@@ -159,12 +159,27 @@ static int ethtool_stats(int fd, struct ifreq *ifr, odp_pktio_stats_t *stats)
return 0;
}
-int ethtool_stats_get_fd(int fd, const char *name, odp_pktio_stats_t *stats)
+int ethtool_stats_get_fd(int fd, const char *netif_name,
+ odp_pktio_stats_t *stats)
{
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
- snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", name);
+ snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", netif_name);
return ethtool_stats(fd, &ifr, stats);
}
+
+int ethtool_ringparam_get_fd(int fd, const char *netif_name,
+ struct ethtool_ringparam *param)
+{
+ struct ifreq ifr;
+
+ memset(&ifr, 0, sizeof(ifr));
+ snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", netif_name);
+
+ param->cmd = ETHTOOL_GRINGPARAM;
+ ifr.ifr_data = (void *)param;
+
+ return ioctl(fd, SIOCETHTOOL, &ifr);
+}
@@ -7,9 +7,32 @@
#ifndef ODP_PKTIO_ETHTOOL_H_
#define ODP_PKTIO_ETHTOOL_H_
+#include <linux/ethtool.h>
+
+/**
+ * Get statistics for a network interface
+ *
+ * @param fd Arbitrary socket file descriptor
+ * @param netif_name Network interface name
+ * @param stats[out] Output buffer for counters
+ *
+ * @retval 0 on success
+ * @retval != 0 on failure
+ */
+int ethtool_stats_get_fd(int fd, const char *netif_name,
+ odp_pktio_stats_t *stats);
+
/**
- * Get ethtool statistics of a packet socket
+ * Get RX/TX queue parameters for a network interface
+ *
+ * @param fd Arbitrary socket file descriptor
+ * @param netif_name Network interface name
+ * @param param[out] Output buffer for parameters
+ *
+ * @retval 0 on success
+ * @retval != 0 on failure
*/
-int ethtool_stats_get_fd(int fd, const char *name, odp_pktio_stats_t *stats);
+int ethtool_ringparam_get_fd(int fd, const char *netif_name,
+ struct ethtool_ringparam *param);
#endif /*ODP_PKTIO_ETHTOOL_H_*/