History

eth: fbnic: Add pause stats support

Add support to read pause stats for fbnic. Unlike FEC and PCS stats, pause stats won't wrap, do not fetch them under the service task. Since, they are exclusively accessed via the ethtool API, don't include them in fbnic_get_hw_stats(). ]# ethtool -I -a eth0 Pause parameters for eth0: Autonegotiate: on RX: off TX: off Statistics: tx_pause_frames: 0 rx_pause_frames: 0

Mohsin Bashir committed 1 year ago

Commit e9faf4d1 parent 33c49376 files · +42 −0Browse files

Unified · Split

6 files
  1. drivers/net/ethernet/meta/fbnic/fbnic_csr.h +4 −0
  2. drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c +17 −0
  3. drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.c +1 −0
  4. drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.h +7 −0
  5. drivers/net/ethernet/meta/fbnic/fbnic_mac.c +11 −0
  6. drivers/net/ethernet/meta/fbnic/fbnic_mac.h +2 −0
drivers/net/ethernet/meta/fbnic/fbnic_csr.h+4−0
@@ -844,6 +844,10 @@ enum { · 843 unmodified lines
844#define FBNIC_CSR_END_SIG 0x1184e /* CSR section delimiter */844#define FBNIC_CSR_END_SIG 0x1184e /* CSR section delimiter */
845 845
846#define FBNIC_CSR_START_MAC_STAT 0x11a00846#define FBNIC_CSR_START_MAC_STAT 0x11a00
847#define FBNIC_MAC_STAT_RX_XOFF_STB_L 0x11a00 /* 0x46800 */
848#define FBNIC_MAC_STAT_RX_XOFF_STB_H 0x11a01 /* 0x46804 */
849#define FBNIC_MAC_STAT_TX_XOFF_STB_L 0x11a04 /* 0x46810 */
850#define FBNIC_MAC_STAT_TX_XOFF_STB_H 0x11a05 /* 0x46814 */
847#define FBNIC_MAC_STAT_RX_BYTE_COUNT_L 0x11a08 /* 0x46820 */851#define FBNIC_MAC_STAT_RX_BYTE_COUNT_L 0x11a08 /* 0x46820 */
848#define FBNIC_MAC_STAT_RX_BYTE_COUNT_H 0x11a09 /* 0x46824 */852#define FBNIC_MAC_STAT_RX_BYTE_COUNT_H 0x11a09 /* 0x46824 */
849#define FBNIC_MAC_STAT_RX_ALIGN_ERROR_L 0x11a0a /* 0x46828 */853#define FBNIC_MAC_STAT_RX_ALIGN_ERROR_L 0x11a0a /* 0x46828 */
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c+17−0
@@ -1641,6 +1641,22 @@ static void fbnic_set_counter(u64 *stat, struct fbnic_stat_counter *counter) · 1640 unmodified lines
1641 *stat = counter->value;1641 *stat = counter->value;
1642}1642}
1643 1643
1644static void
1645fbnic_get_pause_stats(struct net_device *netdev,
1646 struct ethtool_pause_stats *pause_stats)
1647{
1648 struct fbnic_net *fbn = netdev_priv(netdev);
1649 struct fbnic_mac_stats *mac_stats;
1650 struct fbnic_dev *fbd = fbn->fbd;
1651
1652 mac_stats = &fbd->hw_stats.mac;
1653
1654 fbd->mac->get_pause_stats(fbd, false, &mac_stats->pause);
1655
1656 pause_stats->tx_pause_frames = mac_stats->pause.tx_pause_frames.value;
1657 pause_stats->rx_pause_frames = mac_stats->pause.rx_pause_frames.value;
1658}
1659
1644static void1660static void
1645fbnic_get_fec_stats(struct net_device *netdev,1661fbnic_get_fec_stats(struct net_device *netdev,
1646 struct ethtool_fec_stats *fec_stats)1662 struct ethtool_fec_stats *fec_stats)
@@ -1801,6 +1817,7 @@ static const struct ethtool_ops fbnic_ethtool_ops = { · 154 unmodified lines
1801 .set_coalesce = fbnic_set_coalesce,1817 .set_coalesce = fbnic_set_coalesce,
1802 .get_ringparam = fbnic_get_ringparam,1818 .get_ringparam = fbnic_get_ringparam,
1803 .set_ringparam = fbnic_set_ringparam,1819 .set_ringparam = fbnic_set_ringparam,
1820 .get_pause_stats = fbnic_get_pause_stats,
1804 .get_pauseparam = fbnic_phylink_get_pauseparam,1821 .get_pauseparam = fbnic_phylink_get_pauseparam,
1805 .set_pauseparam = fbnic_phylink_set_pauseparam,1822 .set_pauseparam = fbnic_phylink_set_pauseparam,
1806 .get_strings = fbnic_get_strings,1823 .get_strings = fbnic_get_strings,
drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.c+1−0
@@ -536,6 +536,7 @@ static void fbnic_reset_hw_mac_stats(struct fbnic_dev *fbd, · 535 unmodified lines
536 const struct fbnic_mac *mac = fbd->mac;536 const struct fbnic_mac *mac = fbd->mac;
537 537
538 mac->get_eth_mac_stats(fbd, true, &mac_stats->eth_mac);538 mac->get_eth_mac_stats(fbd, true, &mac_stats->eth_mac);
539 mac->get_pause_stats(fbd, true, &mac_stats->pause);
539 mac->get_eth_ctrl_stats(fbd, true, &mac_stats->eth_ctrl);540 mac->get_eth_ctrl_stats(fbd, true, &mac_stats->eth_ctrl);
540 mac->get_rmon_stats(fbd, true, &mac_stats->rmon);541 mac->get_rmon_stats(fbd, true, &mac_stats->rmon);
541}542}
drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.h+7−0
@@ -50,6 +50,12 @@ struct fbnic_rmon_stats { · 49 unmodified lines
50 struct fbnic_stat_counter hist_tx[ETHTOOL_RMON_HIST_MAX];50 struct fbnic_stat_counter hist_tx[ETHTOOL_RMON_HIST_MAX];
51};51};
52 52
53/* Note: not updated by fbnic_get_hw_stats() */
54struct fbnic_pause_stats {
55 struct fbnic_stat_counter tx_pause_frames;
56 struct fbnic_stat_counter rx_pause_frames;
57};
58
53struct fbnic_eth_mac_stats {59struct fbnic_eth_mac_stats {
54 struct fbnic_stat_counter FramesTransmittedOK;60 struct fbnic_stat_counter FramesTransmittedOK;
55 struct fbnic_stat_counter FramesReceivedOK;61 struct fbnic_stat_counter FramesReceivedOK;
@@ -73,6 +79,7 @@ struct fbnic_phy_stats { · 17 unmodified lines
73 79
74struct fbnic_mac_stats {80struct fbnic_mac_stats {
75 struct fbnic_eth_mac_stats eth_mac;81 struct fbnic_eth_mac_stats eth_mac;
82 struct fbnic_pause_stats pause;
76 struct fbnic_eth_ctrl_stats eth_ctrl;83 struct fbnic_eth_ctrl_stats eth_ctrl;
77 struct fbnic_rmon_stats rmon;84 struct fbnic_rmon_stats rmon;
78};85};
drivers/net/ethernet/meta/fbnic/fbnic_mac.c+11−0
@@ -709,6 +709,16 @@ fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset, · 708 unmodified lines
709 MAC_STAT_TX_BROADCAST);709 MAC_STAT_TX_BROADCAST);
710}710}
711 711
712static void
713fbnic_mac_get_pause_stats(struct fbnic_dev *fbd, bool reset,
714 struct fbnic_pause_stats *pause_stats)
715{
716 fbnic_mac_stat_rd64(fbd, reset, pause_stats->tx_pause_frames,
717 MAC_STAT_TX_XOFF_STB);
718 fbnic_mac_stat_rd64(fbd, reset, pause_stats->rx_pause_frames,
719 MAC_STAT_RX_XOFF_STB);
720}
721
712static void722static void
713fbnic_mac_get_eth_ctrl_stats(struct fbnic_dev *fbd, bool reset,723fbnic_mac_get_eth_ctrl_stats(struct fbnic_dev *fbd, bool reset,
714 struct fbnic_eth_ctrl_stats *ctrl_stats)724 struct fbnic_eth_ctrl_stats *ctrl_stats)
@@ -856,6 +866,7 @@ static const struct fbnic_mac fbnic_mac_asic = { · 141 unmodified lines
856 .get_fec_stats = fbnic_mac_get_fec_stats,866 .get_fec_stats = fbnic_mac_get_fec_stats,
857 .get_pcs_stats = fbnic_mac_get_pcs_stats,867 .get_pcs_stats = fbnic_mac_get_pcs_stats,
858 .get_eth_mac_stats = fbnic_mac_get_eth_mac_stats,868 .get_eth_mac_stats = fbnic_mac_get_eth_mac_stats,
869 .get_pause_stats = fbnic_mac_get_pause_stats,
859 .get_eth_ctrl_stats = fbnic_mac_get_eth_ctrl_stats,870 .get_eth_ctrl_stats = fbnic_mac_get_eth_ctrl_stats,
860 .get_rmon_stats = fbnic_mac_get_rmon_stats,871 .get_rmon_stats = fbnic_mac_get_rmon_stats,
861 .link_down = fbnic_mac_link_down_asic,872 .link_down = fbnic_mac_link_down_asic,
drivers/net/ethernet/meta/fbnic/fbnic_mac.h+2−0
@@ -85,6 +85,8 @@ struct fbnic_mac { · 84 unmodified lines
85 struct fbnic_pcs_stats *pcs_stats);85 struct fbnic_pcs_stats *pcs_stats);
86 void (*get_eth_mac_stats)(struct fbnic_dev *fbd, bool reset,86 void (*get_eth_mac_stats)(struct fbnic_dev *fbd, bool reset,
87 struct fbnic_eth_mac_stats *mac_stats);87 struct fbnic_eth_mac_stats *mac_stats);
88 void (*get_pause_stats)(struct fbnic_dev *fbd, bool reset,
89 struct fbnic_pause_stats *pause_stats);
88 void (*get_eth_ctrl_stats)(struct fbnic_dev *fbd, bool reset,90 void (*get_eth_ctrl_stats)(struct fbnic_dev *fbd, bool reset,
89 struct fbnic_eth_ctrl_stats *ctrl_stats);91 struct fbnic_eth_ctrl_stats *ctrl_stats);
90 void (*get_rmon_stats)(struct fbnic_dev *fbd, bool reset,92 void (*get_rmon_stats)(struct fbnic_dev *fbd, bool reset,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t