Skip to content

Commit 5337d29

Browse files
Yajun Denganguy11
authored andcommitted
i40e: Add rx_missed_errors for buffer exhaustion
As the comment in struct rtnl_link_stats64, rx_dropped should not include packets dropped by the device due to buffer exhaustion. They are counted in rx_missed_errors, procfs folds those two counters together. Add rx_missed_errors for buffer exhaustion, rx_missed_errors corresponds to rx_discards, rx_dropped corresponds to rx_discards_other. Signed-off-by: Yajun Deng <yajun.deng@linux.dev> Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 8989682 commit 5337d29

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ static const struct i40e_stats i40e_gstrings_net_stats[] = {
245245
I40E_NETDEV_STAT(rx_errors),
246246
I40E_NETDEV_STAT(tx_errors),
247247
I40E_NETDEV_STAT(rx_dropped),
248+
I40E_NETDEV_STAT(rx_missed_errors),
248249
I40E_NETDEV_STAT(tx_dropped),
249250
I40E_NETDEV_STAT(collisions),
250251
I40E_NETDEV_STAT(rx_length_errors),
@@ -321,7 +322,7 @@ static const struct i40e_stats i40e_gstrings_stats[] = {
321322
I40E_PF_STAT("port.rx_broadcast", stats.eth.rx_broadcast),
322323
I40E_PF_STAT("port.tx_broadcast", stats.eth.tx_broadcast),
323324
I40E_PF_STAT("port.tx_errors", stats.eth.tx_errors),
324-
I40E_PF_STAT("port.rx_dropped", stats.eth.rx_discards),
325+
I40E_PF_STAT("port.rx_discards", stats.eth.rx_discards),
325326
I40E_PF_STAT("port.tx_dropped_link_down", stats.tx_dropped_link_down),
326327
I40E_PF_STAT("port.rx_crc_errors", stats.crc_errors),
327328
I40E_PF_STAT("port.illegal_bytes", stats.illegal_bytes),

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ static void i40e_get_netdev_stats_struct(struct net_device *netdev,
489489
stats->tx_dropped = vsi_stats->tx_dropped;
490490
stats->rx_errors = vsi_stats->rx_errors;
491491
stats->rx_dropped = vsi_stats->rx_dropped;
492+
stats->rx_missed_errors = vsi_stats->rx_missed_errors;
492493
stats->rx_crc_errors = vsi_stats->rx_crc_errors;
493494
stats->rx_length_errors = vsi_stats->rx_length_errors;
494495
}
@@ -680,17 +681,13 @@ i40e_stats_update_rx_discards(struct i40e_vsi *vsi, struct i40e_hw *hw,
680681
struct i40e_eth_stats *stat_offset,
681682
struct i40e_eth_stats *stat)
682683
{
683-
u64 rx_rdpc, rx_rxerr;
684-
685684
i40e_stat_update32(hw, I40E_GLV_RDPC(stat_idx), offset_loaded,
686-
&stat_offset->rx_discards, &rx_rdpc);
685+
&stat_offset->rx_discards, &stat->rx_discards);
687686
i40e_stat_update64(hw,
688687
I40E_GL_RXERR1H(i40e_compute_pci_to_hw_id(vsi, hw)),
689688
I40E_GL_RXERR1L(i40e_compute_pci_to_hw_id(vsi, hw)),
690689
offset_loaded, &stat_offset->rx_discards_other,
691-
&rx_rxerr);
692-
693-
stat->rx_discards = rx_rdpc + rx_rxerr;
690+
&stat->rx_discards_other);
694691
}
695692

696693
/**
@@ -712,9 +709,6 @@ void i40e_update_eth_stats(struct i40e_vsi *vsi)
712709
i40e_stat_update32(hw, I40E_GLV_TEPC(stat_idx),
713710
vsi->stat_offsets_loaded,
714711
&oes->tx_errors, &es->tx_errors);
715-
i40e_stat_update32(hw, I40E_GLV_RDPC(stat_idx),
716-
vsi->stat_offsets_loaded,
717-
&oes->rx_discards, &es->rx_discards);
718712
i40e_stat_update32(hw, I40E_GLV_RUPP(stat_idx),
719713
vsi->stat_offsets_loaded,
720714
&oes->rx_unknown_protocol, &es->rx_unknown_protocol);
@@ -971,8 +965,10 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
971965
ns->tx_errors = es->tx_errors;
972966
ons->multicast = oes->rx_multicast;
973967
ns->multicast = es->rx_multicast;
974-
ons->rx_dropped = oes->rx_discards;
975-
ns->rx_dropped = es->rx_discards;
968+
ons->rx_dropped = oes->rx_discards_other;
969+
ns->rx_dropped = es->rx_discards_other;
970+
ons->rx_missed_errors = oes->rx_discards;
971+
ns->rx_missed_errors = es->rx_discards;
976972
ons->tx_dropped = oes->tx_discards;
977973
ns->tx_dropped = es->tx_discards;
978974

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4916,7 +4916,7 @@ int i40e_get_vf_stats(struct net_device *netdev, int vf_id,
49164916
vf_stats->tx_bytes = stats->tx_bytes;
49174917
vf_stats->broadcast = stats->rx_broadcast;
49184918
vf_stats->multicast = stats->rx_multicast;
4919-
vf_stats->rx_dropped = stats->rx_discards;
4919+
vf_stats->rx_dropped = stats->rx_discards + stats->rx_discards_other;
49204920
vf_stats->tx_dropped = stats->tx_discards;
49214921

49224922
return 0;

0 commit comments

Comments
 (0)