提交 ca3daf43 编写于 作者: H Huayu Chen 提交者: Jakub Kicinski

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: 9b7fe804 ("nfp: add DCB IEEE support")
Signed-off-by: NHuayu Chen <huayu.chen@corigine.com>
Reviewed-by: NNiklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: NSimon Horman <simon.horman@corigine.com>
Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230131163033.981937-1-simon.horman@corigine.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
上级 bc617613
......@@ -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,
};
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册