DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: kaara.satwik@chelsio.com
Subject: [dpdk-dev] [PATCH 2/2] net/cxgbe: avoid link FEC retraining during probe
Date: Fri, 15 Jan 2021 22:49:17 +0530	[thread overview]
Message-ID: <92d7ce2b978c6dd777d2c25e536530972789d10c.1610730372.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1610730372.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1610730372.git.rahul.lakkireddy@chelsio.com>

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")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/cxgbe/base/t4_hw.c   | 11 ++++++++++-
 drivers/net/cxgbe/cxgbe_ethdev.c | 21 +++++----------------
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 8587eec60..ef20dc667 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -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)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 6f481551d..eb4258fe1 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -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;
 }
-- 
2.24.0


  parent reply	other threads:[~2021-01-15 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 17:19 [dpdk-dev] [PATCH 0/2] net/cxgbe: minor fixes for link related changes Rahul Lakkireddy
2021-01-15 17:19 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: do not link down for every link config change Rahul Lakkireddy
2021-01-15 17:19 ` Rahul Lakkireddy [this message]
2021-01-19  1:52 ` [dpdk-dev] [PATCH 0/2] net/cxgbe: minor fixes for link related changes Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92d7ce2b978c6dd777d2c25e536530972789d10c.1610730372.git.rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=kaara.satwik@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).