Skip to content

Commit ca3daf4

Browse files
Huayu-Chenkuba-moo
authored andcommitted
nfp: correct cleanup related to DCB resources
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: 9b7fe80 ("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> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Link: https://lore.kernel.org/r/20230131163033.981937-1-simon.horman@corigine.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bc61761 commit ca3daf4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

drivers/net/ethernet/netronome/nfp/nic/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ static void nfp_nic_sriov_disable(struct nfp_app *app)
3232

3333
static int nfp_nic_vnic_init(struct nfp_app *app, struct nfp_net *nn)
3434
{
35-
nfp_nic_dcb_init(nn);
35+
return nfp_nic_dcb_init(nn);
36+
}
3637

37-
return 0;
38+
static void nfp_nic_vnic_clean(struct nfp_app *app, struct nfp_net *nn)
39+
{
40+
nfp_nic_dcb_clean(nn);
3841
}
3942

4043
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 = {
7275
.sriov_disable = nfp_nic_sriov_disable,
7376

7477
.vnic_init = nfp_nic_vnic_init,
78+
.vnic_clean = nfp_nic_vnic_clean,
7579
};

drivers/net/ethernet/netronome/nfp/nic/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct nfp_dcb {
3333
int nfp_nic_dcb_init(struct nfp_net *nn);
3434
void nfp_nic_dcb_clean(struct nfp_net *nn);
3535
#else
36-
static inline int nfp_nic_dcb_init(struct nfp_net *nn) {return 0; }
36+
static inline int nfp_nic_dcb_init(struct nfp_net *nn) { return 0; }
3737
static inline void nfp_nic_dcb_clean(struct nfp_net *nn) {}
3838
#endif
3939

0 commit comments

Comments
 (0)