@@ -1356,7 +1356,7 @@ static int altera_tse_probe(struct platform_device *pdev)
/* Scatter/gather IO is not supported,
* so it is turned off
*/
- ndev->hw_features &= ~NETIF_F_SG;
+ netdev_hw_feature_del(ndev, NETIF_F_SG_BIT);
netdev_active_features_set(ndev, ndev->hw_features);
netdev_active_feature_add(ndev, NETIF_F_HIGHDMA_BIT);
@@ -2216,7 +2216,8 @@ static netdev_features_t xgbe_fix_features(struct net_device *netdev,
if (features & NETIF_F_GSO_UDP_TUNNEL_CSUM) {
netdev_notice(netdev,
"forcing tx udp tunnel checksumming off\n");
- features &= ~NETIF_F_GSO_UDP_TUNNEL_CSUM;
+ netdev_feature_del(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,
+ features);
}
}
@@ -231,13 +231,13 @@ static netdev_features_t aq_ndev_fix_features(struct net_device *ndev,
struct bpf_prog *prog;
if (!(features & NETIF_F_RXCSUM))
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
prog = READ_ONCE(aq_nic->xdp_prog);
if (prog && !prog->aux->xdp_has_frags &&
aq_nic->xdp_prog && features & NETIF_F_LRO) {
netdev_err(ndev, "LRO is not supported with single buffer XDP, disabling\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
return features;
@@ -466,7 +466,7 @@ static int aq_xdp_setup(struct net_device *ndev, struct bpf_prog *prog,
if (prog && ndev->features & NETIF_F_LRO) {
netdev_err(ndev,
"LRO is not supported with single buffer XDP, disabling\n");
- ndev->features &= ~NETIF_F_LRO;
+ netdev_active_feature_del(ndev, NETIF_F_LRO_BIT);
}
}
@@ -517,7 +517,7 @@ static netdev_features_t atl1c_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
if (hw->nic_type != athr_mt) {
if (netdev->mtu > MAX_TSO_FRAME_SIZE)
@@ -392,7 +392,7 @@ static netdev_features_t atl1e_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -382,7 +382,7 @@ static netdev_features_t atl2_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -247,7 +247,7 @@ static netdev_features_t atlx_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -8602,7 +8602,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->max_mtu = MAX_ETHERNET_JUMBO_PACKET_SIZE;
if (!(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN))
- dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_hw_feature_del(dev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
if ((rc = register_netdev(dev))) {
dev_err(&pdev->dev, "Cannot register net device\n");
@@ -4891,7 +4891,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu)
dev->mtu = new_mtu;
if (!bnx2x_mtu_allows_gro(new_mtu))
- dev->features &= ~NETIF_F_GRO_HW;
+ netdev_active_feature_del(dev, NETIF_F_GRO_HW_BIT);
if (IS_PF(bp) && SHMEM2_HAS(bp, curr_cfg))
SHMEM2_WR(bp, curr_cfg, CURR_CFG_MET_OS);
@@ -4911,14 +4911,14 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev,
* would require internal reload of PF in bnx2x_set_features().
*/
if (!(features & NETIF_F_RXCSUM) && !bp->disable_tpa) {
- features &= ~NETIF_F_RXCSUM;
+ netdev_feature_del(NETIF_F_RXCSUM_BIT, features);
if (dev->features & NETIF_F_RXCSUM)
netdev_feature_add(NETIF_F_RXCSUM_BIT,
features);
}
if (changed & NETIF_F_LOOPBACK) {
- features &= ~NETIF_F_LOOPBACK;
+ netdev_feature_del(NETIF_F_LOOPBACK_BIT, features);
if (dev->features & NETIF_F_LOOPBACK)
netdev_feature_add(NETIF_F_LOOPBACK_BIT,
features);
@@ -4927,12 +4927,12 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev,
/* TPA requires Rx CSUM offloading */
if (!(features & NETIF_F_RXCSUM))
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
if (!(features & NETIF_F_GRO) || !bnx2x_mtu_allows_gro(dev->mtu))
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
if (features & NETIF_F_GRO_HW)
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
return features;
}
@@ -4960,7 +4960,7 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features)
}
/* Don't care about GRO changes */
- changes &= ~NETIF_F_GRO;
+ netdev_feature_del(NETIF_F_GRO_BIT, changes);
if (changes)
bnx2x_reload = true;
@@ -13259,7 +13259,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
netdev_active_feature_add(dev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
netdev_active_feature_add(dev, NETIF_F_HIGHDMA_BIT);
if (dev->features & NETIF_F_LRO)
- dev->features &= ~NETIF_F_GRO_HW;
+ netdev_active_feature_del(dev, NETIF_F_GRO_HW_BIT);
/* Add Loopback capability to the device */
netdev_hw_feature_add(dev, NETIF_F_LOOPBACK_BIT);
@@ -6511,8 +6511,8 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
bp->flags &= ~BNXT_FLAG_AGG_RINGS;
bp->flags |= BNXT_FLAG_NO_AGG_RINGS;
- bp->dev->hw_features &= ~NETIF_F_LRO;
- bp->dev->features &= ~NETIF_F_LRO;
+ netdev_hw_feature_del(bp->dev, NETIF_F_LRO_BIT);
+ netdev_active_feature_del(bp->dev, NETIF_F_LRO_BIT);
bnxt_set_ring_params(bp);
}
}
@@ -10444,7 +10444,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
if ((bp->flags & BNXT_FLAG_RFS) &&
!(bp->flags & BNXT_FLAG_USING_MSIX)) {
/* disable RFS if falling back to INTA */
- bp->dev->hw_features &= ~NETIF_F_NTUPLE;
+ netdev_hw_feature_del(bp->dev, NETIF_F_NTUPLE_BIT);
bp->flags &= ~BNXT_FLAG_RFS;
}
@@ -11177,17 +11177,17 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
netdev_features_t vlan_features;
if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
- features &= ~NETIF_F_NTUPLE;
+ netdev_feature_del(NETIF_F_NTUPLE_BIT, features);
if ((bp->flags & BNXT_FLAG_NO_AGG_RINGS) || bp->xdp_prog)
netdev_features_clear_set(features, NETIF_F_LRO_BIT,
NETIF_F_GRO_HW_BIT);
if (!(features & NETIF_F_GRO))
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
if (features & NETIF_F_GRO_HW)
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
/* Both CTAG and STAG VLAN accelaration on the RX side have to be
* turned on or off together.
@@ -12257,8 +12257,8 @@ static void bnxt_set_dflt_rfs(struct bnxt *bp)
{
struct net_device *dev = bp->dev;
- dev->hw_features &= ~NETIF_F_NTUPLE;
- dev->features &= ~NETIF_F_NTUPLE;
+ netdev_hw_feature_del(dev, NETIF_F_NTUPLE_BIT);
+ netdev_active_feature_del(dev, NETIF_F_NTUPLE_BIT);
bp->flags &= ~BNXT_FLAG_RFS;
if (bnxt_rfs_supported(bp)) {
netdev_hw_feature_add(dev, NETIF_F_NTUPLE_BIT);
@@ -13637,7 +13637,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_active_features_set(dev, dev->hw_features);
netdev_active_feature_add(dev, NETIF_F_HIGHDMA_BIT);
if (dev->features & NETIF_F_GRO_HW)
- dev->features &= ~NETIF_F_LRO;
+ netdev_active_feature_del(dev, NETIF_F_LRO_BIT);
dev->priv_flags |= IFF_UNICAST_FLT;
#ifdef CONFIG_BNXT_SRIOV
@@ -2149,7 +2149,7 @@ static netdev_features_t macb_features_check(struct sk_buff *skb,
* apart from the last must be a multiple of 8 bytes in size.
*/
if (!IS_ALIGNED(skb_headlen(skb) - hdrlen, MACB_TX_LEN_ALIGN)) {
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
return features;
}
@@ -2160,7 +2160,7 @@ static netdev_features_t macb_features_check(struct sk_buff *skb,
const skb_frag_t *frag = &skb_shinfo(skb)->frags[f];
if (!IS_ALIGNED(skb_frag_size(frag), MACB_TX_LEN_ALIGN)) {
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
return features;
}
}
@@ -4064,7 +4064,7 @@ static int macb_init(struct platform_device *pdev)
netdev_hw_features_set_set(dev, NETIF_F_HW_CSUM_BIT,
NETIF_F_RXCSUM_BIT);
if (bp->caps & MACB_CAPS_SG_DISABLED)
- dev->hw_features &= ~NETIF_F_SG;
+ netdev_hw_feature_del(dev, NETIF_F_SG_BIT);
dev->features = dev->hw_features;
/* Check RX Flow Filters support.
@@ -2722,29 +2722,29 @@ static netdev_features_t liquidio_fix_features(struct net_device *netdev,
if ((request & NETIF_F_RXCSUM) &&
!(lio->dev_capability & NETIF_F_RXCSUM))
- request &= ~NETIF_F_RXCSUM;
+ netdev_feature_del(NETIF_F_RXCSUM_BIT, request);
if ((request & NETIF_F_HW_CSUM) &&
!(lio->dev_capability & NETIF_F_HW_CSUM))
- request &= ~NETIF_F_HW_CSUM;
+ netdev_feature_del(NETIF_F_HW_CSUM_BIT, request);
if ((request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO))
- request &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, request);
if ((request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6))
- request &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT, request);
if ((request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO))
- request &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, request);
/*Disable LRO if RXCSUM is off */
if (!(request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) &&
(lio->dev_capability & NETIF_F_LRO))
- request &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, request);
if ((request & NETIF_F_HW_VLAN_CTAG_FILTER) &&
!(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER))
- request &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, request);
return request;
}
@@ -3583,7 +3583,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
NETIF_F_TSO6_BIT, NETIF_F_LRO_BIT);
netdev->hw_enc_features = lio->enc_dev_capability;
- netdev->hw_enc_features &= ~NETIF_F_LRO;
+ netdev_hw_enc_feature_del(netdev, NETIF_F_LRO_BIT);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
@@ -3596,11 +3596,11 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
netdev_ctag_vlan_features);
netdev->features = lio->dev_capability;
- netdev->features &= ~NETIF_F_LRO;
+ netdev_active_feature_del(netdev, NETIF_F_LRO_BIT);
netdev->hw_features = lio->dev_capability;
/*HW_VLAN_RX and HW_VLAN_FILTER is always on*/
- netdev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_hw_feature_del(netdev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
/* MTU range: 68 - 16000 */
netdev->min_mtu = LIO_MIN_MTU_SIZE;
@@ -1820,25 +1820,25 @@ static netdev_features_t liquidio_fix_features(struct net_device *netdev,
if ((request & NETIF_F_RXCSUM) &&
!(lio->dev_capability & NETIF_F_RXCSUM))
- request &= ~NETIF_F_RXCSUM;
+ netdev_feature_del(NETIF_F_RXCSUM_BIT, request);
if ((request & NETIF_F_HW_CSUM) &&
!(lio->dev_capability & NETIF_F_HW_CSUM))
- request &= ~NETIF_F_HW_CSUM;
+ netdev_feature_del(NETIF_F_HW_CSUM_BIT, request);
if ((request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO))
- request &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, request);
if ((request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6))
- request &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT, request);
if ((request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO))
- request &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, request);
/* Disable LRO if RXCSUM is off */
if (!(request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) &&
(lio->dev_capability & NETIF_F_LRO))
- request &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, request);
return request;
}
@@ -2113,7 +2113,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
NETIF_F_TSO6_BIT, NETIF_F_LRO_BIT);
netdev->hw_enc_features = lio->enc_dev_capability;
- netdev->hw_enc_features &= ~NETIF_F_LRO;
+ netdev_hw_enc_feature_del(netdev, NETIF_F_LRO_BIT);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
netdev->vlan_features = lio->dev_capability;
@@ -2122,10 +2122,10 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
netdev_ctag_vlan_features);
netdev->features = lio->dev_capability;
- netdev->features &= ~NETIF_F_LRO;
+ netdev_active_feature_del(netdev, NETIF_F_LRO_BIT);
netdev->hw_features = lio->dev_capability;
- netdev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_hw_feature_del(netdev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
/* MTU range: 68 - 16000 */
netdev->min_mtu = LIO_MIN_MTU_SIZE;
@@ -1780,7 +1780,7 @@ static netdev_features_t nicvf_fix_features(struct net_device *netdev,
if ((features & NETIF_F_LOOPBACK) &&
netif_running(netdev) && !nic->loopback_supported)
- features &= ~NETIF_F_LOOPBACK;
+ netdev_feature_del(NETIF_F_LOOPBACK_BIT, features);
return features;
}
@@ -873,7 +873,7 @@ static netdev_features_t t1_fix_features(struct net_device *dev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -2245,7 +2245,8 @@ static int cxgb_siocdevprivate(struct net_device *dev,
netdev_wanted_feature_add(dev,
NETIF_F_GRO_BIT);
else
- dev->wanted_features &= ~NETIF_F_GRO;
+ netdev_wanted_feature_del(dev,
+ NETIF_F_GRO_BIT);
netdev_update_features(dev);
}
@@ -2597,7 +2598,7 @@ static netdev_features_t cxgb_fix_features(struct net_device *dev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -110,10 +110,10 @@ int cxgb_fcoe_disable(struct net_device *netdev)
fcoe->flags &= ~CXGB_FCOE_ENABLED;
- netdev->features &= ~NETIF_F_FCOE_CRC;
- netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
- netdev->features &= ~NETIF_F_FCOE_MTU;
- netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
+ netdev_active_feature_del(netdev, NETIF_F_FCOE_CRC_BIT);
+ netdev_vlan_feature_del(netdev, NETIF_F_FCOE_CRC_BIT);
+ netdev_active_feature_del(netdev, NETIF_F_FCOE_MTU_BIT);
+ netdev_vlan_feature_del(netdev, NETIF_F_FCOE_MTU_BIT);
netdev_features_change(netdev);
@@ -3860,7 +3860,7 @@ static netdev_features_t cxgb_fix_features(struct net_device *dev,
{
/* Disable GRO, if RX_CSUM is disabled */
if (!(features & NETIF_F_RXCSUM))
- features &= ~NETIF_F_GRO;
+ netdev_feature_del(NETIF_F_GRO_BIT, features);
return features;
}
@@ -1184,7 +1184,7 @@ static netdev_features_t cxgb4vf_fix_features(struct net_device *dev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -2887,7 +2887,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_active_features_set(netdev, netdev_ctag_vlan_offload_features);
if (ENIC_SETTING(enic, LOOP)) {
- netdev->features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_active_feature_del(netdev, NETIF_F_HW_VLAN_CTAG_TX_BIT);
enic->loop_enable = 1;
enic->loop_tag = enic->config.loop_tag;
dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag);
@@ -5077,7 +5077,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;
+ netdev_feature_del(NETIF_F_TSO6_BIT, features);
/* Lancer cannot handle the packet with MSS less than 256.
* Also it can't handle a TSO packet with a single segment
@@ -1942,11 +1942,11 @@ static int ftgmac100_probe(struct platform_device *pdev)
/* AST2400 doesn't have working HW checksum generation */
if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac")))
- netdev->hw_features &= ~NETIF_F_HW_CSUM;
+ netdev_hw_feature_del(netdev, NETIF_F_HW_CSUM_BIT);
/* AST2600 tx checksum with NCSI is broken */
if (priv->use_ncsi && of_device_is_compatible(np, "aspeed,ast2600-mac"))
- netdev->hw_features &= ~NETIF_F_HW_CSUM;
+ netdev_hw_feature_del(netdev, NETIF_F_HW_CSUM_BIT);
if (np && of_get_property(np, "no-hw-checksum", NULL))
netdev_hw_features_clear_set(netdev, NETIF_F_HW_CSUM_BIT,
@@ -3348,7 +3348,7 @@ static void hns3_set_default_feature(struct net_device *netdev)
netdev_hw_features_set(netdev, netdev->features);
if (!test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps))
- netdev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_hw_feature_del(netdev, NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
netdev_features_zero(vlan_off_features);
netdev_features_set_set(vlan_off_features,
@@ -872,7 +872,7 @@ static netdev_features_t hinic_fix_features(struct net_device *netdev,
/* If Rx checksum is disabled, then LRO should also be disabled */
if (!(features & NETIF_F_RXCSUM)) {
netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
return features;
@@ -794,7 +794,8 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data)
set_attr, clr_attr, &ret_attr);
if (data == 1)
- dev->features &= ~NETIF_F_IP_CSUM;
+ netdev_active_feature_del(dev,
+ NETIF_F_IP_CSUM_BIT);
} else {
adapter->fw_ipv4_csum_support = data;
@@ -812,7 +813,8 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data)
set_attr6, clr_attr6, &ret_attr);
if (data == 1)
- dev->features &= ~NETIF_F_IPV6_CSUM;
+ netdev_active_feature_del(dev,
+ NETIF_F_IPV6_CSUM_BIT);
} else
adapter->fw_ipv6_csum_support = data;
@@ -884,7 +886,7 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data)
* support tcp6/ipv6
*/
if (data == 1) {
- dev->features &= ~NETIF_F_TSO6;
+ netdev_active_feature_del(dev, NETIF_F_TSO6_BIT);
netdev_info(dev, "TSO feature requires all partitions to have updated driver");
}
adapter->large_send = data;
@@ -908,7 +910,7 @@ static int ibmveth_set_features(struct net_device *dev,
rc1 = ibmveth_set_csum_offload(dev, rx_csum);
if (rc1 && !adapter->rx_csum) {
dev->features = features & ~NETIF_F_CSUM_MASK;
- dev->features &= ~NETIF_F_RXCSUM;
+ netdev_active_feature_del(dev, NETIF_F_RXCSUM_BIT);
}
}
@@ -796,7 +796,7 @@ static netdev_features_t e1000_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -7297,7 +7297,7 @@ static netdev_features_t e1000_fix_features(struct net_device *netdev,
/* Jumbo frame workaround on 82579 and newer requires CRC be stripped */
if ((hw->mac.type >= e1000_pch2lan) && (netdev->mtu > ETH_DATA_LEN))
- features &= ~NETIF_F_RXFCS;
+ netdev_feature_del(NETIF_F_RXFCS_BIT, features);
/* Since there is no support for separate Rx/Tx vlan accel
* enable/disable make sure Tx flag is always in same state as Rx.
@@ -7305,7 +7305,7 @@ static netdev_features_t e1000_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -772,7 +772,7 @@ static int fm10k_tso(struct fm10k_ring *tx_ring,
return 1;
err_vxlan:
- tx_ring->netdev->features &= ~NETIF_F_GSO_UDP_TUNNEL;
+ netdev_active_feature_del(tx_ring->netdev, NETIF_F_GSO_UDP_TUNNEL_BIT);
if (net_ratelimit())
netdev_err(tx_ring->netdev,
"TSO requested for unsupported tunnel, disabling offload\n");
@@ -306,7 +306,8 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface)
}
if (hw->mac.vlan_override)
- netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_active_feature_del(netdev,
+ NETIF_F_HW_VLAN_CTAG_RX_BIT);
else
netdev_active_feature_add(netdev,
NETIF_F_HW_VLAN_CTAG_RX_BIT);
@@ -13702,7 +13702,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
netdev_active_feature_add(netdev, NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
netdev_hw_enc_feature_add(netdev, NETIF_F_TSO_MANGLEID_BIT);
- netdev->features &= ~NETIF_F_HW_TC;
+ netdev_active_feature_del(netdev, NETIF_F_HW_TC_BIT);
if (vsi->type == I40E_VSI_MAIN) {
SET_NETDEV_DEV(netdev, &pf->pdev->dev);
@@ -4641,31 +4641,37 @@ iavf_fix_netdev_vlan_features(struct iavf_adapter *adapter,
if (!IAVF_NETDEV_VLAN_FEATURE_ALLOWED(requested_features,
allowed_features,
NETIF_F_HW_VLAN_CTAG_TX_BIT))
- requested_features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT,
+ requested_features);
if (!IAVF_NETDEV_VLAN_FEATURE_ALLOWED(requested_features,
allowed_features,
NETIF_F_HW_VLAN_CTAG_RX_BIT))
- requested_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_RX_BIT,
+ requested_features);
if (!IAVF_NETDEV_VLAN_FEATURE_ALLOWED(requested_features,
allowed_features,
NETIF_F_HW_VLAN_STAG_TX_BIT))
- requested_features &= ~NETIF_F_HW_VLAN_STAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_STAG_TX_BIT,
+ requested_features);
if (!IAVF_NETDEV_VLAN_FEATURE_ALLOWED(requested_features,
allowed_features,
NETIF_F_HW_VLAN_STAG_RX_BIT))
- requested_features &= ~NETIF_F_HW_VLAN_STAG_RX;
+ netdev_feature_del(NETIF_F_HW_VLAN_STAG_RX_BIT,
+ requested_features);
if (!IAVF_NETDEV_VLAN_FEATURE_ALLOWED(requested_features,
allowed_features,
NETIF_F_HW_VLAN_CTAG_FILTER_BIT))
- requested_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
+ requested_features);
if (!IAVF_NETDEV_VLAN_FEATURE_ALLOWED(requested_features,
allowed_features,
NETIF_F_HW_VLAN_STAG_FILTER_BIT))
- requested_features &= ~NETIF_F_HW_VLAN_STAG_FILTER;
+ netdev_feature_del(NETIF_F_HW_VLAN_STAG_FILTER_BIT,
+ requested_features);
if ((requested_features & netdev_ctag_vlan_offload_features) &&
(requested_features & netdev_stag_vlan_offload_features) &&
@@ -4820,16 +4826,16 @@ int iavf_process_config(struct iavf_adapter *adapter)
if (netdev->wanted_features) {
if (!(netdev->wanted_features & NETIF_F_TSO) ||
netdev->mtu < 576)
- netdev->features &= ~NETIF_F_TSO;
+ netdev_active_feature_del(netdev, NETIF_F_TSO_BIT);
if (!(netdev->wanted_features & NETIF_F_TSO6) ||
netdev->mtu < 576)
- netdev->features &= ~NETIF_F_TSO6;
+ netdev_active_feature_del(netdev, NETIF_F_TSO6_BIT);
if (!(netdev->wanted_features & NETIF_F_TSO_ECN))
- netdev->features &= ~NETIF_F_TSO_ECN;
+ netdev_active_feature_del(netdev, NETIF_F_TSO_ECN_BIT);
if (!(netdev->wanted_features & NETIF_F_GRO))
- netdev->features &= ~NETIF_F_GRO;
+ netdev_active_feature_del(netdev, NETIF_F_GRO_BIT);
if (!(netdev->wanted_features & NETIF_F_GSO))
- netdev->features &= ~NETIF_F_GSO;
+ netdev_active_feature_del(netdev, NETIF_F_GSO_BIT);
}
return 0;
@@ -1880,7 +1880,7 @@ static void iavf_netdev_features_vlan_strip_set(struct net_device *netdev,
if (enable)
netdev_active_feature_add(netdev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
else
- netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_active_feature_del(netdev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
}
/**
@@ -2441,7 +2441,7 @@ static netdev_features_t igb_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -2538,7 +2538,7 @@ igb_features_check(struct sk_buff *skb, struct net_device *dev,
* inner IP ID field, so strip TSO if MANGLEID is not supported.
*/
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
return features;
}
@@ -2651,7 +2651,7 @@ igbvf_features_check(struct sk_buff *skb, struct net_device *dev,
* inner IP ID field, so strip TSO if MANGLEID is not supported.
*/
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
return features;
}
@@ -4981,7 +4981,7 @@ static netdev_features_t igc_fix_features(struct net_device *netdev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -5044,7 +5044,7 @@ igc_features_check(struct sk_buff *skb, struct net_device *dev,
* inner IP ID field, so strip TSO if MANGLEID is not supported.
*/
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
return features;
}
@@ -302,7 +302,7 @@ ixgb_fix_features(struct net_device *netdev, netdev_features_t features)
* disabled.
*/
if (!(features & NETIF_F_HW_VLAN_CTAG_RX))
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return features;
}
@@ -899,7 +899,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
/* disable FCoE and notify stack */
adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
- netdev->features &= ~NETIF_F_FCOE_MTU;
+ netdev_active_feature_del(netdev, NETIF_F_FCOE_MTU_BIT);
netdev_features_change(netdev);
@@ -4922,7 +4922,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
hw->addr_ctrl.user_set_promisc = true;
fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
vmolr |= IXGBE_VMOLR_MPE;
- features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features);
} else {
if (netdev->flags & IFF_ALLMULTI) {
fctrl |= IXGBE_FCTRL_MPE;
@@ -9837,15 +9837,15 @@ static netdev_features_t ixgbe_fix_features(struct net_device *netdev,
/* If Rx checksum is disabled, then RSC/LRO should also be disabled */
if (!(features & NETIF_F_RXCSUM))
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
/* Turn off LRO if not RSC capable */
if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE))
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
if (adapter->xdp_prog && (features & NETIF_F_LRO)) {
e_dev_err("LRO is not supported with XDP\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
return features;
@@ -10254,7 +10254,7 @@ ixgbe_features_check(struct sk_buff *skb, struct net_device *dev,
#ifdef CONFIG_IXGBE_IPSEC
if (!secpath_exists(skb))
#endif
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
}
return features;
@@ -4432,7 +4432,7 @@ ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev,
* inner IP ID field, so strip TSO if MANGLEID is not supported.
*/
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
return features;
}
@@ -6,6 +6,7 @@
*/
#include <linux/interrupt.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/pci.h>
#include <net/tso.h>
@@ -496,7 +497,7 @@ void otx2_setup_segmentation(struct otx2_nic *pfvf)
mutex_unlock(&pfvf->mbox.lock);
netdev_info(pfvf->netdev,
"Failed to get LSO index for UDP GSO offload, disabling\n");
- pfvf->netdev->hw_features &= ~NETIF_F_GSO_UDP_L4;
+ netdev_hw_feature_del(pfvf->netdev, NETIF_F_GSO_UDP_L4_BIT);
}
void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx)
@@ -1911,7 +1911,7 @@ static netdev_features_t otx2_fix_features(struct net_device *dev,
if (features & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_add(NETIF_F_HW_VLAN_STAG_RX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_STAG_RX;
+ netdev_feature_del(NETIF_F_HW_VLAN_STAG_RX_BIT, features);
return features;
}
@@ -2681,7 +2681,7 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status)
* It will be reenabled on next ndo_set_features, but if it's
* really broken, will get disabled again
*/
- sky2->netdev->features &= ~NETIF_F_RXCSUM;
+ netdev_active_feature_del(sky2->netdev, NETIF_F_RXCSUM_BIT);
sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR),
BMU_DIS_RX_CHKSUM);
}
@@ -4316,8 +4316,8 @@ static netdev_features_t sky2_fix_features(struct net_device *dev,
*/
if (dev->mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_EC_U) {
netdev_info(dev, "checksum offload not possible with jumbo frames\n");
- features &= ~NETIF_F_TSO;
- features &= ~NETIF_F_SG;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
+ netdev_feature_del(NETIF_F_SG_BIT, features);
features &= ~NETIF_F_CSUM_MASK;
}
@@ -2510,7 +2510,7 @@ static netdev_features_t mlx4_en_fix_features(struct net_device *netdev,
!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN))
netdev_feature_add(NETIF_F_HW_VLAN_STAG_RX_BIT, features);
else
- features &= ~NETIF_F_HW_VLAN_STAG_RX;
+ netdev_feature_del(NETIF_F_HW_VLAN_STAG_RX_BIT, features);
return features;
}
@@ -3547,7 +3547,8 @@ int mlx4_en_reset_config(struct net_device *dev,
netdev_active_feature_add(dev,
NETIF_F_HW_VLAN_CTAG_RX_BIT);
else
- dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_active_feature_del(dev,
+ NETIF_F_HW_VLAN_CTAG_RX_BIT);
} else if (ts_config.rx_filter == HWTSTAMP_FILTER_NONE) {
/* RX time-stamping is OFF, update the RX vlan offload
* to the latest wanted state
@@ -3556,14 +3557,15 @@ int mlx4_en_reset_config(struct net_device *dev,
netdev_active_feature_add(dev,
NETIF_F_HW_VLAN_CTAG_RX_BIT);
else
- dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_active_feature_del(dev,
+ NETIF_F_HW_VLAN_CTAG_RX_BIT);
}
if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS_BIT)) {
if (features & NETIF_F_RXFCS)
netdev_active_feature_add(dev, NETIF_F_RXFCS_BIT);
else
- dev->features &= ~NETIF_F_RXFCS;
+ netdev_active_feature_del(dev, NETIF_F_RXFCS_BIT);
}
/* RX vlan offload and RX time-stamping can't co-exist !
@@ -3573,7 +3575,7 @@ int mlx4_en_reset_config(struct net_device *dev,
if (ts_config.rx_filter != HWTSTAMP_FILTER_NONE) {
if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
en_warn(priv, "Turning off RX vlan offload since RX time-stamping is ON\n");
- dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_active_feature_del(dev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
}
if (port_up) {
@@ -1311,7 +1311,7 @@ int mlx5e_create_flow_steering(struct mlx5e_flow_steering *fs,
!!(netdev->hw_features & NETIF_F_NTUPLE));
if (err) {
fs_err(fs, "Failed to create arfs tables, err=%d\n", err);
- netdev->hw_features &= ~NETIF_F_NTUPLE;
+ netdev_hw_feature_del(netdev, NETIF_F_NTUPLE_BIT);
}
err = mlx5e_create_inner_ttc_table(fs, rx_res);
@@ -3894,19 +3894,19 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features)
static netdev_features_t mlx5e_fix_uplink_rep_features(struct net_device *netdev,
netdev_features_t features)
{
- features &= ~NETIF_F_HW_TLS_RX;
+ netdev_feature_del(NETIF_F_HW_TLS_RX_BIT, features);
if (netdev->features & NETIF_F_HW_TLS_RX)
netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n");
- features &= ~NETIF_F_HW_TLS_TX;
+ netdev_feature_del(NETIF_F_HW_TLS_TX_BIT, features);
if (netdev->features & NETIF_F_HW_TLS_TX)
netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n");
- features &= ~NETIF_F_NTUPLE;
+ netdev_feature_del(NETIF_F_NTUPLE_BIT, features);
if (netdev->features & NETIF_F_NTUPLE)
netdev_warn(netdev, "Disabling ntuple, not supported in switchdev mode\n");
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
if (netdev->features & NETIF_F_GRO_HW)
netdev_warn(netdev, "Disabling HW_GRO, not supported in switchdev mode\n");
@@ -3928,7 +3928,7 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
/* HW strips the outer C-tag header, this is a problem
* for S-tag traffic.
*/
- features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_RX_BIT, features);
if (!params->vlan_strip_disable)
netdev_warn(netdev, "Dropping C-tag vlan stripping offload due to S-tag vlan\n");
}
@@ -3936,22 +3936,22 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
if (!MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_STRIDING_RQ)) {
if (features & NETIF_F_LRO) {
netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
if (features & NETIF_F_GRO_HW) {
netdev_warn(netdev, "Disabling HW-GRO, not supported in legacy RQ\n");
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
}
}
if (params->xdp_prog) {
if (features & NETIF_F_LRO) {
netdev_warn(netdev, "LRO is incompatible with XDP\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
if (features & NETIF_F_GRO_HW) {
netdev_warn(netdev, "HW GRO is incompatible with XDP\n");
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
}
}
@@ -3959,23 +3959,23 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
if (features & NETIF_F_LRO) {
netdev_warn(netdev, "LRO is incompatible with AF_XDP (%u XSKs are active)\n",
priv->xsk.refcnt);
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
if (features & NETIF_F_GRO_HW) {
netdev_warn(netdev, "HW GRO is incompatible with AF_XDP (%u XSKs are active)\n",
priv->xsk.refcnt);
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
}
}
if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) {
- features &= ~NETIF_F_RXHASH;
+ netdev_feature_del(NETIF_F_RXHASH_BIT, features);
if (netdev->features & NETIF_F_RXHASH)
netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n");
if (features & NETIF_F_GRO_HW) {
netdev_warn(netdev, "Disabling HW-GRO, not supported when CQE compress is active\n");
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
}
}
@@ -4972,10 +4972,10 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
/* Defaults */
if (fcs_enabled)
- netdev->features &= ~NETIF_F_RXALL;
- netdev->features &= ~NETIF_F_LRO;
- netdev->features &= ~NETIF_F_GRO_HW;
- netdev->features &= ~NETIF_F_RXFCS;
+ netdev_active_feature_del(netdev, NETIF_F_RXALL_BIT);
+ netdev_active_feature_del(netdev, NETIF_F_LRO_BIT);
+ netdev_active_feature_del(netdev, NETIF_F_GRO_HW_BIT);
+ netdev_active_feature_del(netdev, NETIF_F_RXFCS_BIT);
#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f)
if (FT_CAP(flow_modify_en) &&
@@ -335,7 +335,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
if (err) {
netdev_err(priv->netdev, "Failed to create arfs tables, err=%d\n",
err);
- priv->netdev->hw_features &= ~NETIF_F_NTUPLE;
+ netdev_hw_feature_del(priv->netdev, NETIF_F_NTUPLE_BIT);
}
err = mlx5e_create_ttc_table(priv->fs, priv->rx_res);
@@ -2897,7 +2897,7 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,
struct myri10ge_slice_state *ss;
netdev_tx_t status;
- features &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT, features);
segs = skb_gso_segment(skb, features);
if (IS_ERR(segs))
goto drop;
@@ -3874,9 +3874,9 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_vlan_features_set(netdev, mgp->features);
if (mgp->fw_ver_tiny < 37)
- netdev->vlan_features &= ~NETIF_F_TSO6;
+ netdev_vlan_feature_del(netdev, NETIF_F_TSO6_BIT);
if (mgp->fw_ver_tiny < 32)
- netdev->vlan_features &= ~NETIF_F_TSO;
+ netdev_vlan_feature_del(netdev, NETIF_F_TSO_BIT);
/* make sure we can get an irq, and that MSI can be
* setup (if available). */
@@ -1762,13 +1762,17 @@ nfp_net_fix_features(struct net_device *netdev,
if ((features & NETIF_F_HW_VLAN_CTAG_RX) &&
(features & NETIF_F_HW_VLAN_STAG_RX)) {
if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
- features &= ~NETIF_F_HW_VLAN_CTAG_RX;
- netdev->wanted_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_RX_BIT,
+ features);
+ netdev_wanted_feature_del(netdev,
+ NETIF_F_HW_VLAN_CTAG_RX_BIT);
netdev_warn(netdev,
"S-tag and C-tag stripping can't be enabled at the same time. Enabling S-tag stripping and disabling C-tag stripping\n");
} else if (netdev->features & NETIF_F_HW_VLAN_STAG_RX) {
- features &= ~NETIF_F_HW_VLAN_STAG_RX;
- netdev->wanted_features &= ~NETIF_F_HW_VLAN_STAG_RX;
+ netdev_feature_del(NETIF_F_HW_VLAN_STAG_RX_BIT,
+ features);
+ netdev_wanted_feature_del(netdev,
+ NETIF_F_HW_VLAN_STAG_RX_BIT);
netdev_warn(netdev,
"S-tag and C-tag stripping can't be enabled at the same time. Enabling C-tag stripping and disabling S-tag stripping\n");
}
@@ -2432,7 +2436,7 @@ static void nfp_net_netdev_init(struct nfp_net *nn)
/* C-Tag strip and S-Tag strip can't be supported simultaneously,
* so enable C-Tag strip and disable S-Tag strip by default.
*/
- netdev->features &= ~NETIF_F_HW_VLAN_STAG_RX;
+ netdev_active_feature_del(netdev, NETIF_F_HW_VLAN_STAG_RX_BIT);
nn->dp.ctrl &= ~NFP_NET_CFG_CTRL_RXQINQ;
/* Finalise the netdev setup */
@@ -391,7 +391,7 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
/* C-Tag strip and S-Tag strip can't be supported simultaneously,
* so enable C-Tag strip and disable S-Tag strip by default.
*/
- netdev->features &= ~NETIF_F_HW_VLAN_STAG_RX;
+ netdev_active_feature_del(netdev, NETIF_F_HW_VLAN_STAG_RX_BIT);
netif_set_tso_max_segs(netdev, NFP_NET_LSO_MAX_SEGS);
netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL;
@@ -477,7 +477,7 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
val = XsumRX;
pch_gbe_validate_option(&val, &opt, adapter);
if (!val)
- dev->features &= ~NETIF_F_RXCSUM;
+ netdev_active_feature_del(dev, NETIF_F_RXCSUM_BIT);
}
{ /* Checksum Offload Enable/Disable */
static const struct pch_gbe_option opt = {
@@ -526,7 +526,7 @@ static netdev_features_t netxen_fix_features(struct net_device *dev,
if (!(features & NETIF_F_RXCSUM)) {
netdev_info(dev, "disabling LRO as RXCSUM is off\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
return features;
@@ -7,6 +7,7 @@
#include <linux/version.h>
#include <linux/types.h>
#include <linux/netdevice.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/string.h>
@@ -1044,7 +1045,7 @@ int qede_change_mtu(struct net_device *ndev, int new_mtu)
"Configuring MTU size of %d\n", new_mtu);
if (new_mtu > PAGE_SIZE)
- ndev->features &= ~NETIF_F_GRO_HW;
+ netdev_active_feature_del(ndev, NETIF_F_GRO_HW_BIT);
/* Set the mtu field and re-start the interface if needed */
args.u.mtu = new_mtu;
@@ -917,7 +917,7 @@ netdev_features_t qede_fix_features(struct net_device *dev,
if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE ||
!(features & NETIF_F_GRO))
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
return features;
}
@@ -1567,7 +1567,7 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq)
rxq->rx_buf_seg_size = roundup_pow_of_two(size);
} else {
rxq->rx_buf_seg_size = PAGE_SIZE;
- edev->ndev->features &= ~NETIF_F_GRO_HW;
+ netdev_active_feature_del(edev->ndev, NETIF_F_GRO_HW_BIT);
}
/* Allocate the parallel driver ring for Rx buffers */
@@ -2456,7 +2456,7 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
goto err2;
if (qede_alloc_arfs(edev)) {
- edev->ndev->features &= ~NETIF_F_NTUPLE;
+ netdev_active_feature_del(edev->ndev, NETIF_F_NTUPLE_BIT);
edev->dev_info.common.b_arfs_capable = false;
}
@@ -1033,12 +1033,13 @@ static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter,
adapter->rx_csum = 1;
if (QLCNIC_IS_TSO_CAPABLE(adapter)) {
if (!(offload_flags & BIT_1))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
else
netdev_feature_add(NETIF_F_TSO_BIT, features);
if (!(offload_flags & BIT_2))
- features &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT,
+ features);
else
netdev_feature_add(NETIF_F_TSO6_BIT,
features);
@@ -1082,7 +1083,7 @@ netdev_features_t qlcnic_fix_features(struct net_device *netdev,
}
if (!(features & NETIF_F_RXCSUM))
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
return features;
}
@@ -1862,7 +1862,7 @@ static netdev_features_t cp_features_check(struct sk_buff *skb,
netdev_features_t features)
{
if (skb_shinfo(skb)->gso_size > MSSMask)
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
return vlan_features_check(skb, features);
}
@@ -5257,7 +5257,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
*/
if (tp->mac_version == RTL_GIGA_MAC_VER_05)
/* Disallow toggling */
- dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
+ netdev_hw_feature_del(dev, NETIF_F_HW_VLAN_CTAG_RX_BIT);
if (rtl_chip_supports_csum_v2(tp))
netdev_hw_feature_add(dev, NETIF_F_IPV6_CSUM_BIT);
@@ -246,7 +246,8 @@ static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx)
netdev_feature_add(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
efx->fixed_features);
else
- efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
+ efx->fixed_features);
return 0;
@@ -1021,13 +1021,13 @@ static int efx_pci_probe_post_io(struct efx_nic *efx)
netdev_hw_features_set(net_dev, tmp);
/* Disable receiving frames with bad FCS, by default. */
- net_dev->features &= ~NETIF_F_RXALL;
+ netdev_active_feature_del(net_dev, NETIF_F_RXALL_BIT);
/* Disable VLAN filtering by default. It may be enforced if
* the feature is fixed (i.e. VLAN filters are required to
* receive VLAN tagged packets due to vPort restrictions).
*/
- net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_active_feature_del(net_dev, NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
netdev_active_features_set(net_dev, efx->fixed_features);
rc = efx_register_netdev(efx);
@@ -2914,7 +2914,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev,
* the feature is fixed (i.e. VLAN filters are required to
* receive VLAN tagged packets due to vPort restrictions).
*/
- net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_active_feature_del(net_dev, NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
netdev_active_features_set(net_dev, efx->fixed_features);
rc = ef4_register_netdev(efx);
@@ -1330,9 +1330,12 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
(EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_LOC_MAC_IG)))) {
netif_info(efx, probe, net_dev,
"VLAN filters are not supported in this firmware variant\n");
- net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
- efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
- net_dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_active_feature_del(net_dev,
+ NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
+ efx->fixed_features);
+ netdev_hw_feature_del(net_dev,
+ NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
}
table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS,
@@ -1004,13 +1004,13 @@ static int efx_pci_probe_post_io(struct efx_nic *efx)
netdev_hw_features_set(net_dev, tmp);
/* Disable receiving frames with bad FCS, by default. */
- net_dev->features &= ~NETIF_F_RXALL;
+ netdev_active_feature_del(net_dev, NETIF_F_RXALL_BIT);
/* Disable VLAN filtering by default. It may be enforced if
* the feature is fixed (i.e. VLAN filters are required to
* receive VLAN tagged packets due to vPort restrictions).
*/
- net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_active_feature_del(net_dev, NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
netdev_active_features_set(net_dev, efx->fixed_features);
rc = efx_register_netdev(efx);
@@ -5591,7 +5591,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
struct stmmac_priv *priv = netdev_priv(dev);
if (priv->plat->rx_coe == STMMAC_RX_COE_NONE)
- features &= ~NETIF_F_RXCSUM;
+ netdev_feature_del(NETIF_F_RXCSUM_BIT, features);
if (!priv->plat->tx_coe)
features &= ~NETIF_F_CSUM_MASK;
@@ -1275,7 +1275,7 @@ vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb,
skb_shinfo(skb)->gso_size = datalen;
skb_shinfo(skb)->gso_segs = gso_segs;
}
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
segs = skb_gso_segment(skb, features);
if (IS_ERR(segs))
goto out_dropped;
@@ -2017,7 +2017,7 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
/* Disable TX checksum offload by default due to HW bug */
if (common->pdata.quirks & AM65_CPSW_QUIRK_I2027_NO_TX_CSUM)
- port->ndev->features &= ~NETIF_F_HW_CSUM;
+ netdev_active_feature_del(port->ndev, NETIF_F_HW_CSUM_BIT);
ndev_priv->stats = netdev_alloc_pcpu_stats(struct am65_cpsw_ndev_stats);
if (!ndev_priv->stats)
@@ -1088,7 +1088,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev,
mask = features;
tmp = features;
- tmp &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, tmp);
lowerdev_features &= tmp;
features = netdev_increment_features(lowerdev_features, features, mask);
netdev_features_set(features, ALWAYS_ON_FEATURES);
@@ -9690,8 +9690,8 @@ static int rtl8152_probe(struct usb_interface *intf,
NETIF_F_IPV6_CSUM_BIT, NETIF_F_TSO6_BIT);
if (tp->version == RTL_VER_01) {
- netdev->features &= ~NETIF_F_RXCSUM;
- netdev->hw_features &= ~NETIF_F_RXCSUM;
+ netdev_active_feature_del(netdev, NETIF_F_RXCSUM_BIT);
+ netdev_hw_feature_del(netdev, NETIF_F_RXCSUM_BIT);
}
tp->lenovo_macpassthru = rtl8152_supports_lenovo_macpassthru(udev);
@@ -1171,7 +1171,7 @@ static void veth_disable_xdp(struct net_device *dev)
* enabled it, clear it now
*/
if (!veth_gro_requested(dev) && netif_running(dev)) {
- dev->features &= ~NETIF_F_GRO;
+ netdev_active_feature_del(dev, NETIF_F_GRO_BIT);
netdev_features_change(dev);
}
}
@@ -1681,8 +1681,8 @@ static struct rtnl_link_ops veth_link_ops;
static void veth_disable_gro(struct net_device *dev)
{
- dev->features &= ~NETIF_F_GRO;
- dev->wanted_features &= ~NETIF_F_GRO;
+ netdev_active_feature_del(dev, NETIF_F_GRO_BIT);
+ netdev_wanted_feature_del(dev, NETIF_F_GRO_BIT);
netdev_update_features(dev);
}
@@ -3369,13 +3369,17 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter)
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_CHECKSUM_OFFLOAD)) &&
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_GENEVE_TSO)) &&
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_TSO))) {
- netdev->hw_enc_features &= ~NETIF_F_GSO_UDP_TUNNEL;
- netdev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL;
+ netdev_hw_enc_feature_del(netdev,
+ NETIF_F_GSO_UDP_TUNNEL_BIT);
+ netdev_hw_feature_del(netdev,
+ NETIF_F_GSO_UDP_TUNNEL_BIT);
}
if (!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_GENEVE_OUTER_CHECKSUM_OFFLOAD)) &&
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_OUTER_CHECKSUM_OFFLOAD))) {
- netdev->hw_enc_features &= ~NETIF_F_GSO_UDP_TUNNEL_CSUM;
- netdev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL_CSUM;
+ netdev_hw_enc_feature_del(netdev,
+ NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT);
+ netdev_hw_feature_del(netdev,
+ NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT);
}
}
@@ -251,7 +251,7 @@ netdev_features_t vmxnet3_fix_features(struct net_device *netdev,
{
/* If Rx checksum is disabled, then LRO should also be disabled */
if (!(features & NETIF_F_RXCSUM))
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
return features;
}
@@ -356,11 +356,13 @@ static void vmxnet3_enable_encap_offloads(struct net_device *netdev, netdev_feat
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_CHECKSUM_OFFLOAD)) &&
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_GENEVE_TSO)) &&
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_TSO))) {
- netdev->hw_enc_features &= ~NETIF_F_GSO_UDP_TUNNEL;
+ netdev_hw_enc_feature_del(netdev,
+ NETIF_F_GSO_UDP_TUNNEL_BIT);
}
if (!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_GENEVE_OUTER_CHECKSUM_OFFLOAD)) &&
!(adapter->dev_caps[0] & (1UL << VMXNET3_CAP_VXLAN_OUTER_CHECKSUM_OFFLOAD))) {
- netdev->hw_enc_features &= ~NETIF_F_GSO_UDP_TUNNEL_CSUM;
+ netdev_hw_enc_feature_del(netdev,
+ NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT);
}
}
}
@@ -1133,7 +1133,8 @@ static int ath6kl_set_features(struct net_device *dev,
vif->fw_vif_idx,
ar->rx_meta_ver, 0, 0);
if (err) {
- dev->features = features & ~NETIF_F_RXCSUM;
+ dev->features = features;
+ netdev_active_feature_del(dev, NETIF_F_RXCSUM_BIT);
return err;
}
} else if (!(features & NETIF_F_RXCSUM) &&
@@ -607,7 +607,7 @@ static int brcmf_netdev_open(struct net_device *ndev)
&& (toe_ol & TOE_TX_CSUM_OL) != 0)
netdev_active_feature_add(ndev, NETIF_F_IP_CSUM_BIT);
else
- ndev->features &= ~NETIF_F_IP_CSUM;
+ netdev_active_feature_del(ndev, NETIF_F_IP_CSUM_BIT);
if (brcmf_cfg80211_up(ndev)) {
bphy_err(drvr, "failed to bring up cfg80211\n");
@@ -366,15 +366,15 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev,
struct xenvif *vif = netdev_priv(dev);
if (!vif->can_sg)
- features &= ~NETIF_F_SG;
+ netdev_feature_del(NETIF_F_SG_BIT, features);
if (~(vif->gso_mask) & GSO_BIT(TCPV4))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
if (~(vif->gso_mask) & GSO_BIT(TCPV6))
- features &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT, features);
if (!vif->ip_csum)
- features &= ~NETIF_F_IP_CSUM;
+ netdev_feature_del(NETIF_F_IP_CSUM_BIT, features);
if (!vif->ipv6_csum)
- features &= ~NETIF_F_IPV6_CSUM;
+ netdev_feature_del(NETIF_F_IPV6_CSUM_BIT, features);
return features;
}
@@ -1476,20 +1476,20 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
if (features & NETIF_F_SG &&
!xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0))
- features &= ~NETIF_F_SG;
+ netdev_feature_del(NETIF_F_SG_BIT, features);
if (features & NETIF_F_IPV6_CSUM &&
!xenbus_read_unsigned(np->xbdev->otherend,
"feature-ipv6-csum-offload", 0))
- features &= ~NETIF_F_IPV6_CSUM;
+ netdev_feature_del(NETIF_F_IPV6_CSUM_BIT, features);
if (features & NETIF_F_TSO &&
!xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
if (features & NETIF_F_TSO6 &&
!xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0))
- features &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT, features);
return features;
}
@@ -6751,7 +6751,8 @@ void qeth_enable_hw_features(struct net_device *dev)
dev->features &= ~dev->hw_features;
/* toggle VLAN filter, so that VIDs are re-programmed: */
if (IS_LAYER2(card) && IS_VM_NIC(card)) {
- dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_active_feature_del(dev,
+ NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
netdev_wanted_feature_add(dev,
NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
}
@@ -6845,16 +6846,16 @@ netdev_features_t qeth_fix_features(struct net_device *dev,
QETH_CARD_TEXT(card, 2, "fixfeat");
if (!qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM))
- features &= ~NETIF_F_IP_CSUM;
+ netdev_feature_del(NETIF_F_IP_CSUM_BIT, features);
if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6))
- features &= ~NETIF_F_IPV6_CSUM;
+ netdev_feature_del(NETIF_F_IPV6_CSUM_BIT, features);
if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM) &&
!qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6))
- features &= ~NETIF_F_RXCSUM;
+ netdev_feature_del(NETIF_F_RXCSUM_BIT, features);
if (!qeth_is_supported(card, IPA_OUTBOUND_TSO))
- features &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO))
- features &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT, features);
QETH_CARD_HEX(card, 2, &features, sizeof(features));
return features;
@@ -6913,7 +6914,7 @@ 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;
+ netdev_feature_del(NETIF_F_SG_BIT, features);
}
return vlan_features_check(skb, features);
@@ -1809,7 +1809,7 @@ static netdev_features_t qeth_l3_osa_features_check(struct sk_buff *skb,
netdev_features_t features)
{
if (vlan_get_protocol(skb) != htons(ETH_P_IP))
- features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev_feature_del(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
return qeth_features_check(skb, dev, features);
}
@@ -1585,7 +1585,7 @@ void dev_disable_lro(struct net_device *dev)
struct net_device *lower_dev;
struct list_head *iter;
- dev->wanted_features &= ~NETIF_F_LRO;
+ netdev_wanted_feature_del(dev, NETIF_F_LRO_BIT);
netdev_update_features(dev);
if (unlikely(dev->features & NETIF_F_LRO))
@@ -1606,7 +1606,7 @@ EXPORT_SYMBOL(dev_disable_lro);
*/
static void dev_disable_gro_hw(struct net_device *dev)
{
- dev->wanted_features &= ~NETIF_F_GRO_HW;
+ netdev_wanted_feature_del(dev, NETIF_F_GRO_HW_BIT);
netdev_update_features(dev);
if (unlikely(dev->features & NETIF_F_GRO_HW))
@@ -3401,7 +3401,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
netdev_feature_add(NETIF_F_GSO_ROBUST_BIT, partial_features);
netdev_features_set(partial_features, features);
if (!skb_gso_ok(skb, partial_features))
- features &= ~NETIF_F_GSO_PARTIAL;
+ netdev_feature_del(NETIF_F_GSO_PARTIAL_BIT, features);
}
BUILD_BUG_ON(SKB_GSO_CB_OFFSET +
@@ -3491,7 +3491,7 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
features &= ~netdev_csum_gso_features_mask;
}
if (illegal_highdma(skb->dev, skb))
- features &= ~NETIF_F_SG;
+ netdev_feature_del(NETIF_F_SG_BIT, features);
return features;
}
@@ -3542,7 +3542,8 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,
inner_ip_hdr(skb) : ip_hdr(skb);
if (!(iph->frag_off & htons(IP_DF)))
- features &= ~NETIF_F_TSO_MANGLEID;
+ netdev_feature_del(NETIF_F_TSO_MANGLEID_BIT,
+ features);
}
return features;
@@ -9623,30 +9624,30 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
if ((features & NETIF_F_TSO) && !(features & NETIF_F_HW_CSUM) &&
!(features & NETIF_F_IP_CSUM)) {
netdev_dbg(dev, "Dropping TSO features since no CSUM feature.\n");
- features &= ~NETIF_F_TSO;
- features &= ~NETIF_F_TSO_ECN;
+ netdev_feature_del(NETIF_F_TSO_BIT, features);
+ netdev_feature_del(NETIF_F_TSO_ECN_BIT, features);
}
if ((features & NETIF_F_TSO6) && !(features & NETIF_F_HW_CSUM) &&
!(features & NETIF_F_IPV6_CSUM)) {
netdev_dbg(dev, "Dropping TSO6 features since no CSUM feature.\n");
- features &= ~NETIF_F_TSO6;
+ netdev_feature_del(NETIF_F_TSO6_BIT, features);
}
/* TSO with IPv4 ID mangling requires IPv4 TSO be enabled */
if ((features & NETIF_F_TSO_MANGLEID) && !(features & NETIF_F_TSO))
- features &= ~NETIF_F_TSO_MANGLEID;
+ netdev_feature_del(NETIF_F_TSO_MANGLEID_BIT, features);
/* TSO ECN requires that TSO is present as well. */
tmp = NETIF_F_ALL_TSO;
- tmp &= ~NETIF_F_TSO_ECN;
+ netdev_feature_del(NETIF_F_TSO_ECN_BIT, tmp);
if (!(features & tmp) && (features & NETIF_F_TSO_ECN))
- features &= ~NETIF_F_TSO_ECN;
+ netdev_feature_del(NETIF_F_TSO_ECN_BIT, features);
/* Software GSO depends on SG. */
if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) {
netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n");
- features &= ~NETIF_F_GSO;
+ netdev_feature_del(NETIF_F_GSO_BIT, features);
}
/* GSO partial features require GSO partial be set */
@@ -9665,7 +9666,7 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
*/
if (features & NETIF_F_GRO_HW) {
netdev_dbg(dev, "Dropping NETIF_F_GRO_HW since no RXCSUM feature.\n");
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
}
}
@@ -9673,18 +9674,18 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
if (features & NETIF_F_RXFCS) {
if (features & NETIF_F_LRO) {
netdev_dbg(dev, "Dropping LRO feature since RX-FCS is requested.\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
if (features & NETIF_F_GRO_HW) {
netdev_dbg(dev, "Dropping HW-GRO feature since RX-FCS is requested.\n");
- features &= ~NETIF_F_GRO_HW;
+ netdev_feature_del(NETIF_F_GRO_HW_BIT, features);
}
}
if ((features & NETIF_F_GRO_HW) && (features & NETIF_F_LRO)) {
netdev_dbg(dev, "Dropping LRO feature since HW-GRO is requested.\n");
- features &= ~NETIF_F_LRO;
+ netdev_feature_del(NETIF_F_LRO_BIT, features);
}
if (features & NETIF_F_HW_TLS_TX) {
@@ -9694,13 +9695,13 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
if (!ip_csum && !hw_csum) {
netdev_dbg(dev, "Dropping TLS TX HW offload feature since no CSUM feature.\n");
- features &= ~NETIF_F_HW_TLS_TX;
+ netdev_feature_del(NETIF_F_HW_TLS_TX_BIT, features);
}
}
if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) {
netdev_dbg(dev, "Dropping TLS RX HW offload feature since no RXCSUM feature.\n");
- features &= ~NETIF_F_HW_TLS_RX;
+ netdev_feature_del(NETIF_F_HW_TLS_RX_BIT, features);
}
return features;
@@ -11169,7 +11170,7 @@ netdev_features_t netdev_increment_features(netdev_features_t all,
/* If one device supports hw checksumming, set for all. */
if (all & NETIF_F_HW_CSUM) {
tmp = NETIF_F_CSUM_MASK;
- tmp &= ~NETIF_F_HW_CSUM;
+ netdev_feature_del(NETIF_F_HW_CSUM_BIT, tmp);
all &= ~tmp;
}
@@ -46,6 +46,7 @@
#include <linux/udp.h>
#include <linux/sctp.h>
#include <linux/netdevice.h>
+#include <linux/netdev_feature_helpers.h>
#ifdef CONFIG_NET_CLS_ACT
#include <net/pkt_sched.h>
#endif
@@ -4048,7 +4049,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
* skbs; we do so by disabling SG.
*/
if (mss != GSO_BY_FRAGS && mss != skb_headlen(head_skb))
- features &= ~NETIF_F_SG;
+ netdev_feature_del(NETIF_F_SG_BIT, features);
}
__skb_push(head_skb, doffset);
@@ -9,6 +9,7 @@
*/
#include <linux/module.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/random.h>
#include <linux/slab.h>
#include <linux/xfrm.h>
@@ -490,8 +491,8 @@ static struct sock *dccp_v6_request_recv_sock(const struct sock *sk,
ip6_dst_store(newsk, dst, NULL, NULL);
newsk->sk_route_caps = dst->dev->features;
- newsk->sk_route_caps &= ~NETIF_F_IP_CSUM;
- newsk->sk_route_caps &= ~NETIF_F_TSO;
+ netdev_feature_del(NETIF_F_IP_CSUM_BIT, newsk->sk_route_caps);
+ netdev_feature_del(NETIF_F_TSO_BIT, newsk->sk_route_caps);
newdp6 = (struct dccp6_sock *)newsk;
newinet = inet_sk(newsk);
newinet->pinet6 = &newdp6->inet6;
@@ -1678,7 +1678,8 @@ int dsa_slave_manage_vlan_filtering(struct net_device *slave,
err = vlan_for_each(slave, dsa_slave_restore_vlan, slave);
if (err) {
vlan_for_each(slave, dsa_slave_clear_vlan, slave);
- slave->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_active_feature_del(slave,
+ NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
return err;
}
} else {
@@ -1686,7 +1687,8 @@ int dsa_slave_manage_vlan_filtering(struct net_device *slave,
if (err)
return err;
- slave->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
+ netdev_active_feature_del(slave,
+ NETIF_F_HW_VLAN_CTAG_FILTER_BIT);
}
return 0;
@@ -205,7 +205,8 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
list_for_each_entry(wpan_dev, &rdev->wpan_dev_list, list) {
if (!wpan_dev->netdev)
continue;
- wpan_dev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+ netdev_active_feature_del(wpan_dev->netdev,
+ NETIF_F_NETNS_LOCAL_BIT);
err = dev_change_net_namespace(wpan_dev->netdev, net, "wpan%d");
if (err)
break;
@@ -222,7 +223,8 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
list) {
if (!wpan_dev->netdev)
continue;
- wpan_dev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+ netdev_active_feature_del(wpan_dev->netdev,
+ NETIF_F_NETNS_LOCAL_BIT);
err = dev_change_net_namespace(wpan_dev->netdev, net,
"wpan%d");
WARN_ON(err);
@@ -220,12 +220,12 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) &&
!(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev) {
esp_features = features & ~NETIF_F_CSUM_MASK;
- esp_features &= ~NETIF_F_SG;
- esp_features &= ~NETIF_F_SCTP_CRC;
+ netdev_feature_del(NETIF_F_SG_BIT, esp_features);
+ netdev_feature_del(NETIF_F_SCTP_CRC_BIT, esp_features);
} else if (!(features & NETIF_F_HW_ESP_TX_CSUM) &&
!(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM)) {
esp_features = features & ~NETIF_F_CSUM_MASK;
- esp_features &= ~NETIF_F_SCTP_CRC;
+ netdev_feature_del(NETIF_F_SCTP_CRC_BIT, esp_features);
}
xo->flags |= XFRM_GSO_SEGMENT;
@@ -46,7 +46,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
features &= skb->dev->hw_enc_features;
if (need_csum)
- features &= ~NETIF_F_SCTP_CRC;
+ netdev_feature_del(NETIF_F_SCTP_CRC_BIT, features);
need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb));
/* Try to offload checksum if possible */
@@ -70,7 +70,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
features &= skb->dev->hw_enc_features;
if (need_csum)
- features &= ~NETIF_F_SCTP_CRC;
+ netdev_feature_del(NETIF_F_SCTP_CRC_BIT, features);
/* The only checksum offload we care about from here on out is the
* outer one so strip the existing checksum feature flags and
@@ -258,11 +258,11 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb,
if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) {
esp_features = features & ~NETIF_F_CSUM_MASK;
- esp_features &= ~NETIF_F_SG;
- esp_features &= ~NETIF_F_SCTP_CRC;
+ netdev_feature_del(NETIF_F_SG_BIT, esp_features);
+ netdev_feature_del(NETIF_F_SCTP_CRC_BIT, esp_features);
} else if (!(features & NETIF_F_HW_ESP_TX_CSUM)) {
esp_features = features & ~NETIF_F_CSUM_MASK;
- esp_features &= ~NETIF_F_SCTP_CRC;
+ netdev_feature_del(NETIF_F_SCTP_CRC_BIT, esp_features);
}
xo->flags |= XFRM_GSO_SEGMENT;
@@ -121,7 +121,7 @@ static void do_setup(struct net_device *netdev)
netdev->hw_enc_features = netdev->features;
netdev_active_features_set(netdev, netdev_tx_vlan_features);
netdev->hw_features = netdev->features;
- netdev->hw_features &= ~NETIF_F_LLTX;
+ netdev_hw_feature_del(netdev, NETIF_F_LLTX_BIT);
eth_hw_addr_random(netdev);
}
@@ -72,7 +72,7 @@ static struct sk_buff *sctp_gso_segment(struct sk_buff *skb,
tmp = features;
netdev_feature_add(NETIF_F_HW_CSUM_BIT, tmp);
- tmp &= ~NETIF_F_SG;
+ netdev_feature_del(NETIF_F_SG_BIT, tmp);
segs = skb_segment(skb, tmp);
if (IS_ERR(segs))
goto out;
@@ -165,7 +165,8 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
if (!wdev->netdev)
continue;
- wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+ netdev_active_feature_del(wdev->netdev,
+ NETIF_F_NETNS_LOCAL_BIT);
err = dev_change_net_namespace(wdev->netdev, net, "wlan%d");
if (err)
break;
@@ -182,7 +183,8 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
list) {
if (!wdev->netdev)
continue;
- wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
+ netdev_active_feature_del(wdev->netdev,
+ NETIF_F_NETNS_LOCAL_BIT);
err = dev_change_net_namespace(wdev->netdev, net,
"wlan%d");
WARN_ON(err);
@@ -114,7 +114,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
if (!(features & NETIF_F_HW_ESP)) {
esp_features = features;
- esp_features &= ~NETIF_F_SG;
+ netdev_feature_del(NETIF_F_SG_BIT, esp_features);
esp_features &= ~NETIF_F_CSUM_MASK;
}
@@ -141,8 +141,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
struct sk_buff *segs;
/* Packet got rerouted, fixup features and segment it. */
- esp_features &= ~NETIF_F_HW_ESP;
- esp_features &= ~NETIF_F_GSO_ESP;
+ netdev_feature_del(NETIF_F_HW_ESP_BIT, esp_features);
+ netdev_feature_del(NETIF_F_GSO_ESP_BIT, esp_features);
segs = skb_gso_segment(skb, esp_features);
if (IS_ERR(segs)) {
Replace the '&= ~' expreesions of single feature bit by netdev_feature_del helpers. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/altera/altera_tse_main.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 3 +- .../net/ethernet/aquantia/atlantic/aq_main.c | 6 +-- .../net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- .../net/ethernet/atheros/atl1e/atl1e_main.c | 2 +- drivers/net/ethernet/atheros/atlx/atl2.c | 2 +- drivers/net/ethernet/atheros/atlx/atlx.c | 2 +- drivers/net/ethernet/broadcom/bnx2.c | 2 +- .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 14 +++---- .../net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 18 ++++----- drivers/net/ethernet/cadence/macb_main.c | 6 +-- .../net/ethernet/cavium/liquidio/lio_main.c | 20 +++++----- .../ethernet/cavium/liquidio/lio_vf_main.c | 18 ++++----- .../net/ethernet/cavium/thunder/nicvf_main.c | 2 +- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 2 +- .../net/ethernet/chelsio/cxgb3/cxgb3_main.c | 5 ++- .../net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 8 ++-- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- .../ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 2 +- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- drivers/net/ethernet/faraday/ftgmac100.c | 4 +- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- .../net/ethernet/huawei/hinic/hinic_main.c | 2 +- drivers/net/ethernet/ibm/ibmveth.c | 10 +++-- drivers/net/ethernet/intel/e1000/e1000_main.c | 2 +- drivers/net/ethernet/intel/e1000e/netdev.c | 4 +- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 3 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 28 +++++++------ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 4 +- drivers/net/ethernet/intel/igbvf/netdev.c | 2 +- drivers/net/ethernet/intel/igc/igc_main.c | 4 +- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 ++--- .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +- .../marvell/octeontx2/nic/otx2_common.c | 3 +- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +- drivers/net/ethernet/marvell/sky2.c | 6 +-- .../net/ethernet/mellanox/mlx4/en_netdev.c | 12 +++--- .../net/ethernet/mellanox/mlx5/core/en_fs.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 34 ++++++++-------- .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 2 +- .../net/ethernet/myricom/myri10ge/myri10ge.c | 6 +-- .../ethernet/netronome/nfp/nfp_net_common.c | 14 ++++--- .../net/ethernet/netronome/nfp/nfp_net_repr.c | 2 +- .../ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 2 +- .../net/ethernet/qlogic/qede/qede_ethtool.c | 3 +- .../net/ethernet/qlogic/qede/qede_filter.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 4 +- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 7 ++-- drivers/net/ethernet/realtek/8139cp.c | 2 +- drivers/net/ethernet/realtek/r8169_main.c | 2 +- drivers/net/ethernet/sfc/ef10_sriov.c | 3 +- drivers/net/ethernet/sfc/efx.c | 4 +- drivers/net/ethernet/sfc/falcon/efx.c | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 9 +++-- drivers/net/ethernet/sfc/siena/efx.c | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- drivers/net/ethernet/sun/sunvnet_common.c | 2 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- drivers/net/macvlan.c | 2 +- drivers/net/usb/r8152.c | 4 +- drivers/net/veth.c | 6 +-- drivers/net/vmxnet3/vmxnet3_drv.c | 12 ++++-- drivers/net/vmxnet3/vmxnet3_ethtool.c | 8 ++-- drivers/net/wireless/ath/ath6kl/main.c | 3 +- .../broadcom/brcm80211/brcmfmac/core.c | 2 +- drivers/net/xen-netback/interface.c | 10 ++--- drivers/net/xen-netfront.c | 8 ++-- drivers/s390/net/qeth_core_main.c | 15 +++---- drivers/s390/net/qeth_l3_main.c | 2 +- net/core/dev.c | 39 ++++++++++--------- net/core/skbuff.c | 3 +- net/dccp/ipv6.c | 5 ++- net/dsa/slave.c | 6 ++- net/ieee802154/core.c | 6 ++- net/ipv4/esp4_offload.c | 6 +-- net/ipv4/gre_offload.c | 2 +- net/ipv4/udp_offload.c | 2 +- net/ipv6/esp6_offload.c | 6 +-- net/openvswitch/vport-internal_dev.c | 2 +- net/sctp/offload.c | 2 +- net/wireless/core.c | 6 ++- net/xfrm/xfrm_device.c | 6 +-- 90 files changed, 275 insertions(+), 234 deletions(-)