+done:
+ (void)close(fd);
+}
+
+static void query_iface_rx_queues_from_name(const char *name,
+ uint64_t *rx_queues)
+{
+ int ret = 0;
+ struct ethtool_rxnfc rxcmd;
+ struct ifreq ifr;
+ int fd;
+
+ fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+ if (fd == -1) {
+ DBG_ERR("Failed to open socket.\n");
+ return;
+ }
+
+ if (strlen(name) >= IF_NAMESIZE) {
+ DBG_ERR("Interface name too long.\n");
+ goto done;
+ }
+
+ ZERO_STRUCT(ifr);
+ strlcpy(ifr.ifr_name, name, IF_NAMESIZE);
+
+ ifr.ifr_data = (void *)&rxcmd;
+ ZERO_STRUCT(rxcmd);
+ rxcmd.cmd = ETHTOOL_GRXRINGS;
+ ret = ioctl(fd, SIOCETHTOOL, &ifr);
+ if (ret == -1) {
+ goto done;
+ }
+
+ *rx_queues = rxcmd.data;
+