]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "selftests/bpf: Implement get_hw_ring_size function to retrieve current and...
authorPu Lehui <pulehui@huawei.com>
Thu, 31 Oct 2024 06:37:02 +0000 (06:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Nov 2024 12:19:38 +0000 (13:19 +0100)
This reverts commit c8c590f07ad7ffaa6ef11e90b81202212077497b which is
commit 90a695c3d31e1c9f0adb8c4c80028ed4ea7ed5ab upstream.

Commit c8c590f07ad7 ("selftests/bpf: Implement get_hw_ring_size function
to retrieve current and max interface size") will cause the following
bpf selftests compilation error in the 6.6 stable branch, and it is not
the Stable-dep-of of commit 103c0431c7fb ("selftests/bpf: Drop unneeded
error.h includes"). So let's revert commit c8c590f07ad7 to fix this
compilation error.

  ./network_helpers.h:66:43: error: 'struct ethtool_ringparam' declared
    inside parameter list will not be visible outside of this definition or
    declaration [-Werror]
      66 | int get_hw_ring_size(char *ifname, struct ethtool_ringparam *ring_param);

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/bpf/network_helpers.c
tools/testing/selftests/bpf/network_helpers.h
tools/testing/selftests/bpf/prog_tests/flow_dissector.c
tools/testing/selftests/bpf/xdp_hw_metadata.c

index d2acc88752126ccead1f5a90e2a7d3821becbcfc..0877b60ec81f69f57afd8042004fa3e65112fb68 100644 (file)
@@ -465,27 +465,3 @@ int get_socket_local_port(int sock_fd)
 
        return -1;
 }
-
-int get_hw_ring_size(char *ifname, struct ethtool_ringparam *ring_param)
-{
-       struct ifreq ifr = {0};
-       int sockfd, err;
-
-       sockfd = socket(AF_INET, SOCK_DGRAM, 0);
-       if (sockfd < 0)
-               return -errno;
-
-       memcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-
-       ring_param->cmd = ETHTOOL_GRINGPARAM;
-       ifr.ifr_data = (char *)ring_param;
-
-       if (ioctl(sockfd, SIOCETHTOOL, &ifr) < 0) {
-               err = errno;
-               close(sockfd);
-               return -err;
-       }
-
-       close(sockfd);
-       return 0;
-}
index 11cbe194769b16edf17ceaa896dc0d92746f291b..5eccc67d1a9989855de834db41d45d00f8b0ea82 100644 (file)
@@ -9,11 +9,8 @@ typedef __u16 __sum16;
 #include <linux/if_packet.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
-#include <linux/ethtool.h>
-#include <linux/sockios.h>
 #include <netinet/tcp.h>
 #include <bpf/bpf_endian.h>
-#include <net/if.h>
 
 #define MAGIC_VAL 0x1234
 #define NUM_ITER 100000
@@ -63,7 +60,6 @@ int make_sockaddr(int family, const char *addr_str, __u16 port,
                  struct sockaddr_storage *addr, socklen_t *len);
 char *ping_command(int family);
 int get_socket_local_port(int sock_fd);
-int get_hw_ring_size(char *ifname, struct ethtool_ringparam *ring_param);
 
 struct nstoken;
 /**
index 3171047414a7dc77b83bf109bd869ece39750e0f..b81046806579870f7f42472381c69739256fbe88 100644 (file)
@@ -2,6 +2,7 @@
 #define _GNU_SOURCE
 #include <test_progs.h>
 #include <network_helpers.h>
+#include <linux/if.h>
 #include <linux/if_tun.h>
 #include <sys/uio.h>
 
index 79f2da8f6ead631b703df1108f0934973d62b34d..adb77c1a6a74048c3f0b480535aad399a69ad939 100644 (file)
@@ -288,6 +288,20 @@ static int verify_metadata(struct xsk *rx_xsk, int rxq, int server_fd, clockid_t
        return 0;
 }
 
+struct ethtool_channels {
+       __u32   cmd;
+       __u32   max_rx;
+       __u32   max_tx;
+       __u32   max_other;
+       __u32   max_combined;
+       __u32   rx_count;
+       __u32   tx_count;
+       __u32   other_count;
+       __u32   combined_count;
+};
+
+#define ETHTOOL_GCHANNELS      0x0000003c /* Get no of channels */
+
 static int rxq_num(const char *ifname)
 {
        struct ethtool_channels ch = {