Skip to contentSkip to conversation

octeontx2-af: misc MAC block changes

PATCH Applied Hariprasad Kelam 2 participants 6 messages Aug 25, 2023 – Aug 28, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover octeontx2-af: misc MAC block changes

This series of patches adds recent changes added in MAC (CGX/RPM) block.

Patch1: Adds new LMAC mode supported by CN10KB silicon

Patch2: In a scenario where system boots with no cgx devices, currently
AF driver treats this as error as a result no interfaces will work. This patch relaxes this check, such that non cgx mapped netdev devices will work.

Patch3: This patch adds required lmac validation in MAC block APIs.

Patch4: Prints error message incase, no netdev is mapped with given
cgx,lmac pair.

Hariprasad Kelam (3):
octeontx2-af: CN10KB: Add USGMII LMAC mode
octeontx2-af: Add validation of lmac
octeontx2-af: print error message incase of invalid pf mapping

Sunil Goutham (1):
octeontx2-af: Don't treat lack of CGX interfaces as error
---
v2 * Removed patch #4 which is replacing generic error codes with driver
specific error codes.

 drivers/net/ethernet/marvell/octeontx2/af/cgx.c     | 11 ++++++++---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.h     |  1 +
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c |  7 ++++++-
 3 files changed, 15 insertions(+), 4 deletions(-)

--
2.17.1

#1 lore raw

PATCH v2 1/4 octeontx2-af: CN10KB: Add USGMII LMAC mode

Upon physical link change, firmware reports to the kernel about the change along with the details like speed, lmac_type_id, etc. Kernel derives lmac_type based on lmac_type_id received from firmware.

This patch extends current lmac list with new USGMII mode supported by CN10KB RPM block.

---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 1 +
 drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +1 -0
index 988383e20bb8..9392ef95a245 100644
@@ -55,6 +55,7 @@ static const char *cgx_lmactype_string[LMAC_MODE_MAX] = {
 	[LMAC_MODE_50G_R] = "50G_R",
 	[LMAC_MODE_100G_R] = "100G_R",
 	[LMAC_MODE_USXGMII] = "USXGMII",
+	[LMAC_MODE_USGMII] = "USGMII",
 };
 
 /* CGX PHY management internal APIs */
drivers/net/ethernet/marvell/octeontx2/af/cgx.h +1 -0
index 574114179688..6f7d1dee5830 100644
@@ -110,6 +110,7 @@ enum LMAC_TYPE {
 	LMAC_MODE_50G_R		= 8,
 	LMAC_MODE_100G_R	= 9,
 	LMAC_MODE_USXGMII	= 10,
+	LMAC_MODE_USGMII	= 11,
 	LMAC_MODE_MAX,
 };
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/4 octeontx2-af: Don't treat lack of CGX interfaces as error

In reply to Hariprasad Kelam

From: Sunil Goutham <[email protected]>

Don't treat lack of CGX LMACs on the system as a error. Instead ignore it so that LBK VFs are created and can be used.

---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +1 -1
index b3f766b970ca..4e3aec7bdbee 100644
@@ -345,7 +345,7 @@ int rvu_cgx_init(struct rvu *rvu)
 	rvu->cgx_cnt_max = cgx_get_cgxcnt_max();
 	if (!rvu->cgx_cnt_max) {
 		dev_info(rvu->dev, "No CGX devices found!\n");
-		return -ENODEV;
+		return 0;
 	}
 
 	rvu->cgx_idmap = devm_kzalloc(rvu->dev, rvu->cgx_cnt_max *
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/4 octeontx2-af: Add validation of lmac

In reply to Hariprasad Kelam

With the addition of new MAC blocks like CN10K RPM and CN10KB RPM_USX, LMACs are noncontiguous. Though in most of the functions, lmac validation checks exist but in few functions they are missing. This patch adds the same.

---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +7 -3
index 9392ef95a245..e06f77ad6106 100644
@@ -232,6 +232,9 @@ int cgx_lmac_addr_set(u8 cgx_id, u8 lmac_id, u8 *mac_addr)
 	int index, id;
 	u64 cfg;
 
+	if (!lmac)
+		return -ENODEV;
+
 	/* access mac_ops to know csr_offset */
 	mac_ops = cgx_dev->mac_ops;
 
@@ -550,15 +553,16 @@ void cgx_lmac_promisc_config(int cgx_id, int lmac_id, bool enable)
 {
 	struct cgx *cgx = cgx_get_pdata(cgx_id);
 	struct lmac *lmac = lmac_pdata(lmac_id, cgx);
-	u16 max_dmac = lmac->mac_to_index_bmap.max;
 	struct mac_ops *mac_ops;
+	u16 max_dmac;
 	int index, i;
 	u64 cfg = 0;
 	int id;
 
-	if (!cgx)
+	if (!cgx || !lmac)
 		return;
 
+	max_dmac = lmac->mac_to_index_bmap.max;
 	id = get_sequence_id_of_lmac(cgx, lmac_id);
 
 	mac_ops = cgx->mac_ops;
@@ -731,7 +735,7 @@ int cgx_get_fec_stats(void *cgxd, int lmac_id, struct cgx_fec_stats_rsp *rsp)
 	int corr_reg, uncorr_reg;
 	struct cgx *cgx = cgxd;
 
-	if (!cgx || lmac_id >= cgx->lmac_count)
+	if (!is_lmac_valid(cgx, lmac_id))
 		return -ENODEV;
 
 	if (cgx->lmac_idmap[lmac_id]->link_info.fec == OTX2_FEC_NONE)
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 4/4 octeontx2-af: print error message incase of invalid pf mapping

In reply to Hariprasad Kelam

During AF driver initialization, it creates a mapping between pf to cgx,lmac pair. Whenever there is a physical link change, using this mapping driver forwards the message to the associated netdev.

This patch prints error message incase of cgx,lmac pair is not associated with any pf netdev.

---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +5 -0
index 4e3aec7bdbee..f2b1edf1bb43 100644
@@ -236,6 +236,11 @@ static void cgx_notify_pfs(struct cgx_link_event *event, struct rvu *rvu)
 
 	linfo = &event->link_uinfo;
 	pfmap = cgxlmac_to_pfmap(rvu, event->cgx_id, event->lmac_id);
+	if (!pfmap) {
+		dev_err(rvu->dev, "CGX port%d:%d not mapped with PF\n",
+			event->cgx_id, event->lmac_id);
+		return;
+	}
 
 	do {
 		pfid = find_first_bit(&pfmap,
Signature · 1 line
2.17.1
#5 lore raw
In reply to Hariprasad Kelam
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 10 lines · On Fri, 25 Aug 2023 16:10:18 +0530 you wrote:

This series of patches adds recent changes added in MAC (CGX/RPM) block.

Patch1: Adds new LMAC mode supported by CN10KB silicon

Patch2: In a scenario where system boots with no cgx devices, currently
AF driver treats this as error as a result no interfaces will work. This patch relaxes this check, such that non cgx mapped netdev devices will work.

[...]

Here is the summary with links:
- [net-next,PatchV2,1/4] octeontx2-af: CN10KB: Add USGMII LMAC mode

    https://git.kernel.org/netdev/net-next/c/5266733c7986
  - [net-next,PatchV2,2/4] octeontx2-af: Don't treat lack of CGX interfaces as error
    https://git.kernel.org/netdev/net-next/c/f027fd51edeb
  - [net-next,PatchV2,3/4] octeontx2-af: Add validation of lmac
    https://git.kernel.org/netdev/net-next/c/2f387525d484
  - [net-next,PatchV2,4/4] octeontx2-af: print error message incase of invalid pf mapping
    https://git.kernel.org/netdev/net-next/c/17d1368f4f19

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html