[PATCH v2 iwl-next 1/2] igbvf: add lbtx_packets and lbtx_bytes to ethtool statistics

Kohei Enju posted 2 patches 1 month, 2 weeks ago
[PATCH v2 iwl-next 1/2] igbvf: add lbtx_packets and lbtx_bytes to ethtool statistics
Posted by Kohei Enju 1 month, 2 weeks ago
Currently ethtool shows lbrx_packets and lbrx_bytes (Good RX
Packets/Octets loopback Count), but doesn't show the TX-side equivalents
(lbtx_packets and lbtx_bytes). Add visibility of those missing
statistics by adding them to ethtool statistics.

In addition, the order of lbrx_bytes and lbrx_packets is not consistent
with non-loopback statistics (rx_packets, rx_bytes). Therefore,
align the order by swapping positions of lbrx_bytes and lbrx_packets.

Tested on Intel Corporation I350 Gigabit Network Connection.

Before:
  # ethtool -S ens5 | grep -E "x_(bytes|packets)"
       rx_packets: 135
       tx_packets: 106
       rx_bytes: 16010
       tx_bytes: 12451
       lbrx_bytes: 1148
       lbrx_packets: 12

After:
  # ethtool -S ens5 | grep -E "x_(bytes|packets)"
       rx_packets: 748
       tx_packets: 304
       rx_bytes: 81513
       tx_bytes: 33698
       lbrx_packets: 97
       lbtx_packets: 109
       lbrx_bytes: 12090
       lbtx_bytes: 12401

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Kohei Enju <enjuk@amazon.com>
---
 drivers/net/ethernet/intel/igbvf/ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c
index 773895c663fd..c6defc495f13 100644
--- a/drivers/net/ethernet/intel/igbvf/ethtool.c
+++ b/drivers/net/ethernet/intel/igbvf/ethtool.c
@@ -30,8 +30,10 @@ static const struct igbvf_stats igbvf_gstrings_stats[] = {
 	{ "rx_bytes", IGBVF_STAT(stats.gorc, stats.base_gorc) },
 	{ "tx_bytes", IGBVF_STAT(stats.gotc, stats.base_gotc) },
 	{ "multicast", IGBVF_STAT(stats.mprc, stats.base_mprc) },
-	{ "lbrx_bytes", IGBVF_STAT(stats.gorlbc, stats.base_gorlbc) },
 	{ "lbrx_packets", IGBVF_STAT(stats.gprlbc, stats.base_gprlbc) },
+	{ "lbtx_packets", IGBVF_STAT(stats.gptlbc, stats.base_gptlbc) },
+	{ "lbrx_bytes", IGBVF_STAT(stats.gorlbc, stats.base_gorlbc) },
+	{ "lbtx_bytes", IGBVF_STAT(stats.gotlbc, stats.base_gotlbc) },
 	{ "tx_restart_queue", IGBVF_STAT(restart_queue, zero_base) },
 	{ "tx_timeout_count", IGBVF_STAT(tx_timeout_count, zero_base) },
 	{ "rx_long_byte_count", IGBVF_STAT(stats.gorc, stats.base_gorc) },
-- 
2.48.1
Re: [PATCH v2 iwl-next 1/2] igbvf: add lbtx_packets and lbtx_bytes to ethtool statistics
Posted by Simon Horman 1 month, 1 week ago
On Tue, Aug 19, 2025 at 12:18:26AM +0900, Kohei Enju wrote:
> Currently ethtool shows lbrx_packets and lbrx_bytes (Good RX
> Packets/Octets loopback Count), but doesn't show the TX-side equivalents
> (lbtx_packets and lbtx_bytes). Add visibility of those missing
> statistics by adding them to ethtool statistics.
> 
> In addition, the order of lbrx_bytes and lbrx_packets is not consistent
> with non-loopback statistics (rx_packets, rx_bytes). Therefore,
> align the order by swapping positions of lbrx_bytes and lbrx_packets.
> 
> Tested on Intel Corporation I350 Gigabit Network Connection.
> 
> Before:
>   # ethtool -S ens5 | grep -E "x_(bytes|packets)"
>        rx_packets: 135
>        tx_packets: 106
>        rx_bytes: 16010
>        tx_bytes: 12451
>        lbrx_bytes: 1148
>        lbrx_packets: 12
> 
> After:
>   # ethtool -S ens5 | grep -E "x_(bytes|packets)"
>        rx_packets: 748
>        tx_packets: 304
>        rx_bytes: 81513
>        tx_bytes: 33698
>        lbrx_packets: 97
>        lbtx_packets: 109
>        lbrx_bytes: 12090
>        lbtx_bytes: 12401
> 
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Signed-off-by: Kohei Enju <enjuk@amazon.com>

Reviewed-by: Simon Horman <horms@kernel.org>
RE: [Intel-wired-lan] [PATCH v2 iwl-next 1/2] igbvf: add lbtx_packets and lbtx_bytes to ethtool statistics
Posted by Romanowski, Rafal 1 month ago
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Simon
> Horman
> Sent: Wednesday, August 27, 2025 2:27 PM
> To: Kohei Enju <enjuk@amazon.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; Nguyen, Anthony L <anthony.l.nguyen@intel.com>;
> Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; kohei.enju@gmail.com; Paul Menzel
> <pmenzel@molgen.mpg.de>
> Subject: Re: [Intel-wired-lan] [PATCH v2 iwl-next 1/2] igbvf: add lbtx_packets and
> lbtx_bytes to ethtool statistics
> 
> On Tue, Aug 19, 2025 at 12:18:26AM +0900, Kohei Enju wrote:
> > Currently ethtool shows lbrx_packets and lbrx_bytes (Good RX
> > Packets/Octets loopback Count), but doesn't show the TX-side
> > equivalents (lbtx_packets and lbtx_bytes). Add visibility of those
> > missing statistics by adding them to ethtool statistics.
> >
> > In addition, the order of lbrx_bytes and lbrx_packets is not
> > consistent with non-loopback statistics (rx_packets, rx_bytes).
> > Therefore, align the order by swapping positions of lbrx_bytes and lbrx_packets.
> >
> > Tested on Intel Corporation I350 Gigabit Network Connection.
> >
> > Before:
> >   # ethtool -S ens5 | grep -E "x_(bytes|packets)"
> >        rx_packets: 135
> >        tx_packets: 106
> >        rx_bytes: 16010
> >        tx_bytes: 12451
> >        lbrx_bytes: 1148
> >        lbrx_packets: 12
> >
> > After:
> >   # ethtool -S ens5 | grep -E "x_(bytes|packets)"
> >        rx_packets: 748
> >        tx_packets: 304
> >        rx_bytes: 81513
> >        tx_bytes: 33698
> >        lbrx_packets: 97
> >        lbtx_packets: 109
> >        lbrx_bytes: 12090
> >        lbtx_bytes: 12401
> >
> > Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
> > Signed-off-by: Kohei Enju <enjuk@amazon.com>
> 
> Reviewed-by: Simon Horman <horms@kernel.org>


Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
RE: [Intel-wired-lan] [PATCH v2 iwl-next 1/2] igbvf: add lbtx_packets and lbtx_bytes to ethtool statistics
Posted by Loktionov, Aleksandr 1 month, 2 weeks ago

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Kohei Enju
> Sent: Monday, August 18, 2025 5:18 PM
> To: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; kohei.enju@gmail.com; Kohei Enju
> <enjuk@amazon.com>; Paul Menzel <pmenzel@molgen.mpg.de>
> Subject: [Intel-wired-lan] [PATCH v2 iwl-next 1/2] igbvf: add
> lbtx_packets and lbtx_bytes to ethtool statistics
> 
> Currently ethtool shows lbrx_packets and lbrx_bytes (Good RX
> Packets/Octets loopback Count), but doesn't show the TX-side
> equivalents (lbtx_packets and lbtx_bytes). Add visibility of those
> missing statistics by adding them to ethtool statistics.
> 
> In addition, the order of lbrx_bytes and lbrx_packets is not
> consistent with non-loopback statistics (rx_packets, rx_bytes).
> Therefore, align the order by swapping positions of lbrx_bytes and
> lbrx_packets.
> 
> Tested on Intel Corporation I350 Gigabit Network Connection.
> 
> Before:
>   # ethtool -S ens5 | grep -E "x_(bytes|packets)"
>        rx_packets: 135
>        tx_packets: 106
>        rx_bytes: 16010
>        tx_bytes: 12451
>        lbrx_bytes: 1148
>        lbrx_packets: 12
> 
> After:
>   # ethtool -S ens5 | grep -E "x_(bytes|packets)"
>        rx_packets: 748
>        tx_packets: 304
>        rx_bytes: 81513
>        tx_bytes: 33698
>        lbrx_packets: 97
>        lbtx_packets: 109
>        lbrx_bytes: 12090
>        lbtx_bytes: 12401
> 
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Signed-off-by: Kohei Enju <enjuk@amazon.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

> ---
>  drivers/net/ethernet/intel/igbvf/ethtool.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c
> b/drivers/net/ethernet/intel/igbvf/ethtool.c
> index 773895c663fd..c6defc495f13 100644
> --- a/drivers/net/ethernet/intel/igbvf/ethtool.c
> +++ b/drivers/net/ethernet/intel/igbvf/ethtool.c
> @@ -30,8 +30,10 @@ static const struct igbvf_stats
> igbvf_gstrings_stats[] = {
>  	{ "rx_bytes", IGBVF_STAT(stats.gorc, stats.base_gorc) },
>  	{ "tx_bytes", IGBVF_STAT(stats.gotc, stats.base_gotc) },
>  	{ "multicast", IGBVF_STAT(stats.mprc, stats.base_mprc) },
> -	{ "lbrx_bytes", IGBVF_STAT(stats.gorlbc, stats.base_gorlbc) },
>  	{ "lbrx_packets", IGBVF_STAT(stats.gprlbc, stats.base_gprlbc)
> },
> +	{ "lbtx_packets", IGBVF_STAT(stats.gptlbc, stats.base_gptlbc)
> },
> +	{ "lbrx_bytes", IGBVF_STAT(stats.gorlbc, stats.base_gorlbc) },
> +	{ "lbtx_bytes", IGBVF_STAT(stats.gotlbc, stats.base_gotlbc) },
>  	{ "tx_restart_queue", IGBVF_STAT(restart_queue, zero_base) },
>  	{ "tx_timeout_count", IGBVF_STAT(tx_timeout_count, zero_base)
> },
>  	{ "rx_long_byte_count", IGBVF_STAT(stats.gorc, stats.base_gorc)
> },
> --
> 2.48.1