History

Merge branch 'eth-fbnic-extend-hw-stats-support'

Jakub Kicinski says: ==================== eth: fbnic: Extend hw stats support Mohsin says: Extend hardware stats support for fbnic by adding the ability to reset hardware stats when the device experience a reset due to a PCI error and include MAC stats in the hardware stats reset. Additionally, expand hardware stats coverage to include FEC, PHY, and Pause stats. v1: https://lore.kernel.org/20250822164731.1461754-1-kuba@kernel.org ====================

Jakub Kicinski committed 1 year ago

Commit d4854be2 parents ef5ca97 e9faf4d9 files · +240 −21Browse files

Unified · Split

9 files
  1. drivers/net/ethernet/meta/fbnic/fbnic.h +0 −3
  2. drivers/net/ethernet/meta/fbnic/fbnic_csr.h +19 −0
  3. drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c +61 −2
  4. drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.c +58 −8
  5. drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.h +28 −0
  6. drivers/net/ethernet/meta/fbnic/fbnic_mac.c +57 −0
  7. drivers/net/ethernet/meta/fbnic/fbnic_mac.h +6 −0
  8. drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +6 −6
  9. drivers/net/ethernet/meta/fbnic/fbnic_pci.c +5 −2
drivers/net/ethernet/meta/fbnic/fbnic.h+0−3
@@ -84,9 +84,6 @@ struct fbnic_dev { · 83 unmodified lines
8484 /* Local copy of hardware statistics */
8585 struct fbnic_hw_stats hw_stats;
8686
87− /* Lock protecting access to hw_stats */
88− spinlock_t hw_stats_lock;
89−
9087 struct fbnic_fw_log fw_log;
9188 };
9289
drivers/net/ethernet/meta/fbnic/fbnic_csr.h+19−0
@@ -790,6 +790,21 @@ enum { · 789 unmodified lines
790790 #define FBNIC_CSR_END_PCS 0x10668 /* CSR section delimiter */
791791
792792 #define FBNIC_CSR_START_RSFEC 0x10800 /* CSR section delimiter */
793+
794+/* We have 4 RSFEC engines present in our part, however we are only using 1.
795+ * As such only CCW(0) and NCCW(0) will never be non-zero and the other
796+ * registers can be ignored.
797+ */
798+#define FBNIC_RSFEC_CCW_LO(n) (0x10802 + 8 * (n)) /* 0x42008 + 32*n */
799+#define FBNIC_RSFEC_CCW_HI(n) (0x10803 + 8 * (n)) /* 0x4200c + 32*n */
800+#define FBNIC_RSFEC_NCCW_LO(n) (0x10804 + 8 * (n)) /* 0x42010 + 32*n */
801+#define FBNIC_RSFEC_NCCW_HI(n) (0x10805 + 8 * (n)) /* 0x42014 + 32*n */
802+
803+#define FBNIC_PCS_MAX_LANES 4
804+#define FBNIC_PCS_SYMBLERR_LO(n) \
805+ (0x10880 + 2 * (n)) /* 0x42200 + 8*n */
806+#define FBNIC_PCS_SYMBLERR_HI(n) \
807+ (0x10881 + 2 * (n)) /* 0x42204 + 8*n */
793808 #define FBNIC_CSR_END_RSFEC 0x108c8 /* CSR section delimiter */
794809
795810 /* MAC MAC registers (ASIC only) */
@@ -829,6 +844,10 @@ enum { · 33 unmodified lines
829844 #define FBNIC_CSR_END_SIG 0x1184e /* CSR section delimiter */
830845
831846 #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 */
832851 #define FBNIC_MAC_STAT_RX_BYTE_COUNT_L 0x11a08 /* 0x46820 */
833852 #define FBNIC_MAC_STAT_RX_BYTE_COUNT_H 0x11a09 /* 0x46824 */
834853 #define FBNIC_MAC_STAT_RX_ALIGN_ERROR_L 0x11a0a /* 0x46828 */
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c+61−2
@@ -518,7 +518,7 @@ static void fbnic_get_ethtool_stats(struct net_device *dev, · 517 unmodified lines
518518
519519 fbnic_get_hw_stats(fbn->fbd);
520520
521− spin_lock(&fbd->hw_stats_lock);
521+ spin_lock(&fbd->hw_stats.lock);
522522 fbnic_report_hw_stats(fbnic_gstrings_hw_stats, &fbd->hw_stats,
523523 FBNIC_HW_FIXED_STATS_LEN, &data);
524524
@@ -555,7 +555,7 @@ static void fbnic_get_ethtool_stats(struct net_device *dev, · 30 unmodified lines
555555 fbnic_report_hw_stats(fbnic_gstrings_hw_q_stats, hw_q,
556556 FBNIC_HW_Q_STATS_LEN, &data);
557557 }
558− spin_unlock(&fbd->hw_stats_lock);
558+ spin_unlock(&fbd->hw_stats.lock);
559559
560560 for (i = 0; i < FBNIC_MAX_XDPQS; i++)
561561 fbnic_get_xdp_queue_stats(fbn->tx[i + FBNIC_MAX_TXQS], &data);
@@ -1641,6 +1641,62 @@ static void fbnic_set_counter(u64 *stat, struct fbnic_stat_counter *counter) · 1079 unmodified lines
16411641 *stat = counter->value;
16421642 }
16431643
1644+static void
1645+fbnic_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+
1660+static void
1661+fbnic_get_fec_stats(struct net_device *netdev,
1662+ struct ethtool_fec_stats *fec_stats)
1663+{
1664+ struct fbnic_net *fbn = netdev_priv(netdev);
1665+ struct fbnic_phy_stats *phy_stats;
1666+ struct fbnic_dev *fbd = fbn->fbd;
1667+
1668+ fbnic_get_hw_stats32(fbd);
1669+ phy_stats = &fbd->hw_stats.phy;
1670+
1671+ spin_lock(&fbd->hw_stats.lock);
1672+ fec_stats->corrected_blocks.total =
1673+ phy_stats->fec.corrected_blocks.value;
1674+ fec_stats->uncorrectable_blocks.total =
1675+ phy_stats->fec.uncorrectable_blocks.value;
1676+ spin_unlock(&fbd->hw_stats.lock);
1677+}
1678+
1679+static void
1680+fbnic_get_eth_phy_stats(struct net_device *netdev,
1681+ struct ethtool_eth_phy_stats *eth_phy_stats)
1682+{
1683+ struct fbnic_net *fbn = netdev_priv(netdev);
1684+ struct fbnic_phy_stats *phy_stats;
1685+ struct fbnic_dev *fbd = fbn->fbd;
1686+ u64 total = 0;
1687+ int i;
1688+
1689+ fbnic_get_hw_stats32(fbd);
1690+ phy_stats = &fbd->hw_stats.phy;
1691+
1692+ spin_lock(&fbd->hw_stats.lock);
1693+ for (i = 0; i < FBNIC_PCS_MAX_LANES; i++)
1694+ total += phy_stats->pcs.SymbolErrorDuringCarrier.lanes[i].value;
1695+
1696+ eth_phy_stats->SymbolErrorDuringCarrier = total;
1697+ spin_unlock(&fbd->hw_stats.lock);
1698+}
1699+
16441700 static void
16451701 fbnic_get_eth_mac_stats(struct net_device *netdev,
16461702 struct ethtool_eth_mac_stats *eth_mac_stats)
@@ -1761,6 +1817,7 @@ static const struct ethtool_ops fbnic_ethtool_ops = { · 114 unmodified lines
17611817 .set_coalesce = fbnic_set_coalesce,
17621818 .get_ringparam = fbnic_get_ringparam,
17631819 .set_ringparam = fbnic_set_ringparam,
1820+ .get_pause_stats = fbnic_get_pause_stats,
17641821 .get_pauseparam = fbnic_phylink_get_pauseparam,
17651822 .set_pauseparam = fbnic_phylink_set_pauseparam,
17661823 .get_strings = fbnic_get_strings,
@@ -1782,7 +1839,9 @@ static const struct ethtool_ops fbnic_ethtool_ops = { · 15 unmodified lines
17821839 .get_ts_info = fbnic_get_ts_info,
17831840 .get_ts_stats = fbnic_get_ts_stats,
17841841 .get_link_ksettings = fbnic_phylink_ethtool_ksettings_get,
1842+ .get_fec_stats = fbnic_get_fec_stats,
17851843 .get_fecparam = fbnic_phylink_get_fecparam,
1844+ .get_eth_phy_stats = fbnic_get_eth_phy_stats,
17861845 .get_eth_mac_stats = fbnic_get_eth_mac_stats,
17871846 .get_eth_ctrl_stats = fbnic_get_eth_ctrl_stats,
17881847 .get_rmon_stats = fbnic_get_rmon_stats,
drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.c+58−8
@@ -1,6 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /* Copyright (c) Meta Platforms, Inc. and affiliates. */
33
4+#include <linux/rtnetlink.h>
5+
46 #include "fbnic.h"
57
68 static void fbnic_hw_stat_rst32(struct fbnic_dev *fbd, u32 reg,
@@ -421,9 +423,9 @@ static void fbnic_get_hw_rxq_stats32(struct fbnic_dev *fbd, · 414 unmodified lines
421423 void fbnic_get_hw_q_stats(struct fbnic_dev *fbd,
422424 struct fbnic_hw_q_stats *hw_q)
423425 {
424− spin_lock(&fbd->hw_stats_lock);
426+ spin_lock(&fbd->hw_stats.lock);
425427 fbnic_get_hw_rxq_stats32(fbd, hw_q);
426− spin_unlock(&fbd->hw_stats_lock);
428+ spin_unlock(&fbd->hw_stats.lock);
427429 }
428430
429431 static void fbnic_reset_pcie_stats_asic(struct fbnic_dev *fbd,
@@ -510,20 +512,68 @@ static void fbnic_get_pcie_stats_asic64(struct fbnic_dev *fbd, · 80 unmodified lines
510512 &pcie->ob_rd_no_np_cred);
511513 }
512514
515+static void fbnic_reset_phy_stats(struct fbnic_dev *fbd,
516+ struct fbnic_phy_stats *phy_stats)
517+{
518+ const struct fbnic_mac *mac = fbd->mac;
519+
520+ mac->get_fec_stats(fbd, true, &phy_stats->fec);
521+ mac->get_pcs_stats(fbd, true, &phy_stats->pcs);
522+}
523+
524+static void fbnic_get_phy_stats32(struct fbnic_dev *fbd,
525+ struct fbnic_phy_stats *phy_stats)
526+{
527+ const struct fbnic_mac *mac = fbd->mac;
528+
529+ mac->get_fec_stats(fbd, false, &phy_stats->fec);
530+ mac->get_pcs_stats(fbd, false, &phy_stats->pcs);
531+}
532+
533+static void fbnic_reset_hw_mac_stats(struct fbnic_dev *fbd,
534+ struct fbnic_mac_stats *mac_stats)
535+{
536+ const struct fbnic_mac *mac = fbd->mac;
537+
538+ mac->get_eth_mac_stats(fbd, true, &mac_stats->eth_mac);
539+ mac->get_pause_stats(fbd, true, &mac_stats->pause);
540+ mac->get_eth_ctrl_stats(fbd, true, &mac_stats->eth_ctrl);
541+ mac->get_rmon_stats(fbd, true, &mac_stats->rmon);
542+}
543+
513544 void fbnic_reset_hw_stats(struct fbnic_dev *fbd)
514545 {
515− spin_lock(&fbd->hw_stats_lock);
546+ spin_lock(&fbd->hw_stats.lock);
547+ fbnic_reset_phy_stats(fbd, &fbd->hw_stats.phy);
516548 fbnic_reset_tmi_stats(fbd, &fbd->hw_stats.tmi);
517549 fbnic_reset_tti_stats(fbd, &fbd->hw_stats.tti);
518550 fbnic_reset_rpc_stats(fbd, &fbd->hw_stats.rpc);
519551 fbnic_reset_rxb_stats(fbd, &fbd->hw_stats.rxb);
520552 fbnic_reset_hw_rxq_stats(fbd, fbd->hw_stats.hw_q);
521553 fbnic_reset_pcie_stats_asic(fbd, &fbd->hw_stats.pcie);
522− spin_unlock(&fbd->hw_stats_lock);
554+ spin_unlock(&fbd->hw_stats.lock);
555+
556+ /* Once registered, the only other access to MAC stats is via the
557+ * ethtool API which is protected by the rtnl_lock. The call to
558+ * fbnic_reset_hw_stats() during PCI recovery is also protected
559+ * by the rtnl_lock hence, we don't need the spinlock to access
560+ * the MAC stats.
561+ */
562+ if (fbd->netdev)
563+ ASSERT_RTNL();
564+ fbnic_reset_hw_mac_stats(fbd, &fbd->hw_stats.mac);
565+}
566+
567+void fbnic_init_hw_stats(struct fbnic_dev *fbd)
568+{
569+ spin_lock_init(&fbd->hw_stats.lock);
570+
571+ fbnic_reset_hw_stats(fbd);
523572 }
524573
525574 static void __fbnic_get_hw_stats32(struct fbnic_dev *fbd)
526575 {
576+ fbnic_get_phy_stats32(fbd, &fbd->hw_stats.phy);
527577 fbnic_get_tmi_stats32(fbd, &fbd->hw_stats.tmi);
528578 fbnic_get_tti_stats32(fbd, &fbd->hw_stats.tti);
529579 fbnic_get_rpc_stats32(fbd, &fbd->hw_stats.rpc);
@@ -533,19 +583,19 @@ static void __fbnic_get_hw_stats32(struct fbnic_dev *fbd) · 3 unmodified lines
533583
534584 void fbnic_get_hw_stats32(struct fbnic_dev *fbd)
535585 {
536− spin_lock(&fbd->hw_stats_lock);
586+ spin_lock(&fbd->hw_stats.lock);
537587 __fbnic_get_hw_stats32(fbd);
538− spin_unlock(&fbd->hw_stats_lock);
588+ spin_unlock(&fbd->hw_stats.lock);
539589 }
540590
541591 void fbnic_get_hw_stats(struct fbnic_dev *fbd)
542592 {
543− spin_lock(&fbd->hw_stats_lock);
593+ spin_lock(&fbd->hw_stats.lock);
544594 __fbnic_get_hw_stats32(fbd);
545595
546596 fbnic_get_tmi_stats(fbd, &fbd->hw_stats.tmi);
547597 fbnic_get_tti_stats(fbd, &fbd->hw_stats.tti);
548598 fbnic_get_rxb_stats(fbd, &fbd->hw_stats.rxb);
549599 fbnic_get_pcie_stats_asic64(fbd, &fbd->hw_stats.pcie);
550− spin_unlock(&fbd->hw_stats_lock);
600+ spin_unlock(&fbd->hw_stats.lock);
551601 }
drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.h+28−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #define _FBNIC_HW_STATS_H_
66
77 #include <linux/ethtool.h>
8+#include <linux/spinlock.h>
89
910 #include "fbnic_csr.h"
1011
@@ -22,6 +23,16 @@ struct fbnic_hw_stat { · 11 unmodified lines
2223 struct fbnic_stat_counter bytes;
2324 };
2425
26+struct fbnic_fec_stats {
27+ struct fbnic_stat_counter corrected_blocks, uncorrectable_blocks;
28+};
29+
30+struct fbnic_pcs_stats {
31+ struct {
32+ struct fbnic_stat_counter lanes[FBNIC_PCS_MAX_LANES];
33+ } SymbolErrorDuringCarrier;
34+};
35+
2536 /* Note: not updated by fbnic_get_hw_stats() */
2637 struct fbnic_eth_ctrl_stats {
2738 struct fbnic_stat_counter MACControlFramesTransmitted;
@@ -39,6 +50,12 @@ struct fbnic_rmon_stats { · 11 unmodified lines
3950 struct fbnic_stat_counter hist_tx[ETHTOOL_RMON_HIST_MAX];
4051 };
4152
53+/* Note: not updated by fbnic_get_hw_stats() */
54+struct fbnic_pause_stats {
55+ struct fbnic_stat_counter tx_pause_frames;
56+ struct fbnic_stat_counter rx_pause_frames;
57+};
58+
4259 struct fbnic_eth_mac_stats {
4360 struct fbnic_stat_counter FramesTransmittedOK;
4461 struct fbnic_stat_counter FramesReceivedOK;
@@ -55,8 +72,14 @@ struct fbnic_eth_mac_stats { · 10 unmodified lines
5572 struct fbnic_stat_counter FrameTooLongErrors;
5673 };
5774
75+struct fbnic_phy_stats {
76+ struct fbnic_fec_stats fec;
77+ struct fbnic_pcs_stats pcs;
78+};
79+
5880 struct fbnic_mac_stats {
5981 struct fbnic_eth_mac_stats eth_mac;
82+ struct fbnic_pause_stats pause;
6083 struct fbnic_eth_ctrl_stats eth_ctrl;
6184 struct fbnic_rmon_stats rmon;
6285 };
@@ -115,6 +138,7 @@ struct fbnic_pcie_stats { · 52 unmodified lines
115138 };
116139
117140 struct fbnic_hw_stats {
141+ struct fbnic_phy_stats phy;
118142 struct fbnic_mac_stats mac;
119143 struct fbnic_tmi_stats tmi;
120144 struct fbnic_tti_stats tti;
@@ -122,11 +146,15 @@ struct fbnic_hw_stats { · 1 unmodified line
122146 struct fbnic_rxb_stats rxb;
123147 struct fbnic_hw_q_stats hw_q[FBNIC_MAX_QUEUES];
124148 struct fbnic_pcie_stats pcie;
149+
150+ /* Lock protecting the access to hw stats */
151+ spinlock_t lock;
125152 };
126153
127154 u64 fbnic_stat_rd64(struct fbnic_dev *fbd, u32 reg, u32 offset);
128155
129156 void fbnic_reset_hw_stats(struct fbnic_dev *fbd);
157+void fbnic_init_hw_stats(struct fbnic_dev *fbd);
130158 void fbnic_get_hw_q_stats(struct fbnic_dev *fbd,
131159 struct fbnic_hw_q_stats *hw_q);
132160 void fbnic_get_hw_stats32(struct fbnic_dev *fbd);
drivers/net/ethernet/meta/fbnic/fbnic_mac.c+57−0
@@ -631,6 +631,50 @@ static void fbnic_mac_link_up_asic(struct fbnic_dev *fbd, · 630 unmodified lines
631631 wr32(fbd, FBNIC_MAC_COMMAND_CONFIG, cmd_cfg);
632632 }
633633
634+static void
635+fbnic_pcs_rsfec_stat_rd32(struct fbnic_dev *fbd, u32 reg, bool reset,
636+ struct fbnic_stat_counter *stat)
637+{
638+ u32 pcs_rsfec_stat;
639+
640+ /* The PCS/RFSEC registers are only 16b wide each. So what we will
641+ * have after the 64b read is 0x0000xxxx0000xxxx. To make it usable
642+ * as a full stat we will shift the upper bits into the lower set of
643+ * 0s and then mask off the math at 32b.
644+ *
645+ * Read ordering must be lower reg followed by upper reg.
646+ */
647+ pcs_rsfec_stat = rd32(fbd, reg) & 0xffff;
648+ pcs_rsfec_stat |= rd32(fbd, reg + 1) << 16;
649+
650+ /* RFSEC registers clear themselves upon being read so there is no
651+ * need to store the old_reg_value.
652+ */
653+ if (!reset)
654+ stat->value += pcs_rsfec_stat;
655+}
656+
657+static void
658+fbnic_mac_get_fec_stats(struct fbnic_dev *fbd, bool reset,
659+ struct fbnic_fec_stats *s)
660+{
661+ fbnic_pcs_rsfec_stat_rd32(fbd, FBNIC_RSFEC_CCW_LO(0), reset,
662+ &s->corrected_blocks);
663+ fbnic_pcs_rsfec_stat_rd32(fbd, FBNIC_RSFEC_NCCW_LO(0), reset,
664+ &s->uncorrectable_blocks);
665+}
666+
667+static void
668+fbnic_mac_get_pcs_stats(struct fbnic_dev *fbd, bool reset,
669+ struct fbnic_pcs_stats *s)
670+{
671+ int i;
672+
673+ for (i = 0; i < FBNIC_PCS_MAX_LANES; i++)
674+ fbnic_pcs_rsfec_stat_rd32(fbd, FBNIC_PCS_SYMBLERR_LO(i), reset,
675+ &s->SymbolErrorDuringCarrier.lanes[i]);
676+}
677+
634678 static void
635679 fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset,
636680 struct fbnic_eth_mac_stats *mac_stats)
@@ -665,6 +709,16 @@ fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset, · 28 unmodified lines
665709 MAC_STAT_TX_BROADCAST);
666710 }
667711
712+static void
713+fbnic_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+
668722 static void
669723 fbnic_mac_get_eth_ctrl_stats(struct fbnic_dev *fbd, bool reset,
670724 struct fbnic_eth_ctrl_stats *ctrl_stats)
@@ -809,7 +863,10 @@ static const struct fbnic_mac fbnic_mac_asic = { · 138 unmodified lines
809863 .pcs_disable = fbnic_pcs_disable_asic,
810864 .pcs_get_link = fbnic_pcs_get_link_asic,
811865 .pcs_get_link_event = fbnic_pcs_get_link_event_asic,
866+ .get_fec_stats = fbnic_mac_get_fec_stats,
867+ .get_pcs_stats = fbnic_mac_get_pcs_stats,
812868 .get_eth_mac_stats = fbnic_mac_get_eth_mac_stats,
869+ .get_pause_stats = fbnic_mac_get_pause_stats,
813870 .get_eth_ctrl_stats = fbnic_mac_get_eth_ctrl_stats,
814871 .get_rmon_stats = fbnic_mac_get_rmon_stats,
815872 .link_down = fbnic_mac_link_down_asic,
drivers/net/ethernet/meta/fbnic/fbnic_mac.h+6−0
@@ -79,8 +79,14 @@ struct fbnic_mac { · 78 unmodified lines
7979 bool (*pcs_get_link)(struct fbnic_dev *fbd);
8080 int (*pcs_get_link_event)(struct fbnic_dev *fbd);
8181
82+ void (*get_fec_stats)(struct fbnic_dev *fbd, bool reset,
83+ struct fbnic_fec_stats *fec_stats);
84+ void (*get_pcs_stats)(struct fbnic_dev *fbd, bool reset,
85+ struct fbnic_pcs_stats *pcs_stats);
8286 void (*get_eth_mac_stats)(struct fbnic_dev *fbd, bool reset,
8387 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);
8490 void (*get_eth_ctrl_stats)(struct fbnic_dev *fbd, bool reset,
8591 struct fbnic_eth_ctrl_stats *ctrl_stats);
8692 void (*get_rmon_stats)(struct fbnic_dev *fbd, bool reset,
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c+6−6
@@ -424,12 +424,12 @@ static void fbnic_get_stats64(struct net_device *dev, · 423 unmodified lines
424424 tx_dropped = stats->dropped;
425425
426426 /* Record drops from Tx HW Datapath */
427− spin_lock(&fbd->hw_stats_lock);
427+ spin_lock(&fbd->hw_stats.lock);
428428 tx_dropped += fbd->hw_stats.tmi.drop.frames.value +
429429 fbd->hw_stats.tti.cm_drop.frames.value +
430430 fbd->hw_stats.tti.frame_drop.frames.value +
431431 fbd->hw_stats.tti.tbi_drop.frames.value;
432− spin_unlock(&fbd->hw_stats_lock);
432+ spin_unlock(&fbd->hw_stats.lock);
433433
434434 stats64->tx_bytes = tx_bytes;
435435 stats64->tx_packets = tx_packets;
@@ -460,7 +460,7 @@ static void fbnic_get_stats64(struct net_device *dev, · 24 unmodified lines
460460 rx_packets = stats->packets;
461461 rx_dropped = stats->dropped;
462462
463− spin_lock(&fbd->hw_stats_lock);
463+ spin_lock(&fbd->hw_stats.lock);
464464 /* Record drops for the host FIFOs.
465465 * 4: network to Host, 6: BMC to Host
466466 * Exclude the BMC and MC FIFOs as those stats may contain drops
@@ -480,7 +480,7 @@ static void fbnic_get_stats64(struct net_device *dev, · 13 unmodified lines
480480 /* Report packets with errors */
481481 rx_errors += fbd->hw_stats.hw_q[i].rde_pkt_err.value;
482482 }
483− spin_unlock(&fbd->hw_stats_lock);
483+ spin_unlock(&fbd->hw_stats.lock);
484484
485485 stats64->rx_bytes = rx_bytes;
486486 stats64->rx_packets = rx_packets;
@@ -608,12 +608,12 @@ static void fbnic_get_queue_stats_rx(struct net_device *dev, int idx, · 121 unmodified lines
608608
609609 fbnic_get_hw_q_stats(fbd, fbd->hw_stats.hw_q);
610610
611− spin_lock(&fbd->hw_stats_lock);
611+ spin_lock(&fbd->hw_stats.lock);
612612 rx->hw_drop_overruns = fbd->hw_stats.hw_q[idx].rde_pkt_cq_drop.value +
613613 fbd->hw_stats.hw_q[idx].rde_pkt_bdq_drop.value;
614614 rx->hw_drops = fbd->hw_stats.hw_q[idx].rde_pkt_err.value +
615615 rx->hw_drop_overruns;
616− spin_unlock(&fbd->hw_stats_lock);
616+ spin_unlock(&fbd->hw_stats.lock);
617617 }
618618
619619 static void fbnic_get_queue_stats_tx(struct net_device *dev, int idx,
drivers/net/ethernet/meta/fbnic/fbnic_pci.c+5−2
@@ -304,10 +304,9 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 303 unmodified lines
304304
305305 fbnic_devlink_register(fbd);
306306 fbnic_dbg_fbd_init(fbd);
307− spin_lock_init(&fbd->hw_stats_lock);
308307
309308 /* Capture snapshot of hardware stats so netdev can calculate delta */
310− fbnic_reset_hw_stats(fbd);
309+ fbnic_init_hw_stats(fbd);
311310
312311 fbnic_hwmon_register(fbd);
313312
@@ -492,6 +491,10 @@ static void __fbnic_pm_attach(struct device *dev) · 178 unmodified lines
492491 struct net_device *netdev = fbd->netdev;
493492 struct fbnic_net *fbn;
494493
494+ rtnl_lock();
495+ fbnic_reset_hw_stats(fbd);
496+ rtnl_unlock();
497+
495498 if (fbnic_init_failure(fbd))
496499 return;
497500

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