public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes
@ 2023-08-25 10:40 Hariprasad Kelam
  2023-08-25 10:40 ` [net-next PatchV2 1/4] octeontx2-af: CN10KB: Add USGMII LMAC mode Hariprasad Kelam
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Hariprasad Kelam @ 2023-08-25 10:40 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: kuba, davem, sgoutham, gakula, jerinj, lcherian, sbhatta, hkelam,
	naveenm, edumazet, pabeni

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [net-next PatchV2 1/4] octeontx2-af: CN10KB: Add USGMII LMAC mode
  2023-08-25 10:40 [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes Hariprasad Kelam
@ 2023-08-25 10:40 ` Hariprasad Kelam
  2023-08-25 10:40 ` [net-next PatchV2 2/4] octeontx2-af: Don't treat lack of CGX interfaces as error Hariprasad Kelam
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Hariprasad Kelam @ 2023-08-25 10:40 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: kuba, davem, sgoutham, gakula, jerinj, lcherian, sbhatta, hkelam,
	naveenm, edumazet, pabeni

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.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 1 +
 drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index 988383e20bb8..9392ef95a245 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -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 */
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.h b/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
index 574114179688..6f7d1dee5830 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
@@ -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,
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [net-next PatchV2 2/4] octeontx2-af: Don't treat lack of CGX interfaces as error
  2023-08-25 10:40 [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes Hariprasad Kelam
  2023-08-25 10:40 ` [net-next PatchV2 1/4] octeontx2-af: CN10KB: Add USGMII LMAC mode Hariprasad Kelam
@ 2023-08-25 10:40 ` Hariprasad Kelam
  2023-08-25 10:40 ` [net-next PatchV2 3/4] octeontx2-af: Add validation of lmac Hariprasad Kelam
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Hariprasad Kelam @ 2023-08-25 10:40 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: kuba, davem, sgoutham, gakula, jerinj, lcherian, sbhatta, hkelam,
	naveenm, edumazet, pabeni

From: Sunil Goutham <sgoutham@marvell.com>

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.

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index b3f766b970ca..4e3aec7bdbee 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
@@ -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 *
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [net-next PatchV2 3/4] octeontx2-af: Add validation of lmac
  2023-08-25 10:40 [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes Hariprasad Kelam
  2023-08-25 10:40 ` [net-next PatchV2 1/4] octeontx2-af: CN10KB: Add USGMII LMAC mode Hariprasad Kelam
  2023-08-25 10:40 ` [net-next PatchV2 2/4] octeontx2-af: Don't treat lack of CGX interfaces as error Hariprasad Kelam
@ 2023-08-25 10:40 ` Hariprasad Kelam
  2023-08-25 10:40 ` [net-next PatchV2 4/4] octeontx2-af: print error message incase of invalid pf mapping Hariprasad Kelam
  2023-08-28  9:10 ` [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Hariprasad Kelam @ 2023-08-25 10:40 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: kuba, davem, sgoutham, gakula, jerinj, lcherian, sbhatta, hkelam,
	naveenm, edumazet, pabeni

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.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index 9392ef95a245..e06f77ad6106 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -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)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [net-next PatchV2 4/4] octeontx2-af: print error message incase of invalid pf mapping
  2023-08-25 10:40 [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes Hariprasad Kelam
                   ` (2 preceding siblings ...)
  2023-08-25 10:40 ` [net-next PatchV2 3/4] octeontx2-af: Add validation of lmac Hariprasad Kelam
@ 2023-08-25 10:40 ` Hariprasad Kelam
  2023-08-28  9:10 ` [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Hariprasad Kelam @ 2023-08-25 10:40 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: kuba, davem, sgoutham, gakula, jerinj, lcherian, sbhatta, hkelam,
	naveenm, edumazet, pabeni

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.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index 4e3aec7bdbee..f2b1edf1bb43 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
@@ -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,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes
  2023-08-25 10:40 [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes Hariprasad Kelam
                   ` (3 preceding siblings ...)
  2023-08-25 10:40 ` [net-next PatchV2 4/4] octeontx2-af: print error message incase of invalid pf mapping Hariprasad Kelam
@ 2023-08-28  9:10 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-28  9:10 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: netdev, linux-kernel, kuba, davem, sgoutham, gakula, jerinj,
	lcherian, sbhatta, naveenm, edumazet, pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-28  9:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-25 10:40 [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes Hariprasad Kelam
2023-08-25 10:40 ` [net-next PatchV2 1/4] octeontx2-af: CN10KB: Add USGMII LMAC mode Hariprasad Kelam
2023-08-25 10:40 ` [net-next PatchV2 2/4] octeontx2-af: Don't treat lack of CGX interfaces as error Hariprasad Kelam
2023-08-25 10:40 ` [net-next PatchV2 3/4] octeontx2-af: Add validation of lmac Hariprasad Kelam
2023-08-25 10:40 ` [net-next PatchV2 4/4] octeontx2-af: print error message incase of invalid pf mapping Hariprasad Kelam
2023-08-28  9:10 ` [net-next PatchV2 0/4] octeontx2-af: misc MAC block changes patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox