DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tduszynski@marvell.com>
To: <dev@dpdk.org>, Jakub Palider <jpalider@marvell.com>,
	Tomasz Duszynski <tduszynski@marvell.com>
Cc: <jerinj@marvell.com>
Subject: [dpdk-dev] [PATCH 3/4] raw/cnxk_bphy: support reading FEC
Date: Thu, 15 Jul 2021 08:53:29 -0500	[thread overview]
Message-ID: <20210715135330.2541009-4-tduszynski@marvell.com> (raw)
In-Reply-To: <20210715135330.2541009-1-tduszynski@marvell.com>

Allow one to retrieve supported FEC setting for specific LMAC.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
---
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c      |  9 +++++++++
 drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c | 23 ++++++++++++++++++++++
 drivers/raw/cnxk_bphy/rte_pmd_bphy.h       |  1 +
 3 files changed, 33 insertions(+)

diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
index 3da2244146..693a9cd2d5 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c
@@ -62,6 +62,7 @@ cnxk_bphy_cgx_process_buf(struct cnxk_bphy_cgx *cgx, unsigned int queue,
 	struct cnxk_bphy_cgx_msg_link_info *link_info;
 	struct roc_bphy_cgx_link_info rlink_info;
 	struct roc_bphy_cgx_link_mode rlink_mode;
+	enum roc_bphy_cgx_eth_link_fec *fec;
 	unsigned int lmac = qp->lmac;
 	void *rsp = NULL;
 	int ret;
@@ -122,6 +123,14 @@ cnxk_bphy_cgx_process_buf(struct cnxk_bphy_cgx *cgx, unsigned int queue,
 	case CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX:
 		ret = roc_bphy_cgx_stop_rxtx(cgx->rcgx, lmac);
 		break;
+	case CNXK_BPHY_CGX_MSG_TYPE_GET_SUPPORTED_FEC:
+		fec = rte_zmalloc(NULL, sizeof(*fec), 0);
+		if (!fec)
+			return -ENOMEM;
+
+		ret = roc_bphy_cgx_fec_supported_get(cgx->rcgx, lmac, fec);
+		rsp = fec;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c
index cb4dd4b221..cd3e6b2e97 100644
--- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c
+++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c
@@ -87,6 +87,22 @@ cnxk_bphy_cgx_link_cond(uint16_t dev_id, unsigned int queue, int cond)
 	return -ETIMEDOUT;
 }
 
+static int
+cnxk_bphy_cgx_get_supported_fec(uint16_t dev_id, unsigned int queue,
+				enum cnxk_bphy_cgx_eth_link_fec *fec)
+{
+	struct cnxk_bphy_cgx_msg msg = {
+		.type = CNXK_BPHY_CGX_MSG_TYPE_GET_SUPPORTED_FEC,
+	};
+	int ret;
+
+	ret = cnxk_bphy_cgx_enq_msg(dev_id, queue, &msg);
+	if (ret)
+		return ret;
+
+	return cnxk_bphy_cgx_deq_msg(dev_id, queue, (void **)&fec);
+}
+
 int
 cnxk_bphy_cgx_dev_selftest(uint16_t dev_id)
 {
@@ -103,6 +119,7 @@ cnxk_bphy_cgx_dev_selftest(uint16_t dev_id)
 
 	for (i = 0; i < queues; i++) {
 		struct cnxk_bphy_cgx_msg_set_link_state link_state;
+		enum cnxk_bphy_cgx_eth_link_fec fec;
 		struct cnxk_bphy_cgx_msg msg;
 		unsigned int descs;
 
@@ -198,6 +215,12 @@ cnxk_bphy_cgx_dev_selftest(uint16_t dev_id)
 			break;
 		}
 		ret = 0;
+
+		ret = cnxk_bphy_cgx_get_supported_fec(dev_id, i, &fec);
+		if (ret) {
+			RTE_LOG(ERR, PMD, "Failed to get supported FEC\n");
+			break;
+		}
 	}
 
 	rte_rawdev_stop(dev_id);
diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
index f3387f38e3..0737964149 100644
--- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
+++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
@@ -17,6 +17,7 @@ enum cnxk_bphy_cgx_msg_type {
 	CNXK_BPHY_CGX_MSG_TYPE_SET_LINK_STATE,
 	CNXK_BPHY_CGX_MSG_TYPE_START_RXTX,
 	CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX,
+	CNXK_BPHY_CGX_MSG_TYPE_GET_SUPPORTED_FEC,
 };
 
 enum cnxk_bphy_cgx_eth_link_speed {
-- 
2.25.1


  parent reply	other threads:[~2021-07-15 13:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 13:53 [dpdk-dev] [PATCH 0/4] raw/cnxk_bphy: add FEC support Tomasz Duszynski
2021-07-15 13:53 ` [dpdk-dev] [PATCH 1/4] common/cnxk: support reading BPHY CGX/RPM FEC Tomasz Duszynski
2021-07-15 13:53 ` [dpdk-dev] [PATCH 2/4] common/cnxk: support setting " Tomasz Duszynski
2021-07-15 13:53 ` Tomasz Duszynski [this message]
2021-07-15 13:53 ` [dpdk-dev] [PATCH 4/4] raw/cnxk_bphy: support setting FEC Tomasz Duszynski
2021-07-23  8:07 ` [dpdk-dev] [PATCH 0/4] raw/cnxk_bphy: add FEC support Thomas Monjalon

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=20210715135330.2541009-4-tduszynski@marvell.com \
    --to=tduszynski@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=jpalider@marvell.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).