All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, oss-drivers@corigine.com,
	"Huayu Chen" <huayu.chen@corigine.com>,
	"Niklas Söderlund" <niklas.soderlund@corigine.com>,
	"Simon Horman" <simon.horman@corigine.com>
Subject: [PATCH net-next] nfp: correct cleanup related to DCB resources
Date: Tue, 31 Jan 2023 17:30:33 +0100	[thread overview]
Message-ID: <20230131163033.981937-1-simon.horman@corigine.com> (raw)

From: Huayu Chen <huayu.chen@corigine.com>

This patch corrects two oversights relating to releasing resources
and DCB initialisation.

1. If mapping of the dcbcfg_tbl area fails: an error should be
   propagated, allowing partial initialisation (probe) to be unwound.

2. Conversely, if where dcbcfg_tbl is successfully mapped: it should
   be unmapped in nfp_nic_dcb_clean() which is called via various error
   cleanup paths, and shutdown or removal of the PCIE device.

Fixes: 9b7fe8046d74 ("nfp: add DCB IEEE support")
Signed-off-by: Huayu Chen <huayu.chen@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 drivers/net/ethernet/netronome/nfp/nic/main.c | 8 ++++++--
 drivers/net/ethernet/netronome/nfp/nic/main.h | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nic/main.c b/drivers/net/ethernet/netronome/nfp/nic/main.c
index f78c2447d45b..9dd5afe37f6e 100644
--- a/drivers/net/ethernet/netronome/nfp/nic/main.c
+++ b/drivers/net/ethernet/netronome/nfp/nic/main.c
@@ -32,9 +32,12 @@ static void nfp_nic_sriov_disable(struct nfp_app *app)
 
 static int nfp_nic_vnic_init(struct nfp_app *app, struct nfp_net *nn)
 {
-	nfp_nic_dcb_init(nn);
+	return nfp_nic_dcb_init(nn);
+}
 
-	return 0;
+static void nfp_nic_vnic_clean(struct nfp_app *app, struct nfp_net *nn)
+{
+	nfp_nic_dcb_clean(nn);
 }
 
 static int nfp_nic_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
@@ -72,4 +75,5 @@ const struct nfp_app_type app_nic = {
 	.sriov_disable	= nfp_nic_sriov_disable,
 
 	.vnic_init      = nfp_nic_vnic_init,
+	.vnic_clean     = nfp_nic_vnic_clean,
 };
diff --git a/drivers/net/ethernet/netronome/nfp/nic/main.h b/drivers/net/ethernet/netronome/nfp/nic/main.h
index 7ba04451b8ba..094374df42b8 100644
--- a/drivers/net/ethernet/netronome/nfp/nic/main.h
+++ b/drivers/net/ethernet/netronome/nfp/nic/main.h
@@ -33,7 +33,7 @@ struct nfp_dcb {
 int nfp_nic_dcb_init(struct nfp_net *nn);
 void nfp_nic_dcb_clean(struct nfp_net *nn);
 #else
-static inline int nfp_nic_dcb_init(struct nfp_net *nn) {return 0; }
+static inline int nfp_nic_dcb_init(struct nfp_net *nn) { return 0; }
 static inline void nfp_nic_dcb_clean(struct nfp_net *nn) {}
 #endif
 
-- 
2.30.2


             reply	other threads:[~2023-01-31 16:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 16:30 Simon Horman [this message]
2023-02-01  9:30 ` [PATCH net-next] nfp: correct cleanup related to DCB resources Leon Romanovsky
2023-02-02  4:00 ` patchwork-bot+netdevbpf

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=20230131163033.981937-1-simon.horman@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=davem@davemloft.net \
    --cc=huayu.chen@corigine.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.