Skip to content

Commit 931af95

Browse files
Yajun Dengopsiff
authored andcommitted
i40e: Add rx_missed_errors for buffer exhaustion
[ Upstream commit 5337d29 ] 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 <[email protected]> Tested-by: Arpana Arland <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Stable-dep-of: 50b2af451597 ("i40e: report VF tx_dropped with tx_errors instead of tx_discards") Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit a05b3883083ba52dc6d56db05d784a8bd4ad5ed5)
1 parent 2ec1ba5 commit 931af95

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
@@ -246,6 +246,7 @@ static const struct i40e_stats i40e_gstrings_net_stats[] = {
246246
I40E_NETDEV_STAT(rx_errors),
247247
I40E_NETDEV_STAT(tx_errors),
248248
I40E_NETDEV_STAT(rx_dropped),
249+
I40E_NETDEV_STAT(rx_missed_errors),
249250
I40E_NETDEV_STAT(tx_dropped),
250251
I40E_NETDEV_STAT(collisions),
251252
I40E_NETDEV_STAT(rx_length_errors),
@@ -322,7 +323,7 @@ static const struct i40e_stats i40e_gstrings_stats[] = {
322323
I40E_PF_STAT("port.rx_broadcast", stats.eth.rx_broadcast),
323324
I40E_PF_STAT("port.tx_broadcast", stats.eth.tx_broadcast),
324325
I40E_PF_STAT("port.tx_errors", stats.eth.tx_errors),
325-
I40E_PF_STAT("port.rx_dropped", stats.eth.rx_discards),
326+
I40E_PF_STAT("port.rx_discards", stats.eth.rx_discards),
326327
I40E_PF_STAT("port.tx_dropped_link_down", stats.tx_dropped_link_down),
327328
I40E_PF_STAT("port.rx_crc_errors", stats.crc_errors),
328329
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
@@ -509,6 +509,7 @@ static void i40e_get_netdev_stats_struct(struct net_device *netdev,
509509
stats->tx_dropped = vsi_stats->tx_dropped;
510510
stats->rx_errors = vsi_stats->rx_errors;
511511
stats->rx_dropped = vsi_stats->rx_dropped;
512+
stats->rx_missed_errors = vsi_stats->rx_missed_errors;
512513
stats->rx_crc_errors = vsi_stats->rx_crc_errors;
513514
stats->rx_length_errors = vsi_stats->rx_length_errors;
514515
}
@@ -700,17 +701,13 @@ i40e_stats_update_rx_discards(struct i40e_vsi *vsi, struct i40e_hw *hw,
700701
struct i40e_eth_stats *stat_offset,
701702
struct i40e_eth_stats *stat)
702703
{
703-
u64 rx_rdpc, rx_rxerr;
704-
705704
i40e_stat_update32(hw, I40E_GLV_RDPC(stat_idx), offset_loaded,
706-
&stat_offset->rx_discards, &rx_rdpc);
705+
&stat_offset->rx_discards, &stat->rx_discards);
707706
i40e_stat_update64(hw,
708707
I40E_GL_RXERR1H(i40e_compute_pci_to_hw_id(vsi, hw)),
709708
I40E_GL_RXERR1L(i40e_compute_pci_to_hw_id(vsi, hw)),
710709
offset_loaded, &stat_offset->rx_discards_other,
711-
&rx_rxerr);
712-
713-
stat->rx_discards = rx_rdpc + rx_rxerr;
710+
&stat->rx_discards_other);
714711
}
715712

716713
/**
@@ -732,9 +729,6 @@ void i40e_update_eth_stats(struct i40e_vsi *vsi)
732729
i40e_stat_update32(hw, I40E_GLV_TEPC(stat_idx),
733730
vsi->stat_offsets_loaded,
734731
&oes->tx_errors, &es->tx_errors);
735-
i40e_stat_update32(hw, I40E_GLV_RDPC(stat_idx),
736-
vsi->stat_offsets_loaded,
737-
&oes->rx_discards, &es->rx_discards);
738732
i40e_stat_update32(hw, I40E_GLV_RUPP(stat_idx),
739733
vsi->stat_offsets_loaded,
740734
&oes->rx_unknown_protocol, &es->rx_unknown_protocol);
@@ -991,8 +985,10 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
991985
ns->tx_errors = es->tx_errors;
992986
ons->multicast = oes->rx_multicast;
993987
ns->multicast = es->rx_multicast;
994-
ons->rx_dropped = oes->rx_discards;
995-
ns->rx_dropped = es->rx_discards;
988+
ons->rx_dropped = oes->rx_discards_other;
989+
ns->rx_dropped = es->rx_discards_other;
990+
ons->rx_missed_errors = oes->rx_discards;
991+
ns->rx_missed_errors = es->rx_discards;
996992
ons->tx_dropped = oes->tx_discards;
997993
ns->tx_dropped = es->tx_discards;
998994

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5010,7 +5010,7 @@ int i40e_get_vf_stats(struct net_device *netdev, int vf_id,
50105010
vf_stats->tx_bytes = stats->tx_bytes;
50115011
vf_stats->broadcast = stats->rx_broadcast;
50125012
vf_stats->multicast = stats->rx_multicast;
5013-
vf_stats->rx_dropped = stats->rx_discards;
5013+
vf_stats->rx_dropped = stats->rx_discards + stats->rx_discards_other;
50145014
vf_stats->tx_dropped = stats->tx_discards;
50155015

50165016
return 0;

0 commit comments

Comments
 (0)