[PATCH net-next] ixgbe: implement get_queue_stats_rx

Kshitiz Bartariya posted 1 patch 5 days, 16 hours ago
There is a newer version of this series
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
[PATCH net-next] ixgbe: implement get_queue_stats_rx
Posted by Kshitiz Bartariya 5 days, 16 hours ago
Hook into the netdev_stat_ops interface to expose per RX queue
statistics through the netdev generic netlink API.

The following counters are filled:

 - alloc_fail: sum of alloc_rx_page_failed and alloc_rx_buff_failed

 - csum_bad: maps directly to csum_err, which is incremented for both
   IP header and L4 checksum errors in ixgbe_rx_checksum().

Signed-off-by: Kshitiz Bartariya <kshitiz.bartariya@zohomail.in>
---
This patch was previously discussed for the net tree:
Link: https://lore.kernel.org/lkml/20260526074744.36315-1-kshitiz.bartariya@zohomail.in/

Sending to net-next as suggested by Jacob Keller and Aleksandr Loktionov.


 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index bc16e4c93fd4..05d4b8aff1fc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9759,6 +9759,21 @@ static void ixgbe_get_stats64(struct net_device *netdev,
 	stats->rx_missed_errors	= netdev->stats.rx_missed_errors;
 }
 
+static void ixgbe_get_queue_stats_rx(struct net_device *dev, int idx,
+				     struct netdev_queue_stats_rx *stats)
+{
+	struct ixgbe_adapter *adapter = ixgbe_from_netdev(dev);
+	struct ixgbe_ring *ring = adapter->rx_ring[idx];
+
+	stats->alloc_fail = ring->rx_stats.alloc_rx_page_failed +
+			    ring->rx_stats.alloc_rx_buff_failed;
+	stats->csum_bad = ring->rx_stats.csum_err;
+}
+
+static const struct netdev_stat_ops ixgbe_stat_ops = {
+	.get_queue_stats_rx	= ixgbe_get_queue_stats_rx,
+};
+
 static int ixgbe_ndo_get_vf_stats(struct net_device *netdev, int vf,
 				  struct ifla_vf_stats *vf_stats)
 {
@@ -11662,6 +11677,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	hw->phy.mdio.mdio_write = ixgbe_mdio_write;
 
 	netdev->netdev_ops = &ixgbe_netdev_ops;
+	netdev->stat_ops   = &ixgbe_stat_ops;
 	ixgbe_set_ethtool_ops(netdev);
 	netdev->watchdog_timeo = 5 * HZ;
 	strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name));
-- 
2.50.1 (Apple Git-155)
RE: [Intel-wired-lan] [PATCH net-next] ixgbe: implement get_queue_stats_rx
Posted by Kwapulinski, Piotr 5 days, 11 hours ago
>-----Original Message-----
>From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Kshitiz Bartariya via Intel-wired-lan
>Sent: Tuesday, June 2, 2026 12:09 PM
>To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; andrew+netdev@lunn.ch; davem@davemloft.net; edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>; Keller, Jacob E <jacob.e.keller@intel.com>
>Cc: Kshitiz Bartariya <kshitiz.bartariya@zohomail.in>; intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [Intel-wired-lan] [PATCH net-next] ixgbe: implement get_queue_stats_rx
>
>Hook into the netdev_stat_ops interface to expose per RX queue statistics through the netdev generic netlink API.
>
>The following counters are filled:
>
> - alloc_fail: sum of alloc_rx_page_failed and alloc_rx_buff_failed
>
> - csum_bad: maps directly to csum_err, which is incremented for both
>   IP header and L4 checksum errors in ixgbe_rx_checksum().
>
>Signed-off-by: Kshitiz Bartariya <kshitiz.bartariya@zohomail.in>
>---
>This patch was previously discussed for the net tree:
>Link: https://lore.kernel.org/lkml/20260526074744.36315-1-kshitiz.bartariya@zohomail.in/
>
>Sending to net-next as suggested by Jacob Keller and Aleksandr Loktionov.
>
>
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
>diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
>index bc16e4c93fd4..05d4b8aff1fc 100644
>--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
>+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
>@@ -9759,6 +9759,21 @@ static void ixgbe_get_stats64(struct net_device *netdev,
> 	stats->rx_missed_errors	= netdev->stats.rx_missed_errors;
> }
> 
>+static void ixgbe_get_queue_stats_rx(struct net_device *dev, int idx,
>+				     struct netdev_queue_stats_rx *stats) {
>+	struct ixgbe_adapter *adapter = ixgbe_from_netdev(dev);
>+	struct ixgbe_ring *ring = adapter->rx_ring[idx];
>+
>+	stats->alloc_fail = ring->rx_stats.alloc_rx_page_failed +
>+			    ring->rx_stats.alloc_rx_buff_failed;
>+	stats->csum_bad = ring->rx_stats.csum_err; }
>+
>+static const struct netdev_stat_ops ixgbe_stat_ops = {
>+	.get_queue_stats_rx	= ixgbe_get_queue_stats_rx,
>+};
>+
> static int ixgbe_ndo_get_vf_stats(struct net_device *netdev, int vf,
> 				  struct ifla_vf_stats *vf_stats)
> {
>@@ -11662,6 +11677,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> 	hw->phy.mdio.mdio_write = ixgbe_mdio_write;
> 
> 	netdev->netdev_ops = &ixgbe_netdev_ops;
>+	netdev->stat_ops   = &ixgbe_stat_ops;
> 	ixgbe_set_ethtool_ops(netdev);
> 	netdev->watchdog_timeo = 5 * HZ;
> 	strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name));
>--
>2.50.1 (Apple Git-155)

Reviewed-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
RE: [PATCH net-next] ixgbe: implement get_queue_stats_rx
Posted by Jagielski, Jedrzej 5 days, 13 hours ago
From: Kshitiz Bartariya <kshitiz.bartariya@zohomail.in> 
Sent: Tuesday, June 2, 2026 12:09 PM

>Hook into the netdev_stat_ops interface to expose per RX queue
>statistics through the netdev generic netlink API.
>
>The following counters are filled:
>
> - alloc_fail: sum of alloc_rx_page_failed and alloc_rx_buff_failed
>
> - csum_bad: maps directly to csum_err, which is incremented for both
>   IP header and L4 checksum errors in ixgbe_rx_checksum().
>
>Signed-off-by: Kshitiz Bartariya <kshitiz.bartariya@zohomail.in>
>---
>This patch was previously discussed for the net tree:
>Link: https://lore.kernel.org/lkml/20260526074744.36315-1-kshitiz.bartariya@zohomail.in/
>
>Sending to net-next as suggested by Jacob Keller and Aleksandr Loktionov.
>
>
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)


LGTM
Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>

One nit - you can add exact cmd collecting the stats to the commit msg

By any chance was it tested on real HW?