@@ -316,14 +316,14 @@ static inline bool eth_type_vlan(__be16 ethertype)
}
}
-static inline bool vlan_hw_offload_capable(netdev_features_t features,
+static inline bool vlan_hw_offload_capable(const netdev_features_t *features,
__be16 proto)
{
if (proto == htons(ETH_P_8021Q) &&
- netdev_feature_test(NETIF_F_HW_VLAN_CTAG_TX_BIT, features))
+ netdev_feature_test(NETIF_F_HW_VLAN_CTAG_TX_BIT, *features))
return true;
if (proto == htons(ETH_P_8021AD) &&
- netdev_feature_test(NETIF_F_HW_VLAN_STAG_TX_BIT, features))
+ netdev_feature_test(NETIF_F_HW_VLAN_STAG_TX_BIT, *features))
return true;
return false;
}
@@ -321,7 +321,7 @@ static void vlan_transfer_features(struct net_device *dev,
netif_inherit_tso_max(vlandev, dev);
- if (vlan_hw_offload_capable(dev->features, vlan->vlan_proto))
+ if (vlan_hw_offload_capable(&dev->features, vlan->vlan_proto))
vlandev->hard_header_len = dev->hard_header_len;
else
vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
@@ -332,7 +332,7 @@ static void vlan_transfer_features(struct net_device *dev,
vlandev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
vlandev->priv_flags |= (vlan->real_dev->priv_flags & IFF_XMIT_DST_RELEASE);
- vlandev->hw_enc_features = vlan_tnl_features(vlan->real_dev);
+ vlan_tnl_features(vlan->real_dev, &vlandev->hw_enc_features);
netdev_update_features(vlandev);
}
@@ -104,22 +104,20 @@ static inline struct net_device *vlan_find_dev(struct net_device *real_dev,
return NULL;
}
-static inline netdev_features_t vlan_tnl_features(struct net_device *real_dev)
+static inline void vlan_tnl_features(struct net_device *real_dev,
+ netdev_features_t *features)
{
- netdev_features_t ret;
-
- netdev_features_or(ret, NETIF_F_CSUM_MASK, NETIF_F_GSO_SOFTWARE);
- netdev_features_set(ret, NETIF_F_GSO_ENCAP_ALL);
- netdev_features_mask(ret, real_dev->hw_enc_features);
-
- if (netdev_features_intersects(ret, NETIF_F_GSO_ENCAP_ALL) &&
- netdev_features_intersects(ret, NETIF_F_CSUM_MASK)) {
- netdev_features_clear(ret, NETIF_F_CSUM_MASK);
- netdev_feature_add(NETIF_F_HW_CSUM_BIT, ret);
- return ret;
+ netdev_features_or(*features, NETIF_F_CSUM_MASK, NETIF_F_GSO_SOFTWARE);
+ netdev_features_set(*features, NETIF_F_GSO_ENCAP_ALL);
+ netdev_features_mask(*features, real_dev->hw_enc_features);
+
+ if (netdev_features_intersects(*features, NETIF_F_GSO_ENCAP_ALL) &&
+ netdev_features_intersects(*features, NETIF_F_CSUM_MASK)) {
+ netdev_features_clear(*features, NETIF_F_CSUM_MASK);
+ netdev_feature_add(NETIF_F_HW_CSUM_BIT, *features);
+ return;
}
- netdev_features_zero(ret);
- return ret;
+ netdev_features_zero(*features);
}
#define vlan_group_for_each_dev(grp, i, dev) \
@@ -583,7 +583,7 @@ static int vlan_dev_init(struct net_device *dev)
netdev_vlan_features_andnot(dev, real_dev->vlan_features,
NETIF_F_ALL_FCOE);
- dev->hw_enc_features = vlan_tnl_features(real_dev);
+ vlan_tnl_features(real_dev, &dev->hw_enc_features);
dev->mpls_features = real_dev->mpls_features;
/* ipv6 shared card related stuff */
@@ -601,7 +601,7 @@ static int vlan_dev_init(struct net_device *dev)
#endif
dev->needed_headroom = real_dev->needed_headroom;
- if (vlan_hw_offload_capable(real_dev->features, vlan->vlan_proto)) {
+ if (vlan_hw_offload_capable(&real_dev->features, vlan->vlan_proto)) {
dev->header_ops = &vlan_passthru_header_ops;
dev->hard_header_len = real_dev->hard_header_len;
} else {
@@ -3622,7 +3622,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *first, struct net_device *de
}
static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,
- netdev_features_t features)
+ const netdev_features_t *features)
{
if (skb_vlan_tag_present(skb) &&
!vlan_hw_offload_capable(features, skb->vlan_proto))
@@ -3657,7 +3657,7 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
netdev_features_t features;
netif_skb_features(skb, &features);
- skb = validate_xmit_vlan(skb, features);
+ skb = validate_xmit_vlan(skb, &features);
if (unlikely(!skb))
goto out_null;
@@ -80,7 +80,7 @@ static netdev_tx_t netpoll_start_xmit(struct sk_buff *skb,
netif_skb_features(skb, &features);
if (skb_vlan_tag_present(skb) &&
- !vlan_hw_offload_capable(features, skb->vlan_proto)) {
+ !vlan_hw_offload_capable(&features, skb->vlan_proto)) {
skb = __vlan_hwaccel_push_inside(skb);
if (unlikely(!skb)) {
/* This is actually a packet drop, but we
There are some functions of vlan driver using netdev_features_t as parameters or return netdev_features_t directly or both. For the prototype of netdev_features_t will be extended to be larger than 8 bytes, so change the prototype of the function, change the prototype of input features to 'netdev_features_t *', and return the features pointer as output parameter. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- include/linux/if_vlan.h | 6 +++--- net/8021q/vlan.c | 4 ++-- net/8021q/vlan.h | 26 ++++++++++++-------------- net/8021q/vlan_dev.c | 4 ++-- net/core/dev.c | 4 ++-- net/core/netpoll.c | 2 +- 6 files changed, 22 insertions(+), 24 deletions(-)