diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 50 | 
1 files changed, 42 insertions, 8 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c20f190b4c18..ae5e260911e2 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -848,6 +848,7 @@ enum tc_setup_type {  	TC_SETUP_ROOT_QDISC,  	TC_SETUP_QDISC_GRED,  	TC_SETUP_QDISC_TAPRIO, +	TC_SETUP_FT,  };  /* These structures hold the attributes of bpf state that are being passed @@ -925,6 +926,15 @@ struct dev_ifalias {  struct devlink;  struct tlsdev_ops; +struct netdev_name_node { +	struct hlist_node hlist; +	struct list_head list; +	struct net_device *dev; +	const char *name; +}; + +int netdev_name_node_alt_create(struct net_device *dev, const char *name); +int netdev_name_node_alt_destroy(struct net_device *dev, const char *name);  /*   * This structure defines the management hooks for network devices. @@ -1317,6 +1327,10 @@ struct net_device_ops {  						   struct nlattr *port[]);  	int			(*ndo_get_vf_port)(struct net_device *dev,  						   int vf, struct sk_buff *skb); +	int			(*ndo_get_vf_guid)(struct net_device *dev, +						   int vf, +						   struct ifla_vf_guid *node_guid, +						   struct ifla_vf_guid *port_guid);  	int			(*ndo_set_vf_guid)(struct net_device *dev,  						   int vf, u64 guid,  						   int guid_type); @@ -1564,7 +1578,7 @@ enum netdev_priv_flags {   *		(i.e. as seen by users in the "Space.c" file).  It is the name   *		of the interface.   * - *	@name_hlist: 	Device name hash chain, please keep it close to name[] + *	@name_node:	Name hashlist node   *	@ifalias:	SNMP alias   *	@mem_end:	Shared memory end   *	@mem_start:	Shared memory start @@ -1761,7 +1775,7 @@ enum netdev_priv_flags {   *			for hardware timestamping   *	@sfp_bus:	attached &struct sfp_bus structure.   *	@qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock -				spinlock + *				spinlock   *	@qdisc_running_key:	lockdep class annotating Qdisc->running seqcount   *	@qdisc_xmit_lock_key:	lockdep class annotating   *				netdev_queue->_xmit_lock spinlock @@ -1780,7 +1794,7 @@ enum netdev_priv_flags {  struct net_device {  	char			name[IFNAMSIZ]; -	struct hlist_node	name_hlist; +	struct netdev_name_node	*name_node;  	struct dev_ifalias	__rcu *ifalias;  	/*  	 *	I/O specific fields @@ -1867,6 +1881,11 @@ struct net_device {  	unsigned char		if_port;  	unsigned char		dma; +	/* Note : dev->mtu is often read without holding a lock. +	 * Writers usually hold RTNL. +	 * It is recommended to use READ_ONCE() to annotate the reads, +	 * and to use WRITE_ONCE() to annotate the writes. +	 */  	unsigned int		mtu;  	unsigned int		min_mtu;  	unsigned int		max_mtu; @@ -2387,11 +2406,23 @@ struct pcpu_sw_netstats {  } __aligned(4 * sizeof(u64));  struct pcpu_lstats { -	u64 packets; -	u64 bytes; +	u64_stats_t packets; +	u64_stats_t bytes;  	struct u64_stats_sync syncp;  } __aligned(2 * sizeof(u64)); +void dev_lstats_read(struct net_device *dev, u64 *packets, u64 *bytes); + +static inline void dev_lstats_add(struct net_device *dev, unsigned int len) +{ +	struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats); + +	u64_stats_update_begin(&lstats->syncp); +	u64_stats_add(&lstats->bytes, len); +	u64_stats_inc(&lstats->packets); +	u64_stats_update_end(&lstats->syncp); +} +  #define __netdev_alloc_pcpu_stats(type, gfp)				\  ({									\  	typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\ @@ -2487,6 +2518,9 @@ const char *netdev_cmd_to_name(enum netdev_cmd cmd);  int register_netdevice_notifier(struct notifier_block *nb);  int unregister_netdevice_notifier(struct notifier_block *nb); +int register_netdevice_notifier_net(struct net *net, struct notifier_block *nb); +int unregister_netdevice_notifier_net(struct net *net, +				      struct notifier_block *nb);  struct netdev_notifier_info {  	struct net_device	*dev; @@ -2557,6 +2591,9 @@ extern rwlock_t				dev_base_lock;		/* Device list lock */  		list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)  #define for_each_netdev_continue(net, d)		\  		list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) +#define for_each_netdev_continue_reverse(net, d)		\ +		list_for_each_entry_continue_reverse(d, &(net)->dev_base_head, \ +						     dev_list)  #define for_each_netdev_continue_rcu(net, d)		\  	list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)  #define for_each_netdev_in_bond_rcu(bond, slave)	\ @@ -4081,9 +4118,6 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,  				    unsigned char name_assign_type,  				    void (*setup)(struct net_device *),  				    unsigned int txqs, unsigned int rxqs); -int dev_get_valid_name(struct net *net, struct net_device *dev, -		       const char *name); -  #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \  	alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)  |