aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorHariprasad Shenai <hariprasad@chelsio.com>2015-02-06 09:02:55 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-08 01:52:39 -0500
commitbad4379263d2c2442f5273adc856dd67e4274f3f (patch)
treeeaee8c8a3ec8c75dce02aac7888b519aed4bd12e /drivers/net/ethernet
parentbf7c781d576823e5d71f40585aeeac430a1845c8 (diff)
cxgb4: Add support in debugfs to dump the congestion control table
Dump Transport Processor modules congestion control configuration Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4.h1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c28
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c21
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_regs.h3
4 files changed, 53 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 6e18b42cafb3..0fe3a52fb0b8 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -1173,6 +1173,7 @@ void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres);
1173const char *t4_get_port_type_description(enum fw_port_type port_type); 1173const char *t4_get_port_type_description(enum fw_port_type port_type);
1174void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); 1174void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
1175void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); 1175void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
1176void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]);
1176void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, 1177void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
1177 unsigned int mask, unsigned int val); 1178 unsigned int mask, unsigned int val);
1178void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); 1179void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 83e29320a945..a1029eecef02 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -663,6 +663,33 @@ static const struct file_operations pm_stats_debugfs_fops = {
663 .write = pm_stats_clear 663 .write = pm_stats_clear
664}; 664};
665 665
666static int cctrl_tbl_show(struct seq_file *seq, void *v)
667{
668 static const char * const dec_fac[] = {
669 "0.5", "0.5625", "0.625", "0.6875", "0.75", "0.8125", "0.875",
670 "0.9375" };
671
672 int i;
673 u16 incr[NMTUS][NCCTRL_WIN];
674 struct adapter *adap = seq->private;
675
676 t4_read_cong_tbl(adap, incr);
677
678 for (i = 0; i < NCCTRL_WIN; ++i) {
679 seq_printf(seq, "%2d: %4u %4u %4u %4u %4u %4u %4u %4u\n", i,
680 incr[0][i], incr[1][i], incr[2][i], incr[3][i],
681 incr[4][i], incr[5][i], incr[6][i], incr[7][i]);
682 seq_printf(seq, "%8u %4u %4u %4u %4u %4u %4u %4u %5u %s\n",
683 incr[8][i], incr[9][i], incr[10][i], incr[11][i],
684 incr[12][i], incr[13][i], incr[14][i], incr[15][i],
685 adap->params.a_wnd[i],
686 dec_fac[adap->params.b_wnd[i]]);
687 }
688 return 0;
689}
690
691DEFINE_SIMPLE_DEBUGFS_FILE(cctrl_tbl);
692
666/* Format a value in a unit that differs from the value's native unit by the 693/* Format a value in a unit that differs from the value's native unit by the
667 * given factor. 694 * given factor.
668 */ 695 */
@@ -1990,6 +2017,7 @@ int t4_setup_debugfs(struct adapter *adap)
1990 { "ulprx_la", &ulprx_la_fops, S_IRUSR, 0 }, 2017 { "ulprx_la", &ulprx_la_fops, S_IRUSR, 0 },
1991 { "sensors", &sensors_debugfs_fops, S_IRUSR, 0 }, 2018 { "sensors", &sensors_debugfs_fops, S_IRUSR, 0 },
1992 { "pm_stats", &pm_stats_debugfs_fops, S_IRUSR, 0 }, 2019 { "pm_stats", &pm_stats_debugfs_fops, S_IRUSR, 0 },
2020 { "cctrl", &cctrl_tbl_debugfs_fops, S_IRUSR, 0 },
1993#if IS_ENABLED(CONFIG_IPV6) 2021#if IS_ENABLED(CONFIG_IPV6)
1994 { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 }, 2022 { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 },
1995#endif 2023#endif
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 9938f2aa5ef7..2c13e8005319 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -2419,6 +2419,27 @@ void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log)
2419} 2419}
2420 2420
2421/** 2421/**
2422 * t4_read_cong_tbl - reads the congestion control table
2423 * @adap: the adapter
2424 * @incr: where to store the alpha values
2425 *
2426 * Reads the additive increments programmed into the HW congestion
2427 * control table.
2428 */
2429void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN])
2430{
2431 unsigned int mtu, w;
2432
2433 for (mtu = 0; mtu < NMTUS; ++mtu)
2434 for (w = 0; w < NCCTRL_WIN; ++w) {
2435 t4_write_reg(adap, TP_CCTRL_TABLE_A,
2436 ROWINDEX_V(0xffff) | (mtu << 5) | w);
2437 incr[mtu][w] = (u16)t4_read_reg(adap,
2438 TP_CCTRL_TABLE_A) & 0x1fff;
2439 }
2440}
2441
2442/**
2422 * t4_tp_wr_bits_indirect - set/clear bits in an indirect TP register 2443 * t4_tp_wr_bits_indirect - set/clear bits in an indirect TP register
2423 * @adap: the adapter 2444 * @adap: the adapter
2424 * @addr: the indirect TP register address 2445 * @addr: the indirect TP register address
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
index 3f18d5c5e7f0..231a725f6d5d 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
@@ -1292,6 +1292,9 @@
1292#define KEEPALIVEMAXR2_V(x) ((x) << KEEPALIVEMAXR2_S) 1292#define KEEPALIVEMAXR2_V(x) ((x) << KEEPALIVEMAXR2_S)
1293#define KEEPALIVEMAXR2_G(x) (((x) >> KEEPALIVEMAXR2_S) & KEEPALIVEMAXR2_M) 1293#define KEEPALIVEMAXR2_G(x) (((x) >> KEEPALIVEMAXR2_S) & KEEPALIVEMAXR2_M)
1294 1294
1295#define ROWINDEX_S 16
1296#define ROWINDEX_V(x) ((x) << ROWINDEX_S)
1297
1295#define TP_CCTRL_TABLE_A 0x7ddc 1298#define TP_CCTRL_TABLE_A 0x7ddc
1296#define TP_MTU_TABLE_A 0x7de4 1299#define TP_MTU_TABLE_A 0x7de4
1297 1300