linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net PATCH] octeontx2-af: Fix devlink unregister
@ 2023-01-27  9:46 Ratheesh Kannoth
  2023-01-27  9:46 ` [net PATCH] octeontx2-af: Removed unnecessary debug messages Ratheesh Kannoth
  2023-01-29 12:41 ` [net PATCH] octeontx2-af: Fix devlink unregister Leon Romanovsky
  0 siblings, 2 replies; 4+ messages in thread
From: Ratheesh Kannoth @ 2023-01-27  9:46 UTC (permalink / raw)
  To: netdev, linux-kernel, davem, edumazet, kuba, pabeni
  Cc: sgoutham, Ratheesh Kannoth

Exact match devlink entry is only for CN10K-B.
Unregistration devlink should subtract this
entry before invoking devlink unregistration

Fixes: 87e4ea29b030 ("octeontx2-af: Debugsfs support for exact match.")
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
 .../net/ethernet/marvell/octeontx2/af/rvu_devlink.c    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
index bda1a6fa2ec4..d058eeadb23f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
@@ -1603,10 +1603,16 @@ void rvu_unregister_dl(struct rvu *rvu)
 {
 	struct rvu_devlink *rvu_dl = rvu->rvu_dl;
 	struct devlink *dl = rvu_dl->dl;
+	size_t size;
 
 	devlink_unregister(dl);
-	devlink_params_unregister(dl, rvu_af_dl_params,
-				  ARRAY_SIZE(rvu_af_dl_params));
+	/* Unregister exact match devlink only for CN10K-B */
+	size = ARRAY_SIZE(rvu_af_dl_params);
+	if (!rvu_npc_exact_has_match_table(rvu))
+		size -= 1;
+
+	devlink_params_unregister(dl, rvu_af_dl_params, size);
+
 	rvu_health_reporters_destroy(rvu);
 	devlink_free(dl);
 }
-- 
2.25.1


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

* [net PATCH] octeontx2-af: Removed unnecessary debug messages.
  2023-01-27  9:46 [net PATCH] octeontx2-af: Fix devlink unregister Ratheesh Kannoth
@ 2023-01-27  9:46 ` Ratheesh Kannoth
  2023-01-29 12:36   ` Leon Romanovsky
  2023-01-29 12:41 ` [net PATCH] octeontx2-af: Fix devlink unregister Leon Romanovsky
  1 sibling, 1 reply; 4+ messages in thread
From: Ratheesh Kannoth @ 2023-01-27  9:46 UTC (permalink / raw)
  To: netdev, linux-kernel, davem, edumazet, kuba, pabeni; +Cc: sgoutham

From: Sunil Goutham <sgoutham@marvell.com>

NPC exact match feature is supported only on one silicon
variant, removed debug messages which print that this
feature is not available on all other silicon variants.

Fixes: b747923afff8 ("octeontx2-af: Exact match support")
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 .../ethernet/marvell/octeontx2/af/rvu_npc_hash.c    | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
index f69102d20c90..2c832469229b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
@@ -200,10 +200,8 @@ void npc_config_secret_key(struct rvu *rvu, int blkaddr)
 	struct rvu_hwinfo *hw = rvu->hw;
 	u8 intf;
 
-	if (!hwcap->npc_hash_extract) {
-		dev_info(rvu->dev, "HW does not support secret key configuration\n");
+	if (!hwcap->npc_hash_extract)
 		return;
-	}
 
 	for (intf = 0; intf < hw->npc_intfs; intf++) {
 		rvu_write64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY0(intf),
@@ -221,10 +219,8 @@ void npc_program_mkex_hash(struct rvu *rvu, int blkaddr)
 	struct rvu_hwinfo *hw = rvu->hw;
 	u8 intf;
 
-	if (!hwcap->npc_hash_extract) {
-		dev_dbg(rvu->dev, "Field hash extract feature is not supported\n");
+	if (!hwcap->npc_hash_extract)
 		return;
-	}
 
 	for (intf = 0; intf < hw->npc_intfs; intf++) {
 		npc_program_mkex_hash_rx(rvu, blkaddr, intf);
@@ -1854,16 +1850,12 @@ int rvu_npc_exact_init(struct rvu *rvu)
 	/* Check exact match feature is supported */
 	npc_const3 = rvu_read64(rvu, blkaddr, NPC_AF_CONST3);
 	if (!(npc_const3 & BIT_ULL(62))) {
-		dev_info(rvu->dev, "%s: No support for exact match support\n",
-			 __func__);
 		return 0;
 	}
 
 	/* Check if kex profile has enabled EXACT match nibble */
 	cfg = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(NIX_INTF_RX));
 	if (!(cfg & NPC_EXACT_NIBBLE_HIT)) {
-		dev_info(rvu->dev, "%s: NPC exact match nibble not enabled in KEX profile\n",
-			 __func__);
 		return 0;
 	}
 
@@ -2005,6 +1997,5 @@ int rvu_npc_exact_init(struct rvu *rvu)
 		(*drop_mcam_idx)++;
 	}
 
-	dev_info(rvu->dev, "initialized exact match table successfully\n");
 	return 0;
 }
-- 
2.25.1


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

* Re: [net PATCH] octeontx2-af: Removed unnecessary debug messages.
  2023-01-27  9:46 ` [net PATCH] octeontx2-af: Removed unnecessary debug messages Ratheesh Kannoth
@ 2023-01-29 12:36   ` Leon Romanovsky
  0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2023-01-29 12:36 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: netdev, linux-kernel, davem, edumazet, kuba, pabeni, sgoutham

On Fri, Jan 27, 2023 at 03:16:52PM +0530, Ratheesh Kannoth wrote:
> From: Sunil Goutham <sgoutham@marvell.com>
> 
> NPC exact match feature is supported only on one silicon
> variant, removed debug messages which print that this
> feature is not available on all other silicon variants.

I would say that this is net-next patch and not net. 
You simply remove debug prints.

> 
> Fixes: b747923afff8 ("octeontx2-af: Exact match support")
> Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
> ---
>  .../ethernet/marvell/octeontx2/af/rvu_npc_hash.c    | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
> index f69102d20c90..2c832469229b 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
> @@ -200,10 +200,8 @@ void npc_config_secret_key(struct rvu *rvu, int blkaddr)
>  	struct rvu_hwinfo *hw = rvu->hw;
>  	u8 intf;
>  
> -	if (!hwcap->npc_hash_extract) {
> -		dev_info(rvu->dev, "HW does not support secret key configuration\n");
> +	if (!hwcap->npc_hash_extract)
>  		return;
> -	}
>  
>  	for (intf = 0; intf < hw->npc_intfs; intf++) {
>  		rvu_write64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY0(intf),
> @@ -221,10 +219,8 @@ void npc_program_mkex_hash(struct rvu *rvu, int blkaddr)
>  	struct rvu_hwinfo *hw = rvu->hw;
>  	u8 intf;
>  
> -	if (!hwcap->npc_hash_extract) {
> -		dev_dbg(rvu->dev, "Field hash extract feature is not supported\n");
> +	if (!hwcap->npc_hash_extract)
>  		return;
> -	}
>  
>  	for (intf = 0; intf < hw->npc_intfs; intf++) {
>  		npc_program_mkex_hash_rx(rvu, blkaddr, intf);
> @@ -1854,16 +1850,12 @@ int rvu_npc_exact_init(struct rvu *rvu)
>  	/* Check exact match feature is supported */
>  	npc_const3 = rvu_read64(rvu, blkaddr, NPC_AF_CONST3);
>  	if (!(npc_const3 & BIT_ULL(62))) {
> -		dev_info(rvu->dev, "%s: No support for exact match support\n",
> -			 __func__);
>  		return 0;
>  	}

You need to remove { } brackets too.

>  
>  	/* Check if kex profile has enabled EXACT match nibble */
>  	cfg = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(NIX_INTF_RX));
>  	if (!(cfg & NPC_EXACT_NIBBLE_HIT)) {
> -		dev_info(rvu->dev, "%s: NPC exact match nibble not enabled in KEX profile\n",
> -			 __func__);
>  		return 0;
>  	}

Ditto.

>  
> @@ -2005,6 +1997,5 @@ int rvu_npc_exact_init(struct rvu *rvu)
>  		(*drop_mcam_idx)++;
>  	}
>  
> -	dev_info(rvu->dev, "initialized exact match table successfully\n");
>  	return 0;
>  }
> -- 
> 2.25.1
> 

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

* Re: [net PATCH] octeontx2-af: Fix devlink unregister
  2023-01-27  9:46 [net PATCH] octeontx2-af: Fix devlink unregister Ratheesh Kannoth
  2023-01-27  9:46 ` [net PATCH] octeontx2-af: Removed unnecessary debug messages Ratheesh Kannoth
@ 2023-01-29 12:41 ` Leon Romanovsky
  1 sibling, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2023-01-29 12:41 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: netdev, linux-kernel, davem, edumazet, kuba, pabeni, sgoutham

On Fri, Jan 27, 2023 at 03:16:51PM +0530, Ratheesh Kannoth wrote:
> Exact match devlink entry is only for CN10K-B.
> Unregistration devlink should subtract this
> entry before invoking devlink unregistration
> 
> Fixes: 87e4ea29b030 ("octeontx2-af: Debugsfs support for exact match.")
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
> ---
>  .../net/ethernet/marvell/octeontx2/af/rvu_devlink.c    | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> index bda1a6fa2ec4..d058eeadb23f 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
> @@ -1603,10 +1603,16 @@ void rvu_unregister_dl(struct rvu *rvu)
>  {
>  	struct rvu_devlink *rvu_dl = rvu->rvu_dl;
>  	struct devlink *dl = rvu_dl->dl;
> +	size_t size;
>  
>  	devlink_unregister(dl);
> -	devlink_params_unregister(dl, rvu_af_dl_params,
> -				  ARRAY_SIZE(rvu_af_dl_params));
> +	/* Unregister exact match devlink only for CN10K-B */
> +	size = ARRAY_SIZE(rvu_af_dl_params);
> +	if (!rvu_npc_exact_has_match_table(rvu))
> +		size -= 1;
> +
> +	devlink_params_unregister(dl, rvu_af_dl_params, size);

The code is ok, but it will be much better if you separate
rvu_af_dl_params to two structs and call to devlink_params_register()
twice with relevant parameters.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

end of thread, other threads:[~2023-01-29 12:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27  9:46 [net PATCH] octeontx2-af: Fix devlink unregister Ratheesh Kannoth
2023-01-27  9:46 ` [net PATCH] octeontx2-af: Removed unnecessary debug messages Ratheesh Kannoth
2023-01-29 12:36   ` Leon Romanovsky
2023-01-29 12:41 ` [net PATCH] octeontx2-af: Fix devlink unregister Leon Romanovsky

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).