Commit 71f8a116 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: add helper for cleaning up vNICs

We will soon have to invoke more clean up for vNICs.
Move the cleanup callbacks into a helper.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1851f93f
...@@ -418,6 +418,12 @@ nfp_net_pf_alloc_vnics(struct nfp_pf *pf, void __iomem *ctrl_bar, ...@@ -418,6 +418,12 @@ nfp_net_pf_alloc_vnics(struct nfp_pf *pf, void __iomem *ctrl_bar,
return err; return err;
} }
static void nfp_net_pf_clean_vnic(struct nfp_pf *pf, struct nfp_net *nn)
{
nfp_net_debugfs_dir_clean(&nn->debugfs_dir);
nfp_net_clean(nn);
}
static int static int
nfp_net_pf_spawn_vnics(struct nfp_pf *pf, nfp_net_pf_spawn_vnics(struct nfp_pf *pf,
void __iomem *ctrl_bar, void __iomem *tx_bar, void __iomem *ctrl_bar, void __iomem *tx_bar,
...@@ -480,10 +486,8 @@ nfp_net_pf_spawn_vnics(struct nfp_pf *pf, ...@@ -480,10 +486,8 @@ nfp_net_pf_spawn_vnics(struct nfp_pf *pf,
return 0; return 0;
err_prev_deinit: err_prev_deinit:
list_for_each_entry_continue_reverse(nn, &pf->vnics, vnic_list) { list_for_each_entry_continue_reverse(nn, &pf->vnics, vnic_list)
nfp_net_debugfs_dir_clean(&nn->debugfs_dir); nfp_net_pf_clean_vnic(pf, nn);
nfp_net_clean(nn);
}
nfp_net_irqs_disable(pf->pdev); nfp_net_irqs_disable(pf->pdev);
err_vec_free: err_vec_free:
kfree(pf->irq_entries); kfree(pf->irq_entries);
...@@ -585,9 +589,7 @@ static void nfp_net_refresh_vnics(struct work_struct *work) ...@@ -585,9 +589,7 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
if (!nn->port || nn->port->type != NFP_PORT_INVALID) if (!nn->port || nn->port->type != NFP_PORT_INVALID)
continue; continue;
nfp_net_debugfs_dir_clean(&nn->debugfs_dir); nfp_net_pf_clean_vnic(pf, nn);
nfp_net_clean(nn);
nfp_net_pf_free_vnic(pf, nn); nfp_net_pf_free_vnic(pf, nn);
} }
...@@ -760,11 +762,8 @@ void nfp_net_pci_remove(struct nfp_pf *pf) ...@@ -760,11 +762,8 @@ void nfp_net_pci_remove(struct nfp_pf *pf)
if (list_empty(&pf->vnics)) if (list_empty(&pf->vnics))
goto out; goto out;
list_for_each_entry(nn, &pf->vnics, vnic_list) { list_for_each_entry(nn, &pf->vnics, vnic_list)
nfp_net_debugfs_dir_clean(&nn->debugfs_dir); nfp_net_pf_clean_vnic(pf, nn);
nfp_net_clean(nn);
}
nfp_net_pf_free_vnics(pf); nfp_net_pf_free_vnics(pf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment