Skip to content

Commit d06c2ab

Browse files
Geetha sowjanyadavem330
authored andcommitted
octeontx2-af: cn10k: mcs: Add debugfs support
This patch adds debugfs entry to dump MCS secy, sc, sa, flowid and port stats. This helps in debugging the packet path and to figure out where exactly packet was dropped. Signed-off-by: Geetha sowjanya <[email protected]> Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: Subbaraya Sundeep <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6c635f7 commit d06c2ab

File tree

2 files changed

+350
-0
lines changed

2 files changed

+350
-0
lines changed

drivers/net/ethernet/marvell/octeontx2/af/rvu.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ struct rvu_debugfs {
6464
struct dentry *nix;
6565
struct dentry *npc;
6666
struct dentry *cpt;
67+
struct dentry *mcs_root;
68+
struct dentry *mcs;
69+
struct dentry *mcs_rx;
70+
struct dentry *mcs_tx;
6771
struct dump_ctx npa_aura_ctx;
6872
struct dump_ctx npa_pool_ctx;
6973
struct dump_ctx nix_cq_ctx;

drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c

Lines changed: 346 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "lmac_common.h"
2020
#include "npc.h"
2121
#include "rvu_npc_hash.h"
22+
#include "mcs.h"
2223

2324
#define DEBUGFS_DIR_NAME "octeontx2"
2425

@@ -227,6 +228,350 @@ static const struct file_operations rvu_dbg_##name##_fops = { \
227228

228229
static void print_nix_qsize(struct seq_file *filp, struct rvu_pfvf *pfvf);
229230

231+
static int rvu_dbg_mcs_port_stats_display(struct seq_file *filp, void *unused, int dir)
232+
{
233+
struct mcs *mcs = filp->private;
234+
struct mcs_port_stats stats;
235+
int lmac;
236+
237+
seq_puts(filp, "\n port stats\n");
238+
mutex_lock(&mcs->stats_lock);
239+
for_each_set_bit(lmac, &mcs->hw->lmac_bmap, mcs->hw->lmac_cnt) {
240+
mcs_get_port_stats(mcs, &stats, lmac, dir);
241+
seq_printf(filp, "port%d: Tcam Miss: %lld\n", lmac, stats.tcam_miss_cnt);
242+
seq_printf(filp, "port%d: Parser errors: %lld\n", lmac, stats.parser_err_cnt);
243+
244+
if (dir == MCS_RX && mcs->hw->mcs_blks > 1)
245+
seq_printf(filp, "port%d: Preempt error: %lld\n", lmac,
246+
stats.preempt_err_cnt);
247+
if (dir == MCS_TX)
248+
seq_printf(filp, "port%d: Sectag insert error: %lld\n", lmac,
249+
stats.sectag_insert_err_cnt);
250+
}
251+
mutex_unlock(&mcs->stats_lock);
252+
return 0;
253+
}
254+
255+
static int rvu_dbg_mcs_rx_port_stats_display(struct seq_file *filp, void *unused)
256+
{
257+
return rvu_dbg_mcs_port_stats_display(filp, unused, MCS_RX);
258+
}
259+
260+
RVU_DEBUG_SEQ_FOPS(mcs_rx_port_stats, mcs_rx_port_stats_display, NULL);
261+
262+
static int rvu_dbg_mcs_tx_port_stats_display(struct seq_file *filp, void *unused)
263+
{
264+
return rvu_dbg_mcs_port_stats_display(filp, unused, MCS_TX);
265+
}
266+
267+
RVU_DEBUG_SEQ_FOPS(mcs_tx_port_stats, mcs_tx_port_stats_display, NULL);
268+
269+
static int rvu_dbg_mcs_sa_stats_display(struct seq_file *filp, void *unused, int dir)
270+
{
271+
struct mcs *mcs = filp->private;
272+
struct mcs_sa_stats stats;
273+
struct rsrc_bmap *map;
274+
int sa_id;
275+
276+
if (dir == MCS_TX) {
277+
map = &mcs->tx.sa;
278+
mutex_lock(&mcs->stats_lock);
279+
for_each_set_bit(sa_id, map->bmap, mcs->hw->sa_entries) {
280+
seq_puts(filp, "\n TX SA stats\n");
281+
mcs_get_sa_stats(mcs, &stats, sa_id, MCS_TX);
282+
seq_printf(filp, "sa%d: Pkts encrypted: %lld\n", sa_id,
283+
stats.pkt_encrypt_cnt);
284+
285+
seq_printf(filp, "sa%d: Pkts protected: %lld\n", sa_id,
286+
stats.pkt_protected_cnt);
287+
}
288+
mutex_unlock(&mcs->stats_lock);
289+
return 0;
290+
}
291+
292+
/* RX stats */
293+
map = &mcs->rx.sa;
294+
mutex_lock(&mcs->stats_lock);
295+
for_each_set_bit(sa_id, map->bmap, mcs->hw->sa_entries) {
296+
seq_puts(filp, "\n RX SA stats\n");
297+
mcs_get_sa_stats(mcs, &stats, sa_id, MCS_RX);
298+
seq_printf(filp, "sa%d: Invalid pkts: %lld\n", sa_id, stats.pkt_invalid_cnt);
299+
seq_printf(filp, "sa%d: Pkts no sa error: %lld\n", sa_id, stats.pkt_nosaerror_cnt);
300+
seq_printf(filp, "sa%d: Pkts not valid: %lld\n", sa_id, stats.pkt_notvalid_cnt);
301+
seq_printf(filp, "sa%d: Pkts ok: %lld\n", sa_id, stats.pkt_ok_cnt);
302+
seq_printf(filp, "sa%d: Pkts no sa: %lld\n", sa_id, stats.pkt_nosa_cnt);
303+
}
304+
mutex_unlock(&mcs->stats_lock);
305+
return 0;
306+
}
307+
308+
static int rvu_dbg_mcs_rx_sa_stats_display(struct seq_file *filp, void *unused)
309+
{
310+
return rvu_dbg_mcs_sa_stats_display(filp, unused, MCS_RX);
311+
}
312+
313+
RVU_DEBUG_SEQ_FOPS(mcs_rx_sa_stats, mcs_rx_sa_stats_display, NULL);
314+
315+
static int rvu_dbg_mcs_tx_sa_stats_display(struct seq_file *filp, void *unused)
316+
{
317+
return rvu_dbg_mcs_sa_stats_display(filp, unused, MCS_TX);
318+
}
319+
320+
RVU_DEBUG_SEQ_FOPS(mcs_tx_sa_stats, mcs_tx_sa_stats_display, NULL);
321+
322+
static int rvu_dbg_mcs_tx_sc_stats_display(struct seq_file *filp, void *unused)
323+
{
324+
struct mcs *mcs = filp->private;
325+
struct mcs_sc_stats stats;
326+
struct rsrc_bmap *map;
327+
int sc_id;
328+
329+
map = &mcs->tx.sc;
330+
seq_puts(filp, "\n SC stats\n");
331+
332+
mutex_lock(&mcs->stats_lock);
333+
for_each_set_bit(sc_id, map->bmap, mcs->hw->sc_entries) {
334+
mcs_get_sc_stats(mcs, &stats, sc_id, MCS_TX);
335+
seq_printf(filp, "\n=======sc%d======\n\n", sc_id);
336+
seq_printf(filp, "sc%d: Pkts encrypted: %lld\n", sc_id, stats.pkt_encrypt_cnt);
337+
seq_printf(filp, "sc%d: Pkts protected: %lld\n", sc_id, stats.pkt_protected_cnt);
338+
339+
if (mcs->hw->mcs_blks == 1) {
340+
seq_printf(filp, "sc%d: Octets encrypted: %lld\n", sc_id,
341+
stats.octet_encrypt_cnt);
342+
seq_printf(filp, "sc%d: Octets protected: %lld\n", sc_id,
343+
stats.octet_protected_cnt);
344+
}
345+
}
346+
mutex_unlock(&mcs->stats_lock);
347+
return 0;
348+
}
349+
350+
RVU_DEBUG_SEQ_FOPS(mcs_tx_sc_stats, mcs_tx_sc_stats_display, NULL);
351+
352+
static int rvu_dbg_mcs_rx_sc_stats_display(struct seq_file *filp, void *unused)
353+
{
354+
struct mcs *mcs = filp->private;
355+
struct mcs_sc_stats stats;
356+
struct rsrc_bmap *map;
357+
int sc_id;
358+
359+
map = &mcs->rx.sc;
360+
seq_puts(filp, "\n SC stats\n");
361+
362+
mutex_lock(&mcs->stats_lock);
363+
for_each_set_bit(sc_id, map->bmap, mcs->hw->sc_entries) {
364+
mcs_get_sc_stats(mcs, &stats, sc_id, MCS_RX);
365+
seq_printf(filp, "\n=======sc%d======\n\n", sc_id);
366+
seq_printf(filp, "sc%d: Cam hits: %lld\n", sc_id, stats.hit_cnt);
367+
seq_printf(filp, "sc%d: Invalid pkts: %lld\n", sc_id, stats.pkt_invalid_cnt);
368+
seq_printf(filp, "sc%d: Late pkts: %lld\n", sc_id, stats.pkt_late_cnt);
369+
seq_printf(filp, "sc%d: Notvalid pkts: %lld\n", sc_id, stats.pkt_notvalid_cnt);
370+
seq_printf(filp, "sc%d: Unchecked pkts: %lld\n", sc_id, stats.pkt_unchecked_cnt);
371+
372+
if (mcs->hw->mcs_blks > 1) {
373+
seq_printf(filp, "sc%d: Delay pkts: %lld\n", sc_id, stats.pkt_delay_cnt);
374+
seq_printf(filp, "sc%d: Pkts ok: %lld\n", sc_id, stats.pkt_ok_cnt);
375+
}
376+
if (mcs->hw->mcs_blks == 1) {
377+
seq_printf(filp, "sc%d: Octets decrypted: %lld\n", sc_id,
378+
stats.octet_decrypt_cnt);
379+
seq_printf(filp, "sc%d: Octets validated: %lld\n", sc_id,
380+
stats.octet_validate_cnt);
381+
}
382+
}
383+
mutex_unlock(&mcs->stats_lock);
384+
return 0;
385+
}
386+
387+
RVU_DEBUG_SEQ_FOPS(mcs_rx_sc_stats, mcs_rx_sc_stats_display, NULL);
388+
389+
static int rvu_dbg_mcs_flowid_stats_display(struct seq_file *filp, void *unused, int dir)
390+
{
391+
struct mcs *mcs = filp->private;
392+
struct mcs_flowid_stats stats;
393+
struct rsrc_bmap *map;
394+
int flow_id;
395+
396+
seq_puts(filp, "\n Flowid stats\n");
397+
398+
if (dir == MCS_RX)
399+
map = &mcs->rx.flow_ids;
400+
else
401+
map = &mcs->tx.flow_ids;
402+
403+
mutex_lock(&mcs->stats_lock);
404+
for_each_set_bit(flow_id, map->bmap, mcs->hw->tcam_entries) {
405+
mcs_get_flowid_stats(mcs, &stats, flow_id, dir);
406+
seq_printf(filp, "Flowid%d: Hit:%lld\n", flow_id, stats.tcam_hit_cnt);
407+
}
408+
mutex_unlock(&mcs->stats_lock);
409+
return 0;
410+
}
411+
412+
static int rvu_dbg_mcs_tx_flowid_stats_display(struct seq_file *filp, void *unused)
413+
{
414+
return rvu_dbg_mcs_flowid_stats_display(filp, unused, MCS_TX);
415+
}
416+
417+
RVU_DEBUG_SEQ_FOPS(mcs_tx_flowid_stats, mcs_tx_flowid_stats_display, NULL);
418+
419+
static int rvu_dbg_mcs_rx_flowid_stats_display(struct seq_file *filp, void *unused)
420+
{
421+
return rvu_dbg_mcs_flowid_stats_display(filp, unused, MCS_RX);
422+
}
423+
424+
RVU_DEBUG_SEQ_FOPS(mcs_rx_flowid_stats, mcs_rx_flowid_stats_display, NULL);
425+
426+
static int rvu_dbg_mcs_tx_secy_stats_display(struct seq_file *filp, void *unused)
427+
{
428+
struct mcs *mcs = filp->private;
429+
struct mcs_secy_stats stats;
430+
struct rsrc_bmap *map;
431+
int secy_id;
432+
433+
map = &mcs->tx.secy;
434+
seq_puts(filp, "\n MCS TX secy stats\n");
435+
436+
mutex_lock(&mcs->stats_lock);
437+
for_each_set_bit(secy_id, map->bmap, mcs->hw->secy_entries) {
438+
mcs_get_tx_secy_stats(mcs, &stats, secy_id);
439+
seq_printf(filp, "\n=======Secy%d======\n\n", secy_id);
440+
seq_printf(filp, "secy%d: Ctrl bcast pkts: %lld\n", secy_id,
441+
stats.ctl_pkt_bcast_cnt);
442+
seq_printf(filp, "secy%d: Ctrl Mcast pkts: %lld\n", secy_id,
443+
stats.ctl_pkt_mcast_cnt);
444+
seq_printf(filp, "secy%d: Ctrl ucast pkts: %lld\n", secy_id,
445+
stats.ctl_pkt_ucast_cnt);
446+
seq_printf(filp, "secy%d: Ctrl octets: %lld\n", secy_id, stats.ctl_octet_cnt);
447+
seq_printf(filp, "secy%d: Unctrl bcast cnt: %lld\n", secy_id,
448+
stats.unctl_pkt_bcast_cnt);
449+
seq_printf(filp, "secy%d: Unctrl mcast pkts: %lld\n", secy_id,
450+
stats.unctl_pkt_mcast_cnt);
451+
seq_printf(filp, "secy%d: Unctrl ucast pkts: %lld\n", secy_id,
452+
stats.unctl_pkt_ucast_cnt);
453+
seq_printf(filp, "secy%d: Unctrl octets: %lld\n", secy_id, stats.unctl_octet_cnt);
454+
seq_printf(filp, "secy%d: Octet encrypted: %lld\n", secy_id,
455+
stats.octet_encrypted_cnt);
456+
seq_printf(filp, "secy%d: octet protected: %lld\n", secy_id,
457+
stats.octet_protected_cnt);
458+
seq_printf(filp, "secy%d: Pkts on active sa: %lld\n", secy_id,
459+
stats.pkt_noactivesa_cnt);
460+
seq_printf(filp, "secy%d: Pkts too long: %lld\n", secy_id, stats.pkt_toolong_cnt);
461+
seq_printf(filp, "secy%d: Pkts untagged: %lld\n", secy_id, stats.pkt_untagged_cnt);
462+
}
463+
mutex_unlock(&mcs->stats_lock);
464+
return 0;
465+
}
466+
467+
RVU_DEBUG_SEQ_FOPS(mcs_tx_secy_stats, mcs_tx_secy_stats_display, NULL);
468+
469+
static int rvu_dbg_mcs_rx_secy_stats_display(struct seq_file *filp, void *unused)
470+
{
471+
struct mcs *mcs = filp->private;
472+
struct mcs_secy_stats stats;
473+
struct rsrc_bmap *map;
474+
int secy_id;
475+
476+
map = &mcs->rx.secy;
477+
seq_puts(filp, "\n MCS secy stats\n");
478+
479+
mutex_lock(&mcs->stats_lock);
480+
for_each_set_bit(secy_id, map->bmap, mcs->hw->secy_entries) {
481+
mcs_get_rx_secy_stats(mcs, &stats, secy_id);
482+
seq_printf(filp, "\n=======Secy%d======\n\n", secy_id);
483+
seq_printf(filp, "secy%d: Ctrl bcast pkts: %lld\n", secy_id,
484+
stats.ctl_pkt_bcast_cnt);
485+
seq_printf(filp, "secy%d: Ctrl Mcast pkts: %lld\n", secy_id,
486+
stats.ctl_pkt_mcast_cnt);
487+
seq_printf(filp, "secy%d: Ctrl ucast pkts: %lld\n", secy_id,
488+
stats.ctl_pkt_ucast_cnt);
489+
seq_printf(filp, "secy%d: Ctrl octets: %lld\n", secy_id, stats.ctl_octet_cnt);
490+
seq_printf(filp, "secy%d: Unctrl bcast cnt: %lld\n", secy_id,
491+
stats.unctl_pkt_bcast_cnt);
492+
seq_printf(filp, "secy%d: Unctrl mcast pkts: %lld\n", secy_id,
493+
stats.unctl_pkt_mcast_cnt);
494+
seq_printf(filp, "secy%d: Unctrl ucast pkts: %lld\n", secy_id,
495+
stats.unctl_pkt_ucast_cnt);
496+
seq_printf(filp, "secy%d: Unctrl octets: %lld\n", secy_id, stats.unctl_octet_cnt);
497+
seq_printf(filp, "secy%d: Octet decrypted: %lld\n", secy_id,
498+
stats.octet_decrypted_cnt);
499+
seq_printf(filp, "secy%d: octet validated: %lld\n", secy_id,
500+
stats.octet_validated_cnt);
501+
seq_printf(filp, "secy%d: Pkts on disable port: %lld\n", secy_id,
502+
stats.pkt_port_disabled_cnt);
503+
seq_printf(filp, "secy%d: Octets validated: %lld\n", secy_id, stats.pkt_badtag_cnt);
504+
seq_printf(filp, "secy%d: Octets validated: %lld\n", secy_id, stats.pkt_nosa_cnt);
505+
seq_printf(filp, "secy%d: Pkts with nosaerror: %lld\n", secy_id,
506+
stats.pkt_nosaerror_cnt);
507+
seq_printf(filp, "secy%d: Tagged ctrl pkts: %lld\n", secy_id,
508+
stats.pkt_tagged_ctl_cnt);
509+
seq_printf(filp, "secy%d: Untaged pkts: %lld\n", secy_id, stats.pkt_untaged_cnt);
510+
seq_printf(filp, "secy%d: Ctrl pkts: %lld\n", secy_id, stats.pkt_ctl_cnt);
511+
if (mcs->hw->mcs_blks > 1)
512+
seq_printf(filp, "secy%d: pkts notag: %lld\n", secy_id,
513+
stats.pkt_notag_cnt);
514+
}
515+
mutex_unlock(&mcs->stats_lock);
516+
return 0;
517+
}
518+
519+
RVU_DEBUG_SEQ_FOPS(mcs_rx_secy_stats, mcs_rx_secy_stats_display, NULL);
520+
521+
static void rvu_dbg_mcs_init(struct rvu *rvu)
522+
{
523+
struct mcs *mcs;
524+
char dname[10];
525+
int i;
526+
527+
if (!rvu->mcs_blk_cnt)
528+
return;
529+
530+
rvu->rvu_dbg.mcs_root = debugfs_create_dir("mcs", rvu->rvu_dbg.root);
531+
532+
for (i = 0; i < rvu->mcs_blk_cnt; i++) {
533+
mcs = mcs_get_pdata(i);
534+
535+
sprintf(dname, "mcs%d", i);
536+
rvu->rvu_dbg.mcs = debugfs_create_dir(dname,
537+
rvu->rvu_dbg.mcs_root);
538+
539+
rvu->rvu_dbg.mcs_rx = debugfs_create_dir("rx_stats", rvu->rvu_dbg.mcs);
540+
541+
debugfs_create_file("flowid", 0600, rvu->rvu_dbg.mcs_rx, mcs,
542+
&rvu_dbg_mcs_rx_flowid_stats_fops);
543+
544+
debugfs_create_file("secy", 0600, rvu->rvu_dbg.mcs_rx, mcs,
545+
&rvu_dbg_mcs_rx_secy_stats_fops);
546+
547+
debugfs_create_file("sc", 0600, rvu->rvu_dbg.mcs_rx, mcs,
548+
&rvu_dbg_mcs_rx_sc_stats_fops);
549+
550+
debugfs_create_file("sa", 0600, rvu->rvu_dbg.mcs_rx, mcs,
551+
&rvu_dbg_mcs_rx_sa_stats_fops);
552+
553+
debugfs_create_file("port", 0600, rvu->rvu_dbg.mcs_rx, mcs,
554+
&rvu_dbg_mcs_rx_port_stats_fops);
555+
556+
rvu->rvu_dbg.mcs_tx = debugfs_create_dir("tx_stats", rvu->rvu_dbg.mcs);
557+
558+
debugfs_create_file("flowid", 0600, rvu->rvu_dbg.mcs_tx, mcs,
559+
&rvu_dbg_mcs_tx_flowid_stats_fops);
560+
561+
debugfs_create_file("secy", 0600, rvu->rvu_dbg.mcs_tx, mcs,
562+
&rvu_dbg_mcs_tx_secy_stats_fops);
563+
564+
debugfs_create_file("sc", 0600, rvu->rvu_dbg.mcs_tx, mcs,
565+
&rvu_dbg_mcs_tx_sc_stats_fops);
566+
567+
debugfs_create_file("sa", 0600, rvu->rvu_dbg.mcs_tx, mcs,
568+
&rvu_dbg_mcs_tx_sa_stats_fops);
569+
570+
debugfs_create_file("port", 0600, rvu->rvu_dbg.mcs_tx, mcs,
571+
&rvu_dbg_mcs_tx_port_stats_fops);
572+
}
573+
}
574+
230575
#define LMT_MAPTBL_ENTRY_SIZE 16
231576
/* Dump LMTST map table */
232577
static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp,
@@ -3053,6 +3398,7 @@ void rvu_dbg_init(struct rvu *rvu)
30533398
rvu_dbg_npc_init(rvu);
30543399
rvu_dbg_cpt_init(rvu, BLKADDR_CPT0);
30553400
rvu_dbg_cpt_init(rvu, BLKADDR_CPT1);
3401+
rvu_dbg_mcs_init(rvu);
30563402
}
30573403

30583404
void rvu_dbg_exit(struct rvu *rvu)

0 commit comments

Comments
 (0)