diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 70 | 
1 files changed, 52 insertions, 18 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1377d085ef99..26f69cf763f4 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -274,6 +274,7 @@ struct header_ops {  				const struct net_device *dev,  				const unsigned char *haddr);  	bool	(*validate)(const char *ll_header, unsigned int len); +	__be16	(*parse_protocol)(const struct sk_buff *skb);  };  /* These flag bits are private to the generic network queueing @@ -630,6 +631,7 @@ struct netdev_queue {  } ____cacheline_aligned_in_smp;  extern int sysctl_fb_tunnels_only_for_init_net; +extern int sysctl_devconf_inherit_init_net;  static inline bool net_has_fallback_tunnels(const struct net *net)  { @@ -867,7 +869,6 @@ enum bpf_netdev_command {  	/* BPF program for offload callbacks, invoked at program load time. */  	BPF_OFFLOAD_MAP_ALLOC,  	BPF_OFFLOAD_MAP_FREE, -	XDP_QUERY_XSK_UMEM,  	XDP_SETUP_XSK_UMEM,  }; @@ -894,10 +895,10 @@ struct netdev_bpf {  		struct {  			struct bpf_offloaded_map *offmap;  		}; -		/* XDP_QUERY_XSK_UMEM, XDP_SETUP_XSK_UMEM */ +		/* XDP_SETUP_XSK_UMEM */  		struct { -			struct xdp_umem *umem; /* out for query*/ -			u16 queue_id; /* in for query */ +			struct xdp_umem *umem; +			u16 queue_id;  		} xsk;  	};  }; @@ -940,6 +941,8 @@ struct dev_ifalias {  	char ifalias[];  }; +struct devlink; +  /*   * This structure defines the management hooks for network devices.   * The following hooks can be defined; unless noted otherwise, they are @@ -1152,7 +1155,8 @@ struct dev_ifalias {   *   * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],   *		      struct net_device *dev, - *		      const unsigned char *addr, u16 vid, u16 flags) + *		      const unsigned char *addr, u16 vid, u16 flags, + *		      struct netlink_ext_ack *extack);   *	Adds an FDB entry to dev for addr.   * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],   *		      struct net_device *dev, @@ -1186,6 +1190,10 @@ struct dev_ifalias {   *	not implement this, it is assumed that the hw is not able to have   *	multiple net devices on single physical port.   * + * int (*ndo_get_port_parent_id)(struct net_device *dev, + *				 struct netdev_phys_item_id *ppid) + *	Called to get the parent ID of the physical port of this device. + *   * void (*ndo_udp_tunnel_add)(struct net_device *dev,   *			      struct udp_tunnel_info *ti);   *	Called by UDP tunnel to notify a driver about the UDP port and socket @@ -1243,6 +1251,10 @@ struct dev_ifalias {   *	that got dropped are freed/returned via xdp_return_frame().   *	Returns negative number, means general error invoking ndo, meaning   *	no frames were xmit'ed and core-caller will free all frames. + * struct devlink *(*ndo_get_devlink)(struct net_device *dev); + *	Get devlink instance associated with a given netdev. + *	Called with a reference on the netdevice and devlink locks only, + *	rtnl_lock is not held.   */  struct net_device_ops {  	int			(*ndo_init)(struct net_device *dev); @@ -1376,7 +1388,8 @@ struct net_device_ops {  					       struct net_device *dev,  					       const unsigned char *addr,  					       u16 vid, -					       u16 flags); +					       u16 flags, +					       struct netlink_ext_ack *extack);  	int			(*ndo_fdb_del)(struct ndmsg *ndm,  					       struct nlattr *tb[],  					       struct net_device *dev, @@ -1409,6 +1422,8 @@ struct net_device_ops {  						      bool new_carrier);  	int			(*ndo_get_phys_port_id)(struct net_device *dev,  							struct netdev_phys_item_id *ppid); +	int			(*ndo_get_port_parent_id)(struct net_device *dev, +							  struct netdev_phys_item_id *ppid);  	int			(*ndo_get_phys_port_name)(struct net_device *dev,  							  char *name, size_t len);  	void			(*ndo_udp_tunnel_add)(struct net_device *dev, @@ -1438,6 +1453,7 @@ struct net_device_ops {  						u32 flags);  	int			(*ndo_xsk_async_xmit)(struct net_device *dev,  						      u32 queue_id); +	struct devlink *	(*ndo_get_devlink)(struct net_device *dev);  };  /** @@ -1483,6 +1499,7 @@ struct net_device_ops {   * @IFF_NO_RX_HANDLER: device doesn't support the rx_handler hook   * @IFF_FAILOVER: device is a failover master device   * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device + * @IFF_L3MDEV_RX_HANDLER: only invoke the rx handler of L3 master device   */  enum netdev_priv_flags {  	IFF_802_1Q_VLAN			= 1<<0, @@ -1514,6 +1531,7 @@ enum netdev_priv_flags {  	IFF_NO_RX_HANDLER		= 1<<26,  	IFF_FAILOVER			= 1<<27,  	IFF_FAILOVER_SLAVE		= 1<<28, +	IFF_L3MDEV_RX_HANDLER		= 1<<29,  };  #define IFF_802_1Q_VLAN			IFF_802_1Q_VLAN @@ -1544,6 +1562,7 @@ enum netdev_priv_flags {  #define IFF_NO_RX_HANDLER		IFF_NO_RX_HANDLER  #define IFF_FAILOVER			IFF_FAILOVER  #define IFF_FAILOVER_SLAVE		IFF_FAILOVER_SLAVE +#define IFF_L3MDEV_RX_HANDLER		IFF_L3MDEV_RX_HANDLER  /**   *	struct net_device - The DEVICE structure. @@ -1824,9 +1843,6 @@ struct net_device {  #endif  	const struct net_device_ops *netdev_ops;  	const struct ethtool_ops *ethtool_ops; -#ifdef CONFIG_NET_SWITCHDEV -	const struct switchdev_ops *switchdev_ops; -#endif  #ifdef CONFIG_NET_L3_MASTER_DEV  	const struct l3mdev_ops	*l3mdev_ops;  #endif @@ -2928,6 +2944,15 @@ static inline int dev_parse_header(const struct sk_buff *skb,  	return dev->header_ops->parse(skb, haddr);  } +static inline __be16 dev_parse_header_protocol(const struct sk_buff *skb) +{ +	const struct net_device *dev = skb->dev; + +	if (!dev->header_ops || !dev->header_ops->parse_protocol) +		return 0; +	return dev->header_ops->parse_protocol(skb); +} +  /* ll_header must have at least hard_header_len allocated */  static inline bool dev_validate_header(const struct net_device *dev,  				       char *ll_header, int len) @@ -3648,7 +3673,11 @@ int dev_get_phys_port_id(struct net_device *dev,  			 struct netdev_phys_item_id *ppid);  int dev_get_phys_port_name(struct net_device *dev,  			   char *name, size_t len); +int dev_get_port_parent_id(struct net_device *dev, +			   struct netdev_phys_item_id *ppid, bool recurse); +bool netdev_port_same_parent_id(struct net_device *a, struct net_device *b);  int dev_change_proto_down(struct net_device *dev, bool proto_down); +int dev_change_proto_down_generic(struct net_device *dev, bool proto_down);  struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again);  struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,  				    struct netdev_queue *txq, int *ret); @@ -3858,7 +3887,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)  	if (debug_value == 0)	/* no output */  		return 0;  	/* set low N bits */ -	return (1 << debug_value) - 1; +	return (1U << debug_value) - 1;  }  static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) @@ -4549,6 +4578,11 @@ static inline bool netif_supports_nofcs(struct net_device *dev)  	return dev->priv_flags & IFF_SUPP_NOFCS;  } +static inline bool netif_has_l3_rx_handler(const struct net_device *dev) +{ +	return dev->priv_flags & IFF_L3MDEV_RX_HANDLER; +} +  static inline bool netif_is_l3_master(const struct net_device *dev)  {  	return dev->priv_flags & IFF_L3MDEV_MASTER; @@ -4660,22 +4694,22 @@ static inline const char *netdev_reg_state(const struct net_device *dev)  	return " (unknown)";  } -__printf(3, 4) +__printf(3, 4) __cold  void netdev_printk(const char *level, const struct net_device *dev,  		   const char *format, ...); -__printf(2, 3) +__printf(2, 3) __cold  void netdev_emerg(const struct net_device *dev, const char *format, ...); -__printf(2, 3) +__printf(2, 3) __cold  void netdev_alert(const struct net_device *dev, const char *format, ...); -__printf(2, 3) +__printf(2, 3) __cold  void netdev_crit(const struct net_device *dev, const char *format, ...); -__printf(2, 3) +__printf(2, 3) __cold  void netdev_err(const struct net_device *dev, const char *format, ...); -__printf(2, 3) +__printf(2, 3) __cold  void netdev_warn(const struct net_device *dev, const char *format, ...); -__printf(2, 3) +__printf(2, 3) __cold  void netdev_notice(const struct net_device *dev, const char *format, ...); -__printf(2, 3) +__printf(2, 3) __cold  void netdev_info(const struct net_device *dev, const char *format, ...);  #define netdev_level_once(level, dev, fmt, ...)			\  |