Skip to contentSkip to conversation

net/cxgbe: minor fixes for link related changes

PATCH In review Rahul Lakkireddy 2 participants 4 messages Jan 15, 2021 – Jan 19, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/cxgbe: minor fixes for link related changes

Patch 1 fixes issue with link status always getting set to down by driver for every link config change request. This is not required for some link config changes, like Tx/Rx pause on/off. Instead, driver should rely on actual link status returned by firmware in link config change reply.

Patch 2 fixes issue with link FEC retraining during probe. If firmware had already saved FEC before probe is completed, then use the saved FEC for further link configuration, instead of triggering link retraining. Also simplifies get fec ops.

Thanks,
Rahul

Rahul Lakkireddy (2):
net/cxgbe: do not link down for every link config change net/cxgbe: avoid link FEC retraining during probe

 drivers/net/cxgbe/base/t4_hw.c   | 17 ++++++++++++-----
 drivers/net/cxgbe/cxgbe_ethdev.c | 21 +++++----------------
 2 files changed, 17 insertions(+), 21 deletions(-)
Signature · 1 line
2.24.0
#1 lore raw

PATCH 1/2 net/cxgbe: do not link down for every link config change

Some commands like turning local Tx/Rx pause on/off do not need link to go down. If there are issues with link config params, then the firmware will explicitly indicate link down in reply. So, don't always link down for every link config param change request. Instead, rely on actual link status coming in firmware's link config change reply.

Fixes 61570952b138 ("net/cxgbe: rework and simplify link handling code")
---
 drivers/net/cxgbe/base/t4_hw.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/cxgbe/base/t4_hw.c +2 -4
index e87823f8f..8587eec60 100644
@@ -2844,14 +2844,12 @@ int t4_link_l1cfg_core(struct port_info *pi, u32 caps, u8 sleep_ok)
 	else
 		ret = t4_wr_mbox_ns(adap, adap->mbox, &cmd, sizeof(cmd), NULL);
 
-	if (ret == FW_SUCCESS) {
-		lc->link_ok = 0;
+	if (ret == FW_SUCCESS)
 		lc->link_caps = caps;
-	} else {
+	else
 		dev_err(adap,
 			"Requested Port Capabilities %#x rejected, error %d\n",
 			caps, ret);
-	}
 
 	return ret;
 }
Signature · 1 line
2.24.0
#2 lore raw

PATCH 2/2 net/cxgbe: avoid link FEC retraining during probe

In reply to Rahul Lakkireddy

If link FEC has already been saved by firmware during link training in probe, then use the saved FEC value, instead of retraining the link. If link training is still not complete in probe, then firmware will send the actual FEC later in link config change reply after training is complete.

Also, there can only be 1 active FEC at any time. So, simplify the FEC get ops. If FEC is supported and if none of the supported FEC caps are set, then assume NOFEC by default, instead of AUTO.

Fixes b99a547371e3 ("net/cxgbe: support configuring link FEC")
---
 drivers/net/cxgbe/base/t4_hw.c   | 11 ++++++++++-
 drivers/net/cxgbe/cxgbe_ethdev.c | 21 +++++----------------
 2 files changed, 15 insertions(+), 17 deletions(-)
drivers/net/cxgbe/base/t4_hw.c +10 -1
index 8587eec60..ef20dc667 100644
@@ -4700,6 +4700,7 @@ void t4_reset_link_config(struct adapter *adap, int idx)
 void t4_init_link_config(struct port_info *pi, u32 pcaps, u32 acaps,
 			 u8 mdio_addr, u8 port_type, u8 mod_type)
 {
+	u8 fec_rs = 0, fec_baser = 0, fec_none = 0;
 	struct link_config *lc = &pi->link_cfg;
 
 	lc->pcaps = pcaps;
@@ -4722,8 +4723,16 @@ void t4_init_link_config(struct port_info *pi, u32 pcaps, u32 acaps,
 
 	/* Reset FEC caps to default values */
 	if (lc->pcaps & V_FW_PORT_CAP32_FEC(M_FW_PORT_CAP32_FEC)) {
+		if (lc->acaps & FW_PORT_CAP32_FEC_RS)
+			fec_rs = 1;
+		else if (lc->acaps & FW_PORT_CAP32_FEC_BASER_RS)
+			fec_baser = 1;
+		else
+			fec_none = 1;
+
 		lc->admin_caps &= ~V_FW_PORT_CAP32_FEC(M_FW_PORT_CAP32_FEC);
-		t4_set_link_fec(pi, 0, 0, 0, &lc->admin_caps);
+		t4_set_link_fec(pi, fec_rs, fec_baser, fec_none,
+				&lc->admin_caps);
 	}
 
 	if (lc->pcaps & FW_PORT_CAP32_FORCE_FEC)
drivers/net/cxgbe/cxgbe_ethdev.c +5 -16
index 6f481551d..eb4258fe1 100644
@@ -1256,24 +1256,13 @@ static int cxgbe_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa)
 	if (!(lc->pcaps & V_FW_PORT_CAP32_FEC(M_FW_PORT_CAP32_FEC)))
 		return -EOPNOTSUPP;
 
-	if (caps & FW_PORT_CAP32_FEC_NO_FEC) {
-		fec_caps = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC);
-		goto out;
-	}
-
-	if (caps & FW_PORT_CAP32_FEC_BASER_RS) {
-		fec_caps = RTE_ETH_FEC_MODE_CAPA_MASK(BASER);
-		goto out;
-	}
-
-	if (caps & FW_PORT_CAP32_FEC_RS) {
+	if (caps & FW_PORT_CAP32_FEC_RS)
 		fec_caps = RTE_ETH_FEC_MODE_CAPA_MASK(RS);
-		goto out;
-	}
-
-	fec_caps = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO);
+	else if (caps & FW_PORT_CAP32_FEC_BASER_RS)
+		fec_caps = RTE_ETH_FEC_MODE_CAPA_MASK(BASER);
+	else
+		fec_caps = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC);
 
-out:
 	*fec_capa = fec_caps;
 	return 0;
 }
Signature · 1 line
2.24.0
#3 lore raw
In reply to Rahul Lakkireddy
Quoted 14 lines · Rahul Lakkireddy

Patch 1 fixes issue with link status always getting set to down by driver for every link config change request. This is not required for some link config changes, like Tx/Rx pause on/off. Instead, driver should rely on actual link status returned by firmware in link config change reply.

Patch 2 fixes issue with link FEC retraining during probe. If firmware had already saved FEC before probe is completed, then use the saved FEC for further link configuration, instead of triggering link retraining. Also simplifies get fec ops.

Thanks,
Rahul

Quoted 8 lines

Rahul Lakkireddy (2):
net/cxgbe: do not link down for every link config change net/cxgbe: avoid link FEC retraining during probe

  drivers/net/cxgbe/base/t4_hw.c   | 17 ++++++++++++-----
  drivers/net/cxgbe/cxgbe_ethdev.c | 21 +++++----------------
  2 files changed, 17 insertions(+), 21 deletions(-)

Set squashed into relevant commits in next-net, thanks.