Skip to content

Commit a4465f1

Browse files
Mohsin BashirNipaLocal
authored andcommitted
eth: fbnic: add support for TTI HW stats
Add coverage for the TX Extension (TEI) Interface (TTI) stats. We are tracking packets and control message drops because of credit exhaustion on the TX interface. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: NipaLocal <nipa@local>
1 parent e6e7e4b commit a4465f1

File tree

6 files changed

+99
-1
lines changed

6 files changed

+99
-1
lines changed

Documentation/networking/device_drivers/ethernet/meta/fbnic.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ TX MAC Interface
3838
- ``ptp_good_ts``: packets successfully routed to MAC with PTP request bit set
3939
- ``ptp_bad_ts``: packets destined for MAC with PTP request bit set but aborted because of some error (e.g., DMA read error)
4040

41+
TX Extension (TEI) Interface (TTI)
42+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
44+
- ``tti_cm_drop``: control messages dropped at the TX Extension (TEI) Interface because of credit starvation
45+
- ``tti_frame_drop``: packets dropped at the TX Extension (TEI) Interface because of credit starvation
46+
- ``tti_tbi_drop``: packets dropped at the TX BMC Interface (TBI) because of credit starvation
47+
4148
RXB (RX Buffer) Enqueue
4249
~~~~~~~~~~~~~~~~~~~~~~~
4350

drivers/net/ethernet/meta/fbnic/fbnic_csr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,15 @@ enum {
397397
#define FBNIC_TCE_DROP_CTRL_TTI_FRM_DROP_EN CSR_BIT(1)
398398
#define FBNIC_TCE_DROP_CTRL_TTI_TBI_DROP_EN CSR_BIT(2)
399399

400+
#define FBNIC_TCE_TTI_CM_DROP_PKTS 0x0403e /* 0x100f8 */
401+
#define FBNIC_TCE_TTI_CM_DROP_BYTE_L 0x0403f /* 0x100fc */
402+
#define FBNIC_TCE_TTI_CM_DROP_BYTE_H 0x04040 /* 0x10100 */
403+
#define FBNIC_TCE_TTI_FRAME_DROP_PKTS 0x04041 /* 0x10104 */
404+
#define FBNIC_TCE_TTI_FRAME_DROP_BYTE_L 0x04042 /* 0x10108 */
405+
#define FBNIC_TCE_TTI_FRAME_DROP_BYTE_H 0x04043 /* 0x1010c */
406+
#define FBNIC_TCE_TBI_DROP_PKTS 0x04044 /* 0x10110 */
407+
#define FBNIC_TCE_TBI_DROP_BYTE_L 0x04045 /* 0x10114 */
408+
400409
#define FBNIC_TCE_TCAM_IDX2DEST_MAP 0x0404A /* 0x10128 */
401410
#define FBNIC_TCE_TCAM_IDX2DEST_MAP_DEST_ID_0 CSR_GENMASK(3, 0)
402411
enum {

drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ struct fbnic_stat {
2727
FBNIC_STAT_FIELDS(fbnic_hw_stats, name, stat)
2828

2929
static const struct fbnic_stat fbnic_gstrings_hw_stats[] = {
30+
/* TTI */
31+
FBNIC_HW_STAT("tti_cm_drop_frames", tti.cm_drop.frames),
32+
FBNIC_HW_STAT("tti_cm_drop_bytes", tti.cm_drop.bytes),
33+
FBNIC_HW_STAT("tti_frame_drop_frames", tti.frame_drop.frames),
34+
FBNIC_HW_STAT("tti_frame_drop_bytes", tti.frame_drop.bytes),
35+
FBNIC_HW_STAT("tti_tbi_drop_frames", tti.tbi_drop.frames),
36+
FBNIC_HW_STAT("tti_tbi_drop_bytes", tti.tbi_drop.bytes),
37+
3038
/* TMI */
3139
FBNIC_HW_STAT("ptp_illegal_req", tmi.ptp_illegal_req),
3240
FBNIC_HW_STAT("ptp_good_ts", tmi.ptp_good_ts),

drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,69 @@ static void fbnic_get_tmi_stats(struct fbnic_dev *fbd,
101101
fbnic_hw_stat_rd64(fbd, FBNIC_TMI_DROP_BYTE_L, 1, &tmi->drop.bytes);
102102
}
103103

104+
static void fbnic_reset_tti_stats(struct fbnic_dev *fbd,
105+
struct fbnic_tti_stats *tti)
106+
{
107+
fbnic_hw_stat_rst32(fbd,
108+
FBNIC_TCE_TTI_CM_DROP_PKTS,
109+
&tti->cm_drop.frames);
110+
fbnic_hw_stat_rst64(fbd,
111+
FBNIC_TCE_TTI_CM_DROP_BYTE_L,
112+
1,
113+
&tti->cm_drop.bytes);
114+
115+
fbnic_hw_stat_rst32(fbd,
116+
FBNIC_TCE_TTI_FRAME_DROP_PKTS,
117+
&tti->frame_drop.frames);
118+
fbnic_hw_stat_rst64(fbd,
119+
FBNIC_TCE_TTI_FRAME_DROP_BYTE_L,
120+
1,
121+
&tti->frame_drop.bytes);
122+
123+
fbnic_hw_stat_rst32(fbd,
124+
FBNIC_TCE_TBI_DROP_PKTS,
125+
&tti->tbi_drop.frames);
126+
fbnic_hw_stat_rst64(fbd,
127+
FBNIC_TCE_TBI_DROP_BYTE_L,
128+
1,
129+
&tti->tbi_drop.bytes);
130+
}
131+
132+
static void fbnic_get_tti_stats32(struct fbnic_dev *fbd,
133+
struct fbnic_tti_stats *tti)
134+
{
135+
fbnic_hw_stat_rd32(fbd,
136+
FBNIC_TCE_TTI_CM_DROP_PKTS,
137+
&tti->cm_drop.frames);
138+
139+
fbnic_hw_stat_rd32(fbd,
140+
FBNIC_TCE_TTI_FRAME_DROP_PKTS,
141+
&tti->frame_drop.frames);
142+
143+
fbnic_hw_stat_rd32(fbd,
144+
FBNIC_TCE_TBI_DROP_PKTS,
145+
&tti->tbi_drop.frames);
146+
}
147+
148+
static void fbnic_get_tti_stats(struct fbnic_dev *fbd,
149+
struct fbnic_tti_stats *tti)
150+
{
151+
fbnic_hw_stat_rd64(fbd,
152+
FBNIC_TCE_TTI_CM_DROP_BYTE_L,
153+
1,
154+
&tti->cm_drop.bytes);
155+
156+
fbnic_hw_stat_rd64(fbd,
157+
FBNIC_TCE_TTI_FRAME_DROP_BYTE_L,
158+
1,
159+
&tti->frame_drop.bytes);
160+
161+
fbnic_hw_stat_rd64(fbd,
162+
FBNIC_TCE_TBI_DROP_BYTE_L,
163+
1,
164+
&tti->tbi_drop.bytes);
165+
}
166+
104167
static void fbnic_reset_rpc_stats(struct fbnic_dev *fbd,
105168
struct fbnic_rpc_stats *rpc)
106169
{
@@ -451,6 +514,7 @@ void fbnic_reset_hw_stats(struct fbnic_dev *fbd)
451514
{
452515
spin_lock(&fbd->hw_stats_lock);
453516
fbnic_reset_tmi_stats(fbd, &fbd->hw_stats.tmi);
517+
fbnic_reset_tti_stats(fbd, &fbd->hw_stats.tti);
454518
fbnic_reset_rpc_stats(fbd, &fbd->hw_stats.rpc);
455519
fbnic_reset_rxb_stats(fbd, &fbd->hw_stats.rxb);
456520
fbnic_reset_hw_rxq_stats(fbd, fbd->hw_stats.hw_q);
@@ -461,6 +525,7 @@ void fbnic_reset_hw_stats(struct fbnic_dev *fbd)
461525
static void __fbnic_get_hw_stats32(struct fbnic_dev *fbd)
462526
{
463527
fbnic_get_tmi_stats32(fbd, &fbd->hw_stats.tmi);
528+
fbnic_get_tti_stats32(fbd, &fbd->hw_stats.tti);
464529
fbnic_get_rpc_stats32(fbd, &fbd->hw_stats.rpc);
465530
fbnic_get_rxb_stats32(fbd, &fbd->hw_stats.rxb);
466531
fbnic_get_hw_rxq_stats32(fbd, fbd->hw_stats.hw_q);
@@ -479,6 +544,7 @@ void fbnic_get_hw_stats(struct fbnic_dev *fbd)
479544
__fbnic_get_hw_stats32(fbd);
480545

481546
fbnic_get_tmi_stats(fbd, &fbd->hw_stats.tmi);
547+
fbnic_get_tti_stats(fbd, &fbd->hw_stats.tti);
482548
fbnic_get_rxb_stats(fbd, &fbd->hw_stats.rxb);
483549
fbnic_get_pcie_stats_asic64(fbd, &fbd->hw_stats.pcie);
484550
spin_unlock(&fbd->hw_stats_lock);

drivers/net/ethernet/meta/fbnic/fbnic_hw_stats.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ struct fbnic_tmi_stats {
4747
struct fbnic_stat_counter ptp_illegal_req, ptp_good_ts, ptp_bad_ts;
4848
};
4949

50+
struct fbnic_tti_stats {
51+
struct fbnic_hw_stat cm_drop, frame_drop, tbi_drop;
52+
};
53+
5054
struct fbnic_rpc_stats {
5155
struct fbnic_stat_counter unkn_etype, unkn_ext_hdr;
5256
struct fbnic_stat_counter ipv4_frag, ipv6_frag, ipv4_esp, ipv6_esp;
@@ -94,6 +98,7 @@ struct fbnic_pcie_stats {
9498
struct fbnic_hw_stats {
9599
struct fbnic_mac_stats mac;
96100
struct fbnic_tmi_stats tmi;
101+
struct fbnic_tti_stats tti;
97102
struct fbnic_rpc_stats rpc;
98103
struct fbnic_rxb_stats rxb;
99104
struct fbnic_hw_q_stats hw_q[FBNIC_MAX_QUEUES];

drivers/net/ethernet/meta/fbnic/fbnic_netdev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,10 @@ static void fbnic_get_stats64(struct net_device *dev,
424424
stats64->tx_dropped = tx_dropped;
425425

426426
/* Record drops from Tx HW Datapath */
427-
tx_dropped += fbd->hw_stats.tmi.drop.frames.value;
427+
tx_dropped += fbd->hw_stats.tmi.drop.frames.value +
428+
fbd->hw_stats.tti.frame_drop.frames.value +
429+
fbd->hw_stats.tti.tbi_drop.frames.value +
430+
fbd->hw_stats.tmi.drop.frames.value;
428431

429432
for (i = 0; i < fbn->num_tx_queues; i++) {
430433
struct fbnic_ring *txr = fbn->tx[i];

0 commit comments

Comments
 (0)