For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of ndo_features_check for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 11 +++--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 12 +++---- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 ++++---- drivers/net/ethernet/cadence/macb_main.c | 20 ++++++----- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 11 +++--- drivers/net/ethernet/cisco/enic/enic_main.c | 13 ++++--- drivers/net/ethernet/emulex/benet/be_main.c | 23 ++++++------ drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 11 +++--- drivers/net/ethernet/ibm/ibmvnic.c | 9 ++--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 9 +++-- drivers/net/ethernet/intel/i40e/i40e_main.c | 13 ++++--- drivers/net/ethernet/intel/iavf/iavf_main.c | 13 ++++--- drivers/net/ethernet/intel/ice/ice_main.c | 15 ++++---- drivers/net/ethernet/intel/igb/igb_main.c | 41 +++++++++++----------- drivers/net/ethernet/intel/igbvf/netdev.c | 37 +++++++++---------- drivers/net/ethernet/intel/igc/igc_main.c | 37 +++++++++---------- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 41 +++++++++++----------- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 37 +++++++++---------- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 13 +++---- drivers/net/ethernet/mellanox/mlx5/core/en.h | 5 ++- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 15 ++++---- .../net/ethernet/netronome/nfp/nfp_net_common.c | 22 ++++++------ drivers/net/ethernet/qlogic/qede/qede.h | 5 ++- drivers/net/ethernet/qlogic/qede/qede_fp.c | 20 +++++------ drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 10 +++--- drivers/net/ethernet/realtek/8139cp.c | 10 +++--- drivers/net/ethernet/realtek/r8169_main.c | 18 +++++----- drivers/net/ethernet/sfc/efx_common.c | 13 ++++--- drivers/net/ethernet/sfc/efx_common.h | 4 +-- drivers/net/usb/lan78xx.c | 14 ++++---- drivers/net/usb/r8152.c | 11 +++--- drivers/net/vmxnet3/vmxnet3_ethtool.c | 15 ++++---- drivers/net/vmxnet3/vmxnet3_int.h | 4 +-- drivers/s390/net/qeth_core.h | 5 ++- drivers/s390/net/qeth_core_main.c | 18 +++++----- drivers/s390/net/qeth_l3_main.c | 10 +++--- include/linux/netdevice.h | 9 +++-- net/core/dev.c | 9 ++--- 38 files changed, 280 insertions(+), 318 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 29bca9fa..cc1f1a7 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2267,14 +2267,11 @@ static int xgbe_set_features(struct net_device *netdev, return 0; }
-static netdev_features_t xgbe_features_check(struct sk_buff *skb, - struct net_device *netdev, - netdev_features_t features) +static void xgbe_features_check(struct sk_buff *skb, struct net_device *netdev, + netdev_features_t *features) { - vlan_features_check(skb, &features); - vxlan_features_check(skb, &features); - - return features; + vlan_features_check(skb, features); + vxlan_features_check(skb, features); }
static const struct net_device_ops xgbe_netdev_ops = { diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index fad43c3..f8b84f7 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12885,9 +12885,8 @@ static int bnx2x_get_phys_port_id(struct net_device *netdev, return 0; }
-static netdev_features_t bnx2x_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void bnx2x_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { /* * A skb with gso_size + header length > 9700 will cause a @@ -12905,11 +12904,10 @@ static netdev_features_t bnx2x_features_check(struct sk_buff *skb, if (unlikely(skb_is_gso(skb) && (skb_shinfo(skb)->gso_size > 9000) && !skb_gso_validate_mac_len(skb, 9700))) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK;
- vlan_features_check(skb, &features); - vxlan_features_check(skb, &features); - return features; + vlan_features_check(skb, features); + vxlan_features_check(skb, features); }
static int __bnx2x_vlan_configure_vid(struct bnx2x *bp, u16 vid, bool add) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index af6bddf..3d5c116 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -11107,31 +11107,30 @@ static bool bnxt_tunl_check(struct bnxt *bp, struct sk_buff *skb, u8 l4_proto) return false; }
-static netdev_features_t bnxt_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void bnxt_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { struct bnxt *bp = netdev_priv(dev); u8 *l4_proto;
- vlan_features_check(skb, &features); + vlan_features_check(skb, features); switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): if (!skb->encapsulation) - return features; + return; l4_proto = &ip_hdr(skb)->protocol; if (bnxt_tunl_check(bp, skb, *l4_proto)) - return features; + return; break; case htons(ETH_P_IPV6): if (!bnxt_exthdr_check(bp, skb, skb_network_offset(skb), &l4_proto)) break; if (!l4_proto || bnxt_tunl_check(bp, skb, *l4_proto)) - return features; + return; break; } - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
int bnxt_dbg_hwrm_rd_reg(struct bnxt *bp, u32 reg_off, u16 num_words, diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 181ebc2..ff54f2a 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2032,9 +2032,8 @@ static unsigned int macb_tx_map(struct macb *bp, return 0; }
-static netdev_features_t macb_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void macb_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { unsigned int nr_frags, f; unsigned int hdrlen; @@ -2043,7 +2042,7 @@ static netdev_features_t macb_features_check(struct sk_buff *skb,
/* there is only one buffer or protocol is not UDP */ if (!skb_is_nonlinear(skb) || (ip_hdr(skb)->protocol != IPPROTO_UDP)) - return features; + return;
/* length of header */ hdrlen = skb_transport_offset(skb); @@ -2052,8 +2051,10 @@ static netdev_features_t macb_features_check(struct sk_buff *skb, * When software supplies two or more payload buffers all payload buffers * apart from the last must be a multiple of 8 bytes in size. */ - if (!IS_ALIGNED(skb_headlen(skb) - hdrlen, MACB_TX_LEN_ALIGN)) - return features & ~MACB_NETIF_LSO; + if (!IS_ALIGNED(skb_headlen(skb) - hdrlen, MACB_TX_LEN_ALIGN)) { + *features &= ~MACB_NETIF_LSO; + return; + }
nr_frags = skb_shinfo(skb)->nr_frags; /* No need to check last fragment */ @@ -2061,10 +2062,11 @@ static netdev_features_t macb_features_check(struct sk_buff *skb, for (f = 0; f < nr_frags; f++) { const skb_frag_t *frag = &skb_shinfo(skb)->frags[f];
- if (!IS_ALIGNED(skb_frag_size(frag), MACB_TX_LEN_ALIGN)) - return features & ~MACB_NETIF_LSO; + if (!IS_ALIGNED(skb_frag_size(frag), MACB_TX_LEN_ALIGN)) { + *features &= ~MACB_NETIF_LSO; + return; + } } - return features; }
static inline int macb_clear_csum(struct sk_buff *skb) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index aa85732..3f9434c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -3834,22 +3834,21 @@ static const struct udp_tunnel_nic_info cxgb_udp_tunnels = { }, };
-static netdev_features_t cxgb_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void cxgb_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { struct port_info *pi = netdev_priv(dev); struct adapter *adapter = pi->adapter;
if (CHELSIO_CHIP_VERSION(adapter->params.chip) < CHELSIO_T6) - return features; + return;
/* Check if hw supports offload for this packet */ if (!skb->encapsulation || cxgb_encap_offload_supported(skb)) - return features; + return;
/* Offload is not supported for this encapsulated packet */ - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
static netdev_features_t cxgb_fix_features(struct net_device *dev, diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 033b9de..a2cc1d5 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -240,9 +240,8 @@ static const struct udp_tunnel_nic_info enic_udp_tunnels = { }, };
-static netdev_features_t enic_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void enic_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { const struct ethhdr *eth = (struct ethhdr *)skb_inner_mac_header(skb); struct enic *enic = netdev_priv(dev); @@ -251,9 +250,9 @@ static netdev_features_t enic_features_check(struct sk_buff *skb, u8 proto;
if (!skb->encapsulation) - return features; + return;
- vxlan_features_check(skb, &features); + vxlan_features_check(skb, features);
switch (vlan_get_protocol(skb)) { case htons(ETH_P_IPV6): @@ -291,10 +290,10 @@ static netdev_features_t enic_features_check(struct sk_buff *skb, if (port != enic->vxlan.vxlan_udp_port_number) goto out;
- return features; + return;
out: - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
int enic_is_dynamic(struct enic *enic) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 556242d..27e8a1d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -5064,9 +5064,8 @@ static struct be_cmd_work *be_alloc_work(struct be_adapter *adapter, return work; }
-static netdev_features_t be_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void be_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { struct be_adapter *adapter = netdev_priv(dev); u8 l4_hdr = 0; @@ -5076,7 +5075,7 @@ static netdev_features_t be_features_check(struct sk_buff *skb, * to Lancer and BE3 HW. Disable TSO6 feature. */ if (!skyhawk_chip(adapter) && is_ipv6_ext_hdr(skb)) - features &= ~NETIF_F_TSO6; + *features &= ~NETIF_F_TSO6;
/* Lancer cannot handle the packet with MSS less than 256. * Also it can't handle a TSO packet with a single segment @@ -5085,17 +5084,17 @@ static netdev_features_t be_features_check(struct sk_buff *skb, if (lancer_chip(adapter) && (skb_shinfo(skb)->gso_size < 256 || skb_shinfo(skb)->gso_segs == 1)) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK; }
/* The code below restricts offload features for some tunneled and * Q-in-Q packets. * Offload features for normal (non tunnel) packets are unchanged. */ - vlan_features_check(skb, &features); + vlan_features_check(skb, features); if (!skb->encapsulation || !(adapter->flags & BE_FLAGS_VXLAN_OFFLOADS)) - return features; + return;
/* It's an encapsulated packet and VxLAN offloads are enabled. We * should disable tunnel offload features if it's not a VxLAN packet, @@ -5111,7 +5110,7 @@ static netdev_features_t be_features_check(struct sk_buff *skb, l4_hdr = ipv6_hdr(skb)->nexthdr; break; default: - return features; + return; }
if (l4_hdr != IPPROTO_UDP || @@ -5120,10 +5119,10 @@ static netdev_features_t be_features_check(struct sk_buff *skb, skb_inner_mac_header(skb) - skb_transport_header(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; + udp_hdr(skb)->dest != adapter->vxlan_port) { + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + return; + } }
static int be_get_phys_port_id(struct net_device *dev, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 8072644..91f5417 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2347,9 +2347,8 @@ static int hns3_nic_set_features(struct net_device *netdev, return 0; }
-static netdev_features_t hns3_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void hns3_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { #define HNS3_MAX_HDR_LEN 480U #define HNS3_MAX_L4_HDR_LEN 60U @@ -2357,7 +2356,7 @@ static netdev_features_t hns3_features_check(struct sk_buff *skb, size_t len;
if (skb->ip_summed != CHECKSUM_PARTIAL) - return features; + return;
if (skb->encapsulation) len = skb_inner_transport_header(skb) - skb->data; @@ -2373,9 +2372,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); - - return features; + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
static void hns3_nic_get_stats64(struct net_device *netdev, diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index a775c69..e3a07c96 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2813,9 +2813,8 @@ static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu) return wait_for_reset(adapter); }
-static netdev_features_t ibmvnic_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void ibmvnic_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { /* Some backing hardware adapters can not * handle packets with a MSS less than 224 @@ -2824,10 +2823,8 @@ static netdev_features_t ibmvnic_features_check(struct sk_buff *skb, if (skb_is_gso(skb)) { if (skb_shinfo(skb)->gso_size < 224 || skb_shinfo(skb)->gso_segs == 1) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK; } - - return features; }
static const struct net_device_ops ibmvnic_netdev_ops = { diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c index 2fb52bd..a311bcd 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c @@ -1504,14 +1504,13 @@ static void fm10k_dfwd_del_station(struct net_device *dev, void *priv) } }
-static netdev_features_t fm10k_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void fm10k_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { if (!skb->encapsulation || fm10k_tx_encap_offload(skb)) - return features; + return;
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
static const struct net_device_ops fm10k_netdev_ops = { diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 97c7855..e493c5a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -12873,9 +12873,8 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, * @dev: This physical port's netdev * @features: Offload features that the stack believes apply **/ -static netdev_features_t i40e_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void i40e_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { size_t len;
@@ -12884,13 +12883,13 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb, * checking for CHECKSUM_PARTIAL */ if (skb->ip_summed != CHECKSUM_PARTIAL) - return features; + return;
/* We cannot support GSO if the MSS is going to be less than * 64 bytes. If it is then we need to drop support for GSO. */ if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_size < 64)) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK;
/* MACLEN can support at most 63 words */ len = skb_network_header(skb) - skb->data; @@ -12920,9 +12919,9 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb, * by TCP, which is at most 15 dwords */
- return features; + return; out_err: - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
/** diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index fa6cf20..6df2b66 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3384,9 +3384,8 @@ static int iavf_set_features(struct net_device *netdev, * @dev: This physical port's netdev * @features: Offload features that the stack believes apply **/ -static netdev_features_t iavf_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { size_t len;
@@ -3395,13 +3394,13 @@ static netdev_features_t iavf_features_check(struct sk_buff *skb, * checking for CHECKSUM_PARTIAL */ if (skb->ip_summed != CHECKSUM_PARTIAL) - return features; + return;
/* We cannot support GSO if the MSS is going to be less than * 64 bytes. If it is then we need to drop support for GSO. */ if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_size < 64)) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK;
/* MACLEN can support at most 63 words */ len = skb_network_header(skb) - skb->data; @@ -3431,9 +3430,9 @@ static netdev_features_t iavf_features_check(struct sk_buff *skb, * by TCP, which is at most 15 dwords */
- return features; + return; out_err: - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
/** diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 33916ed..54cb9af 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -7162,10 +7162,9 @@ int ice_stop(struct net_device *netdev) * @netdev: This port's netdev * @features: Offload features that the stack believes apply */ -static netdev_features_t -ice_features_check(struct sk_buff *skb, - struct net_device __always_unused *netdev, - netdev_features_t features) +static void ice_features_check(struct sk_buff *skb, + struct net_device __always_unused *netdev, + netdev_features_t *features) { size_t len;
@@ -7174,13 +7173,13 @@ ice_features_check(struct sk_buff *skb, * checking for CHECKSUM_PARTIAL */ if (skb->ip_summed != CHECKSUM_PARTIAL) - return features; + return;
/* We cannot support GSO if the MSS is going to be less than * 64 bytes. If it is then we need to drop support for GSO. */ if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_size < 64)) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK;
len = skb_network_header(skb) - skb->data; if (len > ICE_TXD_MACLEN_MAX || len & 0x1) @@ -7201,9 +7200,9 @@ ice_features_check(struct sk_buff *skb, goto out_rm_features; }
- return features; + return; out_rm_features: - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
static const struct net_device_ops ice_netdev_safe_mode_ops = { diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 751de06..82b59ad 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2505,37 +2505,38 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], #define IGB_MAX_MAC_HDR_LEN 127 #define IGB_MAX_NETWORK_HDR_LEN 511
-static netdev_features_t -igb_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +static void igb_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { unsigned int network_hdr_len, mac_hdr_len;
/* Make certain the headers can be described by a context descriptor */ mac_hdr_len = skb_network_header(skb) - skb->data; - if (unlikely(mac_hdr_len > IGB_MAX_MAC_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_GSO_UDP_L4 | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(mac_hdr_len > IGB_MAX_MAC_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_GSO_UDP_L4 | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); - if (unlikely(network_hdr_len > IGB_MAX_NETWORK_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_GSO_UDP_L4 | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(network_hdr_len > IGB_MAX_NETWORK_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_GSO_UDP_L4 | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
/* We can only support IPV4 TSO in tunnels if we can mangle the * inner IP ID field, so strip TSO if MANGLEID is not supported. */ - if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) - features &= ~NETIF_F_TSO; - - return features; + if (skb->encapsulation && !(*features & NETIF_F_TSO_MANGLEID)) + *features &= ~NETIF_F_TSO; }
static void igb_offload_apply(struct igb_adapter *adapter, s32 queue) diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index d32e72d..92a46ac 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2619,35 +2619,36 @@ static int igbvf_set_features(struct net_device *netdev, #define IGBVF_MAX_MAC_HDR_LEN 127 #define IGBVF_MAX_NETWORK_HDR_LEN 511
-static netdev_features_t -igbvf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +static void igbvf_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { unsigned int network_hdr_len, mac_hdr_len;
/* Make certain the headers can be described by a context descriptor */ mac_hdr_len = skb_network_header(skb) - skb->data; - if (unlikely(mac_hdr_len > IGBVF_MAX_MAC_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(mac_hdr_len > IGBVF_MAX_MAC_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); - if (unlikely(network_hdr_len > IGBVF_MAX_NETWORK_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(network_hdr_len > IGBVF_MAX_NETWORK_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
/* We can only support IPV4 TSO in tunnels if we can mangle the * inner IP ID field, so strip TSO if MANGLEID is not supported. */ - if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) - features &= ~NETIF_F_TSO; - - return features; + if (skb->encapsulation && !(*features & NETIF_F_TSO_MANGLEID)) + *features &= ~NETIF_F_TSO; }
static const struct net_device_ops igbvf_netdev_ops = { diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index b7aab35..b9a2fbd 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4947,35 +4947,36 @@ static int igc_set_features(struct net_device *netdev, return 1; }
-static netdev_features_t -igc_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +static void igc_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { unsigned int network_hdr_len, mac_hdr_len;
/* Make certain the headers can be described by a context descriptor */ mac_hdr_len = skb_network_header(skb) - skb->data; - if (unlikely(mac_hdr_len > IGC_MAX_MAC_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(mac_hdr_len > IGC_MAX_MAC_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); - if (unlikely(network_hdr_len > IGC_MAX_NETWORK_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(network_hdr_len > IGC_MAX_NETWORK_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
/* We can only support IPv4 TSO in tunnels if we can mangle the * inner IP ID field, so strip TSO if MANGLEID is not supported. */ - if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) - features &= ~NETIF_F_TSO; - - return features; + if (skb->encapsulation && !(*features & NETIF_F_TSO_MANGLEID)) + *features &= ~NETIF_F_TSO; }
static void igc_tsync_interrupt(struct igc_adapter *adapter) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 24e06ba..e39d398 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -10067,43 +10067,44 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv) #define IXGBE_MAX_MAC_HDR_LEN 127 #define IXGBE_MAX_NETWORK_HDR_LEN 511
-static netdev_features_t -ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { unsigned int network_hdr_len, mac_hdr_len;
/* Make certain the headers can be described by a context descriptor */ mac_hdr_len = skb_network_header(skb) - skb->data; - if (unlikely(mac_hdr_len > IXGBE_MAX_MAC_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_GSO_UDP_L4 | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(mac_hdr_len > IXGBE_MAX_MAC_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_GSO_UDP_L4 | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); - if (unlikely(network_hdr_len > IXGBE_MAX_NETWORK_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_GSO_UDP_L4 | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(network_hdr_len > IXGBE_MAX_NETWORK_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_GSO_UDP_L4 | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
/* We can only support IPV4 TSO in tunnels if we can mangle the * inner IP ID field, so strip TSO if MANGLEID is not supported. * IPsec offoad sets skb->encapsulation but still can handle * the TSO, so it's the exception. */ - if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) { + if (skb->encapsulation && !(*features & NETIF_F_TSO_MANGLEID)) { #ifdef CONFIG_IXGBE_IPSEC if (!secpath_exists(skb)) #endif - features &= ~NETIF_F_TSO; + *features &= ~NETIF_F_TSO; } - - return features; }
static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index c714e1e..f2f6d00 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -4381,35 +4381,36 @@ static void ixgbevf_get_stats(struct net_device *netdev, #define IXGBEVF_MAX_MAC_HDR_LEN 127 #define IXGBEVF_MAX_NETWORK_HDR_LEN 511
-static netdev_features_t -ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +static void ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { unsigned int network_hdr_len, mac_hdr_len;
/* Make certain the headers can be described by a context descriptor */ mac_hdr_len = skb_network_header(skb) - skb->data; - if (unlikely(mac_hdr_len > IXGBEVF_MAX_MAC_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(mac_hdr_len > IXGBEVF_MAX_MAC_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); - if (unlikely(network_hdr_len > IXGBEVF_MAX_NETWORK_HDR_LEN)) - return features & ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_TSO | - NETIF_F_TSO6); + if (unlikely(network_hdr_len > IXGBEVF_MAX_NETWORK_HDR_LEN)) { + *features &= ~(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_TSO | + NETIF_F_TSO6); + return; + }
/* We can only support IPV4 TSO in tunnels if we can mangle the * inner IP ID field, so strip TSO if MANGLEID is not supported. */ - if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) - features &= ~NETIF_F_TSO; - - return features; + if (skb->encapsulation && !(*features & NETIF_F_TSO_MANGLEID)) + *features &= ~NETIF_F_TSO; }
static int ixgbevf_xdp_setup(struct net_device *dev, struct bpf_prog *prog) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 941d2d45..bc504dc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -2660,12 +2660,11 @@ static const struct udp_tunnel_nic_info mlx4_udp_tunnels = { }, };
-static netdev_features_t mlx4_en_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void mlx4_en_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { - vlan_features_check(skb, &features); - vxlan_features_check(skb, &features); + vlan_features_check(skb, features); + vxlan_features_check(skb, features);
/* The ConnectX-3 doesn't support outer IPv6 checksums but it does * support inner IPv6 checksums and segmentation so we need to @@ -2678,10 +2677,8 @@ 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 &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); } - - return features; }
static int mlx4_en_set_tx_maxrate(struct net_device *dev, int queue_index, u32 maxrate) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 4f6897c..5111c2c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -1120,9 +1120,8 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 void mlx5e_rx_dim_work(struct work_struct *work); void mlx5e_tx_dim_work(struct work_struct *work);
-netdev_features_t mlx5e_features_check(struct sk_buff *skb, - struct net_device *netdev, - netdev_features_t features); +void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, + netdev_features_t *features); int mlx5e_set_features(struct net_device *netdev, netdev_features_t features); #ifdef CONFIG_MLX5_ESWITCH int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 3deb65b..8f5046a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3814,21 +3814,18 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv, return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
-netdev_features_t mlx5e_features_check(struct sk_buff *skb, - struct net_device *netdev, - netdev_features_t features) +void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, + netdev_features_t *features) { struct mlx5e_priv *priv = netdev_priv(netdev);
- vlan_features_check(skb, &features); - vxlan_features_check(skb, &features); + vlan_features_check(skb, features); + vxlan_features_check(skb, features);
/* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation && - (features & NETIF_F_CSUM_MASK || features & NETIF_F_GSO_MASK)) - return mlx5e_tunnel_features_check(priv, skb, features); - - return features; + (*features & NETIF_F_CSUM_MASK || *features & NETIF_F_GSO_MASK)) + *features = mlx5e_tunnel_features_check(priv, skb, *features); }
static void mlx5e_tx_timeout_work(struct work_struct *work) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 58e7d98..6261596 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -3598,17 +3598,16 @@ static int nfp_net_set_features(struct net_device *netdev, return 0; }
-static netdev_features_t -nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +static void nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { u8 l4_hdr;
/* We can't do TSO over double tagged packets (802.1AD) */ - vlan_features_check(skb, &features); + vlan_features_check(skb, features);
if (!skb->encapsulation) - return features; + return;
/* Ensure that inner L4 header offset fits into TX descriptor field */ if (skb_is_gso(skb)) { @@ -3621,7 +3620,7 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, * metadata prepend - 8B */ if (unlikely(hdrlen > NFP_NET_LSO_MAX_HDR_SZ - 8)) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK; }
/* VXLAN/GRE check */ @@ -3633,7 +3632,8 @@ 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); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + return; }
if (skb->inner_protocol_type != ENCAP_TYPE_ETHER || @@ -3641,10 +3641,10 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, (l4_hdr != IPPROTO_UDP && l4_hdr != IPPROTO_GRE) || (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; + sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) { + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + return; + } }
static int diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h index 66c69f0..e476561 100644 --- a/drivers/net/ethernet/qlogic/qede/qede.h +++ b/drivers/net/ethernet/qlogic/qede/qede.h @@ -527,9 +527,8 @@ int qede_xdp_transmit(struct net_device *dev, int n_frames, struct xdp_frame **frames, u32 flags); u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev); -netdev_features_t qede_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features); +void qede_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features); int qede_alloc_rx_buffer(struct qede_rx_queue *rxq, bool allow_lazy); int qede_free_tx_pkt(struct qede_dev *edev, struct qede_tx_queue *txq, int *len); diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index 065e900..8a459d2 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c @@ -1747,9 +1747,8 @@ u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, /* 8B udp header + 8B base tunnel header + 32B option length */ #define QEDE_MAX_TUN_HDR_LEN 48
-netdev_features_t qede_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +void qede_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { if (skb->encapsulation) { u8 l4_proto = 0; @@ -1762,7 +1761,7 @@ netdev_features_t qede_features_check(struct sk_buff *skb, l4_proto = ipv6_hdr(skb)->nexthdr; break; default: - return features; + return; }
/* Disable offloads for geneve tunnels, as HW can't parse @@ -1780,16 +1779,17 @@ netdev_features_t qede_features_check(struct sk_buff *skb, if ((skb_inner_mac_header(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); + ntohs(udp_hdr(skb)->dest) != gnv_port)) { + *features &= ~(NETIF_F_CSUM_MASK | + NETIF_F_GSO_MASK); + return; + } } 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); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + return; } } - - return features; } diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 93a94a0..75ade18 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -492,13 +492,11 @@ static const struct udp_tunnel_nic_info qlcnic_udp_tunnels = { }, };
-static netdev_features_t qlcnic_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void qlcnic_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { - vlan_features_check(skb, &features); - vxlan_features_check(skb, &features); - return features; + vlan_features_check(skb, features); + vxlan_features_check(skb, features); }
static const struct net_device_ops qlcnic_netdev_ops = { diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 276a158..dc06c3e 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -1853,15 +1853,13 @@ static void cp_set_d3_state (struct cp_private *cp) pci_set_power_state (cp->pdev, PCI_D3hot); }
-static netdev_features_t cp_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void cp_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { if (skb_shinfo(skb)->gso_size > MSSMask) - features &= ~NETIF_F_TSO; + *features &= ~NETIF_F_TSO;
- vlan_features_check(skb, &features); - return features; + vlan_features_check(skb, features); } static const struct net_device_ops cp_netdev_ops = { .ndo_open = cp_open, diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index d48e589..3d93348 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -4352,35 +4352,33 @@ static netdev_features_t rtl8168evl_fix_tso(struct sk_buff *skb, return features; }
-static netdev_features_t rtl8169_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { int transport_offset = skb_transport_offset(skb); struct rtl8169_private *tp = netdev_priv(dev);
if (skb_is_gso(skb)) { if (tp->mac_version == RTL_GIGA_MAC_VER_34) - features = rtl8168evl_fix_tso(skb, features); + *features = rtl8168evl_fix_tso(skb, *features);
if (transport_offset > GTTCPHO_MAX && rtl_chip_supports_csum_v2(tp)) - features &= ~NETIF_F_ALL_TSO; + *features &= ~NETIF_F_ALL_TSO; } else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* work around hw bug on some chip versions */ if (skb->len < ETH_ZLEN) - features &= ~NETIF_F_CSUM_MASK; + *features &= ~NETIF_F_CSUM_MASK;
if (rtl_quirk_packet_padto(tp, skb)) - features &= ~NETIF_F_CSUM_MASK; + *features &= ~NETIF_F_CSUM_MASK;
if (transport_offset > TCPHO_MAX && rtl_chip_supports_csum_v2(tp)) - features &= ~NETIF_F_CSUM_MASK; + *features &= ~NETIF_F_CSUM_MASK; }
- vlan_features_check(skb, &features); - return features; + vlan_features_check(skb, features); }
static void rtl8169_pcierr_interrupt(struct net_device *dev) diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c index 896b592..a101fa5 100644 --- a/drivers/net/ethernet/sfc/efx_common.c +++ b/drivers/net/ethernet/sfc/efx_common.c @@ -1353,25 +1353,24 @@ static bool efx_can_encap_offloads(struct efx_nic *efx, struct sk_buff *skb) } }
-netdev_features_t efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +void efx_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { struct efx_nic *efx = netdev_priv(dev);
if (skb->encapsulation) { - if (features & NETIF_F_GSO_MASK) + if (*features & NETIF_F_GSO_MASK) /* Hardware can only do TSO with at most 208 bytes * of headers. */ 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)) + *features &= ~(NETIF_F_GSO_MASK); + if (*features & (NETIF_F_GSO_MASK | NETIF_F_CSUM_MASK)) if (!efx_can_encap_offloads(efx, skb)) - features &= ~(NETIF_F_GSO_MASK | + *features &= ~(NETIF_F_GSO_MASK | NETIF_F_CSUM_MASK); } - return features; }
int efx_get_phys_port_id(struct net_device *net_dev, diff --git a/drivers/net/ethernet/sfc/efx_common.h b/drivers/net/ethernet/sfc/efx_common.h index 65513fd..c4fea39 100644 --- a/drivers/net/ethernet/sfc/efx_common.h +++ b/drivers/net/ethernet/sfc/efx_common.h @@ -105,8 +105,8 @@ int efx_change_mtu(struct net_device *net_dev, int new_mtu);
extern const struct pci_error_handlers efx_err_handlers;
-netdev_features_t efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features); +void efx_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features);
int efx_get_phys_port_id(struct net_device *net_dev, struct netdev_phys_item_id *ppid); diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index d9e4dde..fe5c0d4 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -3588,17 +3588,15 @@ static void lan78xx_tx_timeout(struct net_device *net, unsigned int txqueue) tasklet_schedule(&dev->bh); }
-static netdev_features_t lan78xx_features_check(struct sk_buff *skb, - struct net_device *netdev, - netdev_features_t features) +static void lan78xx_features_check(struct sk_buff *skb, + struct net_device *netdev, + netdev_features_t *features) { if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE) - features &= ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK;
- vlan_features_check(skb, &features); - vxlan_features_check(skb, &features); - - return features; + vlan_features_check(skb, features); + vxlan_features_check(skb, features); }
static const struct net_device_ops lan78xx_netdev_ops = { diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index d7fbc81..e4fa71c 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2741,20 +2741,17 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev) netif_wake_queue(netdev); }
-static netdev_features_t -rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features) +static void rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { u32 mss = skb_shinfo(skb)->gso_size; int max_offset = mss ? GTTCPHO_MAX : TCPHO_MAX; int offset = skb_transport_offset(skb);
if ((mss || skb->ip_summed == CHECKSUM_PARTIAL) && offset > max_offset) - features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); else if ((skb->len + sizeof(struct tx_desc)) > agg_buf_sz) - features &= ~NETIF_F_GSO_MASK; - - return features; + *features &= ~NETIF_F_GSO_MASK; }
static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index a3e2f2ba..6780f1e 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -256,9 +256,8 @@ netdev_features_t vmxnet3_fix_features(struct net_device *netdev, return features; }
-netdev_features_t vmxnet3_features_check(struct sk_buff *skb, - struct net_device *netdev, - netdev_features_t features) +void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, + netdev_features_t *features) { struct vmxnet3_adapter *adapter = netdev_priv(netdev);
@@ -277,7 +276,8 @@ 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); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + return; }
switch (l4_proto) { @@ -288,14 +288,15 @@ 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); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + return; } break; default: - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + return; } } - return features; }
static void vmxnet3_enable_encap_offloads(struct net_device *netdev) diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 7027ff4..a711759 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h @@ -478,9 +478,9 @@ vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter); netdev_features_t vmxnet3_fix_features(struct net_device *netdev, netdev_features_t features);
-netdev_features_t +void vmxnet3_features_check(struct sk_buff *skb, - struct net_device *netdev, netdev_features_t features); + struct net_device *netdev, netdev_features_t *features);
int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features); diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 535a60b..06d02e2 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -1095,9 +1095,8 @@ int qeth_setassparms_cb(struct qeth_card *, struct qeth_reply *, unsigned long); int qeth_set_features(struct net_device *, netdev_features_t); void qeth_enable_hw_features(struct net_device *dev); netdev_features_t qeth_fix_features(struct net_device *, netdev_features_t); -netdev_features_t qeth_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features); +void qeth_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features); void qeth_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats); int qeth_set_real_num_tx_queues(struct qeth_card *card, unsigned int count); u16 qeth_iqd_select_queue(struct net_device *dev, struct sk_buff *skb, diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 1a7bb6f..50dde2c 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -6954,9 +6954,8 @@ netdev_features_t qeth_fix_features(struct net_device *dev, } EXPORT_SYMBOL_GPL(qeth_fix_features);
-netdev_features_t qeth_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +void qeth_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { struct qeth_card *card = dev->ml_priv;
@@ -6965,7 +6964,7 @@ netdev_features_t qeth_features_check(struct sk_buff *skb, READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) { netdev_features_t restricted = 0;
- if (skb_is_gso(skb) && !netif_needs_gso(skb, features)) + if (skb_is_gso(skb) && !netif_needs_gso(skb, *features)) restricted |= NETIF_F_ALL_TSO;
switch (vlan_get_protocol(skb)) { @@ -6974,14 +6973,14 @@ netdev_features_t qeth_features_check(struct sk_buff *skb, restricted |= NETIF_F_IP_CSUM;
if (restricted && qeth_next_hop_is_local_v4(card, skb)) - features &= ~restricted; + *features &= ~restricted; break; case htons(ETH_P_IPV6): if (!card->info.has_lp2lp_cso_v6) restricted |= NETIF_F_IPV6_CSUM;
if (restricted && qeth_next_hop_is_local_v6(card, skb)) - features &= ~restricted; + *features &= ~restricted; break; default: break; @@ -6995,7 +6994,7 @@ netdev_features_t qeth_features_check(struct sk_buff *skb, * additional buffer element. This reduces buffer utilization, and * hurts throughput. So compress small segments into one element. */ - if (netif_needs_gso(skb, features)) { + if (netif_needs_gso(skb, *features)) { /* match skb_segment(): */ unsigned int doffset = skb->data - skb_mac_header(skb); unsigned int hsize = skb_shinfo(skb)->gso_size; @@ -7003,11 +7002,10 @@ netdev_features_t qeth_features_check(struct sk_buff *skb,
/* linearize only if resulting skb allocations are order-0: */ if (SKB_DATA_ALIGN(hroom + doffset + hsize) <= SKB_MAX_HEAD(0)) - features &= ~NETIF_F_SG; + *features &= ~NETIF_F_SG; }
- vlan_features_check(skb, &features); - return features; + vlan_features_check(skb, features); } EXPORT_SYMBOL_GPL(qeth_features_check);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 3a523e7..76c37ee 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -1804,13 +1804,13 @@ qeth_l3_neigh_setup(struct net_device *dev, struct neigh_parms *np) return 0; }
-static netdev_features_t qeth_l3_osa_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void qeth_l3_osa_features_check(struct sk_buff *skb, + struct net_device *dev, + netdev_features_t *features) { if (vlan_get_protocol(skb) != htons(ETH_P_IP)) - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - return qeth_features_check(skb, dev, features); + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + qeth_features_check(skb, dev, features); }
static u16 qeth_l3_iqd_select_queue(struct net_device *dev, struct sk_buff *skb, diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index efea2d6..aa3ca93 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1347,9 +1347,9 @@ struct net_device_ops { int (*ndo_stop)(struct net_device *dev); netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev); - netdev_features_t (*ndo_features_check)(struct sk_buff *skb, + void (*ndo_features_check)(struct sk_buff *skb, struct net_device *dev, - netdev_features_t features); + netdev_features_t *features); u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev); @@ -5029,9 +5029,8 @@ 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 passthru_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features); +void passthru_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features); netdev_features_t netif_skb_features(struct sk_buff *skb);
static inline bool net_gso_ok(netdev_features_t features, int gso_type) diff --git a/net/core/dev.c b/net/core/dev.c index 31ab16b..a084a19 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3470,11 +3470,9 @@ static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) *features &= ~NETIF_F_SG; }
-netdev_features_t passthru_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +void passthru_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t *features) { - return features; } EXPORT_SYMBOL(passthru_features_check);
@@ -3545,8 +3543,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) NETIF_F_HW_VLAN_STAG_TX);
if (dev->netdev_ops->ndo_features_check) - features &= dev->netdev_ops->ndo_features_check(skb, dev, - features); + dev->netdev_ops->ndo_features_check(skb, dev, &features); else dflt_features_check(skb, dev, &features);