git: 5f328e9e3f3f - stable/13 - cxgbe(4): sysctl to track the last L1_CFG32 requested by the driver.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Mon, 28 Feb 2022 06:55:37 UTC
The branch stable/13 has been updated by np:

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

commit 5f328e9e3f3fbe304153ca9bd93f9ea5ac4b94ae
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2021-11-03 18:00:44 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2022-02-28 06:42:32 +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
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit d99b1d83b9e9ae2c47ffbd71a7c2a261d9eae2dd)
---
 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 1522b500c496..235f9a52546a 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -5762,6 +5762,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)
@@ -7823,6 +7824,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,