Commit 9e7a5d17 authored by Usha Ketineni's avatar Usha Ketineni Committed by Jeff Kirsher

ice: Fix ethtool port and PFC stats for 4x25G cards

This patch fixes the issue where port and PFC statistics counters are
incrementing at the wrong port with 4x25G cards.
Read the GLPRT port registers using lport parameter instead of pf_id to
update the statistics otherwise the pf_ids are flipped for ports 2 and 3
when read from the HW register PF_FUNC_RID and this is expected as per
hardware specification.
Signed-off-by: default avatarUsha Ketineni <usha.k.ketineni@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent d00ee466
...@@ -500,30 +500,31 @@ void ice_update_dcb_stats(struct ice_pf *pf) ...@@ -500,30 +500,31 @@ void ice_update_dcb_stats(struct ice_pf *pf)
{ {
struct ice_hw_port_stats *prev_ps, *cur_ps; struct ice_hw_port_stats *prev_ps, *cur_ps;
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
u8 pf_id = hw->pf_id; u8 port;
int i; int i;
port = hw->port_info->lport;
prev_ps = &pf->stats_prev; prev_ps = &pf->stats_prev;
cur_ps = &pf->stats; cur_ps = &pf->stats;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
ice_stat_update32(hw, GLPRT_PXOFFRXC(pf_id, i), ice_stat_update32(hw, GLPRT_PXOFFRXC(port, i),
pf->stat_prev_loaded, pf->stat_prev_loaded,
&prev_ps->priority_xoff_rx[i], &prev_ps->priority_xoff_rx[i],
&cur_ps->priority_xoff_rx[i]); &cur_ps->priority_xoff_rx[i]);
ice_stat_update32(hw, GLPRT_PXONRXC(pf_id, i), ice_stat_update32(hw, GLPRT_PXONRXC(port, i),
pf->stat_prev_loaded, pf->stat_prev_loaded,
&prev_ps->priority_xon_rx[i], &prev_ps->priority_xon_rx[i],
&cur_ps->priority_xon_rx[i]); &cur_ps->priority_xon_rx[i]);
ice_stat_update32(hw, GLPRT_PXONTXC(pf_id, i), ice_stat_update32(hw, GLPRT_PXONTXC(port, i),
pf->stat_prev_loaded, pf->stat_prev_loaded,
&prev_ps->priority_xon_tx[i], &prev_ps->priority_xon_tx[i],
&cur_ps->priority_xon_tx[i]); &cur_ps->priority_xon_tx[i]);
ice_stat_update32(hw, GLPRT_PXOFFTXC(pf_id, i), ice_stat_update32(hw, GLPRT_PXOFFTXC(port, i),
pf->stat_prev_loaded, pf->stat_prev_loaded,
&prev_ps->priority_xoff_tx[i], &prev_ps->priority_xoff_tx[i],
&cur_ps->priority_xoff_tx[i]); &cur_ps->priority_xoff_tx[i]);
ice_stat_update32(hw, GLPRT_RXON2OFFCNT(pf_id, i), ice_stat_update32(hw, GLPRT_RXON2OFFCNT(port, i),
pf->stat_prev_loaded, pf->stat_prev_loaded,
&prev_ps->priority_xon_2_xoff[i], &prev_ps->priority_xon_2_xoff[i],
&cur_ps->priority_xon_2_xoff[i]); &cur_ps->priority_xon_2_xoff[i]);
......
...@@ -3262,25 +3262,25 @@ void ice_update_pf_stats(struct ice_pf *pf) ...@@ -3262,25 +3262,25 @@ void ice_update_pf_stats(struct ice_pf *pf)
{ {
struct ice_hw_port_stats *prev_ps, *cur_ps; struct ice_hw_port_stats *prev_ps, *cur_ps;
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
u8 pf_id; u8 port;
port = hw->port_info->lport;
prev_ps = &pf->stats_prev; prev_ps = &pf->stats_prev;
cur_ps = &pf->stats; cur_ps = &pf->stats;
pf_id = hw->pf_id;
ice_stat_update40(hw, GLPRT_GORCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_GORCL(port), pf->stat_prev_loaded,
&prev_ps->eth.rx_bytes, &prev_ps->eth.rx_bytes,
&cur_ps->eth.rx_bytes); &cur_ps->eth.rx_bytes);
ice_stat_update40(hw, GLPRT_UPRCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_UPRCL(port), pf->stat_prev_loaded,
&prev_ps->eth.rx_unicast, &prev_ps->eth.rx_unicast,
&cur_ps->eth.rx_unicast); &cur_ps->eth.rx_unicast);
ice_stat_update40(hw, GLPRT_MPRCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_MPRCL(port), pf->stat_prev_loaded,
&prev_ps->eth.rx_multicast, &prev_ps->eth.rx_multicast,
&cur_ps->eth.rx_multicast); &cur_ps->eth.rx_multicast);
ice_stat_update40(hw, GLPRT_BPRCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_BPRCL(port), pf->stat_prev_loaded,
&prev_ps->eth.rx_broadcast, &prev_ps->eth.rx_broadcast,
&cur_ps->eth.rx_broadcast); &cur_ps->eth.rx_broadcast);
...@@ -3288,109 +3288,109 @@ void ice_update_pf_stats(struct ice_pf *pf) ...@@ -3288,109 +3288,109 @@ void ice_update_pf_stats(struct ice_pf *pf)
&prev_ps->eth.rx_discards, &prev_ps->eth.rx_discards,
&cur_ps->eth.rx_discards); &cur_ps->eth.rx_discards);
ice_stat_update40(hw, GLPRT_GOTCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_GOTCL(port), pf->stat_prev_loaded,
&prev_ps->eth.tx_bytes, &prev_ps->eth.tx_bytes,
&cur_ps->eth.tx_bytes); &cur_ps->eth.tx_bytes);
ice_stat_update40(hw, GLPRT_UPTCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_UPTCL(port), pf->stat_prev_loaded,
&prev_ps->eth.tx_unicast, &prev_ps->eth.tx_unicast,
&cur_ps->eth.tx_unicast); &cur_ps->eth.tx_unicast);
ice_stat_update40(hw, GLPRT_MPTCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_MPTCL(port), pf->stat_prev_loaded,
&prev_ps->eth.tx_multicast, &prev_ps->eth.tx_multicast,
&cur_ps->eth.tx_multicast); &cur_ps->eth.tx_multicast);
ice_stat_update40(hw, GLPRT_BPTCL(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_BPTCL(port), pf->stat_prev_loaded,
&prev_ps->eth.tx_broadcast, &prev_ps->eth.tx_broadcast,
&cur_ps->eth.tx_broadcast); &cur_ps->eth.tx_broadcast);
ice_stat_update32(hw, GLPRT_TDOLD(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_TDOLD(port), pf->stat_prev_loaded,
&prev_ps->tx_dropped_link_down, &prev_ps->tx_dropped_link_down,
&cur_ps->tx_dropped_link_down); &cur_ps->tx_dropped_link_down);
ice_stat_update40(hw, GLPRT_PRC64L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PRC64L(port), pf->stat_prev_loaded,
&prev_ps->rx_size_64, &cur_ps->rx_size_64); &prev_ps->rx_size_64, &cur_ps->rx_size_64);
ice_stat_update40(hw, GLPRT_PRC127L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PRC127L(port), pf->stat_prev_loaded,
&prev_ps->rx_size_127, &cur_ps->rx_size_127); &prev_ps->rx_size_127, &cur_ps->rx_size_127);
ice_stat_update40(hw, GLPRT_PRC255L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PRC255L(port), pf->stat_prev_loaded,
&prev_ps->rx_size_255, &cur_ps->rx_size_255); &prev_ps->rx_size_255, &cur_ps->rx_size_255);
ice_stat_update40(hw, GLPRT_PRC511L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PRC511L(port), pf->stat_prev_loaded,
&prev_ps->rx_size_511, &cur_ps->rx_size_511); &prev_ps->rx_size_511, &cur_ps->rx_size_511);
ice_stat_update40(hw, GLPRT_PRC1023L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PRC1023L(port), pf->stat_prev_loaded,
&prev_ps->rx_size_1023, &cur_ps->rx_size_1023); &prev_ps->rx_size_1023, &cur_ps->rx_size_1023);
ice_stat_update40(hw, GLPRT_PRC1522L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PRC1522L(port), pf->stat_prev_loaded,
&prev_ps->rx_size_1522, &cur_ps->rx_size_1522); &prev_ps->rx_size_1522, &cur_ps->rx_size_1522);
ice_stat_update40(hw, GLPRT_PRC9522L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PRC9522L(port), pf->stat_prev_loaded,
&prev_ps->rx_size_big, &cur_ps->rx_size_big); &prev_ps->rx_size_big, &cur_ps->rx_size_big);
ice_stat_update40(hw, GLPRT_PTC64L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PTC64L(port), pf->stat_prev_loaded,
&prev_ps->tx_size_64, &cur_ps->tx_size_64); &prev_ps->tx_size_64, &cur_ps->tx_size_64);
ice_stat_update40(hw, GLPRT_PTC127L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PTC127L(port), pf->stat_prev_loaded,
&prev_ps->tx_size_127, &cur_ps->tx_size_127); &prev_ps->tx_size_127, &cur_ps->tx_size_127);
ice_stat_update40(hw, GLPRT_PTC255L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PTC255L(port), pf->stat_prev_loaded,
&prev_ps->tx_size_255, &cur_ps->tx_size_255); &prev_ps->tx_size_255, &cur_ps->tx_size_255);
ice_stat_update40(hw, GLPRT_PTC511L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PTC511L(port), pf->stat_prev_loaded,
&prev_ps->tx_size_511, &cur_ps->tx_size_511); &prev_ps->tx_size_511, &cur_ps->tx_size_511);
ice_stat_update40(hw, GLPRT_PTC1023L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PTC1023L(port), pf->stat_prev_loaded,
&prev_ps->tx_size_1023, &cur_ps->tx_size_1023); &prev_ps->tx_size_1023, &cur_ps->tx_size_1023);
ice_stat_update40(hw, GLPRT_PTC1522L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PTC1522L(port), pf->stat_prev_loaded,
&prev_ps->tx_size_1522, &cur_ps->tx_size_1522); &prev_ps->tx_size_1522, &cur_ps->tx_size_1522);
ice_stat_update40(hw, GLPRT_PTC9522L(pf_id), pf->stat_prev_loaded, ice_stat_update40(hw, GLPRT_PTC9522L(port), pf->stat_prev_loaded,
&prev_ps->tx_size_big, &cur_ps->tx_size_big); &prev_ps->tx_size_big, &cur_ps->tx_size_big);
ice_stat_update32(hw, GLPRT_LXONRXC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_LXONRXC(port), pf->stat_prev_loaded,
&prev_ps->link_xon_rx, &cur_ps->link_xon_rx); &prev_ps->link_xon_rx, &cur_ps->link_xon_rx);
ice_stat_update32(hw, GLPRT_LXOFFRXC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_LXOFFRXC(port), pf->stat_prev_loaded,
&prev_ps->link_xoff_rx, &cur_ps->link_xoff_rx); &prev_ps->link_xoff_rx, &cur_ps->link_xoff_rx);
ice_stat_update32(hw, GLPRT_LXONTXC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_LXONTXC(port), pf->stat_prev_loaded,
&prev_ps->link_xon_tx, &cur_ps->link_xon_tx); &prev_ps->link_xon_tx, &cur_ps->link_xon_tx);
ice_stat_update32(hw, GLPRT_LXOFFTXC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_LXOFFTXC(port), pf->stat_prev_loaded,
&prev_ps->link_xoff_tx, &cur_ps->link_xoff_tx); &prev_ps->link_xoff_tx, &cur_ps->link_xoff_tx);
ice_update_dcb_stats(pf); ice_update_dcb_stats(pf);
ice_stat_update32(hw, GLPRT_CRCERRS(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_CRCERRS(port), pf->stat_prev_loaded,
&prev_ps->crc_errors, &cur_ps->crc_errors); &prev_ps->crc_errors, &cur_ps->crc_errors);
ice_stat_update32(hw, GLPRT_ILLERRC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_ILLERRC(port), pf->stat_prev_loaded,
&prev_ps->illegal_bytes, &cur_ps->illegal_bytes); &prev_ps->illegal_bytes, &cur_ps->illegal_bytes);
ice_stat_update32(hw, GLPRT_MLFC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_MLFC(port), pf->stat_prev_loaded,
&prev_ps->mac_local_faults, &prev_ps->mac_local_faults,
&cur_ps->mac_local_faults); &cur_ps->mac_local_faults);
ice_stat_update32(hw, GLPRT_MRFC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_MRFC(port), pf->stat_prev_loaded,
&prev_ps->mac_remote_faults, &prev_ps->mac_remote_faults,
&cur_ps->mac_remote_faults); &cur_ps->mac_remote_faults);
ice_stat_update32(hw, GLPRT_RLEC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_RLEC(port), pf->stat_prev_loaded,
&prev_ps->rx_len_errors, &cur_ps->rx_len_errors); &prev_ps->rx_len_errors, &cur_ps->rx_len_errors);
ice_stat_update32(hw, GLPRT_RUC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_RUC(port), pf->stat_prev_loaded,
&prev_ps->rx_undersize, &cur_ps->rx_undersize); &prev_ps->rx_undersize, &cur_ps->rx_undersize);
ice_stat_update32(hw, GLPRT_RFC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_RFC(port), pf->stat_prev_loaded,
&prev_ps->rx_fragments, &cur_ps->rx_fragments); &prev_ps->rx_fragments, &cur_ps->rx_fragments);
ice_stat_update32(hw, GLPRT_ROC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_ROC(port), pf->stat_prev_loaded,
&prev_ps->rx_oversize, &cur_ps->rx_oversize); &prev_ps->rx_oversize, &cur_ps->rx_oversize);
ice_stat_update32(hw, GLPRT_RJC(pf_id), pf->stat_prev_loaded, ice_stat_update32(hw, GLPRT_RJC(port), pf->stat_prev_loaded,
&prev_ps->rx_jabber, &cur_ps->rx_jabber); &prev_ps->rx_jabber, &cur_ps->rx_jabber);
pf->stat_prev_loaded = true; pf->stat_prev_loaded = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment