git: d99b1d83b9e9 - main - cxgbe(4): sysctl to track the last L1_CFG32 requested by the driver.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Wed, 10 Nov 2021 01:16:27 UTC
The branch main has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=d99b1d83b9e9ae2c47ffbd71a7c2a261d9eae2dd

commit d99b1d83b9e9ae2c47ffbd71a7c2a261d9eae2dd
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2021-11-03 18:00:44 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2021-11-09 23:41:20 +0000

    cxgbe(4): sysctl to track the last L1_CFG32 requested by the driver.
    
    dev.<port>.<inst>.rcaps
    
     # sysctl dev.cc | grep rcaps
     dev.cc.1.rcaps: 581107776
     dev.cc.0.rcaps: 582156414
    
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/common/common.h | 1 +
 sys/dev/cxgbe/common/t4_hw.c  | 1 +
 sys/dev/cxgbe/t4_main.c       | 3 +++
 3 files changed, 5 insertions(+)

diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h
index 07d8ab2b40f0..50859e868b9d 100644
--- a/sys/dev/cxgbe/common/common.h
+++ b/sys/dev/cxgbe/common/common.h
@@ -444,6 +444,7 @@ struct link_config {
 	int8_t requested_fc;	/* flow control */
 	int8_t requested_fec;	/* FEC */
 	u_int requested_speed;	/* speed (Mbps) */
+	uint32_t requested_caps;/* rcap in last l1cfg issued by the driver. */
 
 	uint32_t pcaps;		/* link capabilities */
 	uint32_t acaps;		/* advertised capabilities */
diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c
index f06b21120061..b9bf5df5ccc6 100644
--- a/sys/dev/cxgbe/common/t4_hw.c
+++ b/sys/dev/cxgbe/common/t4_hw.c
@@ -3975,6 +3975,7 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,
 		c.u.l1cfg.rcap = cpu_to_be32(fwcaps32_to_caps16(rcap));
 	}
 
+	lc->requested_caps = rcap;
 	return t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), NULL);
 }
 
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 66f48f2bf922..1c51e4847959 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -5703,6 +5703,7 @@ init_link_config(struct port_info *pi)
 
 	PORT_LOCK_ASSERT_OWNED(pi);
 
+	lc->requested_caps = 0;
 	lc->requested_speed = 0;
 
 	if (t4_autoneg == 0)
@@ -7770,6 +7771,8 @@ cxgbe_sysctls(struct port_info *pi)
 	    sysctl_autoneg, "I",
 	    "autonegotiation (-1 = not supported)");
 
+	SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rcaps", CTLFLAG_RD,
+	    &pi->link_cfg.requested_caps, 0, "L1 config requested by driver");
 	SYSCTL_ADD_INT(ctx, children, OID_AUTO, "pcaps", CTLFLAG_RD,
 	    &pi->link_cfg.pcaps, 0, "port capabilities");
 	SYSCTL_ADD_INT(ctx, children, OID_AUTO, "acaps", CTLFLAG_RD,