summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-05-22 10:59:25 -0700
committerDavid S. Miller <davem@davemloft.net>2017-05-22 14:59:03 -0400
commit9140b30d318520e6d7dfe3b48aa62e6a7336b510 (patch)
treecd7b7b6e386c12c20f1deab3adcbb005454ae2d2 /drivers/net/ethernet/netronome/nfp/nfp_net_main.c
parentd4e7f0928593ac7df9b78410beb90178326a22c0 (diff)
nfp: add nfp_net_pf_free_vnic() function
Soon a third place will need to free a struct nfp_net. Add a free counterpart to nfp_net_pf_alloc_vnic(). Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_net_main.c')
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_net_main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index 532371940fd6..5f0c58a56182 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -268,16 +268,20 @@ static u8 __iomem *nfp_net_pf_map_ctrl_bar(struct nfp_pf *pf)
return ctrl_bar;
}
+static void nfp_net_pf_free_vnic(struct nfp_pf *pf, struct nfp_net *nn)
+{
+ list_del(&nn->vnic_list);
+ pf->num_vnics--;
+ nfp_net_free(nn);
+}
+
static void nfp_net_pf_free_vnics(struct nfp_pf *pf)
{
struct nfp_net *nn;
while (!list_empty(&pf->vnics)) {
nn = list_first_entry(&pf->vnics, struct nfp_net, vnic_list);
- list_del(&nn->vnic_list);
- pf->num_vnics--;
-
- nfp_net_free(nn);
+ nfp_net_pf_free_vnic(pf, nn);
}
}
@@ -518,9 +522,7 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
nfp_net_debugfs_dir_clean(&nn->debugfs_dir);
nfp_net_clean(nn);
- list_del(&nn->vnic_list);
- pf->num_vnics--;
- nfp_net_free(nn);
+ nfp_net_pf_free_vnic(pf, nn);
}
if (list_empty(&pf->vnics))