Re: [Intel-wired-lan] [PATCH iwl-net 2/2] ice: use ice_update_eth_stats() for representor stats

From: Holda, Patryk

Date: Thu Mar 19 2026 - 05:40:32 EST





________________________________________
From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> on behalf of Loktionov, Aleksandr <aleksandr.loktionov@xxxxxxxxx>
Sent: Thursday, February 12, 2026 09:24
To: Oros, Petr <poros@xxxxxxxxxx>; netdev@xxxxxxxxxxxxxxx <netdev@xxxxxxxxxxxxxxx>
Cc: Drewek, Wojciech <wojciech.drewek@xxxxxxxxx>; Kitszel, Przemyslaw <przemyslaw.kitszel@xxxxxxxxx>; Eric Dumazet <edumazet@xxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx>; Andrew Lunn <andrew+netdev@xxxxxxx>; Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx>; Simon Horman <horms@xxxxxxxxxx>; Michal Swiatkowski <michal.swiatkowski@xxxxxxxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx <intel-wired-lan@xxxxxxxxxxxxxxxx>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net 2/2] ice: use ice_update_eth_stats() for representor stats




> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf
> Of Petr Oros
> Sent: Thursday, February 12, 2026 8:53 AM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: Drewek, Wojciech <wojciech.drewek@xxxxxxxxx>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Eric Dumazet <edumazet@xxxxxxxxxx>;
> linux-kernel@xxxxxxxxxxxxxxx; Andrew Lunn <andrew+netdev@xxxxxxx>;
> Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx>; Simon Horman
> <horms@xxxxxxxxxx>; Michal Swiatkowski
> <michal.swiatkowski@xxxxxxxxxxxxxxx>; Jakub Kicinski
> <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>; David S. Miller
> <davem@xxxxxxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx
> Subject: [Intel-wired-lan] [PATCH iwl-net 2/2] ice: use
> ice_update_eth_stats() for representor stats
>
> ice_repr_get_stats64() and __ice_get_ethtool_stats() call
> ice_update_vsi_stats() on the VF's src_vsi. This always returns early
> because ICE_VSI_DOWN is permanently set for VF VSIs — ice_up() is
> never called on them since queues are managed by iavf through
> virtchnl.
>
> In __ice_get_ethtool_stats() the original code called
> ice_update_vsi_stats() for all VSIs including representors, iterated
> over ice_gstrings_vsi_stats[] to populate the data, and then bailed
> out with an early return before the per-queue ring stats section. That
> early return was necessary because representor VSIs have no rings on
> the PF side — the rings belong to the VF driver (iavf), so accessing
> per-queue stats would be invalid.
>
> Move the representor handling to the top of __ice_get_ethtool_stats()
> and call ice_update_eth_stats() directly to read the hardware GLV_*
> counters. This matches ice_get_vf_stats() which already uses
> ice_update_eth_stats() for the same VF VSI in legacy mode. Apply the
> same fix to ice_repr_get_stats64().
>
> Note that ice_gstrings_vsi_stats[] contains five software ring
> counters (rx_buf_failed, rx_page_failed, tx_linearize, tx_busy,
> tx_restart) that are always zero for representors since the PF never
> processes packets on VF rings. This is pre-existing behavior unchanged
> by this patch.
>
> Fixes: 7aae80cef7ba ("ice: add port representor ethtool ops and
> stats")
> Signed-off-by: Petr Oros <poros@xxxxxxxxxx>
> ---
>  drivers/net/ethernet/intel/ice/ice_ethtool.c | 14 +++++++++++---
>  drivers/net/ethernet/intel/ice/ice_repr.c    |  3 ++-
>  2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> index 3565a5d96c6d18..0b8775621f1567 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> @@ -1926,6 +1926,17 @@ __ice_get_ethtool_stats(struct net_device
> *netdev,
>        int i = 0;
>        char *p;
>
> +     if (ice_is_port_repr_netdev(netdev)) {
> +             ice_update_eth_stats(vsi);
> +
> +             for (j = 0; j < ICE_VSI_STATS_LEN; j++) {
> +                     p = (char *)vsi +
> ice_gstrings_vsi_stats[j].stat_offset;
> +                     data[i++] =
> (ice_gstrings_vsi_stats[j].sizeof_stat ==
> +                                  sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
> +             }
> +             return;
> +     }
> +
>        ice_update_pf_stats(pf);
>        ice_update_vsi_stats(vsi);
>
> @@ -1935,9 +1946,6 @@ __ice_get_ethtool_stats(struct net_device
> *netdev,
>                             sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
>        }
>
> -     if (ice_is_port_repr_netdev(netdev))
> -             return;
> -
>        /* populate per queue stats */
>        rcu_read_lock();
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c
> b/drivers/net/ethernet/intel/ice/ice_repr.c
> index 2a84f656405828..f1e82ba155cff2 100644
> --- a/drivers/net/ethernet/intel/ice/ice_repr.c
> +++ b/drivers/net/ethernet/intel/ice/ice_repr.c
> @@ -2,6 +2,7 @@
>  /* Copyright (C) 2019-2021, Intel Corporation. */
>
>  #include "ice.h"
> +#include "ice_lib.h"
>  #include "ice_eswitch.h"
>  #include "devlink/devlink.h"
>  #include "devlink/port.h"
> @@ -67,7 +68,7 @@ ice_repr_get_stats64(struct net_device *netdev,
> struct rtnl_link_stats64 *stats)
>                return;
>        vsi = repr->src_vsi;
>
> -     ice_update_vsi_stats(vsi);
> +     ice_update_eth_stats(vsi);
>        eth_stats = &vsi->eth_stats;
>
>        stats->tx_packets = eth_stats->tx_unicast + eth_stats-
> >tx_broadcast +
> --
> 2.52.0


Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>



Tested-by: Patryk Holda <patryk.holda@xxxxxxxxx>
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.