diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c index a0f3df8572d67c311e27e52dca754414bab8cb0f..d67969d3e484682c102a965c4abf5908dc1fc6fc 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c @@ -376,6 +376,12 @@ static int nfp_pci_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, pf); pf->pdev = pdev; + pf->wq = alloc_workqueue("nfp-%s", 0, 2, pci_name(pdev)); + if (!pf->wq) { + err = -ENOMEM; + goto err_pci_priv_unset; + } + pf->cpp = nfp_cpp_from_nfp6000_pcie(pdev); if (IS_ERR_OR_NULL(pf->cpp)) { err = PTR_ERR(pf->cpp); @@ -445,6 +451,8 @@ static int nfp_pci_probe(struct pci_dev *pdev, kfree(pf->hwinfo); nfp_cpp_free(pf->cpp); err_disable_msix: + destroy_workqueue(pf->wq); +err_pci_priv_unset: pci_set_drvdata(pdev, NULL); mutex_destroy(&pf->lock); devlink_free(devlink); @@ -477,6 +485,7 @@ static void nfp_pci_remove(struct pci_dev *pdev) if (pf->fw_loaded) nfp_fw_unload(pf); + destroy_workqueue(pf->wq); pci_set_drvdata(pdev, NULL); kfree(pf->hwinfo); nfp_cpp_free(pf->cpp); diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.h b/drivers/net/ethernet/netronome/nfp/nfp_main.h index edc14dc78674e9c5d9e960a3b33e449ec1c6dd60..a08cfba7e68ed41c69b6e92a6167d229366f479b 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.h @@ -89,6 +89,7 @@ struct nfp_rtsym_table; * @num_vnics: Number of vNICs spawned * @vnics: Linked list of vNIC structures (struct nfp_net) * @ports: Linked list of port structures (struct nfp_port) + * @wq: Workqueue for running works which need to grab @lock * @port_refresh_work: Work entry for taking netdevs out * @lock: Protects all fields which may change after probe */ @@ -131,7 +132,10 @@ struct nfp_pf { struct list_head vnics; struct list_head ports; + + struct workqueue_struct *wq; struct work_struct port_refresh_work; + struct mutex lock; }; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index 4d22e1cc013e75b44e2b812a59e97c2f5b1743cf..c85a2f18c4df9df095427b33b03f248bce218bc3 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -682,7 +682,7 @@ void nfp_net_refresh_port_table(struct nfp_port *port) set_bit(NFP_PORT_CHANGED, &port->flags); - schedule_work(&pf->port_refresh_work); + queue_work(pf->wq, &pf->port_refresh_work); } int nfp_net_refresh_eth_port(struct nfp_port *port)