diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7ed3a3aa6604..b42d07b0390b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1144,6 +1144,7 @@ struct net_device_ops { | |||
1144 | netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb, | 1144 | netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb, |
1145 | struct net_device *dev, | 1145 | struct net_device *dev, |
1146 | void *priv); | 1146 | void *priv); |
1147 | int (*ndo_get_lock_subclass)(struct net_device *dev); | ||
1147 | }; | 1148 | }; |
1148 | 1149 | ||
1149 | /** | 1150 | /** |
@@ -2950,7 +2951,12 @@ static inline void netif_addr_lock(struct net_device *dev) | |||
2950 | 2951 | ||
2951 | static inline void netif_addr_lock_nested(struct net_device *dev) | 2952 | static inline void netif_addr_lock_nested(struct net_device *dev) |
2952 | { | 2953 | { |
2953 | spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING); | 2954 | int subclass = SINGLE_DEPTH_NESTING; |
2955 | |||
2956 | if (dev->netdev_ops->ndo_get_lock_subclass) | ||
2957 | subclass = dev->netdev_ops->ndo_get_lock_subclass(dev); | ||
2958 | |||
2959 | spin_lock_nested(&dev->addr_list_lock, subclass); | ||
2954 | } | 2960 | } |
2955 | 2961 | ||
2956 | static inline void netif_addr_lock_bh(struct net_device *dev) | 2962 | static inline void netif_addr_lock_bh(struct net_device *dev) |
@@ -3050,10 +3056,19 @@ extern int weight_p; | |||
3050 | extern int bpf_jit_enable; | 3056 | extern int bpf_jit_enable; |
3051 | 3057 | ||
3052 | bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev); | 3058 | bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev); |
3059 | struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev, | ||
3060 | struct list_head **iter); | ||
3053 | struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev, | 3061 | struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev, |
3054 | struct list_head **iter); | 3062 | struct list_head **iter); |
3055 | 3063 | ||
3056 | /* iterate through upper list, must be called under RCU read lock */ | 3064 | /* iterate through upper list, must be called under RCU read lock */ |
3065 | #define netdev_for_each_upper_dev_rcu(dev, updev, iter) \ | ||
3066 | for (iter = &(dev)->adj_list.upper, \ | ||
3067 | updev = netdev_upper_get_next_dev_rcu(dev, &(iter)); \ | ||
3068 | updev; \ | ||
3069 | updev = netdev_upper_get_next_dev_rcu(dev, &(iter))) | ||
3070 | |||
3071 | /* iterate through upper list, must be called under RCU read lock */ | ||
3057 | #define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \ | 3072 | #define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \ |
3058 | for (iter = &(dev)->all_adj_list.upper, \ | 3073 | for (iter = &(dev)->all_adj_list.upper, \ |
3059 | updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \ | 3074 | updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \ |
@@ -3077,6 +3092,14 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev, | |||
3077 | priv; \ | 3092 | priv; \ |
3078 | priv = netdev_lower_get_next_private_rcu(dev, &(iter))) | 3093 | priv = netdev_lower_get_next_private_rcu(dev, &(iter))) |
3079 | 3094 | ||
3095 | void *netdev_lower_get_next(struct net_device *dev, | ||
3096 | struct list_head **iter); | ||
3097 | #define netdev_for_each_lower_dev(dev, ldev, iter) \ | ||
3098 | for (iter = &(dev)->adj_list.lower, \ | ||
3099 | ldev = netdev_lower_get_next(dev, &(iter)); \ | ||
3100 | ldev; \ | ||
3101 | ldev = netdev_lower_get_next(dev, &(iter))) | ||
3102 | |||
3080 | void *netdev_adjacent_get_private(struct list_head *adj_list); | 3103 | void *netdev_adjacent_get_private(struct list_head *adj_list); |
3081 | void *netdev_lower_get_first_private_rcu(struct net_device *dev); | 3104 | void *netdev_lower_get_first_private_rcu(struct net_device *dev); |
3082 | struct net_device *netdev_master_upper_dev_get(struct net_device *dev); | 3105 | struct net_device *netdev_master_upper_dev_get(struct net_device *dev); |
@@ -3092,6 +3115,8 @@ void netdev_upper_dev_unlink(struct net_device *dev, | |||
3092 | void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); | 3115 | void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); |
3093 | void *netdev_lower_dev_get_private(struct net_device *dev, | 3116 | void *netdev_lower_dev_get_private(struct net_device *dev, |
3094 | struct net_device *lower_dev); | 3117 | struct net_device *lower_dev); |
3118 | int dev_get_nest_level(struct net_device *dev, | ||
3119 | bool (*type_check)(struct net_device *dev)); | ||
3095 | int skb_checksum_help(struct sk_buff *skb); | 3120 | int skb_checksum_help(struct sk_buff *skb); |
3096 | struct sk_buff *__skb_gso_segment(struct sk_buff *skb, | 3121 | struct sk_buff *__skb_gso_segment(struct sk_buff *skb, |
3097 | netdev_features_t features, bool tx_path); | 3122 | netdev_features_t features, bool tx_path); |
@@ -3180,12 +3205,7 @@ void netdev_change_features(struct net_device *dev); | |||
3180 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, | 3205 | void netif_stacked_transfer_operstate(const struct net_device *rootdev, |
3181 | struct net_device *dev); | 3206 | struct net_device *dev); |
3182 | 3207 | ||
3183 | netdev_features_t netif_skb_dev_features(struct sk_buff *skb, | 3208 | netdev_features_t netif_skb_features(struct sk_buff *skb); |
3184 | const struct net_device *dev); | ||
3185 | static inline netdev_features_t netif_skb_features(struct sk_buff *skb) | ||
3186 | { | ||
3187 | return netif_skb_dev_features(skb, skb->dev); | ||
3188 | } | ||
3189 | 3209 | ||
3190 | static inline bool net_gso_ok(netdev_features_t features, int gso_type) | 3210 | static inline bool net_gso_ok(netdev_features_t features, int gso_type) |
3191 | { | 3211 | { |