diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-04-05 02:12:24 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-05 20:49:12 +0300 |
commit | d12537df343ec21054769f59bda3b15879644f52 (patch) | |
tree | d1b10d4985385ba8280a692eabe85da712e4f12c /drivers/net/ethernet/netronome/nfp/nfp_main.h | |
parent | b9de00770db50ce11f64cd7676dbcaf295a1926f (diff) | |
download | linux-d12537df343ec21054769f59bda3b15879644f52.tar.xz |
nfp: add mutex protection for the port list
We will want to unregister netdevs after their port got reconfigured.
For that we need to make sure manipulations of port list from the
port reconfiguration flow will not race with driver's .remove()
callback.
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_main.h')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_main.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.h b/drivers/net/ethernet/netronome/nfp/nfp_main.h index bb15a5724bf7..b7ceec9a5783 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_main.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_main.h @@ -42,6 +42,7 @@ #include <linux/list.h> #include <linux/types.h> #include <linux/msi.h> +#include <linux/mutex.h> #include <linux/pci.h> struct dentry; @@ -67,6 +68,7 @@ struct nfp_eth_table; * @num_ports: Number of adapter ports app firmware supports * @num_netdevs: Number of netdevs spawned * @ports: Linked list of port structures (struct nfp_net) + * @port_lock: Protects @ports, @num_ports, @num_netdevs */ struct nfp_pf { struct pci_dev *pdev; @@ -92,6 +94,7 @@ struct nfp_pf { unsigned int num_netdevs; struct list_head ports; + struct mutex port_lock; }; extern struct pci_driver nfp_netvf_pci_driver; |