summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/netronome/nfp/nfp_main.h
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-04-05 02:12:24 +0300
committerDavid S. Miller <davem@davemloft.net>2017-04-05 20:49:12 +0300
commitd12537df343ec21054769f59bda3b15879644f52 (patch)
treed1b10d4985385ba8280a692eabe85da712e4f12c /drivers/net/ethernet/netronome/nfp/nfp_main.h
parentb9de00770db50ce11f64cd7676dbcaf295a1926f (diff)
downloadlinux-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.h3
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;