@@ -11393,7 +11393,7 @@ static netdev_features_t bnxt_features_check(struct sk_buff *skb,
return features;
break;
}
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
int bnxt_dbg_hwrm_rd_reg(struct bnxt *bp, u32 reg_off, u16 num_words,
@@ -3850,7 +3850,7 @@ static netdev_features_t cxgb_features_check(struct sk_buff *skb,
return features;
/* Offload is not supported for this encapsulated packet */
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
static netdev_features_t cxgb_fix_features(struct net_device *dev,
@@ -295,7 +295,7 @@ static netdev_features_t enic_features_check(struct sk_buff *skb,
return features;
out:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
int enic_is_dynamic(struct enic *enic)
@@ -5126,7 +5126,7 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
sizeof(struct udphdr) + sizeof(struct vxlanhdr) ||
!adapter->vxlan_port ||
udp_hdr(skb)->dest != adapter->vxlan_port)
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
return features;
}
@@ -2476,7 +2476,7 @@ static netdev_features_t hns3_features_check(struct sk_buff *skb,
* len of 480 bytes.
*/
if (len > HNS3_MAX_HDR_LEN)
- features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ features &= ~netdev_csum_gso_features_mask;
return features;
}
@@ -1512,7 +1512,7 @@ static netdev_features_t fm10k_features_check(struct sk_buff *skb,
if (!skb->encapsulation || fm10k_tx_encap_offload(skb))
return features;
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
static const struct net_device_ops fm10k_netdev_ops = {
@@ -13237,7 +13237,7 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,
return features;
out_err:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
/**
@@ -4306,7 +4306,7 @@ static netdev_features_t iavf_features_check(struct sk_buff *skb,
return features;
out_err:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
/**
@@ -8944,7 +8944,7 @@ ice_features_check(struct sk_buff *skb,
return features;
out_rm_features:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
static const struct net_device_ops ice_netdev_safe_mode_ops = {
@@ -2695,7 +2695,7 @@ static netdev_features_t mlx4_en_features_check(struct sk_buff *skb,
if (!priv->vxlan_port ||
(ip_hdr(skb)->version != 4) ||
(udp_hdr(skb)->dest != priv->vxlan_port))
- features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ features &= ~netdev_csum_gso_features_mask;
}
return features;
@@ -121,7 +121,7 @@ mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features)
/* Disable CSUM and GSO for software IPsec */
out_disable:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
static inline bool
@@ -161,7 +161,7 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg)
static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe) { return false; }
static inline netdev_features_t
mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features)
-{ return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
+{ return features & ~netdev_csum_gso_features_mask; }
static inline bool
mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
@@ -4465,7 +4465,7 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv,
out:
/* Disable CSUM and GSO if the udp dport is not offloaded by HW */
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
netdev_features_t mlx5e_features_check(struct sk_buff *skb,
@@ -1806,7 +1806,7 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev,
l4_hdr = ipv6_hdr(skb)->nexthdr;
break;
default:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
if (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
@@ -1815,7 +1815,7 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev,
(l4_hdr == IPPROTO_UDP &&
(skb_inner_mac_header(skb) - skb_transport_header(skb) !=
sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
return features;
}
@@ -1790,13 +1790,12 @@ netdev_features_t qede_features_check(struct sk_buff *skb,
skb_transport_header(skb)) > hdrlen ||
(ntohs(udp_hdr(skb)->dest) != vxln_port &&
ntohs(udp_hdr(skb)->dest) != gnv_port))
- return features & ~(NETIF_F_CSUM_MASK |
- NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
} else if (l4_proto == IPPROTO_IPIP) {
/* IPIP tunnels are unknown to the device or at least unsupported natively,
* offloads for them can't be done trivially, so disable them for such skb.
*/
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
}
@@ -1365,10 +1365,9 @@ netdev_features_t efx_features_check(struct sk_buff *skb, struct net_device *dev
if (skb_inner_transport_offset(skb) >
EFX_TSO2_MAX_HDRLEN)
features &= ~(NETIF_F_GSO_MASK);
- if (features & (NETIF_F_GSO_MASK | NETIF_F_CSUM_MASK))
+ if (features & netdev_csum_gso_features_mask)
if (!efx_can_encap_offloads(efx, skb))
- features &= ~(NETIF_F_GSO_MASK |
- NETIF_F_CSUM_MASK);
+ features &= ~netdev_csum_gso_features_mask;
}
return features;
}
@@ -1378,10 +1378,9 @@ netdev_features_t efx_siena_features_check(struct sk_buff *skb,
if (skb_inner_transport_offset(skb) >
EFX_TSO2_MAX_HDRLEN)
features &= ~(NETIF_F_GSO_MASK);
- if (features & (NETIF_F_GSO_MASK | NETIF_F_CSUM_MASK))
+ if (features & netdev_csum_gso_features_mask)
if (!efx_can_encap_offloads(efx, skb))
- features &= ~(NETIF_F_GSO_MASK |
- NETIF_F_CSUM_MASK);
+ features &= ~netdev_csum_gso_features_mask;
}
return features;
}
@@ -2768,7 +2768,7 @@ rtl8152_features_check(struct sk_buff *skb, struct net_device *dev,
if ((mss || skb->ip_summed == CHECKSUM_PARTIAL) &&
skb_transport_offset(skb) > max_offset)
- features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ features &= ~netdev_csum_gso_features_mask;
else if ((skb->len + sizeof(struct tx_desc)) > agg_buf_sz)
features &= ~NETIF_F_GSO_MASK;
@@ -277,7 +277,7 @@ netdev_features_t vmxnet3_features_check(struct sk_buff *skb,
l4_proto = ipv6_hdr(skb)->nexthdr;
break;
default:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
switch (l4_proto) {
@@ -288,11 +288,11 @@ netdev_features_t vmxnet3_features_check(struct sk_buff *skb,
if (port != GENEVE_UDP_PORT &&
port != IANA_VXLAN_UDP_PORT &&
port != VXLAN_UDP_PORT) {
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
break;
default:
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
}
}
return features;
@@ -373,7 +373,7 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,
sizeof(struct udphdr) + sizeof(struct vxlanhdr)) ||
(skb->ip_summed != CHECKSUM_NONE &&
!can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto))))
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ return features & ~netdev_csum_gso_features_mask;
return features;
}
@@ -3487,7 +3487,7 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
if (skb->ip_summed != CHECKSUM_NONE &&
!can_checksum_protocol(features, type)) {
- features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
+ features &= ~netdev_csum_gso_features_mask;
}
if (illegal_highdma(skb->dev, skb))
features &= ~NETIF_F_SG;
Replace the expression "NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK" by netdev_csum_gso_features_mask, make it simple to use netdev features helpers later. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 4 ++-- drivers/net/ethernet/qlogic/qede/qede_fp.c | 5 ++--- drivers/net/ethernet/sfc/efx_common.c | 5 ++--- drivers/net/ethernet/sfc/siena/efx_common.c | 5 ++--- drivers/net/usb/r8152.c | 2 +- drivers/net/vmxnet3/vmxnet3_ethtool.c | 6 +++--- include/net/vxlan.h | 2 +- net/core/dev.c | 2 +- 20 files changed, 27 insertions(+), 30 deletions(-)