diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 36 | 
1 files changed, 32 insertions, 4 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 440a02ee6f92..e8eeebd49a98 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -752,6 +752,9 @@ struct netdev_phys_port_id {  	unsigned char id_len;  }; +typedef u16 (*select_queue_fallback_t)(struct net_device *dev, +				       struct sk_buff *skb); +  /*   * This structure defines the management hooks for network devices.   * The following hooks can be defined; unless noted otherwise, they are @@ -783,7 +786,7 @@ struct netdev_phys_port_id {   *	Required can not be NULL.   *   * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, - *                         void *accel_priv); + *                         void *accel_priv, select_queue_fallback_t fallback);   *	Called to decide which queue to when device supports multiple   *	transmit queues.   * @@ -1005,7 +1008,8 @@ struct net_device_ops {  						   struct net_device *dev);  	u16			(*ndo_select_queue)(struct net_device *dev,  						    struct sk_buff *skb, -						    void *accel_priv); +						    void *accel_priv, +						    select_queue_fallback_t fallback);  	void			(*ndo_change_rx_flags)(struct net_device *dev,  						       int flags);  	void			(*ndo_set_rx_mode)(struct net_device *dev); @@ -1551,7 +1555,6 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,  struct netdev_queue *netdev_pick_tx(struct net_device *dev,  				    struct sk_buff *skb,  				    void *accel_priv); -u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);  /*   * Net namespace inlines @@ -2276,6 +2279,26 @@ static inline void netdev_reset_queue(struct net_device *dev_queue)  }  /** + * 	netdev_cap_txqueue - check if selected tx queue exceeds device queues + * 	@dev: network device + * 	@queue_index: given tx queue index + * + * 	Returns 0 if given tx queue index >= number of device tx queues, + * 	otherwise returns the originally passed tx queue index. + */ +static inline u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index) +{ +	if (unlikely(queue_index >= dev->real_num_tx_queues)) { +		net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n", +				     dev->name, queue_index, +				     dev->real_num_tx_queues); +		return 0; +	} + +	return queue_index; +} + +/**   *	netif_running - test if up   *	@dev: network device   * @@ -3068,7 +3091,12 @@ void netdev_change_features(struct net_device *dev);  void netif_stacked_transfer_operstate(const struct net_device *rootdev,  					struct net_device *dev); -netdev_features_t netif_skb_features(struct sk_buff *skb); +netdev_features_t netif_skb_dev_features(struct sk_buff *skb, +					 const struct net_device *dev); +static inline netdev_features_t netif_skb_features(struct sk_buff *skb) +{ +	return netif_skb_dev_features(skb, skb->dev); +}  static inline bool net_gso_ok(netdev_features_t features, int gso_type)  {  | 
