irst series for xpcs based rsfec configuration
Subsystems (4)
v3 cover irst series for xpcs based rsfec configuration
From: "Mike Marciniszyn (Meta)" <[email protected]>
The series:
- Fixes an addr validation error
- Adds MDIO defines associated with RS-FEC
- consolidates the handling of the boilerplat ID registers into a routine to report id'ish registers and reduces the lines of code across the entire set of c45 routines.
- adds PMA read/write routines
https://lore.kernel.org/all/[email protected]/
has been put back into the based on
https://lore.kernel.org/all/[email protected]/
pcs reads for DEVS1 and DEVS2 cleaned up 2/3
Mike Marciniszyn (Meta) (3):
net: eth: fbnic: Fix addr validation in pcs write
net: mdio: Add support for RSFEC Control register for PMA
net: eth: fbnic: Consolidate register reads for ids and devs
net: eth: fbnic: Add pma read and write access
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 1 + drivers/net/ethernet/meta/fbnic/fbnic_mdio.c | 137 +++++++++++++++---- include/uapi/linux/mdio.h | 10 ++ 3 files changed, 123 insertions(+), 25 deletions(-)
--
2.43.0
PATCH v3 1/4 net: eth: fbnic: Fix addr validation in pcs write
From: "Mike Marciniszyn (Meta)" <[email protected]>
The DW IP has two distinct PCS address ranges cooresponding to the C45 PCS registers.
The shim translates the PCS addr/regno into specific CSR writes into one of those two zero-relative.
This patch fixes a one off in the test that could allow an invalid CSR write if an addr == 2 was called.
This patch contains a fix for addr validation in fbnic_mdio_write_pcs() to only return actual CSR reads for addr 0 and 1.
There are as of yet, no real impact for the bug as no PCS writes are not yet present.
---
v3:
- put back into the series based on https://lore.kernel.org/all/[email protected]/
- revised commit message will additional details
v2:
- omitted from patch series
v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/meta/fbnic/fbnic_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/meta/fbnic/fbnic_mdio.c +1 -1
@@ -125,7 +125,7 @@ fbnic_mdio_write_pcs(struct fbnic_dev *fbd, int addr, int regnum, u16 val) addr, regnum, val);/* Allow access to both halves of PCS for 50R2 config */ -if (addr >2 ) +if (addr >=2 )return ;/* Skip write for reserved registers */
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerRe: [PATCH net-next v3 1/4] net: eth: fbnic: Fix addr validation in pcs write
Quoted 8 lines · On Mon, 4 May 2026 09:58:12 -0400 [email protected] wrote:
From: "Mike Marciniszyn (Meta)" <[email protected]>
The DW IP has two distinct PCS address ranges cooresponding to the C45 PCS registers.
The shim translates the PCS addr/regno into specific CSR writes into one of those two zero-relative.
Quoted 8 lines
This patch fixes a one off in the test that could allow an invalid CSR write if an addr == 2 was called.
This patch contains a fix for addr validation in
fbnic_mdio_write_pcs()to only return actual CSR reads for addr 0 and 1.There are as of yet, no real impact for the bug as no PCS writes are not yet present.
Hi Paolo! Was there a reason / do you recall why this was not applied? (I dropped it from patchwork now. If the omission was accidental it has to be reposted)
Paolo Abeni
maintainerRe: [PATCH net-next v3 1/4] net: eth: fbnic: Fix addr validation in pcs write
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Mon, 4 May 2026 09:58:12 -0400 [email protected] wrote:
From: "Mike Marciniszyn (Meta)" <[email protected]>
The DW IP has two distinct PCS address ranges cooresponding to the C45 PCS registers.
The shim translates the PCS addr/regno into specific CSR writes into one of those two zero-relative.
This patch fixes a one off in the test that could allow an invalid CSR write if an addr == 2 was called.
This patch contains a fix for addr validation in
fbnic_mdio_write_pcs()to only return actual CSR reads for addr 0 and 1.
Quoted 6 lines
Quoted 2 lines
There are as of yet, no real impact for the bug as no PCS writes are not yet present.
Hi Paolo! Was there a reason / do you recall why this was not applied? (I dropped it from patchwork now. If the omission was accidental it has to be reposted)
Darn, limited capacity here plus re-submission glitch: v3 had a slightly different cover title (due to typo) WRT v2 so PW did not mark v2 as superseded. I process patches via PW in sequence, when I reached v2 I considered the sashiko comment not blocking and I apply it. I was unable to reach v3 until now.
TL;DR: @Mike: please re-submit 1/4 and double check there are not other differences between v2 and v3 - otherwise more patches needed. Also please ensure you keep the series title consistent among revision, or at least manually remove old revisions from PW upon resubmission.
Thanks,
Paolo
Re: [PATCH net-next v3 1/4] net: eth: fbnic: Fix addr validation in pcs write
Quoted 29 lines · Paolo Abeni
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Mon, 4 May 2026 09:58:12 -0400 [email protected] wrote:
From: "Mike Marciniszyn (Meta)" <[email protected]>
The DW IP has two distinct PCS address ranges cooresponding to the C45 PCS registers.
The shim translates the PCS addr/regno into specific CSR writes into one of those two zero-relative.
This patch fixes a one off in the test that could allow an invalid CSR write if an addr == 2 was called.
This patch contains a fix for addr validation in
fbnic_mdio_write_pcs()to only return actual CSR reads for addr 0 and 1.Quoted 6 lines
Quoted 2 lines
There are as of yet, no real impact for the bug as no PCS writes are not yet present.
Hi Paolo! Was there a reason / do you recall why this was not applied? (I dropped it from patchwork now. If the omission was accidental it has to be reposted)
Darn, limited capacity here plus re-submission glitch: v3 had a slightly different cover title (due to typo) WRT v2 so PW did not mark v2 as superseded. I process patches via PW in sequence, when I reached v2 I considered the sashiko comment not blocking and I apply it. I was unable to reach v3 until now.
Quoted 9 lines
TL;DR: @Mike: please re-submit 1/4 and double check there are not other differences between v2 and v3 - otherwise more patches needed. Also please ensure you keep the series title consistent among revision, or at least manually remove old revisions from PW upon resubmission.
Thanks,
Paolo
I double checked v2 -> v3 for the other patches are ok.
I'm just now resending 1/4 of the series. I reworded the commit message to fix the AI review comment.
Mike
Re: [PATCH net-next v3 1/4] net: eth: fbnic: Fix addr validation in pcs write
Quoted 40 lines · Mike Marciniszyn
Quoted 29 lines · Paolo Abeni
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Mon, 4 May 2026 09:58:12 -0400 [email protected] wrote:
From: "Mike Marciniszyn (Meta)" <[email protected]>
The DW IP has two distinct PCS address ranges cooresponding to the C45 PCS registers.
The shim translates the PCS addr/regno into specific CSR writes into one of those two zero-relative.
This patch fixes a one off in the test that could allow an invalid CSR write if an addr == 2 was called.
This patch contains a fix for addr validation in
fbnic_mdio_write_pcs()to only return actual CSR reads for addr 0 and 1.Quoted 6 lines
Quoted 2 lines
There are as of yet, no real impact for the bug as no PCS writes are not yet present.
Hi Paolo! Was there a reason / do you recall why this was not applied? (I dropped it from patchwork now. If the omission was accidental it has to be reposted)
Darn, limited capacity here plus re-submission glitch: v3 had a slightly different cover title (due to typo) WRT v2 so PW did not mark v2 as superseded. I process patches via PW in sequence, when I reached v2 I considered the sashiko comment not blocking and I apply it. I was unable to reach v3 until now.
Quoted 9 lines
TL;DR: @Mike: please re-submit 1/4 and double check there are not other differences between v2 and v3 - otherwise more patches needed. Also please ensure you keep the series title consistent among revision, or at least manually remove old revisions from PW upon resubmission.
Thanks,
Paolo
Quoted 6 lines
I double checked v2 -> v3 for the other patches are ok.
I'm just now resending 1/4 of the series. I reworded the commit message to fix the AI review comment.
Mike
The patch isn't showing up on either lore or patchwork.
I may need to bump the rev?
Mike
Paolo Abeni
maintainerRe: [PATCH net-next v3 1/4] net: eth: fbnic: Fix addr validation in pcs write
Quoted 43 lines · Mike Marciniszyn
Quoted 42 lines · Mike Marciniszyn
Quoted 29 lines · Paolo Abeni
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Mon, 4 May 2026 09:58:12 -0400 [email protected] wrote:
From: "Mike Marciniszyn (Meta)" <[email protected]>
The DW IP has two distinct PCS address ranges cooresponding to the C45 PCS registers.
The shim translates the PCS addr/regno into specific CSR writes into one of those two zero-relative.
This patch fixes a one off in the test that could allow an invalid CSR write if an addr == 2 was called.
This patch contains a fix for addr validation in
fbnic_mdio_write_pcs()to only return actual CSR reads for addr 0 and 1.Quoted 6 lines
Quoted 2 lines
There are as of yet, no real impact for the bug as no PCS writes are not yet present.
Hi Paolo! Was there a reason / do you recall why this was not applied? (I dropped it from patchwork now. If the omission was accidental it has to be reposted)
Darn, limited capacity here plus re-submission glitch: v3 had a slightly different cover title (due to typo) WRT v2 so PW did not mark v2 as superseded. I process patches via PW in sequence, when I reached v2 I considered the sashiko comment not blocking and I apply it. I was unable to reach v3 until now.
Quoted 9 lines
TL;DR: @Mike: please re-submit 1/4 and double check there are not other differences between v2 and v3 - otherwise more patches needed. Also please ensure you keep the series title consistent among revision, or at least manually remove old revisions from PW upon resubmission.
Thanks,
Paolo
I double checked v2 -> v3 for the other patches are ok.
Quoted 8 lines
Quoted 4 lines
I'm just now resending 1/4 of the series. I reworded the commit message to fix the AI review comment.
Mike
The patch isn't showing up on either lore or patchwork.
I may need to bump the rev?
Wait a bit more. 1h latency can happen quite easily.
/P
Re: [PATCH net-next v3 1/4] net: eth: fbnic: Fix addr validation in pcs write
Quoted 49 lines · Paolo Abeni
Quoted 48 lines · Mike Marciniszyn
Quoted 46 lines · Mike Marciniszyn
Quoted 29 lines · Paolo Abeni
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Mon, 4 May 2026 09:58:12 -0400 [email protected] wrote:
From: "Mike Marciniszyn (Meta)" <[email protected]>
The DW IP has two distinct PCS address ranges cooresponding to the C45 PCS registers.
The shim translates the PCS addr/regno into specific CSR writes into one of those two zero-relative.
This patch fixes a one off in the test that could allow an invalid CSR write if an addr == 2 was called.
This patch contains a fix for addr validation in
fbnic_mdio_write_pcs()to only return actual CSR reads for addr 0 and 1.Quoted 6 lines
Quoted 2 lines
There are as of yet, no real impact for the bug as no PCS writes are not yet present.
Hi Paolo! Was there a reason / do you recall why this was not applied? (I dropped it from patchwork now. If the omission was accidental it has to be reposted)
Darn, limited capacity here plus re-submission glitch: v3 had a slightly different cover title (due to typo) WRT v2 so PW did not mark v2 as superseded. I process patches via PW in sequence, when I reached v2 I considered the sashiko comment not blocking and I apply it. I was unable to reach v3 until now.
Quoted 9 lines
TL;DR: @Mike: please re-submit 1/4 and double check there are not other differences between v2 and v3 - otherwise more patches needed. Also please ensure you keep the series title consistent among revision, or at least manually remove old revisions from PW upon resubmission.
Thanks,
Paolo
I double checked v2 -> v3 for the other patches are ok.
I'm just now resending 1/4 of the series. I reworded the commit message to fix the AI review comment.
Mike
Quoted 8 lines
Quoted 3 lines
The patch isn't showing up on either lore or patchwork.
I may need to bump the rev?
Wait a bit more. 1h latency can happen quite easily.
/P
The patch in is patchwork:
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
Mike
PATCH v3 2/4 net: mdio: Add support for RSFEC Control register for PMA
In reply to [email protected]From: "Mike Marciniszyn (Meta)" <[email protected]>
Add the constants associated with RS-FEC configuration and status as well as the indicated separated bits for DEVS1 to convey a separated PMA.
---
v3:
- no changes
v2:https://lore.kernel.org/all/[email protected]/
- Added Reviewed-by
v1: https://lore.kernel.org/all/[email protected]/
- initial revision
include/uapi/linux/mdio.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/uapi/linux/mdio.h +10 -0
@@ -23,6 +23,10 @@#define MDIO_MMD_DTEXS 5/* DTE Extender Sublayer */ #define MDIO_MMD_TC 6/* Transmission Convergence */ #define MDIO_MMD_AN 7/* Auto-Negotiation */ +#define MDIO_MMD_SEP_PMA1 8/* Separated PMA (1) */ +#define MDIO_MMD_SEP_PMA2 9/* Separated PMA (2) */ +#define MDIO_MMD_SEP_PMA3 10/* Separated PMA (3) */ +#define MDIO_MMD_SEP_PMA4 11/* Separated PMA (4) */ #define MDIO_MMD_POWER_UNIT 13/* PHY Power Unit */ #define MDIO_MMD_C22EXT 29/* Clause 22 extension */ #define MDIO_MMD_VEND1 30/* Vendor specific 1 */
@@ -63,6 +67,8 @@* Lanes B-D are numbered 134-136. */ #define MDIO_PMA_10GBR_FSRT_CSR 147/* 10GBASE-R fast retrain status and control */ #define MDIO_PMA_10GBR_FECABLE 170/* 10GBASE-R FEC ability */ +#define MDIO_PMA_RSFEC_CTRL 200/* RSFEC control */ +#define MDIO_PMA_RSFEC_LANE_MAP 206/* RSFEC lane mapping */ #define MDIO_PCS_10GBX_STAT1 24/* 10GBASE-X PCS status 1 */ #define MDIO_PCS_10GBRT_STAT1 32/* 10GBASE-R/-T PCS status 1 */ #define MDIO_PCS_10GBRT_STAT2 33/* 10GBASE-R/-T PCS status 2 */
@@ -175,6 +181,10 @@#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN) +#define MDIO_DEVS_SEP_PMA1 MDIO_DEVS_PRESENT(MDIO_MMD_SEP_PMA1) +#define MDIO_DEVS_SEP_PMA2 MDIO_DEVS_PRESENT(MDIO_MMD_SEP_PMA2) +#define MDIO_DEVS_SEP_PMA3 MDIO_DEVS_PRESENT(MDIO_MMD_SEP_PMA3) +#define MDIO_DEVS_SEP_PMA4 MDIO_DEVS_PRESENT(MDIO_MMD_SEP_PMA4)#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)#define MDIO_DEVS_VEND1 MDIO_DEVS_PRESENT(MDIO_MMD_VEND1)#define MDIO_DEVS_VEND2 MDIO_DEVS_PRESENT(MDIO_MMD_VEND2)
Signature · 1 line
2.43.0
PATCH v3 3/4 net: eth: fbnic: Consolidate register reads for ids and devs
In reply to [email protected]From: "Mike Marciniszyn (Meta)" <[email protected]>
Consolidate the register reads for boiler plate registers to reduce LOC and cleanup pcs reads for DEVS1 to fetch overrides for reserved bits that the hardware does not return.
---
v3:
- no changes
v2: https://lore.kernel.org/all/[email protected]/
- Restore pcs register read for DEVS2
- read pcs DEVS1 overrides and or into return
v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/meta/fbnic/fbnic_mdio.c | 64 ++++++++++++-------- 1 file changed, 40 insertions(+), 24 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_mdio.c +40 -24
@@ -11,6 +11,26 @@#define FBNIC_PCS_VENDOR BIT(9)#define FBNIC_PCS_ZERO_MASK (DW_VENDOR - FBNIC_PCS_VENDOR) +static int +fbnic_mdio_ids (int id,int regnum) +{ +/* return correct IDs */ +switch (regnum) { +case MDIO_DEVID1 : +return id >>16 ; +case MDIO_DEVID2 : +return id &0xffff ; +case MDIO_DEVS1 : +return MDIO_DEVS_SEP_PMA1 |MDIO_DEVS_PMAPMD |MDIO_DEVS_PCS ; +case MDIO_DEVS2 : +return 0 ; +case MDIO_STAT2 : +return MDIO_STAT2_DEVPRST_VAL ; + } + +return 0 ; +} +static int fbnic_mdio_read_pmd (struct fbnic_dev *fbd,int addr,int regnum) {
@@ -29,18 +49,6 @@ fbnic_mdio_read_pmd(struct fbnic_dev *fbd, int addr, int regnum) }switch (regnum) { -case MDIO_DEVID1 : - ret =MP_FBNIC_XPCS_PMA_100G_ID >>16 ; -break ; -case MDIO_DEVID2 : - ret =MP_FBNIC_XPCS_PMA_100G_ID &0xffff ; -break ; -case MDIO_DEVS1 : - ret =MDIO_DEVS_PMAPMD |MDIO_DEVS_PCS ; -break ; -case MDIO_STAT2 : - ret =MDIO_STAT2_DEVPRST_VAL ; -break ;case MDIO_PMA_RXDET :/* If training isn't complete default to 0 */ if (fbd->pmd_state !=FBNIC_PMD_SEND_DATA )
@@ -51,6 +59,7 @@ fbnic_mdio_read_pmd(struct fbnic_dev *fbd, int addr, int regnum) (MDIO_PMD_RXDET_1 / FBNIC_AUI_MODE_R2));break ;default : + ret =fbnic_mdio_ids (MP_FBNIC_XPCS_PMA_100G_ID , regnum);break ; }
@@ -64,7 +73,7 @@ fbnic_mdio_read_pmd(struct fbnic_dev *fbd, int addr, int regnum)static int fbnic_mdio_read_pcs (struct fbnic_dev *fbd,int addr,int regnum) { -int ret, offset =0 ; +int ret, offset =0 , overrides =0 ;/* We will need access to both PCS instances to get config info */ if (addr >=2 )
@@ -75,18 +84,25 @@ fbnic_mdio_read_pcs(struct fbnic_dev *fbd, int addr, int regnum)return 0 ;/* Intercept and return correct ID for PCS */ -if (regnum ==MDIO_DEVID1 ) -return DW_XPCS_ID >>16 ; -if (regnum ==MDIO_DEVID2 ) -return DW_XPCS_ID &0xffff ; -if (regnum ==MDIO_DEVS1 ) -return MDIO_DEVS_PMAPMD |MDIO_DEVS_PCS ; - -/* Swap vendor page bit for FBNIC PCS vendor page bit */ -if (regnum &DW_VENDOR ) - offset ^=DW_VENDOR |FBNIC_PCS_VENDOR ; +switch (regnum) { + case MDIO_DEVID1 ... MDIO_DEVID2: + ret =fbnic_mdio_ids (DW_XPCS_ID , regnum); +break ; +case MDIO_DEVS1 : +/* DW IP returns MDIO_DEVS_SEP_PMA1, MDIO_DEVS_PMAPMD, +* and MDIO_DEVS_PCS as 0 +*/ + overrides =fbnic_mdio_ids (DW_XPCS_ID , regnum); + fallthrough; +default : +/* Swap vendor page bit for FBNIC PCS vendor page bit */ +if (regnum &DW_VENDOR ) + offset ^=DW_VENDOR |FBNIC_PCS_VENDOR ; - ret =fbnic_rd32 (fbd,FBNIC_PCS_PAGE (addr) + (regnum ^ offset)); + ret =fbnic_rd32 (fbd,FBNIC_PCS_PAGE (addr) + (regnum ^ offset)); + ret |= overrides; +break ; + } dev_dbg(fbd->dev, "SWMII PCS Rd: Addr: %d RegNum: %d Value: 0x%04x\n",
Signature · 1 line
2.43.0
PATCH v3 4/4 net: eth: fbnic: Add pma read and write access
In reply to [email protected]From: "Mike Marciniszyn (Meta)" <[email protected]>
Document the MDIO interface topology with an ASCII diagram showing the MAC, PCS (MMD 3), FEC, Separated PMA (MMD 8), and PMD (MMD 1) blocks and their interconnects. The diagram illustrates how 4 lanes connect the MAC through PCS, FEC, and PMA, then narrow to 2 lanes at the PMD.
The c45 read and write routines are enhanced to support read and write of the separated PMA for the fbnic.
---
v2: https://lore.kernel.org/all/[email protected]/
- no changes
v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 1 + drivers/net/ethernet/meta/fbnic/fbnic_mdio.c | 71 ++++++++++++++++++++ 2 files changed, 72 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic_csr.h +1 -0
@@ -805,6 +805,7 @@ enum {#define FBNIC_CSR_END_PCS 0x10668/* CSR section delimiter */ #define FBNIC_CSR_START_RSFEC 0x10800/* CSR section delimiter */ +#define FBNIC_RSFEC_CONTROL (n) (0x10800 + 8 * (n))/* 0x42000 + 32*n */ /* We have 4 RSFEC engines present in our part, however we are only using 1. * As such only CCW(0) and NCCW(0) will never be non-zero and the other
drivers/net/ethernet/meta/fbnic/fbnic_mdio.c +71 -0
101 lines not on this page · raw message
Signature · 1 line
2.43.0
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 11 lines · On Mon, 4 May 2026 09:58:11 -0400 you wrote:
From: "Mike Marciniszyn (Meta)" <[email protected]>
The series:
- Fixes an addr validation error
- Adds MDIO defines associated with RS-FEC
- consolidates the handling of the boilerplat ID registers into a routine to report id'ish registers and reduces the lines of code across the entire set of c45 routines.
- adds PMA read/write routines[...]
Here is the summary with links:
- [net-next,v3,1/4] net: eth: fbnic: Fix addr validation in pcs write (no matching commit)
- [net-next,v3,2/4] net: mdio: Add support for RSFEC Control register for PMA
https://git.kernel.org/netdev/net-next/c/ca283942e5b9 - [net-next,v3,3/4] net: eth: fbnic: Consolidate register reads for ids and devs https://git.kernel.org/netdev/net-next/c/d7dbf00b4a55 - [net-next,v3,4/4] net: eth: fbnic: Add pma read and write access https://git.kernel.org/netdev/net-next/c/3877097c3c9e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html