forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
....@@ -49,6 +49,7 @@
4949 #include "cudbg_lib_common.h"
5050 #include "cudbg_entity.h"
5151 #include "cudbg_lib.h"
52
+#include "cxgb4_tc_mqprio.h"
5253
5354 /* generic seq_file support for showing a table of size rows x width. */
5455 static void *seq_tab_get_idx(struct seq_tab *tb, loff_t pos)
....@@ -377,19 +378,7 @@
377378 QUEREMFLITS_G(p[2]) * 16);
378379 return 0;
379380 }
380
-
381
-static int cim_qcfg_open(struct inode *inode, struct file *file)
382
-{
383
- return single_open(file, cim_qcfg_show, inode->i_private);
384
-}
385
-
386
-static const struct file_operations cim_qcfg_fops = {
387
- .owner = THIS_MODULE,
388
- .open = cim_qcfg_open,
389
- .read = seq_read,
390
- .llseek = seq_lseek,
391
- .release = single_release,
392
-};
381
+DEFINE_SHOW_ATTRIBUTE(cim_qcfg);
393382
394383 static int cimq_show(struct seq_file *seq, void *v, int idx)
395384 {
....@@ -859,8 +848,7 @@
859848 }
860849 return 0;
861850 }
862
-
863
-DEFINE_SIMPLE_DEBUGFS_FILE(tx_rate);
851
+DEFINE_SHOW_ATTRIBUTE(tx_rate);
864852
865853 static int cctrl_tbl_show(struct seq_file *seq, void *v)
866854 {
....@@ -892,8 +880,7 @@
892880 kfree(incr);
893881 return 0;
894882 }
895
-
896
-DEFINE_SIMPLE_DEBUGFS_FILE(cctrl_tbl);
883
+DEFINE_SHOW_ATTRIBUTE(cctrl_tbl);
897884
898885 /* Format a value in a unit that differs from the value's native unit by the
899886 * given factor.
....@@ -954,8 +941,7 @@
954941
955942 return 0;
956943 }
957
-
958
-DEFINE_SIMPLE_DEBUGFS_FILE(clk);
944
+DEFINE_SHOW_ATTRIBUTE(clk);
959945
960946 /* Firmware Device Log dump. */
961947 static const char * const devlog_level_strings[] = {
....@@ -999,7 +985,7 @@
999985 struct devlog_info {
1000986 unsigned int nentries; /* number of entries in log[] */
1001987 unsigned int first; /* first [temporal] entry in log[] */
1002
- struct fw_devlog_e log[0]; /* Firmware Device Log */
988
+ struct fw_devlog_e log[]; /* Firmware Device Log */
1003989 };
1004990
1005991 /* Dump a Firmaware Device Log entry.
....@@ -1827,12 +1813,8 @@
18271813 /* Inner header lookup */
18281814 if (lookup_type && (lookup_type != DATALKPTYPE_M)) {
18291815 seq_printf(seq,
1830
- "%3u %02x:%02x:%02x:%02x:%02x:%02x "
1831
- "%012llx %06x %06x - - %3c"
1832
- " 'I' %4x "
1833
- "%3c %#x%4u%4d", idx, addr[0],
1834
- addr[1], addr[2], addr[3],
1835
- addr[4], addr[5],
1816
+ "%3u %pM %012llx %06x %06x - - %3c 'I' %4x %3c %#x%4u%4d",
1817
+ idx, addr,
18361818 (unsigned long long)mask,
18371819 vniy, (vnix | vniy),
18381820 dip_hit ? 'Y' : 'N',
....@@ -1844,10 +1826,8 @@
18441826 T6_VF_G(cls_lo) : -1);
18451827 } else {
18461828 seq_printf(seq,
1847
- "%3u %02x:%02x:%02x:%02x:%02x:%02x "
1848
- "%012llx - - ",
1849
- idx, addr[0], addr[1], addr[2],
1850
- addr[3], addr[4], addr[5],
1829
+ "%3u %pM %012llx - - ",
1830
+ idx, addr,
18511831 (unsigned long long)mask);
18521832
18531833 if (vlan_vld)
....@@ -1865,10 +1845,8 @@
18651845 T6_VF_G(cls_lo) : -1);
18661846 }
18671847 } else
1868
- seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x "
1869
- "%012llx%3c %#x%4u%4d",
1870
- idx, addr[0], addr[1], addr[2], addr[3],
1871
- addr[4], addr[5], (unsigned long long)mask,
1848
+ seq_printf(seq, "%3u %pM %012llx%3c %#x%4u%4d",
1849
+ idx, addr, (unsigned long long)mask,
18721850 (cls_lo & SRAM_VLD_F) ? 'Y' : 'N',
18731851 PORTMAP_G(cls_hi),
18741852 PF_G(cls_lo),
....@@ -1989,22 +1967,10 @@
19891967
19901968 return 0;
19911969 }
1992
-
1993
-DEFINE_SIMPLE_DEBUGFS_FILE(sensors);
1970
+DEFINE_SHOW_ATTRIBUTE(sensors);
19941971
19951972 #if IS_ENABLED(CONFIG_IPV6)
1996
-static int clip_tbl_open(struct inode *inode, struct file *file)
1997
-{
1998
- return single_open(file, clip_tbl_show, inode->i_private);
1999
-}
2000
-
2001
-static const struct file_operations clip_tbl_debugfs_fops = {
2002
- .owner = THIS_MODULE,
2003
- .open = clip_tbl_open,
2004
- .read = seq_read,
2005
- .llseek = seq_lseek,
2006
- .release = single_release
2007
-};
1973
+DEFINE_SHOW_ATTRIBUTE(clip_tbl);
20081974 #endif
20091975
20101976 /*RSS Table.
....@@ -2207,8 +2173,7 @@
22072173
22082174 return 0;
22092175 }
2210
-
2211
-DEFINE_SIMPLE_DEBUGFS_FILE(rss_config);
2176
+DEFINE_SHOW_ATTRIBUTE(rss_config);
22122177
22132178 /* RSS Secret Key.
22142179 */
....@@ -2414,7 +2379,6 @@
24142379 };
24152380
24162381 #ifdef CONFIG_CHELSIO_T4_DCB
2417
-extern char *dcb_ver_array[];
24182382
24192383 /* Data Center Briging information for each port.
24202384 */
....@@ -2627,19 +2591,7 @@
26272591
26282592 return 0;
26292593 }
2630
-
2631
-static int resources_open(struct inode *inode, struct file *file)
2632
-{
2633
- return single_open(file, resources_show, inode->i_private);
2634
-}
2635
-
2636
-static const struct file_operations resources_debugfs_fops = {
2637
- .owner = THIS_MODULE,
2638
- .open = resources_open,
2639
- .read = seq_read,
2640
- .llseek = seq_lseek,
2641
- .release = seq_release,
2642
-};
2594
+DEFINE_SHOW_ATTRIBUTE(resources);
26432595
26442596 /**
26452597 * ethqset2pinfo - return port_info of an Ethernet Queue Set
....@@ -2659,7 +2611,7 @@
26592611 }
26602612
26612613 /* should never happen! */
2662
- BUG_ON(1);
2614
+ BUG();
26632615 return NULL;
26642616 }
26652617
....@@ -2697,30 +2649,19 @@
26972649
26982650 static int sge_qinfo_show(struct seq_file *seq, void *v)
26992651 {
2652
+ int eth_entries, ctrl_entries, eohw_entries = 0, eosw_entries = 0;
27002653 int uld_rxq_entries[CXGB4_ULD_MAX] = { 0 };
27012654 int uld_ciq_entries[CXGB4_ULD_MAX] = { 0 };
27022655 int uld_txq_entries[CXGB4_TX_MAX] = { 0 };
27032656 const struct sge_uld_txq_info *utxq_info;
27042657 const struct sge_uld_rxq_info *urxq_info;
2658
+ struct cxgb4_tc_port_mqprio *port_mqprio;
27052659 struct adapter *adap = seq->private;
2706
- int i, n, r = (uintptr_t)v - 1;
2707
- int eth_entries, ctrl_entries;
2660
+ int i, j, n, r = (uintptr_t)v - 1;
27082661 struct sge *s = &adap->sge;
27092662
27102663 eth_entries = DIV_ROUND_UP(adap->sge.ethqsets, 4);
27112664 ctrl_entries = DIV_ROUND_UP(MAX_CTRL_QUEUES, 4);
2712
-
2713
- mutex_lock(&uld_mutex);
2714
- if (s->uld_txq_info)
2715
- for (i = 0; i < ARRAY_SIZE(uld_txq_entries); i++)
2716
- uld_txq_entries[i] = sge_qinfo_uld_txq_entries(adap, i);
2717
-
2718
- if (s->uld_rxq_info) {
2719
- for (i = 0; i < ARRAY_SIZE(uld_rxq_entries); i++) {
2720
- uld_rxq_entries[i] = sge_qinfo_uld_rxq_entries(adap, i);
2721
- uld_ciq_entries[i] = sge_qinfo_uld_ciq_entries(adap, i);
2722
- }
2723
- }
27242665
27252666 if (r)
27262667 seq_putc(seq, '\n');
....@@ -2783,7 +2724,9 @@
27832724 RL("LROmerged:", stats.lro_merged);
27842725 RL("LROpackets:", stats.lro_pkts);
27852726 RL("RxDrops:", stats.rx_drops);
2727
+ RL("RxBadPkts:", stats.bad_rx_pkts);
27862728 TL("TSO:", tso);
2729
+ TL("USO:", uso);
27872730 TL("TxCSO:", tx_cso);
27882731 TL("VLANins:", vlan_ins);
27892732 TL("TxQFull:", q.stops);
....@@ -2795,10 +2738,182 @@
27952738 RL("FLLow:", fl.low);
27962739 RL("FLStarving:", fl.starving);
27972740
2798
- goto unlock;
2741
+ goto out;
27992742 }
28002743
28012744 r -= eth_entries;
2745
+ for_each_port(adap, j) {
2746
+ struct port_info *pi = adap2pinfo(adap, j);
2747
+ const struct sge_eth_rxq *rx;
2748
+
2749
+ mutex_lock(&pi->vi_mirror_mutex);
2750
+ if (!pi->vi_mirror_count) {
2751
+ mutex_unlock(&pi->vi_mirror_mutex);
2752
+ continue;
2753
+ }
2754
+
2755
+ if (r >= DIV_ROUND_UP(pi->nmirrorqsets, 4)) {
2756
+ r -= DIV_ROUND_UP(pi->nmirrorqsets, 4);
2757
+ mutex_unlock(&pi->vi_mirror_mutex);
2758
+ continue;
2759
+ }
2760
+
2761
+ rx = &s->mirror_rxq[j][r * 4];
2762
+ n = min(4, pi->nmirrorqsets - 4 * r);
2763
+
2764
+ S("QType:", "Mirror-Rxq");
2765
+ S("Interface:",
2766
+ rx[i].rspq.netdev ? rx[i].rspq.netdev->name : "N/A");
2767
+ R("RspQ ID:", rspq.abs_id);
2768
+ R("RspQ size:", rspq.size);
2769
+ R("RspQE size:", rspq.iqe_len);
2770
+ R("RspQ CIDX:", rspq.cidx);
2771
+ R("RspQ Gen:", rspq.gen);
2772
+ S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq));
2773
+ S3("u", "Intr pktcnt:", s->counter_val[rx[i].rspq.pktcnt_idx]);
2774
+ R("FL ID:", fl.cntxt_id);
2775
+ R("FL size:", fl.size - 8);
2776
+ R("FL pend:", fl.pend_cred);
2777
+ R("FL avail:", fl.avail);
2778
+ R("FL PIDX:", fl.pidx);
2779
+ R("FL CIDX:", fl.cidx);
2780
+ RL("RxPackets:", stats.pkts);
2781
+ RL("RxCSO:", stats.rx_cso);
2782
+ RL("VLANxtract:", stats.vlan_ex);
2783
+ RL("LROmerged:", stats.lro_merged);
2784
+ RL("LROpackets:", stats.lro_pkts);
2785
+ RL("RxDrops:", stats.rx_drops);
2786
+ RL("RxBadPkts:", stats.bad_rx_pkts);
2787
+ RL("FLAllocErr:", fl.alloc_failed);
2788
+ RL("FLLrgAlcErr:", fl.large_alloc_failed);
2789
+ RL("FLMapErr:", fl.mapping_err);
2790
+ RL("FLLow:", fl.low);
2791
+ RL("FLStarving:", fl.starving);
2792
+
2793
+ mutex_unlock(&pi->vi_mirror_mutex);
2794
+ goto out;
2795
+ }
2796
+
2797
+ if (!adap->tc_mqprio)
2798
+ goto skip_mqprio;
2799
+
2800
+ mutex_lock(&adap->tc_mqprio->mqprio_mutex);
2801
+ if (!refcount_read(&adap->tc_mqprio->refcnt)) {
2802
+ mutex_unlock(&adap->tc_mqprio->mqprio_mutex);
2803
+ goto skip_mqprio;
2804
+ }
2805
+
2806
+ eohw_entries = DIV_ROUND_UP(adap->sge.eoqsets, 4);
2807
+ if (r < eohw_entries) {
2808
+ int base_qset = r * 4;
2809
+ const struct sge_ofld_rxq *rx = &s->eohw_rxq[base_qset];
2810
+ const struct sge_eohw_txq *tx = &s->eohw_txq[base_qset];
2811
+
2812
+ n = min(4, s->eoqsets - 4 * r);
2813
+
2814
+ S("QType:", "ETHOFLD");
2815
+ S("Interface:",
2816
+ rx[i].rspq.netdev ? rx[i].rspq.netdev->name : "N/A");
2817
+ T("TxQ ID:", q.cntxt_id);
2818
+ T("TxQ size:", q.size);
2819
+ T("TxQ inuse:", q.in_use);
2820
+ T("TxQ CIDX:", q.cidx);
2821
+ T("TxQ PIDX:", q.pidx);
2822
+ R("RspQ ID:", rspq.abs_id);
2823
+ R("RspQ size:", rspq.size);
2824
+ R("RspQE size:", rspq.iqe_len);
2825
+ R("RspQ CIDX:", rspq.cidx);
2826
+ R("RspQ Gen:", rspq.gen);
2827
+ S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq));
2828
+ S3("u", "Intr pktcnt:", s->counter_val[rx[i].rspq.pktcnt_idx]);
2829
+ R("FL ID:", fl.cntxt_id);
2830
+ S3("u", "FL size:", rx->fl.size ? rx->fl.size - 8 : 0);
2831
+ R("FL pend:", fl.pend_cred);
2832
+ R("FL avail:", fl.avail);
2833
+ R("FL PIDX:", fl.pidx);
2834
+ R("FL CIDX:", fl.cidx);
2835
+ RL("RxPackets:", stats.pkts);
2836
+ RL("RxImm:", stats.imm);
2837
+ RL("RxAN", stats.an);
2838
+ RL("RxNoMem", stats.nomem);
2839
+ TL("TSO:", tso);
2840
+ TL("USO:", uso);
2841
+ TL("TxCSO:", tx_cso);
2842
+ TL("VLANins:", vlan_ins);
2843
+ TL("TxQFull:", q.stops);
2844
+ TL("TxQRestarts:", q.restarts);
2845
+ TL("TxMapErr:", mapping_err);
2846
+ RL("FLAllocErr:", fl.alloc_failed);
2847
+ RL("FLLrgAlcErr:", fl.large_alloc_failed);
2848
+ RL("FLMapErr:", fl.mapping_err);
2849
+ RL("FLLow:", fl.low);
2850
+ RL("FLStarving:", fl.starving);
2851
+
2852
+ mutex_unlock(&adap->tc_mqprio->mqprio_mutex);
2853
+ goto out;
2854
+ }
2855
+
2856
+ r -= eohw_entries;
2857
+ for (j = 0; j < adap->params.nports; j++) {
2858
+ int entries;
2859
+ u8 tc;
2860
+
2861
+ port_mqprio = &adap->tc_mqprio->port_mqprio[j];
2862
+ entries = 0;
2863
+ for (tc = 0; tc < port_mqprio->mqprio.qopt.num_tc; tc++)
2864
+ entries += port_mqprio->mqprio.qopt.count[tc];
2865
+
2866
+ if (!entries)
2867
+ continue;
2868
+
2869
+ eosw_entries = DIV_ROUND_UP(entries, 4);
2870
+ if (r < eosw_entries) {
2871
+ const struct sge_eosw_txq *tx;
2872
+
2873
+ n = min(4, entries - 4 * r);
2874
+ tx = &port_mqprio->eosw_txq[4 * r];
2875
+
2876
+ S("QType:", "EOSW-TXQ");
2877
+ S("Interface:",
2878
+ adap->port[j] ? adap->port[j]->name : "N/A");
2879
+ T("EOTID:", hwtid);
2880
+ T("HWQID:", hwqid);
2881
+ T("State:", state);
2882
+ T("Size:", ndesc);
2883
+ T("In-Use:", inuse);
2884
+ T("Credits:", cred);
2885
+ T("Compl:", ncompl);
2886
+ T("Last-Compl:", last_compl);
2887
+ T("PIDX:", pidx);
2888
+ T("Last-PIDX:", last_pidx);
2889
+ T("CIDX:", cidx);
2890
+ T("Last-CIDX:", last_cidx);
2891
+ T("FLOWC-IDX:", flowc_idx);
2892
+
2893
+ mutex_unlock(&adap->tc_mqprio->mqprio_mutex);
2894
+ goto out;
2895
+ }
2896
+
2897
+ r -= eosw_entries;
2898
+ }
2899
+ mutex_unlock(&adap->tc_mqprio->mqprio_mutex);
2900
+
2901
+skip_mqprio:
2902
+ if (!is_uld(adap))
2903
+ goto skip_uld;
2904
+
2905
+ mutex_lock(&uld_mutex);
2906
+ if (s->uld_txq_info)
2907
+ for (i = 0; i < ARRAY_SIZE(uld_txq_entries); i++)
2908
+ uld_txq_entries[i] = sge_qinfo_uld_txq_entries(adap, i);
2909
+
2910
+ if (s->uld_rxq_info) {
2911
+ for (i = 0; i < ARRAY_SIZE(uld_rxq_entries); i++) {
2912
+ uld_rxq_entries[i] = sge_qinfo_uld_rxq_entries(adap, i);
2913
+ uld_ciq_entries[i] = sge_qinfo_uld_ciq_entries(adap, i);
2914
+ }
2915
+ }
2916
+
28022917 if (r < uld_txq_entries[CXGB4_TX_OFLD]) {
28032918 const struct sge_uld_txq *tx;
28042919
....@@ -2981,6 +3096,9 @@
29813096 }
29823097
29833098 r -= uld_txq_entries[CXGB4_TX_CRYPTO];
3099
+ mutex_unlock(&uld_mutex);
3100
+
3101
+skip_uld:
29843102 if (r < ctrl_entries) {
29853103 const struct sge_ctrl_txq *tx = &s->ctrlq[r * 4];
29863104
....@@ -2995,7 +3113,7 @@
29953113 TL("TxQFull:", q.stops);
29963114 TL("TxQRestarts:", q.restarts);
29973115
2998
- goto unlock;
3116
+ goto out;
29993117 }
30003118
30013119 r -= ctrl_entries;
....@@ -3013,11 +3131,9 @@
30133131 seq_printf(seq, "%-12s %16u\n", "Intr pktcnt:",
30143132 s->counter_val[evtq->pktcnt_idx]);
30153133
3016
- goto unlock;
3134
+ goto out;
30173135 }
30183136
3019
-unlock:
3020
- mutex_unlock(&uld_mutex);
30213137 #undef R
30223138 #undef RL
30233139 #undef T
....@@ -3026,13 +3142,48 @@
30263142 #undef R3
30273143 #undef T3
30283144 #undef S3
3145
+out:
3146
+ return 0;
3147
+
3148
+unlock:
3149
+ mutex_unlock(&uld_mutex);
30293150 return 0;
30303151 }
30313152
3032
-static int sge_queue_entries(const struct adapter *adap)
3153
+static int sge_queue_entries(struct adapter *adap)
30333154 {
3034
- int tot_uld_entries = 0;
3035
- int i;
3155
+ int i, tot_uld_entries = 0, eohw_entries = 0, eosw_entries = 0;
3156
+ int mirror_rxq_entries = 0;
3157
+
3158
+ if (adap->tc_mqprio) {
3159
+ struct cxgb4_tc_port_mqprio *port_mqprio;
3160
+ u8 tc;
3161
+
3162
+ mutex_lock(&adap->tc_mqprio->mqprio_mutex);
3163
+ if (adap->sge.eohw_txq)
3164
+ eohw_entries = DIV_ROUND_UP(adap->sge.eoqsets, 4);
3165
+
3166
+ for (i = 0; i < adap->params.nports; i++) {
3167
+ u32 entries = 0;
3168
+
3169
+ port_mqprio = &adap->tc_mqprio->port_mqprio[i];
3170
+ for (tc = 0; tc < port_mqprio->mqprio.qopt.num_tc; tc++)
3171
+ entries += port_mqprio->mqprio.qopt.count[tc];
3172
+
3173
+ if (entries)
3174
+ eosw_entries += DIV_ROUND_UP(entries, 4);
3175
+ }
3176
+ mutex_unlock(&adap->tc_mqprio->mqprio_mutex);
3177
+ }
3178
+
3179
+ for_each_port(adap, i) {
3180
+ struct port_info *pi = adap2pinfo(adap, i);
3181
+
3182
+ mutex_lock(&pi->vi_mirror_mutex);
3183
+ if (pi->vi_mirror_count)
3184
+ mirror_rxq_entries += DIV_ROUND_UP(pi->nmirrorqsets, 4);
3185
+ mutex_unlock(&pi->vi_mirror_mutex);
3186
+ }
30363187
30373188 if (!is_uld(adap))
30383189 goto lld_only;
....@@ -3048,8 +3199,8 @@
30483199 mutex_unlock(&uld_mutex);
30493200
30503201 lld_only:
3051
- return DIV_ROUND_UP(adap->sge.ethqsets, 4) +
3052
- tot_uld_entries +
3202
+ return DIV_ROUND_UP(adap->sge.ethqsets, 4) + mirror_rxq_entries +
3203
+ eohw_entries + eosw_entries + tot_uld_entries +
30533204 DIV_ROUND_UP(MAX_CTRL_QUEUES, 4) + 1;
30543205 }
30553206
....@@ -3160,14 +3311,12 @@
31603311
31613312 static int tid_info_show(struct seq_file *seq, void *v)
31623313 {
3163
- unsigned int tid_start = 0;
31643314 struct adapter *adap = seq->private;
3165
- const struct tid_info *t = &adap->tids;
3166
- enum chip_type chip = CHELSIO_CHIP_VERSION(adap->params.chip);
3315
+ const struct tid_info *t;
3316
+ enum chip_type chip;
31673317
3168
- if (chip > CHELSIO_T5)
3169
- tid_start = t4_read_reg(adap, LE_DB_ACTIVE_TABLE_START_INDEX_A);
3170
-
3318
+ t = &adap->tids;
3319
+ chip = CHELSIO_CHIP_VERSION(adap->params.chip);
31713320 if (t4_read_reg(adap, LE_DB_CONFIG_A) & HASHEN_F) {
31723321 unsigned int sb;
31733322 seq_printf(seq, "Connections in use: %u\n",
....@@ -3179,25 +3328,25 @@
31793328 sb = t4_read_reg(adap, LE_DB_SRVR_START_INDEX_A);
31803329
31813330 if (sb) {
3182
- seq_printf(seq, "TID range: %u..%u/%u..%u", tid_start,
3331
+ seq_printf(seq, "TID range: %u..%u/%u..%u", t->tid_base,
31833332 sb - 1, adap->tids.hash_base,
3184
- t->ntids - 1);
3333
+ t->tid_base + t->ntids - 1);
31853334 seq_printf(seq, ", in use: %u/%u\n",
31863335 atomic_read(&t->tids_in_use),
31873336 atomic_read(&t->hash_tids_in_use));
3188
- } else if (adap->flags & FW_OFLD_CONN) {
3337
+ } else if (adap->flags & CXGB4_FW_OFLD_CONN) {
31893338 seq_printf(seq, "TID range: %u..%u/%u..%u",
31903339 t->aftid_base,
31913340 t->aftid_end,
31923341 adap->tids.hash_base,
3193
- t->ntids - 1);
3342
+ t->tid_base + t->ntids - 1);
31943343 seq_printf(seq, ", in use: %u/%u\n",
31953344 atomic_read(&t->tids_in_use),
31963345 atomic_read(&t->hash_tids_in_use));
31973346 } else {
31983347 seq_printf(seq, "TID range: %u..%u",
31993348 adap->tids.hash_base,
3200
- t->ntids - 1);
3349
+ t->tid_base + t->ntids - 1);
32013350 seq_printf(seq, ", in use: %u\n",
32023351 atomic_read(&t->hash_tids_in_use));
32033352 }
....@@ -3205,8 +3354,8 @@
32053354 seq_printf(seq, "Connections in use: %u\n",
32063355 atomic_read(&t->conns_in_use));
32073356
3208
- seq_printf(seq, "TID range: %u..%u", tid_start,
3209
- tid_start + t->ntids - 1);
3357
+ seq_printf(seq, "TID range: %u..%u", t->tid_base,
3358
+ t->tid_base + t->ntids - 1);
32103359 seq_printf(seq, ", in use: %u\n",
32113360 atomic_read(&t->tids_in_use));
32123361 }
....@@ -3229,14 +3378,20 @@
32293378 seq_printf(seq, "SFTID range: %u..%u in use: %u\n",
32303379 t->sftid_base, t->sftid_base + t->nsftids - 2,
32313380 t->sftids_in_use);
3381
+ if (t->nhpftids)
3382
+ seq_printf(seq, "HPFTID range: %u..%u\n", t->hpftid_base,
3383
+ t->hpftid_base + t->nhpftids - 1);
3384
+ if (t->neotids)
3385
+ seq_printf(seq, "EOTID range: %u..%u, in use: %u\n",
3386
+ t->eotid_base, t->eotid_base + t->neotids - 1,
3387
+ atomic_read(&t->eotids_in_use));
32323388 if (t->ntids)
32333389 seq_printf(seq, "HW TID usage: %u IP users, %u IPv6 users\n",
32343390 t4_read_reg(adap, LE_DB_ACT_CNT_IPV4_A),
32353391 t4_read_reg(adap, LE_DB_ACT_CNT_IPV6_A));
32363392 return 0;
32373393 }
3238
-
3239
-DEFINE_SIMPLE_DEBUGFS_FILE(tid_info);
3394
+DEFINE_SHOW_ATTRIBUTE(tid_info);
32403395
32413396 static void add_debugfs_mem(struct adapter *adap, const char *name,
32423397 unsigned int idx, unsigned int size_mb)
....@@ -3263,7 +3418,7 @@
32633418 adap->sge.egr_sz, adap->sge.blocked_fl);
32643419 len += sprintf(buf + len, "\n");
32653420 size = simple_read_from_buffer(ubuf, count, ppos, buf, len);
3266
- kvfree(buf);
3421
+ kfree(buf);
32673422 return size;
32683423 }
32693424
....@@ -3280,12 +3435,12 @@
32803435
32813436 err = bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz);
32823437 if (err) {
3283
- kvfree(t);
3438
+ kfree(t);
32843439 return err;
32853440 }
32863441
32873442 bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz);
3288
- kvfree(t);
3443
+ kfree(t);
32893444 return count;
32903445 }
32913446
....@@ -3368,22 +3523,14 @@
33683523
33693524 return 0;
33703525 }
3526
+DEFINE_SHOW_ATTRIBUTE(meminfo);
33713527
3372
-static int meminfo_open(struct inode *inode, struct file *file)
3528
+static int chcr_stats_show(struct seq_file *seq, void *v)
33733529 {
3374
- return single_open(file, meminfo_show, inode->i_private);
3375
-}
3376
-
3377
-static const struct file_operations meminfo_fops = {
3378
- .owner = THIS_MODULE,
3379
- .open = meminfo_open,
3380
- .read = seq_read,
3381
- .llseek = seq_lseek,
3382
- .release = single_release,
3383
-};
3384
-
3385
-static int chcr_show(struct seq_file *seq, void *v)
3386
-{
3530
+#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
3531
+ struct ch_ktls_port_stats_debug *ktls_port;
3532
+ int i = 0;
3533
+#endif
33873534 struct adapter *adap = seq->private;
33883535
33893536 seq_puts(seq, "Chelsio Crypto Accelerator Stats \n");
....@@ -3399,24 +3546,50 @@
33993546 atomic_read(&adap->chcr_stats.error));
34003547 seq_printf(seq, "Fallback: %10u \n",
34013548 atomic_read(&adap->chcr_stats.fallback));
3549
+ seq_printf(seq, "TLS PDU Tx: %10u\n",
3550
+ atomic_read(&adap->chcr_stats.tls_pdu_tx));
3551
+ seq_printf(seq, "TLS PDU Rx: %10u\n",
3552
+ atomic_read(&adap->chcr_stats.tls_pdu_rx));
3553
+ seq_printf(seq, "TLS Keys (DDR) Count: %10u\n",
3554
+ atomic_read(&adap->chcr_stats.tls_key));
3555
+#if IS_ENABLED(CONFIG_CHELSIO_IPSEC_INLINE)
3556
+ seq_puts(seq, "\nChelsio Inline IPsec Crypto Accelerator Stats\n");
34023557 seq_printf(seq, "IPSec PDU: %10u\n",
3403
- atomic_read(&adap->chcr_stats.ipsec_cnt));
3558
+ atomic_read(&adap->ch_ipsec_stats.ipsec_cnt));
3559
+#endif
3560
+#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
3561
+ seq_puts(seq, "\nChelsio KTLS Crypto Accelerator Stats\n");
3562
+ seq_printf(seq, "Tx TLS offload refcount: %20u\n",
3563
+ refcount_read(&adap->chcr_ktls.ktls_refcount));
3564
+ seq_printf(seq, "Tx records send: %20llu\n",
3565
+ atomic64_read(&adap->ch_ktls_stats.ktls_tx_send_records));
3566
+ seq_printf(seq, "Tx partial start of records: %20llu\n",
3567
+ atomic64_read(&adap->ch_ktls_stats.ktls_tx_start_pkts));
3568
+ seq_printf(seq, "Tx partial middle of records: %20llu\n",
3569
+ atomic64_read(&adap->ch_ktls_stats.ktls_tx_middle_pkts));
3570
+ seq_printf(seq, "Tx partial end of record: %20llu\n",
3571
+ atomic64_read(&adap->ch_ktls_stats.ktls_tx_end_pkts));
3572
+ seq_printf(seq, "Tx complete records: %20llu\n",
3573
+ atomic64_read(&adap->ch_ktls_stats.ktls_tx_complete_pkts));
3574
+ seq_printf(seq, "TX trim pkts : %20llu\n",
3575
+ atomic64_read(&adap->ch_ktls_stats.ktls_tx_trimmed_pkts));
3576
+ seq_printf(seq, "TX sw fallback : %20llu\n",
3577
+ atomic64_read(&adap->ch_ktls_stats.ktls_tx_fallback));
3578
+ while (i < MAX_NPORTS) {
3579
+ ktls_port = &adap->ch_ktls_stats.ktls_port[i];
3580
+ seq_printf(seq, "Port %d\n", i);
3581
+ seq_printf(seq, "Tx connection created: %20llu\n",
3582
+ atomic64_read(&ktls_port->ktls_tx_connection_open));
3583
+ seq_printf(seq, "Tx connection failed: %20llu\n",
3584
+ atomic64_read(&ktls_port->ktls_tx_connection_fail));
3585
+ seq_printf(seq, "Tx connection closed: %20llu\n",
3586
+ atomic64_read(&ktls_port->ktls_tx_connection_close));
3587
+ i++;
3588
+ }
3589
+#endif
34043590 return 0;
34053591 }
3406
-
3407
-
3408
-static int chcr_stats_open(struct inode *inode, struct file *file)
3409
-{
3410
- return single_open(file, chcr_show, inode->i_private);
3411
-}
3412
-
3413
-static const struct file_operations chcr_stats_debugfs_fops = {
3414
- .owner = THIS_MODULE,
3415
- .open = chcr_stats_open,
3416
- .read = seq_read,
3417
- .llseek = seq_lseek,
3418
- .release = single_release,
3419
-};
3592
+DEFINE_SHOW_ATTRIBUTE(chcr_stats);
34203593
34213594 #define PRINT_ADAP_STATS(string, value) \
34223595 seq_printf(seq, "%-25s %-20llu\n", (string), \
....@@ -3577,8 +3750,7 @@
35773750
35783751 return 0;
35793752 }
3580
-
3581
-DEFINE_SIMPLE_DEBUGFS_FILE(tp_stats);
3753
+DEFINE_SHOW_ATTRIBUTE(tp_stats);
35823754
35833755 /* Add an array of Debug FS files.
35843756 */
....@@ -3600,14 +3772,13 @@
36003772 {
36013773 int i;
36023774 u32 size = 0;
3603
- struct dentry *de;
36043775
36053776 static struct t4_debugfs_entry t4_debugfs_files[] = {
36063777 { "cim_la", &cim_la_fops, 0400, 0 },
36073778 { "cim_pif_la", &cim_pif_la_fops, 0400, 0 },
36083779 { "cim_ma_la", &cim_ma_la_fops, 0400, 0 },
36093780 { "cim_qcfg", &cim_qcfg_fops, 0400, 0 },
3610
- { "clk", &clk_debugfs_fops, 0400, 0 },
3781
+ { "clk", &clk_fops, 0400, 0 },
36113782 { "devlog", &devlog_fops, 0400, 0 },
36123783 { "mboxlog", &mboxlog_fops, 0400, 0 },
36133784 { "mbox0", &mbox_debugfs_fops, 0600, 0 },
....@@ -3625,11 +3796,11 @@
36253796 { "l2t", &t4_l2t_fops, 0400, 0},
36263797 { "mps_tcam", &mps_tcam_debugfs_fops, 0400, 0 },
36273798 { "rss", &rss_debugfs_fops, 0400, 0 },
3628
- { "rss_config", &rss_config_debugfs_fops, 0400, 0 },
3799
+ { "rss_config", &rss_config_fops, 0400, 0 },
36293800 { "rss_key", &rss_key_debugfs_fops, 0400, 0 },
36303801 { "rss_pf_config", &rss_pf_config_debugfs_fops, 0400, 0 },
36313802 { "rss_vf_config", &rss_vf_config_debugfs_fops, 0400, 0 },
3632
- { "resources", &resources_debugfs_fops, 0400, 0 },
3803
+ { "resources", &resources_fops, 0400, 0 },
36333804 #ifdef CONFIG_CHELSIO_T4_DCB
36343805 { "dcb_info", &dcb_info_debugfs_fops, 0400, 0 },
36353806 #endif
....@@ -3648,18 +3819,18 @@
36483819 { "obq_ncsi", &cim_obq_fops, 0400, 5 },
36493820 { "tp_la", &tp_la_fops, 0400, 0 },
36503821 { "ulprx_la", &ulprx_la_fops, 0400, 0 },
3651
- { "sensors", &sensors_debugfs_fops, 0400, 0 },
3822
+ { "sensors", &sensors_fops, 0400, 0 },
36523823 { "pm_stats", &pm_stats_debugfs_fops, 0400, 0 },
3653
- { "tx_rate", &tx_rate_debugfs_fops, 0400, 0 },
3654
- { "cctrl", &cctrl_tbl_debugfs_fops, 0400, 0 },
3824
+ { "tx_rate", &tx_rate_fops, 0400, 0 },
3825
+ { "cctrl", &cctrl_tbl_fops, 0400, 0 },
36553826 #if IS_ENABLED(CONFIG_IPV6)
3656
- { "clip_tbl", &clip_tbl_debugfs_fops, 0400, 0 },
3827
+ { "clip_tbl", &clip_tbl_fops, 0400, 0 },
36573828 #endif
3658
- { "tids", &tid_info_debugfs_fops, 0400, 0},
3829
+ { "tids", &tid_info_fops, 0400, 0},
36593830 { "blocked_fl", &blocked_fl_fops, 0600, 0 },
36603831 { "meminfo", &meminfo_fops, 0400, 0 },
3661
- { "crypto", &chcr_stats_debugfs_fops, 0400, 0 },
3662
- { "tp_stats", &tp_stats_debugfs_fops, 0400, 0 },
3832
+ { "crypto", &chcr_stats_fops, 0400, 0 },
3833
+ { "tp_stats", &tp_stats_fops, 0400, 0 },
36633834 };
36643835
36653836 /* Debug FS nodes common to all T5 and later adapters.
....@@ -3711,8 +3882,8 @@
37113882 }
37123883 }
37133884
3714
- de = debugfs_create_file_size("flash", 0400, adap->debugfs_root, adap,
3715
- &flash_debugfs_fops, adap->params.sf_size);
3885
+ debugfs_create_file_size("flash", 0400, adap->debugfs_root, adap,
3886
+ &flash_debugfs_fops, adap->params.sf_size);
37163887 debugfs_create_bool("use_backdoor", 0600,
37173888 adap->debugfs_root, &adap->use_bd);
37183889 debugfs_create_bool("trace_rss", 0600,