Skip to content

Commit 2526e44

Browse files
orospanguy11
authored andcommitted
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: 7aae80c ("ice: add port representor ethtool ops and stats") Signed-off-by: Petr Oros <[email protected]> Reviewed-by: Aleksandr Loktionov <[email protected]> Tested-by: Patryk Holda <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent ad85de0 commit 2526e44

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

drivers/net/ethernet/intel/ice/ice_ethtool.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,17 @@ __ice_get_ethtool_stats(struct net_device *netdev,
19301930
int i = 0;
19311931
char *p;
19321932

1933+
if (ice_is_port_repr_netdev(netdev)) {
1934+
ice_update_eth_stats(vsi);
1935+
1936+
for (j = 0; j < ICE_VSI_STATS_LEN; j++) {
1937+
p = (char *)vsi + ice_gstrings_vsi_stats[j].stat_offset;
1938+
data[i++] = (ice_gstrings_vsi_stats[j].sizeof_stat ==
1939+
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
1940+
}
1941+
return;
1942+
}
1943+
19331944
ice_update_pf_stats(pf);
19341945
ice_update_vsi_stats(vsi);
19351946

@@ -1939,9 +1950,6 @@ __ice_get_ethtool_stats(struct net_device *netdev,
19391950
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
19401951
}
19411952

1942-
if (ice_is_port_repr_netdev(netdev))
1943-
return;
1944-
19451953
/* populate per queue stats */
19461954
rcu_read_lock();
19471955

drivers/net/ethernet/intel/ice/ice_repr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* Copyright (C) 2019-2021, Intel Corporation. */
33

44
#include "ice.h"
5+
#include "ice_lib.h"
56
#include "ice_eswitch.h"
67
#include "devlink/devlink.h"
78
#include "devlink/port.h"
@@ -67,7 +68,7 @@ ice_repr_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
6768
return;
6869
vsi = repr->src_vsi;
6970

70-
ice_update_vsi_stats(vsi);
71+
ice_update_eth_stats(vsi);
7172
eth_stats = &vsi->eth_stats;
7273

7374
stats->tx_packets = eth_stats->tx_unicast + eth_stats->tx_broadcast +

0 commit comments

Comments
 (0)