public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Ratheesh Kannoth <rkannoth@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, leon@kernel.org, sgoutham@marvell.com
Subject: Re: [net PATCH v1] octeontx2-af: Fix devlink unregister
Date: Mon, 30 Jan 2023 11:32:22 +0100	[thread overview]
Message-ID: <Y9ecthytH/d+xV5v@nanopsycho> (raw)
In-Reply-To: <20230130060443.763564-1-rkannoth@marvell.com>

Mon, Jan 30, 2023 at 07:04:43AM CET, rkannoth@marvell.com 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>
>---
> .../marvell/octeontx2/af/rvu_devlink.c        | 37 ++++++++++++++-----
> 1 file changed, 28 insertions(+), 9 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..4950eb13a79f 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
>@@ -1500,6 +1500,9 @@ static const struct devlink_param rvu_af_dl_params[] = {
> 			     BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> 			     rvu_af_dl_dwrr_mtu_get, rvu_af_dl_dwrr_mtu_set,
> 			     rvu_af_dl_dwrr_mtu_validate),
>+};
>+
>+static const struct devlink_param rvu_af_dl_param_exact_match[] = {
> 	DEVLINK_PARAM_DRIVER(RVU_AF_DEVLINK_PARAM_ID_NPC_EXACT_FEATURE_DISABLE,
> 			     "npc_exact_feature_disable", DEVLINK_PARAM_TYPE_STRING,
> 			     BIT(DEVLINK_PARAM_CMODE_RUNTIME),
>@@ -1556,7 +1559,6 @@ int rvu_register_dl(struct rvu *rvu)
> {
> 	struct rvu_devlink *rvu_dl;
> 	struct devlink *dl;
>-	size_t size;
> 	int err;
> 
> 	dl = devlink_alloc(&rvu_devlink_ops, sizeof(struct rvu_devlink),
>@@ -1578,18 +1580,29 @@ int rvu_register_dl(struct rvu *rvu)
> 		goto err_dl_health;
> 	}
> 
>-	/* Register exact match devlink only for CN10K-B */
>-	size = ARRAY_SIZE(rvu_af_dl_params);
>-	if (!rvu_npc_exact_has_match_table(rvu))
>-		size -= 1;
>-
>-	err = devlink_params_register(dl, rvu_af_dl_params, size);
>+	err = devlink_params_register(dl, rvu_af_dl_params, ARRAY_SIZE(rvu_af_dl_params));
> 	if (err) {
> 		dev_err(rvu->dev,
> 			"devlink params register failed with error %d", err);
> 		goto err_dl_health;
> 	}
> 
>+	/* Register exact match devlink only for CN10K-B */
>+	if (!rvu_npc_exact_has_match_table(rvu))
>+		goto done;
>+
>+	err = devlink_params_register(dl, rvu_af_dl_param_exact_match,
>+				      ARRAY_SIZE(rvu_af_dl_param_exact_match));
>+	if (!err)
>+		goto done;

Could you please follow the common error path pattern?
	if (err)
		goto err_something;

	return 0;


>+
>+	dev_err(rvu->dev,
>+		"devlink exact match params register failed with error %d", err);
>+
>+	devlink_params_unregister(dl, rvu_af_dl_params, ARRAY_SIZE(rvu_af_dl_params));
>+	goto err_dl_health;
>+
>+done:
> 	devlink_register(dl);
> 	return 0;
> 
>@@ -1605,8 +1618,14 @@ void rvu_unregister_dl(struct rvu *rvu)
> 	struct devlink *dl = rvu_dl->dl;
> 
> 	devlink_unregister(dl);
>-	devlink_params_unregister(dl, rvu_af_dl_params,
>-				  ARRAY_SIZE(rvu_af_dl_params));
>+
>+	devlink_params_unregister(dl, rvu_af_dl_params, ARRAY_SIZE(rvu_af_dl_params));
>+
>+	/* Unregister exact match devlink only for CN10K-B */
>+	if (rvu_npc_exact_has_match_table(rvu))
>+		devlink_params_unregister(dl, rvu_af_dl_param_exact_match,
>+					  ARRAY_SIZE(rvu_af_dl_param_exact_match));
>+
> 	rvu_health_reporters_destroy(rvu);
> 	devlink_free(dl);
> }
>-- 
>2.25.1
>

      parent reply	other threads:[~2023-01-30 10:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  6:04 [net PATCH v1] octeontx2-af: Fix devlink unregister Ratheesh Kannoth
2023-01-30 10:06 ` Leon Romanovsky
2023-01-30 10:32 ` Jiri Pirko [this message]

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=Y9ecthytH/d+xV5v@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rkannoth@marvell.com \
    --cc=sgoutham@marvell.com \
    /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