From: spinler@cesnet.cz
To: dev@dpdk.org
Cc: Martin Spinler <spinler@cesnet.cz>
Subject: [PATCH v2 4/6] net/nfb: support setting RS-FEC mode
Date: Tue, 17 Feb 2026 12:03:22 +0100 [thread overview]
Message-ID: <20260217110324.3344310-5-spinler@cesnet.cz> (raw)
In-Reply-To: <20260217110324.3344310-1-spinler@cesnet.cz>
From: Martin Spinler <spinler@cesnet.cz>
Enable basic configuration of the RS-FEC link mode over MDIO.
Signed-off-by: Martin Spinler <spinler@cesnet.cz>
---
doc/guides/rel_notes/release_26_03.rst | 2 +-
drivers/net/nfb/nfb_ethdev.c | 65 ++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/doc/guides/rel_notes/release_26_03.rst b/doc/guides/rel_notes/release_26_03.rst
index 8a7e1010fb..ac76ac5b67 100644
--- a/doc/guides/rel_notes/release_26_03.rst
+++ b/doc/guides/rel_notes/release_26_03.rst
@@ -67,7 +67,7 @@ New Features
* Report firmware version and correct Ethernet link speed.
* Common CESNET-NDK-based adapters have been added,
including the FB2CGHH (Silicom Denmark) and XpressSX AGI-FH400G (Reflex CES).
- * Added support for configuration of the Link Up / Link Down state.
+ * Added support for configuration of the RS-FEC mode, Link Up / Link Down state.
Removed Items
diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c
index abb108a280..a556ceca67 100644
--- a/drivers/net/nfb/nfb_ethdev.c
+++ b/drivers/net/nfb/nfb_ethdev.c
@@ -601,6 +601,69 @@ nfb_eth_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
return 0;
}
+static int
+nfb_eth_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa)
+{
+ int reg;
+ struct pmd_internals *intl = dev->process_private;
+ struct mdio_if_info *if_info;
+
+ *fec_capa = 0;
+ if (!intl->max_eth)
+ return 0;
+
+ if_info = &intl->eth_node[0].if_info;
+
+ reg = nfb_mdio_if_read_pma(if_info, NFB_MDIO_PMA_RSFEC_CR);
+ if (reg < 0)
+ return -EIO;
+
+ *fec_capa = (reg & NFB_MDIO_PMA_RSFEC_CR_ENABLE) ?
+ RTE_ETH_FEC_MODE_CAPA_MASK(RS) :
+ RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC);
+
+ return 0;
+}
+
+static int
+nfb_eth_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)
+{
+ int ret;
+ uint32_t fec_capa2 = 0;
+ int reg;
+
+ struct pmd_internals *intl = dev->process_private;
+ struct mdio_if_info *if_info;
+
+ if (!intl->max_eth)
+ return 0;
+
+ if_info = &intl->eth_node[0].if_info;
+
+ if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(AUTO))
+ return -EINVAL;
+
+ reg = nfb_mdio_if_read_pma(if_info, NFB_MDIO_PMA_RSFEC_CR);
+ if (reg < 0)
+ return -EIO;
+
+ reg = (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(RS)) ?
+ (reg | NFB_MDIO_PMA_RSFEC_CR_ENABLE) :
+ (reg & ~NFB_MDIO_PMA_RSFEC_CR_ENABLE);
+ ret = nfb_mdio_if_write_pma(if_info, NFB_MDIO_PMA_RSFEC_CR, reg);
+ if (ret < 0)
+ return -EIO;
+
+ ret = nfb_eth_fec_get(dev, &fec_capa2);
+ if (ret)
+ return ret;
+
+ if (fec_capa != fec_capa2)
+ return -EINVAL;
+
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_start = nfb_eth_dev_start,
.dev_stop = nfb_eth_dev_stop,
@@ -628,6 +691,8 @@ static const struct eth_dev_ops ops = {
.mac_addr_add = nfb_eth_mac_addr_add,
.mac_addr_remove = nfb_eth_mac_addr_remove,
.fw_version_get = nfb_eth_fw_version_get,
+ .fec_get = nfb_eth_fec_get,
+ .fec_set = nfb_eth_fec_set,
};
/**
--
2.53.0
next prev parent reply other threads:[~2026-02-17 11:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 17:04 [PATCH 0/7] net/nfb: ethernet enhancements spinler
2026-02-06 17:04 ` [PATCH 1/7] net/nfb: use MAC address assigned to card spinler
2026-02-06 17:04 ` [PATCH 2/7] net/nfb: get correct link speed spinler
2026-02-06 17:04 ` [PATCH 3/7] net/nfb: support real link-up/down config spinler
2026-02-06 17:04 ` [PATCH 4/7] net/nfb: support setting RS-FEC mode spinler
2026-02-06 17:04 ` [PATCH 5/7] net/nfb: support setting Rx MTU spinler
2026-02-18 18:20 ` Stephen Hemminger
2026-02-19 6:20 ` Martin Spinler
2026-02-06 17:04 ` [PATCH 6/7] net/nfb: read total stats from macs spinler
2026-02-06 17:04 ` [PATCH 7/7] doc/nfb: update release notes for nfb driver spinler
2026-02-17 4:37 ` Stephen Hemminger
2026-02-10 0:33 ` [PATCH 0/7] net/nfb: ethernet enhancements Stephen Hemminger
2026-02-12 18:52 ` Stephen Hemminger
2026-02-17 11:03 ` [PATCH v2 0/6] " spinler
2026-02-17 11:03 ` [PATCH v2 1/6] net/nfb: use MAC address assigned to card spinler
2026-02-17 11:03 ` [PATCH v2 2/6] net/nfb: get correct link speed spinler
2026-02-17 11:03 ` [PATCH v2 3/6] net/nfb: support real link-up/down config spinler
2026-02-17 11:03 ` spinler [this message]
2026-02-17 11:03 ` [PATCH v2 5/6] net/nfb: support setting Rx MTU spinler
2026-02-17 11:03 ` [PATCH v2 6/6] net/nfb: read total stats from macs spinler
2026-02-18 18:21 ` [PATCH v2 0/6] net/nfb: ethernet enhancements Stephen Hemminger
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=20260217110324.3344310-5-spinler@cesnet.cz \
--to=spinler@cesnet.cz \
--cc=dev@dpdk.org \
/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