diff mbox series

[net-next,2/4] ixgbe: aggregate of all receive errors through netdev's rx_errors

Message ID 20210409190314.946192-3-anthony.l.nguyen@intel.com
State New
Headers show
Series 10GbE Intel Wired LAN Driver Updates 2021-04-09 | expand

Commit Message

Tony Nguyen April 9, 2021, 7:03 p.m. UTC
From: Radoslaw Tyl <radoslawx.tyl@intel.com>

The global rx error does not take into account all the error counters
that are counted by device.

Extend rx error with the following counters:
- illegal byte error
- number of receive fragment errors
- receive jabber
- receive oversize error
- receive undersize error
- frames marked as checksum invalid by hardware

The above were added in order to align statistics with other products.

Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski April 10, 2021, 1 a.m. UTC | #1
On Fri,  9 Apr 2021 12:03:12 -0700 Tony Nguyen wrote:
> From: Radoslaw Tyl <radoslawx.tyl@intel.com>

> 

> The global rx error does not take into account all the error counters

> that are counted by device.

> 

> Extend rx error with the following counters:

> - illegal byte error

> - number of receive fragment errors

> - receive jabber

> - receive oversize error

> - receive undersize error

> - frames marked as checksum invalid by hardware

> 

> The above were added in order to align statistics with other products.

> 

> Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com>

> Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>

> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

> ---

>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 11 ++++++++++-

>  1 file changed, 10 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

> index 7ba1c2985ef7..7711828401d9 100644

> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

> @@ -7240,12 +7240,21 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)

>  	hwstats->ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023);

>  	hwstats->ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522);

>  	hwstats->bptc += IXGBE_READ_REG(hw, IXGBE_BPTC);

> +	hwstats->illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);

>  

>  	/* Fill out the OS statistics structure */

>  	netdev->stats.multicast = hwstats->mprc;

>  

>  	/* Rx Errors */

> -	netdev->stats.rx_errors = hwstats->crcerrs + hwstats->rlec;

> +	netdev->stats.rx_errors = hwstats->crcerrs +

> +				    hwstats->illerrc +

> +				    hwstats->rlec +

> +				    hwstats->rfc +

> +				    hwstats->rjc +

> +				    hwstats->roc +

> +				    hwstats->ruc +


IDK what the HW counts exactly but perhaps rlec includes other
counters? Note that the stats you add with this patch are RFC 2819 /
RMON counters, and AFAIU they overlap with IEEE counters.

If the RMON counters are somehow exclusively counting their events you
should update rx_length_errors as well.

> +				    hw_csum_rx_error;


AFAICT this is incorrect L4 csum, that's not supposed be counted as NIC
rx_error. Let the appropriate protocol code check this and increment
its own counter.

>  	netdev->stats.rx_dropped = 0;

>  	netdev->stats.rx_length_errors = hwstats->rlec;

>  	netdev->stats.rx_crc_errors = hwstats->crcerrs;
Tony Nguyen April 13, 2021, 11:52 p.m. UTC | #2
On Fri, 2021-04-09 at 18:00 -0700, Jakub Kicinski wrote:
> On Fri,  9 Apr 2021 12:03:12 -0700 Tony Nguyen wrote:

> > From: Radoslaw Tyl <radoslawx.tyl@intel.com>

> > 

> > The global rx error does not take into account all the error

> > counters

> > that are counted by device.

> > 

> > Extend rx error with the following counters:

> > - illegal byte error

> > - number of receive fragment errors

> > - receive jabber

> > - receive oversize error

> > - receive undersize error

> > - frames marked as checksum invalid by hardware

> > 

> > The above were added in order to align statistics with other

> > products.

> > 

> > Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com>

> > Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>

> > Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

> > ---

> >  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 11 ++++++++++-

> >  1 file changed, 10 insertions(+), 1 deletion(-)

> > 

> > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

> > b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

> > index 7ba1c2985ef7..7711828401d9 100644

> > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

> > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

> > @@ -7240,12 +7240,21 @@ void ixgbe_update_stats(struct

> > ixgbe_adapter *adapter)

> >  	hwstats->ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023);

> >  	hwstats->ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522);

> >  	hwstats->bptc += IXGBE_READ_REG(hw, IXGBE_BPTC);

> > +	hwstats->illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);

> >  

> >  	/* Fill out the OS statistics structure */

> >  	netdev->stats.multicast = hwstats->mprc;

> >  

> >  	/* Rx Errors */

> > -	netdev->stats.rx_errors = hwstats->crcerrs + hwstats->rlec;

> > +	netdev->stats.rx_errors = hwstats->crcerrs +

> > +				    hwstats->illerrc +

> > +				    hwstats->rlec +

> > +				    hwstats->rfc +

> > +				    hwstats->rjc +

> > +				    hwstats->roc +

> > +				    hwstats->ruc +

> 

> IDK what the HW counts exactly but perhaps rlec includes other

> counters? Note that the stats you add with this patch are RFC 2819 /

> RMON counters, and AFAIU they overlap with IEEE counters.

> 

> If the RMON counters are somehow exclusively counting their events

> you

> should update rx_length_errors as well.


Thanks for the feedback. I'm going to drop this patch for now so we can
double check that everything is being properly included/excluded.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 7ba1c2985ef7..7711828401d9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7240,12 +7240,21 @@  void ixgbe_update_stats(struct ixgbe_adapter *adapter)
 	hwstats->ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023);
 	hwstats->ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522);
 	hwstats->bptc += IXGBE_READ_REG(hw, IXGBE_BPTC);
+	hwstats->illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
 
 	/* Fill out the OS statistics structure */
 	netdev->stats.multicast = hwstats->mprc;
 
 	/* Rx Errors */
-	netdev->stats.rx_errors = hwstats->crcerrs + hwstats->rlec;
+	netdev->stats.rx_errors = hwstats->crcerrs +
+				    hwstats->illerrc +
+				    hwstats->rlec +
+				    hwstats->rfc +
+				    hwstats->rjc +
+				    hwstats->roc +
+				    hwstats->ruc +
+				    hw_csum_rx_error;
+
 	netdev->stats.rx_dropped = 0;
 	netdev->stats.rx_length_errors = hwstats->rlec;
 	netdev->stats.rx_crc_errors = hwstats->crcerrs;