For the prototype of netdev_features_t is u64, and the number of netdevice feature bits is 64 now. So there is no space to introduce new feature bit.
This patchset try to solve it by change the prototype of netdev_features_t from u64 to bitmap. With this change, it's neccessary to introduce a set of bitmap operation helpers for netdev features. Meanwhile, the functions which use netdev_features_t as return value are also need to be changed, return the result as an output parameter.
With above changes, it will affect hundreds of files, and all the nic drivers. To make it easy to be reviewed, split the changes to 124 patches to 6 parts.
patch 1: code optimization for hns3 driver patch 2~23: convert the prototype which use netdev_features_t as return value patch 24: introduce fake helpers for bitmap operation patch 25~141: use netdev_feature_xxx helpers patch 142: use macro __DECLARE_NETDEV_FEATURE_MASK to replace netdev_feature_t declaration. patch 143: change the type of netdev_features_t to bitmap, and rewrite the bitmap helpers.
Jian Shen (143): net: hns3: refine function hns3_set_default_feature() net: convert the prototype of netdev_intersect_features net: convert the prototype of netdev_get_wanted_features net: convert the prototype of net_mpls_features net: convert the prototype of harmonize_features net: convert the prototype of gso_features_check net: convert the prototype of vlan_features_check net: convert the prototype of vxlan_features_check net: convert the prototype of dflt_features_check net: convert the prototype of ndo_features_check net: convert the prototype of netif_skb_features net: convert the prototype of ndo_fix_features net: convert the prototype of netdev_fix_features net: convert the prototype of netdev_sync_upper_features net: convert the prototype of br_features_recompute net: convert the prototype of netdev_add_tso_features net: convert the prototype of netdev_increment_features net: convert the prototype of hsr_features_recompute net: mlx5: convert prototype of mlx5e_ipsec_feature_check, mlx5e_tunnel_features_check and mlx5e_fix_uplink_rep_features net: sfc: convert the prototype of xxx_supported_features net: qlogic: convert the prototype of qlcnic_process_flags net: realtek: convert the prototype of rtl8168evl_fix_tso ethtool: convert the prototype of ethtool_get_feature_mask net: add netdev feature helpers net: core: use netdev feature helpers skbuff: use netdev feature helpers net: vlan: use netdev feature helpers bridge: use netdev feature helpers ipvlan: use netdev feature helpers veth: use netdev feature helpers bonding: use netdev feature helpers net: tun: use netdev feature helpers net: tap: use netdev feature helpers net: geneve: use netdev feature helpers hv_netvsc: use netdev feature helpers macvlan: use netdev feature helpers macsec: use netdev feature helpers s390: qeth: use netdev feature helpers dsa: use netdev feature helpers macvtap: use netdev feature helpers team: use netdev feature helpers vmxnet3: use netdev feature helpers net_failover: use netdev feature helpers pktgen: use netdev feature helpers net: sched: use netdev feature helpers netdevsim: use netdev feature helpers virtio_net: use netdev feature helpers net: ipv4: use netdev feature helpers net: ipv6: use netdev feature helpers net: hsr: use netdev feature helpers net: nsh: use netdev feature helpers vxlan: use netdev feature helpers xen-netback: use netdev feature helpers xen-netfront: use netdev feature helpers sock: use netdev feature helpers sunrpc: use netdev feature helpers net: loopback: use netdev feature helpers net: dummy: use netdev_feature helpers net: mac80211: use netdev feature helpers net: ifb: use netdev feature helpers net: bareudp: use netdev feature helpers net: gtp: use netdev feature helpers net: nlmon: use netdev feature helpers net: wireguard: use netdev feature helpers net: can: use netdev feature helpers net: ppp: use netdev feature helpers net: ipa: use netdev feature helpers net: fjes: use netdev feature helpers net: usb: use netdev feature helpers net: wireless: use netdev feature helpers net: realtek: use netdev feature helpers net: broadcom: use netdev feature helpers net: intel: use netdev feature helpers net: hisilicon: use netdev feature helpers net: mellanox: use netdev feature helpers net: atlantic: use netdev feature helpers net: atheros: use netdev feature helpers net: chelsio: use netdev feature helpers net: davicom: use netdev feature helpers net: freescale: use netdev feature helpers net: synopsys: use netdev feature helpers net: sfc: use netdev feature helpers net: qualcomm: use netdev feature helpers net: nvidia: use netdev feature helpers net: faraday: use netdev feature helpers net: google: use netdev feature helpers net: hinic: use netdev feature helpers net: ibm: use netdev feature helpers net: ionic: use netdev feature helpers net: jme: use netdev feature helpers net: micrel: use netdev feature helpers net: cavium: use netdev feature helpers net: cadence: use netdev feature helpers net: mediatek: use netdev feature helpers net: marvell: use netdev feature helpers net: socionext: use netdev feature helpers net: qlogic: use netdev feature helpers net: nfp: use netdev feature helpers net: mscc: use netdev feature helpers net: oki-semi: use netdev feature helpers net: renesas: use netdev feature helpers net: neterion: use netdev feature helpers net: cortina: use netdev feature helpers net: stmmac: use netdev feature helpers net: sxgbe: use netdev feature helpers net: xgmac: use netdev feature helpers net: altera: use netdev feature helpers net: ti: use netdev feature helpers net: benet: use netdev feature helpers net: amd: use netdev feature helpers net: bna: use netdev feature helpers net: enic: use netdev feature helpers net: 3com: use netdev feature helpers net: aeroflex: use netdev feature helpers net: sun: use netdev feature helpers net: mana: use netdev feature helpers net: myricom: use netdev feature helpers net: alacritech: use netdev feature helpers net: toshiba: use netdev feature helpers net: tehuti: use netdev feature helpers net: alteon: use netdev feature helpers net: ena: use netdev feature helpers net: sgi: use netdev feature helpers net: microchip: use netdev feature helpers net: ni: use netdev feature helpers net: apm: use netdev feature helpers net: natsemi: use netdev feature helpers net: xilinx: use netdev feature helpers net: pasemi: use netdev feature helpers net: rocker: use netdev feature helpers net: silan: use netdev feature helpers net: adaptec: use netdev feature helpers net: tundra: use netdev feature helpers net: via: use netdev feature helpers net: wiznet: use netdev feature helpers net: dnet: use netdev feature helpers net: ethoc: use netdev feature helpers RDMA: ipoib: use netdev feature helpers um: use netdev feature helpers staging: qlge: use netdev feature helpers net: sock: add helper sk_nocaps_add_gso() treewide: introduce macro __DECLARE_NETDEV_FEATURE_MASK net: extend the type of netdev_features_t to bitmap
arch/um/drivers/vector_kern.c | 15 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 21 +- drivers/net/bareudp.c | 16 +- drivers/net/bonding/bond_main.c | 137 ++++--- drivers/net/bonding/bond_options.c | 12 +- drivers/net/can/dev/dev.c | 3 +- drivers/net/can/slcan.c | 3 +- drivers/net/dsa/xrs700x/xrs700x.c | 6 +- drivers/net/dummy.c | 14 +- drivers/net/ethernet/3com/3c59x.c | 9 +- drivers/net/ethernet/3com/typhoon.c | 10 +- drivers/net/ethernet/adaptec/starfire.c | 9 +- drivers/net/ethernet/aeroflex/greth.c | 12 +- drivers/net/ethernet/alacritech/slicoss.c | 5 +- drivers/net/ethernet/alteon/acenic.c | 7 +- drivers/net/ethernet/altera/altera_tse_main.c | 11 +- drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 2 +- drivers/net/ethernet/amazon/ena/ena_netdev.c | 50 +-- drivers/net/ethernet/amd/amd8111e.c | 8 +- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 20 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 93 +++-- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 68 ++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 2 +- drivers/net/ethernet/apm/xgene-v2/main.c | 5 +- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 21 +- .../net/ethernet/aquantia/atlantic/aq_filters.c | 12 +- drivers/net/ethernet/aquantia/atlantic/aq_macsec.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 27 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 28 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 3 +- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 3 +- drivers/net/ethernet/atheros/alx/main.c | 23 +- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 33 +- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 44 ++- drivers/net/ethernet/atheros/atlx/atl1.c | 15 +- drivers/net/ethernet/atheros/atlx/atl2.c | 27 +- drivers/net/ethernet/atheros/atlx/atlx.c | 20 +- drivers/net/ethernet/broadcom/b44.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 24 +- drivers/net/ethernet/broadcom/bgmac.c | 8 +- drivers/net/ethernet/broadcom/bnx2.c | 48 ++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 67 ++-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 3 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 93 +++-- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 171 +++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 11 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 3 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 12 +- drivers/net/ethernet/broadcom/tg3.c | 62 +-- drivers/net/ethernet/brocade/bna/bnad.c | 48 ++- drivers/net/ethernet/cadence/macb_main.c | 81 ++-- drivers/net/ethernet/calxeda/xgmac.c | 20 +- drivers/net/ethernet/cavium/liquidio/lio_core.c | 6 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 95 +++-- drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 79 ++-- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 50 +-- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 50 +-- drivers/net/ethernet/chelsio/cxgb/sge.c | 12 +- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 60 +-- drivers/net/ethernet/chelsio/cxgb3/sge.c | 10 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 16 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 88 +++-- drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h | 3 +- drivers/net/ethernet/chelsio/cxgb4/sge.c | 14 +- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 39 +- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 8 +- .../chelsio/inline_crypto/chtls/chtls_main.c | 3 +- drivers/net/ethernet/cisco/enic/enic_main.c | 74 ++-- drivers/net/ethernet/cortina/gemini.c | 18 +- drivers/net/ethernet/davicom/dm9000.c | 24 +- drivers/net/ethernet/dnet.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 68 ++-- drivers/net/ethernet/ethoc.c | 2 +- drivers/net/ethernet/faraday/ftgmac100.c | 38 +- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 23 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 44 ++- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 5 +- drivers/net/ethernet/freescale/enetc/enetc.c | 34 +- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 38 +- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 16 +- drivers/net/ethernet/freescale/fec_main.c | 29 +- .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +- drivers/net/ethernet/freescale/gianfar.c | 39 +- drivers/net/ethernet/freescale/gianfar_ethtool.c | 11 +- drivers/net/ethernet/google/gve/gve_adminq.c | 6 +- drivers/net/ethernet/google/gve/gve_main.c | 31 +- drivers/net/ethernet/google/gve/gve_rx.c | 8 +- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 8 +- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 8 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 52 +-- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 159 ++++---- drivers/net/ethernet/huawei/hinic/hinic_main.c | 80 ++-- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 5 +- drivers/net/ethernet/ibm/ehea/ehea_main.c | 22 +- drivers/net/ethernet/ibm/emac/core.c | 7 +- drivers/net/ethernet/ibm/ibmveth.c | 76 ++-- drivers/net/ethernet/ibm/ibmvnic.c | 67 ++-- drivers/net/ethernet/intel/e100.c | 26 +- drivers/net/ethernet/intel/e1000/e1000_main.c | 82 ++-- drivers/net/ethernet/intel/e1000e/netdev.c | 129 ++++--- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 65 ++-- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 11 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 122 +++--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 153 ++++---- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 12 +- drivers/net/ethernet/intel/ice/ice_main.c | 177 +++++---- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 9 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 150 +++++--- drivers/net/ethernet/intel/igbvf/netdev.c | 86 +++-- drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 +- drivers/net/ethernet/intel/igc/igc_main.c | 122 +++--- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 49 ++- drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 7 +- drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 215 ++++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 6 +- drivers/net/ethernet/intel/ixgbevf/ipsec.c | 9 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 105 +++--- drivers/net/ethernet/jme.c | 49 +-- drivers/net/ethernet/marvell/mv643xx_eth.c | 14 +- drivers/net/ethernet/marvell/mvneta.c | 22 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 73 ++-- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 3 +- .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 74 ++-- .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 8 +- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 22 +- .../net/ethernet/marvell/prestera/prestera_main.c | 3 +- drivers/net/ethernet/marvell/skge.c | 11 +- drivers/net/ethernet/marvell/sky2.c | 75 ++-- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 56 +-- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 4 +- drivers/net/ethernet/mellanox/mlx4/en_main.c | 8 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 198 ++++++---- drivers/net/ethernet/mellanox/mlx4/en_resources.c | 4 +- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 19 +- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 5 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 5 +- .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 18 +- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 15 +- .../ethernet/mellanox/mlx5/core/en_accel/ktls.c | 14 +- .../net/ethernet/mellanox/mlx5/core/en_accel/tls.c | 16 +- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 6 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 250 ++++++------ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 25 +- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 9 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 19 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 36 +- drivers/net/ethernet/micrel/ksz884x.c | 10 +- drivers/net/ethernet/microchip/lan743x_main.c | 7 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 20 +- drivers/net/ethernet/mscc/ocelot.c | 3 +- drivers/net/ethernet/mscc/ocelot_net.c | 18 +- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 31 +- drivers/net/ethernet/natsemi/ns83820.c | 13 +- drivers/net/ethernet/neterion/s2io.c | 32 +- drivers/net/ethernet/neterion/vxge/vxge-main.c | 49 ++- drivers/net/ethernet/netronome/nfp/crypto/tls.c | 12 +- .../net/ethernet/netronome/nfp/nfp_net_common.c | 117 +++--- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 76 ++-- drivers/net/ethernet/netronome/nfp/nfp_port.c | 3 +- drivers/net/ethernet/ni/nixge.c | 3 +- drivers/net/ethernet/nvidia/forcedeth.c | 66 ++-- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 13 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 6 +- drivers/net/ethernet/pasemi/pasemi_mac.c | 6 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 125 +++--- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 9 +- .../net/ethernet/qlogic/netxen/netxen_nic_init.c | 3 +- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 50 +-- drivers/net/ethernet/qlogic/qede/qede.h | 10 +- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 19 +- drivers/net/ethernet/qlogic/qede/qede_fp.c | 23 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 67 ++-- drivers/net/ethernet/qlogic/qla3xxx.c | 5 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 3 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 72 ++-- drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 3 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 57 +-- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 6 +- drivers/net/ethernet/qualcomm/emac/emac.c | 25 +- .../net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 11 +- drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 10 +- drivers/net/ethernet/realtek/8139cp.c | 36 +- drivers/net/ethernet/realtek/8139too.c | 28 +- drivers/net/ethernet/realtek/r8169_main.c | 85 +++-- drivers/net/ethernet/renesas/ravb_main.c | 24 +- drivers/net/ethernet/renesas/sh_eth.c | 28 +- drivers/net/ethernet/rocker/rocker_main.c | 3 +- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 19 +- drivers/net/ethernet/sfc/ef10.c | 37 +- drivers/net/ethernet/sfc/ef100_nic.c | 39 +- drivers/net/ethernet/sfc/ef100_rx.c | 6 +- drivers/net/ethernet/sfc/ef100_tx.c | 11 +- drivers/net/ethernet/sfc/ef10_sriov.c | 6 +- drivers/net/ethernet/sfc/efx.c | 30 +- drivers/net/ethernet/sfc/efx_common.c | 41 +- drivers/net/ethernet/sfc/efx_common.h | 4 +- drivers/net/ethernet/sfc/falcon/efx.c | 43 ++- drivers/net/ethernet/sfc/falcon/net_driver.h | 9 +- drivers/net/ethernet/sfc/falcon/rx.c | 6 +- drivers/net/ethernet/sfc/farch.c | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 21 +- drivers/net/ethernet/sfc/mcdi_port_common.c | 3 +- drivers/net/ethernet/sfc/net_driver.h | 9 +- drivers/net/ethernet/sfc/rx.c | 3 +- drivers/net/ethernet/sfc/rx_common.c | 3 +- drivers/net/ethernet/sgi/ioc3-eth.c | 11 +- drivers/net/ethernet/silan/sc92031.c | 6 +- drivers/net/ethernet/socionext/netsec.c | 10 +- drivers/net/ethernet/socionext/sni_ave.c | 6 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 3 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 62 +-- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 +- drivers/net/ethernet/sun/cassini.c | 5 +- drivers/net/ethernet/sun/ldmvsw.c | 5 +- drivers/net/ethernet/sun/niu.c | 11 +- drivers/net/ethernet/sun/sungem.c | 11 +- drivers/net/ethernet/sun/sunhme.c | 14 +- drivers/net/ethernet/sun/sunvnet.c | 8 +- drivers/net/ethernet/sun/sunvnet_common.c | 5 +- drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 45 ++- drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c | 20 +- drivers/net/ethernet/synopsys/dwc-xlgmac-net.c | 41 +- drivers/net/ethernet/synopsys/dwc-xlgmac.h | 2 +- drivers/net/ethernet/tehuti/tehuti.c | 22 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 23 +- drivers/net/ethernet/ti/cpsw.c | 6 +- drivers/net/ethernet/ti/cpsw_new.c | 7 +- drivers/net/ethernet/ti/netcp_core.c | 9 +- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 14 +- drivers/net/ethernet/toshiba/spider_net.c | 12 +- drivers/net/ethernet/tundra/tsi108_eth.c | 3 +- drivers/net/ethernet/via/via-rhine.c | 10 +- drivers/net/ethernet/via/via-velocity.c | 14 +- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 5 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 9 +- drivers/net/fjes/fjes_main.c | 3 +- drivers/net/geneve.c | 18 +- drivers/net/gtp.c | 2 +- drivers/net/hyperv/netvsc_bpf.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 46 +-- drivers/net/hyperv/rndis_filter.c | 30 +- drivers/net/ifb.c | 12 +- drivers/net/ipa/ipa_modem.c | 3 +- drivers/net/ipvlan/ipvlan.h | 2 +- drivers/net/ipvlan/ipvlan_main.c | 40 +- drivers/net/ipvlan/ipvtap.c | 4 +- drivers/net/loopback.c | 20 +- drivers/net/macsec.c | 49 ++- drivers/net/macvlan.c | 58 +-- drivers/net/macvtap.c | 5 +- drivers/net/net_failover.c | 77 ++-- drivers/net/netdevsim/ipsec.c | 4 +- drivers/net/netdevsim/netdev.c | 15 +- drivers/net/nlmon.c | 5 +- drivers/net/ppp/ppp_generic.c | 2 +- drivers/net/tap.c | 38 +- drivers/net/team/team.c | 90 +++-- drivers/net/tun.c | 53 ++- drivers/net/usb/aqc111.c | 42 ++- drivers/net/usb/ax88179_178a.c | 26 +- drivers/net/usb/cdc-phonet.c | 2 +- drivers/net/usb/cdc_mbim.c | 4 +- drivers/net/usb/lan78xx.c | 46 +-- drivers/net/usb/r8152.c | 71 ++-- drivers/net/usb/smsc75xx.c | 14 +- drivers/net/usb/smsc95xx.c | 18 +- drivers/net/veth.c | 67 ++-- drivers/net/virtio_net.c | 51 ++- drivers/net/vmxnet3/vmxnet3_drv.c | 78 ++-- drivers/net/vmxnet3/vmxnet3_ethtool.c | 88 +++-- drivers/net/vmxnet3/vmxnet3_int.h | 4 +- drivers/net/vxlan.c | 21 +- drivers/net/wireguard/device.c | 8 +- drivers/net/wireless/ath/ath10k/mac.c | 7 +- drivers/net/wireless/ath/ath11k/mac.c | 4 +- drivers/net/wireless/ath/ath6kl/main.c | 15 +- drivers/net/wireless/ath/ath6kl/txrx.c | 6 +- drivers/net/wireless/ath/wil6210/netdev.c | 11 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 7 +- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 3 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 8 +- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 3 +- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 +- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 3 +- drivers/net/xen-netback/interface.c | 27 +- drivers/net/xen-netfront.c | 52 +-- drivers/s390/net/qeth_core.h | 7 +- drivers/s390/net/qeth_core_main.c | 129 ++++--- drivers/s390/net/qeth_l2_main.c | 44 ++- drivers/s390/net/qeth_l3_main.c | 49 ++- drivers/staging/qlge/qlge_main.c | 59 +-- include/linux/if_macvlan.h | 2 +- include/linux/if_tap.h | 2 +- include/linux/if_vlan.h | 22 +- include/linux/netdev_features.h | 179 +++++++-- include/linux/netdevice.h | 122 +++--- include/linux/skbuff.h | 6 +- include/net/mac80211.h | 2 +- include/net/pkt_cls.h | 2 +- include/net/sock.h | 22 +- include/net/udp.h | 8 +- include/net/udp_tunnel.h | 12 +- include/net/vxlan.h | 13 +- lib/test_bpf.c | 2 +- lib/vsprintf.c | 4 +- net/8021q/vlan.c | 11 +- net/8021q/vlan.h | 22 +- net/8021q/vlan_core.c | 6 +- net/8021q/vlan_dev.c | 57 +-- net/bridge/br_device.c | 21 +- net/bridge/br_if.c | 19 +- net/bridge/br_private.h | 3 +- net/core/dev.c | 418 ++++++++++++--------- net/core/netpoll.c | 4 +- net/core/pktgen.c | 6 +- net/core/skbuff.c | 10 +- net/core/skmsg.c | 3 +- net/core/sock.c | 17 +- net/dsa/slave.c | 15 +- net/ethtool/features.c | 94 ++--- net/ethtool/ioctl.c | 154 +++++--- net/hsr/hsr_device.c | 40 +- net/ipv4/af_inet.c | 5 +- net/ipv4/esp4_offload.c | 29 +- net/ipv4/gre_offload.c | 8 +- net/ipv4/ip_gre.c | 36 +- net/ipv4/ip_output.c | 27 +- net/ipv4/ip_tunnel.c | 4 +- net/ipv4/ip_vti.c | 2 +- net/ipv4/ipip.c | 6 +- net/ipv4/ipmr.c | 2 +- net/ipv4/tcp.c | 10 +- net/ipv4/tcp_ipv4.c | 6 +- net/ipv4/tcp_offload.c | 5 +- net/ipv4/tcp_output.c | 2 +- net/ipv4/udp_offload.c | 28 +- net/ipv6/af_inet6.c | 2 +- net/ipv6/esp6_offload.c | 19 +- net/ipv6/inet6_connection_sock.c | 2 +- net/ipv6/ip6_gre.c | 17 +- net/ipv6/ip6_offload.c | 3 +- net/ipv6/ip6_output.c | 24 +- net/ipv6/ip6_tunnel.c | 9 +- net/ipv6/ip6mr.c | 2 +- net/ipv6/sit.c | 9 +- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/udp_offload.c | 2 +- net/mac80211/iface.c | 10 +- net/mac80211/main.c | 5 +- net/nsh/nsh.c | 2 +- net/sched/sch_cake.c | 4 +- net/sched/sch_netem.c | 6 +- net/sched/sch_taprio.c | 6 +- net/sched/sch_tbf.c | 6 +- net/sunrpc/sunrpc.h | 2 +- net/wireless/core.c | 14 +- 378 files changed, 6367 insertions(+), 4344 deletions(-)
Currently, the driver sets default feature for netdev->features, netdev->hw_features, netdev->vlan_features and netdev->hw_enc_features separately. It's fussy, because most of the feature bits are same. So refine it by copy value from netdev->features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 62 +++++++------------------ 1 file changed, 16 insertions(+), 46 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index fcbeb1f..8072644 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3127,11 +3127,6 @@ static void hns3_set_default_feature(struct net_device *netdev)
netdev->priv_flags |= IFF_UNICAST_FLT;
- netdev->hw_enc_features |= NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_SCTP_CRC | NETIF_F_TSO_MANGLEID | NETIF_F_FRAGLIST; - netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | @@ -3141,62 +3136,37 @@ static void hns3_set_default_feature(struct net_device *netdev) NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST;
- netdev->vlan_features |= NETIF_F_RXCSUM | - NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO | - NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST; - - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST; - if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { - netdev->hw_features |= NETIF_F_GRO_HW; netdev->features |= NETIF_F_GRO_HW;
- if (!(h->flags & HNAE3_SUPPORT_VF)) { - netdev->hw_features |= NETIF_F_NTUPLE; + if (!(h->flags & HNAE3_SUPPORT_VF)) netdev->features |= NETIF_F_NTUPLE; - } }
- if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps)) { - netdev->hw_features |= NETIF_F_GSO_UDP_L4; + if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps)) netdev->features |= NETIF_F_GSO_UDP_L4; - netdev->vlan_features |= NETIF_F_GSO_UDP_L4; - netdev->hw_enc_features |= NETIF_F_GSO_UDP_L4; - }
- if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps)) { - netdev->hw_features |= NETIF_F_HW_CSUM; + if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps)) netdev->features |= NETIF_F_HW_CSUM; - netdev->vlan_features |= NETIF_F_HW_CSUM; - netdev->hw_enc_features |= NETIF_F_HW_CSUM; - } else { - netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + else netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - netdev->vlan_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - }
- if (test_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps)) { - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; + if (test_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps)) netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; - netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; - netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; - }
- if (test_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps)) { - netdev->hw_features |= NETIF_F_HW_TC; + if (test_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps)) netdev->features |= NETIF_F_HW_TC; - }
- if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps)) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev->hw_features |= 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->vlan_features |= netdev->features & + ~(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_HW | NETIF_F_NTUPLE | + NETIF_F_HW_TC); + + netdev->hw_enc_features |= netdev->vlan_features | NETIF_F_TSO_MANGLEID; }
static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_intersect_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 2 +- include/linux/netdevice.h | 7 ++++--- net/8021q/vlan_dev.c | 8 ++++---- net/core/dev.c | 8 ++++---- 4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index 3b8e675..466e898 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -246,7 +246,7 @@ nfp_repr_fix_features(struct net_device *netdev, netdev_features_t features) if (lower_features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) lower_features |= NETIF_F_HW_CSUM;
- features = netdev_intersect_features(features, lower_features); + netdev_intersect_features(&features, features, lower_features); features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC); features |= NETIF_F_LLTX;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index bd8d5b8..f96e31a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4990,8 +4990,9 @@ const char *netdev_drivername(const struct net_device *dev);
void linkwatch_run_queue(void);
-static inline netdev_features_t netdev_intersect_features(netdev_features_t f1, - netdev_features_t f2) +static inline void netdev_intersect_features(netdev_features_t *ret, + netdev_features_t f1, + netdev_features_t f2) { if ((f1 ^ f2) & NETIF_F_HW_CSUM) { if (f1 & NETIF_F_HW_CSUM) @@ -5000,7 +5001,7 @@ static inline netdev_features_t netdev_intersect_features(netdev_features_t f1, f2 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); }
- return f1 & f2; + *ret = f1 & f2; }
static inline netdev_features_t netdev_get_wanted_features( diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 0c21d1f..2987201 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -640,16 +640,16 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev, netdev_features_t old_features = features; netdev_features_t lower_features;
- lower_features = netdev_intersect_features((real_dev->vlan_features | - NETIF_F_RXCSUM), - real_dev->features); + netdev_intersect_features(&lower_features, + (real_dev->vlan_features | NETIF_F_RXCSUM), + real_dev->features);
/* Add HW_CSUM setting to preserve user ability to control * checksum offload on the vlan device. */ if (lower_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) lower_features |= NETIF_F_HW_CSUM; - features = netdev_intersect_features(features, lower_features); + netdev_intersect_features(&features, features, lower_features); features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE); features |= NETIF_F_LLTX;
diff --git a/net/core/dev.c b/net/core/dev.c index 8865079..dfd5fa9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3546,10 +3546,10 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) features &= dev->hw_enc_features;
if (skb_vlan_tagged(skb)) - features = netdev_intersect_features(features, - dev->vlan_features | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX); + netdev_intersect_features(&features, features, + dev->vlan_features | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX);
if (dev->netdev_ops->ndo_features_check) features &= dev->netdev_ops->ndo_features_check(skb, dev,
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_get_wanted_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/linux/netdevice.h | 6 +++--- net/core/dev.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f96e31a..efea2d6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5004,10 +5004,10 @@ static inline void netdev_intersect_features(netdev_features_t *ret, *ret = f1 & f2; }
-static inline netdev_features_t netdev_get_wanted_features( - struct net_device *dev) +static inline void netdev_get_wanted_features(struct net_device *dev, + netdev_features_t *wanted) { - return (dev->features & ~dev->hw_features) | dev->wanted_features; + *wanted = (dev->features & ~dev->hw_features) | dev->wanted_features; } netdev_features_t netdev_increment_features(netdev_features_t all, netdev_features_t one, netdev_features_t mask); diff --git a/net/core/dev.c b/net/core/dev.c index dfd5fa9..abc6fb7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9927,7 +9927,7 @@ int __netdev_update_features(struct net_device *dev)
ASSERT_RTNL();
- features = netdev_get_wanted_features(dev); + netdev_get_wanted_features(dev, &features);
if (dev->netdev_ops->ndo_fix_features) features = dev->netdev_ops->ndo_fix_features(dev, features);
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of net_mpls_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/core/dev.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c index abc6fb7..487204d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3442,21 +3442,16 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb) * instead of standard features for the netdev. */ #if IS_ENABLED(CONFIG_NET_MPLS_GSO) -static netdev_features_t net_mpls_features(struct sk_buff *skb, - netdev_features_t features, - __be16 type) +static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, + __be16 type) { if (eth_p_mpls(type)) - features &= skb->dev->mpls_features; - - return features; + *features &= skb->dev->mpls_features; } #else -static netdev_features_t net_mpls_features(struct sk_buff *skb, - netdev_features_t features, - __be16 type) +static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, + __be16 type) { - return features; } #endif
@@ -3466,7 +3461,7 @@ static netdev_features_t harmonize_features(struct sk_buff *skb, __be16 type;
type = skb_network_protocol(skb, NULL); - features = net_mpls_features(skb, features, type); + net_mpls_features(skb, &features, type);
if (skb->ip_summed != CHECKSUM_NONE && !can_checksum_protocol(features, type)) {
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of harmonize_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/core/dev.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c index 487204d..9dd7421 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3455,22 +3455,19 @@ static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, } #endif
-static netdev_features_t harmonize_features(struct sk_buff *skb, - netdev_features_t features) +static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) { __be16 type;
type = skb_network_protocol(skb, NULL); - net_mpls_features(skb, &features, type); + net_mpls_features(skb, features, type);
if (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(features, type)) { - features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + !can_checksum_protocol(*features, type)) { + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); } if (illegal_highdma(skb->dev, skb)) - features &= ~NETIF_F_SG; - - return features; + *features &= ~NETIF_F_SG; }
netdev_features_t passthru_features_check(struct sk_buff *skb, @@ -3552,7 +3549,8 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) else features &= dflt_features_check(skb, dev, features);
- return harmonize_features(skb, features); + harmonize_features(skb, &features); + return features; } EXPORT_SYMBOL(netif_skb_features);
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of gso_features_check for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/core/dev.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c index 9dd7421..4e553d4 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3485,18 +3485,21 @@ static netdev_features_t dflt_features_check(struct sk_buff *skb, return vlan_features_check(skb, features); }
-static netdev_features_t gso_features_check(const struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void gso_features_check(const struct sk_buff *skb, + struct net_device *dev, + netdev_features_t *features) { u16 gso_segs = skb_shinfo(skb)->gso_segs;
- if (gso_segs > dev->gso_max_segs) - return features & ~NETIF_F_GSO_MASK; + if (gso_segs > dev->gso_max_segs) { + *features &= ~NETIF_F_GSO_MASK; + return; + }
if (!skb_shinfo(skb)->gso_type) { skb_warn_bad_offload(skb); - return features & ~NETIF_F_GSO_MASK; + *features &= ~NETIF_F_GSO_MASK; + return; }
/* Support for GSO partial features requires software @@ -3506,7 +3509,7 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb, * segmented the frame. */ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL)) - features &= ~dev->gso_partial_features; + *features &= ~dev->gso_partial_features;
/* Make sure to clear the IPv4 ID mangling feature if the * IPv4 header has the potential to be fragmented. @@ -3516,10 +3519,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; + *features &= ~NETIF_F_TSO_MANGLEID; } - - return features; }
netdev_features_t netif_skb_features(struct sk_buff *skb) @@ -3528,7 +3529,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) netdev_features_t features = dev->features;
if (skb_is_gso(skb)) - features = gso_features_check(skb, dev, features); + gso_features_check(skb, dev, &features);
/* If encapsulation offload request, verify we are testing * hardware encapsulation features instead of standard
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of vlan_features_check for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 +- drivers/net/ethernet/realtek/8139cp.c | 3 ++- drivers/net/ethernet/realtek/r8169_main.c | 3 ++- drivers/net/usb/lan78xx.c | 2 +- drivers/s390/net/qeth_core_main.c | 3 ++- include/linux/if_vlan.h | 12 +++++------- net/core/dev.c | 3 ++- 14 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 17a585a..3fb15f6 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2271,7 +2271,7 @@ static netdev_features_t xgbe_features_check(struct sk_buff *skb, struct net_device *netdev, netdev_features_t features) { - features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); features = vxlan_features_check(skb, features);
return features; diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 6d98134..5f67a9a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12907,7 +12907,7 @@ static netdev_features_t bnx2x_features_check(struct sk_buff *skb, !skb_gso_validate_mac_len(skb, 9700))) features &= ~NETIF_F_GSO_MASK;
- features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); return vxlan_features_check(skb, features); }
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 865fcb8..af6bddf 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -11114,7 +11114,7 @@ static netdev_features_t bnxt_features_check(struct sk_buff *skb, struct bnxt *bp = netdev_priv(dev); u8 *l4_proto;
- features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): if (!skb->encapsulation) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 361c1c8..556242d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -5092,7 +5092,7 @@ static netdev_features_t be_features_check(struct sk_buff *skb, * Q-in-Q packets. * Offload features for normal (non tunnel) packets are unchanged. */ - features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); if (!skb->encapsulation || !(adapter->flags & BE_FLAGS_VXLAN_OFFLOADS)) return features; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index a2f61a8..c51bd5d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -2664,7 +2664,7 @@ static netdev_features_t mlx4_en_features_check(struct sk_buff *skb, struct net_device *dev, netdev_features_t features) { - features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); features = vxlan_features_check(skb, features);
/* The ConnectX-3 doesn't support outer IPv6 checksums but it does diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index ccc569c..6c0fc8d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3820,7 +3820,7 @@ netdev_features_t mlx5e_features_check(struct sk_buff *skb, { struct mlx5e_priv *priv = netdev_priv(netdev);
- features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); features = vxlan_features_check(skb, features);
/* Validate if the tunneled packet is being offloaded by HW */ diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 5bfa22a..58e7d98 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -3605,7 +3605,7 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, u8 l4_hdr;
/* We can't do TSO over double tagged packets (802.1AD) */ - features &= vlan_features_check(skb, features); + vlan_features_check(skb, &features);
if (!skb->encapsulation) return features; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index a4fa5079..4b13db3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -496,7 +496,7 @@ static netdev_features_t qlcnic_features_check(struct sk_buff *skb, struct net_device *dev, netdev_features_t features) { - features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); return vxlan_features_check(skb, features); }
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index edc6190..276a158 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -1860,7 +1860,8 @@ static netdev_features_t cp_features_check(struct sk_buff *skb, if (skb_shinfo(skb)->gso_size > MSSMask) features &= ~NETIF_F_TSO;
- return vlan_features_check(skb, features); + vlan_features_check(skb, &features); + return 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 fa2dab6..d48e589 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -4379,7 +4379,8 @@ static netdev_features_t rtl8169_features_check(struct sk_buff *skb, features &= ~NETIF_F_CSUM_MASK; }
- return vlan_features_check(skb, features); + vlan_features_check(skb, &features); + return features; }
static void rtl8169_pcierr_interrupt(struct net_device *dev) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 4e8d3c2..e536d96 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -3595,7 +3595,7 @@ static netdev_features_t lan78xx_features_check(struct sk_buff *skb, if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE) features &= ~NETIF_F_GSO_MASK;
- features = vlan_features_check(skb, features); + vlan_features_check(skb, &features); features = vxlan_features_check(skb, features);
return features; diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 5b973f3..1a7bb6f 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -7006,7 +7006,8 @@ netdev_features_t qeth_features_check(struct sk_buff *skb, features &= ~NETIF_F_SG; }
- return vlan_features_check(skb, features); + vlan_features_check(skb, &features); + return features; } EXPORT_SYMBOL_GPL(qeth_features_check);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 41a5183..2337538 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -727,8 +727,8 @@ static inline bool skb_vlan_tagged_multi(struct sk_buff *skb) * * Returns features without unsafe ones if the skb has multiple tags. */ -static inline netdev_features_t vlan_features_check(struct sk_buff *skb, - netdev_features_t features) +static inline void vlan_features_check(struct sk_buff *skb, + netdev_features_t *features) { if (skb_vlan_tagged_multi(skb)) { /* In the case of multi-tagged packets, use a direct mask @@ -736,12 +736,10 @@ static inline netdev_features_t vlan_features_check(struct sk_buff *skb, * sure that only devices supporting NETIF_F_HW_CSUM will * have checksum offloading support. */ - features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | - NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; + *features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | + NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX; } - - return features; }
/** diff --git a/net/core/dev.c b/net/core/dev.c index 4e553d4..78466c8 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3482,7 +3482,8 @@ static netdev_features_t dflt_features_check(struct sk_buff *skb, struct net_device *dev, netdev_features_t features) { - return vlan_features_check(skb, features); + vlan_features_check(skb, &features); + return features; }
static void gso_features_check(const struct sk_buff *skb,
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of vxlan_features_check for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 3 ++- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 3 ++- drivers/net/usb/lan78xx.c | 2 +- include/net/vxlan.h | 13 ++++++------- 8 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 3fb15f6..29bca9fa 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2272,7 +2272,7 @@ static netdev_features_t xgbe_features_check(struct sk_buff *skb, netdev_features_t features) { vlan_features_check(skb, &features); - features = vxlan_features_check(skb, features); + vxlan_features_check(skb, &features);
return features; } diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 5f67a9a..fad43c3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12908,7 +12908,8 @@ static netdev_features_t bnx2x_features_check(struct sk_buff *skb, features &= ~NETIF_F_GSO_MASK;
vlan_features_check(skb, &features); - return vxlan_features_check(skb, features); + vxlan_features_check(skb, &features); + return features; }
static int __bnx2x_vlan_configure_vid(struct bnx2x *bp, u16 vid, bool add) diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index d0a8f71..033b9de 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -253,7 +253,7 @@ static netdev_features_t enic_features_check(struct sk_buff *skb, if (!skb->encapsulation) return features;
- features = vxlan_features_check(skb, features); + vxlan_features_check(skb, &features);
switch (vlan_get_protocol(skb)) { case htons(ETH_P_IPV6): diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index c51bd5d..941d2d45 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -2665,7 +2665,7 @@ static netdev_features_t mlx4_en_features_check(struct sk_buff *skb, netdev_features_t features) { vlan_features_check(skb, &features); - features = vxlan_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 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 6c0fc8d..3deb65b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3821,7 +3821,7 @@ netdev_features_t mlx5e_features_check(struct sk_buff *skb, struct mlx5e_priv *priv = netdev_priv(netdev);
vlan_features_check(skb, &features); - features = vxlan_features_check(skb, features); + vxlan_features_check(skb, &features);
/* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation && diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 4b13db3..93a94a0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -497,7 +497,8 @@ static netdev_features_t qlcnic_features_check(struct sk_buff *skb, netdev_features_t features) { vlan_features_check(skb, &features); - return vxlan_features_check(skb, features); + vxlan_features_check(skb, &features); + return features; }
static const struct net_device_ops qlcnic_netdev_ops = { diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index e536d96..d9e4dde 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -3596,7 +3596,7 @@ static netdev_features_t lan78xx_features_check(struct sk_buff *skb, features &= ~NETIF_F_GSO_MASK;
vlan_features_check(skb, &features); - features = vxlan_features_check(skb, features); + vxlan_features_check(skb, &features);
return features; } diff --git a/include/net/vxlan.h b/include/net/vxlan.h index 08537aa..a801e59 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -296,13 +296,13 @@ struct vxlan_dev { struct net_device *vxlan_dev_create(struct net *net, const char *name, u8 name_assign_type, struct vxlan_config *conf);
-static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, - netdev_features_t features) +static inline void vxlan_features_check(struct sk_buff *skb, + netdev_features_t *features) { u8 l4_hdr = 0;
if (!skb->encapsulation) - return features; + return;
switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): @@ -312,7 +312,7 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, l4_hdr = ipv6_hdr(skb)->nexthdr; break; default: - return features; + return; }
if ((l4_hdr == IPPROTO_UDP) && @@ -321,10 +321,9 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, (skb_inner_mac_header(skb) - skb_transport_header(skb) != sizeof(struct udphdr) + sizeof(struct vxlanhdr)) || (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto)))) - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + !can_checksum_protocol(*features, inner_eth_hdr(skb)->h_proto)))) + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
- return features; }
/* IP header + UDP + VXLAN + Ethernet header */
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of dflt_features_check for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/core/dev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c index 78466c8..31ab16b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3478,12 +3478,11 @@ netdev_features_t passthru_features_check(struct sk_buff *skb, } EXPORT_SYMBOL(passthru_features_check);
-static netdev_features_t dflt_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features) +static void dflt_features_check(struct sk_buff *skb, + struct net_device *dev, + netdev_features_t *features) { - vlan_features_check(skb, &features); - return features; + vlan_features_check(skb, features); }
static void gso_features_check(const struct sk_buff *skb, @@ -3549,7 +3548,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) features &= dev->netdev_ops->ndo_features_check(skb, dev, features); else - features &= dflt_features_check(skb, dev, features); + dflt_features_check(skb, dev, &features);
harmonize_features(skb, &features); return features;
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);
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netif_skb_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/xen-netfront.c | 9 +++++++-- include/linux/netdevice.h | 2 +- net/core/dev.c | 20 ++++++++++---------- net/core/netpoll.c | 2 +- net/ipv4/ip_output.c | 2 +- net/ipv6/ip6_output.c | 2 +- net/sched/sch_cake.c | 3 ++- net/sched/sch_netem.c | 3 ++- net/sched/sch_taprio.c | 3 ++- net/sched/sch_tbf.c | 3 ++- 10 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 4427590..a8c2d41 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -648,6 +648,7 @@ static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev unsigned long flags; struct netfront_queue *queue = NULL; unsigned int num_queues = dev->real_num_tx_queues; + netdev_features_t features; u16 queue_index; struct sk_buff *nskb;
@@ -697,8 +698,12 @@ static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev spin_lock_irqsave(&queue->tx_lock, flags);
if (unlikely(!netif_carrier_ok(dev) || - (slots > 1 && !xennet_can_sg(dev)) || - netif_needs_gso(skb, netif_skb_features(skb)))) { + (slots > 1 && !xennet_can_sg(dev)))) { + spin_unlock_irqrestore(&queue->tx_lock, flags); + goto drop; + } + netif_skb_features(skb, &features); + if (unlikely(netif_needs_gso(skb, features))) { spin_unlock_irqrestore(&queue->tx_lock, flags); goto drop; } diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index aa3ca93..842b29ee 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5031,7 +5031,7 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,
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); +void netif_skb_features(struct sk_buff *skb, netdev_features_t *features);
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 a084a19..e7719c2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3521,34 +3521,34 @@ static void gso_features_check(const struct sk_buff *skb, } }
-netdev_features_t netif_skb_features(struct sk_buff *skb) +void netif_skb_features(struct sk_buff *skb, netdev_features_t *features) { struct net_device *dev = skb->dev; - netdev_features_t features = dev->features; + + *features = dev->features;
if (skb_is_gso(skb)) - gso_features_check(skb, dev, &features); + gso_features_check(skb, dev, features);
/* If encapsulation offload request, verify we are testing * hardware encapsulation features instead of standard * features for the netdev */ if (skb->encapsulation) - features &= dev->hw_enc_features; + *features &= dev->hw_enc_features;
if (skb_vlan_tagged(skb)) - netdev_intersect_features(&features, features, + netdev_intersect_features(features, *features, dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX);
if (dev->netdev_ops->ndo_features_check) - 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); + dflt_features_check(skb, dev, features);
- harmonize_features(skb, &features); - return features; + harmonize_features(skb, features); } EXPORT_SYMBOL(netif_skb_features);
@@ -3633,7 +3633,7 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device { netdev_features_t features;
- features = netif_skb_features(skb); + netif_skb_features(skb, &features); skb = validate_xmit_vlan(skb, features); if (unlikely(!skb)) goto out_null; diff --git a/net/core/netpoll.c b/net/core/netpoll.c index edfc0f8..d2fc92b 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -77,7 +77,7 @@ static netdev_tx_t netpoll_start_xmit(struct sk_buff *skb, netdev_tx_t status = NETDEV_TX_OK; netdev_features_t features;
- features = netif_skb_features(skb); + netif_skb_features(skb, &features);
if (skb_vlan_tag_present(skb) && !vlan_hw_offload_capable(features, skb->vlan_proto)) { diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 6b04a88..e458f1f 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -255,7 +255,7 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk, * bridged to a NETIF_F_TSO tunnel stacked over an interface with an * insufficient MTU. */ - features = netif_skb_features(skb); + netif_skb_features(skb, &features); BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_GSO_CB_OFFSET); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); if (IS_ERR_OR_NULL(segs)) { diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 12f985f..46a0867 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -146,7 +146,7 @@ ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk, * describing the cases where GSO segment length exceeds the * egress MTU. */ - features = netif_skb_features(skb); + netif_skb_features(skb, &features); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index ecc5c4d..0808569 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -1740,9 +1740,10 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) { struct sk_buff *segs, *nskb; - netdev_features_t features = netif_skb_features(skb); + netdev_features_t features; unsigned int slen = 0, numsegs = 0;
+ netif_skb_features(skb, &features); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free); diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 0c345e4..414d57e 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -413,8 +413,9 @@ static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) { struct sk_buff *segs; - netdev_features_t features = netif_skb_features(skb); + netdev_features_t features;
+ netif_skb_features(skb, &features); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
if (IS_ERR_OR_NULL(segs)) { diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 9c79374..a4073c4 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -453,10 +453,11 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, */ if (skb_is_gso(skb) && !FULL_OFFLOAD_IS_ENABLED(q->flags)) { unsigned int slen = 0, numsegs = 0, len = qdisc_pkt_len(skb); - netdev_features_t features = netif_skb_features(skb); + netdev_features_t features; struct sk_buff *segs, *nskb; int ret;
+ netif_skb_features(skb, &features); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free); diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 78e7902..99e6d726 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -192,10 +192,11 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch, { struct tbf_sched_data *q = qdisc_priv(sch); struct sk_buff *segs, *nskb; - netdev_features_t features = netif_skb_features(skb); + netdev_features_t features; unsigned int len = 0, prev_len = qdisc_pkt_len(skb); int ret, nb;
+ netif_skb_features(skb, &features); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
if (IS_ERR_OR_NULL(segs))
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of ndo_fix_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- arch/um/drivers/vector_kern.c | 7 ++--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 7 ++--- drivers/net/bonding/bond_main.c | 24 +++++++-------- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 28 +++++++++--------- drivers/net/ethernet/atheros/alx/main.c | 8 ++--- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 14 ++++----- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 12 ++++---- drivers/net/ethernet/atheros/atlx/atl2.c | 12 ++++---- drivers/net/ethernet/atheros/atlx/atlx.c | 12 ++++---- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 29 +++++++++--------- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 3 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 27 +++++++++-------- drivers/net/ethernet/broadcom/tg3.c | 8 ++--- drivers/net/ethernet/cavium/liquidio/lio_main.c | 34 ++++++++++------------ drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 30 +++++++++---------- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 10 +++---- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 11 +++---- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 12 ++++---- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 10 +++---- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 12 ++++---- drivers/net/ethernet/cortina/gemini.c | 8 ++--- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 7 ++--- drivers/net/ethernet/huawei/hinic/hinic_main.c | 10 +++---- drivers/net/ethernet/ibm/ibmveth.c | 10 +++---- drivers/net/ethernet/intel/e1000/e1000_main.c | 12 ++++---- drivers/net/ethernet/intel/e1000e/netdev.c | 14 ++++----- drivers/net/ethernet/intel/iavf/iavf_main.c | 8 ++--- drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++---- drivers/net/ethernet/intel/igc/igc_main.c | 12 ++++---- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 10 +++---- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 +++++----- drivers/net/ethernet/jme.c | 7 ++--- drivers/net/ethernet/marvell/mvneta.c | 8 ++--- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 14 ++++----- drivers/net/ethernet/marvell/sky2.c | 16 +++++----- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 10 +++---- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 12 ++++---- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 14 ++++----- drivers/net/ethernet/neterion/vxge/vxge-main.c | 10 +++---- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 14 ++++----- drivers/net/ethernet/nvidia/forcedeth.c | 10 +++---- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 10 +++---- drivers/net/ethernet/qlogic/qede/qede.h | 3 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 9 ++---- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 3 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 15 ++++------ drivers/net/ethernet/realtek/r8169_main.c | 10 +++---- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++----- drivers/net/hyperv/netvsc_drv.c | 12 ++++---- drivers/net/ipvlan/ipvlan_main.c | 18 +++++------- drivers/net/macsec.c | 16 +++++----- drivers/net/macvlan.c | 20 ++++++------- drivers/net/team/team.c | 20 ++++++------- drivers/net/tun.c | 7 +++-- drivers/net/veth.c | 10 +++---- drivers/net/vmxnet3/vmxnet3_ethtool.c | 10 +++---- drivers/net/vmxnet3/vmxnet3_int.h | 4 +-- drivers/net/xen-netback/interface.c | 16 +++++----- drivers/net/xen-netfront.c | 22 +++++++------- drivers/s390/net/qeth_core.h | 2 +- drivers/s390/net/qeth_core_main.c | 16 +++++----- include/linux/netdevice.h | 4 +-- net/8021q/vlan_dev.c | 14 ++++----- net/bridge/br_device.c | 5 ++-- net/core/dev.c | 2 +- net/hsr/hsr_device.c | 6 ++-- 66 files changed, 350 insertions(+), 462 deletions(-)
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index d27a2a9..cf3e781 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -1342,11 +1342,10 @@ static void vector_net_tx_timeout(struct net_device *dev, unsigned int txqueue) schedule_work(&vp->reset_tx); }
-static netdev_features_t vector_fix_features(struct net_device *dev, - netdev_features_t features) +static void vector_fix_features(struct net_device *dev, + netdev_features_t *features) { - features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); - return features; + *features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); }
static int vector_set_features(struct net_device *dev, diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 0aa8629..488d50a 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -214,14 +214,13 @@ static int ipoib_stop(struct net_device *dev) return 0; }
-static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features) +static void ipoib_fix_features(struct net_device *dev, + netdev_features_t *features) { struct ipoib_dev_priv *priv = ipoib_priv(dev);
if (test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags)) - features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); - - return features; + *features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); }
static int ipoib_change_mtu(struct net_device *dev, int new_mtu) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 365953e..29bdadf 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1355,8 +1355,8 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev)
/*---------------------------------- IOCTL ----------------------------------*/
-static netdev_features_t bond_fix_features(struct net_device *dev, - netdev_features_t features) +static void bond_fix_features(struct net_device *dev, + netdev_features_t *features) { struct bonding *bond = netdev_priv(dev); struct list_head *iter; @@ -1365,24 +1365,22 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
#if IS_ENABLED(CONFIG_TLS_DEVICE) if (bond_sk_check(bond)) - features |= BOND_TLS_FEATURES; + *features |= BOND_TLS_FEATURES; else - features &= ~BOND_TLS_FEATURES; + *features &= ~BOND_TLS_FEATURES; #endif
- mask = features; + mask = *features;
- features &= ~NETIF_F_ONE_FOR_ALL; - features |= NETIF_F_ALL_FOR_ALL; + *features &= ~NETIF_F_ONE_FOR_ALL; + *features |= NETIF_F_ALL_FOR_ALL;
bond_for_each_slave(bond, slave, iter) { - features = netdev_increment_features(features, - slave->dev->features, - mask); + *features = netdev_increment_features(*features, + slave->dev->features, + mask); } - features = netdev_add_tso_features(features, mask); - - return features; + *features = netdev_add_tso_features(*features, mask); }
#define BOND_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index cc1f1a7..dff9eec 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2182,8 +2182,8 @@ static int xgbe_setup_tc(struct net_device *netdev, enum tc_setup_type type, return 0; }
-static netdev_features_t xgbe_fix_features(struct net_device *netdev, - netdev_features_t features) +static void xgbe_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct xgbe_prv_data *pdata = netdev_priv(netdev); netdev_features_t vxlan_base; @@ -2191,38 +2191,36 @@ static netdev_features_t xgbe_fix_features(struct net_device *netdev, vxlan_base = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_RX_UDP_TUNNEL_PORT;
if (!pdata->hw_feat.vxn) - return features; + return;
/* VXLAN CSUM requires VXLAN base */ - if ((features & NETIF_F_GSO_UDP_TUNNEL_CSUM) && - !(features & NETIF_F_GSO_UDP_TUNNEL)) { + if ((*features & NETIF_F_GSO_UDP_TUNNEL_CSUM) && + !(*features & NETIF_F_GSO_UDP_TUNNEL)) { netdev_notice(netdev, "forcing tx udp tunnel support\n"); - features |= NETIF_F_GSO_UDP_TUNNEL; + *features |= NETIF_F_GSO_UDP_TUNNEL; }
/* Can't do one without doing the other */ - if ((features & vxlan_base) != vxlan_base) { + if ((*features & vxlan_base) != vxlan_base) { netdev_notice(netdev, "forcing both tx and rx udp tunnel support\n"); - features |= vxlan_base; + *features |= vxlan_base; }
- if (features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) { - if (!(features & NETIF_F_GSO_UDP_TUNNEL_CSUM)) { + if (*features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) { + if (!(*features & NETIF_F_GSO_UDP_TUNNEL_CSUM)) { netdev_notice(netdev, "forcing tx udp tunnel checksumming on\n"); - features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; + *features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; } } else { - if (features & NETIF_F_GSO_UDP_TUNNEL_CSUM) { + 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; + *features &= ~NETIF_F_GSO_UDP_TUNNEL_CSUM; } } - - return features; }
static int xgbe_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 4ea157e..922c600 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -1097,13 +1097,11 @@ static int alx_init_sw(struct alx_priv *alx) }
-static netdev_features_t alx_fix_features(struct net_device *netdev, - netdev_features_t features) +static void alx_fix_features(struct net_device *netdev, + netdev_features_t *features) { if (netdev->mtu > ALX_MAX_TSO_PKT_SIZE) - features &= ~(NETIF_F_TSO | NETIF_F_TSO6); - - return features; + *features &= ~(NETIF_F_TSO | NETIF_F_TSO6); }
static void alx_netif_stop(struct alx_priv *alx) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 3b51b17..f01a39f 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -504,8 +504,8 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, adapter->rx_frag_size = roundup_pow_of_two(head_size); }
-static netdev_features_t atl1c_fix_features(struct net_device *netdev, - netdev_features_t features) +static void atl1c_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_hw *hw = &adapter->hw; @@ -514,17 +514,15 @@ static netdev_features_t atl1c_fix_features(struct net_device *netdev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX;
if (hw->nic_type != athr_mt) { if (netdev->mtu > MAX_TSO_FRAME_SIZE) - features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + *features &= ~(NETIF_F_TSO | NETIF_F_TSO6); } - - return features; }
static int atl1c_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 753973a..3f66110 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -382,19 +382,17 @@ static int atl1e_set_mac_addr(struct net_device *netdev, void *p) return 0; }
-static netdev_features_t atl1e_fix_features(struct net_device *netdev, - netdev_features_t features) +static void atl1e_fix_features(struct net_device *netdev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int atl1e_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index b69298d..c4d303c 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c @@ -371,19 +371,17 @@ static void atl2_restore_vlan(struct atl2_adapter *adapter) atl2_vlan_mode(adapter->netdev, adapter->netdev->features); }
-static netdev_features_t atl2_fix_features(struct net_device *netdev, - netdev_features_t features) +static void atl2_fix_features(struct net_device *netdev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int atl2_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index 0941d07..3b0dbc3 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c @@ -237,19 +237,17 @@ static void atlx_restore_vlan(struct atlx_adapter *adapter) atlx_vlan_mode(adapter->netdev, adapter->netdev->features); }
-static netdev_features_t atlx_fix_features(struct net_device *netdev, - netdev_features_t features) +static void atlx_fix_features(struct net_device *netdev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int atlx_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index b5d954c..d745103 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -4899,38 +4899,35 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) return bnx2x_reload_if_running(dev); }
-netdev_features_t bnx2x_fix_features(struct net_device *dev, - netdev_features_t features) +void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) { struct bnx2x *bp = netdev_priv(dev);
if (pci_num_vf(bp->pdev)) { - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed = dev->features ^ *features;
/* Revert the requested changes in features if they * would require internal reload of PF in bnx2x_set_features(). */ - if (!(features & NETIF_F_RXCSUM) && !bp->disable_tpa) { - features &= ~NETIF_F_RXCSUM; - features |= dev->features & NETIF_F_RXCSUM; + if (!(*features & NETIF_F_RXCSUM) && !bp->disable_tpa) { + *features &= ~NETIF_F_RXCSUM; + *features |= dev->features & NETIF_F_RXCSUM; }
if (changed & NETIF_F_LOOPBACK) { - features &= ~NETIF_F_LOOPBACK; - features |= dev->features & NETIF_F_LOOPBACK; + *features &= ~NETIF_F_LOOPBACK; + *features |= dev->features & NETIF_F_LOOPBACK; } }
/* TPA requires Rx CSUM offloading */ - if (!(features & NETIF_F_RXCSUM)) - features &= ~NETIF_F_LRO; + if (!(*features & NETIF_F_RXCSUM)) + *features &= ~NETIF_F_LRO;
- if (!(features & NETIF_F_GRO) || !bnx2x_mtu_allows_gro(dev->mtu)) - features &= ~NETIF_F_GRO_HW; - if (features & NETIF_F_GRO_HW) - features &= ~NETIF_F_LRO; - - return features; + if (!(*features & NETIF_F_GRO) || !bnx2x_mtu_allows_gro(dev->mtu)) + *features &= ~NETIF_F_GRO_HW; + if (*features & NETIF_F_GRO_HW) + *features &= ~NETIF_F_LRO; }
int bnx2x_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index d8b1824..4c66ef3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h @@ -606,8 +606,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu); int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type); #endif
-netdev_features_t bnx2x_fix_features(struct net_device *dev, - netdev_features_t features); +void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features); int bnx2x_set_features(struct net_device *dev, netdev_features_t features);
/** diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3d5c116..5fa1d3b 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10911,39 +10911,38 @@ static bool bnxt_rfs_capable(struct bnxt *bp) #endif }
-static netdev_features_t bnxt_fix_features(struct net_device *dev, - netdev_features_t features) +static void bnxt_fix_features(struct net_device *dev, + netdev_features_t *features) { struct bnxt *bp = netdev_priv(dev); netdev_features_t vlan_features;
- if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp)) - features &= ~NETIF_F_NTUPLE; + if ((*features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp)) + *features &= ~NETIF_F_NTUPLE;
if (bp->flags & BNXT_FLAG_NO_AGG_RINGS) - features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW); + *features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
- if (!(features & NETIF_F_GRO)) - features &= ~NETIF_F_GRO_HW; + if (!(*features & NETIF_F_GRO)) + *features &= ~NETIF_F_GRO_HW;
- if (features & NETIF_F_GRO_HW) - features &= ~NETIF_F_LRO; + if (*features & NETIF_F_GRO_HW) + *features &= ~NETIF_F_LRO;
/* Both CTAG and STAG VLAN accelaration on the RX side have to be * turned on or off together. */ - vlan_features = features & BNXT_HW_FEATURE_VLAN_ALL_RX; + vlan_features = *features & BNXT_HW_FEATURE_VLAN_ALL_RX; if (vlan_features != BNXT_HW_FEATURE_VLAN_ALL_RX) { if (dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX) - features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX; + *features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX; else if (vlan_features) - features |= BNXT_HW_FEATURE_VLAN_ALL_RX; + *features |= BNXT_HW_FEATURE_VLAN_ALL_RX; } #ifdef CONFIG_BNXT_SRIOV if (BNXT_VF(bp) && bp->vf.vlan) - features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX; + *features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX; #endif - return features; }
static int bnxt_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 6f82eea..31b43fe 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -8305,15 +8305,13 @@ static void tg3_set_loopback(struct net_device *dev, netdev_features_t features) } }
-static netdev_features_t tg3_fix_features(struct net_device *dev, - netdev_features_t features) +static void tg3_fix_features(struct net_device *dev, + netdev_features_t *features) { struct tg3 *tp = netdev_priv(dev);
if (dev->mtu > ETH_DATA_LEN && tg3_flag(tp, 5780_CLASS)) - features &= ~NETIF_F_ALL_TSO; - - return features; + *features &= ~NETIF_F_ALL_TSO; }
static int tg3_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 2907e13..0230a63 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -2716,38 +2716,36 @@ static const struct udp_tunnel_nic_info liquidio_udp_tunnels = { * @request: features requested * Return: updated features list */ -static netdev_features_t liquidio_fix_features(struct net_device *netdev, - netdev_features_t request) +static void liquidio_fix_features(struct net_device *netdev, + netdev_features_t *request) { struct lio *lio = netdev_priv(netdev);
- if ((request & NETIF_F_RXCSUM) && + if ((*request & NETIF_F_RXCSUM) && !(lio->dev_capability & NETIF_F_RXCSUM)) - request &= ~NETIF_F_RXCSUM; + *request &= ~NETIF_F_RXCSUM;
- if ((request & NETIF_F_HW_CSUM) && + if ((*request & NETIF_F_HW_CSUM) && !(lio->dev_capability & NETIF_F_HW_CSUM)) - request &= ~NETIF_F_HW_CSUM; + *request &= ~NETIF_F_HW_CSUM;
- if ((request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO)) - request &= ~NETIF_F_TSO; + if ((*request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO)) + *request &= ~NETIF_F_TSO;
- if ((request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6)) - request &= ~NETIF_F_TSO6; + if ((*request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6)) + *request &= ~NETIF_F_TSO6;
- if ((request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO)) - request &= ~NETIF_F_LRO; + if ((*request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO)) + *request &= ~NETIF_F_LRO;
/*Disable LRO if RXCSUM is off */ - if (!(request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) && + if (!(*request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) && (lio->dev_capability & NETIF_F_LRO)) - request &= ~NETIF_F_LRO; + *request &= ~NETIF_F_LRO;
- if ((request & NETIF_F_HW_VLAN_CTAG_FILTER) && + if ((*request & NETIF_F_HW_VLAN_CTAG_FILTER) && !(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER)) - request &= ~NETIF_F_HW_VLAN_CTAG_FILTER; - - return request; + *request &= ~NETIF_F_HW_VLAN_CTAG_FILTER; }
/** diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index c6fe0f2..cec5b9c 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -1815,34 +1815,32 @@ static const struct udp_tunnel_nic_info liquidio_udp_tunnels = { * @param request features requested * @returns updated features list */ -static netdev_features_t liquidio_fix_features(struct net_device *netdev, - netdev_features_t request) +static void liquidio_fix_features(struct net_device *netdev, + netdev_features_t *request) { struct lio *lio = netdev_priv(netdev);
- if ((request & NETIF_F_RXCSUM) && + if ((*request & NETIF_F_RXCSUM) && !(lio->dev_capability & NETIF_F_RXCSUM)) - request &= ~NETIF_F_RXCSUM; + *request &= ~NETIF_F_RXCSUM;
- if ((request & NETIF_F_HW_CSUM) && + if ((*request & NETIF_F_HW_CSUM) && !(lio->dev_capability & NETIF_F_HW_CSUM)) - request &= ~NETIF_F_HW_CSUM; + *request &= ~NETIF_F_HW_CSUM;
- if ((request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO)) - request &= ~NETIF_F_TSO; + if ((*request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO)) + *request &= ~NETIF_F_TSO;
- if ((request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6)) - request &= ~NETIF_F_TSO6; + if ((*request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6)) + *request &= ~NETIF_F_TSO6;
- if ((request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO)) - request &= ~NETIF_F_LRO; + if ((*request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO)) + *request &= ~NETIF_F_LRO;
/* Disable LRO if RXCSUM is off */ - if (!(request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) && + if (!(*request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) && (lio->dev_capability & NETIF_F_LRO)) - request &= ~NETIF_F_LRO; - - return request; + *request &= ~NETIF_F_LRO; }
/** \brief Net device set features diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index d1667b7..9f736ef 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1773,16 +1773,14 @@ static int nicvf_config_loopback(struct nicvf *nic, return nicvf_send_msg_to_pf(nic, &mbx); }
-static netdev_features_t nicvf_fix_features(struct net_device *netdev, - netdev_features_t features) +static void nicvf_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct nicvf *nic = netdev_priv(netdev);
- if ((features & NETIF_F_LOOPBACK) && + if ((*features & NETIF_F_LOOPBACK) && netif_running(netdev) && !nic->loopback_supported) - features &= ~NETIF_F_LOOPBACK; - - return features; + *features &= ~NETIF_F_LOOPBACK; }
static int nicvf_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index e7575d4..0741ada 100644 --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c @@ -854,19 +854,16 @@ static int t1_set_mac_addr(struct net_device *dev, void *p) return 0; }
-static netdev_features_t t1_fix_features(struct net_device *dev, - netdev_features_t features) +static void t1_fix_features(struct net_device *dev, netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int t1_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 72af9d2..485cee4 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -2589,19 +2589,17 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) return 0; }
-static netdev_features_t cxgb_fix_features(struct net_device *dev, - netdev_features_t features) +static void cxgb_fix_features(struct net_device *dev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int cxgb_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 3f9434c..251b095 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -3851,14 +3851,12 @@ static void cxgb_features_check(struct sk_buff *skb, struct net_device *dev, *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
-static netdev_features_t cxgb_fix_features(struct net_device *dev, - netdev_features_t features) +static void cxgb_fix_features(struct net_device *dev, + netdev_features_t *features) { /* Disable GRO, if RX_CSUM is disabled */ - if (!(features & NETIF_F_RXCSUM)) - features &= ~NETIF_F_GRO; - - return features; + if (!(*features & NETIF_F_RXCSUM)) + *features &= ~NETIF_F_GRO; }
static const struct net_device_ops cxgb4_netdev_ops = { diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index 2842628..0ee73d8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -1173,19 +1173,17 @@ static int cxgb4vf_change_mtu(struct net_device *dev, int new_mtu) return ret; }
-static netdev_features_t cxgb4vf_fix_features(struct net_device *dev, - netdev_features_t features) +static void cxgb4vf_fix_features(struct net_device *dev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int cxgb4vf_set_features(struct net_device *dev, diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index c2ebb33..a759db0 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -1976,13 +1976,11 @@ static int gmac_change_mtu(struct net_device *netdev, int new_mtu) return 0; }
-static netdev_features_t gmac_fix_features(struct net_device *netdev, - netdev_features_t features) +static void gmac_fix_features(struct net_device *netdev, + netdev_features_t *features) { if (netdev->mtu + ETH_HLEN + VLAN_HLEN > MTU_SIZE_BIT_MASK) - features &= ~GMAC_OFFLOAD_FEATURES; - - return features; + *features &= ~GMAC_OFFLOAD_FEATURES; }
static int gmac_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 343c605..1e08c18 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -1793,20 +1793,19 @@ static int hns_nic_set_features(struct net_device *netdev, return 0; }
-static netdev_features_t hns_nic_fix_features( - struct net_device *netdev, netdev_features_t features) +static void hns_nic_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct hns_nic_priv *priv = netdev_priv(netdev);
switch (priv->enet_ver) { case AE_VERSION_1: - features &= ~(NETIF_F_TSO | NETIF_F_TSO6 | + *features &= ~(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_FILTER); break; default: break; } - return features; }
static int hns_nic_uc_sync(struct net_device *netdev, const unsigned char *addr) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 881d0b2..0be4559 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -888,18 +888,16 @@ static int hinic_set_features(struct net_device *netdev, features, false); }
-static netdev_features_t hinic_fix_features(struct net_device *netdev, - netdev_features_t features) +static void hinic_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct hinic_dev *nic_dev = netdev_priv(netdev);
/* If Rx checksum is disabled, then LRO should also be disabled */ - if (!(features & NETIF_F_RXCSUM)) { + if (!(*features & NETIF_F_RXCSUM)) { netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n"); - features &= ~NETIF_F_LRO; + *features &= ~NETIF_F_LRO; } - - return features; }
static const struct net_device_ops hinic_netdev_ops = { diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 3d9b4f9..1afffce 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -749,8 +749,8 @@ static void netdev_get_drvinfo(struct net_device *dev, strlcpy(info->version, ibmveth_driver_version, sizeof(info->version)); }
-static netdev_features_t ibmveth_fix_features(struct net_device *dev, - netdev_features_t features) +static void ibmveth_fix_features(struct net_device *dev, + netdev_features_t *features) { /* * Since the ibmveth firmware interface does not have the @@ -761,10 +761,8 @@ static netdev_features_t ibmveth_fix_features(struct net_device *dev, * checksummed. */
- if (!(features & NETIF_F_RXCSUM)) - features &= ~NETIF_F_CSUM_MASK; - - return features; + if (!(*features & NETIF_F_RXCSUM)) + *features &= ~NETIF_F_CSUM_MASK; }
static int ibmveth_set_csum_offload(struct net_device *dev, u32 data) diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index bed4f04..e333ca1 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -787,18 +787,16 @@ static int e1000_is_need_ioport(struct pci_dev *pdev) } }
-static netdev_features_t e1000_fix_features(struct net_device *netdev, - netdev_features_t features) +static void e1000_fix_features(struct net_device *netdev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int e1000_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 900b3ab..5dd183e 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -7287,25 +7287,23 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter) } }
-static netdev_features_t e1000_fix_features(struct net_device *netdev, - netdev_features_t features) +static void e1000_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw;
/* 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; + *features &= ~NETIF_F_RXFCS;
/* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int e1000_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 6df2b66..e46395a0 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3442,17 +3442,15 @@ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, * * Returns fixed-up features bits **/ -static netdev_features_t iavf_fix_features(struct net_device *netdev, - netdev_features_t features) +static void iavf_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct iavf_adapter *adapter = netdev_priv(netdev);
if (!(adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)) - features &= ~(NETIF_F_HW_VLAN_CTAG_TX | + *features &= ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER); - - return features; }
static const struct net_device_ops iavf_netdev_ops = { diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 82b59ad..2e4a53c 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2433,18 +2433,16 @@ void igb_reset(struct igb_adapter *adapter) igb_get_phy_info(hw); }
-static netdev_features_t igb_fix_features(struct net_device *netdev, - netdev_features_t features) +static void igb_fix_features(struct net_device *netdev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int igb_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index b9a2fbd..f7545a6 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4907,18 +4907,16 @@ static void igc_get_stats64(struct net_device *netdev, spin_unlock(&adapter->stats64_lock); }
-static netdev_features_t igc_fix_features(struct net_device *netdev, - netdev_features_t features) +static void igc_fix_features(struct net_device *netdev, + netdev_features_t *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. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) - features |= NETIF_F_HW_VLAN_CTAG_TX; + if (*features & NETIF_F_HW_VLAN_CTAG_RX) + *features |= NETIF_F_HW_VLAN_CTAG_TX; else - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int igc_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 1588376..34c1bfc 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -293,17 +293,15 @@ ixgb_reset(struct ixgb_adapter *adapter) } }
-static netdev_features_t -ixgb_fix_features(struct net_device *netdev, netdev_features_t features) +static void ixgb_fix_features(struct net_device *netdev, + netdev_features_t *features) { /* * Tx VLAN insertion does not work per HW design when Rx stripping is * disabled. */ - if (!(features & NETIF_F_HW_VLAN_CTAG_RX)) - features &= ~NETIF_F_HW_VLAN_CTAG_TX; - - return features; + if (!(*features & NETIF_F_HW_VLAN_CTAG_RX)) + *features &= ~NETIF_F_HW_VLAN_CTAG_TX; }
static int diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index e39d398..c43c99a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -9682,25 +9682,23 @@ void ixgbe_do_reset(struct net_device *netdev) ixgbe_reset(adapter); }
-static netdev_features_t ixgbe_fix_features(struct net_device *netdev, - netdev_features_t features) +static void ixgbe_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct ixgbe_adapter *adapter = netdev_priv(netdev);
/* If Rx checksum is disabled, then RSC/LRO should also be disabled */ - if (!(features & NETIF_F_RXCSUM)) - features &= ~NETIF_F_LRO; + if (!(*features & NETIF_F_RXCSUM)) + *features &= ~NETIF_F_LRO;
/* Turn off LRO if not RSC capable */ if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) - features &= ~NETIF_F_LRO; + *features &= ~NETIF_F_LRO;
- if (adapter->xdp_prog && (features & NETIF_F_LRO)) { + if (adapter->xdp_prog && (*features & NETIF_F_LRO)) { e_dev_err("LRO is not supported with XDP\n"); - features &= ~NETIF_F_LRO; + *features &= ~NETIF_F_LRO; } - - return features; }
static void ixgbe_reset_l2fw_offload(struct ixgbe_adapter *adapter) diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 1251b74..7b8eefd 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c @@ -2670,12 +2670,11 @@ jme_set_msglevel(struct net_device *netdev, u32 value) jme->msg_enable = value; }
-static netdev_features_t -jme_fix_features(struct net_device *netdev, netdev_features_t features) +static void jme_fix_features(struct net_device *netdev, + netdev_features_t *features) { if (netdev->mtu > 1900) - features &= ~(NETIF_F_ALL_TSO | NETIF_F_CSUM_MASK); - return features; + *features &= ~(NETIF_F_ALL_TSO | NETIF_F_CSUM_MASK); }
static int diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 5d1007e..e259338 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3770,19 +3770,17 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) return 0; }
-static netdev_features_t mvneta_fix_features(struct net_device *dev, - netdev_features_t features) +static void mvneta_fix_features(struct net_device *dev, + netdev_features_t *features) { struct mvneta_port *pp = netdev_priv(dev);
if (pp->tx_csum_limit && dev->mtu > pp->tx_csum_limit) { - features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); + *features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); netdev_info(dev, "Disable IP checksum for MTU greater than %dB\n", pp->tx_csum_limit); } - - return features; }
/* Get mac address */ diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index 22b7af0..1709313 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1784,22 +1784,20 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev) return NETDEV_TX_OK; }
-static netdev_features_t otx2_fix_features(struct net_device *dev, - netdev_features_t features) +static void otx2_fix_features(struct net_device *dev, + netdev_features_t *features) { /* check if n-tuple filters are ON */ - if ((features & NETIF_F_HW_TC) && (dev->features & NETIF_F_NTUPLE)) { + if ((*features & NETIF_F_HW_TC) && (dev->features & NETIF_F_NTUPLE)) { netdev_info(dev, "Disabling n-tuple filters\n"); - features &= ~NETIF_F_NTUPLE; + *features &= ~NETIF_F_NTUPLE; }
/* check if tc hw offload is ON */ - if ((features & NETIF_F_NTUPLE) && (dev->features & NETIF_F_HW_TC)) { + if ((*features & NETIF_F_NTUPLE) && (dev->features & NETIF_F_HW_TC)) { netdev_info(dev, "Disabling TC hardware offload\n"); - features &= ~NETIF_F_HW_TC; + *features &= ~NETIF_F_HW_TC; } - - return features; }
static void otx2_set_rx_mode(struct net_device *netdev) diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index dc9dd77..dd4705c 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -4354,8 +4354,8 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom return sky2_vpd_write(sky2->hw, cap, data, eeprom->offset, eeprom->len); }
-static netdev_features_t sky2_fix_features(struct net_device *dev, - netdev_features_t features) +static void sky2_fix_features(struct net_device *dev, + netdev_features_t *features) { const struct sky2_port *sky2 = netdev_priv(dev); const struct sky2_hw *hw = sky2->hw; @@ -4365,18 +4365,16 @@ 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 | NETIF_F_SG | NETIF_F_CSUM_MASK); + *features &= ~(NETIF_F_TSO | NETIF_F_SG | NETIF_F_CSUM_MASK); }
/* Some hardware requires receive checksum for RSS to work. */ - if ( (features & NETIF_F_RXHASH) && - !(features & NETIF_F_RXCSUM) && - (sky2->hw->flags & SKY2_HW_RSS_CHKSUM)) { + if ((*features & NETIF_F_RXHASH) && + !(*features & NETIF_F_RXCSUM) && + (sky2->hw->flags & SKY2_HW_RSS_CHKSUM)) { netdev_info(dev, "receive hashing forces receive checksum\n"); - features |= NETIF_F_RXCSUM; + *features |= NETIF_F_RXCSUM; } - - return features; }
static int sky2_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 398c23c..6a6ef1c 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -2021,21 +2021,19 @@ static int mtk_hwlro_get_fdir_all(struct net_device *dev, return 0; }
-static netdev_features_t mtk_fix_features(struct net_device *dev, - netdev_features_t features) +static void mtk_fix_features(struct net_device *dev, + netdev_features_t *features) { - if (!(features & NETIF_F_LRO)) { + if (!(*features & NETIF_F_LRO)) { struct mtk_mac *mac = netdev_priv(dev); int ip_cnt = mtk_hwlro_get_ip_cnt(mac);
if (ip_cnt) { netdev_info(dev, "RX flow is programmed, LRO should keep on\n");
- features |= NETIF_F_LRO; + *features |= NETIF_F_LRO; } } - - return features; }
static int mtk_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index bc504dc..06bc81d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -2479,8 +2479,8 @@ static int mlx4_en_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) } }
-static netdev_features_t mlx4_en_fix_features(struct net_device *netdev, - netdev_features_t features) +static void mlx4_en_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct mlx4_en_priv *en_priv = netdev_priv(netdev); struct mlx4_en_dev *mdev = en_priv->mdev; @@ -2489,13 +2489,11 @@ static netdev_features_t mlx4_en_fix_features(struct net_device *netdev, * enable/disable make sure S-TAG flag is always in same state as * C-TAG. */ - if (features & NETIF_F_HW_VLAN_CTAG_RX && + if (*features & NETIF_F_HW_VLAN_CTAG_RX && !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) - features |= NETIF_F_HW_VLAN_STAG_RX; + *features |= NETIF_F_HW_VLAN_STAG_RX; else - features &= ~NETIF_F_HW_VLAN_STAG_RX; - - return features; + *features &= ~NETIF_F_HW_VLAN_STAG_RX; }
static int mlx4_en_set_features(struct net_device *netdev, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 8f5046a..d8c82d3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3307,8 +3307,8 @@ static netdev_features_t mlx5e_fix_uplink_rep_features(struct net_device *netdev return features; }
-static netdev_features_t mlx5e_fix_features(struct net_device *netdev, - netdev_features_t features) +static void mlx5e_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_params *params; @@ -3320,20 +3320,20 @@ 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; + *features &= ~NETIF_F_HW_VLAN_CTAG_RX; if (!params->vlan_strip_disable) netdev_warn(netdev, "Dropping C-tag vlan stripping offload due to S-tag vlan\n"); }
if (!MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_STRIDING_RQ)) { - if (features & NETIF_F_LRO) { + if (*features & NETIF_F_LRO) { netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n"); - features &= ~NETIF_F_LRO; + *features &= ~NETIF_F_LRO; } }
if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) { - features &= ~NETIF_F_RXHASH; + *features &= ~NETIF_F_RXHASH; if (netdev->features & NETIF_F_RXHASH) netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n"); } @@ -3342,8 +3342,6 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, features = mlx5e_fix_uplink_rep_features(netdev, features);
mutex_unlock(&priv->state_lock); - - return features; }
static bool mlx5e_xsk_validate_mtu(struct net_device *netdev, diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index df4a3f3..5f720e9 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -2639,19 +2639,17 @@ static void vxge_poll_vp_lockup(struct timer_list *t) mod_timer(&vdev->vp_lockup_timer, jiffies + HZ / 1000); }
-static netdev_features_t vxge_fix_features(struct net_device *dev, - netdev_features_t features) +static void vxge_fix_features(struct net_device *dev, + netdev_features_t *features) { - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed = dev->features ^ *features;
/* Enabling RTH requires some of the logic in vxge_device_register and a * vpath reset. Due to these restrictions, only allow modification * while the interface is down. */ if ((changed & NETIF_F_RXHASH) && netif_running(dev)) - features ^= NETIF_F_RXHASH; - - return features; + *features ^= NETIF_F_RXHASH; }
static int vxge_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index 466e898..ef14623 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -232,11 +232,11 @@ static int nfp_repr_open(struct net_device *netdev) return err; }
-static netdev_features_t -nfp_repr_fix_features(struct net_device *netdev, netdev_features_t features) +static void nfp_repr_fix_features(struct net_device *netdev, + netdev_features_t *features) { struct nfp_repr *repr = netdev_priv(netdev); - netdev_features_t old_features = features; + netdev_features_t old_features = *features; netdev_features_t lower_features; struct net_device *lower_dev;
@@ -246,11 +246,9 @@ nfp_repr_fix_features(struct net_device *netdev, netdev_features_t features) if (lower_features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) lower_features |= NETIF_F_HW_CSUM;
- netdev_intersect_features(&features, features, lower_features); - features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC); - features |= NETIF_F_LLTX; - - return features; + netdev_intersect_features(features, *features, lower_features); + *features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC); + *features |= NETIF_F_LLTX; }
const struct net_device_ops nfp_repr_netdev_ops = { diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 8724d6a..cce9f8d 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -4920,14 +4920,12 @@ static int nv_set_loopback(struct net_device *dev, netdev_features_t features) return retval; }
-static netdev_features_t nv_fix_features(struct net_device *dev, - netdev_features_t features) +static void nv_fix_features(struct net_device *dev, + netdev_features_t *features) { /* vlan is dependent on rx checksum offload */ - if (features & (NETIF_F_HW_VLAN_CTAG_TX|NETIF_F_HW_VLAN_CTAG_RX)) - features |= NETIF_F_RXCSUM; - - return features; + if (*features & (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX)) + *features |= NETIF_F_RXCSUM; }
static void nv_vlan_mode(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 344ea11..2516688 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -517,16 +517,14 @@ static void netxen_set_multicast_list(struct net_device *dev) adapter->set_multi(dev); }
-static netdev_features_t netxen_fix_features(struct net_device *dev, - netdev_features_t features) +static void netxen_fix_features(struct net_device *dev, + netdev_features_t *features) { - if (!(features & NETIF_F_RXCSUM)) { + if (!(*features & NETIF_F_RXCSUM)) { netdev_info(dev, "disabling LRO as RXCSUM is off\n");
- features &= ~NETIF_F_LRO; + *features &= ~NETIF_F_LRO; } - - return features; }
static int netxen_set_features(struct net_device *dev, diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h index e476561..ed48bae 100644 --- a/drivers/net/ethernet/qlogic/qede/qede.h +++ b/drivers/net/ethernet/qlogic/qede/qede.h @@ -545,8 +545,7 @@ int qede_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid); void qede_vlan_mark_nonconfigured(struct qede_dev *edev); int qede_configure_vlan_filters(struct qede_dev *edev);
-netdev_features_t qede_fix_features(struct net_device *dev, - netdev_features_t features); +void qede_fix_features(struct net_device *dev, netdev_features_t *features); int qede_set_features(struct net_device *dev, netdev_features_t features); void qede_set_rx_mode(struct net_device *ndev); void qede_config_rx_mode(struct net_device *ndev); diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index a2e4dfb..d92870c 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -912,16 +912,13 @@ static void qede_set_features_reload(struct qede_dev *edev, edev->ndev->features = args->u.features; }
-netdev_features_t qede_fix_features(struct net_device *dev, - netdev_features_t features) +void qede_fix_features(struct net_device *dev, netdev_features_t *features) { struct qede_dev *edev = netdev_priv(dev);
if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE || - !(features & NETIF_F_GRO)) - features &= ~NETIF_F_GRO_HW; - - return features; + !(*features & NETIF_F_GRO)) + *features &= ~NETIF_F_GRO_HW; }
int qede_set_features(struct net_device *dev, netdev_features_t features) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index be7abee..7fbf895 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1622,8 +1622,7 @@ int qlcnic_82xx_read_phys_port_id(struct qlcnic_adapter *); int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu); int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *, u32); int qlcnic_change_mtu(struct net_device *netdev, int new_mtu); -netdev_features_t qlcnic_fix_features(struct net_device *netdev, - netdev_features_t features); +void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features); int qlcnic_set_features(struct net_device *netdev, netdev_features_t features); int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable); void qlcnic_update_cmd_producer(struct qlcnic_host_tx_ring *); diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 4b8bc46..e6ed7f8 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -1053,8 +1053,7 @@ static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter, return features; }
-netdev_features_t qlcnic_fix_features(struct net_device *netdev, - netdev_features_t features) +void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); netdev_features_t changed; @@ -1062,10 +1061,10 @@ netdev_features_t qlcnic_fix_features(struct net_device *netdev, if (qlcnic_82xx_check(adapter) && (adapter->flags & QLCNIC_ESWITCH_ENABLED)) { if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) { - features = qlcnic_process_flags(adapter, features); + *features = qlcnic_process_flags(adapter, *features); } else { - changed = features ^ netdev->features; - features ^= changed & (NETIF_F_RXCSUM | + changed = *features ^ netdev->features; + *features ^= changed & (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | @@ -1073,10 +1072,8 @@ netdev_features_t qlcnic_fix_features(struct net_device *netdev, } }
- if (!(features & NETIF_F_RXCSUM)) - features &= ~NETIF_F_LRO; - - return features; + if (!(*features & NETIF_F_RXCSUM)) + *features &= ~NETIF_F_LRO; }
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 3d93348..e6b6eb3 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -1465,19 +1465,17 @@ static int rtl8169_get_regs_len(struct net_device *dev) return R8169_REGS_SIZE; }
-static netdev_features_t rtl8169_fix_features(struct net_device *dev, - netdev_features_t features) +static void rtl8169_fix_features(struct net_device *dev, + netdev_features_t *features) { struct rtl8169_private *tp = netdev_priv(dev);
if (dev->mtu > TD_MSS_MAX) - features &= ~NETIF_F_ALL_TSO; + *features &= ~NETIF_F_ALL_TSO;
if (dev->mtu > ETH_DATA_LEN && tp->mac_version > RTL_GIGA_MAC_VER_06) - features &= ~(NETIF_F_CSUM_MASK | NETIF_F_ALL_TSO); - - return features; + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_ALL_TSO); }
static void rtl_set_rx_config_features(struct rtl8169_private *tp, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a2aa75c..14c8c1c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5450,16 +5450,16 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) return 0; }
-static netdev_features_t stmmac_fix_features(struct net_device *dev, - netdev_features_t features) +static void stmmac_fix_features(struct net_device *dev, + netdev_features_t *features) { struct stmmac_priv *priv = netdev_priv(dev);
if (priv->plat->rx_coe == STMMAC_RX_COE_NONE) - features &= ~NETIF_F_RXCSUM; + *features &= ~NETIF_F_RXCSUM;
if (!priv->plat->tx_coe) - features &= ~NETIF_F_CSUM_MASK; + *features &= ~NETIF_F_CSUM_MASK;
/* Some GMAC devices have a bugged Jumbo frame support that * needs to have the Tx COE disabled for oversized frames @@ -5467,17 +5467,15 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, * the TX csum insertion in the TDES and not use SF. */ if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN)) - features &= ~NETIF_F_CSUM_MASK; + *features &= ~NETIF_F_CSUM_MASK;
/* Disable tso if asked by ethtool */ if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { - if (features & NETIF_F_TSO) + if (*features & NETIF_F_TSO) priv->tso = true; else priv->tso = false; } - - return features; }
static int stmmac_set_features(struct net_device *netdev, diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 382bebc..5371328 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1919,21 +1919,19 @@ static int netvsc_set_ringparam(struct net_device *ndev, return ret; }
-static netdev_features_t netvsc_fix_features(struct net_device *ndev, - netdev_features_t features) +static void netvsc_fix_features(struct net_device *ndev, + netdev_features_t *features) { struct net_device_context *ndevctx = netdev_priv(ndev); struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev);
if (!nvdev || nvdev->destroy) - return features; + return;
- if ((features & NETIF_F_LRO) && netvsc_xdp_get(nvdev)) { - features ^= NETIF_F_LRO; + if ((*features & NETIF_F_LRO) && netvsc_xdp_get(nvdev)) { + *features ^= NETIF_F_LRO; netdev_info(ndev, "Skip LRO - unsupported with XDP\n"); } - - return features; }
static int netvsc_set_features(struct net_device *ndev, diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index c0b21a5..8fcc91c 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -235,19 +235,17 @@ static netdev_tx_t ipvlan_start_xmit(struct sk_buff *skb, return ret; }
-static netdev_features_t ipvlan_fix_features(struct net_device *dev, - netdev_features_t features) +static void ipvlan_fix_features(struct net_device *dev, + netdev_features_t *features) { struct ipvl_dev *ipvlan = netdev_priv(dev);
- features |= NETIF_F_ALL_FOR_ALL; - features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES); - features = netdev_increment_features(ipvlan->phy_dev->features, - features, features); - features |= IPVLAN_ALWAYS_ON; - features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON); - - return features; + *features |= NETIF_F_ALL_FOR_ALL; + *features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES); + *features = netdev_increment_features(ipvlan->phy_dev->features, + *features, *features); + *features |= IPVLAN_ALWAYS_ON; + *features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON); }
static void ipvlan_change_rx_flags(struct net_device *dev, int change) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 93dc48b..601b833 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3470,20 +3470,20 @@ static void macsec_dev_uninit(struct net_device *dev) free_percpu(dev->tstats); }
-static netdev_features_t macsec_fix_features(struct net_device *dev, - netdev_features_t features) +static void macsec_fix_features(struct net_device *dev, + netdev_features_t *features) { struct macsec_dev *macsec = macsec_priv(dev); struct net_device *real_dev = macsec->real_dev;
- if (macsec_is_offloaded(macsec)) - return REAL_DEV_FEATURES(real_dev); + if (macsec_is_offloaded(macsec)) { + *features = REAL_DEV_FEATURES(real_dev); + return; + }
- features &= (real_dev->features & SW_MACSEC_FEATURES) | + *features &= (real_dev->features & SW_MACSEC_FEATURES) | NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES; - features |= NETIF_F_LLTX; - - return features; + *features |= NETIF_F_LLTX; }
static int macsec_dev_open(struct net_device *dev) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 35f46ad..27cd9c0 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1067,23 +1067,21 @@ static int macvlan_ethtool_get_ts_info(struct net_device *dev, return 0; }
-static netdev_features_t macvlan_fix_features(struct net_device *dev, - netdev_features_t features) +static void macvlan_fix_features(struct net_device *dev, + netdev_features_t *features) { struct macvlan_dev *vlan = netdev_priv(dev); netdev_features_t lowerdev_features = vlan->lowerdev->features; netdev_features_t mask;
- features |= NETIF_F_ALL_FOR_ALL; - features &= (vlan->set_features | ~MACVLAN_FEATURES); - mask = features; + *features |= NETIF_F_ALL_FOR_ALL; + *features &= (vlan->set_features | ~MACVLAN_FEATURES); + mask = *features;
- lowerdev_features &= (features | ~NETIF_F_LRO); - features = netdev_increment_features(lowerdev_features, features, mask); - features |= ALWAYS_ON_FEATURES; - features &= (ALWAYS_ON_FEATURES | MACVLAN_FEATURES); - - return features; + lowerdev_features &= (*features | ~NETIF_F_LRO); + *features = netdev_increment_features(lowerdev_features, *features, mask); + *features |= ALWAYS_ON_FEATURES; + *features &= (ALWAYS_ON_FEATURES | MACVLAN_FEATURES); }
#ifdef CONFIG_NET_POLL_CONTROLLER diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index dd7917c..340be92 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -1995,28 +1995,26 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev) return err; }
-static netdev_features_t team_fix_features(struct net_device *dev, - netdev_features_t features) +static void team_fix_features(struct net_device *dev, + netdev_features_t *features) { struct team_port *port; struct team *team = netdev_priv(dev); netdev_features_t mask;
- mask = features; - features &= ~NETIF_F_ONE_FOR_ALL; - features |= NETIF_F_ALL_FOR_ALL; + mask = *features; + *features &= ~NETIF_F_ONE_FOR_ALL; + *features |= NETIF_F_ALL_FOR_ALL;
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { - features = netdev_increment_features(features, - port->dev->features, - mask); + *features = netdev_increment_features(*features, + port->dev->features, + mask); } rcu_read_unlock();
- features = netdev_add_tso_features(features, mask); - - return features; + *features = netdev_add_tso_features(*features, mask); }
static int team_change_carrier(struct net_device *dev, bool new_carrier) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 2ced021..ca0aa4c 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1079,12 +1079,13 @@ static void tun_net_mclist(struct net_device *dev) */ }
-static netdev_features_t tun_net_fix_features(struct net_device *dev, - netdev_features_t features) +static void tun_net_fix_features(struct net_device *dev, + netdev_features_t *features) { struct tun_struct *tun = netdev_priv(dev);
- return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); + *features = (*features & tun->set_features) | + (*features & ~TUN_USER_FEATURES); }
static void tun_set_headroom(struct net_device *dev, int new_hr) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 50eb43e..82c900d 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1382,8 +1382,8 @@ static int veth_get_iflink(const struct net_device *dev) return iflink; }
-static netdev_features_t veth_fix_features(struct net_device *dev, - netdev_features_t features) +static void veth_fix_features(struct net_device *dev, + netdev_features_t *features) { struct veth_priv *priv = netdev_priv(dev); struct net_device *peer; @@ -1393,12 +1393,10 @@ static netdev_features_t veth_fix_features(struct net_device *dev, struct veth_priv *peer_priv = netdev_priv(peer);
if (peer_priv->_xdp_prog) - features &= ~NETIF_F_GSO_SOFTWARE; + *features &= ~NETIF_F_GSO_SOFTWARE; } if (priv->_xdp_prog) - features |= NETIF_F_GRO; - - return features; + *features |= NETIF_F_GRO; }
static int veth_set_features(struct net_device *dev, diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 6780f1e..9b3acf4 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -246,14 +246,12 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) ethtool_sprintf(&buf, vmxnet3_global_stats[i].desc); }
-netdev_features_t vmxnet3_fix_features(struct net_device *netdev, - netdev_features_t features) +void vmxnet3_fix_features(struct net_device *netdev, + netdev_features_t *features) { /* If Rx checksum is disabled, then LRO should also be disabled */ - if (!(features & NETIF_F_RXCSUM)) - features &= ~NETIF_F_LRO; - - return features; + if (!(*features & NETIF_F_RXCSUM)) + *features &= ~NETIF_F_LRO; }
void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index a711759..aed4e1b 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h @@ -475,8 +475,8 @@ vmxnet3_tq_destroy_all(struct vmxnet3_adapter *adapter); void vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter);
-netdev_features_t -vmxnet3_fix_features(struct net_device *netdev, netdev_features_t features); +void +vmxnet3_fix_features(struct net_device *netdev, netdev_features_t *features);
void vmxnet3_features_check(struct sk_buff *skb, diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index c58996c..f964f0a 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c @@ -374,23 +374,21 @@ static int xenvif_change_mtu(struct net_device *dev, int mtu) return 0; }
-static netdev_features_t xenvif_fix_features(struct net_device *dev, - netdev_features_t features) +static void xenvif_fix_features(struct net_device *dev, + netdev_features_t *features) { struct xenvif *vif = netdev_priv(dev);
if (!vif->can_sg) - features &= ~NETIF_F_SG; + *features &= ~NETIF_F_SG; if (~(vif->gso_mask) & GSO_BIT(TCPV4)) - features &= ~NETIF_F_TSO; + *features &= ~NETIF_F_TSO; if (~(vif->gso_mask) & GSO_BIT(TCPV6)) - features &= ~NETIF_F_TSO6; + *features &= ~NETIF_F_TSO6; if (!vif->ip_csum) - features &= ~NETIF_F_IP_CSUM; + *features &= ~NETIF_F_IP_CSUM; if (!vif->ipv6_csum) - features &= ~NETIF_F_IPV6_CSUM; - - return features; + *features &= ~NETIF_F_IPV6_CSUM; }
static const struct xenvif_stat { diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index a8c2d41..e40de65 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1340,29 +1340,27 @@ static void xennet_release_rx_bufs(struct netfront_queue *queue) spin_unlock_bh(&queue->rx_lock); }
-static netdev_features_t xennet_fix_features(struct net_device *dev, - netdev_features_t features) +static void xennet_fix_features(struct net_device *dev, + netdev_features_t *features) { struct netfront_info *np = netdev_priv(dev);
- if (features & NETIF_F_SG && + if (*features & NETIF_F_SG && !xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0)) - features &= ~NETIF_F_SG; + *features &= ~NETIF_F_SG;
- if (features & NETIF_F_IPV6_CSUM && + if (*features & NETIF_F_IPV6_CSUM && !xenbus_read_unsigned(np->xbdev->otherend, "feature-ipv6-csum-offload", 0)) - features &= ~NETIF_F_IPV6_CSUM; + *features &= ~NETIF_F_IPV6_CSUM;
- if (features & NETIF_F_TSO && + if (*features & NETIF_F_TSO && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0)) - features &= ~NETIF_F_TSO; + *features &= ~NETIF_F_TSO;
- if (features & NETIF_F_TSO6 && + if (*features & NETIF_F_TSO6 && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0)) - features &= ~NETIF_F_TSO6; - - return features; + *features &= ~NETIF_F_TSO6; }
static int xennet_set_features(struct net_device *dev, diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 06d02e2..2b26075 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -1094,7 +1094,7 @@ int qeth_hw_trap(struct qeth_card *, enum qeth_diags_trap_action); 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); +void qeth_fix_features(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); diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 50dde2c..a472f47 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -6931,26 +6931,24 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) } EXPORT_SYMBOL_GPL(qeth_set_features);
-netdev_features_t qeth_fix_features(struct net_device *dev, - netdev_features_t features) +void qeth_fix_features(struct net_device *dev, netdev_features_t *features) { struct qeth_card *card = dev->ml_priv;
QETH_CARD_TEXT(card, 2, "fixfeat"); if (!qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) - features &= ~NETIF_F_IP_CSUM; + *features &= ~NETIF_F_IP_CSUM; if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) - features &= ~NETIF_F_IPV6_CSUM; + *features &= ~NETIF_F_IPV6_CSUM; if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM) && !qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) - features &= ~NETIF_F_RXCSUM; + *features &= ~NETIF_F_RXCSUM; if (!qeth_is_supported(card, IPA_OUTBOUND_TSO)) - features &= ~NETIF_F_TSO; + *features &= ~NETIF_F_TSO; if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO)) - features &= ~NETIF_F_TSO6; + *features &= ~NETIF_F_TSO6;
- QETH_CARD_HEX(card, 2, &features, sizeof(features)); - return features; + QETH_CARD_HEX(card, 2, features, sizeof(*features)); } EXPORT_SYMBOL_GPL(qeth_fix_features);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 842b29ee..3e000d9 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1476,8 +1476,8 @@ struct net_device_ops { bool all_slaves); struct net_device* (*ndo_sk_get_lower_dev)(struct net_device *dev, struct sock *sk); - netdev_features_t (*ndo_fix_features)(struct net_device *dev, - netdev_features_t features); + void (*ndo_fix_features)(struct net_device *dev, + netdev_features_t *features); int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); int (*ndo_neigh_construct)(struct net_device *dev, diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 2987201..9f90a58 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -633,11 +633,11 @@ void vlan_dev_uninit(struct net_device *dev) } }
-static netdev_features_t vlan_dev_fix_features(struct net_device *dev, - netdev_features_t features) +static void vlan_dev_fix_features(struct net_device *dev, + netdev_features_t *features) { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; - netdev_features_t old_features = features; + netdev_features_t old_features = *features; netdev_features_t lower_features;
netdev_intersect_features(&lower_features, @@ -649,11 +649,9 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev, */ if (lower_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) lower_features |= NETIF_F_HW_CSUM; - netdev_intersect_features(&features, features, lower_features); - features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE); - features |= NETIF_F_LLTX; - - return features; + netdev_intersect_features(features, *features, lower_features); + *features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE); + *features |= NETIF_F_LLTX; }
static int vlan_ethtool_get_link_ksettings(struct net_device *dev, diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 8d6bab2..622559a 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -288,12 +288,11 @@ static int br_get_link_ksettings(struct net_device *dev, return 0; }
-static netdev_features_t br_fix_features(struct net_device *dev, - netdev_features_t features) +static void br_fix_features(struct net_device *dev, netdev_features_t *features) { struct net_bridge *br = netdev_priv(dev);
- return br_features_recompute(br, features); + *features = br_features_recompute(br, *features); }
#ifdef CONFIG_NET_POLL_CONTROLLER diff --git a/net/core/dev.c b/net/core/dev.c index e7719c2..ac1ab4b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9921,7 +9921,7 @@ int __netdev_update_features(struct net_device *dev) netdev_get_wanted_features(dev, &features);
if (dev->netdev_ops->ndo_fix_features) - features = dev->netdev_ops->ndo_fix_features(dev, features); + dev->netdev_ops->ndo_fix_features(dev, &features);
/* driver might be less strict about feature dependencies */ features = netdev_fix_features(dev, features); diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 26c3240..acaf48a 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -201,12 +201,12 @@ static netdev_features_t hsr_features_recompute(struct hsr_priv *hsr, return features; }
-static netdev_features_t hsr_fix_features(struct net_device *dev, - netdev_features_t features) +static void hsr_fix_features(struct net_device *dev, + netdev_features_t *features) { struct hsr_priv *hsr = netdev_priv(dev);
- return hsr_features_recompute(hsr, features); + *features = hsr_features_recompute(hsr, *features); }
static netdev_tx_t hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev)
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_fix_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/core/dev.c | 78 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 40 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c index ac1ab4b..fe0524d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9814,99 +9814,97 @@ static void netdev_sync_lower_features(struct net_device *upper, } }
-static netdev_features_t netdev_fix_features(struct net_device *dev, - netdev_features_t features) +static void netdev_fix_features(struct net_device *dev, + netdev_features_t *features) { /* Fix illegal checksum combinations */ - if ((features & NETIF_F_HW_CSUM) && - (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { + if ((*features & NETIF_F_HW_CSUM) && + (*features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))) { netdev_warn(dev, "mixed HW and IP checksum settings.\n"); - features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); + *features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); }
/* TSO requires that SG is present as well. */ - if ((features & NETIF_F_ALL_TSO) && !(features & NETIF_F_SG)) { + if ((*features & NETIF_F_ALL_TSO) && !(*features & NETIF_F_SG)) { netdev_dbg(dev, "Dropping TSO features since no SG feature.\n"); - features &= ~NETIF_F_ALL_TSO; + *features &= ~NETIF_F_ALL_TSO; }
- if ((features & NETIF_F_TSO) && !(features & NETIF_F_HW_CSUM) && - !(features & NETIF_F_IP_CSUM)) { + 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; + *features &= ~NETIF_F_TSO; + *features &= ~NETIF_F_TSO_ECN; }
- if ((features & NETIF_F_TSO6) && !(features & NETIF_F_HW_CSUM) && - !(features & NETIF_F_IPV6_CSUM)) { + 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; + *features &= ~NETIF_F_TSO6; }
/* 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; + if ((*features & NETIF_F_TSO_MANGLEID) && !(*features & NETIF_F_TSO)) + *features &= ~NETIF_F_TSO_MANGLEID;
/* TSO ECN requires that TSO is present as well. */ - if ((features & NETIF_F_ALL_TSO) == NETIF_F_TSO_ECN) - features &= ~NETIF_F_TSO_ECN; + if ((*features & NETIF_F_ALL_TSO) == NETIF_F_TSO_ECN) + *features &= ~NETIF_F_TSO_ECN;
/* Software GSO depends on SG. */ - if ((features & NETIF_F_GSO) && !(features & NETIF_F_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; + *features &= ~NETIF_F_GSO; }
/* GSO partial features require GSO partial be set */ - if ((features & dev->gso_partial_features) && - !(features & NETIF_F_GSO_PARTIAL)) { + if ((*features & dev->gso_partial_features) && + !(*features & NETIF_F_GSO_PARTIAL)) { netdev_dbg(dev, "Dropping partially supported GSO features since no GSO partial.\n"); - features &= ~dev->gso_partial_features; + *features &= ~dev->gso_partial_features; }
- if (!(features & NETIF_F_RXCSUM)) { + if (!(*features & NETIF_F_RXCSUM)) { /* NETIF_F_GRO_HW implies doing RXCSUM since every packet * successfully merged by hardware must also have the * checksum verified by hardware. If the user does not * want to enable RXCSUM, logically, we should disable GRO_HW. */ - if (features & NETIF_F_GRO_HW) { + if (*features & NETIF_F_GRO_HW) { netdev_dbg(dev, "Dropping NETIF_F_GRO_HW since no RXCSUM feature.\n"); - features &= ~NETIF_F_GRO_HW; + *features &= ~NETIF_F_GRO_HW; } }
/* LRO/HW-GRO features cannot be combined with RX-FCS */ - if (features & NETIF_F_RXFCS) { - if (features & NETIF_F_LRO) { + 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; + *features &= ~NETIF_F_LRO; }
- if (features & NETIF_F_GRO_HW) { + if (*features & NETIF_F_GRO_HW) { netdev_dbg(dev, "Dropping HW-GRO feature since RX-FCS is requested.\n"); - features &= ~NETIF_F_GRO_HW; + *features &= ~NETIF_F_GRO_HW; } }
- if (features & NETIF_F_HW_TLS_TX) { - bool ip_csum = (features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) == + if (*features & NETIF_F_HW_TLS_TX) { + bool ip_csum = (*features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) == (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); - bool hw_csum = features & NETIF_F_HW_CSUM; + bool hw_csum = *features & NETIF_F_HW_CSUM;
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; + *features &= ~NETIF_F_HW_TLS_TX; } }
- if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { + 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; + *features &= ~NETIF_F_HW_TLS_RX; } - - return features; }
int __netdev_update_features(struct net_device *dev) @@ -9924,7 +9922,7 @@ int __netdev_update_features(struct net_device *dev) dev->netdev_ops->ndo_fix_features(dev, &features);
/* driver might be less strict about feature dependencies */ - features = netdev_fix_features(dev, features); + netdev_fix_features(dev, &features);
/* some features can't be enabled if they're off on an upper device */ netdev_for_each_upper_dev_rcu(dev, upper, iter)
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_sync_upper_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/core/dev.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c index fe0524d..b7632f0 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9770,8 +9770,9 @@ static void net_set_todo(struct net_device *dev) dev_net(dev)->dev_unreg_count++; }
-static netdev_features_t netdev_sync_upper_features(struct net_device *lower, - struct net_device *upper, netdev_features_t features) +static void netdev_sync_upper_features(struct net_device *lower, + struct net_device *upper, + netdev_features_t *features) { netdev_features_t upper_disables = NETIF_F_UPPER_DISABLES; netdev_features_t feature; @@ -9779,15 +9780,13 @@ static netdev_features_t netdev_sync_upper_features(struct net_device *lower,
for_each_netdev_feature(upper_disables, feature_bit) { feature = __NETIF_F_BIT(feature_bit); - if (!(upper->wanted_features & feature) - && (features & feature)) { + if (!(upper->wanted_features & feature) && + (*features & feature)) { netdev_dbg(lower, "Dropping feature %pNF, upper dev %s has it off.\n", &feature, upper->name); - features &= ~feature; + *features &= ~feature; } } - - return features; }
static void netdev_sync_lower_features(struct net_device *upper, @@ -9926,7 +9925,7 @@ int __netdev_update_features(struct net_device *dev)
/* some features can't be enabled if they're off on an upper device */ netdev_for_each_upper_dev_rcu(dev, upper, iter) - features = netdev_sync_upper_features(dev, upper, features); + netdev_sync_upper_features(dev, upper, &features);
if (dev->features == features) goto sync_lower;
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of br_features_recompute for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/bridge/br_device.c | 2 +- net/bridge/br_if.c | 17 +++++++---------- net/bridge/br_private.h | 3 +-- 3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 622559a..fc508b9 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -292,7 +292,7 @@ static void br_fix_features(struct net_device *dev, netdev_features_t *features) { struct net_bridge *br = netdev_priv(dev);
- *features = br_features_recompute(br, *features); + br_features_recompute(br, features); }
#ifdef CONFIG_NET_POLL_CONTROLLER diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 67c60240..321e2b4 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -532,25 +532,22 @@ static void br_set_gso_limits(struct net_bridge *br) /* * Recomputes features using slave's features */ -netdev_features_t br_features_recompute(struct net_bridge *br, - netdev_features_t features) +void br_features_recompute(struct net_bridge *br, netdev_features_t *features) { struct net_bridge_port *p; netdev_features_t mask;
if (list_empty(&br->port_list)) - return features; + return;
- mask = features; - features &= ~NETIF_F_ONE_FOR_ALL; + mask = *features; + *features &= ~NETIF_F_ONE_FOR_ALL;
list_for_each_entry(p, &br->port_list, list) { - features = netdev_increment_features(features, - p->dev->features, mask); + *features = netdev_increment_features(*features, + p->dev->features, mask); } - features = netdev_add_tso_features(features, mask); - - return features; + *features = netdev_add_tso_features(*features, mask); }
/* called with RTNL */ diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 51991f1..241361c 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -809,8 +809,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, struct netlink_ext_ack *extack); int br_del_if(struct net_bridge *br, struct net_device *dev); void br_mtu_auto_adjust(struct net_bridge *br); -netdev_features_t br_features_recompute(struct net_bridge *br, - netdev_features_t features); +void br_features_recompute(struct net_bridge *br, netdev_features_t *features); void br_port_flags_change(struct net_bridge_port *port, unsigned long mask); void br_manage_promisc(struct net_bridge *br); int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev);
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_add_tso_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/bonding/bond_main.c | 2 +- drivers/net/team/team.c | 2 +- include/linux/netdevice.h | 6 +++--- net/bridge/br_if.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 29bdadf..6999a8c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1380,7 +1380,7 @@ static void bond_fix_features(struct net_device *dev, slave->dev->features, mask); } - *features = netdev_add_tso_features(*features, mask); + netdev_add_tso_features(features, mask); }
#define BOND_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 340be92..706572b 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -2014,7 +2014,7 @@ static void team_fix_features(struct net_device *dev, } rcu_read_unlock();
- *features = netdev_add_tso_features(*features, mask); + netdev_add_tso_features(features, mask); }
static int team_change_carrier(struct net_device *dev, bool new_carrier) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3e000d9..355526f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5016,10 +5016,10 @@ netdev_features_t netdev_increment_features(netdev_features_t all, * Performing the GSO segmentation before last device * is a performance improvement. */ -static inline netdev_features_t netdev_add_tso_features(netdev_features_t features, - netdev_features_t mask) +static inline void netdev_add_tso_features(netdev_features_t *features, + netdev_features_t mask) { - return netdev_increment_features(features, NETIF_F_ALL_TSO, mask); + *features = netdev_increment_features(*features, NETIF_F_ALL_TSO, mask); }
int __netdev_update_features(struct net_device *dev); diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 321e2b4..7f9d65a 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -547,7 +547,7 @@ void br_features_recompute(struct net_bridge *br, netdev_features_t *features) *features = netdev_increment_features(*features, p->dev->features, mask); } - *features = netdev_add_tso_features(*features, mask); + netdev_add_tso_features(features, mask); }
/* called with RTNL */
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_increment_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/bonding/bond_main.c | 28 ++++++++++++++-------------- drivers/net/ipvlan/ipvlan_main.c | 4 ++-- drivers/net/macvlan.c | 2 +- drivers/net/net_failover.c | 28 ++++++++++++---------------- drivers/net/team/team.c | 19 ++++++++----------- include/linux/netdevice.h | 6 +++--- net/bridge/br_if.c | 4 ++-- net/core/dev.c | 7 ++++--- net/hsr/hsr_device.c | 5 ++--- 9 files changed, 48 insertions(+), 55 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 6999a8c..3f1554c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1376,9 +1376,8 @@ static void bond_fix_features(struct net_device *dev, *features |= NETIF_F_ALL_FOR_ALL;
bond_for_each_slave(bond, slave, iter) { - *features = netdev_increment_features(*features, - slave->dev->features, - mask); + netdev_increment_features(features, *features, + slave->dev->features, mask); } netdev_add_tso_features(features, mask); } @@ -1417,22 +1416,23 @@ static void bond_compute_features(struct bonding *bond) mpls_features &= NETIF_F_ALL_FOR_ALL;
bond_for_each_slave(bond, slave, iter) { - vlan_features = netdev_increment_features(vlan_features, - slave->dev->vlan_features, BOND_VLAN_FEATURES); + netdev_increment_features(&vlan_features, vlan_features, + slave->dev->vlan_features, + BOND_VLAN_FEATURES);
- enc_features = netdev_increment_features(enc_features, - slave->dev->hw_enc_features, - BOND_ENC_FEATURES); + netdev_increment_features(&enc_features, enc_features, + slave->dev->hw_enc_features, + BOND_ENC_FEATURES);
#ifdef CONFIG_XFRM_OFFLOAD - xfrm_features = netdev_increment_features(xfrm_features, - slave->dev->hw_enc_features, - BOND_XFRM_FEATURES); + netdev_increment_features(&xfrm_features, xfrm_features, + slave->dev->hw_enc_features, + BOND_XFRM_FEATURES); #endif /* CONFIG_XFRM_OFFLOAD */
- mpls_features = netdev_increment_features(mpls_features, - slave->dev->mpls_features, - BOND_MPLS_FEATURES); + netdev_increment_features(&mpls_features, mpls_features, + slave->dev->mpls_features, + BOND_MPLS_FEATURES);
dst_release_flag &= slave->dev->priv_flags; if (slave->dev->hard_header_len > max_hard_header_len) diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 8fcc91c..6a0b7bd 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -242,8 +242,8 @@ static void ipvlan_fix_features(struct net_device *dev,
*features |= NETIF_F_ALL_FOR_ALL; *features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES); - *features = netdev_increment_features(ipvlan->phy_dev->features, - *features, *features); + netdev_increment_features(features, ipvlan->phy_dev->features, + *features, *features); *features |= IPVLAN_ALWAYS_ON; *features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON); } diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 27cd9c0..3c408653 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1079,7 +1079,7 @@ static void macvlan_fix_features(struct net_device *dev, mask = *features;
lowerdev_features &= (*features | ~NETIF_F_LRO); - *features = netdev_increment_features(lowerdev_features, *features, mask); + netdev_increment_features(features, lowerdev_features, *features, mask); *features |= ALWAYS_ON_FEATURES; *features &= (ALWAYS_ON_FEATURES | MACVLAN_FEATURES); } diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 2a48924..878cad2 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -390,14 +390,12 @@ static void net_failover_compute_features(struct net_device *dev)
primary_dev = rcu_dereference(nfo_info->primary_dev); if (primary_dev) { - vlan_features = - netdev_increment_features(vlan_features, - primary_dev->vlan_features, - FAILOVER_VLAN_FEATURES); - enc_features = - netdev_increment_features(enc_features, - primary_dev->hw_enc_features, - FAILOVER_ENC_FEATURES); + netdev_increment_features(&vlan_features, vlan_features, + primary_dev->vlan_features, + FAILOVER_VLAN_FEATURES); + netdev_increment_features(&enc_features, enc_features, + primary_dev->hw_enc_features, + FAILOVER_ENC_FEATURES);
dst_release_flag &= primary_dev->priv_flags; if (primary_dev->hard_header_len > max_hard_header_len) @@ -406,14 +404,12 @@ static void net_failover_compute_features(struct net_device *dev)
standby_dev = rcu_dereference(nfo_info->standby_dev); if (standby_dev) { - vlan_features = - netdev_increment_features(vlan_features, - standby_dev->vlan_features, - FAILOVER_VLAN_FEATURES); - enc_features = - netdev_increment_features(enc_features, - standby_dev->hw_enc_features, - FAILOVER_ENC_FEATURES); + netdev_increment_features(&vlan_features, vlan_features, + standby_dev->vlan_features, + FAILOVER_VLAN_FEATURES); + netdev_increment_features(&enc_features, enc_features, + standby_dev->hw_enc_features, + FAILOVER_ENC_FEATURES);
dst_release_flag &= standby_dev->priv_flags; if (standby_dev->hard_header_len > max_hard_header_len) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 706572b..fa96ee6 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -994,14 +994,12 @@ static void __team_compute_features(struct team *team)
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { - vlan_features = netdev_increment_features(vlan_features, - port->dev->vlan_features, - TEAM_VLAN_FEATURES); - enc_features = - netdev_increment_features(enc_features, - port->dev->hw_enc_features, - TEAM_ENC_FEATURES); - + netdev_increment_features(&vlan_features, vlan_features, + port->dev->vlan_features, + TEAM_VLAN_FEATURES); + netdev_increment_features(&enc_features, enc_features, + port->dev->hw_enc_features, + TEAM_ENC_FEATURES);
dst_release_flag &= port->dev->priv_flags; if (port->dev->hard_header_len > max_hard_header_len) @@ -2008,9 +2006,8 @@ static void team_fix_features(struct net_device *dev,
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { - *features = netdev_increment_features(*features, - port->dev->features, - mask); + netdev_increment_features(features, *features, + port->dev->features, mask); } rcu_read_unlock();
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 355526f..a82fc87 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5009,8 +5009,8 @@ static inline void netdev_get_wanted_features(struct net_device *dev, { *wanted = (dev->features & ~dev->hw_features) | dev->wanted_features; } -netdev_features_t netdev_increment_features(netdev_features_t all, - netdev_features_t one, netdev_features_t mask); +void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, + netdev_features_t one, netdev_features_t mask);
/* Allow TSO being used on stacked device : * Performing the GSO segmentation before last device @@ -5019,7 +5019,7 @@ netdev_features_t netdev_increment_features(netdev_features_t all, static inline void netdev_add_tso_features(netdev_features_t *features, netdev_features_t mask) { - *features = netdev_increment_features(*features, NETIF_F_ALL_TSO, mask); + netdev_increment_features(features, *features, NETIF_F_ALL_TSO, mask); }
int __netdev_update_features(struct net_device *dev); diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 7f9d65a..be64802 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -544,8 +544,8 @@ void br_features_recompute(struct net_bridge *br, netdev_features_t *features) *features &= ~NETIF_F_ONE_FOR_ALL;
list_for_each_entry(p, &br->port_list, list) { - *features = netdev_increment_features(*features, - p->dev->features, mask); + netdev_increment_features(features, *features, p->dev->features, + mask); } netdev_add_tso_features(features, mask); } diff --git a/net/core/dev.c b/net/core/dev.c index b7632f0..7f08594 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -11299,6 +11299,7 @@ static int dev_cpu_dead(unsigned int oldcpu)
/** * netdev_increment_features - increment feature set by one + * @ret: result feature set * @all: current feature set * @one: new feature set * @mask: mask feature set @@ -11307,8 +11308,8 @@ static int dev_cpu_dead(unsigned int oldcpu) * @one to the master device with current feature set @all. Will not * enable anything that is off in @mask. Returns the new feature set. */ -netdev_features_t netdev_increment_features(netdev_features_t all, - netdev_features_t one, netdev_features_t mask) +void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, + netdev_features_t one, netdev_features_t mask) { if (mask & NETIF_F_HW_CSUM) mask |= NETIF_F_CSUM_MASK; @@ -11321,7 +11322,7 @@ netdev_features_t netdev_increment_features(netdev_features_t all, if (all & NETIF_F_HW_CSUM) all &= ~(NETIF_F_CSUM_MASK & ~NETIF_F_HW_CSUM);
- return all; + *ret = all; } EXPORT_SYMBOL(netdev_increment_features);
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index acaf48a..16e0efd 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -194,9 +194,8 @@ static netdev_features_t hsr_features_recompute(struct hsr_priv *hsr, */ features &= ~NETIF_F_ONE_FOR_ALL; hsr_for_each_port(hsr, port) - features = netdev_increment_features(features, - port->dev->features, - mask); + netdev_increment_features(&features, features, + port->dev->features, mask);
return features; }
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of hsr_features_recompute for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/hsr/hsr_device.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 16e0efd..7e6dd37 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -177,13 +177,13 @@ static int hsr_dev_close(struct net_device *dev) return 0; }
-static netdev_features_t hsr_features_recompute(struct hsr_priv *hsr, - netdev_features_t features) +static void hsr_features_recompute(struct hsr_priv *hsr, + netdev_features_t *features) { netdev_features_t mask; struct hsr_port *port;
- mask = features; + mask = *features;
/* Mask out all features that, if supported by one device, should be * enabled for all devices (see NETIF_F_ONE_FOR_ALL). @@ -192,12 +192,10 @@ static netdev_features_t hsr_features_recompute(struct hsr_priv *hsr, * that were in features originally, and also is in NETIF_F_ONE_FOR_ALL, * may become enabled. */ - features &= ~NETIF_F_ONE_FOR_ALL; + *features &= ~NETIF_F_ONE_FOR_ALL; hsr_for_each_port(hsr, port) - netdev_increment_features(&features, features, + netdev_increment_features(features, *features, port->dev->features, mask); - - return features; }
static void hsr_fix_features(struct net_device *dev, @@ -205,7 +203,7 @@ static void hsr_fix_features(struct net_device *dev, { struct hsr_priv *hsr = netdev_priv(dev);
- *features = hsr_features_recompute(hsr, *features); + hsr_features_recompute(hsr, features); }
static netdev_tx_t hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev)
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of mlx5e_tunnel_features_check, mlx5e_ipsec_feature_check and mlx5e_fix_uplink_rep_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 15 +++++----- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 34 ++++++++++------------ 2 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h index 5120a59..62ab97c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h @@ -93,8 +93,8 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg) void mlx5e_ipsec_tx_build_eseg(struct mlx5e_priv *priv, struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg);
-static inline netdev_features_t -mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features) +static inline void +mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features) { struct xfrm_offload *xo = xfrm_offload(skb); struct sec_path *sp = skb_sec_path(skb); @@ -118,13 +118,12 @@ mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features) goto out_disable; }
- return features; - + return; }
/* Disable CSUM and GSO for software IPsec */ out_disable: - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
#else @@ -140,9 +139,9 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg) }
static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe) { return false; } -static inline netdev_features_t -mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features) -{ return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); } +static inline void +mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features) +{ *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); } #endif /* CONFIG_MLX5_EN_IPSEC */
#endif /* __MLX5E_IPSEC_RXTX_H__ */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index d8c82d3..e70e8c5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3289,22 +3289,20 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) return 0; }
-static netdev_features_t mlx5e_fix_uplink_rep_features(struct net_device *netdev, - netdev_features_t features) +static void mlx5e_fix_uplink_rep_features(struct net_device *netdev, + netdev_features_t *features) { - features &= ~NETIF_F_HW_TLS_RX; + *features &= ~NETIF_F_HW_TLS_RX; 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; + *features &= ~NETIF_F_HW_TLS_TX; 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; + *features &= ~NETIF_F_NTUPLE; if (netdev->features & NETIF_F_NTUPLE) netdev_warn(netdev, "Disabling ntuple, not supported in switchdev mode\n"); - - return features; }
static void mlx5e_fix_features(struct net_device *netdev, @@ -3339,7 +3337,7 @@ static void mlx5e_fix_features(struct net_device *netdev, }
if (mlx5e_is_uplink_rep(priv)) - features = mlx5e_fix_uplink_rep_features(netdev, features); + mlx5e_fix_uplink_rep_features(netdev, &features);
mutex_unlock(&priv->state_lock); } @@ -3757,9 +3755,9 @@ static bool mlx5e_gre_tunnel_inner_proto_offload_supported(struct mlx5_core_dev return false; }
-static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv, - struct sk_buff *skb, - netdev_features_t features) +static void mlx5e_tunnel_features_check(struct mlx5e_priv *priv, + struct sk_buff *skb, + netdev_features_t *features) { unsigned int offset = 0; struct udphdr *udph; @@ -3780,12 +3778,12 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv, switch (proto) { case IPPROTO_GRE: if (mlx5e_gre_tunnel_inner_proto_offload_supported(priv->mdev, skb)) - return features; + return; break; case IPPROTO_IPIP: case IPPROTO_IPV6: if (mlx5e_tunnel_proto_supported_tx(priv->mdev, IPPROTO_IPIP)) - return features; + return; break; case IPPROTO_UDP: udph = udp_hdr(skb); @@ -3793,23 +3791,23 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv,
/* Verify if UDP port is being offloaded by HW */ if (mlx5_vxlan_lookup_port(priv->mdev->vxlan, port)) - return features; + return;
#if IS_ENABLED(CONFIG_GENEVE) /* Support Geneve offload for default UDP port */ if (port == GENEVE_UDP_PORT && mlx5_geneve_tx_allowed(priv->mdev)) - return features; + return; #endif break; #ifdef CONFIG_MLX5_EN_IPSEC case IPPROTO_ESP: - return mlx5e_ipsec_feature_check(skb, features); + mlx5e_ipsec_feature_check(skb, *features); #endif }
out: /* Disable CSUM and GSO if the udp dport is not offloaded by HW */ - return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); }
void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, @@ -3823,7 +3821,7 @@ void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, /* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation && (*features & NETIF_F_CSUM_MASK || *features & NETIF_F_GSO_MASK)) - *features = mlx5e_tunnel_features_check(priv, skb, *features); + mlx5e_tunnel_features_check(priv, skb, features); }
static void mlx5e_tx_timeout_work(struct work_struct *work)
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of xxx_supported_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/sfc/falcon/net_driver.h | 5 +++-- drivers/net/ethernet/sfc/mcdi_filters.c | 5 ++++- drivers/net/ethernet/sfc/net_driver.h | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/sfc/falcon/net_driver.h b/drivers/net/ethernet/sfc/falcon/net_driver.h index a381cf9..6fabfe7 100644 --- a/drivers/net/ethernet/sfc/falcon/net_driver.h +++ b/drivers/net/ethernet/sfc/falcon/net_driver.h @@ -1298,11 +1298,12 @@ static inline struct ef4_rx_buffer *ef4_rx_buffer(struct ef4_rx_queue *rx_queue, * If a feature is fixed, it does not present in hw_features, but * always in features. */ -static inline netdev_features_t ef4_supported_features(const struct ef4_nic *efx) +static inline void ef4_supported_features(const struct ef4_nic *efx, + netdev_features_t *supported) { const struct net_device *net_dev = efx->net_dev;
- return net_dev->features | net_dev->hw_features; + *supported = net_dev->features | net_dev->hw_features; }
/* Get the current TX queue insert index. */ diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c index 1523be7..8e788c3 100644 --- a/drivers/net/ethernet/sfc/mcdi_filters.c +++ b/drivers/net/ethernet/sfc/mcdi_filters.c @@ -1298,6 +1298,7 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) { struct net_device *net_dev = efx->net_dev; struct efx_mcdi_filter_table *table; + netdev_features_t supported; int rc;
if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) @@ -1319,7 +1320,9 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) rc = efx_mcdi_filter_table_probe_matches(efx, table, true); if (rc) goto fail; - if ((efx_supported_features(efx) & NETIF_F_HW_VLAN_CTAG_FILTER) && + + efx_supported_features(efx, &supported); + if ((supported & NETIF_F_HW_VLAN_CTAG_FILTER) && !(efx_mcdi_filter_match_supported(table, false, (EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_LOC_MAC)) && efx_mcdi_filter_match_supported(table, false, diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 9b4b257..cfeb37f 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1673,11 +1673,12 @@ efx_channel_tx_old_fill_level(struct efx_channel *channel) * If a feature is fixed, it does not present in hw_features, but * always in features. */ -static inline netdev_features_t efx_supported_features(const struct efx_nic *efx) +static inline void efx_supported_features(const struct efx_nic *efx, + netdev_features_t *supported) { const struct net_device *net_dev = efx->net_dev;
- return net_dev->features | net_dev->hw_features; + *supported = net_dev->features | net_dev->hw_features; }
/* Get the current TX queue insert index. */
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of qlcnic_process_flags for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index e6ed7f8..2367923 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -1020,37 +1020,35 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu) return rc; }
-static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter, - netdev_features_t features) +static void qlcnic_process_flags(struct qlcnic_adapter *adapter, + netdev_features_t *features) { u32 offload_flags = adapter->offload_flags;
if (offload_flags & BIT_0) { - features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM; + *features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM; adapter->rx_csum = 1; if (QLCNIC_IS_TSO_CAPABLE(adapter)) { if (!(offload_flags & BIT_1)) - features &= ~NETIF_F_TSO; + *features &= ~NETIF_F_TSO; else - features |= NETIF_F_TSO; + *features |= NETIF_F_TSO;
if (!(offload_flags & BIT_2)) - features &= ~NETIF_F_TSO6; + *features &= ~NETIF_F_TSO6; else - features |= NETIF_F_TSO6; + *features |= NETIF_F_TSO6; } } else { - features &= ~(NETIF_F_RXCSUM | + *features &= ~(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
if (QLCNIC_IS_TSO_CAPABLE(adapter)) - features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + *features &= ~(NETIF_F_TSO | NETIF_F_TSO6); adapter->rx_csum = 0; } - - return features; }
void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) @@ -1061,7 +1059,7 @@ void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) if (qlcnic_82xx_check(adapter) && (adapter->flags & QLCNIC_ESWITCH_ENABLED)) { if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) { - *features = qlcnic_process_flags(adapter, *features); + qlcnic_process_flags(adapter, features); } else { changed = *features ^ netdev->features; *features ^= changed & (NETIF_F_RXCSUM |
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of rtl8168evl_fix_tso for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/realtek/r8169_main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index e6b6eb3..584b3bb 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -4331,23 +4331,20 @@ static unsigned int rtl_last_frag_len(struct sk_buff *skb) }
/* Workaround for hw issues with TSO on RTL8168evl */ -static netdev_features_t rtl8168evl_fix_tso(struct sk_buff *skb, - netdev_features_t features) +static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t *features) { /* IPv4 header has options field */ if (vlan_get_protocol(skb) == htons(ETH_P_IP) && ip_hdrlen(skb) > sizeof(struct iphdr)) - features &= ~NETIF_F_ALL_TSO; + *features &= ~NETIF_F_ALL_TSO;
/* IPv4 TCP header has options field */ else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 && tcp_hdrlen(skb) > sizeof(struct tcphdr)) - features &= ~NETIF_F_ALL_TSO; + *features &= ~NETIF_F_ALL_TSO;
else if (rtl_last_frag_len(skb) <= 6) - features &= ~NETIF_F_ALL_TSO; - - return features; + *features &= ~NETIF_F_ALL_TSO; }
static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev, @@ -4358,7 +4355,7 @@ static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev,
if (skb_is_gso(skb)) { if (tp->mac_version == RTL_GIGA_MAC_VER_34) - *features = rtl8168evl_fix_tso(skb, *features); + rtl8168evl_fix_tso(skb, features);
if (transport_offset > GTTCPHO_MAX && rtl_chip_supports_csum_v2(tp))
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of ethtool_get_feature_mask for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/ethtool/ioctl.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 81fa36a..dcfe8b3 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -194,30 +194,35 @@ static void __ethtool_get_strings(struct net_device *dev, ops->get_strings(dev, stringset, data); }
-static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd) +static void ethtool_get_feature_mask(u32 eth_cmd, netdev_features_t *mask) { /* feature masks of legacy discrete ethtool ops */
switch (eth_cmd) { case ETHTOOL_GTXCSUM: case ETHTOOL_STXCSUM: - return NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC | - NETIF_F_SCTP_CRC; + *mask = NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC | NETIF_F_SCTP_CRC; + break; case ETHTOOL_GRXCSUM: case ETHTOOL_SRXCSUM: - return NETIF_F_RXCSUM; + *mask = NETIF_F_RXCSUM; + break; case ETHTOOL_GSG: case ETHTOOL_SSG: - return NETIF_F_SG | NETIF_F_FRAGLIST; + *mask = NETIF_F_SG | NETIF_F_FRAGLIST; + break; case ETHTOOL_GTSO: case ETHTOOL_STSO: - return NETIF_F_ALL_TSO; + *mask = NETIF_F_ALL_TSO; + break; case ETHTOOL_GGSO: case ETHTOOL_SGSO: - return NETIF_F_GSO; + *mask = NETIF_F_GSO; + break; case ETHTOOL_GGRO: case ETHTOOL_SGRO: - return NETIF_F_GRO; + *mask = NETIF_F_GRO; + break; default: BUG(); } @@ -226,11 +231,12 @@ static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd) static int ethtool_get_one_feature(struct net_device *dev, char __user *useraddr, u32 ethcmd) { - netdev_features_t mask = ethtool_get_feature_mask(ethcmd); - struct ethtool_value edata = { - .cmd = ethcmd, - .data = !!(dev->features & mask), - }; + struct ethtool_value edata; + netdev_features_t mask; + + ethtool_get_feature_mask(ethcmd, &mask); + edata.cmd = ethcmd; + edata.data = !!(dev->features & mask);
if (copy_to_user(useraddr, &edata, sizeof(edata))) return -EFAULT; @@ -246,7 +252,7 @@ static int ethtool_set_one_feature(struct net_device *dev, if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT;
- mask = ethtool_get_feature_mask(ethcmd); + ethtool_get_feature_mask(ethcmd, &mask); mask &= dev->hw_features; if (!mask) return -EOPNOTSUPP;
For the prototype of netdev_features_t will be changed from u64 to unsigned long *, so it's necessary to add a set of helpers to do the logic operation.
This is a temporary patch, used to compatible with the current prototype of netdev_features_t. The parameters styles are not consistent for among these helpers, in order to minimize the modification when change the netdev_features_t to bitmap.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/linux/netdev_features.h | 133 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 2c6b9e4..9744780 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -261,4 +261,137 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
+static inline void netdev_feature_zero(netdev_features_t *dst) +{ + *dst = 0; +} + +static inline void netdev_feature_fill(netdev_features_t *dst) +{ + *dst = ~0; +} + +static inline void netdev_feature_copy(netdev_features_t *dst, + const netdev_features_t src) +{ + *dst = src; +} + +static inline void netdev_feature_and(netdev_features_t *dst, + const netdev_features_t a, + const netdev_features_t b) +{ + *dst = a & b; +} + +static inline void netdev_feature_or(netdev_features_t *dst, + const netdev_features_t a, + const netdev_features_t b) +{ + *dst = a | b; +} + +static inline void netdev_feature_xor(netdev_features_t *dst, + const netdev_features_t a, + const netdev_features_t b) +{ + *dst = a ^ b; +} + +static inline bool netdev_feature_empty(netdev_features_t src) +{ + return src == 0; +} + +static inline bool netdev_feature_equal(const netdev_features_t src1, + const netdev_features_t src2) +{ + return src1 == src2; +} + +static inline int netdev_feature_andnot(netdev_features_t *dst, + const netdev_features_t src1, + const netdev_features_t src2) +{ + *dst = src1 & ~src2; + return 0; +} + +static inline void netdev_feature_set_bit(int nr, netdev_features_t *addr) +{ + *addr |= __NETIF_F_BIT(nr); +} + +static inline void netdev_feature_clear_bit(int nr, netdev_features_t *addr) +{ + *addr &= ~(__NETIF_F_BIT(nr)); +} + +static inline void netdev_feature_mod_bit(int nr, netdev_features_t *addr, + int set) +{ + if (set) + netdev_feature_set_bit(nr, addr); + else + netdev_feature_clear_bit(nr, addr); +} + +static inline void netdev_feature_change_bit(int nr, netdev_features_t *addr) +{ + *addr ^= __NETIF_F_BIT(nr); +} + +static inline int netdev_feature_test_bit(int nr, const netdev_features_t addr) +{ + return (addr & __NETIF_F_BIT(nr)) > 0; +} + +static inline void netdev_feature_set_bit_array(const int *array, + int array_size, + netdev_features_t *addr) +{ + int i; + + for (i = 0; i < array_size; i++) + netdev_feature_set_bit(array[i], addr); +} + +/* only be used for the first 64 bits features */ +static inline void netdev_feature_set_bits(u64 bits, netdev_features_t *addr) +{ + *addr |= bits; +} + +/* only be used for the first 64 bits features */ +static inline void netdev_feature_clear_bits(u64 bits, netdev_features_t *addr) +{ + *addr &= ~bits; +} + +/* only be used for the first 64 bits features */ +static inline bool netdev_feature_test_bits(u64 bits, + const netdev_features_t addr) +{ + return (addr & bits) > 0; +} + +/* only be used for the first 64 bits features */ +static inline void netdev_feature_and_bits(u64 bits, + netdev_features_t *addr) +{ + *addr &= bits; +} + +static inline int netdev_feature_intersects(const netdev_features_t src1, + const netdev_features_t src2) +{ + return (src1 & src2) > 0; +} + +static inline int netdev_feature_subset(const netdev_features_t src1, + const netdev_features_t src2) +{ + return (src1 & src2) == src2; +} + #endif /* _LINUX_NETDEV_FEATURES_H */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/linux/netdevice.h | 78 +++++++----- net/core/dev.c | 315 +++++++++++++++++++++++++++------------------- 2 files changed, 236 insertions(+), 157 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a82fc87..51fdb9f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2266,7 +2266,8 @@ struct net_device {
static inline bool netif_elide_gro(const struct net_device *dev) { - if (!(dev->features & NETIF_F_GRO) || dev->xdp_prog) + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, dev->features) || + dev->xdp_prog) return true; return false; } @@ -4506,25 +4507,28 @@ static inline void netif_tx_unlock_bh(struct net_device *dev) local_bh_enable(); }
-#define HARD_TX_LOCK(dev, txq, cpu) { \ - if ((dev->features & NETIF_F_LLTX) == 0) { \ - __netif_tx_lock(txq, cpu); \ - } else { \ - __netif_tx_acquire(txq); \ - } \ +#define HARD_TX_LOCK(dev, txq, cpu) { \ + if (!netdev_feature_test_bit(NETIF_F_LLTX_BIT, \ + dev->features)) { \ + __netif_tx_lock(txq, cpu); \ + } else { \ + __netif_tx_acquire(txq); \ + } \ }
-#define HARD_TX_TRYLOCK(dev, txq) \ - (((dev->features & NETIF_F_LLTX) == 0) ? \ - __netif_tx_trylock(txq) : \ +#define HARD_TX_TRYLOCK(dev, txq) \ + (!netdev_feature_test_bit(NETIF_F_LLTX_BIT, \ + dev->features) ? \ + __netif_tx_trylock(txq) : \ __netif_tx_acquire(txq))
-#define HARD_TX_UNLOCK(dev, txq) { \ - if ((dev->features & NETIF_F_LLTX) == 0) { \ - __netif_tx_unlock(txq); \ - } else { \ - __netif_tx_release(txq); \ - } \ +#define HARD_TX_UNLOCK(dev, txq) { \ + if (!netdev_feature_test_bit(NETIF_F_LLTX_BIT, \ + dev->features)) { \ + __netif_tx_unlock(txq); \ + } else { \ + __netif_tx_release(txq); \ + } \ }
static inline void netif_tx_disable(struct net_device *dev) @@ -4916,20 +4920,20 @@ static inline bool can_checksum_protocol(netdev_features_t features, __be16 protocol) { if (protocol == htons(ETH_P_FCOE)) - return !!(features & NETIF_F_FCOE_CRC); + return netdev_feature_test_bit(NETIF_F_FCOE_CRC_BIT, features);
/* Assume this is an IP checksum (not SCTP CRC) */
- if (features & NETIF_F_HW_CSUM) { + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features)) { /* Can checksum everything */ return true; }
switch (protocol) { case htons(ETH_P_IP): - return !!(features & NETIF_F_IP_CSUM); + return netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features); case htons(ETH_P_IPV6): - return !!(features & NETIF_F_IPV6_CSUM); + return netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features); default: return false; } @@ -4994,21 +4998,26 @@ static inline void netdev_intersect_features(netdev_features_t *ret, netdev_features_t f1, netdev_features_t f2) { - if ((f1 ^ f2) & NETIF_F_HW_CSUM) { - if (f1 & NETIF_F_HW_CSUM) - f1 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, f1) != + netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, f2)) { + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, f1)) + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &f1); else - f2 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &f2); }
- *ret = f1 & f2; + netdev_feature_and(ret, f1, f2); }
static inline void netdev_get_wanted_features(struct net_device *dev, netdev_features_t *wanted) { - *wanted = (dev->features & ~dev->hw_features) | dev->wanted_features; + netdev_feature_andnot(wanted, dev->features, dev->hw_features); + netdev_feature_or(wanted, *wanted, dev->wanted_features); } + void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, netdev_features_t one, netdev_features_t mask);
@@ -5019,7 +5028,11 @@ void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, static inline void netdev_add_tso_features(netdev_features_t *features, netdev_features_t mask) { - netdev_increment_features(features, *features, NETIF_F_ALL_TSO, mask); + netdev_features_t one; + + netdev_feature_zero(&one); + netdev_feature_set_bits(NETIF_F_ALL_TSO, &one); + netdev_increment_features(features, *features, one, mask); }
int __netdev_update_features(struct net_device *dev); @@ -5035,7 +5048,7 @@ void netif_skb_features(struct sk_buff *skb, netdev_features_t *features);
static inline bool net_gso_ok(netdev_features_t features, int gso_type) { - netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT; + netdev_features_t feature;
/* check flags correspondence */ BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); @@ -5058,13 +5071,18 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type) BUILD_BUG_ON(SKB_GSO_UDP_L4 != (NETIF_F_GSO_UDP_L4 >> NETIF_F_GSO_SHIFT)); BUILD_BUG_ON(SKB_GSO_FRAGLIST != (NETIF_F_GSO_FRAGLIST >> NETIF_F_GSO_SHIFT));
- return (features & feature) == feature; + netdev_feature_zero(&feature); + netdev_feature_set_bit((u64)gso_type << NETIF_F_GSO_SHIFT, &feature); + + return netdev_feature_subset(features, feature); + }
static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features) { return net_gso_ok(features, skb_shinfo(skb)->gso_type) && - (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); + (!skb_has_frag_list(skb) || + netdev_feature_test_bit(NETIF_F_FRAGLIST_BIT, features)); }
static inline bool netif_needs_gso(struct sk_buff *skb, diff --git a/net/core/dev.c b/net/core/dev.c index 7f08594..a71d35d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1636,10 +1636,10 @@ void dev_disable_lro(struct net_device *dev) struct net_device *lower_dev; struct list_head *iter;
- dev->wanted_features &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &dev->wanted_features); netdev_update_features(dev);
- if (unlikely(dev->features & NETIF_F_LRO)) + if (unlikely(netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features))) netdev_WARN(dev, "failed to disable LRO!\n");
netdev_for_each_lower_dev(dev, lower_dev, iter) @@ -1657,10 +1657,12 @@ EXPORT_SYMBOL(dev_disable_lro); */ static void dev_disable_gro_hw(struct net_device *dev) { - dev->wanted_features &= ~NETIF_F_GRO_HW; + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->wanted_features); netdev_update_features(dev);
- if (unlikely(dev->features & NETIF_F_GRO_HW)) + if (unlikely(netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, + dev->features))) + netdev_WARN(dev, "failed to disable GRO_HW!\n"); }
@@ -3377,13 +3379,19 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, * support segmentation on this frame without needing additional * work. */ - if (features & NETIF_F_GSO_PARTIAL) { - netdev_features_t partial_features = NETIF_F_GSO_ROBUST; + if (netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, features)) { + netdev_features_t partial_features; struct net_device *dev = skb->dev;
- partial_features |= dev->features & dev->gso_partial_features; - if (!skb_gso_ok(skb, features | partial_features)) - features &= ~NETIF_F_GSO_PARTIAL; + netdev_feature_and(&partial_features, dev->features, + dev->gso_partial_features); + netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, + &partial_features); + netdev_feature_or(&partial_features, partial_features, + features); + if (!skb_gso_ok(skb, partial_features)) + netdev_feature_clear_bit(NETIF_F_GSO_PARTIAL_BIT, + &features); }
BUILD_BUG_ON(SKB_GSO_CB_OFFSET + @@ -3426,7 +3434,7 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb) #ifdef CONFIG_HIGHMEM int i;
- if (!(dev->features & NETIF_F_HIGHDMA)) { + if (!netdev_feature_test_bit(NETIF_F_HIGHDMA_BIT, dev->features)) { for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
@@ -3446,7 +3454,8 @@ static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, __be16 type) { if (eth_p_mpls(type)) - *features &= skb->dev->mpls_features; + netdev_feature_and(features, *features, + skb->dev->mpls_features); } #else static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, @@ -3464,10 +3473,11 @@ static void harmonize_features(struct sk_buff *skb, netdev_features_t *features)
if (skb->ip_summed != CHECKSUM_NONE && !can_checksum_protocol(*features, type)) { - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); } if (illegal_highdma(skb->dev, skb)) - *features &= ~NETIF_F_SG; + netdev_feature_clear_bit(NETIF_F_SG_BIT, features); }
void passthru_features_check(struct sk_buff *skb, struct net_device *dev, @@ -3490,13 +3500,13 @@ static void gso_features_check(const struct sk_buff *skb, u16 gso_segs = skb_shinfo(skb)->gso_segs;
if (gso_segs > dev->gso_max_segs) { - *features &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); return; }
if (!skb_shinfo(skb)->gso_type) { skb_warn_bad_offload(skb); - *features &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); return; }
@@ -3507,7 +3517,8 @@ static void gso_features_check(const struct sk_buff *skb, * segmented the frame. */ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL)) - *features &= ~dev->gso_partial_features; + netdev_feature_andnot(features, *features, + dev->gso_partial_features);
/* Make sure to clear the IPv4 ID mangling feature if the * IPv4 header has the potential to be fragmented. @@ -3517,7 +3528,8 @@ static void 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_clear_bit(NETIF_F_TSO_MANGLEID_BIT, + features); } }
@@ -3525,7 +3537,7 @@ void netif_skb_features(struct sk_buff *skb, netdev_features_t *features) { struct net_device *dev = skb->dev;
- *features = dev->features; + netdev_feature_copy(features, dev->features);
if (skb_is_gso(skb)) gso_features_check(skb, dev, features); @@ -3535,13 +3547,16 @@ void netif_skb_features(struct sk_buff *skb, netdev_features_t *features) * features for the netdev */ if (skb->encapsulation) - *features &= dev->hw_enc_features; + netdev_feature_and(features, *features, dev->hw_enc_features); + + if (skb_vlan_tagged(skb)) { + netdev_features_t tmp;
- if (skb_vlan_tagged(skb)) - netdev_intersect_features(features, *features, - dev->vlan_features | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX); + netdev_feature_copy(&tmp, dev->vlan_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX_BIT | + NETIF_F_HW_VLAN_STAG_TX_BIT, &tmp); + netdev_intersect_features(features, *features, tmp); + }
if (dev->netdev_ops->ndo_features_check) dev->netdev_ops->ndo_features_check(skb, dev, features); @@ -3611,13 +3626,14 @@ int skb_csum_hwoffload_help(struct sk_buff *skb, const netdev_features_t features) { if (unlikely(skb_csum_is_sctp(skb))) - return !!(features & NETIF_F_SCTP_CRC) ? 0 : - skb_crc32c_csum_help(skb); + return netdev_feature_test_bit(NETIF_F_SCTP_CRC_BIT, features) ? + 0 : skb_crc32c_csum_help(skb);
- if (features & NETIF_F_HW_CSUM) + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features)) return 0;
- if (features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) { + if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + features)) { switch (skb->csum_offset) { case offsetof(struct tcphdr, check): case offsetof(struct udphdr, check): @@ -4349,7 +4365,8 @@ set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
/* Should we steer this flow to a different hardware queue? */ if (!skb_rx_queue_recorded(skb) || !dev->rx_cpu_rmap || - !(dev->features & NETIF_F_NTUPLE)) + !netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + dev->features)) goto out; rxq_index = cpu_rmap_lookup_index(dev->rx_cpu_rmap, next_cpu); if (rxq_index == skb_get_rx_queue(skb)) @@ -9774,17 +9791,19 @@ static void netdev_sync_upper_features(struct net_device *lower, struct net_device *upper, netdev_features_t *features) { - netdev_features_t upper_disables = NETIF_F_UPPER_DISABLES; - netdev_features_t feature; + netdev_features_t upper_disables; int feature_bit;
+ netdev_feature_zero(&upper_disables); + netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, &upper_disables); + for_each_netdev_feature(upper_disables, feature_bit) { - feature = __NETIF_F_BIT(feature_bit); - if (!(upper->wanted_features & feature) && - (*features & feature)) { - netdev_dbg(lower, "Dropping feature %pNF, upper dev %s has it off.\n", - &feature, upper->name); - *features &= ~feature; + if (!netdev_feature_test_bit(feature_bit, + upper->wanted_features) && + netdev_feature_test_bit(feature_bit, *features)) { + netdev_dbg(lower, "Dropping feature bit %d, upper dev %s has it off.\n", + feature_bit, upper->name); + netdev_feature_clear_bit(feature_bit, features); } } } @@ -9792,21 +9811,25 @@ static void netdev_sync_upper_features(struct net_device *lower, static void netdev_sync_lower_features(struct net_device *upper, struct net_device *lower, netdev_features_t features) { - netdev_features_t upper_disables = NETIF_F_UPPER_DISABLES; - netdev_features_t feature; + netdev_features_t upper_disables; int feature_bit;
+ netdev_feature_zero(&upper_disables); + netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, &upper_disables); + for_each_netdev_feature(upper_disables, feature_bit) { - feature = __NETIF_F_BIT(feature_bit); - if (!(features & feature) && (lower->features & feature)) { - netdev_dbg(upper, "Disabling feature %pNF on lower dev %s.\n", - &feature, lower->name); - lower->wanted_features &= ~feature; + if (!netdev_feature_test_bit(feature_bit, features) && + netdev_feature_test_bit(feature_bit, lower->features)) { + netdev_dbg(upper, "Disabling feature bit %d on lower dev %s.\n", + feature_bit, lower->name); + netdev_feature_clear_bit(feature_bit, + &lower->wanted_features); __netdev_update_features(lower);
- if (unlikely(lower->features & feature)) - netdev_WARN(upper, "failed to disable %pNF on %s!\n", - &feature, lower->name); + if (unlikely(netdev_feature_test_bit(feature_bit, + lower->features))) + netdev_WARN(upper, "failed to disable feature bit %d on %s!\n", + feature_bit, lower->name); else netdev_features_change(lower); } @@ -9817,92 +9840,102 @@ static void netdev_fix_features(struct net_device *dev, netdev_features_t *features) { /* Fix illegal checksum combinations */ - if ((*features & NETIF_F_HW_CSUM) && - (*features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))) { + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && + (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + *features))) { netdev_warn(dev, "mixed HW and IP checksum settings.\n"); - *features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); + netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + features); }
/* TSO requires that SG is present as well. */ - if ((*features & NETIF_F_ALL_TSO) && !(*features & NETIF_F_SG)) { + if (netdev_feature_test_bits(NETIF_F_ALL_TSO, *features) && + !netdev_feature_test_bit(NETIF_F_SG_BIT, *features)) { netdev_dbg(dev, "Dropping TSO features since no SG feature.\n"); - *features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, features); }
- if ((*features & NETIF_F_TSO) && !(*features & NETIF_F_HW_CSUM) && - !(*features & NETIF_F_IP_CSUM)) { + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, *features)) { netdev_dbg(dev, "Dropping TSO features since no CSUM feature.\n"); - *features &= ~NETIF_F_TSO; - *features &= ~NETIF_F_TSO_ECN; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); + netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, features); }
- if ((*features & NETIF_F_TSO6) && !(*features & NETIF_F_HW_CSUM) && - !(*features & NETIF_F_IPV6_CSUM)) { + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features)) { netdev_dbg(dev, "Dropping TSO6 features since no CSUM feature.\n"); - *features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(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; + if (netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_TSO_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_TSO_MANGLEID_BIT, features);
/* TSO ECN requires that TSO is present as well. */ - if ((*features & NETIF_F_ALL_TSO) == NETIF_F_TSO_ECN) - *features &= ~NETIF_F_TSO_ECN; + if (netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, *features) && + !netdev_feature_test_bits(NETIF_F_ALL_TSO & ~NETIF_F_TSO_ECN, + *features)) + netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, features);
/* Software GSO depends on SG. */ - if ((*features & NETIF_F_GSO) && !(*features & NETIF_F_SG)) { + if (netdev_feature_test_bit(NETIF_F_GSO_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_SG_BIT, *features)) { netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n"); - *features &= ~NETIF_F_GSO; + netdev_feature_clear_bit(NETIF_F_GSO_BIT, features); }
/* GSO partial features require GSO partial be set */ - if ((*features & dev->gso_partial_features) && - !(*features & NETIF_F_GSO_PARTIAL)) { + if (netdev_feature_intersects(*features, dev->gso_partial_features) && + !netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, *features)) { netdev_dbg(dev, "Dropping partially supported GSO features since no GSO partial.\n"); - *features &= ~dev->gso_partial_features; + netdev_feature_andnot(features, *features, + dev->gso_partial_features); }
- if (!(*features & NETIF_F_RXCSUM)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { /* NETIF_F_GRO_HW implies doing RXCSUM since every packet * successfully merged by hardware must also have the * checksum verified by hardware. If the user does not * want to enable RXCSUM, logically, we should disable GRO_HW. */ - if (*features & NETIF_F_GRO_HW) { + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) { netdev_dbg(dev, "Dropping NETIF_F_GRO_HW since no RXCSUM feature.\n"); - *features &= ~NETIF_F_GRO_HW; + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); } }
/* LRO/HW-GRO features cannot be combined with RX-FCS */ - if (*features & NETIF_F_RXFCS) { - if (*features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { netdev_dbg(dev, "Dropping LRO feature since RX-FCS is requested.\n"); - *features &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
- if (*features & NETIF_F_GRO_HW) { + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) { netdev_dbg(dev, "Dropping HW-GRO feature since RX-FCS is requested.\n"); - *features &= ~NETIF_F_GRO_HW; + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); } }
- if (*features & NETIF_F_HW_TLS_TX) { - bool ip_csum = (*features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) == - (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); - bool hw_csum = *features & NETIF_F_HW_CSUM; - - if (!ip_csum && !hw_csum) { + if (netdev_feature_test_bit(NETIF_F_HW_TLS_TX_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, *features) || + !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features) || + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features)) { netdev_dbg(dev, "Dropping TLS TX HW offload feature since no CSUM feature.\n"); - *features &= ~NETIF_F_HW_TLS_TX; + netdev_feature_clear_bit(NETIF_F_HW_TLS_TX_BIT, + features); } }
- if ((*features & NETIF_F_HW_TLS_RX) && !(*features & NETIF_F_RXCSUM)) { + if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { netdev_dbg(dev, "Dropping TLS RX HW offload feature since no RXCSUM feature.\n"); - *features &= ~NETIF_F_HW_TLS_RX; + netdev_feature_clear_bit(NETIF_F_HW_TLS_RX_BIT, features); } }
@@ -9927,7 +9960,7 @@ int __netdev_update_features(struct net_device *dev) netdev_for_each_upper_dev_rcu(dev, upper, iter) netdev_sync_upper_features(dev, upper, &features);
- if (dev->features == features) + if (netdev_feature_equal(dev->features, features)) goto sync_lower;
netdev_dbg(dev, "Features changed: %pNF -> %pNF\n", @@ -9956,9 +9989,11 @@ int __netdev_update_features(struct net_device *dev) netdev_sync_lower_features(dev, lower, features);
if (!err) { - netdev_features_t diff = features ^ dev->features; + netdev_features_t diff; + + netdev_feature_xor(&diff, features, dev->features);
- if (diff & NETIF_F_RX_UDP_TUNNEL_PORT) { + if (netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, diff)) { /* udp_tunnel_{get,drop}_rx_info both need * NETIF_F_RX_UDP_TUNNEL_PORT enabled on the * device, or they won't do anything. @@ -9966,33 +10001,36 @@ int __netdev_update_features(struct net_device *dev) * *before* calling udp_tunnel_get_rx_info, * but *after* calling udp_tunnel_drop_rx_info. */ - if (features & NETIF_F_RX_UDP_TUNNEL_PORT) { - dev->features = features; + if (netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, + features)) { + netdev_feature_copy(&dev->features, features); udp_tunnel_get_rx_info(dev); } else { udp_tunnel_drop_rx_info(dev); } }
- if (diff & NETIF_F_HW_VLAN_CTAG_FILTER) { - if (features & NETIF_F_HW_VLAN_CTAG_FILTER) { - dev->features = features; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, diff)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features)) { + netdev_feature_copy(&dev->features, features); err |= vlan_get_rx_ctag_filter_info(dev); } else { vlan_drop_rx_ctag_filter_info(dev); } }
- if (diff & NETIF_F_HW_VLAN_STAG_FILTER) { - if (features & NETIF_F_HW_VLAN_STAG_FILTER) { - dev->features = features; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, diff)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, + features)) { + netdev_feature_copy(&dev->features, features); err |= vlan_get_rx_stag_filter_info(dev); } else { vlan_drop_rx_stag_filter_info(dev); } }
- dev->features = features; + netdev_feature_copy(&dev->features, features); }
return err < 0 ? 0 : 1; @@ -10218,8 +10256,10 @@ int register_netdevice(struct net_device *dev) } }
- if (((dev->hw_features | dev->features) & - NETIF_F_HW_VLAN_CTAG_FILTER) && + if ((netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + dev->hw_features) || + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + dev->features)) && (!dev->netdev_ops->ndo_vlan_rx_add_vid || !dev->netdev_ops->ndo_vlan_rx_kill_vid)) { netdev_WARN(dev, "Buggy VLAN acceleration in driver!\n"); @@ -10236,44 +10276,54 @@ int register_netdevice(struct net_device *dev) /* Transfer changeable features to wanted_features and enable * software offloads (GSO and GRO). */ - dev->hw_features |= (NETIF_F_SOFT_FEATURES | NETIF_F_SOFT_FEATURES_OFF); - dev->features |= NETIF_F_SOFT_FEATURES; + netdev_feature_set_bits(NETIF_F_SOFT_FEATURES | NETIF_F_SOFT_FEATURES_OFF, + &dev->hw_features); + netdev_feature_set_bits(NETIF_F_SOFT_FEATURES, &dev->features);
if (dev->udp_tunnel_nic_info) { - dev->features |= NETIF_F_RX_UDP_TUNNEL_PORT; - dev->hw_features |= NETIF_F_RX_UDP_TUNNEL_PORT; + netdev_feature_set_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, + &dev->features); + netdev_feature_set_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, + &dev->hw_features); }
- dev->wanted_features = dev->features & dev->hw_features; + netdev_feature_and(&dev->wanted_features, dev->features, + dev->hw_features);
if (!(dev->flags & IFF_LOOPBACK)) - dev->hw_features |= NETIF_F_NOCACHE_COPY; + netdev_feature_set_bit(NETIF_F_NOCACHE_COPY_BIT, + &dev->hw_features);
/* If IPv4 TCP segmentation offload is supported we should also * allow the device to enable segmenting the frame with the option * of ignoring a static IP ID value. This doesn't enable the * feature itself but allows the user to enable it later. */ - if (dev->hw_features & NETIF_F_TSO) - dev->hw_features |= NETIF_F_TSO_MANGLEID; - if (dev->vlan_features & NETIF_F_TSO) - dev->vlan_features |= NETIF_F_TSO_MANGLEID; - if (dev->mpls_features & NETIF_F_TSO) - dev->mpls_features |= NETIF_F_TSO_MANGLEID; - if (dev->hw_enc_features & NETIF_F_TSO) - dev->hw_enc_features |= NETIF_F_TSO_MANGLEID; + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->hw_features)) + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &dev->hw_features); + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->vlan_features)) + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &dev->vlan_features); + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->mpls_features)) + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &dev->mpls_features); + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->hw_enc_features)) + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &dev->hw_enc_features);
/* Make NETIF_F_HIGHDMA inheritable to VLAN devices. */ - dev->vlan_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->vlan_features);
/* Make NETIF_F_SG inheritable to tunnel devices. */ - dev->hw_enc_features |= NETIF_F_SG | NETIF_F_GSO_PARTIAL; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO_PARTIAL, + &dev->hw_enc_features);
/* Make NETIF_F_SG inheritable to MPLS. */ - dev->mpls_features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->mpls_features);
ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev); ret = notifier_to_errno(ret); @@ -11114,7 +11164,7 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net,
/* Don't allow namespace local devices to be moved. */ err = -EINVAL; - if (dev->features & NETIF_F_NETNS_LOCAL) + if (netdev_feature_test_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features)) goto out;
/* Ensure the device has been registrered */ @@ -11311,18 +11361,28 @@ static int dev_cpu_dead(unsigned int oldcpu) void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, netdev_features_t one, netdev_features_t mask) { - if (mask & NETIF_F_HW_CSUM) - mask |= NETIF_F_CSUM_MASK; - mask |= NETIF_F_VLAN_CHALLENGED; + netdev_features_t tmp;
- all |= one & (NETIF_F_ONE_FOR_ALL | NETIF_F_CSUM_MASK) & mask; - all &= one | ~NETIF_F_ALL_FOR_ALL; + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, mask)) + netdev_feature_set_bits(NETIF_F_CSUM_MASK, &mask); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &mask);
- /* If one device supports hw checksumming, set for all. */ - if (all & NETIF_F_HW_CSUM) - all &= ~(NETIF_F_CSUM_MASK & ~NETIF_F_HW_CSUM); + netdev_feature_copy(ret, all); + netdev_feature_zero(&tmp); + netdev_feature_set_bits(NETIF_F_ONE_FOR_ALL | NETIF_F_CSUM_MASK, &tmp); + netdev_feature_and(&tmp, tmp, one); + netdev_feature_and(&tmp, tmp, mask); + netdev_feature_or(ret, *ret, tmp);
- *ret = all; + netdev_feature_fill(&tmp); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &tmp); + netdev_feature_or(&tmp, tmp, one); + netdev_feature_and(ret, *ret, tmp); + + /* If one device supports hw checksumming, set for all. */ + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *ret)) + netdev_feature_clear_bits(NETIF_F_CSUM_MASK & ~NETIF_F_HW_CSUM, + ret); } EXPORT_SYMBOL(netdev_increment_features);
@@ -11475,7 +11535,8 @@ static void __net_exit default_device_exit(struct net *net) char fb_name[IFNAMSIZ];
/* Ignore unmoveable devices (i.e. loopback) */ - if (dev->features & NETIF_F_NETNS_LOCAL) + if (netdev_feature_test_bit(NETIF_F_NETNS_LOCAL_BIT, + dev->features)) continue;
/* Leave virtual devices for the generic cleanup */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/linux/skbuff.h | 6 ++++-- net/core/skbuff.c | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 6bdb0db..d1ce567 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3730,8 +3730,10 @@ static inline bool skb_needs_linearize(struct sk_buff *skb, netdev_features_t features) { return skb_is_nonlinear(skb) && - ((skb_has_frag_list(skb) && !(features & NETIF_F_FRAGLIST)) || - (skb_shinfo(skb)->nr_frags && !(features & NETIF_F_SG))); + ((skb_has_frag_list(skb) && + !netdev_feature_test_bit(NETIF_F_FRAGLIST_BIT, features)) || + (skb_shinfo(skb)->nr_frags && + !netdev_feature_test_bit(NETIF_F_SG_BIT, features))); }
static inline void skb_copy_from_linear_data(const struct sk_buff *skb, diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 9240af2..b41bfd0 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3993,7 +3993,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_clear_bit(NETIF_F_SG_BIT, &features); }
__skb_push(head_skb, doffset); @@ -4001,11 +4001,12 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, if (unlikely(!proto)) return ERR_PTR(-EINVAL);
- sg = !!(features & NETIF_F_SG); + sg = !!netdev_feature_test_bit(NETIF_F_SG_BIT, features); csum = !!can_checksum_protocol(features, proto);
if (sg && csum && (mss != GSO_BY_FRAGS)) { - if (!(features & NETIF_F_GSO_PARTIAL)) { + if (!netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, + features)) { struct sk_buff *iter; unsigned int frag_len;
@@ -4262,7 +4263,8 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, unsigned short gso_size = skb_shinfo(head_skb)->gso_size;
/* Update type to add partial and then remove dodgy if set */ - type |= (features & NETIF_F_GSO_PARTIAL) / NETIF_F_GSO_PARTIAL * SKB_GSO_PARTIAL; + type |= netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, + features) * SKB_GSO_PARTIAL; type &= ~SKB_GSO_DODGY;
/* Update GSO info and prepare to start updating headers on
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/linux/if_vlan.h | 16 ++++++++++------ net/8021q/vlan.c | 11 +++++++---- net/8021q/vlan.h | 22 ++++++++++++---------- net/8021q/vlan_core.c | 6 ++++-- net/8021q/vlan_dev.c | 47 ++++++++++++++++++++++++++++------------------- 5 files changed, 61 insertions(+), 41 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 2337538..9696e7a 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -313,9 +313,11 @@ static inline bool eth_type_vlan(__be16 ethertype) static inline bool vlan_hw_offload_capable(netdev_features_t features, __be16 proto) { - if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX) + if (proto == htons(ETH_P_8021Q) && + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) return true; - if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX) + if (proto == htons(ETH_P_8021AD) && + netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, features)) return true; return false; } @@ -563,7 +565,8 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, */ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) { - if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + skb->dev->features)) { return __vlan_hwaccel_get_tag(skb, vlan_tci); } else { return __vlan_get_tag(skb, vlan_tci); @@ -736,9 +739,10 @@ static inline void vlan_features_check(struct sk_buff *skb, * sure that only devices supporting NETIF_F_HW_CSUM will * have checksum offloading support. */ - *features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | - NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_HIGHDMA | + NETIF_F_HW_CSUM | NETIF_F_FRAGLIST | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, features); } }
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 55275ef..8a50def 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -134,7 +134,8 @@ int vlan_check_real_dev(struct net_device *real_dev, { const char *name = real_dev->name;
- if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { + if (netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT, + real_dev->features)) { pr_info("VLANs not supported on %s\n", name); NL_SET_ERR_MSG_MOD(extack, "VLANs not supported on device"); return -EOPNOTSUPP; @@ -339,7 +340,7 @@ static void vlan_transfer_features(struct net_device *dev,
vlandev->priv_flags &= ~IFF_XMIT_DST_RELEASE; vlandev->priv_flags |= (vlan->real_dev->priv_flags & IFF_XMIT_DST_RELEASE); - vlandev->hw_enc_features = vlan_tnl_features(vlan->real_dev); + vlan_tnl_features(vlan->real_dev, &vlandev->hw_enc_features);
netdev_update_features(vlandev); } @@ -386,13 +387,15 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, }
if ((event == NETDEV_UP) && - (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) { + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + dev->features)) { pr_info("adding VLAN 0 to HW filter on device %s\n", dev->name); vlan_vid_add(dev, htons(ETH_P_8021Q), 0); } if (event == NETDEV_DOWN && - (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + dev->features)) vlan_vid_del(dev, htons(ETH_P_8021Q), 0);
vlan_info = rtnl_dereference(dev->vlan_info); diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 1a705a4..10b792e 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -103,17 +103,19 @@ static inline struct net_device *vlan_find_dev(struct net_device *real_dev, return NULL; }
-static inline netdev_features_t vlan_tnl_features(struct net_device *real_dev) +static inline void vlan_tnl_features(struct net_device *real_dev, + netdev_features_t *tnl) { - netdev_features_t ret; - - ret = real_dev->hw_enc_features & - (NETIF_F_CSUM_MASK | NETIF_F_GSO_SOFTWARE | - NETIF_F_GSO_ENCAP_ALL); - - if ((ret & NETIF_F_GSO_ENCAP_ALL) && (ret & NETIF_F_CSUM_MASK)) - return (ret & ~NETIF_F_CSUM_MASK) | NETIF_F_HW_CSUM; - return 0; + netdev_feature_zero(tnl); + netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_SOFTWARE | + NETIF_F_GSO_ENCAP_ALL, tnl); + netdev_feature_and(tnl, *tnl, real_dev->hw_enc_features); + + if (netdev_feature_test_bits(NETIF_F_GSO_ENCAP_ALL, *tnl) && + netdev_feature_test_bits(NETIF_F_CSUM_MASK, *tnl)) { + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, tnl); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, tnl); + } }
#define vlan_group_for_each_dev(grp, i, dev) \ diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 59bc13b..757b2f1 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -169,10 +169,12 @@ struct vlan_vid_info { static bool vlan_hw_filter_capable(const struct net_device *dev, __be16 proto) { if (proto == htons(ETH_P_8021Q) && - dev->features & NETIF_F_HW_VLAN_CTAG_FILTER) + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + dev->features)) return true; if (proto == htons(ETH_P_8021AD) && - dev->features & NETIF_F_HW_VLAN_STAG_FILTER) + netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, + dev->features)) return true; return false; } diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 9f90a58..a010612 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -566,21 +566,24 @@ static int vlan_dev_init(struct net_device *dev) if (vlan->flags & VLAN_FLAG_BRIDGE_BINDING) dev->state |= (1 << __LINK_STATE_NOCARRIER);
- dev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | - NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | - NETIF_F_GSO_ENCAP_ALL | - NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC | - NETIF_F_ALL_FCOE; - - dev->features |= dev->hw_features | NETIF_F_LLTX; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | + NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | + NETIF_F_GSO_ENCAP_ALL | + NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC | + NETIF_F_ALL_FCOE, &dev->hw_features); + + netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); dev->gso_max_size = real_dev->gso_max_size; dev->gso_max_segs = real_dev->gso_max_segs; - if (dev->features & NETIF_F_VLAN_FEATURES) + if (netdev_feature_test_bits(NETIF_F_VLAN_FEATURES, dev->features)) netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n");
- dev->vlan_features = real_dev->vlan_features & ~NETIF_F_ALL_FCOE; - dev->hw_enc_features = vlan_tnl_features(real_dev); - dev->mpls_features = real_dev->mpls_features; + netdev_feature_copy(&dev->vlan_features, real_dev->vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_FCOE, &dev->vlan_features); + vlan_tnl_features(real_dev, &dev->hw_enc_features); + netdev_feature_copy(&dev->mpls_features, real_dev->mpls_features);
/* ipv6 shared card related stuff */ dev->dev_id = real_dev->dev_id; @@ -637,21 +640,27 @@ static void vlan_dev_fix_features(struct net_device *dev, netdev_features_t *features) { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; - netdev_features_t old_features = *features; netdev_features_t lower_features; + netdev_features_t old_features; + netdev_features_t tmp;
- netdev_intersect_features(&lower_features, - (real_dev->vlan_features | NETIF_F_RXCSUM), - real_dev->features); + netdev_feature_copy(&tmp, real_dev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &tmp); + netdev_feature_copy(&old_features, *features); + netdev_intersect_features(&lower_features, tmp, real_dev->features);
/* Add HW_CSUM setting to preserve user ability to control * checksum offload on the vlan device. */ - if (lower_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) - lower_features |= NETIF_F_HW_CSUM; + if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + lower_features)) + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &lower_features); netdev_intersect_features(features, *features, lower_features); - *features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE); - *features |= NETIF_F_LLTX; + + netdev_feature_and_bits(NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE, + &old_features); + netdev_feature_or(features, *features, old_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
static int vlan_ethtool_get_link_ksettings(struct net_device *dev,
在 2021/8/11 22:44, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
include/linux/if_vlan.h | 16 ++++++++++------ net/8021q/vlan.c | 11 +++++++---- net/8021q/vlan.h | 22 ++++++++++++---------- net/8021q/vlan_core.c | 6 ++++-- net/8021q/vlan_dev.c | 47 ++++++++++++++++++++++++++++------------------- 5 files changed, 61 insertions(+), 41 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 2337538..9696e7a 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -313,9 +313,11 @@ static inline bool eth_type_vlan(__be16 ethertype) static inline bool vlan_hw_offload_capable(netdev_features_t features, __be16 proto) {
- if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX)
- if (proto == htons(ETH_P_8021Q) &&
return true;netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features))
- if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX)
- if (proto == htons(ETH_P_8021AD) &&
return true; return false; }netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, features))
@@ -563,7 +565,8 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, */ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) {
- if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
return __vlan_hwaccel_get_tag(skb, vlan_tci); } else { return __vlan_get_tag(skb, vlan_tci);skb->dev->features)) {
@@ -736,9 +739,10 @@ static inline void vlan_features_check(struct sk_buff *skb, * sure that only devices supporting NETIF_F_HW_CSUM will * have checksum offloading support. */
*features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX;
netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_HIGHDMA |
NETIF_F_HW_CSUM | NETIF_F_FRAGLIST |
NETIF_F_HW_VLAN_CTAG_TX |
} }NETIF_F_HW_VLAN_STAG_TX, features);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 55275ef..8a50def 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -134,7 +134,8 @@ int vlan_check_real_dev(struct net_device *real_dev, { const char *name = real_dev->name;
- if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
- if (netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT,
pr_info("VLANs not supported on %s\n", name); NL_SET_ERR_MSG_MOD(extack, "VLANs not supported on device"); return -EOPNOTSUPP;real_dev->features)) {
@@ -339,7 +340,7 @@ static void vlan_transfer_features(struct net_device *dev,
vlandev->priv_flags &= ~IFF_XMIT_DST_RELEASE; vlandev->priv_flags |= (vlan->real_dev->priv_flags & IFF_XMIT_DST_RELEASE);
- vlandev->hw_enc_features = vlan_tnl_features(vlan->real_dev);
vlan_tnl_features(vlan->real_dev, &vlandev->hw_enc_features);
netdev_update_features(vlandev); }
@@ -386,13 +387,15 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, }
if ((event == NETDEV_UP) &&
(dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
pr_info("adding VLAN 0 to HW filter on device %s\n", dev->name); vlan_vid_add(dev, htons(ETH_P_8021Q), 0); } if (event == NETDEV_DOWN &&dev->features)) {
(dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
dev->features))
vlan_vid_del(dev, htons(ETH_P_8021Q), 0);
vlan_info = rtnl_dereference(dev->vlan_info);
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 1a705a4..10b792e 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -103,17 +103,19 @@ static inline struct net_device *vlan_find_dev(struct net_device *real_dev, return NULL; }
-static inline netdev_features_t vlan_tnl_features(struct net_device *real_dev) +static inline void vlan_tnl_features(struct net_device *real_dev,
{netdev_features_t *tnl)
- netdev_features_t ret;
- ret = real_dev->hw_enc_features &
(NETIF_F_CSUM_MASK | NETIF_F_GSO_SOFTWARE |
NETIF_F_GSO_ENCAP_ALL);
- if ((ret & NETIF_F_GSO_ENCAP_ALL) && (ret & NETIF_F_CSUM_MASK))
return (ret & ~NETIF_F_CSUM_MASK) | NETIF_F_HW_CSUM;
- return 0;
- netdev_feature_zero(tnl);
- netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_SOFTWARE |
NETIF_F_GSO_ENCAP_ALL, tnl);
- netdev_feature_and(tnl, *tnl, real_dev->hw_enc_features);
- if (netdev_feature_test_bits(NETIF_F_GSO_ENCAP_ALL, *tnl) &&
netdev_feature_test_bits(NETIF_F_CSUM_MASK, *tnl)) {
netdev_feature_clear_bits(NETIF_F_CSUM_MASK, tnl);
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, tnl);
- }
it missing "netdev_feature_zero(tnl);" here, will fix it next version.
}
#define vlan_group_for_each_dev(grp, i, dev) \ diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 59bc13b..757b2f1 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -169,10 +169,12 @@ struct vlan_vid_info { static bool vlan_hw_filter_capable(const struct net_device *dev, __be16 proto) { if (proto == htons(ETH_P_8021Q) &&
dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
return true; if (proto == htons(ETH_P_8021AD) &&dev->features))
dev->features & NETIF_F_HW_VLAN_STAG_FILTER)
netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT,
return true; return false; }dev->features))
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 9f90a58..a010612 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -566,21 +566,24 @@ static int vlan_dev_init(struct net_device *dev) if (vlan->flags & VLAN_FLAG_BRIDGE_BINDING) dev->state |= (1 << __LINK_STATE_NOCARRIER);
- dev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE |
NETIF_F_GSO_ENCAP_ALL |
NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC |
NETIF_F_ALL_FCOE;
- dev->features |= dev->hw_features | NETIF_F_LLTX;
- netdev_feature_zero(&dev->hw_features);
- netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE |
NETIF_F_GSO_ENCAP_ALL |
NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC |
NETIF_F_ALL_FCOE, &dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features);
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); dev->gso_max_size = real_dev->gso_max_size; dev->gso_max_segs = real_dev->gso_max_segs;
- if (dev->features & NETIF_F_VLAN_FEATURES)
- if (netdev_feature_test_bits(NETIF_F_VLAN_FEATURES, dev->features)) netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n");
- dev->vlan_features = real_dev->vlan_features & ~NETIF_F_ALL_FCOE;
- dev->hw_enc_features = vlan_tnl_features(real_dev);
- dev->mpls_features = real_dev->mpls_features;
netdev_feature_copy(&dev->vlan_features, real_dev->vlan_features);
netdev_feature_clear_bits(NETIF_F_ALL_FCOE, &dev->vlan_features);
vlan_tnl_features(real_dev, &dev->hw_enc_features);
netdev_feature_copy(&dev->mpls_features, real_dev->mpls_features);
/* ipv6 shared card related stuff */ dev->dev_id = real_dev->dev_id;
@@ -637,21 +640,27 @@ static void vlan_dev_fix_features(struct net_device *dev, netdev_features_t *features) { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
- netdev_features_t old_features = *features; netdev_features_t lower_features;
- netdev_features_t old_features;
- netdev_features_t tmp;
- netdev_intersect_features(&lower_features,
(real_dev->vlan_features | NETIF_F_RXCSUM),
real_dev->features);
netdev_feature_copy(&tmp, real_dev->vlan_features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &tmp);
netdev_feature_copy(&old_features, *features);
netdev_intersect_features(&lower_features, tmp, real_dev->features);
/* Add HW_CSUM setting to preserve user ability to control
- checksum offload on the vlan device.
*/
- if (lower_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
lower_features |= NETIF_F_HW_CSUM;
- if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
lower_features))
netdev_intersect_features(features, *features, lower_features);netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &lower_features);
- *features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE);
- *features |= NETIF_F_LLTX;
netdev_feature_and_bits(NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE,
&old_features);
netdev_feature_or(features, *features, old_features);
netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
static int vlan_ethtool_get_link_ksettings(struct net_device *dev,
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/bridge/br_device.c | 16 +++++++++++----- net/bridge/br_if.c | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index fc508b9..c9894b9 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -490,11 +490,17 @@ void br_dev_setup(struct net_device *dev) SET_NETDEV_DEVTYPE(dev, &br_type); dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
- dev->features = COMMON_FEATURES | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; - dev->hw_features = COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; - dev->vlan_features = COMMON_FEATURES; + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_LLTX | + NETIF_F_NETNS_LOCAL | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &dev->features); + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, &dev->hw_features); + netdev_feature_zero(&dev->vlan_features); + netdev_feature_set_bits(COMMON_FEATURES, &dev->vlan_features);
br->dev = dev; spin_lock_init(&br->lock); diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index be64802..c94e329 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -540,8 +540,8 @@ void br_features_recompute(struct net_bridge *br, netdev_features_t *features) if (list_empty(&br->port_list)) return;
- mask = *features; - *features &= ~NETIF_F_ONE_FOR_ALL; + netdev_feature_copy(&mask, *features); + netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features);
list_for_each_entry(p, &br->port_list, list) { netdev_increment_features(features, *features, p->dev->features,
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ipvlan/ipvlan_main.c | 28 ++++++++++++++++++---------- drivers/net/ipvlan/ipvtap.c | 4 ++-- 2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 6a0b7bd..84ad786a 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -135,11 +135,14 @@ static int ipvlan_init(struct net_device *dev)
dev->state = (dev->state & ~IPVLAN_STATE_MASK) | (phy_dev->state & IPVLAN_STATE_MASK); - dev->features = phy_dev->features & IPVLAN_FEATURES; - dev->features |= IPVLAN_ALWAYS_ON; - dev->vlan_features = phy_dev->vlan_features & IPVLAN_FEATURES; - dev->vlan_features |= IPVLAN_ALWAYS_ON_OFLOADS; - dev->hw_enc_features |= dev->features; + netdev_feature_copy(&dev->features, phy_dev->features); + netdev_feature_and_bits(IPVLAN_FEATURES, &dev->features); + netdev_feature_set_bits(IPVLAN_ALWAYS_ON, &dev->features); + netdev_feature_copy(&dev->vlan_features, phy_dev->vlan_features); + netdev_feature_and_bits(IPVLAN_FEATURES, &dev->vlan_features); + netdev_feature_set_bits(IPVLAN_ALWAYS_ON_OFLOADS, &dev->vlan_features); + netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + dev->features); dev->gso_max_size = phy_dev->gso_max_size; dev->gso_max_segs = phy_dev->gso_max_segs; dev->hard_header_len = phy_dev->hard_header_len; @@ -239,13 +242,17 @@ static void ipvlan_fix_features(struct net_device *dev, netdev_features_t *features) { struct ipvl_dev *ipvlan = netdev_priv(dev); + netdev_features_t tmp;
- *features |= NETIF_F_ALL_FOR_ALL; - *features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES); + netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); + netdev_feature_fill(&tmp); + netdev_feature_clear_bits(IPVLAN_FEATURES, &tmp); + netdev_feature_or(&tmp, tmp, ipvlan->sfeatures); + netdev_feature_and(features, *features, tmp); netdev_increment_features(features, ipvlan->phy_dev->features, *features, *features); - *features |= IPVLAN_ALWAYS_ON; - *features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON); + netdev_feature_set_bits(IPVLAN_ALWAYS_ON, features); + netdev_feature_and_bits(IPVLAN_FEATURES | IPVLAN_ALWAYS_ON, features); }
static void ipvlan_change_rx_flags(struct net_device *dev, int change) @@ -567,7 +574,8 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
ipvlan->phy_dev = phy_dev; ipvlan->dev = dev; - ipvlan->sfeatures = IPVLAN_FEATURES; + netdev_feature_zero(&ipvlan->sfeatures); + netdev_feature_set_bits(IPVLAN_FEATURES, &ipvlan->sfeatures); if (!tb[IFLA_MTU]) ipvlan_adjust_mtu(ipvlan, phy_dev); INIT_LIST_HEAD(&ipvlan->addrs); diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c index 1cedb63..e7fb343 100644 --- a/drivers/net/ipvlan/ipvtap.c +++ b/drivers/net/ipvlan/ipvtap.c @@ -70,7 +70,7 @@ static void ipvtap_update_features(struct tap_dev *tap, struct ipvtap_dev *vlantap = container_of(tap, struct ipvtap_dev, tap); struct ipvl_dev *vlan = &vlantap->vlan;
- vlan->sfeatures = features; + netdev_feature_copy(&vlan->sfeatures, features); netdev_update_features(vlan->dev); }
@@ -86,7 +86,7 @@ static int ipvtap_newlink(struct net *src_net, struct net_device *dev, /* Since macvlan supports all offloads by default, make * tap support all offloads also. */ - vlantap->tap.tap_features = TUN_OFFLOADS; + netdev_feature_set_bits(TUN_OFFLOADS, &vlantap->tap.tap_features); vlantap->tap.count_tx_dropped = ipvtap_count_tx_dropped; vlantap->tap.update_features = ipvtap_update_features; vlantap->tap.count_rx_dropped = ipvtap_count_rx_dropped;
在 2021/8/11 22:44, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ipvlan/ipvlan_main.c | 28 ++++++++++++++++++---------- drivers/net/ipvlan/ipvtap.c | 4 ++-- 2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 6a0b7bd..84ad786a 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -135,11 +135,14 @@ static int ipvlan_init(struct net_device *dev)
dev->state = (dev->state & ~IPVLAN_STATE_MASK) | (phy_dev->state & IPVLAN_STATE_MASK);
- dev->features = phy_dev->features & IPVLAN_FEATURES;
- dev->features |= IPVLAN_ALWAYS_ON;
- dev->vlan_features = phy_dev->vlan_features & IPVLAN_FEATURES;
- dev->vlan_features |= IPVLAN_ALWAYS_ON_OFLOADS;
- dev->hw_enc_features |= dev->features;
- netdev_feature_copy(&dev->features, phy_dev->features);
- netdev_feature_and_bits(IPVLAN_FEATURES, &dev->features);
- netdev_feature_set_bits(IPVLAN_ALWAYS_ON, &dev->features);
- netdev_feature_copy(&dev->vlan_features, phy_dev->vlan_features);
- netdev_feature_and_bits(IPVLAN_FEATURES, &dev->vlan_features);
- netdev_feature_set_bits(IPVLAN_ALWAYS_ON_OFLOADS, &dev->vlan_features);
- netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features,
dev->gso_max_size = phy_dev->gso_max_size; dev->gso_max_segs = phy_dev->gso_max_segs; dev->hard_header_len = phy_dev->hard_header_len;dev->features);
@@ -239,13 +242,17 @@ static void ipvlan_fix_features(struct net_device *dev, netdev_features_t *features) { struct ipvl_dev *ipvlan = netdev_priv(dev);
- netdev_features_t tmp;
- *features |= NETIF_F_ALL_FOR_ALL;
- *features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES);
- netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
- netdev_feature_fill(&tmp);
- netdev_feature_clear_bits(IPVLAN_FEATURES, &tmp);
- netdev_feature_or(&tmp, tmp, ipvlan->sfeatures);
- netdev_feature_and(features, *features, tmp); netdev_increment_features(features, ipvlan->phy_dev->features, *features, *features);
- *features |= IPVLAN_ALWAYS_ON;
- *features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON);
netdev_feature_set_bits(IPVLAN_ALWAYS_ON, features);
netdev_feature_and_bits(IPVLAN_FEATURES | IPVLAN_ALWAYS_ON, features); }
static void ipvlan_change_rx_flags(struct net_device *dev, int change)
@@ -567,7 +574,8 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
ipvlan->phy_dev = phy_dev; ipvlan->dev = dev;
- ipvlan->sfeatures = IPVLAN_FEATURES;
- netdev_feature_zero(&ipvlan->sfeatures);
- netdev_feature_set_bits(IPVLAN_FEATURES, &ipvlan->sfeatures); if (!tb[IFLA_MTU]) ipvlan_adjust_mtu(ipvlan, phy_dev); INIT_LIST_HEAD(&ipvlan->addrs);
diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c index 1cedb63..e7fb343 100644 --- a/drivers/net/ipvlan/ipvtap.c +++ b/drivers/net/ipvlan/ipvtap.c @@ -70,7 +70,7 @@ static void ipvtap_update_features(struct tap_dev *tap, struct ipvtap_dev *vlantap = container_of(tap, struct ipvtap_dev, tap); struct ipvl_dev *vlan = &vlantap->vlan;
- vlan->sfeatures = features;
- netdev_feature_copy(&vlan->sfeatures, features); netdev_update_features(vlan->dev); }
@@ -86,7 +86,7 @@ static int ipvtap_newlink(struct net *src_net, struct net_device *dev, /* Since macvlan supports all offloads by default, make * tap support all offloads also. */
- vlantap->tap.tap_features = TUN_OFFLOADS;
missing "netdev_feature_zero(vlantap->tap.tap_features)" here, will fix it next version.
- netdev_feature_set_bits(TUN_OFFLOADS, &vlantap->tap.tap_features); vlantap->tap.count_tx_dropped = ipvtap_count_tx_dropped; vlantap->tap.update_features = ipvtap_update_features; vlantap->tap.count_rx_dropped = ipvtap_count_rx_dropped;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/veth.c | 61 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 24 deletions(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 82c900d..39bfa02 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -310,9 +310,10 @@ static bool veth_skb_is_eligible_for_gro(const struct net_device *dev, const struct net_device *rcv, const struct sk_buff *skb) { - return !(dev->features & NETIF_F_ALL_TSO) || + return !netdev_feature_test_bits(NETIF_F_ALL_TSO, dev->features) || (skb->destructor == sock_wfree && - rcv->features & (NETIF_F_GRO_FRAGLIST | NETIF_F_GRO_UDP_FWD)); + netdev_feature_test_bits(NETIF_F_GRO_FRAGLIST | + NETIF_F_GRO_UDP_FWD, rcv->features)); }
static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) @@ -993,7 +994,7 @@ static void veth_napi_del(struct net_device *dev)
static bool veth_gro_requested(const struct net_device *dev) { - return !!(dev->wanted_features & NETIF_F_GRO); + return netdev_feature_test_bit(NETIF_F_GRO_BIT, dev->wanted_features); }
static int veth_enable_xdp_range(struct net_device *dev, int start, int end, @@ -1075,7 +1076,8 @@ static int veth_enable_xdp(struct net_device *dev) /* user-space did not require GRO, but adding XDP * is supposed to get GRO working */ - dev->features |= NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_GRO_BIT, + &dev->features); netdev_features_change(dev); } } @@ -1104,7 +1106,8 @@ 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_feature_clear_bit(NETIF_F_GRO_BIT, + &dev->features); netdev_features_change(dev); } } @@ -1393,23 +1396,27 @@ static void veth_fix_features(struct net_device *dev, struct veth_priv *peer_priv = netdev_priv(peer);
if (peer_priv->_xdp_prog) - *features &= ~NETIF_F_GSO_SOFTWARE; + netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, + features); } if (priv->_xdp_prog) - *features |= NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_GRO_BIT, features); }
static int veth_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = features ^ dev->features; struct veth_priv *priv = netdev_priv(dev); + netdev_features_t changed; int err;
- if (!(changed & NETIF_F_GRO) || !(dev->flags & IFF_UP) || priv->_xdp_prog) + netdev_feature_xor(&changed, features, dev->features); + + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, changed) || + !(dev->flags & IFF_UP) || priv->_xdp_prog) return 0;
- if (features & NETIF_F_GRO) { + if (netdev_feature_test_bit(NETIF_F_GRO_BIT, features)) { err = veth_napi_enable(dev); if (err) return err; @@ -1486,7 +1493,8 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog, }
if (!old_prog) { - peer->hw_features &= ~NETIF_F_GSO_SOFTWARE; + netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, + &peer->hw_features); peer->max_mtu = max_mtu; } } @@ -1497,7 +1505,8 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog, veth_disable_xdp(dev);
if (peer) { - peer->hw_features |= NETIF_F_GSO_SOFTWARE; + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &peer->hw_features); peer->max_mtu = ETH_MAX_MTU; } } @@ -1562,20 +1571,24 @@ static void veth_setup(struct net_device *dev)
dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; - dev->features |= NETIF_F_LLTX; - dev->features |= VETH_FEATURES; - dev->vlan_features = dev->features & - ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_STAG_RX); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bits(VETH_FEATURES, &dev->features); + netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_STAG_RX, + &dev->vlan_features); dev->needs_free_netdev = true; dev->priv_destructor = veth_dev_free; dev->max_mtu = ETH_MAX_MTU;
- dev->hw_features = VETH_FEATURES; - dev->hw_enc_features = VETH_FEATURES; - dev->mpls_features = NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(VETH_FEATURES, &dev->hw_features); + netdev_feature_copy(&dev->hw_enc_features, dev->hw_features); + netdev_feature_zero(&dev->mpls_features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE, + &dev->mpls_features); }
/* @@ -1602,8 +1615,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_feature_clear_bit(NETIF_F_GRO_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_GRO_BIT, &dev->wanted_features); netdev_update_features(dev); }
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/bonding/bond_main.c | 107 ++++++++++++++++++++++++------------- drivers/net/bonding/bond_options.c | 12 +++-- 2 files changed, 77 insertions(+), 42 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3f1554c..785b12c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1365,15 +1365,15 @@ static void bond_fix_features(struct net_device *dev,
#if IS_ENABLED(CONFIG_TLS_DEVICE) if (bond_sk_check(bond)) - *features |= BOND_TLS_FEATURES; + netdev_feature_set_bits(BOND_TLS_FEATURES, features); else - *features &= ~BOND_TLS_FEATURES; + netdev_feature_clear_bits(BOND_TLS_FEATURES, features); #endif
- mask = *features; + netdev_feature_copy(&mask, *features);
- *features &= ~NETIF_F_ONE_FOR_ALL; - *features |= NETIF_F_ALL_FOR_ALL; + netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); + netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
bond_for_each_slave(bond, slave, iter) { netdev_increment_features(features, *features, @@ -1397,12 +1397,16 @@ static void bond_compute_features(struct bonding *bond) { unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; - netdev_features_t vlan_features = BOND_VLAN_FEATURES; - netdev_features_t enc_features = BOND_ENC_FEATURES; + netdev_features_t vlan_features; + netdev_features_t enc_features; + netdev_features_t vlan_mask; + netdev_features_t enc_mask; #ifdef CONFIG_XFRM_OFFLOAD - netdev_features_t xfrm_features = BOND_XFRM_FEATURES; + netdev_features_t xfrm_features; + netdev_features_t xfrm_mask; #endif /* CONFIG_XFRM_OFFLOAD */ - netdev_features_t mpls_features = BOND_MPLS_FEATURES; + netdev_features_t mpls_features; + netdev_features_t mpls_mask; struct net_device *bond_dev = bond->dev; struct list_head *iter; struct slave *slave; @@ -1410,29 +1414,44 @@ static void bond_compute_features(struct bonding *bond) unsigned int gso_max_size = GSO_MAX_SIZE; u16 gso_max_segs = GSO_MAX_SEGS;
+ netdev_feature_zero(&vlan_features); + netdev_feature_set_bits(BOND_VLAN_FEATURES, &vlan_features); + netdev_feature_copy(&vlan_mask, vlan_features); + netdev_feature_zero(&enc_features); + netdev_feature_set_bits(BOND_ENC_FEATURES, &enc_features); + netdev_feature_copy(&enc_mask, enc_features); +#ifdef CONFIG_XFRM_OFFLOAD + netdev_feature_zero(&xfrm_features); + netdev_feature_set_bits(BOND_XFRM_FEATURES, &xfrm_features); + netdev_feature_copy(&xfrm_mask, xfrm_features); +#endif /* CONFIG_XFRM_OFFLOAD */ + netdev_feature_zero(&mpls_features); + netdev_feature_set_bits(BOND_MPLS_FEATURES, &mpls_features); + netdev_feature_copy(&mpls_mask, mpls_features); + if (!bond_has_slaves(bond)) goto done; - vlan_features &= NETIF_F_ALL_FOR_ALL; - mpls_features &= NETIF_F_ALL_FOR_ALL; + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &mpls_features);
bond_for_each_slave(bond, slave, iter) { netdev_increment_features(&vlan_features, vlan_features, slave->dev->vlan_features, - BOND_VLAN_FEATURES); + vlan_mask);
netdev_increment_features(&enc_features, enc_features, slave->dev->hw_enc_features, - BOND_ENC_FEATURES); + enc_mask);
#ifdef CONFIG_XFRM_OFFLOAD netdev_increment_features(&xfrm_features, xfrm_features, slave->dev->hw_enc_features, - BOND_XFRM_FEATURES); + xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */
netdev_increment_features(&mpls_features, mpls_features, slave->dev->mpls_features, - BOND_MPLS_FEATURES); + mpls_mask);
dst_release_flag &= slave->dev->priv_flags; if (slave->dev->hard_header_len > max_hard_header_len) @@ -1444,14 +1463,16 @@ static void bond_compute_features(struct bonding *bond) bond_dev->hard_header_len = max_hard_header_len;
done: - bond_dev->vlan_features = vlan_features; - bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_copy(&bond_dev->vlan_features, vlan_features); + netdev_feature_copy(&bond_dev->hw_enc_features, enc_features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, &mpls_features); #ifdef CONFIG_XFRM_OFFLOAD - bond_dev->hw_enc_features |= xfrm_features; + netdev_feature_or(&bond_dev->vlan_features, bond_dev->vlan_features, + xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */ - bond_dev->mpls_features = mpls_features; + netdev_feature_copy(&bond_dev->mpls_features, mpls_features); bond_dev->gso_max_segs = gso_max_segs; netif_set_gso_max_size(bond_dev, gso_max_size);
@@ -1764,7 +1785,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
/* vlan challenged mutual exclusion */ /* no need to lock since we're protected by rtnl_lock */ - if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { + if (netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT, + slave_dev->features)) { slave_dbg(bond_dev, slave_dev, "is NETIF_F_VLAN_CHALLENGED\n"); if (vlan_uses_dev(bond_dev)) { NL_SET_ERR_MSG(extack, "Can not enslave VLAN challenged device to VLAN enabled bond"); @@ -1777,7 +1799,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, slave_dbg(bond_dev, slave_dev, "is !NETIF_F_VLAN_CHALLENGED\n"); }
- if (slave_dev->features & NETIF_F_HW_ESP) + if (netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, slave_dev->features)) slave_dbg(bond_dev, slave_dev, "is esp-hw-offload capable\n");
/* Old ifenslave binaries are no longer supported. These can @@ -2072,7 +2094,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, } #endif
- if (!(bond_dev->features & NETIF_F_LRO)) + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, bond_dev->features)) dev_disable_lro(slave_dev);
res = netdev_rx_handler_register(slave_dev, bond_handle_frame, @@ -2272,8 +2294,9 @@ static int __bond_release_one(struct net_device *bond_dev, struct slave *slave, *oldcurrent; struct sockaddr_storage ss; int old_flags = bond_dev->flags; - netdev_features_t old_features = bond_dev->features; + netdev_features_t old_features;
+ netdev_feature_copy(&old_features, bond_dev->features); /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || !netdev_has_upper_dev(slave_dev, bond_dev)) { @@ -2377,8 +2400,10 @@ static int __bond_release_one(struct net_device *bond_dev, }
bond_compute_features(bond); - if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && - (old_features & NETIF_F_VLAN_CHALLENGED)) + if (!netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT, + bond_dev->features) && + netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT, + old_features)) slave_info(bond_dev, slave_dev, "last VLAN challenged slave left bond - VLAN blocking is removed\n");
vlan_vids_del_by_dev(slave_dev, bond_dev); @@ -5398,7 +5423,7 @@ void bond_setup(struct net_device *bond_dev) #endif /* CONFIG_XFRM_OFFLOAD */
/* don't acquire bond device's netif_tx_lock when transmitting */ - bond_dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &bond_dev->features);
/* By default, we declare the bond to be fully * VLAN hardware accelerated capable. Special @@ -5408,24 +5433,30 @@ void bond_setup(struct net_device *bond_dev) */
/* Don't allow bond devices to change network namespaces. */ - bond_dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &bond_dev->features);
- bond_dev->hw_features = BOND_VLAN_FEATURES | + netdev_feature_zero(&bond_dev->hw_features); + netdev_feature_set_bits(BOND_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER; - - bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; - bond_dev->features |= bond_dev->hw_features; - bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; + NETIF_F_HW_VLAN_CTAG_FILTER, + &bond_dev->hw_features); + + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &bond_dev->hw_features); + netdev_feature_or(&bond_dev->features, bond_dev->features, + bond_dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &bond_dev->features); #ifdef CONFIG_XFRM_OFFLOAD - bond_dev->hw_features |= BOND_XFRM_FEATURES; + netdev_feature_set_bits(BOND_XFRM_FEATURES, &bond_dev->hw_features); /* Only enable XFRM features if this is an active-backup config */ if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) - bond_dev->features |= BOND_XFRM_FEATURES; + netdev_feature_set_bits(BOND_XFRM_FEATURES, + &bond_dev->features); #endif /* CONFIG_XFRM_OFFLOAD */ #if IS_ENABLED(CONFIG_TLS_DEVICE) if (bond_sk_check(bond)) - bond_dev->features |= BOND_TLS_FEATURES; + netdev_feature_set_bits(BOND_TLS_FEATURES, &bond_dev->features); #endif }
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index a8fde3b..b0c3a28 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -778,9 +778,11 @@ static bool bond_set_xfrm_features(struct bonding *bond) return false;
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) - bond->dev->wanted_features |= BOND_XFRM_FEATURES; + netdev_feature_set_bits(BOND_XFRM_FEATURES, + &bond->dev->wanted_features); else - bond->dev->wanted_features &= ~BOND_XFRM_FEATURES; + netdev_feature_clear_bits(BOND_XFRM_FEATURES, + &bond->dev->wanted_features);
return true; } @@ -791,9 +793,11 @@ static bool bond_set_tls_features(struct bonding *bond) return false;
if (bond_sk_check(bond)) - bond->dev->wanted_features |= BOND_TLS_FEATURES; + netdev_feature_set_bits(BOND_TLS_FEATURES, + &bond->dev->wanted_features); else - bond->dev->wanted_features &= ~BOND_TLS_FEATURES; + netdev_feature_clear_bits(BOND_TLS_FEATURES, + &bond->dev->wanted_features);
return true; }
在 2021/8/11 22:44, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/bonding/bond_main.c | 107 ++++++++++++++++++++++++------------- drivers/net/bonding/bond_options.c | 12 +++-- 2 files changed, 77 insertions(+), 42 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3f1554c..785b12c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1365,15 +1365,15 @@ static void bond_fix_features(struct net_device *dev,
#if IS_ENABLED(CONFIG_TLS_DEVICE) if (bond_sk_check(bond))
*features |= BOND_TLS_FEATURES;
elsenetdev_feature_set_bits(BOND_TLS_FEATURES, features);
*features &= ~BOND_TLS_FEATURES;
#endifnetdev_feature_clear_bits(BOND_TLS_FEATURES, features);
- mask = *features;
- netdev_feature_copy(&mask, *features);
- *features &= ~NETIF_F_ONE_FOR_ALL;
- *features |= NETIF_F_ALL_FOR_ALL;
netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features);
netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
bond_for_each_slave(bond, slave, iter) { netdev_increment_features(features, *features,
@@ -1397,12 +1397,16 @@ static void bond_compute_features(struct bonding *bond) { unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM;
- netdev_features_t vlan_features = BOND_VLAN_FEATURES;
- netdev_features_t enc_features = BOND_ENC_FEATURES;
- netdev_features_t vlan_features;
- netdev_features_t enc_features;
- netdev_features_t vlan_mask;
- netdev_features_t enc_mask; #ifdef CONFIG_XFRM_OFFLOAD
- netdev_features_t xfrm_features = BOND_XFRM_FEATURES;
- netdev_features_t xfrm_features;
- netdev_features_t xfrm_mask; #endif /* CONFIG_XFRM_OFFLOAD */
- netdev_features_t mpls_features = BOND_MPLS_FEATURES;
- netdev_features_t mpls_features;
- netdev_features_t mpls_mask; struct net_device *bond_dev = bond->dev; struct list_head *iter; struct slave *slave;
@@ -1410,29 +1414,44 @@ static void bond_compute_features(struct bonding *bond) unsigned int gso_max_size = GSO_MAX_SIZE; u16 gso_max_segs = GSO_MAX_SEGS;
- netdev_feature_zero(&vlan_features);
- netdev_feature_set_bits(BOND_VLAN_FEATURES, &vlan_features);
- netdev_feature_copy(&vlan_mask, vlan_features);
- netdev_feature_zero(&enc_features);
- netdev_feature_set_bits(BOND_ENC_FEATURES, &enc_features);
- netdev_feature_copy(&enc_mask, enc_features);
+#ifdef CONFIG_XFRM_OFFLOAD
- netdev_feature_zero(&xfrm_features);
- netdev_feature_set_bits(BOND_XFRM_FEATURES, &xfrm_features);
- netdev_feature_copy(&xfrm_mask, xfrm_features);
+#endif /* CONFIG_XFRM_OFFLOAD */
- netdev_feature_zero(&mpls_features);
- netdev_feature_set_bits(BOND_MPLS_FEATURES, &mpls_features);
- netdev_feature_copy(&mpls_mask, mpls_features);
- if (!bond_has_slaves(bond)) goto done;
- vlan_features &= NETIF_F_ALL_FOR_ALL;
- mpls_features &= NETIF_F_ALL_FOR_ALL;
- netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &vlan_features);
- netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &mpls_features);
it should use netdev_feature_and_bits, not netdev_features_clear_bits. Will fix it next version.
bond_for_each_slave(bond, slave, iter) { netdev_increment_features(&vlan_features, vlan_features, slave->dev->vlan_features,
BOND_VLAN_FEATURES);
vlan_mask);
netdev_increment_features(&enc_features, enc_features, slave->dev->hw_enc_features,
BOND_ENC_FEATURES);
enc_mask);
#ifdef CONFIG_XFRM_OFFLOAD netdev_increment_features(&xfrm_features, xfrm_features, slave->dev->hw_enc_features,
BOND_XFRM_FEATURES);
xfrm_features);
it should be "xfrm_mask" here, will fix it next version
#endif /* CONFIG_XFRM_OFFLOAD */
netdev_increment_features(&mpls_features, mpls_features, slave->dev->mpls_features,
BOND_MPLS_FEATURES);
mpls_mask);
dst_release_flag &= slave->dev->priv_flags; if (slave->dev->hard_header_len > max_hard_header_len)
@@ -1444,14 +1463,16 @@ static void bond_compute_features(struct bonding *bond) bond_dev->hard_header_len = max_hard_header_len;
done:
- bond_dev->vlan_features = vlan_features;
- bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX;
- netdev_feature_copy(&bond_dev->vlan_features, vlan_features);
- netdev_feature_copy(&bond_dev->hw_enc_features, enc_features);
- netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL |
NETIF_F_HW_VLAN_CTAG_TX |
#ifdef CONFIG_XFRM_OFFLOADNETIF_F_HW_VLAN_STAG_TX, &mpls_features);
- bond_dev->hw_enc_features |= xfrm_features;
- netdev_feature_or(&bond_dev->vlan_features, bond_dev->vlan_features,
#endif /* CONFIG_XFRM_OFFLOAD */xfrm_features);
- bond_dev->mpls_features = mpls_features;
- netdev_feature_copy(&bond_dev->mpls_features, mpls_features); bond_dev->gso_max_segs = gso_max_segs; netif_set_gso_max_size(bond_dev, gso_max_size);
@@ -1764,7 +1785,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
/* vlan challenged mutual exclusion */ /* no need to lock since we're protected by rtnl_lock */
- if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
- if (netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT,
slave_dbg(bond_dev, slave_dev, "is NETIF_F_VLAN_CHALLENGED\n"); if (vlan_uses_dev(bond_dev)) { NL_SET_ERR_MSG(extack, "Can not enslave VLAN challenged device to VLAN enabled bond");slave_dev->features)) {
@@ -1777,7 +1799,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, slave_dbg(bond_dev, slave_dev, "is !NETIF_F_VLAN_CHALLENGED\n"); }
- if (slave_dev->features & NETIF_F_HW_ESP)
if (netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, slave_dev->features)) slave_dbg(bond_dev, slave_dev, "is esp-hw-offload capable\n");
/* Old ifenslave binaries are no longer supported. These can
@@ -2072,7 +2094,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, } #endif
- if (!(bond_dev->features & NETIF_F_LRO))
if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, bond_dev->features)) dev_disable_lro(slave_dev);
res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
@@ -2272,8 +2294,9 @@ static int __bond_release_one(struct net_device *bond_dev, struct slave *slave, *oldcurrent; struct sockaddr_storage ss; int old_flags = bond_dev->flags;
- netdev_features_t old_features = bond_dev->features;
netdev_features_t old_features;
netdev_feature_copy(&old_features, bond_dev->features); /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || !netdev_has_upper_dev(slave_dev, bond_dev)) {
@@ -2377,8 +2400,10 @@ static int __bond_release_one(struct net_device *bond_dev, }
bond_compute_features(bond);
- if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
(old_features & NETIF_F_VLAN_CHALLENGED))
if (!netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT,
bond_dev->features) &&
netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT,
old_features))
slave_info(bond_dev, slave_dev, "last VLAN challenged slave left bond - VLAN blocking is removed\n");
vlan_vids_del_by_dev(slave_dev, bond_dev);
@@ -5398,7 +5423,7 @@ void bond_setup(struct net_device *bond_dev) #endif /* CONFIG_XFRM_OFFLOAD */
/* don't acquire bond device's netif_tx_lock when transmitting */
- bond_dev->features |= NETIF_F_LLTX;
netdev_feature_set_bit(NETIF_F_LLTX_BIT, &bond_dev->features);
/* By default, we declare the bond to be fully
- VLAN hardware accelerated capable. Special
@@ -5408,24 +5433,30 @@ void bond_setup(struct net_device *bond_dev) */
/* Don't allow bond devices to change network namespaces. */
- bond_dev->features |= NETIF_F_NETNS_LOCAL;
- netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &bond_dev->features);
- bond_dev->hw_features = BOND_VLAN_FEATURES |
- netdev_feature_zero(&bond_dev->hw_features);
- netdev_feature_set_bits(BOND_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER;
- bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
- bond_dev->features |= bond_dev->hw_features;
- bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
NETIF_F_HW_VLAN_CTAG_FILTER,
&bond_dev->hw_features);
- netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &bond_dev->hw_features);
- netdev_feature_or(&bond_dev->features, bond_dev->features,
bond_dev->hw_features);
- netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX,
#ifdef CONFIG_XFRM_OFFLOAD&bond_dev->features);
- bond_dev->hw_features |= BOND_XFRM_FEATURES;
- netdev_feature_set_bits(BOND_XFRM_FEATURES, &bond_dev->hw_features); /* Only enable XFRM features if this is an active-backup config */ if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
bond_dev->features |= BOND_XFRM_FEATURES;
netdev_feature_set_bits(BOND_XFRM_FEATURES,
#endif /* CONFIG_XFRM_OFFLOAD */ #if IS_ENABLED(CONFIG_TLS_DEVICE) if (bond_sk_check(bond))&bond_dev->features);
bond_dev->features |= BOND_TLS_FEATURES;
#endif }netdev_feature_set_bits(BOND_TLS_FEATURES, &bond_dev->features);
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index a8fde3b..b0c3a28 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -778,9 +778,11 @@ static bool bond_set_xfrm_features(struct bonding *bond) return false;
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
bond->dev->wanted_features |= BOND_XFRM_FEATURES;
netdev_feature_set_bits(BOND_XFRM_FEATURES,
else&bond->dev->wanted_features);
bond->dev->wanted_features &= ~BOND_XFRM_FEATURES;
netdev_feature_clear_bits(BOND_XFRM_FEATURES,
&bond->dev->wanted_features);
return true; }
@@ -791,9 +793,11 @@ static bool bond_set_tls_features(struct bonding *bond) return false;
if (bond_sk_check(bond))
bond->dev->wanted_features |= BOND_TLS_FEATURES;
netdev_feature_set_bits(BOND_TLS_FEATURES,
else&bond->dev->wanted_features);
bond->dev->wanted_features &= ~BOND_TLS_FEATURES;
netdev_feature_clear_bits(BOND_TLS_FEATURES,
&bond->dev->wanted_features);
return true; }
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/tun.c | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index ca0aa4c..be45675 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1083,9 +1083,11 @@ static void tun_net_fix_features(struct net_device *dev, netdev_features_t *features) { struct tun_struct *tun = netdev_priv(dev); + netdev_features_t tmp;
- *features = (*features & tun->set_features) | - (*features & ~TUN_USER_FEATURES); + netdev_feature_and(&tmp, *features, tun->set_features); + netdev_feature_clear_bits(TUN_USER_FEATURES, features); + netdev_feature_or(features, *features, tmp); }
static void tun_set_headroom(struct net_device *dev, int new_hr) @@ -2727,13 +2729,18 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) tun_net_init(dev); tun_flow_init(tun);
- dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | - TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; - dev->features = dev->hw_features | NETIF_F_LLTX; - dev->vlan_features = dev->features & - ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX); + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | + TUN_USER_FEATURES | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &dev->vlan_features);
tun->flags = (tun->flags & ~TUN_FEATURES) | (ifr->ifr_flags & TUN_FEATURES); @@ -2795,21 +2802,26 @@ static void tun_get_iff(struct tun_struct *tun, struct ifreq *ifr) * privs required. */ static int set_offload(struct tun_struct *tun, unsigned long arg) { - netdev_features_t features = 0; + netdev_features_t features; + + netdev_feature_zero(&features);
if (arg & TUN_F_CSUM) { - features |= NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); arg &= ~TUN_F_CSUM;
if (arg & (TUN_F_TSO4|TUN_F_TSO6)) { if (arg & TUN_F_TSO_ECN) { - features |= NETIF_F_TSO_ECN; + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, + &features); arg &= ~TUN_F_TSO_ECN; } if (arg & TUN_F_TSO4) - features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &features); if (arg & TUN_F_TSO6) - features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &features); arg &= ~(TUN_F_TSO4|TUN_F_TSO6); }
@@ -2821,9 +2833,11 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) if (arg) return -EINVAL;
- tun->set_features = features; - tun->dev->wanted_features &= ~TUN_USER_FEATURES; - tun->dev->wanted_features |= features; + netdev_feature_copy(&tun->set_features, features); + netdev_feature_clear_bits(TUN_USER_FEATURES, + &tun->dev->wanted_features); + netdev_feature_or(&tun->dev->wanted_features, + tun->dev->wanted_features, features); netdev_update_features(tun->dev);
return 0;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/tap.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 8e3a28b..03158fa 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -321,7 +321,10 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) struct net_device *dev = skb->dev; struct tap_dev *tap; struct tap_queue *q; - netdev_features_t features = TAP_FEATURES; + netdev_features_t features; + + netdev_feature_zero(&features); + netdev_feature_set_bits(TAP_FEATURES, &features);
tap = tap_dev_get_rcu(dev); if (!tap) @@ -338,7 +341,7 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) * enabled. */ if (q->flags & IFF_VNET_HDR) - features |= tap->tap_features; + netdev_feature_or(&features, features, tap->tap_features); if (netif_needs_gso(skb, features)) { struct sk_buff *segs = __skb_gso_segment(skb, features, false); struct sk_buff *next; @@ -368,7 +371,7 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) * check, we either support them all or none. */ if (skb->ip_summed == CHECKSUM_PARTIAL && - !(features & NETIF_F_CSUM_MASK) && + !netdev_feature_test_bits(NETIF_F_CSUM_MASK, features) && skb_checksum_help(skb)) goto drop; if (ptr_ring_produce(&q->ring, skb)) @@ -536,7 +539,8 @@ static int tap_open(struct inode *inode, struct file *file) * The macvlan supports zerocopy iff the lower device supports zero * copy so we don't have to look at the lower device directly. */ - if ((tap->dev->features & NETIF_F_HIGHDMA) && (tap->dev->features & NETIF_F_SG)) + if (netdev_feature_test_bit(NETIF_F_HIGHDMA_BIT, tap->dev->features) && + netdev_feature_test_bit(NETIF_F_SG_BIT, tap->dev->features)) sock_set_flag(&q->sk, SOCK_ZEROCOPY);
err = tap_set_queue(tap, file, q); @@ -921,24 +925,28 @@ static int set_offload(struct tap_queue *q, unsigned long arg) { struct tap_dev *tap; netdev_features_t features; - netdev_features_t feature_mask = 0; + netdev_features_t feature_mask;
tap = rtnl_dereference(q->tap); if (!tap) return -ENOLINK;
- features = tap->dev->features; + netdev_feature_zero(&feature_mask); + netdev_feature_copy(&features, tap->dev->features);
if (arg & TUN_F_CSUM) { - feature_mask = NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &feature_mask);
if (arg & (TUN_F_TSO4 | TUN_F_TSO6)) { if (arg & TUN_F_TSO_ECN) - feature_mask |= NETIF_F_TSO_ECN; + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, + &feature_mask); if (arg & TUN_F_TSO4) - feature_mask |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &feature_mask); if (arg & TUN_F_TSO6) - feature_mask |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &feature_mask); } }
@@ -950,15 +958,15 @@ static int set_offload(struct tap_queue *q, unsigned long arg) * When user space turns off TSO, we turn off GSO/LRO so that * user-space will not receive TSO frames. */ - if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6)) - features |= RX_OFFLOADS; + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, feature_mask)) + netdev_feature_set_bits(RX_OFFLOADS, &features); else - features &= ~RX_OFFLOADS; + netdev_feature_clear_bits(RX_OFFLOADS, &features);
/* tap_features are the same as features on tun/tap and * reflect user expectations. */ - tap->tap_features = feature_mask; + netdev_feature_copy(&tap->tap_features, feature_mask); if (tap->update_features) tap->update_features(tap, features);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/geneve.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 1ab94b5..d2179c1 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1219,14 +1219,16 @@ static void geneve_setup(struct net_device *dev)
SET_NETDEV_DEVTYPE(dev, &geneve_type);
- dev->features |= NETIF_F_LLTX; - dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST; - dev->features |= NETIF_F_RXCSUM; - dev->features |= NETIF_F_GSO_SOFTWARE; - - dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST; - dev->hw_features |= NETIF_F_RXCSUM; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, + &dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, + &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features);
/* MTU range: 68 - (something less than 65535) */ dev->min_mtu = ETH_MIN_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/hyperv/netvsc_bpf.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 38 ++++++++++++++++++++++---------------- drivers/net/hyperv/rndis_filter.c | 30 +++++++++++++++++++----------- 3 files changed, 42 insertions(+), 28 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_bpf.c b/drivers/net/hyperv/netvsc_bpf.c index aa877da..058a9269 100644 --- a/drivers/net/hyperv/netvsc_bpf.c +++ b/drivers/net/hyperv/netvsc_bpf.c @@ -114,7 +114,7 @@ int netvsc_xdp_set(struct net_device *dev, struct bpf_prog *prog, return -EOPNOTSUPP; }
- if (prog && (dev->features & NETIF_F_LRO)) { + if (prog && netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) { netdev_err(dev, "XDP: not support LRO\n"); NL_SET_ERR_MSG_MOD(extack, "XDP: not support LRO");
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 5371328..22875a7 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -892,13 +892,15 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, }
/* Do L4 checksum offload if enabled and present. */ - if ((ppi_flags & NVSC_RSC_CSUM_INFO) && (net->features & NETIF_F_RXCSUM)) { + if ((ppi_flags & NVSC_RSC_CSUM_INFO) && + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, net->features)) { if (csum_info->receive.tcp_checksum_succeeded || csum_info->receive.udp_checksum_succeeded) skb->ip_summed = CHECKSUM_UNNECESSARY; }
- if ((ppi_flags & NVSC_RSC_HASH_INFO) && (net->features & NETIF_F_RXHASH)) + if ((ppi_flags & NVSC_RSC_HASH_INFO) && + netdev_feature_test_bit(NETIF_F_RXHASH_BIT, net->features)) skb_set_hash(skb, *hash_info, PKT_HASH_TYPE_L4);
if (ppi_flags & NVSC_RSC_VLAN) { @@ -1205,7 +1207,8 @@ static void netvsc_init_settings(struct net_device *dev) ndc->speed = SPEED_UNKNOWN; ndc->duplex = DUPLEX_FULL;
- dev->features = NETIF_F_LRO; + netdev_feature_zero(&dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->features); }
static int netvsc_get_link_ksettings(struct net_device *dev, @@ -1928,8 +1931,9 @@ static void netvsc_fix_features(struct net_device *ndev, if (!nvdev || nvdev->destroy) return;
- if ((*features & NETIF_F_LRO) && netvsc_xdp_get(nvdev)) { - *features ^= NETIF_F_LRO; + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features) && + netvsc_xdp_get(nvdev)) { + netdev_feature_change_bit(NETIF_F_LRO_BIT, features); netdev_info(ndev, "Skip LRO - unsupported with XDP\n"); } } @@ -1937,22 +1941,24 @@ static void netvsc_fix_features(struct net_device *ndev, static int netvsc_set_features(struct net_device *ndev, netdev_features_t features) { - netdev_features_t change = features ^ ndev->features; struct net_device_context *ndevctx = netdev_priv(ndev); struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); struct net_device *vf_netdev = rtnl_dereference(ndevctx->vf_netdev); struct ndis_offload_params offloads; + netdev_features_t change; int ret = 0;
if (!nvdev || nvdev->destroy) return -ENODEV;
- if (!(change & NETIF_F_LRO)) + netdev_feature_xor(&change, features, ndev->features); + + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, change)) goto syncvf;
memset(&offloads, 0, sizeof(struct ndis_offload_params));
- if (features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED; offloads.rsc_ip_v6 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED; } else { @@ -1963,15 +1969,15 @@ static int netvsc_set_features(struct net_device *ndev, ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads);
if (ret) { - features ^= NETIF_F_LRO; - ndev->features = features; + netdev_feature_change_bit(NETIF_F_LRO_BIT, &features); + netdev_feature_copy(&ndev->features, features); }
syncvf: if (!vf_netdev) return ret;
- vf_netdev->wanted_features = features; + netdev_feature_copy(&vf_netdev->wanted_features, features); netdev_update_features(vf_netdev);
return ret; @@ -2385,7 +2391,7 @@ static int netvsc_register_vf(struct net_device *vf_netdev) if (ndev->needed_headroom < vf_netdev->needed_headroom) ndev->needed_headroom = vf_netdev->needed_headroom;
- vf_netdev->wanted_features = ndev->features; + netdev_feature_copy(&vf_netdev->wanted_features, ndev->features); netdev_update_features(vf_netdev);
prog = netvsc_xdp_get(netvsc_dev); @@ -2550,10 +2556,10 @@ static int netvsc_probe(struct hv_device *dev, schedule_work(&nvdev->subchan_work);
/* hw_features computed in rndis_netdev_set_hwcaps() */ - net->features = net->hw_features | - NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - net->vlan_features = net->features; + netdev_feature_copy(&net->features, net->hw_features); + netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &net->features); + netdev_feature_copy(&net->vlan_features, net->features);
netdev_lockdep_set_classes(net);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index f6c9c2a..115ebe0 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1348,6 +1348,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, struct ndis_offload hwcaps; struct ndis_offload_params offloads; unsigned int gso_max_size = GSO_MAX_SIZE; + netdev_features_t tmp; int ret;
/* Find HW offload capabilities */ @@ -1362,24 +1363,26 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, offloads.ip_v4_csum = NDIS_OFFLOAD_PARAMETERS_TX_RX_DISABLED;
/* Reset previously set hw_features flags */ - net->hw_features &= ~NETVSC_SUPPORTED_HW_FEATURES; + netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, + &net->hw_features); net_device_ctx->tx_checksum_mask = 0;
/* Compute tx offload settings based on hw capabilities */ - net->hw_features |= NETIF_F_RXCSUM; - net->hw_features |= NETIF_F_SG; - net->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &net->hw_features);
if ((hwcaps.csum.ip4_txcsum & NDIS_TXCSUM_ALL_TCP4) == NDIS_TXCSUM_ALL_TCP4) { /* Can checksum TCP */ - net->hw_features |= NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &net->hw_features); net_device_ctx->tx_checksum_mask |= TRANSPORT_INFO_IPV4_TCP;
offloads.tcp_ip_v4_csum = NDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED;
if (hwcaps.lsov2.ip4_encap & NDIS_OFFLOAD_ENCAP_8023) { offloads.lso_v2_ipv4 = NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; - net->hw_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &net->hw_features);
if (hwcaps.lsov2.ip4_maxsz < gso_max_size) gso_max_size = hwcaps.lsov2.ip4_maxsz; @@ -1392,7 +1395,8 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, }
if ((hwcaps.csum.ip6_txcsum & NDIS_TXCSUM_ALL_TCP6) == NDIS_TXCSUM_ALL_TCP6) { - net->hw_features |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &net->hw_features);
offloads.tcp_ip_v6_csum = NDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; net_device_ctx->tx_checksum_mask |= TRANSPORT_INFO_IPV6_TCP; @@ -1400,7 +1404,8 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, if ((hwcaps.lsov2.ip6_encap & NDIS_OFFLOAD_ENCAP_8023) && (hwcaps.lsov2.ip6_opts & NDIS_LSOV2_CAP_IP6) == NDIS_LSOV2_CAP_IP6) { offloads.lso_v2_ipv6 = NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; - net->hw_features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &net->hw_features);
if (hwcaps.lsov2.ip6_maxsz < gso_max_size) gso_max_size = hwcaps.lsov2.ip6_maxsz; @@ -1413,9 +1418,9 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, }
if (hwcaps.rsc.ip4 && hwcaps.rsc.ip6) { - net->hw_features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &net->hw_features);
- if (net->features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, net->features)) { offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED; offloads.rsc_ip_v6 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED; } else { @@ -1427,7 +1432,10 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, /* In case some hw_features disappeared we need to remove them from * net->features list as they're no longer supported. */ - net->features &= ~NETVSC_SUPPORTED_HW_FEATURES | net->hw_features; + netdev_feature_fill(&tmp); + netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, &tmp); + netdev_feature_or(&tmp, tmp, net->hw_features); + netdev_feature_and(&net->features, net->features, tmp);
netif_set_gso_max_size(net, gso_max_size);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/macvlan.c | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 3c408653..9ac38e2 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -620,7 +620,8 @@ static int macvlan_open(struct net_device *dev) /* Attempt to populate accel_priv which is used to offload the L2 * forwarding requests for unicast packets. */ - if (lowerdev->features & NETIF_F_HW_L2FW_DOFFLOAD) + if (netdev_feature_test_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, + lowerdev->features)) vlan->accel_priv = lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev, dev);
@@ -893,12 +894,15 @@ static int macvlan_init(struct net_device *dev)
dev->state = (dev->state & ~MACVLAN_STATE_MASK) | (lowerdev->state & MACVLAN_STATE_MASK); - dev->features = lowerdev->features & MACVLAN_FEATURES; - dev->features |= ALWAYS_ON_FEATURES; - dev->hw_features |= NETIF_F_LRO; - dev->vlan_features = lowerdev->vlan_features & MACVLAN_FEATURES; - dev->vlan_features |= ALWAYS_ON_OFFLOADS; - dev->hw_enc_features |= dev->features; + netdev_feature_copy(&dev->features, lowerdev->features); + netdev_feature_and_bits(MACVLAN_FEATURES, &dev->features); + netdev_feature_set_bits(ALWAYS_ON_FEATURES, &dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); + netdev_feature_copy(&dev->vlan_features, lowerdev->vlan_features); + netdev_feature_and_bits(MACVLAN_FEATURES, &dev->vlan_features); + netdev_feature_set_bits(ALWAYS_ON_OFFLOADS, &dev->vlan_features); + netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + dev->features); dev->gso_max_size = lowerdev->gso_max_size; dev->gso_max_segs = lowerdev->gso_max_segs; dev->hard_header_len = lowerdev->hard_header_len; @@ -1071,17 +1075,25 @@ static void macvlan_fix_features(struct net_device *dev, netdev_features_t *features) { struct macvlan_dev *vlan = netdev_priv(dev); - netdev_features_t lowerdev_features = vlan->lowerdev->features; - netdev_features_t mask; - - *features |= NETIF_F_ALL_FOR_ALL; - *features &= (vlan->set_features | ~MACVLAN_FEATURES); - mask = *features; - - lowerdev_features &= (*features | ~NETIF_F_LRO); + netdev_features_t lowerdev_features; + netdev_features_t mask, tmp; + + netdev_feature_copy(&lowerdev_features, vlan->lowerdev->features); + netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); + netdev_feature_fill(&tmp); + netdev_feature_clear_bits(MACVLAN_FEATURES, &tmp); + netdev_feature_or(&tmp, tmp, vlan->set_features); + netdev_feature_and(features, *features, tmp); + netdev_feature_copy(&mask, *features); + + netdev_feature_fill(&tmp); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &tmp); + netdev_feature_or(&tmp, tmp, *features); + netdev_feature_and(&lowerdev_features, lowerdev_features, tmp); netdev_increment_features(features, lowerdev_features, *features, mask); - *features |= ALWAYS_ON_FEATURES; - *features &= (ALWAYS_ON_FEATURES | MACVLAN_FEATURES); + netdev_feature_set_bits(ALWAYS_ON_FEATURES, features); + netdev_feature_and_bits(ALWAYS_ON_FEATURES | MACVLAN_FEATURES, + features); }
#ifdef CONFIG_NET_POLL_CONTROLLER @@ -1458,7 +1470,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, vlan->lowerdev = lowerdev; vlan->dev = dev; vlan->port = port; - vlan->set_features = MACVLAN_FEATURES; + netdev_feature_zero(&vlan->set_features); + netdev_feature_set_bits(MACVLAN_FEATURES, &vlan->set_features);
vlan->mode = MACVLAN_MODE_VEPA; if (data && data[IFLA_MACVLAN_MODE])
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/macsec.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 601b833..5526d54 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -347,7 +347,8 @@ static bool macsec_check_offload(enum macsec_offload offload, return macsec->real_dev->phydev && macsec->real_dev->phydev->macsec_ops; else if (offload == MACSEC_OFFLOAD_MAC) - return macsec->real_dev->features & NETIF_F_HW_MACSEC && + return netdev_feature_test_bit(NETIF_F_HW_MACSEC_BIT, + macsec->real_dev->features) && macsec->real_dev->macsec_ops;
return false; @@ -3419,13 +3420,6 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb, #define SW_MACSEC_FEATURES \ (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
-/* If h/w offloading is enabled, use real device features save for - * VLAN_FEATURES - they require additional ops - * HW_MACSEC - no reason to report it - */ -#define REAL_DEV_FEATURES(dev) \ - ((dev)->features & ~(NETIF_F_VLAN_FEATURES | NETIF_F_HW_MACSEC)) - static int macsec_dev_init(struct net_device *dev) { struct macsec_dev *macsec = macsec_priv(dev); @@ -3443,10 +3437,19 @@ static int macsec_dev_init(struct net_device *dev) }
if (macsec_is_offloaded(macsec)) { - dev->features = REAL_DEV_FEATURES(real_dev); + /* If h/w offloading is enabled, use real device features save for + * VLAN_FEATURES - they require additional ops + * HW_MACSEC - no reason to report it + */ + netdev_feature_copy(&dev->features, real_dev->features); + netdev_feature_clear_bits(NETIF_F_VLAN_FEATURES | + NETIF_F_HW_MACSEC, + &dev->features); } else { - dev->features = real_dev->features & SW_MACSEC_FEATURES; - dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE; + netdev_feature_copy(&dev->features, real_dev->features); + netdev_feature_and_bits(SW_MACSEC_FEATURES, &dev->features); + netdev_feature_set_bits(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE, + &dev->features); }
dev->needed_headroom = real_dev->needed_headroom + @@ -3475,15 +3478,21 @@ static void macsec_fix_features(struct net_device *dev, { struct macsec_dev *macsec = macsec_priv(dev); struct net_device *real_dev = macsec->real_dev; + netdev_features_t tmp;
if (macsec_is_offloaded(macsec)) { - *features = REAL_DEV_FEATURES(real_dev); + netdev_feature_copy(features, real_dev->features); + netdev_feature_clear_bits(NETIF_F_VLAN_FEATURES | + NETIF_F_HW_MACSEC, features); return; }
- *features &= (real_dev->features & SW_MACSEC_FEATURES) | - NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES; - *features |= NETIF_F_LLTX; + netdev_feature_copy(&tmp, real_dev->features); + netdev_feature_and_bits(SW_MACSEC_FEATURES, &tmp); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES, + &tmp); + netdev_feature_and(features, *features, tmp); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
static int macsec_dev_open(struct net_device *dev)
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/s390/net/qeth_core_main.c | 114 +++++++++++++++++++++++--------------- drivers/s390/net/qeth_l2_main.c | 44 ++++++++++----- drivers/s390/net/qeth_l3_main.c | 41 +++++++++----- 3 files changed, 124 insertions(+), 75 deletions(-)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index a472f47..3a586c1 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -5616,7 +5616,8 @@ static void qeth_receive_skb(struct qeth_card *card, struct sk_buff *skb, return; }
- if (is_cso && (card->dev->features & NETIF_F_RXCSUM)) { + if (is_cso && netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + card->dev->features)) { skb->ip_summed = CHECKSUM_UNNECESSARY; QETH_CARD_STAT_INC(card, rx_skb_csum); } else { @@ -6393,10 +6394,10 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
dev->ethtool_ops = &qeth_ethtool_ops; dev->priv_flags &= ~IFF_TX_SKB_SHARING; - dev->hw_features |= NETIF_F_SG; - dev->vlan_features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->vlan_features); if (IS_IQD(card)) - dev->features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->features);
return dev; } @@ -6843,18 +6844,21 @@ void qeth_enable_hw_features(struct net_device *dev) struct qeth_card *card = dev->ml_priv; netdev_features_t features;
- features = dev->features; + netdev_feature_copy(&features, dev->features); /* force-off any feature that might need an IPA sequence. * netdev_update_features() will restart them. */ - dev->features &= ~dev->hw_features; + netdev_feature_andnot(&dev->features, 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; - dev->wanted_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &dev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &dev->wanted_features); } netdev_update_features(dev); - if (features != dev->features) + if (!netdev_feature_equal(features, dev->features)) dev_warn(&card->gdev->dev, "Device recovery failed to restore all offload features\n"); } @@ -6864,69 +6868,84 @@ static void qeth_check_restricted_features(struct qeth_card *card, netdev_features_t changed, netdev_features_t actual) { - netdev_features_t ipv6_features = NETIF_F_TSO6; - netdev_features_t ipv4_features = NETIF_F_TSO; + u64 ipv6_features = NETIF_F_TSO6; + u64 ipv4_features = NETIF_F_TSO;
if (!card->info.has_lp2lp_cso_v6) ipv6_features |= NETIF_F_IPV6_CSUM; if (!card->info.has_lp2lp_cso_v4) ipv4_features |= NETIF_F_IP_CSUM;
- if ((changed & ipv6_features) && !(actual & ipv6_features)) + if (netdev_feature_test_bits(ipv6_features, changed) && + !netdev_feature_test_bits(ipv6_features, actual)) qeth_flush_local_addrs6(card); - if ((changed & ipv4_features) && !(actual & ipv4_features)) + if (netdev_feature_test_bits(ipv4_features, changed) && + !netdev_feature_test_bits(ipv4_features, actual)) qeth_flush_local_addrs4(card); }
int qeth_set_features(struct net_device *dev, netdev_features_t features) { struct qeth_card *card = dev->ml_priv; - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed, tmp1, tmp2; int rc = 0;
QETH_CARD_TEXT(card, 2, "setfeat"); QETH_CARD_HEX(card, 2, &features, sizeof(features));
- if ((changed & NETIF_F_IP_CSUM)) { - rc = qeth_set_ipa_csum(card, features & NETIF_F_IP_CSUM, + netdev_feature_xor(&changed, dev->features, features); + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { + rc = qeth_set_ipa_csum(card, + netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, + features), IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV4, &card->info.has_lp2lp_cso_v4); if (rc) - changed ^= NETIF_F_IP_CSUM; + netdev_feature_change_bit(NETIF_F_IP_CSUM_BIT, &changed); } - if (changed & NETIF_F_IPV6_CSUM) { - rc = qeth_set_ipa_csum(card, features & NETIF_F_IPV6_CSUM, + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, changed)) { + rc = qeth_set_ipa_csum(card, + netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, + features), IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV6, &card->info.has_lp2lp_cso_v6); if (rc) - changed ^= NETIF_F_IPV6_CSUM; + netdev_feature_change_bit(NETIF_F_IPV6_CSUM_BIT, &changed); } - if (changed & NETIF_F_RXCSUM) { - rc = qeth_set_ipa_rx_csum(card, features & NETIF_F_RXCSUM); + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { + rc = qeth_set_ipa_rx_csum(card, + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + features)); if (rc) - changed ^= NETIF_F_RXCSUM; + netdev_feature_change_bit(NETIF_F_RXCSUM_BIT, &changed); } - if (changed & NETIF_F_TSO) { - rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO, + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, changed)) { + rc = qeth_set_ipa_tso(card, + netdev_feature_test_bit(NETIF_F_TSO_BIT, + features), QETH_PROT_IPV4); if (rc) - changed ^= NETIF_F_TSO; + netdev_feature_change_bit(NETIF_F_TSO_BIT, &changed); } - if (changed & NETIF_F_TSO6) { - rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO6, + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, changed)) { + rc = qeth_set_ipa_tso(card, + netdev_feature_test_bit(NETIF_F_TSO6_BIT, + features), QETH_PROT_IPV6); if (rc) - changed ^= NETIF_F_TSO6; + netdev_feature_change_bit(NETIF_F_TSO6_BIT, &changed); }
- qeth_check_restricted_features(card, dev->features ^ features, - dev->features ^ changed); + netdev_feature_xor(&tmp1, dev->features, features); + netdev_feature_xor(&tmp2, dev->features, changed); + qeth_check_restricted_features(card, tmp1, tmp2);
/* everything changed successfully? */ - if ((dev->features ^ features) == changed) + netdev_feature_xor(&tmp1, dev->features, features); + if (netdev_feature_equal(tmp1, changed)) return 0; /* something went wrong. save changed features and return error */ - dev->features ^= changed; + netdev_feature_xor(&dev->features, dev->features, changed); return -EIO; } EXPORT_SYMBOL_GPL(qeth_set_features); @@ -6937,16 +6956,16 @@ void qeth_fix_features(struct net_device *dev, netdev_features_t *features)
QETH_CARD_TEXT(card, 2, "fixfeat"); if (!qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) - *features &= ~NETIF_F_IP_CSUM; + netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, features); if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) - *features &= ~NETIF_F_IPV6_CSUM; + netdev_feature_clear_bit(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_clear_bit(NETIF_F_RXCSUM_BIT, features); if (!qeth_is_supported(card, IPA_OUTBOUND_TSO)) - *features &= ~NETIF_F_TSO; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO)) - *features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features);
QETH_CARD_HEX(card, 2, features, sizeof(*features)); } @@ -6960,25 +6979,30 @@ void qeth_features_check(struct sk_buff *skb, struct net_device *dev, /* Traffic with local next-hop is not eligible for some offloads: */ if (skb->ip_summed == CHECKSUM_PARTIAL && READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) { - netdev_features_t restricted = 0; + netdev_features_t restricted;
+ netdev_feature_zero(&restricted); if (skb_is_gso(skb) && !netif_needs_gso(skb, *features)) - restricted |= NETIF_F_ALL_TSO; + netdev_feature_set_bits(NETIF_F_ALL_TSO, &restricted);
switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): if (!card->info.has_lp2lp_cso_v4) - restricted |= NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, + &restricted);
if (restricted && qeth_next_hop_is_local_v4(card, skb)) - *features &= ~restricted; + netdev_feature_andnot(features, features, + &restricted); break; case htons(ETH_P_IPV6): if (!card->info.has_lp2lp_cso_v6) - restricted |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &restricted);
if (restricted && qeth_next_hop_is_local_v6(card, skb)) - *features &= ~restricted; + netdev_feature_andnot(features, *features, + restricted); break; default: break; @@ -7000,7 +7024,7 @@ void qeth_features_check(struct sk_buff *skb, struct net_device *dev,
/* 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_clear_bit(NETIF_F_SG_BIT, features); }
vlan_features_check(skb, features); diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 4871f71..ecb9b1e 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -1079,40 +1079,54 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) card->dev->priv_flags |= IFF_UNICAST_FLT;
if (IS_OSM(card)) { - card->dev->features |= NETIF_F_VLAN_CHALLENGED; + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, + &card->dev->features); } else { if (!IS_VM_NIC(card)) - card->dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; - card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &card->dev->features); }
if (IS_OSD(card) && !IS_VM_NIC(card)) { - card->dev->features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &card->dev->features); /* OSA 3S and earlier has no RX/TX support */ if (qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) { - card->dev->hw_features |= NETIF_F_IP_CSUM; - card->dev->vlan_features |= NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, + &card->dev->vlan_features); } } if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { - card->dev->hw_features |= NETIF_F_IPV6_CSUM; - card->dev->vlan_features |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &card->dev->vlan_features); } if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM) || qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) { - card->dev->hw_features |= NETIF_F_RXCSUM; - card->dev->vlan_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &card->dev->vlan_features); } if (qeth_is_supported(card, IPA_OUTBOUND_TSO)) { - card->dev->hw_features |= NETIF_F_TSO; - card->dev->vlan_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &card->dev->vlan_features); } if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { - card->dev->hw_features |= NETIF_F_TSO6; - card->dev->vlan_features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &card->dev->vlan_features); }
- if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) { + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, + card->dev->hw_features)) { card->dev->needed_headroom = sizeof(struct qeth_hdr_tso); netif_keep_dst(card->dev); netif_set_gso_max_size(card->dev, diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 76c37ee..71feb90 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -1809,7 +1809,8 @@ static void 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_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); qeth_features_check(skb, dev, features); }
@@ -1878,26 +1879,35 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) dev->dev_id = qeth_l3_get_unique_id(card, dev->dev_id);
if (!IS_VM_NIC(card)) { - card->dev->features |= NETIF_F_SG; - card->dev->hw_features |= NETIF_F_TSO | - NETIF_F_RXCSUM | NETIF_F_IP_CSUM; - card->dev->vlan_features |= NETIF_F_TSO | - NETIF_F_RXCSUM | NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_SG_BIT, + &card->dev->features); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM | + NETIF_F_IP_CSUM, + &card->dev->hw_features); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM | + NETIF_F_IP_CSUM, + &card->dev->vlan_features); }
if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { - card->dev->hw_features |= NETIF_F_IPV6_CSUM; - card->dev->vlan_features |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &card->dev->vlan_features); } if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { - card->dev->hw_features |= NETIF_F_TSO6; - card->dev->vlan_features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &card->dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &card->dev->vlan_features); }
/* allow for de-acceleration of NETIF_F_HW_VLAN_CTAG_TX: */ - if (card->dev->hw_features & NETIF_F_TSO6) + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, + card->dev->hw_features)) headroom = sizeof(struct qeth_hdr_tso) + VLAN_HLEN; - else if (card->dev->hw_features & NETIF_F_TSO) + else if (netdev_feature_test_bit(NETIF_F_TSO_BIT, + card->dev->hw_features)) headroom = sizeof(struct qeth_hdr_tso); else headroom = sizeof(struct qeth_hdr) + VLAN_HLEN; @@ -1913,11 +1923,12 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) return -ENODEV;
card->dev->needed_headroom = headroom; - card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &card->dev->features);
netif_keep_dst(card->dev); - if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) + if (netdev_feature_test_bit(NETIF_F_TSO | NETIF_F_TSO6, + card->dev->hw_features)) netif_set_gso_max_size(card->dev, PAGE_SIZE * (QETH_MAX_BUFFER_ELEMENTS(card) - 1));
在 2021/8/11 22:44, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/s390/net/qeth_core_main.c | 114 +++++++++++++++++++++++--------------- drivers/s390/net/qeth_l2_main.c | 44 ++++++++++----- drivers/s390/net/qeth_l3_main.c | 41 +++++++++----- 3 files changed, 124 insertions(+), 75 deletions(-)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index a472f47..3a586c1 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -5616,7 +5616,8 @@ static void qeth_receive_skb(struct qeth_card *card, struct sk_buff *skb, return; }
- if (is_cso && (card->dev->features & NETIF_F_RXCSUM)) {
- if (is_cso && netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
skb->ip_summed = CHECKSUM_UNNECESSARY; QETH_CARD_STAT_INC(card, rx_skb_csum); } else {card->dev->features)) {
@@ -6393,10 +6394,10 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
dev->ethtool_ops = &qeth_ethtool_ops; dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- dev->hw_features |= NETIF_F_SG;
- dev->vlan_features |= NETIF_F_SG;
- netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features);
- netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->vlan_features); if (IS_IQD(card))
dev->features |= NETIF_F_SG;
netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->features);
return dev; }
@@ -6843,18 +6844,21 @@ void qeth_enable_hw_features(struct net_device *dev) struct qeth_card *card = dev->ml_priv; netdev_features_t features;
- features = dev->features;
- netdev_feature_copy(&features, dev->features); /* force-off any feature that might need an IPA sequence.
*/
- netdev_update_features() will restart them.
- dev->features &= ~dev->hw_features;
- netdev_feature_andnot(&dev->features, dev->features,
/* toggle VLAN filter, so that VIDs are re-programmed: */ if (IS_LAYER2(card) && IS_VM_NIC(card)) {dev->hw_features);
dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
dev->wanted_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&dev->features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
} netdev_update_features(dev);&dev->wanted_features);
- if (features != dev->features)
- if (!netdev_feature_equal(features, dev->features)) dev_warn(&card->gdev->dev, "Device recovery failed to restore all offload features\n"); }
@@ -6864,69 +6868,84 @@ static void qeth_check_restricted_features(struct qeth_card *card, netdev_features_t changed, netdev_features_t actual) {
- netdev_features_t ipv6_features = NETIF_F_TSO6;
- netdev_features_t ipv4_features = NETIF_F_TSO;
u64 ipv6_features = NETIF_F_TSO6;
u64 ipv4_features = NETIF_F_TSO;
if (!card->info.has_lp2lp_cso_v6) ipv6_features |= NETIF_F_IPV6_CSUM; if (!card->info.has_lp2lp_cso_v4) ipv4_features |= NETIF_F_IP_CSUM;
- if ((changed & ipv6_features) && !(actual & ipv6_features))
- if (netdev_feature_test_bits(ipv6_features, changed) &&
qeth_flush_local_addrs6(card);!netdev_feature_test_bits(ipv6_features, actual))
- if ((changed & ipv4_features) && !(actual & ipv4_features))
- if (netdev_feature_test_bits(ipv4_features, changed) &&
qeth_flush_local_addrs4(card); }!netdev_feature_test_bits(ipv4_features, actual))
it should keep use netdev_feature_t, not u64. will fix it in next version.
int qeth_set_features(struct net_device *dev, netdev_features_t features) { struct qeth_card *card = dev->ml_priv;
- netdev_features_t changed = dev->features ^ features;
netdev_features_t changed, tmp1, tmp2; int rc = 0;
QETH_CARD_TEXT(card, 2, "setfeat"); QETH_CARD_HEX(card, 2, &features, sizeof(features));
- if ((changed & NETIF_F_IP_CSUM)) {
rc = qeth_set_ipa_csum(card, features & NETIF_F_IP_CSUM,
- netdev_feature_xor(&changed, dev->features, features);
- if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) {
rc = qeth_set_ipa_csum(card,
netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT,
if (rc)features), IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV4, &card->info.has_lp2lp_cso_v4);
changed ^= NETIF_F_IP_CSUM;
}netdev_feature_change_bit(NETIF_F_IP_CSUM_BIT, &changed);
- if (changed & NETIF_F_IPV6_CSUM) {
rc = qeth_set_ipa_csum(card, features & NETIF_F_IPV6_CSUM,
- if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, changed)) {
rc = qeth_set_ipa_csum(card,
netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT,
if (rc)features), IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV6, &card->info.has_lp2lp_cso_v6);
changed ^= NETIF_F_IPV6_CSUM;
}netdev_feature_change_bit(NETIF_F_IPV6_CSUM_BIT, &changed);
- if (changed & NETIF_F_RXCSUM) {
rc = qeth_set_ipa_rx_csum(card, features & NETIF_F_RXCSUM);
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) {
rc = qeth_set_ipa_rx_csum(card,
netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
if (rc)features));
changed ^= NETIF_F_RXCSUM;
}netdev_feature_change_bit(NETIF_F_RXCSUM_BIT, &changed);
- if (changed & NETIF_F_TSO) {
rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO,
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, changed)) {
rc = qeth_set_ipa_tso(card,
netdev_feature_test_bit(NETIF_F_TSO_BIT,
if (rc)features), QETH_PROT_IPV4);
changed ^= NETIF_F_TSO;
}netdev_feature_change_bit(NETIF_F_TSO_BIT, &changed);
- if (changed & NETIF_F_TSO6) {
rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO6,
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, changed)) {
rc = qeth_set_ipa_tso(card,
netdev_feature_test_bit(NETIF_F_TSO6_BIT,
if (rc)features), QETH_PROT_IPV6);
changed ^= NETIF_F_TSO6;
}netdev_feature_change_bit(NETIF_F_TSO6_BIT, &changed);
- qeth_check_restricted_features(card, dev->features ^ features,
dev->features ^ changed);
netdev_feature_xor(&tmp1, dev->features, features);
netdev_feature_xor(&tmp2, dev->features, changed);
qeth_check_restricted_features(card, tmp1, tmp2);
/* everything changed successfully? */
- if ((dev->features ^ features) == changed)
- netdev_feature_xor(&tmp1, dev->features, features);
- if (netdev_feature_equal(tmp1, changed)) return 0; /* something went wrong. save changed features and return error */
- dev->features ^= changed;
- netdev_feature_xor(&dev->features, dev->features, changed); return -EIO; } EXPORT_SYMBOL_GPL(qeth_set_features);
@@ -6937,16 +6956,16 @@ void qeth_fix_features(struct net_device *dev, netdev_features_t *features)
QETH_CARD_TEXT(card, 2, "fixfeat"); if (!qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM))
*features &= ~NETIF_F_IP_CSUM;
if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6))netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, features);
*features &= ~NETIF_F_IPV6_CSUM;
if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM) && !qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6))netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, features);
*features &= ~NETIF_F_RXCSUM;
if (!qeth_is_supported(card, IPA_OUTBOUND_TSO))netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, features);
*features &= ~NETIF_F_TSO;
if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO))netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
*features &= ~NETIF_F_TSO6;
netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features);
QETH_CARD_HEX(card, 2, features, sizeof(*features)); }
@@ -6960,25 +6979,30 @@ void qeth_features_check(struct sk_buff *skb, struct net_device *dev, /* Traffic with local next-hop is not eligible for some offloads: */ if (skb->ip_summed == CHECKSUM_PARTIAL && READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) {
netdev_features_t restricted = 0;
netdev_features_t restricted;
netdev_feature_zero(&restricted);
if (skb_is_gso(skb) && !netif_needs_gso(skb, *features))
restricted |= NETIF_F_ALL_TSO;
netdev_feature_set_bits(NETIF_F_ALL_TSO, &restricted);
switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): if (!card->info.has_lp2lp_cso_v4)
restricted |= NETIF_F_IP_CSUM;
netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT,
&restricted); if (restricted && qeth_next_hop_is_local_v4(card, skb))
*features &= ~restricted;
netdev_feature_andnot(features, features,
case htons(ETH_P_IPV6): if (!card->info.has_lp2lp_cso_v6)&restricted); break;
restricted |= NETIF_F_IPV6_CSUM;
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
&restricted); if (restricted && qeth_next_hop_is_local_v6(card, skb))
*features &= ~restricted;
netdev_feature_andnot(features, *features,
default: break;restricted); break;
@@ -7000,7 +7024,7 @@ void qeth_features_check(struct sk_buff *skb, struct net_device *dev,
/* 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_clear_bit(NETIF_F_SG_BIT, features);
}
vlan_features_check(skb, features);
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 4871f71..ecb9b1e 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -1079,40 +1079,54 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) card->dev->priv_flags |= IFF_UNICAST_FLT;
if (IS_OSM(card)) {
card->dev->features |= NETIF_F_VLAN_CHALLENGED;
netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT,
} else { if (!IS_VM_NIC(card))&card->dev->features);
card->dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&card->dev->features);
}
if (IS_OSD(card) && !IS_VM_NIC(card)) {
card->dev->features |= NETIF_F_SG;
/* OSA 3S and earlier has no RX/TX support */ if (qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) {netdev_feature_set_bit(NETIF_F_SG_BIT, &card->dev->features);
card->dev->hw_features |= NETIF_F_IP_CSUM;
card->dev->vlan_features |= NETIF_F_IP_CSUM;
netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT,
} } if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) {&card->dev->vlan_features);
card->dev->hw_features |= NETIF_F_IPV6_CSUM;
card->dev->vlan_features |= NETIF_F_IPV6_CSUM;
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
} if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM) || qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) {&card->dev->vlan_features);
card->dev->hw_features |= NETIF_F_RXCSUM;
card->dev->vlan_features |= NETIF_F_RXCSUM;
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT,
} if (qeth_is_supported(card, IPA_OUTBOUND_TSO)) {&card->dev->vlan_features);
card->dev->hw_features |= NETIF_F_TSO;
card->dev->vlan_features |= NETIF_F_TSO;
netdev_feature_set_bit(NETIF_F_TSO_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_TSO_BIT,
} if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) {&card->dev->vlan_features);
card->dev->hw_features |= NETIF_F_TSO6;
card->dev->vlan_features |= NETIF_F_TSO6;
netdev_feature_set_bit(NETIF_F_TSO6_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_TSO6_BIT,
}&card->dev->vlan_features);
- if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) {
- if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6,
card->dev->needed_headroom = sizeof(struct qeth_hdr_tso); netif_keep_dst(card->dev); netif_set_gso_max_size(card->dev,card->dev->hw_features)) {
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 76c37ee..71feb90 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -1809,7 +1809,8 @@ static void 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_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
qeth_features_check(skb, dev, features); }features);
@@ -1878,26 +1879,35 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) dev->dev_id = qeth_l3_get_unique_id(card, dev->dev_id);
if (!IS_VM_NIC(card)) {
card->dev->features |= NETIF_F_SG;
card->dev->hw_features |= NETIF_F_TSO |
NETIF_F_RXCSUM | NETIF_F_IP_CSUM;
card->dev->vlan_features |= NETIF_F_TSO |
NETIF_F_RXCSUM | NETIF_F_IP_CSUM;
netdev_feature_set_bit(NETIF_F_SG_BIT,
&card->dev->features);
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM |
NETIF_F_IP_CSUM,
&card->dev->hw_features);
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM |
NETIF_F_IP_CSUM,
&card->dev->vlan_features);
}
if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) {
card->dev->hw_features |= NETIF_F_IPV6_CSUM;
card->dev->vlan_features |= NETIF_F_IPV6_CSUM;
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
} if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) {&card->dev->vlan_features);
card->dev->hw_features |= NETIF_F_TSO6;
card->dev->vlan_features |= NETIF_F_TSO6;
netdev_feature_set_bit(NETIF_F_TSO6_BIT,
&card->dev->hw_features);
netdev_feature_set_bit(NETIF_F_TSO6_BIT,
&card->dev->vlan_features);
}
/* allow for de-acceleration of NETIF_F_HW_VLAN_CTAG_TX: */
if (card->dev->hw_features & NETIF_F_TSO6)
if (netdev_feature_test_bit(NETIF_F_TSO6_BIT,
card->dev->hw_features)) headroom = sizeof(struct qeth_hdr_tso) + VLAN_HLEN;
else if (card->dev->hw_features & NETIF_F_TSO)
else if (netdev_feature_test_bit(NETIF_F_TSO_BIT,
else headroom = sizeof(struct qeth_hdr) + VLAN_HLEN;card->dev->hw_features)) headroom = sizeof(struct qeth_hdr_tso);
@@ -1913,11 +1923,12 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) return -ENODEV;
card->dev->needed_headroom = headroom;
- card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX, &card->dev->features);
netif_keep_dst(card->dev);
- if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6))
- if (netdev_feature_test_bit(NETIF_F_TSO | NETIF_F_TSO6,
netif_set_gso_max_size(card->dev, PAGE_SIZE * (QETH_MAX_BUFFER_ELEMENTS(card) - 1));card->dev->hw_features))
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/dsa/xrs700x/xrs700x.c | 6 ++++-- net/dsa/slave.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c index 130abb0..898426c 100644 --- a/drivers/net/dsa/xrs700x/xrs700x.c +++ b/drivers/net/dsa/xrs700x/xrs700x.c @@ -639,7 +639,8 @@ static int xrs700x_hsr_join(struct dsa_switch *ds, int port, hsr_pair[1] = partner->index; for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; - slave->features |= XRS7000X_SUPPORTED_HSR_FEATURES; + netdev_feature_set_bits(XRS7000X_SUPPORTED_HSR_FEATURES, + &slave->features); }
return 0; @@ -693,7 +694,8 @@ static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, hsr_pair[1] = partner->index; for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; - slave->features &= ~XRS7000X_SUPPORTED_HSR_FEATURES; + netdev_feature_clear_bits(XRS7000X_SUPPORTED_HSR_FEATURES, + &slave->features); }
return 0; diff --git a/net/dsa/slave.c b/net/dsa/slave.c index acf73db..8ddfed4 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1815,13 +1815,16 @@ void dsa_slave_setup_tagger(struct net_device *slave)
p->xmit = cpu_dp->tag_ops->xmit;
- slave->features = master->vlan_features | NETIF_F_HW_TC; + netdev_feature_copy(&slave->features, master->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->features); if (ds->ops->port_vlan_add && ds->ops->port_vlan_del) - slave->features |= NETIF_F_HW_VLAN_CTAG_FILTER; - slave->hw_features |= NETIF_F_HW_TC; - slave->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &slave->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &slave->features); if (slave->needed_tailroom) - slave->features &= ~(NETIF_F_SG | NETIF_F_FRAGLIST); + netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_FRAGLIST, + &slave->features); }
static struct lock_class_key dsa_slave_netdev_xmit_lock_key; @@ -1900,7 +1903,7 @@ int dsa_slave_create(struct dsa_port *port)
SET_NETDEV_DEV(slave_dev, port->ds->dev); slave_dev->dev.of_node = port->dn; - slave_dev->vlan_features = master->vlan_features; + netdev_feature_copy(&slave_dev->features, master->vlan_features);
p = netdev_priv(slave_dev); slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/macvtap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 694e2f5..2162080 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -74,7 +74,7 @@ static void macvtap_update_features(struct tap_dev *tap, struct macvtap_dev *vlantap = container_of(tap, struct macvtap_dev, tap); struct macvlan_dev *vlan = &vlantap->vlan;
- vlan->set_features = features; + netdev_feature_copy(&vlan->set_features, features); netdev_update_features(vlan->dev); }
@@ -90,7 +90,8 @@ static int macvtap_newlink(struct net *src_net, struct net_device *dev, /* Since macvlan supports all offloads by default, make * tap support all offloads also. */ - vlantap->tap.tap_features = TUN_OFFLOADS; + netdev_feature_zero(&vlantap->tap.tap_features); + netdev_feature_set_bits(TUN_OFFLOADS, &vlantap->tap.tap_features);
/* Register callbacks for rx/tx drops accounting and updating * net_device features
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/team/team.c | 69 ++++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 27 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index fa96ee6..207771e 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -985,21 +985,30 @@ static void team_port_disable(struct team *team, static void __team_compute_features(struct team *team) { struct team_port *port; - netdev_features_t vlan_features = TEAM_VLAN_FEATURES & - NETIF_F_ALL_FOR_ALL; - netdev_features_t enc_features = TEAM_ENC_FEATURES; unsigned short max_hard_header_len = ETH_HLEN; unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; + netdev_features_t vlan_features; + netdev_features_t enc_features; + netdev_features_t mask_vlan; + netdev_features_t mask_enc; + + netdev_feature_zero(&vlan_features); + netdev_feature_set_bits(TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, + &vlan_features); + netdev_feature_zero(&enc_features); + netdev_feature_set_bits(TEAM_ENC_FEATURES, &enc_features); + netdev_feature_zero(&mask_vlan); + netdev_feature_set_bits(TEAM_VLAN_FEATURES, &mask_vlan); + netdev_feature_zero(&mask_enc); + netdev_feature_set_bits(TEAM_ENC_FEATURES, &mask_enc);
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { netdev_increment_features(&vlan_features, vlan_features, - port->dev->vlan_features, - TEAM_VLAN_FEATURES); + port->dev->vlan_features, mask_vlan); netdev_increment_features(&enc_features, enc_features, - port->dev->hw_enc_features, - TEAM_ENC_FEATURES); + port->dev->hw_enc_features, mask_enc);
dst_release_flag &= port->dev->priv_flags; if (port->dev->hard_header_len > max_hard_header_len) @@ -1007,10 +1016,12 @@ static void __team_compute_features(struct team *team) } rcu_read_unlock();
- team->dev->vlan_features = vlan_features; - team->dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_copy(&team->dev->vlan_features, vlan_features); + netdev_feature_copy(&team->dev->hw_enc_features, enc_features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &team->dev->hw_enc_features); team->dev->hard_header_len = max_hard_header_len;
team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; @@ -1161,7 +1172,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev, return -EBUSY; }
- if (port_dev->features & NETIF_F_VLAN_CHALLENGED && + if (netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT, + port_dev->features) && vlan_uses_dev(dev)) { NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up"); netdev_err(dev, "Device %s is VLAN challenged and team device has VLAN set up\n", @@ -1226,7 +1238,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev, goto err_enable_netpoll; }
- if (!(dev->features & NETIF_F_LRO)) + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) dev_disable_lro(port_dev);
err = netdev_rx_handler_register(port_dev, team_handle_frame, @@ -2000,9 +2012,9 @@ static void team_fix_features(struct net_device *dev, struct team *team = netdev_priv(dev); netdev_features_t mask;
- mask = *features; - *features &= ~NETIF_F_ONE_FOR_ALL; - *features |= NETIF_F_ALL_FOR_ALL; + netdev_feature_copy(&mask, *features); + netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); + netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { @@ -2160,19 +2172,22 @@ static void team_setup(struct net_device *dev) */ dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
- dev->features |= NETIF_F_LLTX; - dev->features |= NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, &dev->features);
/* Don't allow team devices to change network namespaces. */ - dev->features |= NETIF_F_NETNS_LOCAL; - - dev->hw_features = TEAM_VLAN_FEATURES | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER; - - dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; - dev->features |= dev->hw_features; - dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + + netdev_feature_set_bits(TEAM_VLAN_FEATURES | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &dev->hw_features); + + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->hw_features); + netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &dev->features); }
static int team_newlink(struct net *src_net, struct net_device *dev,
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/vmxnet3/vmxnet3_drv.c | 78 ++++++++++++++++++++++------------- drivers/net/vmxnet3/vmxnet3_ethtool.c | 73 ++++++++++++++++++++------------ 2 files changed, 96 insertions(+), 55 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index e3c6b7e..5611a10 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -1223,7 +1223,9 @@ vmxnet3_rx_csum(struct vmxnet3_adapter *adapter, struct sk_buff *skb, union Vmxnet3_GenericDesc *gdesc) { - if (!gdesc->rcd.cnc && adapter->netdev->features & NETIF_F_RXCSUM) { + if (!gdesc->rcd.cnc && + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + adapter->netdev->features)) { if (gdesc->rcd.v4 && (le32_to_cpu(gdesc->dword[3]) & VMXNET3_RCD_CSUM_OK) == VMXNET3_RCD_CSUM_OK) { @@ -1478,7 +1480,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
#ifdef VMXNET3_RSS if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE && - (adapter->netdev->features & NETIF_F_RXHASH)) { + netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + adapter->netdev->features)) { enum pkt_hash_types hash_type;
switch (rcd->rssType) { @@ -1581,7 +1584,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, (union Vmxnet3_GenericDesc *)rcd); skb->protocol = eth_type_trans(skb, adapter->netdev); if (!rcd->tcp || - !(adapter->netdev->features & NETIF_F_LRO)) + !netdev_feature_test_bit(NETIF_F_LRO_BIT, + adapter->netdev->features)) goto not_lro;
if (segCnt != 0 && mss != 0) { @@ -1612,7 +1616,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, if (unlikely(rcd->ts)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rcd->tci);
- if (adapter->netdev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + adapter->netdev->features)) netif_receive_skb(skb); else napi_gro_receive(&rq->napi, skb); @@ -2501,18 +2506,22 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter) devRead->misc.ddLen = cpu_to_le32(sizeof(struct vmxnet3_adapter));
/* set up feature flags */ - if (adapter->netdev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + adapter->netdev->features)) devRead->misc.uptFeatures |= UPT1_F_RXCSUM;
- if (adapter->netdev->features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + adapter->netdev->features)) { devRead->misc.uptFeatures |= UPT1_F_LRO; devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS); } - if (adapter->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + adapter->netdev->features)) devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
- if (adapter->netdev->features & (NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM)) + if (netdev_feature_test_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + adapter->netdev->features)) devRead->misc.uptFeatures |= UPT1_F_RXINNEROFLD;
devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu); @@ -3163,28 +3172,40 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) { struct net_device *netdev = adapter->netdev;
- netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_LRO; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | + NETIF_F_TSO6 | NETIF_F_LRO, + &netdev->hw_features);
if (VMXNET3_VERSION_GE_4(adapter)) { - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; - - netdev->hw_enc_features = NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &netdev->hw_features); + + netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &netdev->hw_enc_features); }
if (dma64) - netdev->hw_features |= NETIF_F_HIGHDMA; - netdev->vlan_features = netdev->hw_features & - ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX); - netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->hw_features); + netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->vlan_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features); }
@@ -3636,8 +3657,9 @@ vmxnet3_probe_device(struct pci_dev *pdev, if (adapter->num_rx_queues > 1 && adapter->intr.type == VMXNET3_IT_MSIX) { adapter->rss = true; - netdev->hw_features |= NETIF_F_RXHASH; - netdev->features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->features); dev_dbg(&pdev->dev, "RSS is enabled.\n"); } else { adapter->rss = false; diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 9b3acf4..0e36170 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -250,8 +250,8 @@ void vmxnet3_fix_features(struct net_device *netdev, netdev_features_t *features) { /* If Rx checksum is disabled, then LRO should also be disabled */ - if (!(*features & NETIF_F_RXCSUM)) - *features &= ~NETIF_F_LRO; + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, @@ -274,7 +274,9 @@ void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, l4_proto = ipv6_hdr(skb)->nexthdr; break; default: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | + NETIF_F_GSO_MASK, + features); return; }
@@ -286,12 +288,16 @@ void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, if (port != GENEVE_UDP_PORT && port != IANA_VXLAN_UDP_PORT && port != VXLAN_UDP_PORT) { - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | + NETIF_F_GSO_MASK, + features); return; } break; default: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | + NETIF_F_GSO_MASK, + features); return; } } @@ -302,11 +308,14 @@ static void vmxnet3_enable_encap_offloads(struct net_device *netdev) struct vmxnet3_adapter *adapter = netdev_priv(netdev);
if (VMXNET3_VERSION_GE_4(adapter)) { - netdev->hw_enc_features |= NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &netdev->hw_enc_features); } }
@@ -315,26 +324,33 @@ static void vmxnet3_disable_encap_offloads(struct net_device *netdev) struct vmxnet3_adapter *adapter = netdev_priv(netdev);
if (VMXNET3_VERSION_GE_4(adapter)) { - netdev->hw_enc_features &= ~(NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM); + netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &netdev->hw_enc_features); } }
int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) { struct vmxnet3_adapter *adapter = netdev_priv(netdev); + u64 tun_offload_mask = NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev_features_t changed; unsigned long flags; - netdev_features_t changed = features ^ netdev->features; - netdev_features_t tun_offload_mask = NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM; - u8 udp_tun_enabled = (netdev->features & tun_offload_mask) != 0; - - if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO | - NETIF_F_HW_VLAN_CTAG_RX | tun_offload_mask)) { - if (features & NETIF_F_RXCSUM) + u8 udp_tun_enabled; + + netdev_feature_xor(&changed, netdev->features, features); + udp_tun_enabled = netdev_feature_test_bits(tun_offload_mask, + netdev->features); + if (netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_LRO | + NETIF_F_HW_VLAN_CTAG_RX | + tun_offload_mask, changed)) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) adapter->shared->devRead.misc.uptFeatures |= UPT1_F_RXCSUM; else @@ -342,25 +358,28 @@ int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) ~UPT1_F_RXCSUM;
/* update hardware LRO capability accordingly */ - if (features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) adapter->shared->devRead.misc.uptFeatures |= UPT1_F_LRO; else adapter->shared->devRead.misc.uptFeatures &= ~UPT1_F_LRO;
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) adapter->shared->devRead.misc.uptFeatures |= UPT1_F_RXVLAN; else adapter->shared->devRead.misc.uptFeatures &= ~UPT1_F_RXVLAN;
- if ((features & tun_offload_mask) != 0 && !udp_tun_enabled) { + if (netdev_feature_test_bits(tun_offload_mask, features) && + !udp_tun_enabled) { vmxnet3_enable_encap_offloads(netdev); adapter->shared->devRead.misc.uptFeatures |= UPT1_F_RXINNEROFLD; - } else if ((features & tun_offload_mask) == 0 && + } else if (!netdev_feature_test_bits(tun_offload_mask, + features) && udp_tun_enabled) { vmxnet3_disable_encap_offloads(netdev); adapter->shared->devRead.misc.uptFeatures &=
在 2021/8/11 22:44, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/vmxnet3/vmxnet3_drv.c | 78 ++++++++++++++++++++++------------- drivers/net/vmxnet3/vmxnet3_ethtool.c | 73 ++++++++++++++++++++------------ 2 files changed, 96 insertions(+), 55 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index e3c6b7e..5611a10 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -1223,7 +1223,9 @@ vmxnet3_rx_csum(struct vmxnet3_adapter *adapter, struct sk_buff *skb, union Vmxnet3_GenericDesc *gdesc) {
- if (!gdesc->rcd.cnc && adapter->netdev->features & NETIF_F_RXCSUM) {
- if (!gdesc->rcd.cnc &&
netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
if (gdesc->rcd.v4 && (le32_to_cpu(gdesc->dword[3]) & VMXNET3_RCD_CSUM_OK) == VMXNET3_RCD_CSUM_OK) {adapter->netdev->features)) {
@@ -1478,7 +1480,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
#ifdef VMXNET3_RSS if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE &&
(adapter->netdev->features & NETIF_F_RXHASH)) {
netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
adapter->netdev->features)) { enum pkt_hash_types hash_type; switch (rcd->rssType) {
@@ -1581,7 +1584,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, (union Vmxnet3_GenericDesc *)rcd); skb->protocol = eth_type_trans(skb, adapter->netdev); if (!rcd->tcp ||
!(adapter->netdev->features & NETIF_F_LRO))
!netdev_feature_test_bit(NETIF_F_LRO_BIT,
adapter->netdev->features)) goto not_lro; if (segCnt != 0 && mss != 0) {
@@ -1612,7 +1616,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, if (unlikely(rcd->ts)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rcd->tci);
if (adapter->netdev->features & NETIF_F_LRO)
if (netdev_feature_test_bit(NETIF_F_LRO_BIT,
adapter->netdev->features)) netif_receive_skb(skb); else napi_gro_receive(&rq->napi, skb);
@@ -2501,18 +2506,22 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter) devRead->misc.ddLen = cpu_to_le32(sizeof(struct vmxnet3_adapter));
/* set up feature flags */
- if (adapter->netdev->features & NETIF_F_RXCSUM)
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
devRead->misc.uptFeatures |= UPT1_F_RXCSUM;adapter->netdev->features))
- if (adapter->netdev->features & NETIF_F_LRO) {
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT,
devRead->misc.uptFeatures |= UPT1_F_LRO; devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS); }adapter->netdev->features)) {
- if (adapter->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
devRead->misc.uptFeatures |= UPT1_F_RXVLAN;adapter->netdev->features))
- if (adapter->netdev->features & (NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM))
if (netdev_feature_test_bits(NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM,
adapter->netdev->features))
devRead->misc.uptFeatures |= UPT1_F_RXINNEROFLD;
devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu);
@@ -3163,28 +3172,40 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) { struct net_device *netdev = adapter->netdev;
- netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_LRO;
netdev_feature_zero(&netdev->hw_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO |
NETIF_F_TSO6 | NETIF_F_LRO,
&netdev->hw_features);
if (VMXNET3_VERSION_GE_4(adapter)) {
netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev->hw_enc_features = NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev_feature_zero(&netdev->hw_features);
redundant assignedment, will remove it in next version
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM,
&netdev->hw_features);
netdev_feature_zero(&netdev->hw_enc_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM,
&netdev->hw_enc_features);
}
if (dma64)
netdev->hw_features |= NETIF_F_HIGHDMA;
- netdev->vlan_features = netdev->hw_features &
~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX);
- netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT,
&netdev->hw_features);
- netdev_feature_copy(&netdev->vlan_features, netdev->hw_features);
- netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX,
&netdev->vlan_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features);
- netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
}&netdev->features);
@@ -3636,8 +3657,9 @@ vmxnet3_probe_device(struct pci_dev *pdev, if (adapter->num_rx_queues > 1 && adapter->intr.type == VMXNET3_IT_MSIX) { adapter->rss = true;
netdev->hw_features |= NETIF_F_RXHASH;
netdev->features |= NETIF_F_RXHASH;
netdev_feature_set_bit(NETIF_F_RXHASH_BIT,
&netdev->hw_features);
dev_dbg(&pdev->dev, "RSS is enabled.\n"); } else { adapter->rss = false;netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->features);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 9b3acf4..0e36170 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -250,8 +250,8 @@ void vmxnet3_fix_features(struct net_device *netdev, netdev_features_t *features) { /* If Rx checksum is disabled, then LRO should also be disabled */
- if (!(*features & NETIF_F_RXCSUM))
*features &= ~NETIF_F_LRO;
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features))
netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
}
void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev,
@@ -274,7 +274,9 @@ void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, l4_proto = ipv6_hdr(skb)->nexthdr; break; default:
*features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK |
NETIF_F_GSO_MASK,
}features); return;
@@ -286,12 +288,16 @@ void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, if (port != GENEVE_UDP_PORT && port != IANA_VXLAN_UDP_PORT && port != VXLAN_UDP_PORT) {
*features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK |
NETIF_F_GSO_MASK,
default:features); return; } break;
*features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK |
NETIF_F_GSO_MASK,
} }features); return;
@@ -302,11 +308,14 @@ static void vmxnet3_enable_encap_offloads(struct net_device *netdev) struct vmxnet3_adapter *adapter = netdev_priv(netdev);
if (VMXNET3_VERSION_GE_4(adapter)) {
netdev->hw_enc_features |= NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM,
} }&netdev->hw_enc_features);
@@ -315,26 +324,33 @@ static void vmxnet3_disable_encap_offloads(struct net_device *netdev) struct vmxnet3_adapter *adapter = netdev_priv(netdev);
if (VMXNET3_VERSION_GE_4(adapter)) {
netdev->hw_enc_features &= ~(NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM);
netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM,
&netdev->hw_enc_features);
} }
int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) { struct vmxnet3_adapter *adapter = netdev_priv(netdev);
u64 tun_offload_mask = NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev_features_t changed; unsigned long flags;
- netdev_features_t changed = features ^ netdev->features;
- netdev_features_t tun_offload_mask = NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM;
- u8 udp_tun_enabled = (netdev->features & tun_offload_mask) != 0;
- if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO |
NETIF_F_HW_VLAN_CTAG_RX | tun_offload_mask)) {
if (features & NETIF_F_RXCSUM)
- u8 udp_tun_enabled;
- netdev_feature_xor(&changed, netdev->features, features);
- udp_tun_enabled = netdev_feature_test_bits(tun_offload_mask,
netdev->features);
- if (netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_LRO |
NETIF_F_HW_VLAN_CTAG_RX |
tun_offload_mask, changed)) {
elseif (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) adapter->shared->devRead.misc.uptFeatures |= UPT1_F_RXCSUM;
@@ -342,25 +358,28 @@ int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) ~UPT1_F_RXCSUM;
/* update hardware LRO capability accordingly */
if (features & NETIF_F_LRO)
else adapter->shared->devRead.misc.uptFeatures &= ~UPT1_F_LRO;if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) adapter->shared->devRead.misc.uptFeatures |= UPT1_F_LRO;
if (features & NETIF_F_HW_VLAN_CTAG_RX)
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
else adapter->shared->devRead.misc.uptFeatures &= ~UPT1_F_RXVLAN;features)) adapter->shared->devRead.misc.uptFeatures |= UPT1_F_RXVLAN;
if ((features & tun_offload_mask) != 0 && !udp_tun_enabled) {
if (netdev_feature_test_bits(tun_offload_mask, features) &&
!udp_tun_enabled) { vmxnet3_enable_encap_offloads(netdev); adapter->shared->devRead.misc.uptFeatures |= UPT1_F_RXINNEROFLD;
} else if ((features & tun_offload_mask) == 0 &&
} else if (!netdev_feature_test_bits(tun_offload_mask,
features) && udp_tun_enabled) { vmxnet3_disable_encap_offloads(netdev); adapter->shared->devRead.misc.uptFeatures &=
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/net_failover.c | 57 ++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 20 deletions(-)
diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 878cad2..704e691 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -379,23 +379,33 @@ static rx_handler_result_t net_failover_handle_frame(struct sk_buff **pskb)
static void net_failover_compute_features(struct net_device *dev) { - netdev_features_t vlan_features = FAILOVER_VLAN_FEATURES & - NETIF_F_ALL_FOR_ALL; - netdev_features_t enc_features = FAILOVER_ENC_FEATURES; unsigned short max_hard_header_len = ETH_HLEN; unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; struct net_failover_info *nfo_info = netdev_priv(dev); struct net_device *primary_dev, *standby_dev; + netdev_features_t vlan_features; + netdev_features_t enc_features; + netdev_features_t vlan_mask; + netdev_features_t enc_mask; + + netdev_feature_zero(&vlan_features); + netdev_feature_set_bits(FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, + &vlan_features); + netdev_feature_zero(&enc_features); + netdev_feature_set_bits(FAILOVER_ENC_FEATURES, &enc_features); + netdev_feature_zero(&vlan_mask); + netdev_feature_set_bits(FAILOVER_VLAN_FEATURES, &vlan_mask); + netdev_feature_copy(&enc_mask, enc_features);
primary_dev = rcu_dereference(nfo_info->primary_dev); if (primary_dev) { netdev_increment_features(&vlan_features, vlan_features, primary_dev->vlan_features, - FAILOVER_VLAN_FEATURES); + vlan_mask); netdev_increment_features(&enc_features, enc_features, primary_dev->hw_enc_features, - FAILOVER_ENC_FEATURES); + enc_features);
dst_release_flag &= primary_dev->priv_flags; if (primary_dev->hard_header_len > max_hard_header_len) @@ -406,18 +416,19 @@ static void net_failover_compute_features(struct net_device *dev) if (standby_dev) { netdev_increment_features(&vlan_features, vlan_features, standby_dev->vlan_features, - FAILOVER_VLAN_FEATURES); + vlan_mask); netdev_increment_features(&enc_features, enc_features, standby_dev->hw_enc_features, - FAILOVER_ENC_FEATURES); + enc_features);
dst_release_flag &= standby_dev->priv_flags; if (standby_dev->hard_header_len > max_hard_header_len) max_hard_header_len = standby_dev->hard_header_len; }
- dev->vlan_features = vlan_features; - dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL; + netdev_feature_copy(&dev->vlan_features, vlan_features); + netdev_feature_copy(&dev->hw_enc_features, enc_features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->hw_enc_features); dev->hard_header_len = max_hard_header_len;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; @@ -481,7 +492,8 @@ static int net_failover_slave_pre_register(struct net_device *slave_dev, !dev_is_pci(slave_dev->dev.parent))) return -EINVAL;
- if (failover_dev->features & NETIF_F_VLAN_CHALLENGED && + if (netdev_feature_test_bit(NETIF_F_VLAN_CHALLENGED_BIT, + failover_dev->features) && vlan_uses_dev(failover_dev)) { netdev_err(failover_dev, "Device %s is VLAN challenged and failover device has VLAN set up\n", failover_dev->name); @@ -731,18 +743,23 @@ struct failover *net_failover_create(struct net_device *standby_dev) IFF_TX_SKB_SHARING);
/* don't acquire failover netdev's netif_tx_lock when transmitting */ - failover_dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &failover_dev->features);
/* Don't allow failover devices to change network namespaces. */ - failover_dev->features |= NETIF_F_NETNS_LOCAL; - - failover_dev->hw_features = FAILOVER_VLAN_FEATURES | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER; - - failover_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; - failover_dev->features |= failover_dev->hw_features; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, + &failover_dev->features); + + netdev_feature_zero(&failover_dev->hw_features); + netdev_feature_set_bits(FAILOVER_VLAN_FEATURES | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &failover_dev->hw_features); + + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, + &failover_dev->hw_features); + netdev_feature_or(&failover_dev->features, failover_dev->features, + failover_dev->hw_features);
memcpy(failover_dev->dev_addr, standby_dev->dev_addr, failover_dev->addr_len);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/core/pktgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 314f97ac..25d7f59 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2813,7 +2813,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
if (!(pkt_dev->flags & F_UDPCSUM)) { skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM)) { + } else if (netdev_feature_test_bits(NETIF_F_HW_CSUM | NETIF_F_IP_CSUM, + odev->features)) { skb->ip_summed = CHECKSUM_PARTIAL; skb->csum = 0; udp4_hwcsum(skb, iph->saddr, iph->daddr); @@ -2948,7 +2949,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
if (!(pkt_dev->flags & F_UDPCSUM)) { skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & (NETIF_F_HW_CSUM | NETIF_F_IPV6_CSUM)) { + } else if (netdev_feature_test_bits(NETIF_F_HW_CSUM | NETIF_F_IPV6_CSUM, + odev->features)) { skb->ip_summed = CHECKSUM_PARTIAL; skb->csum_start = skb_transport_header(skb) - skb->head; skb->csum_offset = offsetof(struct udphdr, check);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/net/pkt_cls.h | 2 +- net/sched/sch_cake.c | 1 + net/sched/sch_netem.c | 3 ++- net/sched/sch_taprio.c | 3 ++- net/sched/sch_tbf.c | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 8fb47fc..bf9787e 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -636,7 +636,7 @@ struct tc_cls_u32_offload {
static inline bool tc_can_offload(const struct net_device *dev) { - return dev->features & NETIF_F_HW_TC; + return netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features); }
static inline bool tc_can_offload_extack(const struct net_device *dev, diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index 0808569..2324b5a 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -1744,6 +1744,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, unsigned int slen = 0, numsegs = 0;
netif_skb_features(skb, &features); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free); diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 414d57e..4aabeb20 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -416,7 +416,8 @@ static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch, netdev_features_t features;
netif_skb_features(skb, &features); - segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + segs = skb_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) { qdisc_drop(skb, sch, to_free); diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index a4073c4..c5114a7 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -458,7 +458,8 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, int ret;
netif_skb_features(skb, &features); - segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 99e6d726..8ac786f 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -197,7 +197,8 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch, int ret, nb;
netif_skb_features(skb, &features); - segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + segs = skb_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
include/net/pkt_cls.h | 2 +- net/sched/sch_cake.c | 1 + net/sched/sch_netem.c | 3 ++- net/sched/sch_taprio.c | 3 ++- net/sched/sch_tbf.c | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 8fb47fc..bf9787e 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -636,7 +636,7 @@ struct tc_cls_u32_offload {
static inline bool tc_can_offload(const struct net_device *dev) {
- return dev->features & NETIF_F_HW_TC;
return netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features); }
static inline bool tc_can_offload_extack(const struct net_device *dev,
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index 0808569..2324b5a 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -1744,6 +1744,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, unsigned int slen = 0, numsegs = 0;
netif_skb_features(skb, &features);
segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
it should be "segs = skb_gso_segment(skb, features);" ,will fix it in next version
if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 414d57e..4aabeb20 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -416,7 +416,8 @@ static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch, netdev_features_t features;
netif_skb_features(skb, &features);
- segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
segs = skb_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) { qdisc_drop(skb, sch, to_free);
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index a4073c4..c5114a7 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -458,7 +458,8 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, int ret;
netif_skb_features(skb, &features);
segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);segs = skb_gso_segment(skb, features);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 99e6d726..8ac786f 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -197,7 +197,8 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch, int ret, nb;
netif_skb_features(skb, &features);
- segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
segs = skb_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/netdevsim/ipsec.c | 4 ++-- drivers/net/netdevsim/netdev.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/net/netdevsim/ipsec.c b/drivers/net/netdevsim/ipsec.c index b80ed2f..3b77c37 100644 --- a/drivers/net/netdevsim/ipsec.c +++ b/drivers/net/netdevsim/ipsec.c @@ -280,8 +280,8 @@ void nsim_ipsec_init(struct netdevsim *ns) NETIF_F_HW_ESP_TX_CSUM | \ NETIF_F_GSO_ESP)
- ns->netdev->features |= NSIM_ESP_FEATURES; - ns->netdev->hw_enc_features |= NSIM_ESP_FEATURES; + netdev_feature_set_bits(NSIM_ESP_FEATURES, &ns->netdev->features); + netdev_feature_set_bits(NSIM_ESP_FEATURES, &ns->netdev->hw_enc_features);
ns->ipsec.pfile = debugfs_create_file("ipsec", 0400, ns->nsim_dev_port->ddir, ns, diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 50572e0..895b548 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -232,7 +232,8 @@ nsim_set_features(struct net_device *dev, netdev_features_t features) { struct netdevsim *ns = netdev_priv(dev);
- if ((dev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC)) + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features) && + !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features)) return nsim_bpf_disable_tc(ns);
return 0; @@ -288,12 +289,12 @@ static void nsim_setup(struct net_device *dev) dev->flags &= ~IFF_MULTICAST; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; - dev->features |= NETIF_F_HIGHDMA | - NETIF_F_SG | - NETIF_F_FRAGLIST | - NETIF_F_HW_CSUM | - NETIF_F_TSO; - dev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bits(NETIF_F_HIGHDMA | + NETIF_F_SG | + NETIF_F_FRAGLIST | + NETIF_F_HW_CSUM | + NETIF_F_TSO, &dev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &dev->hw_features); dev->max_mtu = ETH_MAX_MTU; }
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/virtio_net.c | 51 +++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 18 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 2e42210..5859f8f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2635,11 +2635,12 @@ static int virtnet_set_features(struct net_device *dev, u64 offloads; int err;
- if ((dev->features ^ features) & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features) != + netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { if (vi->xdp_enabled) return -EBUSY;
- if (features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) offloads = vi->guest_offloads_capable; else offloads = vi->guest_offloads_capable & @@ -2878,7 +2879,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi) if (vi->has_cvq) { vi->cvq = vqs[total_vqs - 1]; if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN)) - vi->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &vi->dev->features); }
for (i = 0; i < vi->max_queue_pairs; i++) { @@ -3089,7 +3091,8 @@ static int virtnet_probe(struct virtio_device *vdev) dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE | IFF_TX_SKB_NO_LINEAR; dev->netdev_ops = &virtnet_netdev; - dev->features = NETIF_F_HIGHDMA; + netdev_feature_zero(&dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
dev->ethtool_ops = &virtnet_ethtool_ops; SET_NETDEV_DEV(dev, &vdev->dev); @@ -3097,37 +3100,49 @@ static int virtnet_probe(struct virtio_device *vdev) /* Do we support "hardware" checksums? */ if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { /* This opens up the world of extra features. */ - dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, + &dev->hw_features); if (csum) - dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, + &dev->features);
if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { - dev->hw_features |= NETIF_F_TSO - | NETIF_F_TSO_ECN | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO_ECN | + NETIF_F_TSO6, + &dev->hw_features); } /* Individual feature bits: what can host handle? */ if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4)) - dev->hw_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &dev->hw_features); if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6)) - dev->hw_features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &dev->hw_features); if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) - dev->hw_features |= NETIF_F_TSO_ECN; + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, + &dev->hw_features);
- dev->features |= NETIF_F_GSO_ROBUST; + netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &dev->features);
- if (gso) - dev->features |= dev->hw_features & NETIF_F_ALL_TSO; + if (gso) { + netdev_features_t tmp; + + netdev_feature_zero(&tmp); + netdev_feature_set_bits(NETIF_F_ALL_TSO, &tmp); + netdev_feature_and(&dev->features, dev->hw_features, + tmp); + } /* (!csum && gso) case will be fixed by register_netdev() */ } if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) - dev->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6)) - dev->features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->features); if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) - dev->hw_features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features);
- dev->vlan_features = dev->features; + netdev_feature_copy(&dev->vlan_features, dev->features);
/* MTU range: 68 - 65535 */ dev->min_mtu = MIN_MTU;
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/virtio_net.c | 51 +++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 18 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 2e42210..5859f8f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2635,11 +2635,12 @@ static int virtnet_set_features(struct net_device *dev, u64 offloads; int err;
- if ((dev->features ^ features) & NETIF_F_LRO) {
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features) !=
if (vi->xdp_enabled) return -EBUSY;netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) {
if (features & NETIF_F_LRO)
else offloads = vi->guest_offloads_capable &if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) offloads = vi->guest_offloads_capable;
@@ -2878,7 +2879,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi) if (vi->has_cvq) { vi->cvq = vqs[total_vqs - 1]; if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
vi->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&vi->dev->features);
}
for (i = 0; i < vi->max_queue_pairs; i++) {
@@ -3089,7 +3091,8 @@ static int virtnet_probe(struct virtio_device *vdev) dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE | IFF_TX_SKB_NO_LINEAR; dev->netdev_ops = &virtnet_netdev;
- dev->features = NETIF_F_HIGHDMA;
netdev_feature_zero(&dev->features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
dev->ethtool_ops = &virtnet_ethtool_ops; SET_NETDEV_DEV(dev, &vdev->dev);
@@ -3097,37 +3100,49 @@ static int virtnet_probe(struct virtio_device *vdev) /* Do we support "hardware" checksums? */ if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { /* This opens up the world of extra features. */
dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG;
netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG,
if (csum)&dev->hw_features);
dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG,
&dev->features);
if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
dev->hw_features |= NETIF_F_TSO
| NETIF_F_TSO_ECN | NETIF_F_TSO6;
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO_ECN |
NETIF_F_TSO6,
} /* Individual feature bits: what can host handle? */ if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4))&dev->hw_features);
dev->hw_features |= NETIF_F_TSO;
netdev_feature_set_bit(NETIF_F_TSO_BIT,
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6))&dev->hw_features);
dev->hw_features |= NETIF_F_TSO6;
netdev_feature_set_bit(NETIF_F_TSO6_BIT,
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN))&dev->hw_features);
dev->hw_features |= NETIF_F_TSO_ECN;
netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT,
&dev->hw_features);
dev->features |= NETIF_F_GSO_ROBUST;
netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &dev->features);
if (gso)
dev->features |= dev->hw_features & NETIF_F_ALL_TSO;
if (gso) {
netdev_features_t tmp;
netdev_feature_zero(&tmp);
netdev_feature_set_bits(NETIF_F_ALL_TSO, &tmp);
netdev_feature_and(&dev->features, dev->hw_features,
tmp);
it shoule be netdev_feature_copy(&tmp, dev->hw_features); netdev_feature_and_bits(NETIF_F_ALL_TSO, &tmp); netdev_feature_or(&dev->features, dev->features, tmp);
will fix it in next version
/* (!csum && gso) case will be fixed by register_netdev() */ } if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM))}
dev->features |= NETIF_F_RXCSUM;
if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6))netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features);
dev->features |= NETIF_F_LRO;
if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS))netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->features);
dev->hw_features |= NETIF_F_LRO;
netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features);
- dev->vlan_features = dev->features;
netdev_feature_copy(&dev->vlan_features, dev->features);
/* MTU range: 68 - 65535 */ dev->min_mtu = MIN_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/net/udp.h | 8 ++++++-- include/net/udp_tunnel.h | 12 ++++++++---- net/ipv4/af_inet.c | 3 ++- net/ipv4/esp4_offload.c | 29 ++++++++++++++++++----------- net/ipv4/gre_offload.c | 8 +++++--- net/ipv4/ip_gre.c | 36 ++++++++++++++++++++++-------------- net/ipv4/ip_output.c | 23 +++++++++++++++-------- net/ipv4/ip_tunnel.c | 4 +++- net/ipv4/ip_vti.c | 2 +- net/ipv4/ipip.c | 6 +++--- net/ipv4/ipmr.c | 2 +- net/ipv4/tcp_offload.c | 5 ++++- net/ipv4/udp_offload.c | 28 +++++++++++++++++----------- 13 files changed, 105 insertions(+), 61 deletions(-)
diff --git a/include/net/udp.h b/include/net/udp.h index 360df45..3855b97 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -481,14 +481,18 @@ void udpv6_encap_enable(void); static inline struct sk_buff *udp_rcv_segment(struct sock *sk, struct sk_buff *skb, bool ipv4) { - netdev_features_t features = NETIF_F_SG; + netdev_features_t features; struct sk_buff *segs;
+ netdev_feature_zero(&features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &features); + /* Avoid csum recalculation by skb_segment unless userspace explicitly * asks for the final checksum values */ if (!inet_get_convert_csum(sk)) - features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &features);
/* UDP segmentation expects packets of type CHECKSUM_PARTIAL or * CHECKSUM_NONE in __udp_gso_segment. UDP GRO indeed builds partial diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index afc7ce7..68c1a54 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -129,7 +129,8 @@ void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type); static inline void udp_tunnel_get_rx_info(struct net_device *dev) { ASSERT_RTNL(); - if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) + if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, + dev->features)) return; call_netdevice_notifiers(NETDEV_UDP_TUNNEL_PUSH_INFO, dev); } @@ -137,7 +138,8 @@ static inline void udp_tunnel_get_rx_info(struct net_device *dev) static inline void udp_tunnel_drop_rx_info(struct net_device *dev) { ASSERT_RTNL(); - if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) + if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, + dev->features)) return; call_netdevice_notifiers(NETDEV_UDP_TUNNEL_DROP_INFO, dev); } @@ -326,7 +328,8 @@ udp_tunnel_nic_set_port_priv(struct net_device *dev, unsigned int table, static inline void udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti) { - if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) + if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, + dev->features)) return; if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->add_port(dev, ti); @@ -335,7 +338,8 @@ udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti) static inline void udp_tunnel_nic_del_port(struct net_device *dev, struct udp_tunnel_info *ti) { - if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) + if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, + dev->features)) return; if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->del_port(dev, ti); diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 0e4d758..2932eba 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1361,7 +1361,8 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap) - features &= skb->dev->hw_enc_features; + netdev_feature_and(&features, features, + skb->dev->hw_enc_features); SKB_GSO_CB(skb)->encap_level += ihl;
skb_reset_transport_header(skb); diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c index 8e4e9aa..77c876e 100644 --- a/net/ipv4/esp4_offload.c +++ b/net/ipv4/esp4_offload.c @@ -189,8 +189,8 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, struct xfrm_state *x; struct ip_esp_hdr *esph; struct crypto_aead *aead; - netdev_features_t esp_features = features; struct xfrm_offload *xo = xfrm_offload(skb); + netdev_features_t esp_features; struct sec_path *sp;
if (!xo) @@ -214,14 +214,20 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
- 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_SG | NETIF_F_CSUM_MASK | - NETIF_F_SCTP_CRC); - 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 | - NETIF_F_SCTP_CRC); + netdev_feature_copy(&esp_features, features); + if ((!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, + skb->dev->gso_partial_features) && + !netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features)) || + x->xso.dev != skb->dev) + netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_CSUM_MASK | + NETIF_F_SCTP_CRC, &esp_features); + + else if (!netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, + features) && + !netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, + skb->dev->gso_partial_features)) + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_SCTP_CRC, + &esp_features);
xo->flags |= XFRM_GSO_SEGMENT;
@@ -261,8 +267,9 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_ if (!xo) return -EINVAL;
- if ((!(features & NETIF_F_HW_ESP) && - !(skb->dev->gso_partial_features & NETIF_F_HW_ESP)) || + if ((!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features) && + !netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, + skb->dev->gso_partial_features)) || x->xso.dev != skb->dev) { xo->flags |= CRYPTO_FALLBACK; hw_offload = false; diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index 1121a9d..65f22fa 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c @@ -43,14 +43,16 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, need_csum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM); skb->encap_hdr_csum = need_csum;
- features &= skb->dev->hw_enc_features; + netdev_feature_and(&features, features, skb->dev->hw_enc_features); + if (need_csum) - features &= ~NETIF_F_SCTP_CRC; + netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, &features);
need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb)); /* Try to offload checksum if possible */ offload_csum = !!(need_csum && !need_ipsec && - (skb->dev->features & NETIF_F_HW_CSUM)); + netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, + skb->dev->features));
/* segment inner packet. */ segs = skb_mac_gso_segment(skb, features); diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 6ebf058..9cf14d3 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -762,16 +762,22 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || tunnel->encap.type == TUNNEL_ENCAP_NONE) { - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &dev->hw_features); } else { - dev->features &= ~NETIF_F_GSO_SOFTWARE; - dev->hw_features &= ~NETIF_F_GSO_SOFTWARE; + netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, + &dev->features); + netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, + &dev->hw_features); } - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); } else { - dev->hw_features &= ~NETIF_F_GSO_SOFTWARE; - dev->features &= ~(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE); + netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, + &dev->hw_features); + netdev_feature_clear_bits(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE, + &dev->features); } }
@@ -953,8 +959,8 @@ static void __gre_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph);
- dev->features |= GRE_FEATURES; - dev->hw_features |= GRE_FEATURES; + netdev_feature_set_bits(GRE_FEATURES, &dev->features); + netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features);
if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { /* TCP offload with GRE SEQ is not supported, nor @@ -963,14 +969,16 @@ static void __gre_tunnel_init(struct net_device *dev) */ if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || (tunnel->encap.type == TUNNEL_ENCAP_NONE)) { - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &dev->hw_features); }
/* Can use a lockless transmit, unless we generate * output sequences */ - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); } }
@@ -1298,8 +1306,8 @@ static int erspan_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen + erspan_hdr_len(tunnel->erspan_ver);
- dev->features |= GRE_FEATURES; - dev->hw_features |= GRE_FEATURES; + netdev_feature_set_bits(GRE_FEATURES, &dev->features); + netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; netif_keep_dst(dev);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index e458f1f..fb0288a 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -257,7 +257,8 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk, */ netif_skb_features(skb, &features); BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_GSO_CB_OFFSET); - segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); return -ENOMEM; @@ -1005,9 +1006,11 @@ static int __ip_append_data(struct sock *sk, */ if (transhdrlen && length + fragheaderlen <= mtu && - rt->dst.dev->features & (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM) && + netdev_feature_test_bits(NETIF_F_HW_CSUM | NETIF_F_IP_CSUM, + rt->dst.dev->features) && (!(flags & MSG_MORE) || cork->gso_size) && - (!exthdrlen || (rt->dst.dev->features & NETIF_F_HW_ESP_TX_CSUM))) + (!exthdrlen || netdev_feature_test_bits(NETIF_F_HW_ESP_TX_CSUM_BIT, + rt->dst.dev->features))) csummode = CHECKSUM_PARTIAL;
if (flags & MSG_ZEROCOPY && length && sock_flag(sk, SOCK_ZEROCOPY)) { @@ -1015,7 +1018,8 @@ static int __ip_append_data(struct sock *sk, if (!uarg) return -ENOBUFS; extra_uref = !skb_zcopy(skb); /* only ref on new uarg */ - if (rt->dst.dev->features & NETIF_F_SG && + if (netdev_feature_test_bits(NETIF_F_SG_BIT, + rt->dst.dev->features) && csummode == CHECKSUM_PARTIAL) { paged = true; } else { @@ -1078,11 +1082,13 @@ static int __ip_append_data(struct sock *sk, alloc_extra += rt->dst.trailer_len;
if ((flags & MSG_MORE) && - !(rt->dst.dev->features&NETIF_F_SG)) + !netdev_feature_test_bits(NETIF_F_SG_BIT, + rt->dst.dev->features)) alloclen = mtu; else if (!paged && (fraglen + alloc_extra < SKB_MAX_ALLOC || - !(rt->dst.dev->features & NETIF_F_SG))) + !netdev_feature_test_bits(NETIF_F_SG_BIT, + rt->dst.dev->features))) alloclen = fraglen; else { alloclen = min_t(int, fraglen, MAX_HEADER); @@ -1170,7 +1176,8 @@ static int __ip_append_data(struct sock *sk, if (copy > length) copy = length;
- if (!(rt->dst.dev->features&NETIF_F_SG) && + if (!netdev_feature_test_bits(NETIF_F_SG_BIT, + rt->dst.dev->features) && skb_tailroom(skb) >= copy) { unsigned int off;
@@ -1349,7 +1356,7 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, if (cork->flags & IPCORK_OPT) opt = cork->opt;
- if (!(rt->dst.dev->features & NETIF_F_SG)) + if (!netdev_feature_test_bits(NETIF_F_SG_BIT, rt->dst.dev->features)) return -EOPNOTSUPP;
hh_len = LL_RESERVED_SPACE(rt->dst.dev); diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index fe9101d..ac5671e 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -1072,7 +1072,9 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id, * Allowing to move it to another netns is clearly unsafe. */ if (!IS_ERR(itn->fb_tunnel_dev)) { - itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, + &itn->fb_tunnel_dev->features); + itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev); ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev)); itn->type = itn->fb_tunnel_dev->type; diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index efe25a0..bf94ef6 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -430,7 +430,7 @@ static int vti_tunnel_init(struct net_device *dev)
dev->flags = IFF_NOARP; dev->addr_len = 4; - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); netif_keep_dst(dev);
return ip_tunnel_init(dev); diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 3aa78cc..b587d47 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -368,11 +368,11 @@ static void ipip_tunnel_setup(struct net_device *dev) dev->type = ARPHRD_TUNNEL; dev->flags = IFF_NOARP; dev->addr_len = 4; - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); netif_keep_dst(dev);
- dev->features |= IPIP_FEATURES; - dev->hw_features |= IPIP_FEATURES; + netdev_feature_set_bits(IPIP_FEATURES, &dev->features); + netdev_feature_set_bits(IPIP_FEATURES, &dev->hw_features); ip_tunnel_setup(dev, ipip_net_id); }
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 2dda856..750a4a1 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -532,7 +532,7 @@ static void reg_vif_setup(struct net_device *dev) dev->flags = IFF_NOARP; dev->netdev_ops = ®_vif_netdev_ops; dev->needs_free_netdev = true; - dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); }
static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt) diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index fc61cd3..4bf0a0d 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -65,6 +65,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, struct sk_buff *gso_skb = skb; __sum16 newcheck; bool ooo_okay, copy_destructor; + netdev_features_t tmp;
th = tcp_hdr(skb); thlen = th->doff * 4; @@ -81,7 +82,9 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, if (unlikely(skb->len <= mss)) goto out;
- if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) { + netdev_feature_copy(&tmp, features); + netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &tmp); + if (skb_gso_ok(skb, tmp)) { /* Packet is from an untrusted source, reset gso_segs. */
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss); diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 1380a6b..ad9bfde 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -63,22 +63,26 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, /* Try to offload checksum if possible */ offload_csum = !!(need_csum && !need_ipsec && - (skb->dev->features & - (is_ipv6 ? (NETIF_F_HW_CSUM | NETIF_F_IPV6_CSUM) : - (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM)))); - - features &= skb->dev->hw_enc_features; + is_ipv6 ? + netdev_feature_test_bits(NETIF_F_HW_CSUM | + NETIF_F_IPV6_CSUM, + skb->dev->features) : + netdev_feature_test_bits(NETIF_F_HW_CSUM | + NETIF_F_IP_CSUM, + skb->dev->features)); + + netdev_feature_and(&features, features, skb->dev->hw_enc_features); if (need_csum) - features &= ~NETIF_F_SCTP_CRC; + netdev_feature_clear_bit(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 * instead set the flag based on our outer checksum offload value. */ if (remcsum) { - features &= ~NETIF_F_CSUM_MASK; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, &features); if (!need_csum || offload_csum) - features |= NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); }
/* segment inner packet. */ @@ -414,7 +418,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, * software prior to segmenting the frame. */ if (!skb->encap_hdr_csum) - features |= NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features);
/* Fragment the skb. IP headers of the fragments are updated in * inet_gso_segment() @@ -520,10 +524,12 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, */ NAPI_GRO_CB(skb)->is_flist = 0; if (!sk || !udp_sk(sk)->gro_receive) { - if (skb->dev->features & NETIF_F_GRO_FRAGLIST) + if (netdev_feature_test_bit(NETIF_F_GRO_FRAGLIST_BIT, + skb->dev->features)) NAPI_GRO_CB(skb)->is_flist = sk ? !udp_sk(sk)->gro_enabled : 1;
- if ((!sk && (skb->dev->features & NETIF_F_GRO_UDP_FWD)) || + if ((!sk && netdev_feature_test_bit(NETIF_F_GRO_UDP_FWD_BIT, + skb->dev->features)) || (sk && udp_sk(sk)->gro_enabled) || NAPI_GRO_CB(skb)->is_flist) return call_gro_receive(udp_gro_receive_segment, head, skb);
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
include/net/udp.h | 8 ++++++-- include/net/udp_tunnel.h | 12 ++++++++---- net/ipv4/af_inet.c | 3 ++- net/ipv4/esp4_offload.c | 29 ++++++++++++++++++----------- net/ipv4/gre_offload.c | 8 +++++--- net/ipv4/ip_gre.c | 36 ++++++++++++++++++++++-------------- net/ipv4/ip_output.c | 23 +++++++++++++++-------- net/ipv4/ip_tunnel.c | 4 +++- net/ipv4/ip_vti.c | 2 +- net/ipv4/ipip.c | 6 +++--- net/ipv4/ipmr.c | 2 +- net/ipv4/tcp_offload.c | 5 ++++- net/ipv4/udp_offload.c | 28 +++++++++++++++++----------- 13 files changed, 105 insertions(+), 61 deletions(-)
diff --git a/include/net/udp.h b/include/net/udp.h index 360df45..3855b97 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -481,14 +481,18 @@ void udpv6_encap_enable(void); static inline struct sk_buff *udp_rcv_segment(struct sock *sk, struct sk_buff *skb, bool ipv4) {
- netdev_features_t features = NETIF_F_SG;
netdev_features_t features; struct sk_buff *segs;
netdev_feature_zero(&features);
netdev_feature_set_bit(NETIF_F_SG_BIT, &features);
/* Avoid csum recalculation by skb_segment unless userspace explicitly
- asks for the final checksum values
*/ if (!inet_get_convert_csum(sk))
features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
&features);
/* UDP segmentation expects packets of type CHECKSUM_PARTIAL or
- CHECKSUM_NONE in __udp_gso_segment. UDP GRO indeed builds partial
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index afc7ce7..68c1a54 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -129,7 +129,8 @@ void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type); static inline void udp_tunnel_get_rx_info(struct net_device *dev) { ASSERT_RTNL();
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT,
return; call_netdevice_notifiers(NETDEV_UDP_TUNNEL_PUSH_INFO, dev); }dev->features))
@@ -137,7 +138,8 @@ static inline void udp_tunnel_get_rx_info(struct net_device *dev) static inline void udp_tunnel_drop_rx_info(struct net_device *dev) { ASSERT_RTNL();
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT,
return; call_netdevice_notifiers(NETDEV_UDP_TUNNEL_DROP_INFO, dev); }dev->features))
@@ -326,7 +328,8 @@ udp_tunnel_nic_set_port_priv(struct net_device *dev, unsigned int table, static inline void udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti) {
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT,
return; if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->add_port(dev, ti);dev->features))
@@ -335,7 +338,8 @@ udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti) static inline void udp_tunnel_nic_del_port(struct net_device *dev, struct udp_tunnel_info *ti) {
- if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT))
- if (!netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT,
return; if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->del_port(dev, ti);dev->features))
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 0e4d758..2932eba 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1361,7 +1361,8 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap)
features &= skb->dev->hw_enc_features;
netdev_feature_and(&features, features,
skb->dev->hw_enc_features);
SKB_GSO_CB(skb)->encap_level += ihl;
skb_reset_transport_header(skb);
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c index 8e4e9aa..77c876e 100644 --- a/net/ipv4/esp4_offload.c +++ b/net/ipv4/esp4_offload.c @@ -189,8 +189,8 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, struct xfrm_state *x; struct ip_esp_hdr *esph; struct crypto_aead *aead;
- netdev_features_t esp_features = features; struct xfrm_offload *xo = xfrm_offload(skb);
netdev_features_t esp_features; struct sec_path *sp;
if (!xo)
@@ -214,14 +214,20 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
- 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_SG | NETIF_F_CSUM_MASK |
NETIF_F_SCTP_CRC);
- 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 |
NETIF_F_SCTP_CRC);
- netdev_feature_copy(&esp_features, features);
- if ((!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT,
skb->dev->gso_partial_features) &&
!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features)) ||
x->xso.dev != skb->dev)
netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_CSUM_MASK |
NETIF_F_SCTP_CRC, &esp_features);
unnecessary blank line here, will remove it in next version
else if (!netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT,
features) &&
!netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT,
skb->dev->gso_partial_features))
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_SCTP_CRC,
&esp_features);
xo->flags |= XFRM_GSO_SEGMENT;
@@ -261,8 +267,9 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_ if (!xo) return -EINVAL;
- if ((!(features & NETIF_F_HW_ESP) &&
!(skb->dev->gso_partial_features & NETIF_F_HW_ESP)) ||
- if ((!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features) &&
!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT,
x->xso.dev != skb->dev) { xo->flags |= CRYPTO_FALLBACK; hw_offload = false;skb->dev->gso_partial_features)) ||
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index 1121a9d..65f22fa 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c @@ -43,14 +43,16 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, need_csum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM); skb->encap_hdr_csum = need_csum;
- features &= skb->dev->hw_enc_features;
- netdev_feature_and(&features, features, skb->dev->hw_enc_features);
- if (need_csum)
features &= ~NETIF_F_SCTP_CRC;
netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, &features);
need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb)); /* Try to offload checksum if possible */ offload_csum = !!(need_csum && !need_ipsec &&
(skb->dev->features & NETIF_F_HW_CSUM));
netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT,
skb->dev->features));
/* segment inner packet. */ segs = skb_mac_gso_segment(skb, features);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 6ebf058..9cf14d3 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -762,16 +762,22 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || tunnel->encap.type == TUNNEL_ENCAP_NONE) {
dev->features |= NETIF_F_GSO_SOFTWARE;
dev->hw_features |= NETIF_F_GSO_SOFTWARE;
netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE,
&dev->features);
netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE,
} else {&dev->hw_features);
dev->features &= ~NETIF_F_GSO_SOFTWARE;
dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE,
&dev->features);
netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE,
}&dev->hw_features);
dev->features |= NETIF_F_LLTX;
} else {netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features);
dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
dev->features &= ~(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE);
netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE,
&dev->hw_features);
netdev_feature_clear_bits(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE,
} }&dev->features);
@@ -953,8 +959,8 @@ static void __gre_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph);
- dev->features |= GRE_FEATURES;
- dev->hw_features |= GRE_FEATURES;
netdev_feature_set_bits(GRE_FEATURES, &dev->features);
netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features);
if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { /* TCP offload with GRE SEQ is not supported, nor
@@ -963,14 +969,16 @@ static void __gre_tunnel_init(struct net_device *dev) */ if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || (tunnel->encap.type == TUNNEL_ENCAP_NONE)) {
dev->features |= NETIF_F_GSO_SOFTWARE;
dev->hw_features |= NETIF_F_GSO_SOFTWARE;
netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE,
&dev->features);
netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE,
&dev->hw_features);
}
/* Can use a lockless transmit, unless we generate
- output sequences
*/
dev->features |= NETIF_F_LLTX;
} }netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features);
@@ -1298,8 +1306,8 @@ static int erspan_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen + erspan_hdr_len(tunnel->erspan_ver);
- dev->features |= GRE_FEATURES;
- dev->hw_features |= GRE_FEATURES;
- netdev_feature_set_bits(GRE_FEATURES, &dev->features);
- netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; netif_keep_dst(dev);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index e458f1f..fb0288a 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -257,7 +257,8 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk, */ netif_skb_features(skb, &features); BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_GSO_CB_OFFSET);
- segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
- netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
- segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); return -ENOMEM;
@@ -1005,9 +1006,11 @@ static int __ip_append_data(struct sock *sk, */ if (transhdrlen && length + fragheaderlen <= mtu &&
rt->dst.dev->features & (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM) &&
netdev_feature_test_bits(NETIF_F_HW_CSUM | NETIF_F_IP_CSUM,
(!(flags & MSG_MORE) || cork->gso_size) &&rt->dst.dev->features) &&
(!exthdrlen || (rt->dst.dev->features & NETIF_F_HW_ESP_TX_CSUM)))
(!exthdrlen || netdev_feature_test_bits(NETIF_F_HW_ESP_TX_CSUM_BIT,
rt->dst.dev->features)))
csummode = CHECKSUM_PARTIAL;
if (flags & MSG_ZEROCOPY && length && sock_flag(sk, SOCK_ZEROCOPY)) {
@@ -1015,7 +1018,8 @@ static int __ip_append_data(struct sock *sk, if (!uarg) return -ENOBUFS; extra_uref = !skb_zcopy(skb); /* only ref on new uarg */
if (rt->dst.dev->features & NETIF_F_SG &&
if (netdev_feature_test_bits(NETIF_F_SG_BIT,
csummode == CHECKSUM_PARTIAL) { paged = true; } else {rt->dst.dev->features) &&
@@ -1078,11 +1082,13 @@ static int __ip_append_data(struct sock *sk, alloc_extra += rt->dst.trailer_len;
if ((flags & MSG_MORE) &&
!(rt->dst.dev->features&NETIF_F_SG))
!netdev_feature_test_bits(NETIF_F_SG_BIT,
rt->dst.dev->features)) alloclen = mtu; else if (!paged && (fraglen + alloc_extra < SKB_MAX_ALLOC ||
!(rt->dst.dev->features & NETIF_F_SG)))
!netdev_feature_test_bits(NETIF_F_SG_BIT,
rt->dst.dev->features))) alloclen = fraglen; else { alloclen = min_t(int, fraglen, MAX_HEADER);
@@ -1170,7 +1176,8 @@ static int __ip_append_data(struct sock *sk, if (copy > length) copy = length;
if (!(rt->dst.dev->features&NETIF_F_SG) &&
if (!netdev_feature_test_bits(NETIF_F_SG_BIT,
skb_tailroom(skb) >= copy) { unsigned int off;rt->dst.dev->features) &&
@@ -1349,7 +1356,7 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, if (cork->flags & IPCORK_OPT) opt = cork->opt;
- if (!(rt->dst.dev->features & NETIF_F_SG))
if (!netdev_feature_test_bits(NETIF_F_SG_BIT, rt->dst.dev->features)) return -EOPNOTSUPP;
hh_len = LL_RESERVED_SPACE(rt->dst.dev);
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index fe9101d..ac5671e 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -1072,7 +1072,9 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id, * Allowing to move it to another netns is clearly unsafe. */ if (!IS_ERR(itn->fb_tunnel_dev)) {
itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT,
&itn->fb_tunnel_dev->features);
- itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev); ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev)); itn->type = itn->fb_tunnel_dev->type;
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index efe25a0..bf94ef6 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -430,7 +430,7 @@ static int vti_tunnel_init(struct net_device *dev)
dev->flags = IFF_NOARP; dev->addr_len = 4;
- dev->features |= NETIF_F_LLTX;
netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); netif_keep_dst(dev);
return ip_tunnel_init(dev);
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 3aa78cc..b587d47 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -368,11 +368,11 @@ static void ipip_tunnel_setup(struct net_device *dev) dev->type = ARPHRD_TUNNEL; dev->flags = IFF_NOARP; dev->addr_len = 4;
- dev->features |= NETIF_F_LLTX;
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); netif_keep_dst(dev);
- dev->features |= IPIP_FEATURES;
- dev->hw_features |= IPIP_FEATURES;
- netdev_feature_set_bits(IPIP_FEATURES, &dev->features);
- netdev_feature_set_bits(IPIP_FEATURES, &dev->hw_features); ip_tunnel_setup(dev, ipip_net_id); }
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 2dda856..750a4a1 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -532,7 +532,7 @@ static void reg_vif_setup(struct net_device *dev) dev->flags = IFF_NOARP; dev->netdev_ops = ®_vif_netdev_ops; dev->needs_free_netdev = true;
- dev->features |= NETIF_F_NETNS_LOCAL;
netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); }
static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt)
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index fc61cd3..4bf0a0d 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -65,6 +65,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, struct sk_buff *gso_skb = skb; __sum16 newcheck; bool ooo_okay, copy_destructor;
netdev_features_t tmp;
th = tcp_hdr(skb); thlen = th->doff * 4;
@@ -81,7 +82,9 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, if (unlikely(skb->len <= mss)) goto out;
- if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
netdev_feature_copy(&tmp, features);
netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &tmp);
if (skb_gso_ok(skb, tmp)) { /* Packet is from an untrusted source, reset gso_segs. */
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 1380a6b..ad9bfde 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -63,22 +63,26 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, /* Try to offload checksum if possible */ offload_csum = !!(need_csum && !need_ipsec &&
(skb->dev->features &
(is_ipv6 ? (NETIF_F_HW_CSUM | NETIF_F_IPV6_CSUM) :
(NETIF_F_HW_CSUM | NETIF_F_IP_CSUM))));
- features &= skb->dev->hw_enc_features;
is_ipv6 ?
netdev_feature_test_bits(NETIF_F_HW_CSUM |
NETIF_F_IPV6_CSUM,
skb->dev->features) :
netdev_feature_test_bits(NETIF_F_HW_CSUM |
NETIF_F_IP_CSUM,
skb->dev->features));
- netdev_feature_and(&features, features, skb->dev->hw_enc_features); if (need_csum)
features &= ~NETIF_F_SCTP_CRC;
netdev_feature_clear_bit(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
- instead set the flag based on our outer checksum offload value.
*/ if (remcsum) {
features &= ~NETIF_F_CSUM_MASK;
if (!need_csum || offload_csum)netdev_feature_clear_bits(NETIF_F_CSUM_MASK, &features);
features |= NETIF_F_HW_CSUM;
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features);
}
/* segment inner packet. */
@@ -414,7 +418,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, * software prior to segmenting the frame. */ if (!skb->encap_hdr_csum)
features |= NETIF_F_HW_CSUM;
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features);
/* Fragment the skb. IP headers of the fragments are updated in
- inet_gso_segment()
@@ -520,10 +524,12 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, */ NAPI_GRO_CB(skb)->is_flist = 0; if (!sk || !udp_sk(sk)->gro_receive) {
if (skb->dev->features & NETIF_F_GRO_FRAGLIST)
if (netdev_feature_test_bit(NETIF_F_GRO_FRAGLIST_BIT,
skb->dev->features)) NAPI_GRO_CB(skb)->is_flist = sk ? !udp_sk(sk)->gro_enabled : 1;
if ((!sk && (skb->dev->features & NETIF_F_GRO_UDP_FWD)) ||
if ((!sk && netdev_feature_test_bit(NETIF_F_GRO_UDP_FWD_BIT,
(sk && udp_sk(sk)->gro_enabled) || NAPI_GRO_CB(skb)->is_flist) return call_gro_receive(udp_gro_receive_segment, head, skb);skb->dev->features)) ||
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/ipv6/esp6_offload.c | 19 +++++++++++-------- net/ipv6/ip6_gre.c | 17 ++++++++++------- net/ipv6/ip6_offload.c | 3 ++- net/ipv6/ip6_output.c | 18 ++++++++++++------ net/ipv6/ip6_tunnel.c | 9 +++++---- net/ipv6/ip6mr.c | 2 +- net/ipv6/sit.c | 9 +++++---- net/ipv6/udp_offload.c | 2 +- 8 files changed, 47 insertions(+), 32 deletions(-)
diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c index a349d47..5c2e0da 100644 --- a/net/ipv6/esp6_offload.c +++ b/net/ipv6/esp6_offload.c @@ -228,8 +228,8 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb, struct xfrm_state *x; struct ip_esp_hdr *esph; struct crypto_aead *aead; - netdev_features_t esp_features = features; struct xfrm_offload *xo = xfrm_offload(skb); + netdev_features_t esp_features; struct sec_path *sp;
if (!xo) @@ -253,12 +253,14 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
- if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) - esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | - NETIF_F_SCTP_CRC); - else if (!(features & NETIF_F_HW_ESP_TX_CSUM)) - esp_features = features & ~(NETIF_F_CSUM_MASK | - NETIF_F_SCTP_CRC); + netdev_feature_copy(&esp_features, features); + if (!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features) || + x->xso.dev != skb->dev) + netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_CSUM_MASK | + NETIF_F_SCTP_CRC, &esp_features); + else if (!netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, features)) + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_SCTP_CRC, + &esp_features);
xo->flags |= XFRM_GSO_SEGMENT;
@@ -298,7 +300,8 @@ static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features if (!xo) return -EINVAL;
- if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) { + if (!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features) || + x->xso.dev != skb->dev) { xo->flags |= CRYPTO_FALLBACK; hw_offload = false; } diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 3ad201d..336ddf0 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -385,7 +385,7 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
/* Can use a lockless transmit, unless we generate output sequences */ if (!(nt->parms.o_flags & TUNNEL_SEQ)) - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features);
ip6gre_tunnel_link(ign, nt); return nt; @@ -1439,8 +1439,8 @@ static void ip6gre_tnl_init_features(struct net_device *dev) { struct ip6_tnl *nt = netdev_priv(dev);
- dev->features |= GRE6_FEATURES; - dev->hw_features |= GRE6_FEATURES; + netdev_feature_set_bits(GRE6_FEATURES, &dev->features); + netdev_feature_set_bits(GRE6_FEATURES, &dev->hw_features);
if (!(nt->parms.o_flags & TUNNEL_SEQ)) { /* TCP offload with GRE SEQ is not supported, nor @@ -1449,14 +1449,16 @@ static void ip6gre_tnl_init_features(struct net_device *dev) */ if (!(nt->parms.o_flags & TUNNEL_CSUM) || nt->encap.type == TUNNEL_ENCAP_NONE) { - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &dev->hw_features); }
/* Can use a lockless transmit, unless we generate * output sequences */ - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); } }
@@ -1598,7 +1600,8 @@ static int __net_init ip6gre_init_net(struct net *net) /* FB netdevice is special: we have one, and only one per netns. * Allowing to move it to another netns is clearly unsafe. */ - ign->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, + &ign->fb_tunnel_dev->features);
ip6gre_fb_tunnel_init(ign->fb_tunnel_dev); diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 1b9827f..4c3ba4b 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -93,7 +93,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap) - features &= skb->dev->hw_enc_features; + netdev_feature_and(&features, features, + skb->dev->hw_enc_features); SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h);
ipv6h = ipv6_hdr(skb); diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 46a0867..78e01d4 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -147,7 +147,8 @@ ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk, * egress MTU. */ netif_skb_features(skb, &features); - segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); return -ENOMEM; @@ -1512,7 +1513,8 @@ static int __ip6_append_data(struct sock *sk, headersize == sizeof(struct ipv6hdr) && length <= mtu - headersize && (!(flags & MSG_MORE) || cork->gso_size) && - rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) + netdev_feature_test_bits(NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM, + rt->dst.dev->features)) csummode = CHECKSUM_PARTIAL;
if (flags & MSG_ZEROCOPY && length && sock_flag(sk, SOCK_ZEROCOPY)) { @@ -1520,7 +1522,8 @@ static int __ip6_append_data(struct sock *sk, if (!uarg) return -ENOBUFS; extra_uref = !skb_zcopy(skb); /* only ref on new uarg */ - if (rt->dst.dev->features & NETIF_F_SG && + if (netdev_feature_test_bit(NETIF_F_SG_BIT, + rt->dst.dev->features) && csummode == CHECKSUM_PARTIAL) { paged = true; } else { @@ -1598,11 +1601,13 @@ static int __ip6_append_data(struct sock *sk, alloc_extra += sizeof(struct frag_hdr);
if ((flags & MSG_MORE) && - !(rt->dst.dev->features&NETIF_F_SG)) + !netdev_feature_test_bit(NETIF_F_SG_BIT, + rt->dst.dev->features)) alloclen = mtu; else if (!paged && (fraglen + alloc_extra < SKB_MAX_ALLOC || - !(rt->dst.dev->features & NETIF_F_SG))) + !netdev_feature_test_bit(NETIF_F_SG_BIT, + rt->dst.dev->features))) alloclen = fraglen; else { alloclen = min_t(int, fraglen, MAX_HEADER); @@ -1705,7 +1710,8 @@ static int __ip6_append_data(struct sock *sk, if (copy > length) copy = length;
- if (!(rt->dst.dev->features&NETIF_F_SG) && + if (!netdev_feature_test_bit(NETIF_F_SG_BIT, + rt->dst.dev->features) && skb_tailroom(skb) >= copy) { unsigned int off;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 20a67ef..72add9a 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1833,11 +1833,11 @@ static void ip6_tnl_dev_setup(struct net_device *dev) dev->type = ARPHRD_TUNNEL6; dev->flags |= IFF_NOARP; dev->addr_len = sizeof(struct in6_addr); - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); netif_keep_dst(dev);
- dev->features |= IPXIPX_FEATURES; - dev->hw_features |= IPXIPX_FEATURES; + netdev_feature_set_bits(IPXIPX_FEATURES, &dev->features); + netdev_feature_set_bits(IPXIPX_FEATURES, &dev->hw_features);
/* This perm addr will be used as interface identifier by IPv6 */ dev->addr_assign_type = NET_ADDR_RANDOM; @@ -2279,7 +2279,8 @@ static int __net_init ip6_tnl_init_net(struct net *net) /* FB netdevice is special: we have one, and only one per netns. * Allowing to move it to another netns is clearly unsafe. */ - ip6n->fb_tnl_dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bits(NETIF_F_NETNS_LOCAL_BIT, + &ip6n->fb_tnl_dev->features);
err = ip6_fb_tnl_dev_init(ip6n->fb_tnl_dev); if (err < 0) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 36ed9ef..daf2a4b 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -636,7 +636,7 @@ static void reg_vif_setup(struct net_device *dev) dev->flags = IFF_NOARP; dev->netdev_ops = ®_vif_netdev_ops; dev->needs_free_netdev = true; - dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); }
static struct net_device *ip6mr_reg_vif(struct net *net, struct mr_table *mrt) diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index ef0c7a7..58aa232 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1438,9 +1438,9 @@ static void ipip6_tunnel_setup(struct net_device *dev) dev->flags = IFF_NOARP; netif_keep_dst(dev); dev->addr_len = 4; - dev->features |= NETIF_F_LLTX; - dev->features |= SIT_FEATURES; - dev->hw_features |= SIT_FEATURES; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bits(SIT_FEATURES, &dev->features); + netdev_feature_set_bits(SIT_FEATURES, &dev->hw_features); }
static int ipip6_tunnel_init(struct net_device *dev) @@ -1918,7 +1918,8 @@ static int __net_init sit_init_net(struct net *net) /* FB netdevice is special: we have one, and only one per netns. * Allowing to move it to another netns is clearly unsafe. */ - sitn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, + &sitn->fb_tunnel_dev->features);
err = register_netdev(sitn->fb_tunnel_dev); if (err) diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index b3d9ed9..5911c60 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -69,7 +69,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, * software prior to segmenting the frame. */ if (!skb->encap_hdr_csum) - features |= NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features);
/* Check if there is enough headroom to insert fragment header. */ tnl_hlen = skb_tnl_header_len(skb);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/hsr/hsr_device.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 7e6dd37..b7ba16b 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -183,7 +183,7 @@ static void hsr_features_recompute(struct hsr_priv *hsr, netdev_features_t mask; struct hsr_port *port;
- mask = *features; + netdev_feature_copy(&mask, *features);
/* Mask out all features that, if supported by one device, should be * enabled for all devices (see NETIF_F_ONE_FOR_ALL). @@ -192,7 +192,7 @@ static void hsr_features_recompute(struct hsr_priv *hsr, * that were in features originally, and also is in NETIF_F_ONE_FOR_ALL, * may become enabled. */ - *features &= ~NETIF_F_ONE_FOR_ALL; + netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); hsr_for_each_port(hsr, port) netdev_increment_features(features, *features, port->dev->features, mask); @@ -445,22 +445,25 @@ void hsr_dev_setup(struct net_device *dev)
dev->needs_free_netdev = true;
- dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | - NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | + NETIF_F_HIGHDMA | + NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features);
- dev->features = dev->hw_features; + netdev_feature_copy(&dev->features, dev->hw_features);
/* Prevent recursive tx locking */ - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + /* VLAN on top of HSR needs testing and probably some work on * hsr_header_create() etc. */ - dev->features |= NETIF_F_VLAN_CHALLENGED; + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &dev->features); /* Not sure about this. Taken from bridge code. netdev_features.h says * it means "Does not change network namespaces". */ - dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); }
/* Return true if dev is a HSR master; return false otherwise.
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/nsh/nsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c index e9ca007..a337412 100644 --- a/net/nsh/nsh.c +++ b/net/nsh/nsh.c @@ -104,7 +104,7 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, skb->mac_len = proto == htons(ETH_P_TEB) ? ETH_HLEN : 0; skb->protocol = proto;
- features &= NETIF_F_SG; + netdev_feature_clear_bit(NETIF_F_SG_BIT, &features); segs = skb_mac_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { skb_gso_error_unwind(skb, htons(ETH_P_NSH), nsh_len,
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
net/nsh/nsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c index e9ca007..a337412 100644 --- a/net/nsh/nsh.c +++ b/net/nsh/nsh.c @@ -104,7 +104,7 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, skb->mac_len = proto == htons(ETH_P_TEB) ? ETH_HLEN : 0; skb->protocol = proto;
- features &= NETIF_F_SG;
- netdev_feature_clear_bit(NETIF_F_SG_BIT, &features);
it should be "netdev_feature_and_bits(NETIF_F_SG, &features)", will fix it in next version
segs = skb_mac_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { skb_gso_error_unwind(skb, htons(ETH_P_NSH), nsh_len,
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/vxlan.c | 21 ++++++++++++--------- include/net/vxlan.h | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 5a8df5a..e5f7235 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3294,15 +3294,18 @@ static void vxlan_setup(struct net_device *dev) dev->needs_free_netdev = true; SET_NETDEV_DEVTYPE(dev, &vxlan_type);
- dev->features |= NETIF_F_LLTX; - dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST; - dev->features |= NETIF_F_RXCSUM; - dev->features |= NETIF_F_GSO_SOFTWARE; - - dev->vlan_features = dev->features; - dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST; - dev->hw_features |= NETIF_F_RXCSUM; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, + &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + + netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, + &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + netif_keep_dst(dev); dev->priv_flags |= IFF_NO_QUEUE;
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index a801e59..dba14ed 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -322,8 +322,8 @@ static inline void vxlan_features_check(struct sk_buff *skb, sizeof(struct udphdr) + sizeof(struct vxlanhdr)) || (skb->ip_summed != CHECKSUM_NONE && !can_checksum_protocol(*features, inner_eth_hdr(skb)->h_proto)))) - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); - + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
/* IP header + UDP + VXLAN + Ethernet header */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/xen-netback/interface.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index f964f0a..8acfc1f 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c @@ -380,15 +380,15 @@ static void xenvif_fix_features(struct net_device *dev, struct xenvif *vif = netdev_priv(dev);
if (!vif->can_sg) - *features &= ~NETIF_F_SG; + netdev_feature_clear_bit(NETIF_F_SG_BIT, features); if (~(vif->gso_mask) & GSO_BIT(TCPV4)) - *features &= ~NETIF_F_TSO; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); if (~(vif->gso_mask) & GSO_BIT(TCPV6)) - *features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features); if (!vif->ip_csum) - *features &= ~NETIF_F_IP_CSUM; + netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, features); if (!vif->ipv6_csum) - *features &= ~NETIF_F_IPV6_CSUM; + netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, features); }
static const struct xenvif_stat { @@ -532,10 +532,13 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, INIT_LIST_HEAD(&vif->fe_mcast_addr);
dev->netdev_ops = &xenvif_netdev_ops; - dev->hw_features = NETIF_F_SG | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_FRAGLIST; - dev->features = dev->hw_features | NETIF_F_RXCSUM; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_FRAGLIST, + &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); dev->ethtool_ops = &xenvif_ethtool_ops;
dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/xen-netfront.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index e40de65..53408f7 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -240,7 +240,7 @@ static const struct attribute_group xennet_dev_group;
static bool xennet_can_sg(struct net_device *dev) { - return dev->features & NETIF_F_SG; + return netdev_feature_test_bit(NETIF_F_SG_BIT, dev->features); }
@@ -1345,28 +1345,29 @@ static void xennet_fix_features(struct net_device *dev, { struct netfront_info *np = netdev_priv(dev);
- if (*features & NETIF_F_SG && + if (netdev_feature_test_bit(NETIF_F_SG_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0)) - *features &= ~NETIF_F_SG; + netdev_feature_clear_bit(NETIF_F_SG_BIT, features);
- if (*features & NETIF_F_IPV6_CSUM && + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-ipv6-csum-offload", 0)) - *features &= ~NETIF_F_IPV6_CSUM; + netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, features);
- if (*features & NETIF_F_TSO && + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0)) - *features &= ~NETIF_F_TSO; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
- if (*features & NETIF_F_TSO6 && + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0)) - *features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features); }
static int xennet_set_features(struct net_device *dev, netdev_features_t features) { - if (!(features & NETIF_F_SG) && dev->mtu > ETH_DATA_LEN) { + if (!netdev_feature_test_bit(NETIF_F_SG_BIT, features) && + dev->mtu > ETH_DATA_LEN) { netdev_info(dev, "Reducing MTU because no SG offload"); dev->mtu = ETH_DATA_LEN; } @@ -1543,19 +1544,21 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
netdev->netdev_ops = &xennet_netdev_ops;
- netdev->features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | - NETIF_F_GSO_ROBUST; - netdev->hw_features = NETIF_F_SG | - NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6; - + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | + NETIF_F_GSO_ROBUST, &netdev->features); + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6, &netdev->features); /* * Assume that all hw features are available for now. This set * will be adjusted by the call to netdev_update_features() in * xennet_connect() which is the earliest point where we can * negotiate with the backend regarding supported features. */ - netdev->features |= netdev->hw_features; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features);
netdev->ethtool_ops = &xennet_ethtool_ops; netdev->min_mtu = ETH_MIN_MTU;
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/xen-netfront.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index e40de65..53408f7 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -240,7 +240,7 @@ static const struct attribute_group xennet_dev_group;
static bool xennet_can_sg(struct net_device *dev) {
- return dev->features & NETIF_F_SG;
- return netdev_feature_test_bit(NETIF_F_SG_BIT, dev->features); }
@@ -1345,28 +1345,29 @@ static void xennet_fix_features(struct net_device *dev, { struct netfront_info *np = netdev_priv(dev);
- if (*features & NETIF_F_SG &&
- if (netdev_feature_test_bit(NETIF_F_SG_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0))
*features &= ~NETIF_F_SG;
netdev_feature_clear_bit(NETIF_F_SG_BIT, features);
- if (*features & NETIF_F_IPV6_CSUM &&
- if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-ipv6-csum-offload", 0))
*features &= ~NETIF_F_IPV6_CSUM;
netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, features);
- if (*features & NETIF_F_TSO &&
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0))
*features &= ~NETIF_F_TSO;
netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
- if (*features & NETIF_F_TSO6 &&
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0))
*features &= ~NETIF_F_TSO6;
netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features);
}
static int xennet_set_features(struct net_device *dev, netdev_features_t features) {
- if (!(features & NETIF_F_SG) && dev->mtu > ETH_DATA_LEN) {
- if (!netdev_feature_test_bit(NETIF_F_SG_BIT, features) &&
netdev_info(dev, "Reducing MTU because no SG offload"); dev->mtu = ETH_DATA_LEN; }dev->mtu > ETH_DATA_LEN) {
@@ -1543,19 +1544,21 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
netdev->netdev_ops = &xennet_netdev_ops;
- netdev->features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_GSO_ROBUST;
- netdev->hw_features = NETIF_F_SG |
NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO6;
- netdev_feature_zero(&netdev->features);
- netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_GSO_ROBUST, &netdev->features);
- netdev_feature_zero(&netdev->hw_features);
- netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO6, &netdev->features);
it should be netdev->hw_features, not netdev->features, will fix it in next version
/* * Assume that all hw features are available for now. This set * will be adjusted by the call to netdev_update_features() in * xennet_connect() which is the earliest point where we can * negotiate with the backend regarding supported features. */
- netdev->features |= netdev->hw_features;
netdev_feature_or(&netdev->features, netdev->features,
netdev->hw_features);
netdev->ethtool_ops = &xennet_ethtool_ops; netdev->min_mtu = ETH_MIN_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/net/sock.h | 7 ++++--- net/core/skmsg.c | 3 ++- net/core/sock.c | 17 +++++++++++------ net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 10 ++++++---- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/af_inet6.c | 2 +- net/ipv6/inet6_connection_sock.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- 9 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h index 6e76145..01f38c5 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2061,8 +2061,8 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) { - sk->sk_route_nocaps |= flags; - sk->sk_route_caps &= ~flags; + netdev_feature_or(&sk->sk_route_nocaps, sk->sk_route_nocaps, flags); + netdev_feature_andnot(&sk->sk_route_caps, sk->sk_route_caps, flags); }
static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, @@ -2074,7 +2074,8 @@ static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, if (!csum_and_copy_from_iter_full(to, copy, &csum, from)) return -EFAULT; skb->csum = csum_block_add(skb->csum, csum, offset); - } else if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { + } else if (netdev_feature_test_bit(NETIF_F_NOCACHE_COPY_BIT, + sk->sk_route_caps)) { if (!copy_from_iter_full_nocache(to, copy, from)) return -EFAULT; } else if (!copy_from_iter_full(to, copy, from)) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 2d6249b..2ff4a64 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -379,7 +379,8 @@ int sk_msg_memcopy_from_iter(struct sock *sk, struct iov_iter *from, copy = (buf_size > bytes) ? bytes : buf_size; to = sg_virt(sge) + msg->sg.copybreak; msg->sg.copybreak += copy; - if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) + if (netdev_feature_test_bit(NETIF_F_NOCACHE_COPY_BIT, + sk->sk_route_caps)) ret = copy_from_iter_nocache(to, copy, from); else ret = copy_from_iter(to, copy, from); diff --git a/net/core/sock.c b/net/core/sock.c index aada649..11c04a6 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2146,15 +2146,20 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) u32 max_segs = 1;
sk_dst_set(sk, dst); - sk->sk_route_caps = dst->dev->features | sk->sk_route_forced_caps; - if (sk->sk_route_caps & NETIF_F_GSO) - sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE; - sk->sk_route_caps &= ~sk->sk_route_nocaps; + netdev_feature_or(&sk->sk_route_caps, dst->dev->features, + sk->sk_route_forced_caps); + if (netdev_feature_test_bit(NETIF_F_GSO_BIT, sk->sk_route_caps)) + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, + &sk->sk_route_caps); + netdev_feature_andnot(&sk->sk_route_caps, sk->sk_route_caps, + sk->sk_route_nocaps); if (sk_can_gso(sk)) { if (dst->header_len && !xfrm_dst_offload_ok(dst)) { - sk->sk_route_caps &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, + &sk->sk_route_caps); } else { - sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, + &sk->sk_route_caps); sk->sk_gso_max_size = dst->dev->gso_max_size; max_segs = max_t(u32, dst->dev->gso_max_segs, 1); } diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 2932eba..80c62ed 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1299,7 +1299,7 @@ int inet_sk_rebuild_header(struct sock *sk) err = PTR_ERR(rt);
/* Routing failed... */ - sk->sk_route_caps = 0; + netdev_feature_zero(&sk->sk_route_caps); /* * Other protocols have to map its equivalent state to TCP_SYN_SENT. * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f931def..cdcafd5 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -462,7 +462,8 @@ void tcp_init_sock(struct sock *sk) WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]);
sk_sockets_allocated_inc(sk); - sk->sk_route_forced_caps = NETIF_F_GSO; + netdev_feature_zero(&sk->sk_route_forced_caps); + netdev_feature_set_bit(NETIF_F_GSO_BIT, &sk->sk_route_forced_caps); } EXPORT_SYMBOL(tcp_init_sock);
@@ -1123,7 +1124,7 @@ EXPORT_SYMBOL_GPL(do_tcp_sendpages); int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, size_t size, int flags) { - if (!(sk->sk_route_caps & NETIF_F_SG)) + if (!netdev_feature_test_bit(NETIF_F_SG_BIT, sk->sk_route_caps)) return sock_no_sendpage_locked(sk, page, offset, size, flags);
tcp_rate_check_app_limited(sk); /* is sending application-limited? */ @@ -1183,7 +1184,7 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, if (err) { tcp_set_state(sk, TCP_CLOSE); inet->inet_dport = 0; - sk->sk_route_caps = 0; + netdev_feature_zero(&sk->sk_route_caps); } } flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0; @@ -1222,7 +1223,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) goto out_err; }
- zc = sk->sk_route_caps & NETIF_F_SG; + zc = netdev_feature_test_bit(NETIF_F_SG_BIT, + sk->sk_route_caps); if (!zc) uarg->zerocopy = 0; } diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 2e62e0d..60f9ef0 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -323,7 +323,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) */ tcp_set_state(sk, TCP_CLOSE); ip_rt_put(rt); - sk->sk_route_caps = 0; + netdev_feature_zero(&sk->sk_route_caps); inet->inet_dport = 0; return err; } diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index d92c90d..7b8eb28 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -833,7 +833,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); if (IS_ERR(dst)) { - sk->sk_route_caps = 0; + netdev_feature_zero(&sk->sk_route_caps); sk->sk_err_soft = -PTR_ERR(dst); return PTR_ERR(dst); } diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 5a9f4d7..6d83148 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c @@ -121,7 +121,7 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused dst = inet6_csk_route_socket(sk, &fl6); if (IS_ERR(dst)) { sk->sk_err_soft = -PTR_ERR(dst); - sk->sk_route_caps = 0; + netdev_feature_zero(&sk->sk_route_caps); kfree_skb(skb); return PTR_ERR(dst); } diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 0ce52d4..642d640 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -341,7 +341,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, tcp_set_state(sk, TCP_CLOSE); failure: inet->inet_dport = 0; - sk->sk_route_caps = 0; + netdev_feature_zero(&sk->sk_route_caps); return err; }
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/sunrpc/sunrpc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/sunrpc.h b/net/sunrpc/sunrpc.h index 2f59464..30dd2c8 100644 --- a/net/sunrpc/sunrpc.h +++ b/net/sunrpc/sunrpc.h @@ -44,7 +44,7 @@ static inline int sock_is_loopback(struct sock *sk) rcu_read_lock(); dst = rcu_dereference(sk->sk_dst_cache); if (dst && dst->dev && - (dst->dev->features & NETIF_F_LOOPBACK)) + (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, dst->dev->features))) loopback = 1; rcu_read_unlock(); return loopback;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/loopback.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index a1c77cc..23cad64 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -174,17 +174,15 @@ static void gen_lo_setup(struct net_device *dev, dev->flags = IFF_LOOPBACK; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; netif_keep_dst(dev); - dev->hw_features = NETIF_F_GSO_SOFTWARE; - dev->features = NETIF_F_SG | NETIF_F_FRAGLIST - | NETIF_F_GSO_SOFTWARE - | NETIF_F_HW_CSUM - | NETIF_F_RXCSUM - | NETIF_F_SCTP_CRC - | NETIF_F_HIGHDMA - | NETIF_F_LLTX - | NETIF_F_NETNS_LOCAL - | NETIF_F_VLAN_CHALLENGED - | NETIF_F_LOOPBACK; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | + NETIF_F_GSO_SOFTWARE | NETIF_F_HW_CSUM | + NETIF_F_RXCSUM | NETIF_F_SCTP_CRC | + NETIF_F_HIGHDMA | NETIF_F_LLTX | + NETIF_F_NETNS_LOCAL | NETIF_F_VLAN_CHALLENGED | + NETIF_F_LOOPBACK, &dev->hw_features); dev->ethtool_ops = eth_ops; dev->header_ops = hdr_ops; dev->netdev_ops = dev_ops;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/dummy.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index f82ad74..54ebb63 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -123,12 +123,14 @@ static void dummy_setup(struct net_device *dev) dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; - dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST; - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX; - dev->features |= NETIF_F_GSO_ENCAP_ALL; - dev->hw_features |= dev->features; - dev->hw_enc_features |= dev->features; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | + NETIF_F_LLTX, &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->features); + netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + dev->features); eth_hw_addr_random(dev);
dev->min_mtu = 0;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- net/mac80211/iface.c | 10 +++++++--- net/mac80211/main.c | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 1e5e9fc..784f87a 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1991,13 +1991,17 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ieee80211_setup_sdata(sdata, type);
if (ndev) { + netdev_features_t tmp; + ndev->ieee80211_ptr->use_4addr = params->use_4addr; if (type == NL80211_IFTYPE_STATION) sdata->u.mgd.use_4addr = params->use_4addr;
- ndev->features |= local->hw.netdev_features; - ndev->hw_features |= ndev->features & - MAC80211_SUPPORTED_FEATURES_TX; + netdev_feature_or(&ndev->features, ndev->features, + local->hw.netdev_features); + netdev_feature_copy(&tmp, ndev->features); + netdev_feature_and_bits(MAC80211_SUPPORTED_FEATURES_TX, &tmp); + netdev_feature_or(&ndev->hw_features, ndev->hw_features, tmp);
netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 05f4c3c..9b69e53 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -909,6 +909,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) int channels, max_bitrates; bool supp_ht, supp_vht, supp_he; struct cfg80211_chan_def dflt_chandef = {}; + netdev_features_t tmp;
if (ieee80211_hw_check(hw, QUEUE_CONTROL) && (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE || @@ -958,7 +959,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) }
/* Only HW csum features are currently compatible with mac80211 */ - if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES)) + netdev_feature_copy(&tmp, hw->netdev_features); + netdev_feature_clear_bits(MAC80211_SUPPORTED_FEATURES, &tmp); + if (WARN_ON(!netdev_feature_empty(tmp))) return -EINVAL;
if (hw->max_report_rates == 0)
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ifb.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index e9258a9..91add5a 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -213,11 +213,13 @@ static void ifb_setup(struct net_device *dev) ether_setup(dev); dev->tx_queue_len = TX_Q_LIMIT;
- dev->features |= IFB_FEATURES; - dev->hw_features |= dev->features; - dev->hw_enc_features |= dev->features; - dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX); + netdev_feature_set_bits(IFB_FEATURES, &dev->features); + netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + dev->features); + netdev_feature_set_bits(IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX), + &dev->features);
dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST;
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ifb.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index e9258a9..91add5a 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -213,11 +213,13 @@ static void ifb_setup(struct net_device *dev) ether_setup(dev); dev->tx_queue_len = TX_Q_LIMIT;
- dev->features |= IFB_FEATURES;
- dev->hw_features |= dev->features;
- dev->hw_enc_features |= dev->features;
- dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
- netdev_feature_set_bits(IFB_FEATURES, &dev->features);
- netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features);
- netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features,
dev->features);
- netdev_feature_set_bits(IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX),
&dev->features);
it should be &dev->vlan_features here, will fix it next version
dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/bareudp.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index a7ee0af..30d47c8 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -528,13 +528,15 @@ static void bareudp_setup(struct net_device *dev) dev->netdev_ops = &bareudp_netdev_ops; dev->needs_free_netdev = true; SET_NETDEV_DEVTYPE(dev, &bareudp_type); - dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST; - dev->features |= NETIF_F_RXCSUM; - dev->features |= NETIF_F_LLTX; - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST; - dev->hw_features |= NETIF_F_RXCSUM; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, + &dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, + &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); dev->hard_header_len = 0; dev->addr_len = 0; dev->mtu = ETH_DATA_LEN;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index 30e0a10..ddc55d3 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -639,7 +639,7 @@ static void gtp_link_setup(struct net_device *dev) dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->priv_flags |= IFF_NO_QUEUE; - dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); netif_keep_dst(dev);
dev->needed_headroom = LL_MAX_HEADER + max_gtp_header_len;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/nlmon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c index 5e19a68..66af978 100644 --- a/drivers/net/nlmon.c +++ b/drivers/net/nlmon.c @@ -89,8 +89,9 @@ static void nlmon_setup(struct net_device *dev) dev->ethtool_ops = &nlmon_ethtool_ops; dev->needs_free_netdev = true;
- dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | - NETIF_F_HIGHDMA | NETIF_F_LLTX; + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | + NETIF_F_HIGHDMA | NETIF_F_LLTX, &dev->features); dev->flags = IFF_NOARP;
/* That's rather a softlimit here, which, of course,
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/wireguard/device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c index 551ddaaa..9c58f52 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -271,10 +271,10 @@ static void wg_setup(struct net_device *dev) dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP; dev->priv_flags |= IFF_NO_QUEUE; - dev->features |= NETIF_F_LLTX; - dev->features |= WG_NETDEV_FEATURES; - dev->hw_features |= WG_NETDEV_FEATURES; - dev->hw_enc_features |= WG_NETDEV_FEATURES; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->hw_features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->hw_enc_features); dev->mtu = ETH_DATA_LEN - overhead; dev->max_mtu = round_down(INT_MAX, MESSAGE_PADDING_MULTIPLE) - overhead;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/can/dev/dev.c | 3 ++- drivers/net/can/slcan.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 311d856..45c7d48 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -232,7 +232,8 @@ void can_setup(struct net_device *dev)
/* New-style flags. */ dev->flags = IFF_NOARP; - dev->features = NETIF_F_HW_CSUM; + netdev_feature_zero(&dev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->features); }
/* Allocate and setup space for the CAN network device */ diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index d42ec7d..8af2cf0 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c @@ -450,7 +450,8 @@ static void slc_setup(struct net_device *dev)
/* New-style flags. */ dev->flags = IFF_NOARP; - dev->features = NETIF_F_HW_CSUM; + netdev_feature_zero(&dev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->features); }
/******************************************
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ppp/ppp_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 216a9f4..0c9d0bd 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -1599,7 +1599,7 @@ static void ppp_setup(struct net_device *dev) dev->netdev_ops = &ppp_netdev_ops; SET_NETDEV_DEVTYPE(dev, &ppp_type);
- dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features);
dev->hard_header_len = PPP_HDRLEN; dev->mtu = PPP_MRU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ipa/ipa_modem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index ad4019e..f0ce8d6 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -165,7 +165,8 @@ static void ipa_modem_netdev_setup(struct net_device *netdev) netdev->needed_headroom = sizeof(struct rmnet_map_header); netdev->needed_tailroom = IPA_NETDEV_TAILROOM; netdev->watchdog_timeo = IPA_NETDEV_TIMEOUT * HZ; - netdev->hw_features = NETIF_F_SG; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); }
/** ipa_modem_suspend() - suspend callback
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/fjes/fjes_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 185c8a3..583d21a 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1344,7 +1344,8 @@ static void fjes_netdev_setup(struct net_device *netdev) netdev->mtu = fjes_support_mtu[3]; netdev->min_mtu = fjes_support_mtu[0]; netdev->max_mtu = fjes_support_mtu[3]; - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features); }
static void fjes_irq_watch_task(struct work_struct *work)
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/usb/aqc111.c | 42 +++++++++++++++------------ drivers/net/usb/ax88179_178a.c | 26 +++++++++-------- drivers/net/usb/cdc-phonet.c | 2 +- drivers/net/usb/cdc_mbim.c | 4 ++- drivers/net/usb/lan78xx.c | 34 +++++++++++++--------- drivers/net/usb/r8152.c | 64 ++++++++++++++++++++++++++---------------- drivers/net/usb/smsc75xx.c | 14 +++++---- drivers/net/usb/smsc95xx.c | 18 +++++++----- 8 files changed, 121 insertions(+), 83 deletions(-)
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c index 73b97f4..1363f64 100644 --- a/drivers/net/usb/aqc111.c +++ b/drivers/net/usb/aqc111.c @@ -567,27 +567,28 @@ static int aqc111_set_features(struct net_device *net, { struct usbnet *dev = netdev_priv(net); struct aqc111_data *aqc111_data = dev->driver_priv; - netdev_features_t changed = net->features ^ features; + netdev_features_t changed; u16 reg16 = 0; u8 reg8 = 0;
- if (changed & NETIF_F_IP_CSUM) { + netdev_feature_xor(&changed, net->features, features); + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { aqc111_read_cmd(dev, AQ_ACCESS_MAC, SFR_TXCOE_CTL, 1, 1, ®8); reg8 ^= SFR_TXCOE_TCP | SFR_TXCOE_UDP; aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_TXCOE_CTL, 1, 1, ®8); }
- if (changed & NETIF_F_IPV6_CSUM) { + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, changed)) { aqc111_read_cmd(dev, AQ_ACCESS_MAC, SFR_TXCOE_CTL, 1, 1, ®8); reg8 ^= SFR_TXCOE_TCPV6 | SFR_TXCOE_UDPV6; aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_TXCOE_CTL, 1, 1, ®8); }
- if (changed & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { aqc111_read_cmd(dev, AQ_ACCESS_MAC, SFR_RXCOE_CTL, 1, 1, ®8); - if (features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { aqc111_data->rx_checksum = 1; reg8 &= ~(SFR_RXCOE_IP | SFR_RXCOE_TCP | SFR_RXCOE_UDP | SFR_RXCOE_TCPV6 | SFR_RXCOE_UDPV6); @@ -600,8 +601,9 @@ static int aqc111_set_features(struct net_device *net, aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_RXCOE_CTL, 1, 1, ®8); } - if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { - if (features & NETIF_F_HW_VLAN_CTAG_FILTER) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features)) { u16 i = 0;
for (i = 0; i < 256; i++) { @@ -731,9 +733,10 @@ static int aqc111_bind(struct usbnet *dev, struct usb_interface *intf) if (usb_device_no_sg_constraint(dev->udev)) dev->can_dma_sg = 1;
- dev->net->hw_features |= AQ_SUPPORT_HW_FEATURE; - dev->net->features |= AQ_SUPPORT_FEATURE; - dev->net->vlan_features |= AQ_SUPPORT_VLAN_FEATURE; + netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, &dev->net->hw_features); + netdev_feature_set_bits(AQ_SUPPORT_FEATURE, &dev->net->features); + netdev_feature_set_bits(AQ_SUPPORT_VLAN_FEATURE, + &dev->net->vlan_features);
netif_set_gso_max_size(dev->net, 65535);
@@ -881,17 +884,17 @@ static void aqc111_configure_csum_offload(struct usbnet *dev) { u8 reg8 = 0;
- if (dev->net->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->net->features)) { reg8 |= SFR_RXCOE_IP | SFR_RXCOE_TCP | SFR_RXCOE_UDP | SFR_RXCOE_TCPV6 | SFR_RXCOE_UDPV6; } aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_RXCOE_CTL, 1, 1, ®8);
reg8 = 0; - if (dev->net->features & NETIF_F_IP_CSUM) + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, dev->net->features)) reg8 |= SFR_TXCOE_IP | SFR_TXCOE_TCP | SFR_TXCOE_UDP;
- if (dev->net->features & NETIF_F_IPV6_CSUM) + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, dev->net->features)) reg8 |= SFR_TXCOE_TCPV6 | SFR_TXCOE_UDPV6;
aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_TXCOE_CTL, 1, 1, ®8); @@ -908,7 +911,8 @@ static int aqc111_link_reset(struct usbnet *dev)
/* Vlan Tag Filter */ reg8 = SFR_VLAN_CONTROL_VSO; - if (dev->net->features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + dev->net->features)) reg8 |= SFR_VLAN_CONTROL_VFE;
aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_VLAN_ID_CONTROL, @@ -996,9 +1000,10 @@ static int aqc111_reset(struct usbnet *dev) if (usb_device_no_sg_constraint(dev->udev)) dev->can_dma_sg = 1;
- dev->net->hw_features |= AQ_SUPPORT_HW_FEATURE; - dev->net->features |= AQ_SUPPORT_FEATURE; - dev->net->vlan_features |= AQ_SUPPORT_VLAN_FEATURE; + netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, &dev->net->hw_features); + netdev_feature_set_bits(AQ_SUPPORT_FEATURE, &dev->net->features); + netdev_feature_set_bits(AQ_SUPPORT_VLAN_FEATURE, + &dev->net->vlan_features);
/* Power up ethernet PHY */ aqc111_data->phy_cfg = AQ_PHY_POWER_EN; @@ -1209,7 +1214,8 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb, AQ_TX_DESC_VLAN_SHIFT; }
- if (!dev->can_dma_sg && (dev->net->features & NETIF_F_SG) && + if (!dev->can_dma_sg && + netdev_feature_test_bit(NETIF_F_SG_BIT, dev->net->features) && skb_linearize(skb)) return NULL;
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index f25448a..0099d55f 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -952,21 +952,23 @@ ax88179_set_features(struct net_device *net, netdev_features_t features) { u8 tmp; struct usbnet *dev = netdev_priv(net); - netdev_features_t changed = net->features ^ features; + netdev_features_t changed;
- if (changed & NETIF_F_IP_CSUM) { + netdev_feature_xor(&changed, net->features, features); + + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); tmp ^= AX_TXCOE_TCP | AX_TXCOE_UDP; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); }
- if (changed & NETIF_F_IPV6_CSUM) { + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, changed)) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); tmp ^= AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); }
- if (changed & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_RXCOE_CTL, 1, 1, &tmp); tmp ^= AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; @@ -1377,11 +1379,11 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) dev->mii.phy_id = 0x03; dev->mii.supports_gmii = 1;
- dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, &dev->net->features);
- dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, &dev->net->hw_features);
/* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | @@ -1664,11 +1666,11 @@ static int ax88179_reset(struct usbnet *dev) ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_HIGH, 1, 1, tmp);
- dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, &dev->net->features);
- dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, &dev->net->hw_features);
/* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index e1da910..a65be62 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -275,7 +275,7 @@ static const struct net_device_ops usbpn_ops = {
static void usbpn_setup(struct net_device *dev) { - dev->features = 0; + netdev_feature_zero(&dev->features); dev->netdev_ops = &usbpn_ops; dev->header_ops = &phonet_header_ops; dev->type = ARPHRD_PHONET; diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 4c4ab7b..100fe6c 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c @@ -184,7 +184,9 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) dev->net->flags |= IFF_NOARP;
/* no need to put the VLAN tci in the packet headers */ - dev->net->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &dev->net->features);
/* monitor VLAN additions and removals */ dev->net->netdev_ops = &cdc_mbim_netdev_ops; diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index fe5c0d4..65a9892 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2331,7 +2331,7 @@ static int lan78xx_set_features(struct net_device *netdev,
spin_lock_irqsave(&pdata->rfe_ctl_lock, flags);
- if (features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { pdata->rfe_ctl |= RFE_CTL_TCPUDP_COE_ | RFE_CTL_IP_COE_; pdata->rfe_ctl |= RFE_CTL_ICMP_COE_ | RFE_CTL_IGMP_COE_; } else { @@ -2339,12 +2339,12 @@ static int lan78xx_set_features(struct net_device *netdev, pdata->rfe_ctl &= ~(RFE_CTL_ICMP_COE_ | RFE_CTL_IGMP_COE_); }
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) pdata->rfe_ctl |= RFE_CTL_VLAN_STRIP_; else pdata->rfe_ctl &= ~RFE_CTL_VLAN_STRIP_;
- if (features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) pdata->rfe_ctl |= RFE_CTL_VLAN_FILTER_; else pdata->rfe_ctl &= ~RFE_CTL_VLAN_FILTER_; @@ -2879,24 +2879,28 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
INIT_WORK(&pdata->set_vlan, lan78xx_deferred_vlan_write);
- dev->net->features = 0; + netdev_feature_zero(&dev->net->features);
if (DEFAULT_TX_CSUM_ENABLE) - dev->net->features |= NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, + &dev->net->features);
if (DEFAULT_RX_CSUM_ENABLE) - dev->net->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features);
if (DEFAULT_TSO_CSUM_ENABLE) - dev->net->features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG, + &dev->net->features);
if (DEFAULT_VLAN_RX_OFFLOAD) - dev->net->features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->net->features);
if (DEFAULT_VLAN_FILTER_ENABLE) - dev->net->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &dev->net->features);
- dev->net->hw_features = dev->net->features; + netdev_feature_copy(&dev->net->hw_features, dev->net->features);
ret = lan78xx_setup_irq_domain(dev); if (ret < 0) { @@ -2963,10 +2967,11 @@ static void lan78xx_rx_csum_offload(struct lan78xx_net *dev, /* HW Checksum offload appears to be flawed if used when not stripping * VLAN headers. Drop back to S/W checksums under these conditions. */ - if (!(dev->net->features & NETIF_F_RXCSUM) || + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->net->features) || unlikely(rx_cmd_a & RX_CMD_A_ICSM_) || ((rx_cmd_a & RX_CMD_A_FVTG_) && - !(dev->net->features & NETIF_F_HW_VLAN_CTAG_RX))) { + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->net->features))) { skb->ip_summed = CHECKSUM_NONE; } else { skb->csum = ntohs((u16)(rx_cmd_b >> RX_CMD_B_CSUM_SHIFT_)); @@ -2978,7 +2983,8 @@ static void lan78xx_rx_vlan_offload(struct lan78xx_net *dev, struct sk_buff *skb, u32 rx_cmd_a, u32 rx_cmd_b) { - if ((dev->net->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->net->features) && (rx_cmd_a & RX_CMD_A_FVTG_)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), (rx_cmd_b & 0xffff)); @@ -3593,7 +3599,7 @@ static void lan78xx_features_check(struct sk_buff *skb, netdev_features_t *features) { if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE) - *features &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
vlan_features_check(skb, features); vxlan_features_check(skb, features); diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index e4fa71c..ce74862 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2092,11 +2092,13 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb, struct sk_buff_head *list) { if (skb_shinfo(skb)->gso_size) { - netdev_features_t features = tp->netdev->features; struct sk_buff *segs, *seg, *next; struct sk_buff_head seg_list; + netdev_features_t features;
- features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6); + netdev_feature_copy(&features, tp->netdev->features); + netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_IPV6_CSUM | + NETIF_F_TSO6, &features); segs = skb_gso_segment(skb, features); if (IS_ERR(segs) || !segs) goto drop; @@ -2333,7 +2335,7 @@ static u8 r8152_rx_csum(struct r8152 *tp, struct rx_desc *rx_desc) u8 checksum = CHECKSUM_NONE; u32 opts2, opts3;
- if (!(tp->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, tp->netdev->features)) goto return_result;
opts2 = le32_to_cpu(rx_desc->opts2); @@ -2749,9 +2751,10 @@ static void rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, 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); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); else if ((skb->len + sizeof(struct tx_desc)) > agg_buf_sz) - *features &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); }
static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, @@ -3230,18 +3233,21 @@ static void rtl_rx_vlan_en(struct r8152 *tp, bool enable) static int rtl8152_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = features ^ dev->features; struct r8152 *tp = netdev_priv(dev); + netdev_features_t changed; int ret;
ret = usb_autopm_get_interface(tp->intf); if (ret < 0) goto out;
+ netdev_feature_xor(&changed, dev->features, features); + mutex_lock(&tp->control);
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) rtl_rx_vlan_en(tp, true); else rtl_rx_vlan_en(tp, false); @@ -5388,7 +5394,8 @@ static void r8152b_exit_oob(struct r8152 *tp) ocp_write_dword(tp, MCU_TYPE_USB, USB_TX_DMA, TEST_MODE_DISABLE | TX_SIZE_ADJUST1);
- rtl_rx_vlan_en(tp, tp->netdev->features & NETIF_F_HW_VLAN_CTAG_RX); + rtl_rx_vlan_en(tp, netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + tp->netdev->features));
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8152_RMS);
@@ -5833,7 +5840,8 @@ static void r8153_first_init(struct r8152 *tp)
wait_oob_link_list_ready(tp);
- rtl_rx_vlan_en(tp, tp->netdev->features & NETIF_F_HW_VLAN_CTAG_RX); + rtl_rx_vlan_en(tp, netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + tp->netdev->features));
rtl8153_change_mtu(tp);
@@ -6334,7 +6342,8 @@ static void rtl8153c_up(struct r8152 *tp)
wait_oob_link_list_ready(tp);
- rtl_rx_vlan_en(tp, tp->netdev->features & NETIF_F_HW_VLAN_CTAG_RX); + rtl_rx_vlan_en(tp, netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + tp->netdev->features));
rtl8153c_change_mtu(tp);
@@ -6439,7 +6448,8 @@ static void rtl8156_up(struct r8152 *tp) ocp_data &= ~MCU_BORW_EN; ocp_write_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7, ocp_data);
- rtl_rx_vlan_en(tp, tp->netdev->features & NETIF_F_HW_VLAN_CTAG_RX); + rtl_rx_vlan_en(tp, netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + tp->netdev->features));
rtl8156_change_mtu(tp);
@@ -9548,21 +9558,27 @@ static int rtl8152_probe(struct usb_interface *intf, netdev->netdev_ops = &rtl8152_netdev_ops; netdev->watchdog_timeo = RTL8152_TX_TIMEOUT;
- netdev->features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_FRAGLIST | NETIF_F_IPV6_CSUM | - NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; - netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_FRAGLIST | - NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX; - netdev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_FRAGLIST | + NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, &netdev->features); + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_FRAGLIST | + NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, &netdev->hw_features); + netdev_feature_zero(&netdev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | - NETIF_F_IPV6_CSUM | NETIF_F_TSO6; + NETIF_F_IPV6_CSUM | NETIF_F_TSO6, + &netdev->vlan_features);
if (tp->version == RTL_VER_01) { - netdev->features &= ~NETIF_F_RXCSUM; - netdev->hw_features &= ~NETIF_F_RXCSUM; + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, + &netdev->hw_features); }
if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO) { diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 76f7af1..87ad300 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -942,7 +942,7 @@ static int smsc75xx_set_features(struct net_device *netdev,
spin_lock_irqsave(&pdata->rfe_ctl_lock, flags);
- if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) pdata->rfe_ctl |= RFE_CTL_TCPUDP_CKM | RFE_CTL_IP_CKM; else pdata->rfe_ctl &= ~(RFE_CTL_TCPUDP_CKM | RFE_CTL_IP_CKM); @@ -1472,13 +1472,15 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write);
if (DEFAULT_TX_CSUM_ENABLE) - dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &dev->net->features);
if (DEFAULT_RX_CSUM_ENABLE) - dev->net->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features);
- dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, + &dev->net->hw_features);
ret = smsc75xx_wait_ready(dev, 0); if (ret < 0) { @@ -2167,7 +2169,7 @@ static int smsc75xx_resume(struct usb_interface *intf) static void smsc75xx_rx_csum_offload(struct usbnet *dev, struct sk_buff *skb, u32 rx_cmd_a, u32 rx_cmd_b) { - if (!(dev->net->features & NETIF_F_RXCSUM) || + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->net->features) || unlikely(rx_cmd_a & RX_CMD_A_LCSM)) { skb->ip_summed = CHECKSUM_NONE; } else { diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 7d95397..d6c5293 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -615,12 +615,12 @@ static int smsc95xx_set_features(struct net_device *netdev, if (ret < 0) return ret;
- if (features & NETIF_F_IP_CSUM) + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features)) read_buf |= Tx_COE_EN_; else read_buf &= ~Tx_COE_EN_;
- if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) read_buf |= Rx_COE_EN_; else read_buf &= ~Rx_COE_EN_; @@ -1080,11 +1080,13 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) * for ipv4 packets. */ if (DEFAULT_TX_CSUM_ENABLE) - dev->net->features |= NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, + &dev->net->features); if (DEFAULT_RX_CSUM_ENABLE) - dev->net->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features);
- dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, + &dev->net->hw_features); set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
smsc95xx_init_mac_address(dev); @@ -1824,7 +1826,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
/* last frame in this batch */ if (skb->len == size) { - if (dev->net->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->net->features)) smsc95xx_rx_csum_offload(skb); skb_trim(skb, skb->len - 4); /* remove fcs */ skb->truesize = size + sizeof(struct sk_buff); @@ -1842,7 +1845,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ax_skb->data = packet; skb_set_tail_pointer(ax_skb, size);
- if (dev->net->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->net->features)) smsc95xx_rx_csum_offload(ax_skb); skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ ax_skb->truesize = size + sizeof(struct sk_buff);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/wireless/ath/ath10k/mac.c | 7 +++++-- drivers/net/wireless/ath/ath11k/mac.c | 4 +++- drivers/net/wireless/ath/ath6kl/main.c | 15 ++++++++++----- drivers/net/wireless/ath/ath6kl/txrx.c | 6 ++++-- drivers/net/wireless/ath/wil6210/netdev.c | 11 +++++++---- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 4 ++-- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 7 +++++-- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +++++++++++------ drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 3 ++- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 8 ++++++-- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 3 ++- net/wireless/core.c | 15 ++++++++++----- 15 files changed, 72 insertions(+), 36 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c272b29..493d15f 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -10119,8 +10119,11 @@ int ath10k_mac_register(struct ath10k *ar) if (ar->hw_params.dynamic_sar_support) ar->hw->wiphy->sar_capa = &ath10k_sar_capa;
- if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) - ar->hw->netdev_features = NETIF_F_HW_CSUM; + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { + netdev_feature_zero(&ar->hw->netdev_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, + &ar->hw->netdev_features); + }
if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { /* Init ath dfs pattern detector */ diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index e9b3689..ba892c4 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6570,7 +6570,9 @@ static int __ath11k_mac_register(struct ath11k *ar) ath11k_reg_init(ar);
if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { - ar->hw->netdev_features = NETIF_F_HW_CSUM; + netdev_feature_zero(&ar->hw->netdev_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, + &ar->hw->netdev_features); ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); } diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index d3aa9e7..2b15df2 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c @@ -1126,24 +1126,28 @@ static int ath6kl_set_features(struct net_device *dev, struct ath6kl *ar = vif->ar; int err = 0;
- if ((features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && (ar->rx_meta_ver != WMI_META_VERSION_2)) { ar->rx_meta_ver = WMI_META_VERSION_2; err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) { - dev->features = features & ~NETIF_F_RXCSUM; + netdev_feature_copy(&dev->features, features); + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, + &dev->features); return err; } - } else if (!(features & NETIF_F_RXCSUM) && + } else if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && (ar->rx_meta_ver == WMI_META_VERSION_2)) { ar->rx_meta_ver = 0; err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) { - dev->features = features | NETIF_F_RXCSUM; + netdev_feature_copy(&dev->features, features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &dev->features); return err; } } @@ -1305,7 +1309,8 @@ void init_netdev(struct net_device *dev)
if (!test_bit(ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM, ar->fw_capabilities)) - dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, + &dev->hw_features);
return; } diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c index b22ed49..6c7569c 100644 --- a/drivers/net/wireless/ath/ath6kl/txrx.c +++ b/drivers/net/wireless/ath/ath6kl/txrx.c @@ -391,7 +391,8 @@ netdev_tx_t ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) }
if (test_bit(WMI_ENABLED, &ar->flag)) { - if ((dev->features & NETIF_F_IP_CSUM) && + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, + dev->features) && (csum == CHECKSUM_PARTIAL)) { csum_start = skb->csum_start - (skb_network_header(skb) - skb->head) + @@ -410,7 +411,8 @@ netdev_tx_t ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) goto fail_tx; }
- if ((dev->features & NETIF_F_IP_CSUM) && + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, + dev->features) && (csum == CHECKSUM_PARTIAL)) { meta_v2.csum_start = csum_start; meta_v2.csum_dest = csum_dest; diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c index 0913f0b..b29a4d6 100644 --- a/drivers/net/wireless/ath/wil6210/netdev.c +++ b/drivers/net/wireless/ath/wil6210/netdev.c @@ -335,11 +335,14 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name, ndev->netdev_ops = &wil_netdev_ops; wil_set_ethtoolops(ndev); ndev->ieee80211_ptr = wdev; - ndev->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM | - NETIF_F_SG | NETIF_F_GRO | - NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM | + NETIF_F_SG | NETIF_F_GRO | + NETIF_F_TSO | NETIF_F_TSO6, + &ndev->hw_features); + + netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features);
- ndev->features |= ndev->hw_features; SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); wdev->netdev = ndev; return vif; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index db5f853..d04bff1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -616,9 +616,9 @@ static int brcmf_netdev_open(struct net_device *ndev) /* Get current TOE mode from dongle */ if (brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_ol) >= 0 && (toe_ol & TOE_TX_CSUM_OL) != 0) - ndev->features |= NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); else - ndev->features &= ~NETIF_F_IP_CSUM; + netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, &ndev->features);
if (brcmf_cfg80211_up(ndev)) { bphy_err(drvr, "failed to bring up cfg80211\n"); diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c index 75e7665..81df856 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c @@ -101,8 +101,11 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); ieee80211_hw_set(hw, WANT_MONITOR_VIF);
- if (priv->trans->max_skb_frags) - hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG; + if (priv->trans->max_skb_frags) { + netdev_feature_zero(&hw->netdev_features); + netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG, + &hw->netdev_features); + }
hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE; hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FMT; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 70ebecb..65d0125 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -387,8 +387,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) if (mvm->trans->num_rx_queues > 1) ieee80211_hw_set(hw, USES_RSS);
- if (mvm->trans->max_skb_frags) - hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG; + if (mvm->trans->max_skb_frags) { + netdev_feature_zero(&hw->netdev_features); + netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG, + &hw->netdev_features); + }
hw->queues = IEEE80211_MAX_QUEUES; hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; @@ -703,10 +706,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; }
- hw->netdev_features |= mvm->cfg->features; + netdev_feature_copy(&hw->netdev_features, mvm->cfg->features); if (!iwl_mvm_is_csum_supported(mvm)) - hw->netdev_features &= ~(IWL_TX_CSUM_NETIF_FLAGS | - NETIF_F_RXCSUM); + netdev_feature_clear_bits(IWL_TX_CSUM_NETIF_FLAGS | + NETIF_F_RXCSUM, + &hw->netdev_features);
if (mvm->cfg->vht_mu_mimo_supported) wiphy_ext_feature_set(hw->wiphy, @@ -1451,7 +1455,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, goto out_unlock; }
- mvmvif->features |= hw->netdev_features; + netdev_feature_or(&mvmvif->features, mvmvif->features, + hw->netdev_features);
ret = iwl_mvm_mac_ctxt_add(mvm, vif); if (ret) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index 8ef5399..21d97eb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -276,7 +276,7 @@ static void iwl_mvm_rx_csum(struct ieee80211_sta *sta, struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
- if (mvmvif->features & NETIF_F_RXCSUM && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, mvmvif->features) && status & RX_MPDU_RES_STATUS_CSUM_DONE && status & RX_MPDU_RES_STATUS_CSUM_OK) skb->ip_summed = CHECKSUM_UNNECESSARY; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index c0babb8..91d9355 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -459,7 +459,8 @@ static void iwl_mvm_rx_csum(struct iwl_mvm *mvm,
mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
- if (mvmvif->features & NETIF_F_RXCSUM && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + mvmvif->features) && flags & IWL_RX_L3L4_TCP_UDP_CSUM_OK && (flags & IWL_RX_L3L4_IP_HDR_CSUM_OK || l3_prot == IWL_RX_L3_TYPE_IPV6 || diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index 0a13c2b..c254ab4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -53,7 +53,8 @@ static u16 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb, goto out;
/* We do not expect to be requested to csum stuff we do not support */ - if (WARN_ONCE(!(mvm->hw->netdev_features & IWL_TX_CSUM_NETIF_FLAGS) || + if (WARN_ONCE(!netdev_feature_test_bits(IWL_TX_CSUM_NETIF_FLAGS, + mvm->hw->netdev_features) || (skb->protocol != htons(ETH_P_IP) && skb->protocol != htons(ETH_P_IPV6)), "No support for requested checksum\n")) { @@ -836,9 +837,12 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb, unsigned int mss = skb_shinfo(skb)->gso_size; unsigned int num_subframes, tcp_payload_len, subf_len, max_amsdu_len; u16 snap_ip_tcp, pad; - netdev_features_t netdev_flags = NETIF_F_CSUM_MASK | NETIF_F_SG; + netdev_features_t netdev_flags; u8 tid;
+ netdev_feature_zero(&netdev_flags); + netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_SG, &netdev_flags); + snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) + tcp_hdrlen(skb);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index 2f1ac64..e690e09 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -363,7 +363,8 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) hw->max_rates = 3; hw->max_report_rates = 7; hw->max_rate_tries = 11; - hw->netdev_features = NETIF_F_RXCSUM; + netdev_feature_zero(&hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index 4798d63..a3ab1a5f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -217,7 +217,8 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; - hw->netdev_features = NETIF_F_RXCSUM; + netdev_feature_zero(&hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index a9ce10b..368d6cf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -51,7 +51,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = 64; hw->max_tx_aggregation_subframes = 128; - hw->netdev_features = NETIF_F_RXCSUM; + netdev_feature_zero(&hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/net/wireless/core.c b/net/wireless/core.c index 0332312..5849ebf 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -164,11 +164,13 @@ 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_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT, + &wdev->netdev->features); err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); if (err) break; - wdev->netdev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, + &wdev->netdev->features); }
if (err) { @@ -180,11 +182,13 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, list) { if (!wdev->netdev) continue; - wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL; + netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT, + &wdev->netdev->features); err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); WARN_ON(err); - wdev->netdev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, + &wdev->netdev->features); }
return err; @@ -1384,7 +1388,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, SET_NETDEV_DEVTYPE(dev, &wiphy_type); wdev->netdev = dev; /* can only change netns with wiphy */ - dev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, + &dev->features);
cfg80211_init_wdev(wdev); break;
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/wireless/ath/ath10k/mac.c | 7 +++++-- drivers/net/wireless/ath/ath11k/mac.c | 4 +++- drivers/net/wireless/ath/ath6kl/main.c | 15 ++++++++++----- drivers/net/wireless/ath/ath6kl/txrx.c | 6 ++++-- drivers/net/wireless/ath/wil6210/netdev.c | 11 +++++++---- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 4 ++-- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 7 +++++-- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +++++++++++------ drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 3 ++- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 8 ++++++-- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 3 ++- net/wireless/core.c | 15 ++++++++++----- 15 files changed, 72 insertions(+), 36 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c272b29..493d15f 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -10119,8 +10119,11 @@ int ath10k_mac_register(struct ath10k *ar) if (ar->hw_params.dynamic_sar_support) ar->hw->wiphy->sar_capa = &ath10k_sar_capa;
- if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
ar->hw->netdev_features = NETIF_F_HW_CSUM;
if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) {
netdev_feature_zero(&ar->hw->netdev_features);
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT,
&ar->hw->netdev_features);
}
if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { /* Init ath dfs pattern detector */
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index e9b3689..ba892c4 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6570,7 +6570,9 @@ static int __ath11k_mac_register(struct ath11k *ar) ath11k_reg_init(ar);
if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) {
ar->hw->netdev_features = NETIF_F_HW_CSUM;
netdev_feature_zero(&ar->hw->netdev_features);
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT,
ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); }&ar->hw->netdev_features);
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index d3aa9e7..2b15df2 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c @@ -1126,24 +1126,28 @@ static int ath6kl_set_features(struct net_device *dev, struct ath6kl *ar = vif->ar; int err = 0;
- if ((features & NETIF_F_RXCSUM) &&
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && (ar->rx_meta_ver != WMI_META_VERSION_2)) { ar->rx_meta_ver = WMI_META_VERSION_2; err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) {
dev->features = features & ~NETIF_F_RXCSUM;
netdev_feature_copy(&dev->features, features);
netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT,
}&dev->features); return err;
- } else if (!(features & NETIF_F_RXCSUM) &&
- } else if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && (ar->rx_meta_ver == WMI_META_VERSION_2)) { ar->rx_meta_ver = 0; err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) {
dev->features = features | NETIF_F_RXCSUM;
netdev_feature_copy(&dev->features, features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT,
} }&dev->features); return err;
@@ -1305,7 +1309,8 @@ void init_netdev(struct net_device *dev)
if (!test_bit(ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM, ar->fw_capabilities))
dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
netdev_feature_set_bit(NETIF_F_IP_CSUM | NETIF_F_RXCSUM,
&dev->hw_features);
it should be "netdev_feature_set_bits", not "netdev_feature_set_bit", will fix it next version
return; } diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c index b22ed49..6c7569c 100644 --- a/drivers/net/wireless/ath/ath6kl/txrx.c +++ b/drivers/net/wireless/ath/ath6kl/txrx.c @@ -391,7 +391,8 @@ netdev_tx_t ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) }
if (test_bit(WMI_ENABLED, &ar->flag)) {
if ((dev->features & NETIF_F_IP_CSUM) &&
if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT,
(csum == CHECKSUM_PARTIAL)) { csum_start = skb->csum_start - (skb_network_header(skb) - skb->head) +dev->features) &&
@@ -410,7 +411,8 @@ netdev_tx_t ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) goto fail_tx; }
if ((dev->features & NETIF_F_IP_CSUM) &&
if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT,
(csum == CHECKSUM_PARTIAL)) { meta_v2.csum_start = csum_start; meta_v2.csum_dest = csum_dest;dev->features) &&
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c index 0913f0b..b29a4d6 100644 --- a/drivers/net/wireless/ath/wil6210/netdev.c +++ b/drivers/net/wireless/ath/wil6210/netdev.c @@ -335,11 +335,14 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name, ndev->netdev_ops = &wil_netdev_ops; wil_set_ethtoolops(ndev); ndev->ieee80211_ptr = wdev;
- ndev->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
NETIF_F_SG | NETIF_F_GRO |
NETIF_F_TSO | NETIF_F_TSO6;
- netdev_feature_zero(&ndev->hw_features);
- netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
NETIF_F_SG | NETIF_F_GRO |
NETIF_F_TSO | NETIF_F_TSO6,
&ndev->hw_features);
- netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features);
- ndev->features |= ndev->hw_features; SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); wdev->netdev = ndev; return vif;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index db5f853..d04bff1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -616,9 +616,9 @@ static int brcmf_netdev_open(struct net_device *ndev) /* Get current TOE mode from dongle */ if (brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_ol) >= 0 && (toe_ol & TOE_TX_CSUM_OL) != 0)
ndev->features |= NETIF_F_IP_CSUM;
elsenetdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features);
ndev->features &= ~NETIF_F_IP_CSUM;
netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, &ndev->features);
if (brcmf_cfg80211_up(ndev)) { bphy_err(drvr, "failed to bring up cfg80211\n");
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c index 75e7665..81df856 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c @@ -101,8 +101,11 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); ieee80211_hw_set(hw, WANT_MONITOR_VIF);
- if (priv->trans->max_skb_frags)
hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
if (priv->trans->max_skb_frags) {
netdev_feature_zero(&hw->netdev_features);
netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG,
&hw->netdev_features);
}
hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE; hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FMT;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 70ebecb..65d0125 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -387,8 +387,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) if (mvm->trans->num_rx_queues > 1) ieee80211_hw_set(hw, USES_RSS);
- if (mvm->trans->max_skb_frags)
hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
if (mvm->trans->max_skb_frags) {
netdev_feature_zero(&hw->netdev_features);
netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG,
&hw->netdev_features);
}
hw->queues = IEEE80211_MAX_QUEUES; hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
@@ -703,10 +706,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; }
- hw->netdev_features |= mvm->cfg->features;
- netdev_feature_copy(&hw->netdev_features, mvm->cfg->features); if (!iwl_mvm_is_csum_supported(mvm))
hw->netdev_features &= ~(IWL_TX_CSUM_NETIF_FLAGS |
NETIF_F_RXCSUM);
netdev_feature_clear_bits(IWL_TX_CSUM_NETIF_FLAGS |
NETIF_F_RXCSUM,
&hw->netdev_features);
if (mvm->cfg->vht_mu_mimo_supported) wiphy_ext_feature_set(hw->wiphy,
@@ -1451,7 +1455,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, goto out_unlock; }
- mvmvif->features |= hw->netdev_features;
netdev_feature_or(&mvmvif->features, mvmvif->features,
hw->netdev_features);
ret = iwl_mvm_mac_ctxt_add(mvm, vif); if (ret)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index 8ef5399..21d97eb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -276,7 +276,7 @@ static void iwl_mvm_rx_csum(struct ieee80211_sta *sta, struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
- if (mvmvif->features & NETIF_F_RXCSUM &&
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, mvmvif->features) && status & RX_MPDU_RES_STATUS_CSUM_DONE && status & RX_MPDU_RES_STATUS_CSUM_OK) skb->ip_summed = CHECKSUM_UNNECESSARY;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index c0babb8..91d9355 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -459,7 +459,8 @@ static void iwl_mvm_rx_csum(struct iwl_mvm *mvm,
mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
if (mvmvif->features & NETIF_F_RXCSUM &&
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
flags & IWL_RX_L3L4_TCP_UDP_CSUM_OK && (flags & IWL_RX_L3L4_IP_HDR_CSUM_OK || l3_prot == IWL_RX_L3_TYPE_IPV6 ||mvmvif->features) &&
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index 0a13c2b..c254ab4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -53,7 +53,8 @@ static u16 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb, goto out;
/* We do not expect to be requested to csum stuff we do not support */
- if (WARN_ONCE(!(mvm->hw->netdev_features & IWL_TX_CSUM_NETIF_FLAGS) ||
- if (WARN_ONCE(!netdev_feature_test_bits(IWL_TX_CSUM_NETIF_FLAGS,
mvm->hw->netdev_features) || (skb->protocol != htons(ETH_P_IP) && skb->protocol != htons(ETH_P_IPV6)), "No support for requested checksum\n")) {
@@ -836,9 +837,12 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb, unsigned int mss = skb_shinfo(skb)->gso_size; unsigned int num_subframes, tcp_payload_len, subf_len, max_amsdu_len; u16 snap_ip_tcp, pad;
- netdev_features_t netdev_flags = NETIF_F_CSUM_MASK | NETIF_F_SG;
netdev_features_t netdev_flags; u8 tid;
netdev_feature_zero(&netdev_flags);
netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_SG, &netdev_flags);
snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) + tcp_hdrlen(skb);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index 2f1ac64..e690e09 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -363,7 +363,8 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) hw->max_rates = 3; hw->max_report_rates = 7; hw->max_rate_tries = 11;
- hw->netdev_features = NETIF_F_RXCSUM;
netdev_feature_zero(&hw->netdev_features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index 4798d63..a3ab1a5f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -217,7 +217,8 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF;
- hw->netdev_features = NETIF_F_RXCSUM;
netdev_feature_zero(&hw->netdev_features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index a9ce10b..368d6cf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -51,7 +51,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = 64; hw->max_tx_aggregation_subframes = 128;
- hw->netdev_features = NETIF_F_RXCSUM;
netdev_feature_zero(&hw->netdev_features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
diff --git a/net/wireless/core.c b/net/wireless/core.c index 0332312..5849ebf 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -164,11 +164,13 @@ 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_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT,
err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); if (err) break;&wdev->netdev->features);
wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT,
&wdev->netdev->features);
}
if (err) {
@@ -180,11 +182,13 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, list) { if (!wdev->netdev) continue;
wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL;
netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT,
&wdev->netdev->features); err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); WARN_ON(err);
wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT,
&wdev->netdev->features);
}
return err;
@@ -1384,7 +1388,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, SET_NETDEV_DEVTYPE(dev, &wiphy_type); wdev->netdev = dev; /* can only change netns with wiphy */
dev->features |= NETIF_F_NETNS_LOCAL;
netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT,
&dev->features);
cfg80211_init_wdev(wdev); break;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/realtek/8139cp.c | 29 +++++++------- drivers/net/ethernet/realtek/8139too.c | 28 +++++++------ drivers/net/ethernet/realtek/r8169_main.c | 65 ++++++++++++++++++------------- 3 files changed, 72 insertions(+), 50 deletions(-)
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index dc06c3e..626b3f2 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -1461,17 +1461,18 @@ static int cp_set_features(struct net_device *dev, netdev_features_t features) struct cp_private *cp = netdev_priv(dev); unsigned long flags;
- if (!((dev->features ^ features) & NETIF_F_RXCSUM)) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features) != + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) return 0;
spin_lock_irqsave(&cp->lock, flags);
- if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) cp->cpcmd |= RxChkSum; else cp->cpcmd &= ~RxChkSum;
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) cp->cpcmd |= RxVlanOn; else cp->cpcmd &= ~RxVlanOn; @@ -1857,7 +1858,7 @@ 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; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
vlan_features_check(skb, features); } @@ -1967,8 +1968,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) cp->cpcmd = (pci_using_dac ? PCIDAC : 0) | PCIMulRW | RxChkSum | CpRxOn | CpTxOn;
- dev->features |= NETIF_F_RXCSUM; - dev->hw_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features);
regs = ioremap(pciaddr, CP_REGS_SIZE); if (!regs) { @@ -1993,16 +1994,18 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) dev->ethtool_ops = &cp_ethtool_ops; dev->watchdog_timeo = TX_TIMEOUT;
- dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &dev->features);
if (pci_using_dac) - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
- dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; - dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HIGHDMA; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + NETIF_F_HIGHDMA, &dev->vlan_features);
/* MTU range: 60 - 4096 */ dev->min_mtu = CP_MIN_MTU; diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index 2e6923cc..59b5a95 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c @@ -900,18 +900,21 @@ static struct net_device *rtl8139_init_board(struct pci_dev *pdev) static int rtl8139_set_features(struct net_device *dev, netdev_features_t features) { struct rtl8139_private *tp = netdev_priv(dev); + netdev_features_t changed; unsigned long flags; - netdev_features_t changed = features ^ dev->features; void __iomem *ioaddr = tp->mmio_addr;
- if (!(changed & (NETIF_F_RXALL))) + netdev_feature_xor(&changed, features, dev->features); + + if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) return 0;
spin_lock_irqsave(&tp->lock, flags);
- if (changed & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) { int rx_mode = tp->rx_config; - if (features & NETIF_F_RXALL) + + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, features)) rx_mode |= (AcceptErr | AcceptRunt); else rx_mode &= ~(AcceptErr | AcceptRunt); @@ -1007,11 +1010,12 @@ static int rtl8139_init_one(struct pci_dev *pdev, * through the use of skb_copy_and_csum_dev we enable these * features */ - dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA; - dev->vlan_features = dev->features; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA, + &dev->features); + netdev_feature_copy(&dev->vlan_features, dev->features);
- dev->hw_features |= NETIF_F_RXALL; - dev->hw_features |= NETIF_F_RXFCS; + netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features);
/* MTU range: 68 - 1770 */ dev->min_mtu = ETH_MIN_MTU; @@ -1968,7 +1972,8 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp, /* read size+status of next frame from DMA ring buffer */ rx_status = le32_to_cpu (*(__le32 *) (rx_ring + ring_offset)); rx_size = rx_status >> 16; - if (likely(!(dev->features & NETIF_F_RXFCS))) + if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + dev->features))) pkt_size = rx_size - 4; else pkt_size = rx_size; @@ -2009,7 +2014,8 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp, if (unlikely((rx_size > (MAX_ETH_FRAME_SIZE+4)) || (rx_size < 8) || (!(rx_status & RxStatusOK)))) { - if ((dev->features & NETIF_F_RXALL) && + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, + dev->features) && (rx_size <= (MAX_ETH_FRAME_SIZE + 4)) && (rx_size >= 8) && (!(rx_status & RxStatusOK))) { @@ -2580,7 +2586,7 @@ static void __set_rx_mode (struct net_device *dev) } }
- if (dev->features & NETIF_F_RXALL) + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, dev->features)) rx_mode |= (AcceptErr | AcceptRunt);
/* We can safely update without stopping the chip. */ diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 584b3bb..e1bdc34 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -1471,11 +1471,12 @@ static void rtl8169_fix_features(struct net_device *dev, struct rtl8169_private *tp = netdev_priv(dev);
if (dev->mtu > TD_MSS_MAX) - *features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
if (dev->mtu > ETH_DATA_LEN && tp->mac_version > RTL_GIGA_MAC_VER_06) - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_ALL_TSO); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_ALL_TSO, + features); }
static void rtl_set_rx_config_features(struct rtl8169_private *tp, @@ -1483,13 +1484,14 @@ static void rtl_set_rx_config_features(struct rtl8169_private *tp, { u32 rx_config = RTL_R32(tp, RxConfig);
- if (features & NETIF_F_RXALL) + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, features)) rx_config |= RX_CONFIG_ACCEPT_ERR_MASK; else rx_config &= ~RX_CONFIG_ACCEPT_ERR_MASK;
if (rtl_is_8125(tp)) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) rx_config |= RX_VLAN_8125; else rx_config &= ~RX_VLAN_8125; @@ -1505,13 +1507,14 @@ static int rtl8169_set_features(struct net_device *dev,
rtl_set_rx_config_features(tp, features);
- if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) tp->cp_cmd |= RxChkSum; else tp->cp_cmd &= ~RxChkSum;
if (!rtl_is_8125(tp)) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) tp->cp_cmd |= RxVlan; else tp->cp_cmd &= ~RxVlan; @@ -4336,15 +4339,15 @@ static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t *features) /* IPv4 header has options field */ if (vlan_get_protocol(skb) == htons(ETH_P_IP) && ip_hdrlen(skb) > sizeof(struct iphdr)) - *features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
/* IPv4 TCP header has options field */ else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 && tcp_hdrlen(skb) > sizeof(struct tcphdr)) - *features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
else if (rtl_last_frag_len(skb) <= 6) - *features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, features); }
static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev, @@ -4359,18 +4362,18 @@ static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev,
if (transport_offset > GTTCPHO_MAX && rtl_chip_supports_csum_v2(tp)) - *features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, features); } 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; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
if (rtl_quirk_packet_padto(tp, skb)) - *features &= ~NETIF_F_CSUM_MASK; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
if (transport_offset > TCPHO_MAX && rtl_chip_supports_csum_v2(tp)) - *features &= ~NETIF_F_CSUM_MASK; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features); }
vlan_features_check(skb, features); @@ -4496,14 +4499,16 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, int budget if (status & RxCRC) dev->stats.rx_crc_errors++;
- if (!(dev->features & NETIF_F_RXALL)) + if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, + dev->features)) goto release_descriptor; else if (status & RxRWT || !(status & (RxRUNT | RxCRC))) goto release_descriptor; }
pkt_size = status & GENMASK(13, 0); - if (likely(!(dev->features & NETIF_F_RXFCS))) + if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + dev->features))) pkt_size -= ETH_FCS_LEN;
/* The driver does not support incoming fragmented frames. @@ -5323,7 +5328,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (sizeof(dma_addr_t) > 4 && tp->mac_version >= RTL_GIGA_MAC_VER_18 && !dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
rtl_init_rxcfg(tp);
@@ -5347,9 +5352,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_napi_add(dev, &tp->napi, rtl8169_poll, NAPI_POLL_WEIGHT);
- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; - dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); + netdev_feature_zero(&dev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO, + &dev->vlan_features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
/* @@ -5358,12 +5367,14 @@ 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_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->hw_features);
if (rtl_chip_supports_csum_v2(tp)) - dev->hw_features |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &dev->hw_features);
- dev->features |= dev->hw_features; + netdev_feature_or(&dev->features, dev->features, dev->hw_features);
/* There has been a number of reports that using SG/TSO results in * tx timeouts. However for a lot of people SG/TSO works fine. @@ -5371,17 +5382,19 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * enable them. Use at own risk! */ if (rtl_chip_supports_csum_v2(tp)) { - dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6, + &dev->hw_features); dev->gso_max_size = RTL_GSO_MAX_SIZE_V2; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V2; } else { - dev->hw_features |= NETIF_F_SG | NETIF_F_TSO; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO, + &dev->hw_features); dev->gso_max_size = RTL_GSO_MAX_SIZE_V1; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V1; }
- dev->hw_features |= NETIF_F_RXALL; - dev->hw_features |= NETIF_F_RXFCS; + netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features);
/* configure chip for default features */ rtl8169_set_features(dev, dev->features);
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/realtek/8139cp.c | 29 +++++++------- drivers/net/ethernet/realtek/8139too.c | 28 +++++++------ drivers/net/ethernet/realtek/r8169_main.c | 65 ++++++++++++++++++------------- 3 files changed, 72 insertions(+), 50 deletions(-)
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index dc06c3e..626b3f2 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -1461,17 +1461,18 @@ static int cp_set_features(struct net_device *dev, netdev_features_t features) struct cp_private *cp = netdev_priv(dev); unsigned long flags;
- if (!((dev->features ^ features) & NETIF_F_RXCSUM))
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features) !=
netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features))
it should be "==", not "!=", will fix it next version
return 0;
spin_lock_irqsave(&cp->lock, flags);
- if (features & NETIF_F_RXCSUM)
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) cp->cpcmd |= RxChkSum; else cp->cpcmd &= ~RxChkSum;
- if (features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) cp->cpcmd |= RxVlanOn; else cp->cpcmd &= ~RxVlanOn;
@@ -1857,7 +1858,7 @@ 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;
netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
vlan_features_check(skb, features); }
@@ -1967,8 +1968,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) cp->cpcmd = (pci_using_dac ? PCIDAC : 0) | PCIMulRW | RxChkSum | CpRxOn | CpTxOn;
- dev->features |= NETIF_F_RXCSUM;
- dev->hw_features |= NETIF_F_RXCSUM;
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features);
regs = ioremap(pciaddr, CP_REGS_SIZE); if (!regs) {
@@ -1993,16 +1994,18 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) dev->ethtool_ops = &cp_ethtool_ops; dev->watchdog_timeo = TX_TIMEOUT;
- dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX, &dev->features);
if (pci_using_dac)
dev->features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
- dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
- dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_HIGHDMA;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
NETIF_F_HIGHDMA, &dev->vlan_features);
/* MTU range: 60 - 4096 */ dev->min_mtu = CP_MIN_MTU;
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index 2e6923cc..59b5a95 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c @@ -900,18 +900,21 @@ static struct net_device *rtl8139_init_board(struct pci_dev *pdev) static int rtl8139_set_features(struct net_device *dev, netdev_features_t features) { struct rtl8139_private *tp = netdev_priv(dev);
- netdev_features_t changed; unsigned long flags;
netdev_features_t changed = features ^ dev->features; void __iomem *ioaddr = tp->mmio_addr;
if (!(changed & (NETIF_F_RXALL)))
netdev_feature_xor(&changed, features, dev->features);
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) return 0;
spin_lock_irqsave(&tp->lock, flags);
- if (changed & NETIF_F_RXALL) {
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) { int rx_mode = tp->rx_config;
if (features & NETIF_F_RXALL)
else rx_mode &= ~(AcceptErr | AcceptRunt);if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, features)) rx_mode |= (AcceptErr | AcceptRunt);
@@ -1007,11 +1010,12 @@ static int rtl8139_init_one(struct pci_dev *pdev, * through the use of skb_copy_and_csum_dev we enable these * features */
- dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;
- dev->vlan_features = dev->features;
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA,
&dev->features);
- netdev_feature_copy(&dev->vlan_features, dev->features);
- dev->hw_features |= NETIF_F_RXALL;
- dev->hw_features |= NETIF_F_RXFCS;
netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features);
netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features);
/* MTU range: 68 - 1770 */ dev->min_mtu = ETH_MIN_MTU;
@@ -1968,7 +1972,8 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp, /* read size+status of next frame from DMA ring buffer */ rx_status = le32_to_cpu (*(__le32 *) (rx_ring + ring_offset)); rx_size = rx_status >> 16;
if (likely(!(dev->features & NETIF_F_RXFCS)))
if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
else pkt_size = rx_size;dev->features))) pkt_size = rx_size - 4;
@@ -2009,7 +2014,8 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp, if (unlikely((rx_size > (MAX_ETH_FRAME_SIZE+4)) || (rx_size < 8) || (!(rx_status & RxStatusOK)))) {
if ((dev->features & NETIF_F_RXALL) &&
if (netdev_feature_test_bit(NETIF_F_RXALL_BIT,
dev->features) && (rx_size <= (MAX_ETH_FRAME_SIZE + 4)) && (rx_size >= 8) && (!(rx_status & RxStatusOK))) {
@@ -2580,7 +2586,7 @@ static void __set_rx_mode (struct net_device *dev) } }
- if (dev->features & NETIF_F_RXALL)
if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, dev->features)) rx_mode |= (AcceptErr | AcceptRunt);
/* We can safely update without stopping the chip. */
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 584b3bb..e1bdc34 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -1471,11 +1471,12 @@ static void rtl8169_fix_features(struct net_device *dev, struct rtl8169_private *tp = netdev_priv(dev);
if (dev->mtu > TD_MSS_MAX)
*features &= ~NETIF_F_ALL_TSO;
netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
if (dev->mtu > ETH_DATA_LEN && tp->mac_version > RTL_GIGA_MAC_VER_06)
*features &= ~(NETIF_F_CSUM_MASK | NETIF_F_ALL_TSO);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_ALL_TSO,
features);
}
static void rtl_set_rx_config_features(struct rtl8169_private *tp,
@@ -1483,13 +1484,14 @@ static void rtl_set_rx_config_features(struct rtl8169_private *tp, { u32 rx_config = RTL_R32(tp, RxConfig);
- if (features & NETIF_F_RXALL)
if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, features)) rx_config |= RX_CONFIG_ACCEPT_ERR_MASK; else rx_config &= ~RX_CONFIG_ACCEPT_ERR_MASK;
if (rtl_is_8125(tp)) {
if (features & NETIF_F_HW_VLAN_CTAG_RX)
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
else rx_config &= ~RX_VLAN_8125;features)) rx_config |= RX_VLAN_8125;
@@ -1505,13 +1507,14 @@ static int rtl8169_set_features(struct net_device *dev,
rtl_set_rx_config_features(tp, features);
- if (features & NETIF_F_RXCSUM)
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) tp->cp_cmd |= RxChkSum; else tp->cp_cmd &= ~RxChkSum;
if (!rtl_is_8125(tp)) {
if (features & NETIF_F_HW_VLAN_CTAG_RX)
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
else tp->cp_cmd &= ~RxVlan;features)) tp->cp_cmd |= RxVlan;
@@ -4336,15 +4339,15 @@ static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t *features) /* IPv4 header has options field */ if (vlan_get_protocol(skb) == htons(ETH_P_IP) && ip_hdrlen(skb) > sizeof(struct iphdr))
*features &= ~NETIF_F_ALL_TSO;
netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
/* IPv4 TCP header has options field */ else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 && tcp_hdrlen(skb) > sizeof(struct tcphdr))
*features &= ~NETIF_F_ALL_TSO;
netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
else if (rtl_last_frag_len(skb) <= 6)
*features &= ~NETIF_F_ALL_TSO;
netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
}
static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev,
@@ -4359,18 +4362,18 @@ static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev,
if (transport_offset > GTTCPHO_MAX && rtl_chip_supports_csum_v2(tp))
*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)netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
*features &= ~NETIF_F_CSUM_MASK;
netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
if (rtl_quirk_packet_padto(tp, skb))
*features &= ~NETIF_F_CSUM_MASK;
netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
if (transport_offset > TCPHO_MAX && rtl_chip_supports_csum_v2(tp))
*features &= ~NETIF_F_CSUM_MASK;
netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
}
vlan_features_check(skb, features);
@@ -4496,14 +4499,16 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, int budget if (status & RxCRC) dev->stats.rx_crc_errors++;
if (!(dev->features & NETIF_F_RXALL))
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
dev->features)) goto release_descriptor; else if (status & RxRWT || !(status & (RxRUNT | RxCRC))) goto release_descriptor;
}
pkt_size = status & GENMASK(13, 0);
if (likely(!(dev->features & NETIF_F_RXFCS)))
if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
dev->features))) pkt_size -= ETH_FCS_LEN;
/* The driver does not support incoming fragmented frames.
@@ -5323,7 +5328,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (sizeof(dma_addr_t) > 4 && tp->mac_version >= RTL_GIGA_MAC_VER_18 && !dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)))
dev->features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
rtl_init_rxcfg(tp);
@@ -5347,9 +5352,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_napi_add(dev, &tp->napi, rtl8169_poll, NAPI_POLL_WEIGHT);
- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
- dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
netdev_feature_zero(&dev->hw_features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features);
netdev_feature_zero(&dev->vlan_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO,
&dev->vlan_features);
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
/*
@@ -5358,12 +5367,14 @@ 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_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
&dev->hw_features);
if (rtl_chip_supports_csum_v2(tp))
dev->hw_features |= NETIF_F_IPV6_CSUM;
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
&dev->hw_features);
- dev->features |= dev->hw_features;
netdev_feature_or(&dev->features, dev->features, dev->hw_features);
/* There has been a number of reports that using SG/TSO results in
- tx timeouts. However for a lot of people SG/TSO works fine.
@@ -5371,17 +5382,19 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * enable them. Use at own risk! */ if (rtl_chip_supports_csum_v2(tp)) {
dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6,
dev->gso_max_size = RTL_GSO_MAX_SIZE_V2; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V2; } else {&dev->hw_features);
dev->hw_features |= NETIF_F_SG | NETIF_F_TSO;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO,
dev->gso_max_size = RTL_GSO_MAX_SIZE_V1; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V1; }&dev->hw_features);
- dev->hw_features |= NETIF_F_RXALL;
- dev->hw_features |= NETIF_F_RXFCS;
netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features);
netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features);
/* configure chip for default features */ rtl8169_set_features(dev, dev->features);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/broadcom/b44.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 24 ++-- drivers/net/ethernet/broadcom/bgmac.c | 8 +- drivers/net/ethernet/broadcom/bnx2.c | 49 +++++--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 62 +++++---- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 84 +++++++------ drivers/net/ethernet/broadcom/bnxt/bnxt.c | 152 ++++++++++++++--------- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 11 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 3 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 12 +- drivers/net/ethernet/broadcom/tg3.c | 56 +++++---- 12 files changed, 279 insertions(+), 188 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index fa78495..80c0998 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c @@ -2353,7 +2353,7 @@ static int b44_init_one(struct ssb_device *sdev, SET_NETDEV_DEV(dev, sdev->dev);
/* No interesting netdevice features in this card... */ - dev->features |= 0; + netdev_feature_set_bits(0, &dev->features);
bp = netdev_priv(dev); bp->sdev = sdev; diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index d9f0f0d..e1df027 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -122,7 +122,7 @@ static void bcm_sysport_set_rx_csum(struct net_device *dev, struct bcm_sysport_priv *priv = netdev_priv(dev); u32 reg;
- priv->rx_chk_en = !!(wanted & NETIF_F_RXCSUM); + priv->rx_chk_en = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, wanted); reg = rxchk_readl(priv, RXCHK_CONTROL); /* Clear L2 header checks, which would prevent BPDUs * from being received. @@ -162,8 +162,10 @@ static void bcm_sysport_set_tx_csum(struct net_device *dev, /* Hardware transmit checksum requires us to enable the Transmit status * block prepended to the packet contents */ - priv->tsb_en = !!(wanted & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_HW_VLAN_CTAG_TX)); + priv->tsb_en = netdev_feature_test_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_HW_VLAN_CTAG_TX, + wanted); reg = tdma_readl(priv, TDMA_CONTROL); if (priv->tsb_en) reg |= tdma_control_bit(priv, TSB_EN); @@ -180,7 +182,7 @@ static void bcm_sysport_set_tx_csum(struct net_device *dev, tdma_writel(priv, reg, TDMA_CONTROL);
/* Default TPID is ETH_P_8021AD, change to ETH_P_8021Q */ - if (wanted & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, wanted)) tdma_writel(priv, ETH_P_8021Q, TDMA_TPID); }
@@ -1539,7 +1541,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, /* Adjust the packet size calculations if SYSTEMPORT is responsible * for HW insertion of VLAN tags */ - if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + priv->netdev->features)) reg = VLAN_HLEN << RING_PKT_SIZE_ADJ_SHIFT; tdma_writel(priv, reg, TDMA_DESC_RING_PCP_DEI_VID(index));
@@ -2563,11 +2566,12 @@ static int bcm_sysport_probe(struct platform_device *pdev) dev->netdev_ops = &bcm_sysport_netdev_ops; netif_napi_add(dev, &priv->napi, bcm_sysport_poll, 64);
- dev->features |= NETIF_F_RXCSUM | NETIF_F_HIGHDMA | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_HW_VLAN_CTAG_TX; - dev->hw_features |= dev->features; - dev->vlan_features |= dev->features; + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HIGHDMA | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_HW_VLAN_CTAG_TX, &dev->features); + netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(&dev->vlan_features, dev->vlan_features, + dev->features); dev->max_mtu = UMAC_MAX_MTU_SIZE;
/* Request the WOL interrupt and advertise suspend if available */ diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index fe4d99a..c99800b 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -1535,9 +1535,11 @@ int bgmac_enet_probe(struct bgmac *bgmac) goto err_dma_free; }
- net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - net_dev->hw_features = net_dev->features; - net_dev->vlan_features = net_dev->features; + netdev_feature_zero(&net_dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &net_dev->features); + netdev_feature_copy(&net_dev->hw_features, net_dev->features); + netdev_feature_copy(&net_dev->vlan_features, net_dev->features);
/* Omit FCS from max MTU size */ net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN; diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 89ee1c0..c7b8b5a 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -3258,7 +3258,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) }
skb_checksum_none_assert(skb); - if ((bp->dev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + bp->dev->features) && (status & (L2_FHDR_STATUS_TCP_SEGMENT | L2_FHDR_STATUS_UDP_DATAGRAM))) {
@@ -3266,7 +3267,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) L2_FHDR_ERRORS_UDP_XSUM)) == 0)) skb->ip_summed = CHECKSUM_UNNECESSARY; } - if ((bp->dev->features & NETIF_F_RXHASH) && + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + bp->dev->features) && ((status & L2_FHDR_STATUS_USE_RXHASH) == L2_FHDR_STATUS_USE_RXHASH)) skb_set_hash(skb, rx_hdr->l2_fhdr_hash, @@ -3586,7 +3588,8 @@ bnx2_set_rx_mode(struct net_device *dev) rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN; - if (!(dev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features) && (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)) rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; if (dev->flags & IFF_PROMISC) { @@ -7742,18 +7745,23 @@ static int bnx2_set_features(struct net_device *dev, netdev_features_t features) { struct bnx2 *bp = netdev_priv(dev); + netdev_features_t tmp;
/* TSO with VLAN tag won't work with current firmware */ - if (features & NETIF_F_HW_VLAN_CTAG_TX) - dev->vlan_features |= (dev->hw_features & NETIF_F_ALL_TSO); - else - dev->vlan_features &= ~NETIF_F_ALL_TSO; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) { + netdev_feature_copy(&tmp, dev->hw_features); + netdev_feature_and_bits(NETIF_F_ALL_TSO, &tmp); + netdev_feature_or(&dev->vlan_features, dev->vlan_features, + tmp); + } else { + netdev_feature_clear_bits(NETIF_F_ALL_TSO, &dev->vlan_features); + }
- if ((!!(features & NETIF_F_HW_VLAN_CTAG_RX) != + if ((netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) != !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) && netif_running(dev)) { bnx2_netif_stop(bp, false); - dev->features = features; + netdev_feature_copy(&dev->features, features); bnx2_set_rx_mode(dev); bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); bnx2_netif_start(bp, false); @@ -8225,7 +8233,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
/* Configure DMA attributes. */ if (pci_set_dma_mask(pdev, dma_mask) == 0) { - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (rc) { dev_err(&pdev->dev, @@ -8593,22 +8601,27 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_TSO_ECN | - NETIF_F_RXHASH | NETIF_F_RXCSUM; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_TSO_ECN | + NETIF_F_RXHASH | NETIF_F_RXCSUM, + &dev->hw_features);
if (BNX2_CHIP(bp) == BNX2_CHIP_5709) - dev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_IPV6_CSUM | NETIF_F_TSO6, + &dev->hw_features);
- dev->vlan_features = dev->hw_features; - dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; - dev->features |= dev->hw_features; + netdev_feature_copy(&dev->vlan_features, dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); + netdev_feature_or(&dev->features, dev->features, dev->hw_features); dev->priv_flags |= IFF_UNICAST_FLT; dev->min_mtu = MIN_ETHERNET_PACKET_SIZE; 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_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->hw_features);
if ((rc = register_netdev(dev))) { dev_err(&pdev->dev, "Cannot register net device\n"); diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index d745103..6b3a37d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -412,7 +412,7 @@ static u32 bnx2x_get_rxhash(const struct bnx2x *bp, enum pkt_hash_types *rxhash_type) { /* Get Toeplitz hash from CQE */ - if ((bp->dev->features & NETIF_F_RXHASH) && + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, bp->dev->features) && (cqe->status_flags & ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG)) { enum eth_rss_hash_type htype;
@@ -1073,7 +1073,8 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
skb_checksum_none_assert(skb);
- if (bp->dev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + bp->dev->features)) bnx2x_csum_validate(skb, cqe, fp, bnx2x_fp_qstats(bp, fp));
@@ -2491,9 +2492,10 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) /* set the tpa flag for each queue. The tpa flag determines the queue * minimal size so it must be set prior to queue memory allocation */ - if (bp->dev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, bp->dev->features)) fp->mode = TPA_MODE_LRO; - else if (bp->dev->features & NETIF_F_GRO_HW) + else if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, + bp->dev->features)) fp->mode = TPA_MODE_GRO; else fp->mode = TPA_MODE_DISABLED; @@ -4891,7 +4893,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_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features);
if (IS_PF(bp) && SHMEM2_HAS(bp, curr_cfg)) SHMEM2_WR(bp, curr_cfg, CURR_CFG_MET_OS); @@ -4904,42 +4906,54 @@ void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) struct bnx2x *bp = netdev_priv(dev);
if (pci_num_vf(bp->pdev)) { - netdev_features_t changed = dev->features ^ *features; + netdev_features_t changed; + + netdev_feature_xor(&changed, dev->features, *features);
/* Revert the requested changes in features if they * would require internal reload of PF in bnx2x_set_features(). */ - if (!(*features & NETIF_F_RXCSUM) && !bp->disable_tpa) { - *features &= ~NETIF_F_RXCSUM; - *features |= dev->features & NETIF_F_RXCSUM; + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features) && + !bp->disable_tpa) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features)) + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + features); }
- if (changed & NETIF_F_LOOPBACK) { - *features &= ~NETIF_F_LOOPBACK; - *features |= dev->features & NETIF_F_LOOPBACK; + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed)) { + netdev_feature_clear_bit(NETIF_F_LOOPBACK_BIT, + features); + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, + dev->features)) + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, + features); } }
/* TPA requires Rx CSUM offloading */ - if (!(*features & NETIF_F_RXCSUM)) - *features &= ~NETIF_F_LRO; - - if (!(*features & NETIF_F_GRO) || !bnx2x_mtu_allows_gro(dev->mtu)) - *features &= ~NETIF_F_GRO_HW; - if (*features & NETIF_F_GRO_HW) - *features &= ~NETIF_F_LRO; + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); + + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features) || + !bnx2x_mtu_allows_gro(dev->mtu)) + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
int bnx2x_set_features(struct net_device *dev, netdev_features_t features) { struct bnx2x *bp = netdev_priv(dev); - netdev_features_t changes = features ^ dev->features; + netdev_features_t changes; bool bnx2x_reload = false; int rc;
+ netdev_feature_xor(&changes, dev->features, features); + /* VFs or non SRIOV PFs should be able to change loopback feature */ if (!pci_num_vf(bp->pdev)) { - if (features & NETIF_F_LOOPBACK) { + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features)) { if (bp->link_params.loopback_mode != LOOPBACK_BMAC) { bp->link_params.loopback_mode = LOOPBACK_BMAC; bnx2x_reload = true; @@ -4953,14 +4967,14 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) }
/* Don't care about GRO changes */ - changes &= ~NETIF_F_GRO; + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &changes);
- if (changes) + if (!netdev_feature_empty(changes)) bnx2x_reload = true;
if (bnx2x_reload) { if (bp->recovery_state == BNX2X_RECOVERY_DONE) { - dev->features = features; + netdev_feature_copy(&dev->features, features); rc = bnx2x_reload_if_running(dev); return rc ? rc : 1; } diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index f8b84f7..82cfee2 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -3393,9 +3393,9 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) ether_stat->mac_local + MAC_PAD, MAC_PAD, ETH_ALEN); ether_stat->mtu_size = bp->dev->mtu; - if (bp->dev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, bp->dev->features)) ether_stat->feature_flags |= FEATURE_ETH_CHKSUM_OFFLOAD_MASK; - if (bp->dev->features & NETIF_F_TSO) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, bp->dev->features)) ether_stat->feature_flags |= FEATURE_ETH_LSO_MASK; ether_stat->feature_flags |= bp->common.boot_mode;
@@ -12383,8 +12383,10 @@ static int bnx2x_init_bp(struct bnx2x *bp)
/* Set TPA flags */ if (bp->disable_tpa) { - bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW); - bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW); + netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, + &bp->dev->hw_features); + netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, + &bp->dev->features); }
if (CHIP_IS_E1(bp)) @@ -12904,7 +12906,7 @@ static void bnx2x_features_check(struct sk_buff *skb, struct net_device *dev, if (unlikely(skb_is_gso(skb) && (skb_shinfo(skb)->gso_size > 9000) && !skb_gso_validate_mac_len(skb, 9700))) - *features &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
vlan_features_check(skb, features); vxlan_features_check(skb, features); @@ -13241,52 +13243,62 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
dev->priv_flags |= IFF_UNICAST_FLT;
- dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | - NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | NETIF_F_GRO_HW | - NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_TSO | + NETIF_F_TSO_ECN | NETIF_F_TSO6 | + NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | + NETIF_F_GRO_HW | NETIF_F_RXHASH | + NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); if (!chip_is_e1x) { - dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL; - - dev->hw_enc_features = - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | - NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL; - - dev->gso_partial_features = NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | + NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL, &dev->hw_features); + + netdev_feature_zero(&dev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_SG | NETIF_F_TSO | + NETIF_F_TSO_ECN | NETIF_F_TSO6 | + NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL, &dev->hw_enc_features); + + netdev_feature_zero(&dev->gso_partial_features); + netdev_feature_set_bits(NETIF_F_GSO_GRE_CSUM | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &dev->gso_partial_features);
if (IS_PF(bp)) dev->udp_tunnel_nic_info = &bnx2x_udp_tunnels; }
- dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA; + netdev_feature_zero(&dev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_TSO | + NETIF_F_TSO_ECN | NETIF_F_TSO6 | + NETIF_F_HIGHDMA, &dev->vlan_features);
if (IS_PF(bp)) { if (chip_is_e1x) bp->accept_any_vlan = true; else - dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &dev->hw_features); } /* For VF we'll know whether to enable VLAN filtering after * getting a response to CHANNEL_TLV_ACQUIRE from PF. */
- dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX; - dev->features |= NETIF_F_HIGHDMA; - if (dev->features & NETIF_F_LRO) - dev->features &= ~NETIF_F_GRO_HW; + netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features);
/* Add Loopback capability to the device */ - dev->hw_features |= NETIF_F_LOOPBACK; + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &dev->features);
#ifdef BCM_DCBNL dev->dcbnl_ops = &bnx2x_dcbnl_ops; @@ -13989,8 +14001,10 @@ static int bnx2x_init_one(struct pci_dev *pdev, #ifdef CONFIG_BNX2X_SRIOV /* VF with OLD Hypervisor or old PF do not support filtering */ if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) { - dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; - dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &dev->features); } #endif } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 5fa1d3b..3d907bb 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1672,7 +1672,8 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp, skb_set_hash(skb, tpa_info->rss_hash, tpa_info->hash_type);
if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) && - (skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) { + (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + skb->dev->features))) { __be16 vlan_proto = htons(tpa_info->metadata >> RX_CMP_FLAGS2_METADATA_TPID_SFT); u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_TCI_MASK; @@ -1901,7 +1902,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
if ((rxcmp1->rx_cmp_flags2 & cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) && - (skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) { + netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + skb->dev->features)) { u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data); u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_TCI_MASK; __be16 vlan_proto = htons(meta_data >> @@ -1917,13 +1919,15 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
skb_checksum_none_assert(skb); if (RX_CMP_L4_CS_OK(rxcmp1)) { - if (dev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features)) { skb->ip_summed = CHECKSUM_UNNECESSARY; skb->csum_level = RX_CMP_ENCAP(rxcmp1); } } else { if (rxcmp1->rx_cmp_cfa_code_errors_v2 & RX_CMP_L4_CS_ERR_BITS) { - if (dev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features)) bnapi->cp_ring.sw_stats.rx.rx_l4_csum_errors++; } } @@ -3673,9 +3677,10 @@ void bnxt_set_tpa_flags(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_TPA; if (bp->flags & BNXT_FLAG_NO_AGG_RINGS) return; - if (bp->dev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, bp->dev->features)) bp->flags |= BNXT_FLAG_LRO; - else if (bp->dev->features & NETIF_F_GRO_HW) + else if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, + bp->dev->features)) bp->flags |= BNXT_FLAG_GRO; }
@@ -6496,8 +6501,10 @@ 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_feature_clear_bit(NETIF_F_LRO_BIT, + &bp->dev->hw_features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, + &bp->dev->features); bnxt_set_ring_params(bp); } } @@ -10221,7 +10228,8 @@ 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_feature_clear_bit(NETIF_F_NTUPLE_BIT, + &bp->dev->hw_features); bp->flags &= ~BNXT_FLAG_RFS; }
@@ -10914,34 +10922,42 @@ static bool bnxt_rfs_capable(struct bnxt *bp) static void bnxt_fix_features(struct net_device *dev, netdev_features_t *features) { + netdev_features_t vlan_features, tmp; struct bnxt *bp = netdev_priv(dev); - netdev_features_t vlan_features;
- if ((*features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp)) - *features &= ~NETIF_F_NTUPLE; + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) && + !bnxt_rfs_capable(bp)) + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features);
if (bp->flags & BNXT_FLAG_NO_AGG_RINGS) - *features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW); + netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, + features);
- if (!(*features & NETIF_F_GRO)) - *features &= ~NETIF_F_GRO_HW; + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features);
- if (*features & NETIF_F_GRO_HW) - *features &= ~NETIF_F_LRO; + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
/* Both CTAG and STAG VLAN accelaration on the RX side have to be * turned on or off together. */ - vlan_features = *features & BNXT_HW_FEATURE_VLAN_ALL_RX; - if (vlan_features != BNXT_HW_FEATURE_VLAN_ALL_RX) { - if (dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX) - *features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX; - else if (vlan_features) - *features |= BNXT_HW_FEATURE_VLAN_ALL_RX; + netdev_feature_zero(&tmp); + netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, &tmp); + netdev_feature_and(&vlan_features, *features, tmp); + if (!netdev_feature_equal(vlan_features, tmp)) { + if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + dev->features)) + netdev_feature_clear_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + &dev->features); + else if (!netdev_feature_empty(vlan_features)) + netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + &dev->features); } #ifdef CONFIG_BNXT_SRIOV if (BNXT_VF(bp) && bp->vf.vlan) - *features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX; + netdev_feature_clear_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + features); #endif }
@@ -10955,18 +10971,18 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) bool update_tpa = false;
flags &= ~BNXT_FLAG_ALL_CONFIG_FEATS; - if (features & NETIF_F_GRO_HW) + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) flags |= BNXT_FLAG_GRO; - else if (features & NETIF_F_LRO) + else if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) flags |= BNXT_FLAG_LRO;
if (bp->flags & BNXT_FLAG_NO_AGG_RINGS) flags &= ~BNXT_FLAG_TPA;
- if (features & BNXT_HW_FEATURE_VLAN_ALL_RX) + if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, features)) flags |= BNXT_FLAG_STRIP_VLAN;
- if (features & NETIF_F_NTUPLE) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) flags |= BNXT_FLAG_RFS;
changes = flags ^ bp->flags; @@ -11129,7 +11145,8 @@ static void bnxt_features_check(struct sk_buff *skb, struct net_device *dev, return; break; } - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
int bnxt_dbg_hwrm_rd_reg(struct bnxt *bp, u32 reg_off, u16 num_words, @@ -11966,14 +11983,15 @@ 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_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->features); bp->flags &= ~BNXT_FLAG_RFS; if (bnxt_rfs_supported(bp)) { - dev->hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); if (bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS; - dev->features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, + &dev->features); } } } @@ -12952,8 +12970,10 @@ static int bnxt_get_dflt_rings(struct bnxt *bp, int *max_rx, int *max_tx, return rc; } bp->flags |= BNXT_FLAG_NO_AGG_RINGS; - bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW); - bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW); + netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, + &bp->dev->hw_features); + netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, + &bp->dev->features); bnxt_set_ring_params(bp); }
@@ -13068,7 +13088,7 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp) bp->tx_nr_rings_per_tc = bp->tx_nr_rings; if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS; - bp->dev->features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &bp->dev->features); } init_dflt_ring_err: bnxt_ulp_irq_restart(bp, rc); @@ -13289,37 +13309,46 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) goto init_err_pci_clean; }
- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | - NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_PARTIAL | NETIF_F_RXHASH | - NETIF_F_RXCSUM | NETIF_F_GRO; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | + NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_PARTIAL | + NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_GRO, + &dev->hw_features);
if (BNXT_SUPPORTS_TPA(bp)) - dev->hw_features |= NETIF_F_LRO; - - dev->hw_enc_features = - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | - NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_PARTIAL; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); + + netdev_feature_zero(&dev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_PARTIAL, &dev->hw_enc_features); dev->udp_tunnel_nic_info = &bnxt_udp_tunnels;
- dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_GRE_CSUM; - dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA; + netdev_feature_zero(&dev->gso_partial_features); + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_GRE_CSUM, + &dev->gso_partial_features); + netdev_feature_copy(&dev->vlan_features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->vlan_features); if (bp->fw_cap & BNXT_FW_CAP_VLAN_RX_STRIP) - dev->hw_features |= BNXT_HW_FEATURE_VLAN_ALL_RX; + netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + &dev->hw_features); if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) - dev->hw_features |= BNXT_HW_FEATURE_VLAN_ALL_TX; + netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_TX, + &dev->hw_features); if (BNXT_SUPPORTS_TPA(bp)) - dev->hw_features |= NETIF_F_GRO_HW; - dev->features |= dev->hw_features | NETIF_F_HIGHDMA; - if (dev->features & NETIF_F_GRO_HW) - dev->features &= ~NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &dev->hw_features); + netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, dev->features)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &dev->features); dev->priv_flags |= IFF_UNICAST_FLT;
#ifdef CONFIG_BNXT_SRIOV @@ -13368,7 +13397,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
bnxt_fw_init_one_p3(bp);
- if (dev->hw_features & BNXT_HW_FEATURE_VLAN_ALL_RX) + if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, + dev->hw_features)) bp->flags |= BNXT_FLAG_STRIP_VLAN;
rc = bnxt_init_int_mode(bp); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 5e4429b..0a3fbb4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -2041,8 +2041,8 @@ int bnxt_init_tc(struct bnxt *bp) goto destroy_decap_table;
tc_info->enabled = true; - bp->dev->hw_features |= NETIF_F_HW_TC; - bp->dev->features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->features); bp->tc_info = tc_info;
/* init indirect block notifications */ diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c index dd66302..b1d4534 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c @@ -464,11 +464,12 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, /* Just inherit all the featues of the parent PF as the VF-R * uses the RX/TX rings of the parent PF */ - dev->hw_features = pf_dev->hw_features; - dev->gso_partial_features = pf_dev->gso_partial_features; - dev->vlan_features = pf_dev->vlan_features; - dev->hw_enc_features = pf_dev->hw_enc_features; - dev->features |= pf_dev->features; + netdev_feature_copy(&dev->hw_features, pf_dev->hw_features); + netdev_feature_copy(&dev->gso_partial_features, + pf_dev->gso_partial_features); + netdev_feature_copy(&dev->vlan_features, pf_dev->vlan_features); + netdev_feature_copy(&dev->hw_enc_features, pf_dev->hw_enc_features); + netdev_feature_copy(&dev->features, pf_dev->features); bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx, dev->perm_addr); ether_addr_copy(dev->dev_addr, dev->perm_addr); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index bee6e09..18cc0e3 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -297,7 +297,8 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog) bnxt_get_max_rings(bp, &rx, &tx, true); if (rx > 1) { bp->flags &= ~BNXT_FLAG_NO_AGG_RINGS; - bp->dev->hw_features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, + &bp->dev->hw_features); } } bp->tx_nr_rings_xdp = tx_xdp; diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 8507198..70cf8be 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2237,7 +2237,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
status = (struct status_64 *)skb->data; dma_length_status = status->length_status; - if (dev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features)) { rx_csum = (__force __be16)(status->rx_csum & 0xffff); skb->csum = (__force __wsum)ntohs(rx_csum); skb->ip_summed = CHECKSUM_COMPLETE; @@ -3955,10 +3956,11 @@ static int bcmgenet_probe(struct platform_device *pdev) priv->msg_enable = netif_msg_init(-1, GENET_MSG_DEFAULT);
/* Set default features */ - dev->features |= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | - NETIF_F_RXCSUM; - dev->hw_features |= dev->features; - dev->vlan_features |= dev->features; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | + NETIF_F_RXCSUM, &dev->features); + netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(&dev->vlan_features, dev->vlan_features, + dev->features);
/* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled = true; diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 31b43fe..7abbae3 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -6920,7 +6920,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) tg3_hwclock_to_timestamp(tp, tstamp, skb_hwtstamps(skb));
- if ((tp->dev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + tp->dev->features) && (desc->type_flags & RXD_FLAG_TCPUDP_CSUM) && (((desc->ip_tcp_csum & RXD_TCPCSUM_MASK) >> RXD_TCPCSUM_SHIFT) == 0xffff)) @@ -7864,6 +7865,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi, { u32 frag_cnt_est = skb_shinfo(skb)->gso_segs * 3; struct sk_buff *segs, *seg, *next; + netdev_features_t tmp;
/* Estimate the number of fragments in the worst case */ if (unlikely(tg3_tx_avail(tnapi) <= frag_cnt_est)) { @@ -7881,8 +7883,9 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi, netif_tx_wake_queue(txq); }
- segs = skb_gso_segment(skb, tp->dev->features & - ~(NETIF_F_TSO | NETIF_F_TSO6)); + netdev_feature_copy(&tmp, tp->dev->features); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, &tmp); + segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs) || !segs) goto tg3_tso_bug_end;
@@ -8283,7 +8286,7 @@ static void tg3_set_loopback(struct net_device *dev, netdev_features_t features) { struct tg3 *tp = netdev_priv(dev);
- if (features & NETIF_F_LOOPBACK) { + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features)) { if (tp->mac_mode & MAC_MODE_PORT_INT_LPBACK) return;
@@ -8311,14 +8314,16 @@ static void tg3_fix_features(struct net_device *dev, struct tg3 *tp = netdev_priv(dev);
if (dev->mtu > ETH_DATA_LEN && tg3_flag(tp, 5780_CLASS)) - *features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, features); }
static int tg3_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed;
- if ((changed & NETIF_F_LOOPBACK) && netif_running(dev)) + netdev_feature_xor(&changed, dev->features, features); + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && + netif_running(dev)) tg3_set_loopback(dev, features);
return 0; @@ -11651,7 +11656,7 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, * Reset loopback feature if it was turned on while the device was down * make sure that it's installed properly now. */ - if (dev->features & NETIF_F_LOOPBACK) + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, dev->features)) tg3_set_loopback(dev, dev->features);
return 0; @@ -17612,7 +17617,9 @@ static int tg3_init_one(struct pci_dev *pdev, u32 sndmbx, rcvmbx, intmbx; char str[40]; u64 dma_mask, persist_dma_mask; - netdev_features_t features = 0; + netdev_features_t features; + + netdev_feature_zero(&features);
err = pci_enable_device(pdev); if (err) { @@ -17755,7 +17762,7 @@ static int tg3_init_one(struct pci_dev *pdev, if (dma_mask > DMA_BIT_MASK(32)) { err = pci_set_dma_mask(pdev, dma_mask); if (!err) { - features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &features); err = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (err < 0) { @@ -17780,10 +17787,12 @@ static int tg3_init_one(struct pci_dev *pdev, * to hardware bugs. */ if (tg3_chip_rev_id(tp) != CHIPREV_ID_5700_B0) { - features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_RXCSUM, &features);
if (tg3_flag(tp, 5755_PLUS)) - features |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &features); }
/* TSO is on by default on chips that support hardware TSO. @@ -17793,23 +17802,24 @@ static int tg3_init_one(struct pci_dev *pdev, if ((tg3_flag(tp, HW_TSO_1) || tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) && - (features & NETIF_F_IP_CSUM)) - features |= NETIF_F_TSO; + netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features)) + netdev_feature_set_bit(NETIF_F_TSO_BIT, &features); if (tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) { - if (features & NETIF_F_IPV6_CSUM) - features |= NETIF_F_TSO6; + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features)) + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &features); if (tg3_flag(tp, HW_TSO_3) || tg3_asic_rev(tp) == ASIC_REV_5761 || (tg3_asic_rev(tp) == ASIC_REV_5784 && tg3_chip_rev(tp) != CHIPREV_5784_AX) || tg3_asic_rev(tp) == ASIC_REV_5785 || tg3_asic_rev(tp) == ASIC_REV_57780) - features |= NETIF_F_TSO_ECN; + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &features); }
- dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - dev->vlan_features |= features; + netdev_feature_or(&dev->features, dev->features, features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &dev->features); + netdev_feature_or(&dev->vlan_features, dev->vlan_features, features);
/* * Add loopback capability only for a subset of devices that support @@ -17819,9 +17829,9 @@ static int tg3_init_one(struct pci_dev *pdev, if (tg3_asic_rev(tp) != ASIC_REV_5780 && !tg3_flag(tp, CPMU_PRESENT)) /* Add the loopback capability */ - features |= NETIF_F_LOOPBACK; + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &features);
- dev->hw_features |= features; + netdev_feature_or(&dev->hw_features, dev->hw_features, features); dev->priv_flags |= IFF_UNICAST_FLT;
/* MTU range: 60 - 9000 or 1500, depending on hardware */ @@ -17956,7 +17966,7 @@ static int tg3_init_one(struct pci_dev *pdev, }
netdev_info(dev, "RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n", - (dev->features & NETIF_F_RXCSUM) != 0, + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features), tg3_flag(tp, USE_LINKCHG_REG) != 0, (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT) != 0, tg3_flag(tp, ENABLE_ASF) != 0,
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/broadcom/b44.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 24 ++-- drivers/net/ethernet/broadcom/bgmac.c | 8 +- drivers/net/ethernet/broadcom/bnx2.c | 49 +++++--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 62 +++++---- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 84 +++++++------ drivers/net/ethernet/broadcom/bnxt/bnxt.c | 152 ++++++++++++++--------- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 11 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 3 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 12 +- drivers/net/ethernet/broadcom/tg3.c | 56 +++++---- 12 files changed, 279 insertions(+), 188 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index fa78495..80c0998 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c @@ -2353,7 +2353,7 @@ static int b44_init_one(struct ssb_device *sdev, SET_NETDEV_DEV(dev, sdev->dev);
/* No interesting netdevice features in this card... */
- dev->features |= 0;
netdev_feature_set_bits(0, &dev->features);
bp = netdev_priv(dev); bp->sdev = sdev;
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index d9f0f0d..e1df027 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -122,7 +122,7 @@ static void bcm_sysport_set_rx_csum(struct net_device *dev, struct bcm_sysport_priv *priv = netdev_priv(dev); u32 reg;
- priv->rx_chk_en = !!(wanted & NETIF_F_RXCSUM);
- priv->rx_chk_en = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, wanted); reg = rxchk_readl(priv, RXCHK_CONTROL); /* Clear L2 header checks, which would prevent BPDUs
- from being received.
@@ -162,8 +162,10 @@ static void bcm_sysport_set_tx_csum(struct net_device *dev, /* Hardware transmit checksum requires us to enable the Transmit status * block prepended to the packet contents */
- priv->tsb_en = !!(wanted & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_HW_VLAN_CTAG_TX));
- priv->tsb_en = netdev_feature_test_bits(NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_HW_VLAN_CTAG_TX,
reg = tdma_readl(priv, TDMA_CONTROL); if (priv->tsb_en) reg |= tdma_control_bit(priv, TSB_EN);wanted);
@@ -180,7 +182,7 @@ static void bcm_sysport_set_tx_csum(struct net_device *dev, tdma_writel(priv, reg, TDMA_CONTROL);
/* Default TPID is ETH_P_8021AD, change to ETH_P_8021Q */
- if (wanted & NETIF_F_HW_VLAN_CTAG_TX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, wanted)) tdma_writel(priv, ETH_P_8021Q, TDMA_TPID); }
@@ -1539,7 +1541,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, /* Adjust the packet size calculations if SYSTEMPORT is responsible * for HW insertion of VLAN tags */
- if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
reg = VLAN_HLEN << RING_PKT_SIZE_ADJ_SHIFT; tdma_writel(priv, reg, TDMA_DESC_RING_PCP_DEI_VID(index));priv->netdev->features))
@@ -2563,11 +2566,12 @@ static int bcm_sysport_probe(struct platform_device *pdev) dev->netdev_ops = &bcm_sysport_netdev_ops; netif_napi_add(dev, &priv->napi, bcm_sysport_poll, 64);
- dev->features |= NETIF_F_RXCSUM | NETIF_F_HIGHDMA |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_HW_VLAN_CTAG_TX;
- dev->hw_features |= dev->features;
- dev->vlan_features |= dev->features;
netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HIGHDMA |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_HW_VLAN_CTAG_TX, &dev->features);
netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features);
netdev_feature_or(&dev->vlan_features, dev->vlan_features,
dev->features);
dev->max_mtu = UMAC_MAX_MTU_SIZE;
/* Request the WOL interrupt and advertise suspend if available */
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index fe4d99a..c99800b 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -1535,9 +1535,11 @@ int bgmac_enet_probe(struct bgmac *bgmac) goto err_dma_free; }
- net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
- net_dev->hw_features = net_dev->features;
- net_dev->vlan_features = net_dev->features;
netdev_feature_zero(&net_dev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM, &net_dev->features);
netdev_feature_copy(&net_dev->hw_features, net_dev->features);
netdev_feature_copy(&net_dev->vlan_features, net_dev->features);
/* Omit FCS from max MTU size */ net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN;
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 89ee1c0..c7b8b5a 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -3258,7 +3258,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) }
skb_checksum_none_assert(skb);
if ((bp->dev->features & NETIF_F_RXCSUM) &&
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
bp->dev->features) && (status & (L2_FHDR_STATUS_TCP_SEGMENT | L2_FHDR_STATUS_UDP_DATAGRAM))) {
@@ -3266,7 +3267,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) L2_FHDR_ERRORS_UDP_XSUM)) == 0)) skb->ip_summed = CHECKSUM_UNNECESSARY; }
if ((bp->dev->features & NETIF_F_RXHASH) &&
if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
((status & L2_FHDR_STATUS_USE_RXHASH) == L2_FHDR_STATUS_USE_RXHASH)) skb_set_hash(skb, rx_hdr->l2_fhdr_hash,bp->dev->features) &&
@@ -3586,7 +3588,8 @@ bnx2_set_rx_mode(struct net_device *dev) rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN;
- if (!(dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
- if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)) rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; if (dev->flags & IFF_PROMISC) {dev->features) &&
@@ -7742,18 +7745,23 @@ static int bnx2_set_features(struct net_device *dev, netdev_features_t features) { struct bnx2 *bp = netdev_priv(dev);
netdev_features_t tmp;
/* TSO with VLAN tag won't work with current firmware */
- if (features & NETIF_F_HW_VLAN_CTAG_TX)
dev->vlan_features |= (dev->hw_features & NETIF_F_ALL_TSO);
- else
dev->vlan_features &= ~NETIF_F_ALL_TSO;
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) {
netdev_feature_copy(&tmp, dev->hw_features);
netdev_feature_and_bits(NETIF_F_ALL_TSO, &tmp);
netdev_feature_or(&dev->vlan_features, dev->vlan_features,
tmp);
- } else {
netdev_feature_clear_bits(NETIF_F_ALL_TSO, &dev->vlan_features);
- }
- if ((!!(features & NETIF_F_HW_VLAN_CTAG_RX) !=
- if ((netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) != !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) && netif_running(dev)) { bnx2_netif_stop(bp, false);
dev->features = features;
bnx2_set_rx_mode(dev); bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); bnx2_netif_start(bp, false);netdev_feature_copy(&dev->features, features);
@@ -8225,7 +8233,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
/* Configure DMA attributes. */ if (pci_set_dma_mask(pdev, dma_mask) == 0) {
dev->features |= NETIF_F_HIGHDMA;
rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (rc) { dev_err(&pdev->dev,netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
@@ -8593,22 +8601,27 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_TSO_ECN |
NETIF_F_RXHASH | NETIF_F_RXCSUM;
netdev_feature_zero(&dev->hw_features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_TSO_ECN |
NETIF_F_RXHASH | NETIF_F_RXCSUM,
&dev->hw_features);
if (BNX2_CHIP(bp) == BNX2_CHIP_5709)
dev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6;
netdev_feature_set_bits(NETIF_F_IPV6_CSUM | NETIF_F_TSO6,
&dev->hw_features);
- dev->vlan_features = dev->hw_features;
- dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
- dev->features |= dev->hw_features;
netdev_feature_copy(&dev->vlan_features, dev->hw_features);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features);
netdev_feature_or(&dev->features, dev->features, dev->hw_features); dev->priv_flags |= IFF_UNICAST_FLT; dev->min_mtu = MIN_ETHERNET_PACKET_SIZE; 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_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
&dev->hw_features);
if ((rc = register_netdev(dev))) { dev_err(&pdev->dev, "Cannot register net device\n");
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index d745103..6b3a37d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -412,7 +412,7 @@ static u32 bnx2x_get_rxhash(const struct bnx2x *bp, enum pkt_hash_types *rxhash_type) { /* Get Toeplitz hash from CQE */
- if ((bp->dev->features & NETIF_F_RXHASH) &&
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, bp->dev->features) && (cqe->status_flags & ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG)) { enum eth_rss_hash_type htype;
@@ -1073,7 +1073,8 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
skb_checksum_none_assert(skb);
if (bp->dev->features & NETIF_F_RXCSUM)
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
bp->dev->features)) bnx2x_csum_validate(skb, cqe, fp, bnx2x_fp_qstats(bp, fp));
@@ -2491,9 +2492,10 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) /* set the tpa flag for each queue. The tpa flag determines the queue * minimal size so it must be set prior to queue memory allocation */
- if (bp->dev->features & NETIF_F_LRO)
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, bp->dev->features)) fp->mode = TPA_MODE_LRO;
- else if (bp->dev->features & NETIF_F_GRO_HW)
- else if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT,
fp->mode = TPA_MODE_GRO; else fp->mode = TPA_MODE_DISABLED;bp->dev->features))
@@ -4891,7 +4893,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_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features);
if (IS_PF(bp) && SHMEM2_HAS(bp, curr_cfg)) SHMEM2_WR(bp, curr_cfg, CURR_CFG_MET_OS);
@@ -4904,42 +4906,54 @@ void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) struct bnx2x *bp = netdev_priv(dev);
if (pci_num_vf(bp->pdev)) {
netdev_features_t changed = dev->features ^ *features;
netdev_features_t changed;
netdev_feature_xor(&changed, dev->features, *features);
/* Revert the requested changes in features if they
- would require internal reload of PF in bnx2x_set_features().
*/
if (!(*features & NETIF_F_RXCSUM) && !bp->disable_tpa) {
*features &= ~NETIF_F_RXCSUM;
*features |= dev->features & NETIF_F_RXCSUM;
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features) &&
!bp->disable_tpa) {
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
dev->features))
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT,
}features);
if (changed & NETIF_F_LOOPBACK) {
*features &= ~NETIF_F_LOOPBACK;
*features |= dev->features & NETIF_F_LOOPBACK;
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed)) {
netdev_feature_clear_bit(NETIF_F_LOOPBACK_BIT,
features);
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT,
dev->features))
netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT,
features);
} }
/* TPA requires Rx CSUM offloading */
- if (!(*features & NETIF_F_RXCSUM))
*features &= ~NETIF_F_LRO;
- if (!(*features & NETIF_F_GRO) || !bnx2x_mtu_allows_gro(dev->mtu))
*features &= ~NETIF_F_GRO_HW;
- if (*features & NETIF_F_GRO_HW)
*features &= ~NETIF_F_LRO;
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features))
netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features) ||
!bnx2x_mtu_allows_gro(dev->mtu))
netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features);
if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features))
netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
}
int bnx2x_set_features(struct net_device *dev, netdev_features_t features) { struct bnx2x *bp = netdev_priv(dev);
- netdev_features_t changes = features ^ dev->features;
netdev_features_t changes; bool bnx2x_reload = false; int rc;
netdev_feature_xor(&changes, dev->features, features);
/* VFs or non SRIOV PFs should be able to change loopback feature */ if (!pci_num_vf(bp->pdev)) {
if (features & NETIF_F_LOOPBACK) {
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features)) { if (bp->link_params.loopback_mode != LOOPBACK_BMAC) { bp->link_params.loopback_mode = LOOPBACK_BMAC; bnx2x_reload = true;
@@ -4953,14 +4967,14 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) }
/* Don't care about GRO changes */
- changes &= ~NETIF_F_GRO;
- netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &changes);
it should be "NETIF_F_GRO_BIT", not "NETIF_F_GRO_HW_BIT"
- if (changes)
if (!netdev_feature_empty(changes)) bnx2x_reload = true;
if (bnx2x_reload) { if (bp->recovery_state == BNX2X_RECOVERY_DONE) {
dev->features = features;
}netdev_feature_copy(&dev->features, features); rc = bnx2x_reload_if_running(dev); return rc ? rc : 1;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index f8b84f7..82cfee2 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -3393,9 +3393,9 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) ether_stat->mac_local + MAC_PAD, MAC_PAD, ETH_ALEN); ether_stat->mtu_size = bp->dev->mtu;
- if (bp->dev->features & NETIF_F_RXCSUM)
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, bp->dev->features)) ether_stat->feature_flags |= FEATURE_ETH_CHKSUM_OFFLOAD_MASK;
- if (bp->dev->features & NETIF_F_TSO)
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, bp->dev->features)) ether_stat->feature_flags |= FEATURE_ETH_LSO_MASK; ether_stat->feature_flags |= bp->common.boot_mode;
@@ -12383,8 +12383,10 @@ static int bnx2x_init_bp(struct bnx2x *bp)
/* Set TPA flags */ if (bp->disable_tpa) {
bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW,
&bp->dev->hw_features);
netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW,
&bp->dev->features);
}
if (CHIP_IS_E1(bp))
@@ -12904,7 +12906,7 @@ static void bnx2x_features_check(struct sk_buff *skb, struct net_device *dev, if (unlikely(skb_is_gso(skb) && (skb_shinfo(skb)->gso_size > 9000) && !skb_gso_validate_mac_len(skb, 9700)))
*features &= ~NETIF_F_GSO_MASK;
netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
vlan_features_check(skb, features); vxlan_features_check(skb, features);
@@ -13241,52 +13243,62 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
dev->priv_flags |= IFF_UNICAST_FLT;
- dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | NETIF_F_GRO_HW |
NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX;
- netdev_feature_zero(&dev->hw_features);
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM | NETIF_F_TSO |
NETIF_F_TSO_ECN | NETIF_F_TSO6 |
NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO |
NETIF_F_GRO_HW | NETIF_F_RXHASH |
if (!chip_is_e1x) {NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features);
dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL;
dev->hw_enc_features =
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL;
dev->gso_partial_features = NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL, &dev->hw_features);
netdev_feature_zero(&dev->hw_enc_features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_SG | NETIF_F_TSO |
NETIF_F_TSO_ECN | NETIF_F_TSO6 |
NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL, &dev->hw_enc_features);
netdev_feature_zero(&dev->gso_partial_features);
netdev_feature_set_bits(NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_UDP_TUNNEL_CSUM,
&dev->gso_partial_features);
if (IS_PF(bp)) dev->udp_tunnel_nic_info = &bnx2x_udp_tunnels; }
- dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
netdev_feature_zero(&dev->vlan_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM | NETIF_F_TSO |
NETIF_F_TSO_ECN | NETIF_F_TSO6 |
NETIF_F_HIGHDMA, &dev->vlan_features);
if (IS_PF(bp)) { if (chip_is_e1x) bp->accept_any_vlan = true; else
dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
} /* For VF we'll know whether to enable VLAN filtering after&dev->hw_features);
*/
- getting a response to CHANNEL_TLV_ACQUIRE from PF.
- dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX;
- dev->features |= NETIF_F_HIGHDMA;
- if (dev->features & NETIF_F_LRO)
dev->features &= ~NETIF_F_GRO_HW;
netdev_feature_or(&dev->features, dev->features, dev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &dev->features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features))
netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features);
/* Add Loopback capability to the device */
- dev->hw_features |= NETIF_F_LOOPBACK;
netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &dev->features);
#ifdef BCM_DCBNL dev->dcbnl_ops = &bnx2x_dcbnl_ops;
@@ -13989,8 +14001,10 @@ static int bnx2x_init_one(struct pci_dev *pdev, #ifdef CONFIG_BNX2X_SRIOV /* VF with OLD Hypervisor or old PF do not support filtering */ if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) {
dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&dev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
} #endif }&dev->features);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 5fa1d3b..3d907bb 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1672,7 +1672,8 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp, skb_set_hash(skb, tpa_info->rss_hash, tpa_info->hash_type);
if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) &&
(skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) {
(netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
__be16 vlan_proto = htons(tpa_info->metadata >> RX_CMP_FLAGS2_METADATA_TPID_SFT); u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_TCI_MASK;skb->dev->features))) {
@@ -1901,7 +1902,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
if ((rxcmp1->rx_cmp_flags2 & cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) &&
(skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) {
netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data); u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_TCI_MASK; __be16 vlan_proto = htons(meta_data >>skb->dev->features)) {
@@ -1917,13 +1919,15 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
skb_checksum_none_assert(skb); if (RX_CMP_L4_CS_OK(rxcmp1)) {
if (dev->features & NETIF_F_RXCSUM) {
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
} } else { if (rxcmp1->rx_cmp_cfa_code_errors_v2 & RX_CMP_L4_CS_ERR_BITS) {dev->features)) { skb->ip_summed = CHECKSUM_UNNECESSARY; skb->csum_level = RX_CMP_ENCAP(rxcmp1);
if (dev->features & NETIF_F_RXCSUM)
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
} }dev->features)) bnapi->cp_ring.sw_stats.rx.rx_l4_csum_errors++;
@@ -3673,9 +3677,10 @@ void bnxt_set_tpa_flags(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_TPA; if (bp->flags & BNXT_FLAG_NO_AGG_RINGS) return;
- if (bp->dev->features & NETIF_F_LRO)
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, bp->dev->features)) bp->flags |= BNXT_FLAG_LRO;
- else if (bp->dev->features & NETIF_F_GRO_HW)
- else if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT,
bp->flags |= BNXT_FLAG_GRO; }bp->dev->features))
@@ -6496,8 +6501,10 @@ 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_feature_clear_bit(NETIF_F_LRO_BIT,
&bp->dev->hw_features);
netdev_feature_clear_bit(NETIF_F_LRO_BIT,
} }&bp->dev->features); bnxt_set_ring_params(bp);
@@ -10221,7 +10228,8 @@ 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_feature_clear_bit(NETIF_F_NTUPLE_BIT,
bp->flags &= ~BNXT_FLAG_RFS; }&bp->dev->hw_features);
@@ -10914,34 +10922,42 @@ static bool bnxt_rfs_capable(struct bnxt *bp) static void bnxt_fix_features(struct net_device *dev, netdev_features_t *features) {
- netdev_features_t vlan_features, tmp; struct bnxt *bp = netdev_priv(dev);
netdev_features_t vlan_features;
if ((*features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
*features &= ~NETIF_F_NTUPLE;
if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) &&
!bnxt_rfs_capable(bp))
netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features);
if (bp->flags & BNXT_FLAG_NO_AGG_RINGS)
*features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW,
features);
- if (!(*features & NETIF_F_GRO))
*features &= ~NETIF_F_GRO_HW;
- if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features))
netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features);
- if (*features & NETIF_F_GRO_HW)
*features &= ~NETIF_F_LRO;
if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features))
netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
/* Both CTAG and STAG VLAN accelaration on the RX side have to be
- turned on or off together.
*/
- vlan_features = *features & BNXT_HW_FEATURE_VLAN_ALL_RX;
- if (vlan_features != BNXT_HW_FEATURE_VLAN_ALL_RX) {
if (dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)
*features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX;
else if (vlan_features)
*features |= BNXT_HW_FEATURE_VLAN_ALL_RX;
- netdev_feature_zero(&tmp);
- netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, &tmp);
- netdev_feature_and(&vlan_features, *features, tmp);
- if (!netdev_feature_equal(vlan_features, tmp)) {
if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
dev->features))
netdev_feature_clear_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
&dev->features);
it should be "features", not "&dev->features"
else if (!netdev_feature_empty(vlan_features))
netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
&dev->features);
it should be "features", not "&dev->features"
} #ifdef CONFIG_BNXT_SRIOV if (BNXT_VF(bp) && bp->vf.vlan)
*features &= ~BNXT_HW_FEATURE_VLAN_ALL_RX;
netdev_feature_clear_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
#endif }features);
@@ -10955,18 +10971,18 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) bool update_tpa = false;
flags &= ~BNXT_FLAG_ALL_CONFIG_FEATS;
- if (features & NETIF_F_GRO_HW)
- if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) flags |= BNXT_FLAG_GRO;
- else if (features & NETIF_F_LRO)
else if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) flags |= BNXT_FLAG_LRO;
if (bp->flags & BNXT_FLAG_NO_AGG_RINGS) flags &= ~BNXT_FLAG_TPA;
- if (features & BNXT_HW_FEATURE_VLAN_ALL_RX)
- if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, features)) flags |= BNXT_FLAG_STRIP_VLAN;
- if (features & NETIF_F_NTUPLE)
if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) flags |= BNXT_FLAG_RFS;
changes = flags ^ bp->flags;
@@ -11129,7 +11145,8 @@ static void bnxt_features_check(struct sk_buff *skb, struct net_device *dev, return; break; }
- *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK,
features);
}
int bnxt_dbg_hwrm_rd_reg(struct bnxt *bp, u32 reg_off, u16 num_words,
@@ -11966,14 +11983,15 @@ 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_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features);
- netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->features); bp->flags &= ~BNXT_FLAG_RFS; if (bnxt_rfs_supported(bp)) {
dev->hw_features |= NETIF_F_NTUPLE;
if (bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS;netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features);
dev->features |= NETIF_F_NTUPLE;
netdev_feature_set_bit(NETIF_F_NTUPLE_BIT,
} } }&dev->features);
@@ -12952,8 +12970,10 @@ static int bnxt_get_dflt_rings(struct bnxt *bp, int *max_rx, int *max_tx, return rc; } bp->flags |= BNXT_FLAG_NO_AGG_RINGS;
bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW,
&bp->dev->hw_features);
netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW,
bnxt_set_ring_params(bp); }&bp->dev->features);
@@ -13068,7 +13088,7 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp) bp->tx_nr_rings_per_tc = bp->tx_nr_rings; if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS;
bp->dev->features |= NETIF_F_NTUPLE;
} init_dflt_ring_err: bnxt_ulp_irq_restart(bp, rc);netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &bp->dev->features);
@@ -13289,37 +13309,46 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) goto init_err_pci_clean; }
- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_PARTIAL | NETIF_F_RXHASH |
NETIF_F_RXCSUM | NETIF_F_GRO;
netdev_feature_zero(&dev->hw_features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_PARTIAL |
NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_GRO,
&dev->hw_features);
if (BNXT_SUPPORTS_TPA(bp))
dev->hw_features |= NETIF_F_LRO;
- dev->hw_enc_features =
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_PARTIAL;
netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features);
- netdev_feature_zero(&dev->hw_enc_features);
- netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 |
dev->udp_tunnel_nic_info = &bnxt_udp_tunnels;NETIF_F_GSO_PARTIAL, &dev->hw_enc_features);
- dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM;
- dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA;
- netdev_feature_zero(&dev->gso_partial_features);
- netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM,
&dev->gso_partial_features);
- netdev_feature_copy(&dev->vlan_features, dev->hw_features);
- netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->vlan_features); if (bp->fw_cap & BNXT_FW_CAP_VLAN_RX_STRIP)
dev->hw_features |= BNXT_HW_FEATURE_VLAN_ALL_RX;
netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT)&dev->hw_features);
dev->hw_features |= BNXT_HW_FEATURE_VLAN_ALL_TX;
netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_TX,
if (BNXT_SUPPORTS_TPA(bp))&dev->hw_features);
dev->hw_features |= NETIF_F_GRO_HW;
- dev->features |= dev->hw_features | NETIF_F_HIGHDMA;
- if (dev->features & NETIF_F_GRO_HW)
dev->features &= ~NETIF_F_LRO;
netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &dev->hw_features);
netdev_feature_or(&dev->features, dev->features, dev->hw_features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, dev->features))
netdev_feature_clear_bit(NETIF_F_LRO_BIT, &dev->features);
dev->priv_flags |= IFF_UNICAST_FLT;
#ifdef CONFIG_BNXT_SRIOV
@@ -13368,7 +13397,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
bnxt_fw_init_one_p3(bp);
- if (dev->hw_features & BNXT_HW_FEATURE_VLAN_ALL_RX)
if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX,
dev->hw_features))
bp->flags |= BNXT_FLAG_STRIP_VLAN;
rc = bnxt_init_int_mode(bp);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 5e4429b..0a3fbb4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -2041,8 +2041,8 @@ int bnxt_init_tc(struct bnxt *bp) goto destroy_decap_table;
tc_info->enabled = true;
- bp->dev->hw_features |= NETIF_F_HW_TC;
- bp->dev->features |= NETIF_F_HW_TC;
netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->features); bp->tc_info = tc_info;
/* init indirect block notifications */
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c index dd66302..b1d4534 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c @@ -464,11 +464,12 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, /* Just inherit all the featues of the parent PF as the VF-R * uses the RX/TX rings of the parent PF */
- dev->hw_features = pf_dev->hw_features;
- dev->gso_partial_features = pf_dev->gso_partial_features;
- dev->vlan_features = pf_dev->vlan_features;
- dev->hw_enc_features = pf_dev->hw_enc_features;
- dev->features |= pf_dev->features;
- netdev_feature_copy(&dev->hw_features, pf_dev->hw_features);
- netdev_feature_copy(&dev->gso_partial_features,
pf_dev->gso_partial_features);
- netdev_feature_copy(&dev->vlan_features, pf_dev->vlan_features);
- netdev_feature_copy(&dev->hw_enc_features, pf_dev->hw_enc_features);
- netdev_feature_copy(&dev->features, pf_dev->features); bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx, dev->perm_addr); ether_addr_copy(dev->dev_addr, dev->perm_addr);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index bee6e09..18cc0e3 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -297,7 +297,8 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog) bnxt_get_max_rings(bp, &rx, &tx, true); if (rx > 1) { bp->flags &= ~BNXT_FLAG_NO_AGG_RINGS;
bp->dev->hw_features |= NETIF_F_LRO;
netdev_feature_set_bit(NETIF_F_LRO_BIT,
} } bp->tx_nr_rings_xdp = tx_xdp;&bp->dev->hw_features);
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 8507198..70cf8be 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2237,7 +2237,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
status = (struct status_64 *)skb->data; dma_length_status = status->length_status;
if (dev->features & NETIF_F_RXCSUM) {
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
dev->features)) { rx_csum = (__force __be16)(status->rx_csum & 0xffff); skb->csum = (__force __wsum)ntohs(rx_csum); skb->ip_summed = CHECKSUM_COMPLETE;
@@ -3955,10 +3956,11 @@ static int bcmgenet_probe(struct platform_device *pdev) priv->msg_enable = netif_msg_init(-1, GENET_MSG_DEFAULT);
/* Set default features */
- dev->features |= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
NETIF_F_RXCSUM;
- dev->hw_features |= dev->features;
- dev->vlan_features |= dev->features;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
NETIF_F_RXCSUM, &dev->features);
netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features);
netdev_feature_or(&dev->vlan_features, dev->vlan_features,
dev->features);
/* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled = true;
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 31b43fe..7abbae3 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -6920,7 +6920,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) tg3_hwclock_to_timestamp(tp, tstamp, skb_hwtstamps(skb));
if ((tp->dev->features & NETIF_F_RXCSUM) &&
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
(desc->type_flags & RXD_FLAG_TCPUDP_CSUM) && (((desc->ip_tcp_csum & RXD_TCPCSUM_MASK) >> RXD_TCPCSUM_SHIFT) == 0xffff))tp->dev->features) &&
@@ -7864,6 +7865,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi, { u32 frag_cnt_est = skb_shinfo(skb)->gso_segs * 3; struct sk_buff *segs, *seg, *next;
netdev_features_t tmp;
/* Estimate the number of fragments in the worst case */ if (unlikely(tg3_tx_avail(tnapi) <= frag_cnt_est)) {
@@ -7881,8 +7883,9 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi, netif_tx_wake_queue(txq); }
- segs = skb_gso_segment(skb, tp->dev->features &
~(NETIF_F_TSO | NETIF_F_TSO6));
- netdev_feature_copy(&tmp, tp->dev->features);
- netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, &tmp);
- segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs) || !segs) goto tg3_tso_bug_end;
@@ -8283,7 +8286,7 @@ static void tg3_set_loopback(struct net_device *dev, netdev_features_t features) { struct tg3 *tp = netdev_priv(dev);
- if (features & NETIF_F_LOOPBACK) {
- if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features)) { if (tp->mac_mode & MAC_MODE_PORT_INT_LPBACK) return;
@@ -8311,14 +8314,16 @@ static void tg3_fix_features(struct net_device *dev, struct tg3 *tp = netdev_priv(dev);
if (dev->mtu > ETH_DATA_LEN && tg3_flag(tp, 5780_CLASS))
*features &= ~NETIF_F_ALL_TSO;
netdev_feature_clear_bits(NETIF_F_ALL_TSO, features);
}
static int tg3_set_features(struct net_device *dev, netdev_features_t features) {
- netdev_features_t changed = dev->features ^ features;
- netdev_features_t changed;
- if ((changed & NETIF_F_LOOPBACK) && netif_running(dev))
netdev_feature_xor(&changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) &&
netif_running(dev))
tg3_set_loopback(dev, features);
return 0;
@@ -11651,7 +11656,7 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq, * Reset loopback feature if it was turned on while the device was down * make sure that it's installed properly now. */
- if (dev->features & NETIF_F_LOOPBACK)
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, dev->features)) tg3_set_loopback(dev, dev->features);
return 0;
@@ -17612,7 +17617,9 @@ static int tg3_init_one(struct pci_dev *pdev, u32 sndmbx, rcvmbx, intmbx; char str[40]; u64 dma_mask, persist_dma_mask;
- netdev_features_t features = 0;
netdev_features_t features;
netdev_feature_zero(&features);
err = pci_enable_device(pdev); if (err) {
@@ -17755,7 +17762,7 @@ static int tg3_init_one(struct pci_dev *pdev, if (dma_mask > DMA_BIT_MASK(32)) { err = pci_set_dma_mask(pdev, dma_mask); if (!err) {
features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &features); err = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (err < 0) {
@@ -17780,10 +17787,12 @@ static int tg3_init_one(struct pci_dev *pdev, * to hardware bugs. */ if (tg3_chip_rev_id(tp) != CHIPREV_ID_5700_B0) {
features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_RXCSUM, &features);
if (tg3_flag(tp, 5755_PLUS))
features |= NETIF_F_IPV6_CSUM;
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
&features);
}
/* TSO is on by default on chips that support hardware TSO.
@@ -17793,23 +17802,24 @@ static int tg3_init_one(struct pci_dev *pdev, if ((tg3_flag(tp, HW_TSO_1) || tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) &&
(features & NETIF_F_IP_CSUM))
features |= NETIF_F_TSO;
netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features))
if (tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) {netdev_feature_set_bit(NETIF_F_TSO_BIT, &features);
if (features & NETIF_F_IPV6_CSUM)
features |= NETIF_F_TSO6;
if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features))
if (tg3_flag(tp, HW_TSO_3) || tg3_asic_rev(tp) == ASIC_REV_5761 || (tg3_asic_rev(tp) == ASIC_REV_5784 && tg3_chip_rev(tp) != CHIPREV_5784_AX) || tg3_asic_rev(tp) == ASIC_REV_5785 || tg3_asic_rev(tp) == ASIC_REV_57780)netdev_feature_set_bit(NETIF_F_TSO6_BIT, &features);
features |= NETIF_F_TSO_ECN;
}netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &features);
- dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
- dev->vlan_features |= features;
netdev_feature_or(&dev->features, dev->features, features);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX, &dev->features);
netdev_feature_or(&dev->vlan_features, dev->vlan_features, features);
/*
- Add loopback capability only for a subset of devices that support
@@ -17819,9 +17829,9 @@ static int tg3_init_one(struct pci_dev *pdev, if (tg3_asic_rev(tp) != ASIC_REV_5780 && !tg3_flag(tp, CPMU_PRESENT)) /* Add the loopback capability */
features |= NETIF_F_LOOPBACK;
netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &features);
- dev->hw_features |= features;
netdev_feature_or(&dev->hw_features, dev->hw_features, features); dev->priv_flags |= IFF_UNICAST_FLT;
/* MTU range: 60 - 9000 or 1500, depending on hardware */
@@ -17956,7 +17966,7 @@ static int tg3_init_one(struct pci_dev *pdev, }
netdev_info(dev, "RXcsums[%d] LinkChgREG[%d] MIirq[%d] ASF[%d] TSOcap[%d]\n",
(dev->features & NETIF_F_RXCSUM) != 0,
tg3_flag(tp, USE_LINKCHG_REG) != 0, (tp->phy_flags & TG3_PHYFLG_USE_MI_INTERRUPT) != 0, tg3_flag(tp, ENABLE_ASF) != 0,netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features),
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/intel/e100.c | 26 +-- drivers/net/ethernet/intel/e1000/e1000_main.c | 76 +++++---- drivers/net/ethernet/intel/e1000e/netdev.c | 123 ++++++++------ drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 57 ++++--- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 11 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 109 +++++++----- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 134 +++++++++------ drivers/net/ethernet/intel/iavf/iavf_txrx.c | 12 +- drivers/net/ethernet/intel/ice/ice_main.c | 158 +++++++++++------- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 9 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 129 ++++++++------ drivers/net/ethernet/intel/igbvf/netdev.c | 71 ++++---- drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 +- drivers/net/ethernet/intel/igc/igc_main.c | 101 ++++++----- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 43 +++-- drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 7 +- drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 194 +++++++++++++--------- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 6 +- drivers/net/ethernet/intel/ixgbevf/ipsec.c | 9 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 90 ++++++---- 26 files changed, 845 insertions(+), 551 deletions(-)
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 373eb02..abec49f 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -1114,7 +1114,8 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) config->promiscuous_mode = 0x1; /* 1=on, 0=off */ }
- if (unlikely(netdev->features & NETIF_F_RXFCS)) + if (unlikely(netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features))) config->rx_crc_transfer = 0x1; /* 1=save, 0=discard */
if (nic->flags & multicast_all) @@ -1141,7 +1142,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) } }
- if (netdev->features & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, netdev->features)) { config->rx_save_overruns = 0x1; /* 1=save, 0=discard */ config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */ config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */ @@ -1990,7 +1991,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, }
/* Get actual data size */ - if (unlikely(dev->features & NETIF_F_RXFCS)) + if (unlikely(netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + dev->features))) fcs_pad = 4; actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF; if (unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd))) @@ -2021,7 +2023,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, /* If we are receiving all frames, then don't bother * checking for errors. */ - if (unlikely(dev->features & NETIF_F_RXALL)) { + if (unlikely(netdev_feature_test_bit(NETIF_F_RXALL_BIT, + dev->features))) { if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN + fcs_pad) /* Received oversized frame, but keep it. */ nic->rx_over_length_errors++; @@ -2792,12 +2795,14 @@ static int e100_set_features(struct net_device *netdev, netdev_features_t features) { struct nic *nic = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (!(changed & (NETIF_F_RXFCS | NETIF_F_RXALL))) + netdev_feature_xor(&changed, features, netdev->features); + + if (!netdev_feature_test_bits(NETIF_F_RXFCS | NETIF_F_RXALL, changed)) return 0;
- netdev->features = features; + netdev_feature_copy(&netdev->features, features); e100_exec_cb(nic, NULL, e100_configure); return 1; } @@ -2826,9 +2831,9 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (!(netdev = alloc_etherdev(sizeof(struct nic)))) return -ENOMEM;
- netdev->hw_features |= NETIF_F_RXFCS; + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS; - netdev->hw_features |= NETIF_F_RXALL; + netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features);
netdev->netdev_ops = &e100_netdev_ops; netdev->ethtool_ops = &e100_ethtool_ops; @@ -2885,7 +2890,8 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* D100 MAC doesn't allow rx of vlan packets with normal MTU */ if (nic->mac < mac_82558_D101_A4) - netdev->features |= NETIF_F_VLAN_CHALLENGED; + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, + &netdev->features);
/* locks must be initialized before calling hw_reset */ spin_lock_init(&nic->cb_lock); diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index e333ca1..f17057a 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -793,26 +793,30 @@ static void e1000_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int e1000_set_features(struct net_device *netdev, netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, features, netdev->features); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) e1000_vlan_mode(netdev, features);
- if (!(changed & (NETIF_F_RXCSUM | NETIF_F_RXALL))) + if (!netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_RXALL, changed)) return 0;
- netdev->features = features; - adapter->rx_csum = !!(features & NETIF_F_RXCSUM); + netdev_feature_copy(&netdev->features, features); + adapter->rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + features);
if (netif_running(netdev)) e1000_reinit_locked(adapter); @@ -1033,32 +1037,40 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }
if (hw->mac_type >= e1000_82543) { - netdev->hw_features = NETIF_F_SG | - NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_CTAG_RX; - netdev->features = NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->hw_features); + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &netdev->features); }
if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_82547)) - netdev->hw_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
- netdev->features |= netdev->hw_features; - netdev->hw_features |= (NETIF_F_RXCSUM | + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_RXALL | - NETIF_F_RXFCS); + NETIF_F_RXFCS, + &netdev->hw_features);
if (pci_using_dac) { - netdev->features |= NETIF_F_HIGHDMA; - netdev->vlan_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->vlan_features); }
- netdev->vlan_features |= (NETIF_F_TSO | - NETIF_F_HW_CSUM | - NETIF_F_SG); + netdev_feature_set_bits(NETIF_F_TSO | + NETIF_F_TSO | + NETIF_F_SG, + &netdev->vlan_features);
/* Do not set IFF_UNICAST_FLT for VMWare's 82545EM */ if (hw->device_id != E1000_DEV_ID_82545EM_COPPER || @@ -1822,7 +1834,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) }
/* This is useful for sniffing bad packets. */ - if (adapter->netdev->features & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, + adapter->netdev->features)) { /* UPE and MPE will be handled by normal PROMISC logic * in e1000e_set_rx_mode */ @@ -4176,7 +4189,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, rx_desc->errors, length, mapped)) { length--; - } else if (netdev->features & NETIF_F_RXALL) { + } else if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)) { goto process_skb; } else { /* an error means any chain goes out the window @@ -4227,7 +4241,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, if (length <= copybreak) { u8 *vaddr;
- if (likely(!(netdev->features & NETIF_F_RXFCS))) + if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features))) length -= 4; skb = e1000_alloc_rx_skb(adapter, length); @@ -4273,7 +4288,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, le16_to_cpu(rx_desc->csum), skb);
total_rx_bytes += (skb->len - 4); /* don't count FCS */ - if (likely(!(netdev->features & NETIF_F_RXFCS))) + if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features))) pskb_trim(skb, skb->len - 4); total_rx_packets++;
@@ -4428,7 +4444,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, rx_desc->errors, length, data)) { length--; - } else if (netdev->features & NETIF_F_RXALL) { + } else if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)) { goto process_skb; } else { dev_kfree_skb(skb); @@ -4440,7 +4457,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, total_rx_bytes += (length - 4); /* don't count FCS */ total_rx_packets++;
- if (likely(!(netdev->features & NETIF_F_RXFCS))) + if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features))) /* adjust length to remove Ethernet CRC, this must be * done after the TBI_ACCEPT workaround above */ @@ -4888,7 +4906,7 @@ static void __e1000_vlan_mode(struct e1000_adapter *adapter, u32 ctrl;
ctrl = er32(CTRL); - if (features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) { /* enable VLAN tag insert/strip */ ctrl |= E1000_CTRL_VME; } else { diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 5dd183e..a299f27 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -576,7 +576,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, skb_checksum_none_assert(skb);
/* Rx checksum disabled */ - if (!(adapter->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + adapter->netdev->features)) return;
/* Ignore Checksum bit is set */ @@ -894,7 +895,7 @@ static void e1000_alloc_jumbo_rx_buffers(struct e1000_ring *rx_ring, static inline void e1000_rx_hash(struct net_device *netdev, __le32 rss, struct sk_buff *skb) { - if (netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) skb_set_hash(skb, le32_to_cpu(rss), PKT_HASH_TYPE_L3); }
@@ -976,7 +977,8 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, }
if (unlikely((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) && - !(netdev->features & NETIF_F_RXALL))) { + !netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features))) { /* recycle */ buffer_info->skb = skb; goto next_desc; @@ -988,7 +990,8 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, * but keep the FCS bytes out of the total_rx_bytes * counter */ - if (netdev->features & NETIF_F_RXFCS) + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features)) total_rx_bytes -= 4; else length -= 4; @@ -1362,7 +1365,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done, }
if (unlikely((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) && - !(netdev->features & NETIF_F_RXALL))) { + !netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features))) { dev_kfree_skb_irq(skb); goto next_desc; } @@ -1413,7 +1417,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done,
/* remove the CRC */ if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) { - if (!(netdev->features & NETIF_F_RXFCS)) + if (!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features)) l1 -= 4; }
@@ -1442,7 +1447,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done, * this whole operation can get a little cpu intensive */ if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) { - if (!(netdev->features & NETIF_F_RXFCS)) + if (!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features)) pskb_trim(skb, skb->len - 4); }
@@ -1557,7 +1563,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done, /* errors is only valid for DD + EOP descriptors */ if (unlikely((staterr & E1000_RXD_STAT_EOP) && ((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) && - !(netdev->features & NETIF_F_RXALL)))) { + !netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)))) { /* recycle both page and skb */ buffer_info->skb = skb; /* an error means any chain goes out the window too */ @@ -3165,7 +3172,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) }
/* This is useful for sniffing bad packets. */ - if (adapter->netdev->features & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, + adapter->netdev->features)) { /* UPE and MPE will be handled by normal PROMISC logic * in e1000e_set_rx_mode */ @@ -3270,7 +3278,8 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
/* Enable Receive Checksum Offload for TCP and UDP */ rxcsum = er32(RXCSUM); - if (adapter->netdev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + adapter->netdev->features)) rxcsum |= E1000_RXCSUM_TUOFL; else rxcsum &= ~E1000_RXCSUM_TUOFL; @@ -3451,7 +3460,8 @@ static void e1000e_set_rx_mode(struct net_device *netdev)
ew32(RCTL, rctl);
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) e1000e_vlan_strip_enable(adapter); else e1000e_vlan_strip_disable(adapter); @@ -3765,7 +3775,8 @@ static void e1000_configure(struct e1000_adapter *adapter)
e1000_configure_tx(adapter);
- if (adapter->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + adapter->netdev->features)) e1000e_setup_rss_hash(adapter); e1000_setup_rctl(adapter); e1000_configure_rx(adapter); @@ -5304,20 +5315,26 @@ static void e1000_watchdog_task(struct work_struct *work) case SPEED_10: case SPEED_100: e_info("10/100 speed: disabling TSO\n"); - netdev->features &= ~NETIF_F_TSO; - netdev->features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, + &netdev->features); + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, + &netdev->features); break; case SPEED_1000: - netdev->features |= NETIF_F_TSO; - netdev->features |= NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, + &netdev->features); + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, + &netdev->features); break; default: /* oops */ break; } if (hw->mac.type == e1000_pch_spt) { - netdev->features &= ~NETIF_F_TSO; - netdev->features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, + &netdev->features); + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, + &netdev->features); } }
@@ -7295,33 +7312,38 @@ static void 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_clear_bit(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. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int e1000_set_features(struct net_device *netdev, netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (changed & (NETIF_F_TSO | NETIF_F_TSO6)) + netdev_feature_xor(&changed, features, netdev->features); + + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, changed)) adapter->flags |= FLAG_TSO_FORCE;
- if (!(changed & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_RXFCS | - NETIF_F_RXALL))) + if (!netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXCSUM | + NETIF_F_RXHASH | NETIF_F_RXFCS | + NETIF_F_RXALL | NETIF_F_HW_VLAN_CTAG_RX, + changed)) return 0;
- if (changed & NETIF_F_RXFCS) { - if (features & NETIF_F_RXFCS) { + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, features)) { adapter->flags2 &= ~FLAG2_CRC_STRIPPING; } else { /* We need to take it back to defaults, which might mean @@ -7334,7 +7356,7 @@ static int e1000_set_features(struct net_device *netdev, } }
- netdev->features = features; + netdev_feature_copy(&netdev->features, features);
if (netif_running(netdev)) e1000e_reinit_locked(adapter); @@ -7524,34 +7546,39 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) "PHY reset is blocked due to SOL/IDER session.\n");
/* Set initial default active device features */ - netdev->features = (NETIF_F_SG | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_RXHASH | - NETIF_F_RXCSUM | - NETIF_F_HW_CSUM); + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_RXHASH | + NETIF_F_RXCSUM | + NETIF_F_HW_CSUM, + &netdev->features);
/* Set user-changeable features (subset of all device features) */ - netdev->hw_features = netdev->features; - netdev->hw_features |= NETIF_F_RXFCS; + netdev_feature_copy(&netdev->hw_features, netdev->features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS; - netdev->hw_features |= NETIF_F_RXALL; + netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features);
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features);
- netdev->vlan_features |= (NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_HW_CSUM); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_HW_CSUM, + &netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT;
if (pci_using_dac) { - netdev->features |= NETIF_F_HIGHDMA; - netdev->vlan_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->vlan_features); }
/* MTU range: 68 - max_hw_frame_size */ diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c index 3362f26..ed2871d 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c @@ -352,7 +352,8 @@ static inline void fm10k_rx_checksum(struct fm10k_ring *ring, skb_checksum_none_assert(skb);
/* Rx checksum disabled via ethtool */ - if (!(ring->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + ring->netdev->features)) return;
/* TCP/UDP checksum error bit is set */ @@ -388,7 +389,8 @@ static inline void fm10k_rx_hash(struct fm10k_ring *ring, { u16 rss_type;
- if (!(ring->netdev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) return;
rss_type = le16_to_cpu(rx_desc->w.pkt_info) & FM10K_RXD_RSSTYPE_MASK; @@ -772,7 +774,8 @@ static int fm10k_tso(struct fm10k_ring *tx_ring, return 1;
err_vxlan: - tx_ring->netdev->features &= ~NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_clear_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &tx_ring->netdev->features); if (net_ratelimit()) netdev_err(tx_ring->netdev, "TSO requested for unsupported tunnel, disabling offload\n"); diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c index a311bcd..e3747f3 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c @@ -1510,7 +1510,8 @@ static void fm10k_features_check(struct sk_buff *skb, struct net_device *dev, if (!skb->encapsulation || fm10k_tx_encap_offload(skb)) return;
- *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
static const struct net_device_ops fm10k_netdev_ops = { @@ -1556,50 +1557,56 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) interface->msg_enable = BIT(DEFAULT_DEBUG_LEVEL_SHIFT) - 1;
/* configure default features */ - dev->features |= NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | - NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_TSO_ECN | - NETIF_F_RXHASH | - NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_TSO_ECN | + NETIF_F_RXHASH | + NETIF_F_RXCSUM, + &dev->features);
/* Only the PF can support VXLAN and NVGRE tunnel offloads */ if (info->mac == fm10k_mac_pf) { - dev->hw_enc_features = NETIF_F_IP_CSUM | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_TSO_ECN | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_IPV6_CSUM | - NETIF_F_SG; - - dev->features |= NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_TSO_ECN | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_IPV6_CSUM | + NETIF_F_SG, + &dev->hw_enc_features); + + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &dev->features);
dev->udp_tunnel_nic_info = &fm10k_udp_tunnels; }
/* all features defined to this point should be changeable */ - hw_features = dev->features; + netdev_feature_copy(&hw_features, dev->features);
/* allow user to enable L2 forwarding acceleration */ - hw_features |= NETIF_F_HW_L2FW_DOFFLOAD; + netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, &hw_features);
/* configure VLAN features */ - dev->vlan_features |= dev->features; + netdev_feature_or(&dev->vlan_features, dev->vlan_features, + dev->features);
/* we want to leave these both on as we cannot disable VLAN tag * insertion or stripping on the hardware since it is contained * in the FTAG and not in the frame itself. */ - dev->features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &dev->features);
dev->priv_flags |= IFF_UNICAST_FLT;
- dev->hw_features |= hw_features; + netdev_feature_or(&dev->hw_features, dev->hw_features, + hw_features);
/* MTU range: 68 - 15342 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c index adfa276..48c1206 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c @@ -305,9 +305,11 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface) }
if (hw->mac.vlan_override) - netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->features); else - netdev->features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->features); }
err = netif_running(netdev) ? fm10k_open(netdev) : 0; @@ -2010,8 +2012,9 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
/* update netdev with DMA restrictions */ if (dma_get_mask(&pdev->dev) > DMA_BIT_MASK(32)) { - netdev->features |= NETIF_F_HIGHDMA; - netdev->vlan_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->vlan_features); }
/* reset and initialize the hardware so it is in a known state */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index e493c5a..fd81fd0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -2962,7 +2962,8 @@ static void i40e_restore_vlan(struct i40e_vsi *vsi) if (!vsi->netdev) return;
- if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + vsi->netdev->features)) i40e_vlan_stripping_enable(vsi); else i40e_vlan_stripping_disable(vsi); @@ -12541,7 +12542,7 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features) /* Check if Flow Director n-tuple support was enabled or disabled. If * the state changed, we need to reset. */ - if (features & NETIF_F_NTUPLE) { + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) { /* Enable filters and mark for reset */ if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) need_reset = true; @@ -12610,24 +12611,27 @@ static int i40e_set_features(struct net_device *netdev, struct i40e_pf *pf = vsi->back; bool need_reset;
- if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH)) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && + !netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) i40e_pf_config_rss(pf); - else if (!(features & NETIF_F_RXHASH) && - netdev->features & NETIF_F_RXHASH) + else if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && + netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) i40e_clear_rss_lut(vsi);
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) i40e_vlan_stripping_enable(vsi); else i40e_vlan_stripping_disable(vsi);
- if (!(features & NETIF_F_HW_TC) && pf->num_cloud_filters) { + if (!netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && + pf->num_cloud_filters) { dev_err(&pf->pdev->dev, "Offloaded tc filters active, can't turn hw_tc_offload off"); return -EINVAL; }
- if (!(features & NETIF_F_HW_L2FW_DOFFLOAD) && vsi->macvlan_cnt) + if (!netdev_feature_test_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, features) && + vsi->macvlan_cnt) i40e_del_all_macvlans(vsi);
need_reset = i40e_set_ntuple(pf, features); @@ -12889,7 +12893,7 @@ static void i40e_features_check(struct sk_buff *skb, struct net_device *dev, * 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; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
/* MACLEN can support at most 63 words */ len = skb_network_header(skb) - skb->data; @@ -12921,7 +12925,8 @@ static void i40e_features_check(struct sk_buff *skb, struct net_device *dev,
return; out_err: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
/** @@ -13324,53 +13329,71 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) np = netdev_priv(netdev); np->vsi = vsi;
- hw_enc_features = NETIF_F_SG | - NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | - NETIF_F_HIGHDMA | - NETIF_F_SOFT_FEATURES | - NETIF_F_TSO | - NETIF_F_TSO_ECN | - NETIF_F_TSO6 | - NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_PARTIAL | - NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_IPXIP6 | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_UDP_L4 | - NETIF_F_SCTP_CRC | - NETIF_F_RXHASH | - NETIF_F_RXCSUM | - 0; + netdev_feature_zero(&hw_enc_features); + netdev_feature_set_bits(NETIF_F_SG_BIT | + NETIF_F_IP_CSUM_BIT | + NETIF_F_IPV6_CSUM_BIT | + NETIF_F_HIGHDMA_BIT | + NETIF_F_GSO_BIT | + NETIF_F_GRO_BIT | + NETIF_F_TSO_BIT | + NETIF_F_TSO_ECN_BIT | + NETIF_F_TSO6_BIT | + NETIF_F_GSO_GRE_BIT | + NETIF_F_GSO_GRE_CSUM_BIT | + NETIF_F_GSO_PARTIAL_BIT | + NETIF_F_GSO_IPXIP4_BIT | + NETIF_F_GSO_IPXIP6_BIT | + NETIF_F_GSO_UDP_TUNNEL_BIT | + NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT | + NETIF_F_GSO_UDP_L4_BIT | + NETIF_F_SCTP_CRC_BIT | + NETIF_F_RXHASH_BIT | + NETIF_F_RXCSUM_BIT, + &hw_enc_features);
if (!(pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE)) - netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, + &netdev->gso_partial_features);
netdev->udp_tunnel_nic_info = &pf->udp_tunnel_nic;
- netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; + netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, + &netdev->gso_partial_features);
- netdev->hw_enc_features |= hw_enc_features; + netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + hw_enc_features);
/* record features VLANs can make use of */ - netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + hw_enc_features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->vlan_features);
/* enable macvlan offloads */ - netdev->hw_features |= NETIF_F_HW_L2FW_DOFFLOAD; + netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, + &netdev->hw_features);
- hw_features = hw_enc_features | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_copy(&hw_features, hw_enc_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &hw_features);
- if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) - hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC; + if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) { + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features); + }
- netdev->hw_features |= hw_features; + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + hw_features);
- netdev->features |= hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; - netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID; + netdev_feature_or(&netdev->features, netdev->features, + hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->hw_enc_features);
if (vsi->type == I40E_VSI_MAIN) { SET_NETDEV_DEV(netdev, &pf->pdev->dev); diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 3f25bd8..ee5fbd5 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1793,7 +1793,8 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, skb_checksum_none_assert(skb);
/* Rx csum enabled and ip headers found? */ - if (!(vsi->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + vsi->netdev->features)) return;
/* did the hardware decode the packet and checksum? */ @@ -1895,7 +1896,8 @@ static inline void i40e_rx_hash(struct i40e_ring *ring, cpu_to_le64((u64)I40E_RX_DESC_FLTSTAT_RSS_HASH << I40E_RX_DESC_STATUS_FLTSTAT_SHIFT);
- if (!(ring->netdev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) return;
if ((rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask) { @@ -2944,7 +2946,8 @@ static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, u32 tx_flags = 0;
if (protocol == htons(ETH_P_8021Q) && - !(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) { + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + tx_ring->netdev->features)) { /* When HW VLAN acceleration is turned off by the user the * stack sets the protocol to 8021q so that the driver * can take any steps required to support the SW only diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index e46395a0..f4d89e6 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -1897,7 +1897,7 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) err); } dev_info(&pdev->dev, "MAC address: %pM\n", adapter->hw.mac.addr); - if (netdev->features & NETIF_F_GRO) + if (netdev_feature_test_bit( NETIF_F_GRO_BIT, netdev->features)) dev_info(&pdev->dev, "GRO is enabled\n");
adapter->state = __IAVF_DOWN; @@ -3359,15 +3359,20 @@ static int iavf_set_features(struct net_device *netdev, netdev_features_t features) { struct iavf_adapter *adapter = netdev_priv(netdev); + netdev_features_t changed;
+ netdev_feature_xor(&changed, netdev->features, features); /* Don't allow changing VLAN_RX flag when adapter is not capable * of VLAN offload */ if (!VLAN_ALLOWED(adapter)) { - if ((netdev->features ^ features) & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + changed)) return -EINVAL; - } else if ((netdev->features ^ features) & NETIF_F_HW_VLAN_CTAG_RX) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) + } else if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + changed)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) adapter->aq_required |= IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING; else @@ -3400,7 +3405,7 @@ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, * 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; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
/* MACLEN can support at most 63 words */ len = skb_network_header(skb) - skb->data; @@ -3432,7 +3437,8 @@ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev,
return; out_err: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
/** @@ -3448,9 +3454,10 @@ static void iavf_fix_features(struct net_device *netdev, struct iavf_adapter *adapter = netdev_priv(netdev);
if (!(adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)) - *features &= ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + features); }
static const struct net_device_ops iavf_netdev_ops = { @@ -3535,84 +3542,103 @@ int iavf_process_config(struct iavf_adapter *adapter) } adapter->num_req_queues = 0;
- hw_enc_features = NETIF_F_SG | - NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | - NETIF_F_HIGHDMA | - NETIF_F_SOFT_FEATURES | - NETIF_F_TSO | - NETIF_F_TSO_ECN | - NETIF_F_TSO6 | - NETIF_F_SCTP_CRC | - NETIF_F_RXHASH | - NETIF_F_RXCSUM | - 0; + netdev_feature_zero(&hw_enc_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_HIGHDMA | + NETIF_F_SOFT_FEATURES | + NETIF_F_TSO | + NETIF_F_TSO_ECN | + NETIF_F_TSO6 | + NETIF_F_SCTP_CRC | + NETIF_F_RXHASH | + NETIF_F_RXCSUM, + &hw_enc_features);
/* advertise to stack only if offloads for encapsulated packets is * supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ENCAP) { - hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_IPXIP6 | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL | - 0; + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM | + NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_IPXIP6 | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL, + &hw_enc_features);
if (!(vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM)) - netdev->gso_partial_features |= - NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, + &netdev->gso_partial_features);
- netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; - netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID; - netdev->hw_enc_features |= hw_enc_features; + netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, + &netdev->gso_partial_features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->hw_enc_features); + netdev_feature_or(&netdev->hw_enc_features, + netdev->hw_enc_features, hw_enc_features); } /* record features VLANs can make use of */ - netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID; + netdev_feature_or(&netdev->vlan_features, + netdev->vlan_features, hw_enc_features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->vlan_features);
/* Write features and hw_features separately to avoid polluting * with, or dropping, features that are set when we registered. */ - hw_features = hw_enc_features; + netdev_feature_copy(&hw_features, hw_enc_features);
/* Enable VLAN features if supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) - hw_features |= (NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &hw_features); /* Enable cloud filter if ADQ is supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) - hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features); if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_USO) - hw_features |= NETIF_F_GSO_UDP_L4; + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &hw_features);
- netdev->hw_features |= hw_features; + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + hw_features);
- netdev->features |= hw_features; + netdev_feature_or(&netdev->features, netdev->features, hw_features);
if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
/* Do not turn on offloads when they are requested to be turned off. * TSO needs minimum 576 bytes to work correctly. */ - if (netdev->wanted_features) { - if (!(netdev->wanted_features & NETIF_F_TSO) || + if (!netdev_feature_empty(netdev->wanted_features)) { + if (!netdev_feature_test_bit(NETIF_F_TSO_BIT, + netdev->wanted_features) || netdev->mtu < 576) - netdev->features &= ~NETIF_F_TSO; - if (!(netdev->wanted_features & NETIF_F_TSO6) || + netdev_feature_clear_bit(NETIF_F_TSO_BIT, + &netdev->features); + if (!netdev_feature_test_bit(NETIF_F_TSO6_BIT, + netdev->wanted_features) || netdev->mtu < 576) - netdev->features &= ~NETIF_F_TSO6; - if (!(netdev->wanted_features & NETIF_F_TSO_ECN)) - netdev->features &= ~NETIF_F_TSO_ECN; - if (!(netdev->wanted_features & NETIF_F_GRO)) - netdev->features &= ~NETIF_F_GRO; - if (!(netdev->wanted_features & NETIF_F_GSO)) - netdev->features &= ~NETIF_F_GSO; + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, + &netdev->features); + if (!netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, + netdev->wanted_features)) + netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, + &netdev->features); + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, + netdev->wanted_features)) + netdev_feature_clear_bit(NETIF_F_GRO_BIT, + &netdev->features); + if (!netdev_feature_test_bit(NETIF_F_GSO_BIT, + netdev->wanted_features)) + netdev_feature_clear_bit(NETIF_F_GSO_BIT, + &netdev->features); }
adapter->vsi.id = adapter->vsi_res->vsi_id; diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c index 3525eab..2293ad26 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -862,7 +862,8 @@ static void iavf_receive_skb(struct iavf_ring *rx_ring, { struct iavf_q_vector *q_vector = rx_ring->q_vector;
- if ((rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + rx_ring->netdev->features) && (vlan_tag & VLAN_VID_MASK)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
@@ -963,7 +964,8 @@ static inline void iavf_rx_checksum(struct iavf_vsi *vsi, skb_checksum_none_assert(skb);
/* Rx csum enabled and ip headers found? */ - if (!(vsi->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + vsi->netdev->features)) return;
/* did the hardware decode the packet and checksum? */ @@ -1058,7 +1060,8 @@ static inline void iavf_rx_hash(struct iavf_ring *ring, cpu_to_le64((u64)IAVF_RX_DESC_FLTSTAT_RSS_HASH << IAVF_RX_DESC_STATUS_FLTSTAT_SHIFT);
- if (ring->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) return;
if ((rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask) { @@ -1789,7 +1792,8 @@ static inline int iavf_tx_prepare_vlan_flags(struct sk_buff *skb, u32 tx_flags = 0;
if (protocol == htons(ETH_P_8021Q) && - !(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) { + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + tx_ring->netdev->features)) { /* When HW VLAN acceleration is turned off by the user the * stack sets the protocol to 8021q so that the driver * can take any steps required to support the SW only diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 54cb9af..dd9332a 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3053,53 +3053,74 @@ static void ice_set_netdev_features(struct net_device *netdev)
if (ice_is_safe_mode(pf)) { /* safe mode */ - netdev->features = NETIF_F_SG | NETIF_F_HIGHDMA; - netdev->hw_features = netdev->features; + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, + &netdev->features); + netdev_feature_copy(&netdev->hw_features, netdev->features); return; }
- dflt_features = NETIF_F_SG | - NETIF_F_HIGHDMA | - NETIF_F_NTUPLE | - NETIF_F_RXHASH; - - csumo_features = NETIF_F_RXCSUM | - NETIF_F_IP_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_IPV6_CSUM; - - vlano_features = NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - - tso_features = NETIF_F_TSO | - NETIF_F_TSO_ECN | - NETIF_F_TSO6 | - NETIF_F_GSO_GRE | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL | - NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_IPXIP6 | - NETIF_F_GSO_UDP_L4; - - netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_GRE_CSUM; + netdev_feature_zero(&dflt_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_HIGHDMA | + NETIF_F_NTUPLE | + NETIF_F_RXHASH, + &dflt_features); + + netdev_feature_zero(&csumo_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | + NETIF_F_IP_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_IPV6_CSUM, + &csumo_features); + + netdev_feature_zero(&vlano_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &vlano_features); + + netdev_feature_zero(&tso_features); + netdev_feature_set_bits(NETIF_F_TSO | + NETIF_F_TSO_ECN | + NETIF_F_TSO6 | + NETIF_F_GSO_GRE | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_GRE_CSUM | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL | + NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_IPXIP6 | + NETIF_F_GSO_UDP_L4, + &tso_features); + + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_GRE_CSUM, + &netdev->gso_partial_features); /* set features that user can change */ - netdev->hw_features = dflt_features | csumo_features | - vlano_features | tso_features; + netdev_feature_or(&netdev->hw_features, dflt_features, + csumo_features); + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + vlano_features); + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + tso_features);
/* add support for HW_CSUM on packets with MPLS header */ - netdev->mpls_features = NETIF_F_HW_CSUM; + netdev_feature_zero(&netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features);
/* enable features */ - netdev->features |= netdev->hw_features; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); /* encap and VLAN devices inherit default, csumo and tso features */ - netdev->hw_enc_features |= dflt_features | csumo_features | - tso_features; - netdev->vlan_features |= dflt_features | csumo_features | - tso_features; + netdev_feature_or(&netdev->hw_enc_features, dflt_features, + csumo_features); + netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + tso_features); + netdev_feature_or(&netdev->vlan_features, dflt_features, + csumo_features); + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + tso_features); }
/** @@ -5341,39 +5362,51 @@ ice_set_features(struct net_device *netdev, netdev_features_t features) /* Multiple features can be changed in one call so keep features in * separate if/else statements to guarantee each feature is checked */ - if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH)) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && + !netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) ice_vsi_manage_rss_lut(vsi, true); - else if (!(features & NETIF_F_RXHASH) && - netdev->features & NETIF_F_RXHASH) + else if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && + netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) ice_vsi_manage_rss_lut(vsi, false);
- if ((features & NETIF_F_HW_VLAN_CTAG_RX) && - !(netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) && + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) ret = ice_vsi_manage_vlan_stripping(vsi, true); - else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) && - (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) + else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features) && + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) ret = ice_vsi_manage_vlan_stripping(vsi, false);
- if ((features & NETIF_F_HW_VLAN_CTAG_TX) && - !(netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features) && + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + netdev->features)) ret = ice_vsi_manage_vlan_insertion(vsi); - else if (!(features & NETIF_F_HW_VLAN_CTAG_TX) && - (netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) + else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features) && + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + netdev->features)) ret = ice_vsi_manage_vlan_insertion(vsi);
- if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) && - !(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features) && + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + netdev->features)) ret = ice_cfg_vlan_pruning(vsi, true, false); - else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && - (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features) && + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + netdev->features)) ret = ice_cfg_vlan_pruning(vsi, false, false);
- if ((features & NETIF_F_NTUPLE) && - !(netdev->features & NETIF_F_NTUPLE)) { + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) && + !netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->features)) { ice_vsi_manage_fdir(vsi, true); ice_init_arfs(vsi); - } else if (!(features & NETIF_F_NTUPLE) && - (netdev->features & NETIF_F_NTUPLE)) { + } else if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) && + netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + netdev->features)) { ice_vsi_manage_fdir(vsi, false); ice_clear_arfs(vsi); } @@ -5389,9 +5422,11 @@ static int ice_vsi_vlan_setup(struct ice_vsi *vsi) { int ret = 0;
- if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + vsi->netdev->features)) ret = ice_vsi_manage_vlan_stripping(vsi, true); - if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + vsi->netdev->features)) ret = ice_vsi_manage_vlan_insertion(vsi);
return ret; @@ -7179,7 +7214,7 @@ static void ice_features_check(struct sk_buff *skb, * 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; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
len = skb_network_header(skb) - skb->data; if (len > ICE_TXD_MACLEN_MAX || len & 0x1) @@ -7202,7 +7237,8 @@ static void ice_features_check(struct sk_buff *skb,
return; out_rm_features: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
static const struct net_device_ops ice_netdev_safe_mode_ops = { diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 171397d..6ab2c65 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -72,7 +72,8 @@ ice_rx_hash(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc, struct ice_32b_rx_flex_desc_nic *nic_mdid; u32 hash;
- if (!(rx_ring->netdev->features & NETIF_F_RXHASH)) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + rx_ring->netdev->features)) return;
if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC) @@ -110,7 +111,8 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb, skb_checksum_none_assert(skb);
/* check if Rx checksum is enabled */ - if (!(ring->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) return;
/* check if HW has decoded the packet and checksum */ @@ -205,7 +207,8 @@ ice_process_skb_fields(struct ice_ring *rx_ring, void ice_receive_skb(struct ice_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag) { - if ((rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + rx_ring->netdev->features) && (vlan_tag & VLAN_VID_MASK)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); napi_gro_receive(&rx_ring->q_vector->napi, skb); diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 17f5c00..898f246 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -2897,7 +2897,7 @@ static int igb_add_ethtool_nfc_entry(struct igb_adapter *adapter, struct igb_nfc_filter *input, *rule; int err = 0;
- if (!(netdev->hw_features & NETIF_F_NTUPLE)) + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features)) return -EOPNOTSUPP;
/* Don't allow programming if the action is a queue greater than diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 2e4a53c..1f764d4 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2439,25 +2439,28 @@ static void igb_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int igb_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; struct igb_adapter *adapter = netdev_priv(netdev); + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, netdev->features, features); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igb_vlan_mode(netdev, features);
- if (!(changed & (NETIF_F_RXALL | NETIF_F_NTUPLE))) + if (!netdev_feature_test_bits(NETIF_F_RXALL | NETIF_F_NTUPLE, changed)) return 0;
- if (!(features & NETIF_F_NTUPLE)) { + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) { struct hlist_node *node2; struct igb_nfc_filter *rule;
@@ -2472,7 +2475,7 @@ static int igb_set_features(struct net_device *netdev, adapter->nfc_filter_count = 0; }
- netdev->features = features; + netdev_feature_copy(&netdev->features, features);
if (netif_running(netdev)) igb_reinit_locked(adapter); @@ -2511,30 +2514,33 @@ static void igb_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) { - *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); + netdev_feature_clear_bits(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, + features); return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_GSO_UDP_L4 | + NETIF_F_TSO | + NETIF_F_TSO6, + features); 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; + if (skb->encapsulation && + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
static void igb_offload_apply(struct igb_adapter *adapter, s32 queue) @@ -3266,18 +3272,20 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * set by igb_sw_init so we should use an or instead of an * assignment. */ - netdev->features |= NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_RXHASH | - NETIF_F_RXCSUM | - NETIF_F_HW_CSUM; + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_RXHASH | + NETIF_F_RXCSUM | + NETIF_F_HW_CSUM, + &netdev->features);
if (hw->mac.type >= e1000_82576) - netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4; + netdev_feature_set_bits(NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4, + &netdev->features);
if (hw->mac.type >= e1000_i350) - netdev->features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features);
#define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -3286,29 +3294,41 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IGB_GSO_PARTIAL_FEATURES; - netdev->features |= NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES; + netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_set_bits(IGB_GSO_PARTIAL_FEATURES, + &netdev->gso_partial_features); + netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | + IGB_GSO_PARTIAL_FEATURES, + &netdev->features);
/* copy netdev features into list of user selectable features */ - netdev->hw_features |= netdev->features | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_RXALL; + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_RXALL, + &netdev->hw_features);
if (hw->mac.type >= e1000_i350) - netdev->hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, + &netdev->hw_features);
if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
- netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID; - netdev->mpls_features |= NETIF_F_HW_CSUM; - netdev->hw_enc_features |= netdev->vlan_features; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); + netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, + &netdev->features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
@@ -4539,7 +4559,8 @@ void igb_setup_rctl(struct igb_adapter *adapter) }
/* This is useful for sniffing bad packets. */ - if (adapter->netdev->features & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, + adapter->netdev->features)) { /* UPE and MPE will be handled by normal PROMISC logic * in e1000e_set_rx_mode */ @@ -5045,7 +5066,8 @@ static int igb_vlan_promisc_enable(struct igb_adapter *adapter) case e1000_i211: case e1000_i350: /* VLAN filtering needed for VLAN prio filter */ - if (adapter->netdev->features & NETIF_F_NTUPLE) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + adapter->netdev->features)) break; fallthrough; case e1000_82576: @@ -5217,7 +5239,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
/* disable VLAN filtering for modes that require it */ if ((netdev->flags & IFF_PROMISC) || - (netdev->features & NETIF_F_RXALL)) { + netdev_feature_test_bit(NETIF_F_RXALL_BIT, netdev->features)) { /* if we fail to set all rules then just clear VFE */ if (igb_vlan_promisc_enable(adapter)) rctl &= ~E1000_RCTL_VFE; @@ -8467,7 +8489,8 @@ static inline void igb_rx_checksum(struct igb_ring *ring, return;
/* Rx checksum disabled via ethtool */ - if (!(ring->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + ring->netdev->features)) return;
/* TCP/UDP checksum error bit is set */ @@ -8500,7 +8523,8 @@ static inline void igb_rx_hash(struct igb_ring *ring, union e1000_adv_rx_desc *rx_desc, struct sk_buff *skb) { - if (ring->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss), PKT_HASH_TYPE_L3); @@ -8558,7 +8582,8 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring, if (unlikely((igb_test_staterr(rx_desc, E1000_RXDEXT_ERR_FRAME_ERR_MASK)))) { struct net_device *netdev = rx_ring->netdev; - if (!(netdev->features & NETIF_F_RXALL)) { + if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)) { dev_kfree_skb_any(skb); return true; } @@ -8595,7 +8620,8 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring, !igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) igb_ptp_rx_rgtstamp(rx_ring->q_vector, skb);
- if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features) && igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { u16 vid;
@@ -9018,7 +9044,8 @@ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features) struct igb_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; u32 ctrl, rctl; - bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX); + bool enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features);
if (enable) { /* enable VLAN tag insert/strip */ diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 92a46ac..2cad7a2 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2608,7 +2608,7 @@ static int igbvf_set_features(struct net_device *netdev, { struct igbvf_adapter *adapter = netdev_priv(netdev);
- if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) adapter->flags &= ~IGBVF_FLAG_RX_CSUM_DISABLED; else adapter->flags |= IGBVF_FLAG_RX_CSUM_DISABLED; @@ -2627,28 +2627,31 @@ static void igbvf_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) { - *features &= ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6, + features); return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_TSO | + NETIF_F_TSO6, + features); 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; + if (skb->encapsulation && + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
static const struct net_device_ops igbvf_netdev_ops = { @@ -2767,12 +2770,14 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
adapter->bd_number = cards_found++;
- netdev->hw_features = NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_RXCSUM | - NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_RXCSUM | + NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC, + &netdev->hw_features);
#define IGBVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -2781,23 +2786,31 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IGBVF_GSO_PARTIAL_FEATURES; - netdev->hw_features |= NETIF_F_GSO_PARTIAL | - IGBVF_GSO_PARTIAL_FEATURES; + netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_set_bits(IGBVF_GSO_PARTIAL_FEATURES, + &netdev->gso_partial_features); + netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | + IGBVF_GSO_PARTIAL_FEATURES, + &netdev->hw_features);
- netdev->features = netdev->hw_features; + netdev_feature_copy(&netdev->features, netdev->hw_features);
if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
- netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID; - netdev->mpls_features |= NETIF_F_HW_CSUM; - netdev->hw_enc_features |= netdev->vlan_features; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); + netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, + &netdev->features);
/* MTU range: 68 - 9216 */ netdev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index d3e8441..93fbe53 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1295,7 +1295,8 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter, struct igc_nfc_rule *rule, *old_rule; int err;
- if (!(netdev->hw_features & NETIF_F_NTUPLE)) { + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + netdev->hw_features)) { netdev_dbg(netdev, "N-tuple filters disabled\n"); return -EOPNOTSUPP; } diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index f7545a6..a384796 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -816,7 +816,8 @@ static void igc_setup_rctl(struct igc_adapter *adapter) wr32(IGC_RXDCTL(0), 0);
/* This is useful for sniffing bad packets. */ - if (adapter->netdev->features & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, + adapter->netdev->features)) { /* UPE and MPE will be handled by normal PROMISC logic * in set_rx_mode */ @@ -1521,7 +1522,8 @@ static void igc_rx_checksum(struct igc_ring *ring, return;
/* Rx checksum disabled via ethtool */ - if (!(ring->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + ring->netdev->features)) return;
/* TCP/UDP checksum error bit is set */ @@ -1554,7 +1556,8 @@ static inline void igc_rx_hash(struct igc_ring *ring, union igc_adv_rx_desc *rx_desc, struct sk_buff *skb) { - if (ring->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss), PKT_HASH_TYPE_L3); @@ -1567,7 +1570,8 @@ static void igc_rx_vlan(struct igc_ring *rx_ring, struct net_device *dev = rx_ring->netdev; u16 vid;
- if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features) && igc_test_staterr(rx_desc, IGC_RXD_STAT_VP)) { if (igc_test_staterr(rx_desc, IGC_RXDEXT_STATERR_LB) && test_bit(IGC_RING_FLAG_RX_LB_VLAN_BSWAP, &rx_ring->flags)) @@ -1606,7 +1610,8 @@ static void igc_process_skb_fields(struct igc_ring *rx_ring,
static void igc_vlan_mode(struct net_device *netdev, netdev_features_t features) { - bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX); + bool enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features); struct igc_adapter *adapter = netdev_priv(netdev); struct igc_hw *hw = &adapter->hw; u32 ctrl; @@ -1894,7 +1899,8 @@ static bool igc_cleanup_headers(struct igc_ring *rx_ring, if (unlikely(igc_test_staterr(rx_desc, IGC_RXDEXT_STATERR_RXE))) { struct net_device *netdev = rx_ring->netdev;
- if (!(netdev->features & NETIF_F_RXALL)) { + if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)) { dev_kfree_skb_any(skb); return true; } @@ -4913,29 +4919,32 @@ static void igc_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int igc_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; struct igc_adapter *adapter = netdev_priv(netdev); + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, netdev->features, features); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igc_vlan_mode(netdev, features);
/* Add VLAN support */ - if (!(changed & (NETIF_F_RXALL | NETIF_F_NTUPLE))) + if (!netdev_feature_test_bits(NETIF_F_RXALL | NETIF_F_NTUPLE, changed)) return 0;
- if (!(features & NETIF_F_NTUPLE)) + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) igc_flush_nfc_rules(adapter);
- netdev->features = features; + netdev_feature_copy(&netdev->features, features);
if (netif_running(netdev)) igc_reinit_locked(adapter); @@ -4953,28 +4962,31 @@ static void igc_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) { - *features &= ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6, + features); return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_TSO | + NETIF_F_TSO6, + features); 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; + if (skb->encapsulation && + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + netdev_feature_clear_bits(NETIF_F_TSO_BIT, features); }
static void igc_tsync_interrupt(struct igc_adapter *adapter) @@ -6230,14 +6242,14 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* Add supported features to the features list*/ - netdev->features |= NETIF_F_SG; - netdev->features |= NETIF_F_TSO; - netdev->features |= NETIF_F_TSO6; - netdev->features |= NETIF_F_TSO_ECN; - netdev->features |= NETIF_F_RXCSUM; - netdev->features |= NETIF_F_HW_CSUM; - netdev->features |= NETIF_F_SCTP_CRC; - netdev->features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_SCTP_CRC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features);
#define IGC_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -6246,8 +6258,11 @@ static int igc_probe(struct pci_dev *pdev, NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IGC_GSO_PARTIAL_FEATURES; - netdev->features |= NETIF_F_GSO_PARTIAL | IGC_GSO_PARTIAL_FEATURES; + netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_set_bits(IGC_GSO_PARTIAL_FEATURES, + &netdev->gso_partial_features); + netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGC_GSO_PARTIAL_FEATURES, + &netdev->features);
/* setup the private structure */ err = igc_sw_init(adapter); @@ -6255,15 +6270,19 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* copy netdev features into list of user selectable features */ - netdev->hw_features |= NETIF_F_NTUPLE; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; - netdev->hw_features |= netdev->features; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features); + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->features);
if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
- netdev->vlan_features |= netdev->features; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features);
/* MTU range: 68 - 9216 */ netdev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 34c1bfc..c56ac31 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -300,20 +300,26 @@ static void ixgb_fix_features(struct net_device *netdev, * Tx VLAN insertion does not work per HW design when Rx stripping is * disabled. */ - if (!(*features & NETIF_F_HW_VLAN_CTAG_RX)) - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int ixgb_set_features(struct net_device *netdev, netdev_features_t features) { struct ixgb_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (!(changed & (NETIF_F_RXCSUM|NETIF_F_HW_VLAN_CTAG_RX))) + netdev_feature_xor(&changed, features, netdev->features); + + if (!netdev_feature_test_bits(NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_RX, + changed)) return 0;
- adapter->rx_csum = !!(features & NETIF_F_RXCSUM); + adapter->rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + features);
if (netif_running(netdev)) { ixgb_down(adapter, true); @@ -432,18 +438,22 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init;
- netdev->hw_features = NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - netdev->features = netdev->hw_features | - NETIF_F_HW_VLAN_CTAG_FILTER; - netdev->hw_features |= NETIF_F_RXCSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->hw_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features);
if (pci_using_dac) { - netdev->features |= NETIF_F_HIGHDMA; - netdev->vlan_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->vlan_features); }
/* MTU range: 68 - 16114 */ @@ -1098,7 +1108,8 @@ ixgb_set_multi(struct net_device *netdev) }
alloc_failed: - if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) ixgb_vlan_strip_enable(adapter); else ixgb_vlan_strip_disable(adapter); diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index 72e6ebf..5516574 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c @@ -319,7 +319,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
#ifdef IXGBE_FCOE - if (adapter->netdev->features & NETIF_F_FCOE_MTU) + if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, + adapter->netdev->features)) max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE); #endif
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 4ceaca0..fa681c6 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -2391,7 +2391,7 @@ static bool ixgbe_update_rsc(struct ixgbe_adapter *adapter)
/* nothing to do if LRO or RSC are not enabled */ if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) || - !(netdev->features & NETIF_F_LRO)) + !netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) return false;
/* check the feature flag value and enable RSC if necessary */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 0fcd820..57009d1 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c @@ -644,7 +644,8 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) u32 etqf;
/* Minimal functionality for FCoE requires at least CRC offloads */ - if (!(adapter->netdev->features & NETIF_F_FCOE_CRC)) + if (!netdev_feature_test_bit(NETIF_F_FCOE_CRC_BIT, + adapter->netdev->features)) return;
/* Enable L2 EtherType filter for FCoE, needed for FCoE CRC and DDP */ @@ -858,7 +859,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
/* enable FCoE and notify stack */ adapter->flags |= IXGBE_FLAG_FCOE_ENABLED; - netdev->features |= NETIF_F_FCOE_MTU; + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); netdev_features_change(netdev);
/* release existing queues and reallocate them */ @@ -898,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_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features);
netdev_features_change(netdev);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c index 0218f6c..38fe6323 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c @@ -978,7 +978,8 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state);
#ifdef IXGBE_FCOE - if (adapter->netdev->features & NETIF_F_FCOE_MTU) { + if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, + adapter->netdev->features)) { struct ixgbe_ring_feature *f; f = &adapter->ring_feature[RING_F_FCOE]; if ((rxr_idx >= f->offset) && diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index c43c99a..742947f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1423,7 +1423,8 @@ static inline void ixgbe_rx_hash(struct ixgbe_ring *ring, { u16 rss_type;
- if (!(ring->netdev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) return;
rss_type = le16_to_cpu(rx_desc->wb.lower.lo_dword.hs_rss.pkt_info) & @@ -1473,7 +1474,8 @@ static inline void ixgbe_rx_checksum(struct ixgbe_ring *ring, skb_checksum_none_assert(skb);
/* Rx csum disabled */ - if (!(ring->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + ring->netdev->features)) return;
/* check for VXLAN and Geneve packets */ @@ -1692,7 +1694,8 @@ void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring, if (unlikely(flags & IXGBE_FLAG_RX_HWTSTAMP_ENABLED)) ixgbe_ptp_rx_hwtstamp(rx_ring, rx_desc, skb);
- if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features) && ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan); __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); @@ -1890,7 +1893,8 @@ bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, if (!netdev || (unlikely(ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_ERR_FRAME_ERR_MASK) && - !(netdev->features & NETIF_F_RXALL)))) { + !netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)))) { dev_kfree_skb_any(skb); return true; } @@ -4897,9 +4901,11 @@ void ixgbe_set_rx_mode(struct net_device *netdev) struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_hw *hw = &adapter->hw; u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE; - netdev_features_t features = netdev->features; + netdev_features_t features; int count;
+ netdev_feature_copy(&features, netdev->features); + /* Check for Promiscuous and All Multicast modes */ fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
@@ -4915,7 +4921,8 @@ 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_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &features); } else { if (netdev->flags & IFF_ALLMULTI) { fctrl |= IXGBE_FCTRL_MPE; @@ -4954,7 +4961,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) }
/* This is useful for sniffing bad packets. */ - if (features & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, features)) { /* UPE and MPE will be handled by normal PROMISC logic * in e1000e_set_rx_mode */ fctrl |= (IXGBE_FCTRL_SBP | /* Receive bad packets */ @@ -4967,12 +4974,12 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) ixgbe_vlan_strip_enable(adapter); else ixgbe_vlan_strip_disable(adapter);
- if (features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) ixgbe_vlan_promisc_disable(adapter); else ixgbe_vlan_promisc_enable(adapter); @@ -5054,7 +5061,8 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter) netif_set_gso_max_size(adapter->netdev, 32768);
#ifdef IXGBE_FCOE - if (adapter->netdev->features & NETIF_F_FCOE_MTU) + if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, + adapter->netdev->features)) max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE); #endif
@@ -5111,7 +5119,7 @@ static int ixgbe_hpbthresh(struct ixgbe_adapter *adapter, int pb)
#ifdef IXGBE_FCOE /* FCoE traffic class uses FCOE jumbo frames */ - if ((dev->features & NETIF_F_FCOE_MTU) && + if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, dev->features) && (tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) && (pb == ixgbe_fcoe_get_tc(adapter))) tc = IXGBE_FCOE_JUMBO_FRAME_SIZE; @@ -5172,7 +5180,7 @@ static int ixgbe_lpbthresh(struct ixgbe_adapter *adapter, int pb)
#ifdef IXGBE_FCOE /* FCoE traffic class uses FCOE jumbo frames */ - if ((dev->features & NETIF_F_FCOE_MTU) && + if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, dev->features) && (tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) && (pb == netdev_get_prio_tc_map(dev, adapter->fcoe.up))) tc = IXGBE_FCOE_JUMBO_FRAME_SIZE; @@ -8698,7 +8706,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, #ifdef IXGBE_FCOE /* setup tx offload for FCoE */ if ((protocol == htons(ETH_P_FCOE)) && - (tx_ring->netdev->features & (NETIF_F_FSO | NETIF_F_FCOE_CRC))) { + netdev_feature_test_bits(NETIF_F_FSO | NETIF_F_FCOE_CRC, + tx_ring->netdev->features)) { tso = ixgbe_fso(tx_ring, first, &hdr_len); if (tso < 0) goto out_drop; @@ -9688,16 +9697,17 @@ static void ixgbe_fix_features(struct net_device *netdev, struct ixgbe_adapter *adapter = netdev_priv(netdev);
/* If Rx checksum is disabled, then RSC/LRO should also be disabled */ - if (!(*features & NETIF_F_RXCSUM)) - *features &= ~NETIF_F_LRO; + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + netdev_feature_clear_bit(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_clear_bit(NETIF_F_LRO_BIT, features);
- if (adapter->xdp_prog && (*features & NETIF_F_LRO)) { + if (adapter->xdp_prog && + netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { e_dev_err("LRO is not supported with XDP\n"); - *features &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } }
@@ -9721,11 +9731,13 @@ static int ixgbe_set_features(struct net_device *netdev, netdev_features_t features) { struct ixgbe_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = netdev->features ^ features; + netdev_features_t changed; bool need_reset = false;
+ netdev_feature_xor(&changed, netdev->features, features); + /* Make sure RSC matches LRO, reset if change */ - if (!(features & NETIF_F_LRO)) { + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) need_reset = true; adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; @@ -9735,7 +9747,8 @@ static int ixgbe_set_features(struct net_device *netdev, adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; need_reset = true; - } else if ((changed ^ features) & NETIF_F_LRO) { + } else if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, + changed)) { e_info(probe, "rx-usecs set too low, " "disabling RSC\n"); } @@ -9745,7 +9758,8 @@ static int ixgbe_set_features(struct net_device *netdev, * Check if Flow Director n-tuple support or hw_tc support was * enabled or disabled. If the state changed, we need to reset. */ - if ((features & NETIF_F_NTUPLE) || (features & NETIF_F_HW_TC)) { + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) || + netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features)) { /* turn off ATR, enable perfect filters and reset */ if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) need_reset = true; @@ -9772,17 +9786,19 @@ static int ixgbe_set_features(struct net_device *netdev, adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; }
- if (changed & NETIF_F_RXALL) + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) need_reset = true;
- netdev->features = features; + netdev_feature_copy(&netdev->features, features);
- if ((changed & NETIF_F_HW_L2FW_DOFFLOAD) && adapter->num_rx_pools > 1) + if (netdev_feature_test_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, changed) && + adapter->num_rx_pools > 1) ixgbe_reset_l2fw_offload(adapter); else if (need_reset) ixgbe_do_reset(netdev); - else if (changed & (NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER)) + else if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + changed)) ixgbe_set_rx_mode(netdev);
return 1; @@ -10073,22 +10089,24 @@ static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) { - *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); + netdev_feature_clear_bits(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, + features); return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_GSO_UDP_L4 | + NETIF_F_TSO | + NETIF_F_TSO6, + features); return; }
@@ -10097,11 +10115,12 @@ static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, * 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 && + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) { #ifdef CONFIG_IXGBE_IPSEC if (!secpath_exists(skb)) #endif - *features &= ~NETIF_F_TSO; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); } }
@@ -10787,12 +10806,14 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) skip_sriov:
#endif - netdev->features = NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_RXHASH | - NETIF_F_RXCSUM | - NETIF_F_HW_CSUM; + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_RXHASH | + NETIF_F_RXCSUM | + NETIF_F_HW_CSUM, + &netdev->features);
#define IXGBE_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -10801,12 +10822,17 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IXGBE_GSO_PARTIAL_FEATURES; - netdev->features |= NETIF_F_GSO_PARTIAL | - IXGBE_GSO_PARTIAL_FEATURES; + netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES, + &netdev->gso_partial_features); + netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | + IXGBE_GSO_PARTIAL_FEATURES, + &netdev->features);
if (hw->mac.type >= ixgbe_mac_82599EB) - netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4; + netdev_feature_set_bits(NETIF_F_SCTP_CRC | + NETIF_F_GSO_UDP_L4, + &netdev->features);
#ifdef CONFIG_IXGBE_IPSEC #define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \ @@ -10814,35 +10840,45 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_ESP)
if (adapter->ipsec) - netdev->features |= IXGBE_ESP_FEATURES; + netdev_feature_set_bits(IXGBE_ESP_FEATURES, &netdev->features); #endif /* copy netdev features into list of user selectable features */ - netdev->hw_features |= netdev->features | - NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_RXALL | - NETIF_F_HW_L2FW_DOFFLOAD; + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_RXALL | + NETIF_F_HW_L2FW_DOFFLOAD, + &netdev->hw_features);
if (hw->mac.type >= ixgbe_mac_82599EB) - netdev->hw_features |= NETIF_F_NTUPLE | - NETIF_F_HW_TC; + netdev_feature_set_bits(NETIF_F_NTUPLE | + NETIF_F_HW_TC, + &netdev->hw_features);
if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; - - netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID; - netdev->hw_enc_features |= netdev->vlan_features; - netdev->mpls_features |= NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_HW_CSUM; - netdev->mpls_features |= IXGBE_GSO_PARTIAL_FEATURES; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->vlan_features); + netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_HW_CSUM, + &netdev->mpls_features); + netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES, + &netdev->mpls_features);
/* set this bit last since it cannot be part of vlan_features */ - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, + &netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->priv_flags |= IFF_SUPP_NOFCS; @@ -10870,18 +10906,20 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) fcoe_l = min_t(int, IXGBE_FCRETA_SIZE, num_online_cpus()); adapter->ring_feature[RING_F_FCOE].limit = fcoe_l;
- netdev->features |= NETIF_F_FSO | - NETIF_F_FCOE_CRC; + netdev_feature_set_bits(NETIF_F_FSO | + NETIF_F_FCOE_CRC, + &netdev->features);
- netdev->vlan_features |= NETIF_F_FSO | - NETIF_F_FCOE_CRC | - NETIF_F_FCOE_MTU; + netdev_feature_set_bits(NETIF_F_FSO | + NETIF_F_FCOE_CRC | + NETIF_F_FCOE_MTU, + &netdev->vlan_features); } #endif /* IXGBE_FCOE */ if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) - netdev->hw_features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->hw_features); if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) - netdev->features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->features);
if (ixgbe_check_fw_error(adapter)) { err = -EIO; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 214a38d..7a89d8e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -491,7 +491,8 @@ static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf s32 err = 0;
#ifdef CONFIG_FCOE - if (dev->features & NETIF_F_FCOE_MTU) + if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, + dev->features)) pf_max_frame = max_t(int, pf_max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
@@ -869,7 +870,8 @@ static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf) int pf_max_frame = dev->mtu + ETH_HLEN;
#ifdef CONFIG_FCOE - if (dev->features & NETIF_F_FCOE_MTU) + if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, + dev->features)) pf_max_frame = max_t(int, pf_max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c b/drivers/net/ethernet/intel/ixgbevf/ipsec.c index e3e4676..60288ef 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c +++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c @@ -104,7 +104,8 @@ void ixgbevf_ipsec_restore(struct ixgbevf_adapter *adapter) struct net_device *netdev = adapter->netdev; int i;
- if (!(adapter->netdev->features & NETIF_F_HW_ESP)) + if (!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, + adapter->netdev->features)) return;
/* reload the Rx and Tx keys */ @@ -654,8 +655,10 @@ void ixgbevf_init_ipsec_offload(struct ixgbevf_adapter *adapter) NETIF_F_HW_ESP_TX_CSUM | \ NETIF_F_GSO_ESP)
- adapter->netdev->features |= IXGBEVF_ESP_FEATURES; - adapter->netdev->hw_enc_features |= IXGBEVF_ESP_FEATURES; + netdev_feature_set_bits(IXGBEVF_ESP_FEATURES, + &adapter->netdev->features); + netdev_feature_set_bits(IXGBEVF_ESP_FEATURES, + &adapter->netdev->hw_enc_features);
return;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index f2f6d00..f3d7e74 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -444,7 +444,8 @@ static inline void ixgbevf_rx_hash(struct ixgbevf_ring *ring, { u16 rss_type;
- if (!(ring->netdev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ring->netdev->features)) return;
rss_type = le16_to_cpu(rx_desc->wb.lower.lo_dword.hs_rss.pkt_info) & @@ -471,7 +472,8 @@ static inline void ixgbevf_rx_checksum(struct ixgbevf_ring *ring, skb_checksum_none_assert(skb);
/* Rx csum disabled */ - if (!(ring->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + ring->netdev->features)) return;
/* if IP and error */ @@ -742,7 +744,8 @@ static bool ixgbevf_cleanup_headers(struct ixgbevf_ring *rx_ring, IXGBE_RXDADV_ERR_FRAME_ERR_MASK))) { struct net_device *netdev = rx_ring->netdev;
- if (!(netdev->features & NETIF_F_RXALL)) { + if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)) { dev_kfree_skb_any(skb); return true; } @@ -4389,28 +4392,31 @@ static void ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) { - *features &= ~(NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_TSO | - NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_TSO | + NETIF_F_TSO6, + features); return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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); + netdev_feature_clear_bits(NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC | + NETIF_F_TSO | + NETIF_F_TSO6, + features); 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; + if (skb->encapsulation && + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
static int ixgbevf_xdp_setup(struct net_device *dev, struct bpf_prog *prog) @@ -4581,12 +4587,14 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_sw_init; }
- netdev->hw_features = NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_RXCSUM | - NETIF_F_HW_CSUM | - NETIF_F_SCTP_CRC; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_RXCSUM | + NETIF_F_HW_CSUM | + NETIF_F_SCTP_CRC, + &netdev->hw_features);
#define IXGBEVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -4595,27 +4603,37 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IXGBEVF_GSO_PARTIAL_FEATURES; - netdev->hw_features |= NETIF_F_GSO_PARTIAL | - IXGBEVF_GSO_PARTIAL_FEATURES; + netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES, + &netdev->gso_partial_features); + netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | + IXGBEVF_GSO_PARTIAL_FEATURES, + &netdev->hw_features);
- netdev->features = netdev->hw_features; + netdev_feature_copy(&netdev->features, netdev->hw_features);
if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; - - netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID; - netdev->mpls_features |= NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_HW_CSUM; - netdev->mpls_features |= IXGBEVF_GSO_PARTIAL_FEATURES; - netdev->hw_enc_features |= netdev->vlan_features; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_HW_CSUM, + &netdev->mpls_features); + netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES, + &netdev->mpls_features); + netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, + &netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/intel/e100.c | 26 +-- drivers/net/ethernet/intel/e1000/e1000_main.c | 76 +++++---- drivers/net/ethernet/intel/e1000e/netdev.c | 123 ++++++++------ drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 57 ++++--- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 11 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 109 +++++++----- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 134 +++++++++------ drivers/net/ethernet/intel/iavf/iavf_txrx.c | 12 +- drivers/net/ethernet/intel/ice/ice_main.c | 158 +++++++++++------- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 9 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 129 ++++++++------ drivers/net/ethernet/intel/igbvf/netdev.c | 71 ++++---- drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 +- drivers/net/ethernet/intel/igc/igc_main.c | 101 ++++++----- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 43 +++-- drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 7 +- drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 194 +++++++++++++--------- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 6 +- drivers/net/ethernet/intel/ixgbevf/ipsec.c | 9 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 90 ++++++---- 26 files changed, 845 insertions(+), 551 deletions(-)
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 373eb02..abec49f 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -1114,7 +1114,8 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) config->promiscuous_mode = 0x1; /* 1=on, 0=off */ }
- if (unlikely(netdev->features & NETIF_F_RXFCS))
if (unlikely(netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
netdev->features)))
config->rx_crc_transfer = 0x1; /* 1=save, 0=discard */
if (nic->flags & multicast_all)
@@ -1141,7 +1142,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) } }
- if (netdev->features & NETIF_F_RXALL) {
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, netdev->features)) { config->rx_save_overruns = 0x1; /* 1=save, 0=discard */ config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */ config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */
@@ -1990,7 +1991,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, }
/* Get actual data size */
- if (unlikely(dev->features & NETIF_F_RXFCS))
- if (unlikely(netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
fcs_pad = 4; actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF; if (unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd)))dev->features)))
@@ -2021,7 +2023,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, /* If we are receiving all frames, then don't bother * checking for errors. */
- if (unlikely(dev->features & NETIF_F_RXALL)) {
- if (unlikely(netdev_feature_test_bit(NETIF_F_RXALL_BIT,
if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN + fcs_pad) /* Received oversized frame, but keep it. */ nic->rx_over_length_errors++;dev->features))) {
@@ -2792,12 +2795,14 @@ static int e100_set_features(struct net_device *netdev, netdev_features_t features) { struct nic *nic = netdev_priv(netdev);
- netdev_features_t changed = features ^ netdev->features;
- netdev_features_t changed;
- if (!(changed & (NETIF_F_RXFCS | NETIF_F_RXALL)))
- netdev_feature_xor(&changed, features, netdev->features);
- if (!netdev_feature_test_bits(NETIF_F_RXFCS | NETIF_F_RXALL, changed)) return 0;
- netdev->features = features;
- netdev_feature_copy(&netdev->features, features); e100_exec_cb(nic, NULL, e100_configure); return 1; }
@@ -2826,9 +2831,9 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (!(netdev = alloc_etherdev(sizeof(struct nic)))) return -ENOMEM;
- netdev->hw_features |= NETIF_F_RXFCS;
- netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS;
- netdev->hw_features |= NETIF_F_RXALL;
netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features);
netdev->netdev_ops = &e100_netdev_ops; netdev->ethtool_ops = &e100_ethtool_ops;
@@ -2885,7 +2890,8 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* D100 MAC doesn't allow rx of vlan packets with normal MTU */ if (nic->mac < mac_82558_D101_A4)
netdev->features |= NETIF_F_VLAN_CHALLENGED;
netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT,
&netdev->features);
/* locks must be initialized before calling hw_reset */ spin_lock_init(&nic->cb_lock);
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index e333ca1..f17057a 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -793,26 +793,30 @@ static void e1000_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */
- if (*features & NETIF_F_HW_VLAN_CTAG_RX)
*features |= NETIF_F_HW_VLAN_CTAG_TX;
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features))
elsenetdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
*features &= ~NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
features);
}
static int e1000_set_features(struct net_device *netdev, netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev);
- netdev_features_t changed = features ^ netdev->features;
- netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX)
- netdev_feature_xor(&changed, features, netdev->features);
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) e1000_vlan_mode(netdev, features);
- if (!(changed & (NETIF_F_RXCSUM | NETIF_F_RXALL)))
- if (!netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_RXALL, changed)) return 0;
- netdev->features = features;
- adapter->rx_csum = !!(features & NETIF_F_RXCSUM);
netdev_feature_copy(&netdev->features, features);
adapter->rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
features);
if (netif_running(netdev)) e1000_reinit_locked(adapter);
@@ -1033,32 +1037,40 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }
if (hw->mac_type >= e1000_82543) {
netdev->hw_features = NETIF_F_SG |
NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_RX;
netdev->features = NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_zero(&netdev->hw_features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_RX,
&netdev->hw_features);
netdev_feature_zero(&netdev->features);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_FILTER,
&netdev->features);
}
if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_82547))
netdev->hw_features |= NETIF_F_TSO;
netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
- netdev->features |= netdev->hw_features;
- netdev->hw_features |= (NETIF_F_RXCSUM |
- netdev_feature_or(&netdev->features, netdev->features,
netdev->hw_features);
- netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_RXALL |
NETIF_F_RXFCS);
NETIF_F_RXFCS,
&netdev->hw_features);
if (pci_using_dac) {
netdev->features |= NETIF_F_HIGHDMA;
netdev->vlan_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT,
}&netdev->vlan_features);
- netdev->vlan_features |= (NETIF_F_TSO |
NETIF_F_HW_CSUM |
NETIF_F_SG);
- netdev_feature_set_bits(NETIF_F_TSO |
NETIF_F_TSO |
it should be "NETIF_F_HW_CSUM", not "NETIF_F_TSO", will fix it next version
NETIF_F_SG,
&netdev->vlan_features);
/* Do not set IFF_UNICAST_FLT for VMWare's 82545EM */ if (hw->device_id != E1000_DEV_ID_82545EM_COPPER ||
@@ -1822,7 +1834,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) }
/* This is useful for sniffing bad packets. */
- if (adapter->netdev->features & NETIF_F_RXALL) {
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT,
/* UPE and MPE will be handled by normal PROMISC logicadapter->netdev->features)) {
*/
- in e1000e_set_rx_mode
@@ -4176,7 +4189,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, rx_desc->errors, length, mapped)) { length--;
} else if (netdev->features & NETIF_F_RXALL) {
} else if (netdev_feature_test_bit(NETIF_F_RXALL_BIT,
netdev->features)) { goto process_skb; } else { /* an error means any chain goes out the window
@@ -4227,7 +4241,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, if (length <= copybreak) { u8 *vaddr;
if (likely(!(netdev->features & NETIF_F_RXFCS)))
if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
netdev->features))) length -= 4; skb = e1000_alloc_rx_skb(adapter, length);
@@ -4273,7 +4288,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, le16_to_cpu(rx_desc->csum), skb);
total_rx_bytes += (skb->len - 4); /* don't count FCS */
if (likely(!(netdev->features & NETIF_F_RXFCS)))
if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
total_rx_packets++;netdev->features))) pskb_trim(skb, skb->len - 4);
@@ -4428,7 +4444,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, rx_desc->errors, length, data)) { length--;
} else if (netdev->features & NETIF_F_RXALL) {
} else if (netdev_feature_test_bit(NETIF_F_RXALL_BIT,
netdev->features)) { goto process_skb; } else { dev_kfree_skb(skb);
@@ -4440,7 +4457,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, total_rx_bytes += (length - 4); /* don't count FCS */ total_rx_packets++;
if (likely(!(netdev->features & NETIF_F_RXFCS)))
if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
netdev->features))) /* adjust length to remove Ethernet CRC, this must be * done after the TBI_ACCEPT workaround above */
@@ -4888,7 +4906,7 @@ static void __e1000_vlan_mode(struct e1000_adapter *adapter, u32 ctrl;
ctrl = er32(CTRL);
- if (features & NETIF_F_HW_VLAN_CTAG_RX) {
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) { /* enable VLAN tag insert/strip */ ctrl |= E1000_CTRL_VME; } else {
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 5dd183e..a299f27 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -576,7 +576,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, skb_checksum_none_assert(skb);
/* Rx checksum disabled */
- if (!(adapter->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
adapter->netdev->features))
return;
/* Ignore Checksum bit is set */
@@ -894,7 +895,7 @@ static void e1000_alloc_jumbo_rx_buffers(struct e1000_ring *rx_ring, static inline void e1000_rx_hash(struct net_device *netdev, __le32 rss, struct sk_buff *skb) {
- if (netdev->features & NETIF_F_RXHASH)
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) skb_set_hash(skb, le32_to_cpu(rss), PKT_HASH_TYPE_L3); }
@@ -976,7 +977,8 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, }
if (unlikely((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) &&
!(netdev->features & NETIF_F_RXALL))) {
!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
netdev->features))) { /* recycle */ buffer_info->skb = skb; goto next_desc;
@@ -988,7 +990,8 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, * but keep the FCS bytes out of the total_rx_bytes * counter */
if (netdev->features & NETIF_F_RXFCS)
if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
netdev->features)) total_rx_bytes -= 4; else length -= 4;
@@ -1362,7 +1365,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done, }
if (unlikely((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) &&
!(netdev->features & NETIF_F_RXALL))) {
!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
}netdev->features))) { dev_kfree_skb_irq(skb); goto next_desc;
@@ -1413,7 +1417,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done,
/* remove the CRC */ if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) {
if (!(netdev->features & NETIF_F_RXFCS))
if (!netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
netdev->features)) l1 -= 4; }
@@ -1442,7 +1447,8 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done, * this whole operation can get a little cpu intensive */ if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) {
if (!(netdev->features & NETIF_F_RXFCS))
if (!netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
}netdev->features)) pskb_trim(skb, skb->len - 4);
@@ -1557,7 +1563,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done, /* errors is only valid for DD + EOP descriptors */ if (unlikely((staterr & E1000_RXD_STAT_EOP) && ((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) &&
!(netdev->features & NETIF_F_RXALL)))) {
!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
netdev->features)))) { /* recycle both page and skb */ buffer_info->skb = skb; /* an error means any chain goes out the window too */
@@ -3165,7 +3172,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) }
/* This is useful for sniffing bad packets. */
- if (adapter->netdev->features & NETIF_F_RXALL) {
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT,
/* UPE and MPE will be handled by normal PROMISC logicadapter->netdev->features)) {
*/
- in e1000e_set_rx_mode
@@ -3270,7 +3278,8 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
/* Enable Receive Checksum Offload for TCP and UDP */ rxcsum = er32(RXCSUM);
- if (adapter->netdev->features & NETIF_F_RXCSUM)
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
rxcsum |= E1000_RXCSUM_TUOFL; else rxcsum &= ~E1000_RXCSUM_TUOFL;adapter->netdev->features))
@@ -3451,7 +3460,8 @@ static void e1000e_set_rx_mode(struct net_device *netdev)
ew32(RCTL, rctl);
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
e1000e_vlan_strip_enable(adapter); else e1000e_vlan_strip_disable(adapter);netdev->features))
@@ -3765,7 +3775,8 @@ static void e1000_configure(struct e1000_adapter *adapter)
e1000_configure_tx(adapter);
- if (adapter->netdev->features & NETIF_F_RXHASH)
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
e1000e_setup_rss_hash(adapter); e1000_setup_rctl(adapter); e1000_configure_rx(adapter);adapter->netdev->features))
@@ -5304,20 +5315,26 @@ static void e1000_watchdog_task(struct work_struct *work) case SPEED_10: case SPEED_100: e_info("10/100 speed: disabling TSO\n");
netdev->features &= ~NETIF_F_TSO;
netdev->features &= ~NETIF_F_TSO6;
netdev_feature_clear_bit(NETIF_F_TSO_BIT,
&netdev->features);
netdev_feature_clear_bit(NETIF_F_TSO6_BIT,
&netdev->features); break; case SPEED_1000:
netdev->features |= NETIF_F_TSO;
netdev->features |= NETIF_F_TSO6;
netdev_feature_clear_bit(NETIF_F_TSO_BIT,
&netdev->features);
netdev_feature_clear_bit(NETIF_F_TSO6_BIT,
&netdev->features); break; default: /* oops */ break; } if (hw->mac.type == e1000_pch_spt) {
netdev->features &= ~NETIF_F_TSO;
netdev->features &= ~NETIF_F_TSO6;
netdev_feature_clear_bit(NETIF_F_TSO_BIT,
&netdev->features);
netdev_feature_clear_bit(NETIF_F_TSO6_BIT,
&netdev->features); } }
@@ -7295,33 +7312,38 @@ static void 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_clear_bit(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.
*/
- if (*features & NETIF_F_HW_VLAN_CTAG_RX)
*features |= NETIF_F_HW_VLAN_CTAG_TX;
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features))
elsenetdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
*features &= ~NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
features);
}
static int e1000_set_features(struct net_device *netdev, netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev);
- netdev_features_t changed = features ^ netdev->features;
- netdev_features_t changed;
- if (changed & (NETIF_F_TSO | NETIF_F_TSO6))
- netdev_feature_xor(&changed, features, netdev->features);
- if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, changed)) adapter->flags |= FLAG_TSO_FORCE;
- if (!(changed & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_RXFCS |
NETIF_F_RXALL)))
- if (!netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXCSUM |
NETIF_F_RXHASH | NETIF_F_RXFCS |
NETIF_F_RXALL | NETIF_F_HW_VLAN_CTAG_RX,
return 0;changed))
- if (changed & NETIF_F_RXFCS) {
if (features & NETIF_F_RXFCS) {
- if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, changed)) {
} else { /* We need to take it back to defaults, which might meanif (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, features)) { adapter->flags2 &= ~FLAG2_CRC_STRIPPING;
@@ -7334,7 +7356,7 @@ static int e1000_set_features(struct net_device *netdev, } }
- netdev->features = features;
netdev_feature_copy(&netdev->features, features);
if (netif_running(netdev)) e1000e_reinit_locked(adapter);
@@ -7524,34 +7546,39 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) "PHY reset is blocked due to SOL/IDER session.\n");
/* Set initial default active device features */
- netdev->features = (NETIF_F_SG |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM);
netdev_feature_zero(&netdev->features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM,
&netdev->features);
/* Set user-changeable features (subset of all device features) */
- netdev->hw_features = netdev->features;
- netdev->hw_features |= NETIF_F_RXFCS;
- netdev_feature_copy(&netdev->hw_features, netdev->features);
- netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS;
- netdev->hw_features |= NETIF_F_RXALL;
netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features);
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER)
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&netdev->features);
- netdev->vlan_features |= (NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_HW_CSUM);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_HW_CSUM,
&netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT;
if (pci_using_dac) {
netdev->features |= NETIF_F_HIGHDMA;
netdev->vlan_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT,
&netdev->vlan_features);
}
/* MTU range: 68 - max_hw_frame_size */
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c index 3362f26..ed2871d 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c @@ -352,7 +352,8 @@ static inline void fm10k_rx_checksum(struct fm10k_ring *ring, skb_checksum_none_assert(skb);
/* Rx checksum disabled via ethtool */
- if (!(ring->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
ring->netdev->features))
return;
/* TCP/UDP checksum error bit is set */
@@ -388,7 +389,8 @@ static inline void fm10k_rx_hash(struct fm10k_ring *ring, { u16 rss_type;
- if (!(ring->netdev->features & NETIF_F_RXHASH))
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
ring->netdev->features))
return;
rss_type = le16_to_cpu(rx_desc->w.pkt_info) & FM10K_RXD_RSSTYPE_MASK;
@@ -772,7 +774,8 @@ static int fm10k_tso(struct fm10k_ring *tx_ring, return 1;
err_vxlan:
- tx_ring->netdev->features &= ~NETIF_F_GSO_UDP_TUNNEL;
- netdev_feature_clear_bit(NETIF_F_GSO_UDP_TUNNEL_BIT,
if (net_ratelimit()) netdev_err(tx_ring->netdev, "TSO requested for unsupported tunnel, disabling offload\n");&tx_ring->netdev->features);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c index a311bcd..e3747f3 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c @@ -1510,7 +1510,8 @@ static void fm10k_features_check(struct sk_buff *skb, struct net_device *dev, if (!skb->encapsulation || fm10k_tx_encap_offload(skb)) return;
- *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK,
features);
}
static const struct net_device_ops fm10k_netdev_ops = {
@@ -1556,50 +1557,56 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) interface->msg_enable = BIT(DEFAULT_DEBUG_LEVEL_SHIFT) - 1;
/* configure default features */
- dev->features |= NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_TSO_ECN |
NETIF_F_RXHASH |
NETIF_F_RXCSUM;
netdev_feature_set_bits(NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_TSO_ECN |
NETIF_F_RXHASH |
NETIF_F_RXCSUM,
&dev->features);
/* Only the PF can support VXLAN and NVGRE tunnel offloads */ if (info->mac == fm10k_mac_pf) {
dev->hw_enc_features = NETIF_F_IP_CSUM |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_TSO_ECN |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_IPV6_CSUM |
NETIF_F_SG;
dev->features |= NETIF_F_GSO_UDP_TUNNEL;
netdev_feature_set_bits(NETIF_F_IP_CSUM |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_TSO_ECN |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_IPV6_CSUM |
NETIF_F_SG,
&dev->hw_enc_features);
netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT,
&dev->features);
dev->udp_tunnel_nic_info = &fm10k_udp_tunnels; }
/* all features defined to this point should be changeable */
- hw_features = dev->features;
netdev_feature_copy(&hw_features, dev->features);
/* allow user to enable L2 forwarding acceleration */
- hw_features |= NETIF_F_HW_L2FW_DOFFLOAD;
netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, &hw_features);
/* configure VLAN features */
- dev->vlan_features |= dev->features;
netdev_feature_or(&dev->vlan_features, dev->vlan_features,
dev->features);
/* we want to leave these both on as we cannot disable VLAN tag
- insertion or stripping on the hardware since it is contained
- in the FTAG and not in the frame itself.
*/
- dev->features |= NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER,
&dev->features);
dev->priv_flags |= IFF_UNICAST_FLT;
- dev->hw_features |= hw_features;
netdev_feature_or(&dev->hw_features, dev->hw_features,
hw_features);
/* MTU range: 68 - 15342 */ dev->min_mtu = ETH_MIN_MTU;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c index adfa276..48c1206 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c @@ -305,9 +305,11 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface) }
if (hw->mac.vlan_override)
netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
else&netdev->features);
netdev->features |= NETIF_F_HW_VLAN_CTAG_RX;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
&netdev->features);
}
err = netif_running(netdev) ? fm10k_open(netdev) : 0;
@@ -2010,8 +2012,9 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
/* update netdev with DMA restrictions */ if (dma_get_mask(&pdev->dev) > DMA_BIT_MASK(32)) {
netdev->features |= NETIF_F_HIGHDMA;
netdev->vlan_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT,
&netdev->vlan_features);
}
/* reset and initialize the hardware so it is in a known state */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index e493c5a..fd81fd0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -2962,7 +2962,8 @@ static void i40e_restore_vlan(struct i40e_vsi *vsi) if (!vsi->netdev) return;
- if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
i40e_vlan_stripping_enable(vsi); else i40e_vlan_stripping_disable(vsi);vsi->netdev->features))
@@ -12541,7 +12542,7 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features) /* Check if Flow Director n-tuple support was enabled or disabled. If * the state changed, we need to reset. */
- if (features & NETIF_F_NTUPLE) {
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) { /* Enable filters and mark for reset */ if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) need_reset = true;
@@ -12610,24 +12611,27 @@ static int i40e_set_features(struct net_device *netdev, struct i40e_pf *pf = vsi->back; bool need_reset;
- if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH))
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) &&
i40e_pf_config_rss(pf);!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features))
- else if (!(features & NETIF_F_RXHASH) &&
netdev->features & NETIF_F_RXHASH)
- else if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) &&
i40e_clear_rss_lut(vsi);netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features))
- if (features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) i40e_vlan_stripping_enable(vsi); else i40e_vlan_stripping_disable(vsi);
- if (!(features & NETIF_F_HW_TC) && pf->num_cloud_filters) {
- if (!netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) &&
dev_err(&pf->pdev->dev, "Offloaded tc filters active, can't turn hw_tc_offload off"); return -EINVAL; }pf->num_cloud_filters) {
- if (!(features & NETIF_F_HW_L2FW_DOFFLOAD) && vsi->macvlan_cnt)
if (!netdev_feature_test_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, features) &&
vsi->macvlan_cnt)
i40e_del_all_macvlans(vsi);
need_reset = i40e_set_ntuple(pf, features);
@@ -12889,7 +12893,7 @@ static void i40e_features_check(struct sk_buff *skb, struct net_device *dev, * 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;
netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
/* MACLEN can support at most 63 words */ len = skb_network_header(skb) - skb->data;
@@ -12921,7 +12925,8 @@ static void i40e_features_check(struct sk_buff *skb, struct net_device *dev,
return; out_err:
- *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK,
features);
}
/**
@@ -13324,53 +13329,71 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) np = netdev_priv(netdev); np->vsi = vsi;
- hw_enc_features = NETIF_F_SG |
NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_HIGHDMA |
NETIF_F_SOFT_FEATURES |
NETIF_F_TSO |
NETIF_F_TSO_ECN |
NETIF_F_TSO6 |
NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_UDP_L4 |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
0;
netdev_feature_zero(&hw_enc_features);
netdev_feature_set_bits(NETIF_F_SG_BIT |
NETIF_F_IP_CSUM_BIT |
NETIF_F_IPV6_CSUM_BIT |
NETIF_F_HIGHDMA_BIT |
NETIF_F_GSO_BIT |
NETIF_F_GRO_BIT |
NETIF_F_TSO_BIT |
NETIF_F_TSO_ECN_BIT |
NETIF_F_TSO6_BIT |
NETIF_F_GSO_GRE_BIT |
NETIF_F_GSO_GRE_CSUM_BIT |
NETIF_F_GSO_PARTIAL_BIT |
NETIF_F_GSO_IPXIP4_BIT |
NETIF_F_GSO_IPXIP6_BIT |
NETIF_F_GSO_UDP_TUNNEL_BIT |
NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT |
NETIF_F_GSO_UDP_L4_BIT |
NETIF_F_SCTP_CRC_BIT |
NETIF_F_RXHASH_BIT |
NETIF_F_RXCSUM_BIT,
&hw_enc_features);
if (!(pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE))
netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,
&netdev->gso_partial_features);
netdev->udp_tunnel_nic_info = &pf->udp_tunnel_nic;
- netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
- netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT,
&netdev->gso_partial_features);
- netdev->hw_enc_features |= hw_enc_features;
netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features,
hw_enc_features);
/* record features VLANs can make use of */
- netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID;
netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
hw_enc_features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->vlan_features);
/* enable macvlan offloads */
- netdev->hw_features |= NETIF_F_HW_L2FW_DOFFLOAD;
- netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT,
&netdev->hw_features);
- hw_features = hw_enc_features |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
- netdev_feature_copy(&hw_features, hw_enc_features);
- netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
&hw_features);
- netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
&hw_features);
- if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC;
- if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) {
netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &hw_features);
netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features);
- }
- netdev->hw_features |= hw_features;
- netdev_feature_or(&netdev->hw_features, netdev->hw_features,
hw_features);
- netdev->features |= hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
- netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
netdev_feature_or(&netdev->features, netdev->features,
hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&netdev->features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->hw_enc_features);
if (vsi->type == I40E_VSI_MAIN) { SET_NETDEV_DEV(netdev, &pf->pdev->dev);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 3f25bd8..ee5fbd5 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1793,7 +1793,8 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, skb_checksum_none_assert(skb);
/* Rx csum enabled and ip headers found? */
- if (!(vsi->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
vsi->netdev->features))
return;
/* did the hardware decode the packet and checksum? */
@@ -1895,7 +1896,8 @@ static inline void i40e_rx_hash(struct i40e_ring *ring, cpu_to_le64((u64)I40E_RX_DESC_FLTSTAT_RSS_HASH << I40E_RX_DESC_STATUS_FLTSTAT_SHIFT);
- if (!(ring->netdev->features & NETIF_F_RXHASH))
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
ring->netdev->features))
return;
if ((rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask) {
@@ -2944,7 +2946,8 @@ static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, u32 tx_flags = 0;
if (protocol == htons(ETH_P_8021Q) &&
!(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) {
!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
/* When HW VLAN acceleration is turned off by the user thetx_ring->netdev->features)) {
- stack sets the protocol to 8021q so that the driver
- can take any steps required to support the SW only
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index e46395a0..f4d89e6 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -1897,7 +1897,7 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) err); } dev_info(&pdev->dev, "MAC address: %pM\n", adapter->hw.mac.addr);
- if (netdev->features & NETIF_F_GRO)
if (netdev_feature_test_bit( NETIF_F_GRO_BIT, netdev->features)) dev_info(&pdev->dev, "GRO is enabled\n");
adapter->state = __IAVF_DOWN;
@@ -3359,15 +3359,20 @@ static int iavf_set_features(struct net_device *netdev, netdev_features_t features) { struct iavf_adapter *adapter = netdev_priv(netdev);
netdev_features_t changed;
netdev_feature_xor(&changed, netdev->features, features); /* Don't allow changing VLAN_RX flag when adapter is not capable
- of VLAN offload
*/ if (!VLAN_ALLOWED(adapter)) {
if ((netdev->features ^ features) & NETIF_F_HW_VLAN_CTAG_RX)
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
changed)) return -EINVAL;
- } else if ((netdev->features ^ features) & NETIF_F_HW_VLAN_CTAG_RX) {
if (features & NETIF_F_HW_VLAN_CTAG_RX)
- } else if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
changed)) {
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
elsefeatures)) adapter->aq_required |= IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING;
@@ -3400,7 +3405,7 @@ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, * 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;
netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
/* MACLEN can support at most 63 words */ len = skb_network_header(skb) - skb->data;
@@ -3432,7 +3437,8 @@ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev,
return; out_err:
- *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK,
features);
}
/**
@@ -3448,9 +3454,10 @@ static void iavf_fix_features(struct net_device *netdev, struct iavf_adapter *adapter = netdev_priv(netdev);
if (!(adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
*features &= ~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER);
netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER,
features);
}
static const struct net_device_ops iavf_netdev_ops = {
@@ -3535,84 +3542,103 @@ int iavf_process_config(struct iavf_adapter *adapter) } adapter->num_req_queues = 0;
- hw_enc_features = NETIF_F_SG |
NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_HIGHDMA |
NETIF_F_SOFT_FEATURES |
NETIF_F_TSO |
NETIF_F_TSO_ECN |
NETIF_F_TSO6 |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
0;
netdev_feature_zero(&hw_enc_features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_HIGHDMA |
NETIF_F_SOFT_FEATURES |
NETIF_F_TSO |
NETIF_F_TSO_ECN |
NETIF_F_TSO6 |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM,
&hw_enc_features);
/* advertise to stack only if offloads for encapsulated packets is
- supported
*/ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ENCAP) {
hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL |
0;
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL,
&hw_enc_features);
if (!(vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM))
netdev->gso_partial_features |=
NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,
&netdev->gso_partial_features);
netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
netdev->hw_enc_features |= hw_enc_features;
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT,
&netdev->gso_partial_features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->hw_enc_features);
netdev_feature_or(&netdev->hw_enc_features,
} /* record features VLANs can make use of */netdev->hw_enc_features, hw_enc_features);
- netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID;
netdev_feature_or(&netdev->vlan_features,
netdev->vlan_features, hw_enc_features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->vlan_features);
/* Write features and hw_features separately to avoid polluting
- with, or dropping, features that are set when we registered.
*/
- hw_features = hw_enc_features;
netdev_feature_copy(&hw_features, hw_enc_features);
/* Enable VLAN features if supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)
hw_features |= (NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
/* Enable cloud filter if ADQ is supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ)NETIF_F_HW_VLAN_CTAG_RX, &hw_features);
hw_features |= NETIF_F_HW_TC;
if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_USO)netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features);
hw_features |= NETIF_F_GSO_UDP_L4;
netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &hw_features);
- netdev->hw_features |= hw_features;
- netdev_feature_or(&netdev->hw_features, netdev->hw_features,
hw_features);
- netdev->features |= hw_features;
netdev_feature_or(&netdev->features, netdev->features, hw_features);
if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN)
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
/* Do not turn on offloads when they are requested to be turned off.
- TSO needs minimum 576 bytes to work correctly.
*/
- if (netdev->wanted_features) {
if (!(netdev->wanted_features & NETIF_F_TSO) ||
- if (!netdev_feature_empty(netdev->wanted_features)) {
if (!netdev_feature_test_bit(NETIF_F_TSO_BIT,
netdev->mtu < 576)netdev->wanted_features) ||
netdev->features &= ~NETIF_F_TSO;
if (!(netdev->wanted_features & NETIF_F_TSO6) ||
netdev_feature_clear_bit(NETIF_F_TSO_BIT,
&netdev->features);
if (!netdev_feature_test_bit(NETIF_F_TSO6_BIT,
netdev->mtu < 576)netdev->wanted_features) ||
netdev->features &= ~NETIF_F_TSO6;
if (!(netdev->wanted_features & NETIF_F_TSO_ECN))
netdev->features &= ~NETIF_F_TSO_ECN;
if (!(netdev->wanted_features & NETIF_F_GRO))
netdev->features &= ~NETIF_F_GRO;
if (!(netdev->wanted_features & NETIF_F_GSO))
netdev->features &= ~NETIF_F_GSO;
netdev_feature_clear_bit(NETIF_F_TSO6_BIT,
&netdev->features);
if (!netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT,
netdev->wanted_features))
netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT,
&netdev->features);
if (!netdev_feature_test_bit(NETIF_F_GRO_BIT,
netdev->wanted_features))
netdev_feature_clear_bit(NETIF_F_GRO_BIT,
&netdev->features);
if (!netdev_feature_test_bit(NETIF_F_GSO_BIT,
netdev->wanted_features))
netdev_feature_clear_bit(NETIF_F_GSO_BIT,
&netdev->features);
}
adapter->vsi.id = adapter->vsi_res->vsi_id;
diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c index 3525eab..2293ad26 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -862,7 +862,8 @@ static void iavf_receive_skb(struct iavf_ring *rx_ring, { struct iavf_q_vector *q_vector = rx_ring->q_vector;
- if ((rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
(vlan_tag & VLAN_VID_MASK)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);rx_ring->netdev->features) &&
@@ -963,7 +964,8 @@ static inline void iavf_rx_checksum(struct iavf_vsi *vsi, skb_checksum_none_assert(skb);
/* Rx csum enabled and ip headers found? */
- if (!(vsi->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
vsi->netdev->features))
return;
/* did the hardware decode the packet and checksum? */
@@ -1058,7 +1060,8 @@ static inline void iavf_rx_hash(struct iavf_ring *ring, cpu_to_le64((u64)IAVF_RX_DESC_FLTSTAT_RSS_HASH << IAVF_RX_DESC_STATUS_FLTSTAT_SHIFT);
- if (ring->netdev->features & NETIF_F_RXHASH)
if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
ring->netdev->features))
return;
if ((rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask) {
@@ -1789,7 +1792,8 @@ static inline int iavf_tx_prepare_vlan_flags(struct sk_buff *skb, u32 tx_flags = 0;
if (protocol == htons(ETH_P_8021Q) &&
!(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) {
!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
/* When HW VLAN acceleration is turned off by the user thetx_ring->netdev->features)) {
- stack sets the protocol to 8021q so that the driver
- can take any steps required to support the SW only
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 54cb9af..dd9332a 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3053,53 +3053,74 @@ static void ice_set_netdev_features(struct net_device *netdev)
if (ice_is_safe_mode(pf)) { /* safe mode */
netdev->features = NETIF_F_SG | NETIF_F_HIGHDMA;
netdev->hw_features = netdev->features;
netdev_feature_zero(&netdev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA,
&netdev->features);
return; }netdev_feature_copy(&netdev->hw_features, netdev->features);
- dflt_features = NETIF_F_SG |
NETIF_F_HIGHDMA |
NETIF_F_NTUPLE |
NETIF_F_RXHASH;
- csumo_features = NETIF_F_RXCSUM |
NETIF_F_IP_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_IPV6_CSUM;
- vlano_features = NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
- tso_features = NETIF_F_TSO |
NETIF_F_TSO_ECN |
NETIF_F_TSO6 |
NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_L4;
- netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM;
- netdev_feature_zero(&dflt_features);
- netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_HIGHDMA |
NETIF_F_NTUPLE |
NETIF_F_RXHASH,
&dflt_features);
- netdev_feature_zero(&csumo_features);
- netdev_feature_set_bits(NETIF_F_RXCSUM |
NETIF_F_IP_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_IPV6_CSUM,
&csumo_features);
- netdev_feature_zero(&vlano_features);
- netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX,
&vlano_features);
- netdev_feature_zero(&tso_features);
- netdev_feature_set_bits(NETIF_F_TSO |
NETIF_F_TSO_ECN |
NETIF_F_TSO6 |
NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_L4,
&tso_features);
- netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM,
/* set features that user can change */&netdev->gso_partial_features);
- netdev->hw_features = dflt_features | csumo_features |
vlano_features | tso_features;
netdev_feature_or(&netdev->hw_features, dflt_features,
csumo_features);
netdev_feature_or(&netdev->hw_features, netdev->hw_features,
vlano_features);
netdev_feature_or(&netdev->hw_features, netdev->hw_features,
tso_features);
/* add support for HW_CSUM on packets with MPLS header */
- netdev->mpls_features = NETIF_F_HW_CSUM;
netdev_feature_zero(&netdev->mpls_features);
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features);
/* enable features */
- netdev->features |= netdev->hw_features;
- netdev_feature_or(&netdev->features, netdev->features,
/* encap and VLAN devices inherit default, csumo and tso features */netdev->hw_features);
- netdev->hw_enc_features |= dflt_features | csumo_features |
tso_features;
- netdev->vlan_features |= dflt_features | csumo_features |
tso_features;
netdev_feature_or(&netdev->hw_enc_features, dflt_features,
csumo_features);
netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features,
tso_features);
netdev_feature_or(&netdev->vlan_features, dflt_features,
csumo_features);
netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
tso_features);
}
/**
@@ -5341,39 +5362,51 @@ ice_set_features(struct net_device *netdev, netdev_features_t features) /* Multiple features can be changed in one call so keep features in * separate if/else statements to guarantee each feature is checked */
- if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH))
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) &&
ice_vsi_manage_rss_lut(vsi, true);!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features))
- else if (!(features & NETIF_F_RXHASH) &&
netdev->features & NETIF_F_RXHASH)
- else if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) &&
ice_vsi_manage_rss_lut(vsi, false);netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features))
- if ((features & NETIF_F_HW_VLAN_CTAG_RX) &&
!(netdev->features & NETIF_F_HW_VLAN_CTAG_RX))
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) &&
!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
ret = ice_vsi_manage_vlan_stripping(vsi, true);netdev->features))
- else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) &&
(netdev->features & NETIF_F_HW_VLAN_CTAG_RX))
- else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
features) &&
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
ret = ice_vsi_manage_vlan_stripping(vsi, false);netdev->features))
- if ((features & NETIF_F_HW_VLAN_CTAG_TX) &&
!(netdev->features & NETIF_F_HW_VLAN_CTAG_TX))
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features) &&
!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
ret = ice_vsi_manage_vlan_insertion(vsi);netdev->features))
- else if (!(features & NETIF_F_HW_VLAN_CTAG_TX) &&
(netdev->features & NETIF_F_HW_VLAN_CTAG_TX))
- else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
features) &&
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
ret = ice_vsi_manage_vlan_insertion(vsi);netdev->features))
- if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
!(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
features) &&
!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
ret = ice_cfg_vlan_pruning(vsi, true, false);netdev->features))
- else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
- else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
features) &&
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
ret = ice_cfg_vlan_pruning(vsi, false, false);netdev->features))
- if ((features & NETIF_F_NTUPLE) &&
!(netdev->features & NETIF_F_NTUPLE)) {
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) &&
ice_vsi_manage_fdir(vsi, true); ice_init_arfs(vsi);!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->features)) {
- } else if (!(features & NETIF_F_NTUPLE) &&
(netdev->features & NETIF_F_NTUPLE)) {
- } else if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) &&
netdev_feature_test_bit(NETIF_F_NTUPLE_BIT,
ice_vsi_manage_fdir(vsi, false); ice_clear_arfs(vsi); }netdev->features)) {
@@ -5389,9 +5422,11 @@ static int ice_vsi_vlan_setup(struct ice_vsi *vsi) { int ret = 0;
- if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
ret = ice_vsi_manage_vlan_stripping(vsi, true);vsi->netdev->features))
- if (vsi->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
vsi->netdev->features))
ret = ice_vsi_manage_vlan_insertion(vsi);
return ret;
@@ -7179,7 +7214,7 @@ static void ice_features_check(struct sk_buff *skb, * 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;
netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
len = skb_network_header(skb) - skb->data; if (len > ICE_TXD_MACLEN_MAX || len & 0x1)
@@ -7202,7 +7237,8 @@ static void ice_features_check(struct sk_buff *skb,
return; out_rm_features:
- *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK,
features);
}
static const struct net_device_ops ice_netdev_safe_mode_ops = {
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 171397d..6ab2c65 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -72,7 +72,8 @@ ice_rx_hash(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc, struct ice_32b_rx_flex_desc_nic *nic_mdid; u32 hash;
- if (!(rx_ring->netdev->features & NETIF_F_RXHASH))
if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
rx_ring->netdev->features))
return;
if (rx_desc->wb.rxdid != ICE_RXDID_FLEX_NIC)
@@ -110,7 +111,8 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb, skb_checksum_none_assert(skb);
/* check if Rx checksum is enabled */
- if (!(ring->netdev->features & NETIF_F_RXCSUM))
- if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
ring->netdev->features))
it should be "NETIF_F_RXCSUM_BIT", not "NETIF_F_RXHASH_BIT"
return;
/* check if HW has decoded the packet and checksum */ @@ -205,7 +207,8 @@ ice_process_skb_fields(struct ice_ring *rx_ring, void ice_receive_skb(struct ice_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag) {
- if ((rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
- if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
(vlan_tag & VLAN_VID_MASK)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); napi_gro_receive(&rx_ring->q_vector->napi, skb);rx_ring->netdev->features) &&
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 17f5c00..898f246 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -2897,7 +2897,7 @@ static int igb_add_ethtool_nfc_entry(struct igb_adapter *adapter, struct igb_nfc_filter *input, *rule; int err = 0;
- if (!(netdev->hw_features & NETIF_F_NTUPLE))
if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features)) return -EOPNOTSUPP;
/* Don't allow programming if the action is a queue greater than
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 2e4a53c..1f764d4 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2439,25 +2439,28 @@ static void igb_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */
- if (*features & NETIF_F_HW_VLAN_CTAG_RX)
*features |= NETIF_F_HW_VLAN_CTAG_TX;
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features))
elsenetdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
*features &= ~NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
features);
}
static int igb_set_features(struct net_device *netdev, netdev_features_t features) {
- netdev_features_t changed = netdev->features ^ features; struct igb_adapter *adapter = netdev_priv(netdev);
- netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX)
- netdev_feature_xor(&changed, netdev->features, features);
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igb_vlan_mode(netdev, features);
- if (!(changed & (NETIF_F_RXALL | NETIF_F_NTUPLE)))
- if (!netdev_feature_test_bits(NETIF_F_RXALL | NETIF_F_NTUPLE, changed)) return 0;
- if (!(features & NETIF_F_NTUPLE)) {
- if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) { struct hlist_node *node2; struct igb_nfc_filter *rule;
@@ -2472,7 +2475,7 @@ static int igb_set_features(struct net_device *netdev, adapter->nfc_filter_count = 0; }
- netdev->features = features;
netdev_feature_copy(&netdev->features, features);
if (netif_running(netdev)) igb_reinit_locked(adapter);
@@ -2511,30 +2514,33 @@ static void igb_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) {
*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);
netdev_feature_clear_bits(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,
features);
return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_GSO_UDP_L4 |
NETIF_F_TSO |
NETIF_F_TSO6,
features);
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;
if (skb->encapsulation &&
!netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features))
netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
}
static void igb_offload_apply(struct igb_adapter *adapter, s32 queue)
@@ -3266,18 +3272,20 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * set by igb_sw_init so we should use an or instead of an * assignment. */
- netdev->features |= NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM;
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM,
&netdev->features);
if (hw->mac.type >= e1000_82576)
netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4;
netdev_feature_set_bits(NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4,
&netdev->features);
if (hw->mac.type >= e1000_i350)
netdev->features |= NETIF_F_HW_TC;
netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features);
#define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \
@@ -3286,29 +3294,41 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IGB_GSO_PARTIAL_FEATURES;
- netdev->features |= NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES;
netdev_feature_zero(&netdev->gso_partial_features);
netdev_feature_set_bits(IGB_GSO_PARTIAL_FEATURES,
&netdev->gso_partial_features);
netdev_feature_set_bits(NETIF_F_GSO_PARTIAL |
IGB_GSO_PARTIAL_FEATURES,
&netdev->features);
/* copy netdev features into list of user selectable features */
- netdev->hw_features |= netdev->features |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_RXALL;
netdev_feature_or(&netdev->hw_features, netdev->hw_features,
netdev->features);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_RXALL,
&netdev->hw_features);
if (hw->mac.type >= e1000_i350)
netdev->hw_features |= NETIF_F_NTUPLE;
netdev_feature_set_bit(NETIF_F_NTUPLE_BIT,
&netdev->hw_features);
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
- netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
- netdev->mpls_features |= NETIF_F_HW_CSUM;
- netdev->hw_enc_features |= netdev->vlan_features;
netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
netdev->features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->vlan_features);
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features);
netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features,
netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */
- netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX,
&netdev->features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
@@ -4539,7 +4559,8 @@ void igb_setup_rctl(struct igb_adapter *adapter) }
/* This is useful for sniffing bad packets. */
- if (adapter->netdev->features & NETIF_F_RXALL) {
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT,
/* UPE and MPE will be handled by normal PROMISC logicadapter->netdev->features)) {
*/
- in e1000e_set_rx_mode
@@ -5045,7 +5066,8 @@ static int igb_vlan_promisc_enable(struct igb_adapter *adapter) case e1000_i211: case e1000_i350: /* VLAN filtering needed for VLAN prio filter */
if (adapter->netdev->features & NETIF_F_NTUPLE)
if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT,
fallthrough; case e1000_82576:adapter->netdev->features)) break;
@@ -5217,7 +5239,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
/* disable VLAN filtering for modes that require it */ if ((netdev->flags & IFF_PROMISC) ||
(netdev->features & NETIF_F_RXALL)) {
/* if we fail to set all rules then just clear VFE */ if (igb_vlan_promisc_enable(adapter)) rctl &= ~E1000_RCTL_VFE;netdev_feature_test_bit(NETIF_F_RXALL_BIT, netdev->features)) {
@@ -8467,7 +8489,8 @@ static inline void igb_rx_checksum(struct igb_ring *ring, return;
/* Rx checksum disabled via ethtool */
- if (!(ring->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
ring->netdev->features))
return;
/* TCP/UDP checksum error bit is set */
@@ -8500,7 +8523,8 @@ static inline void igb_rx_hash(struct igb_ring *ring, union e1000_adv_rx_desc *rx_desc, struct sk_buff *skb) {
- if (ring->netdev->features & NETIF_F_RXHASH)
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss), PKT_HASH_TYPE_L3);ring->netdev->features))
@@ -8558,7 +8582,8 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring, if (unlikely((igb_test_staterr(rx_desc, E1000_RXDEXT_ERR_FRAME_ERR_MASK)))) { struct net_device *netdev = rx_ring->netdev;
if (!(netdev->features & NETIF_F_RXALL)) {
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
}netdev->features)) { dev_kfree_skb_any(skb); return true;
@@ -8595,7 +8620,8 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring, !igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) igb_ptp_rx_rgtstamp(rx_ring->q_vector, skb);
- if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { u16 vid;dev->features) &&
@@ -9018,7 +9044,8 @@ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features) struct igb_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; u32 ctrl, rctl;
- bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
bool enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
features);
if (enable) { /* enable VLAN tag insert/strip */
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 92a46ac..2cad7a2 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2608,7 +2608,7 @@ static int igbvf_set_features(struct net_device *netdev, { struct igbvf_adapter *adapter = netdev_priv(netdev);
- if (features & NETIF_F_RXCSUM)
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) adapter->flags &= ~IGBVF_FLAG_RX_CSUM_DISABLED; else adapter->flags |= IGBVF_FLAG_RX_CSUM_DISABLED;
@@ -2627,28 +2627,31 @@ static void igbvf_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) {
*features &= ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6,
features);
return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_TSO |
NETIF_F_TSO6,
features);
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;
if (skb->encapsulation &&
!netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features))
netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
}
static const struct net_device_ops igbvf_netdev_ops = {
@@ -2767,12 +2770,14 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
adapter->bd_number = cards_found++;
- netdev->hw_features = NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC;
netdev_feature_zero(&netdev->hw_features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC,
&netdev->hw_features);
#define IGBVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \
@@ -2781,23 +2786,31 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IGBVF_GSO_PARTIAL_FEATURES;
- netdev->hw_features |= NETIF_F_GSO_PARTIAL |
IGBVF_GSO_PARTIAL_FEATURES;
- netdev_feature_zero(&netdev->gso_partial_features);
- netdev_feature_set_bits(IGBVF_GSO_PARTIAL_FEATURES,
&netdev->gso_partial_features);
- netdev_feature_set_bits(NETIF_F_GSO_PARTIAL |
IGBVF_GSO_PARTIAL_FEATURES,
&netdev->hw_features);
- netdev->features = netdev->hw_features;
netdev_feature_copy(&netdev->features, netdev->hw_features);
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
- netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
- netdev->mpls_features |= NETIF_F_HW_CSUM;
- netdev->hw_enc_features |= netdev->vlan_features;
netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
netdev->features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->vlan_features);
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features);
netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features,
netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */
- netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX,
&netdev->features);
/* MTU range: 68 - 9216 */ netdev->min_mtu = ETH_MIN_MTU;
diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index d3e8441..93fbe53 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1295,7 +1295,8 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter, struct igc_nfc_rule *rule, *old_rule; int err;
- if (!(netdev->hw_features & NETIF_F_NTUPLE)) {
- if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT,
netdev_dbg(netdev, "N-tuple filters disabled\n"); return -EOPNOTSUPP; }netdev->hw_features)) {
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index f7545a6..a384796 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -816,7 +816,8 @@ static void igc_setup_rctl(struct igc_adapter *adapter) wr32(IGC_RXDCTL(0), 0);
/* This is useful for sniffing bad packets. */
- if (adapter->netdev->features & NETIF_F_RXALL) {
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT,
/* UPE and MPE will be handled by normal PROMISC logicadapter->netdev->features)) {
*/
- in set_rx_mode
@@ -1521,7 +1522,8 @@ static void igc_rx_checksum(struct igc_ring *ring, return;
/* Rx checksum disabled via ethtool */
- if (!(ring->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
ring->netdev->features))
return;
/* TCP/UDP checksum error bit is set */
@@ -1554,7 +1556,8 @@ static inline void igc_rx_hash(struct igc_ring *ring, union igc_adv_rx_desc *rx_desc, struct sk_buff *skb) {
- if (ring->netdev->features & NETIF_F_RXHASH)
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss), PKT_HASH_TYPE_L3);ring->netdev->features))
@@ -1567,7 +1570,8 @@ static void igc_rx_vlan(struct igc_ring *rx_ring, struct net_device *dev = rx_ring->netdev; u16 vid;
- if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
igc_test_staterr(rx_desc, IGC_RXD_STAT_VP)) { if (igc_test_staterr(rx_desc, IGC_RXDEXT_STATERR_LB) && test_bit(IGC_RING_FLAG_RX_LB_VLAN_BSWAP, &rx_ring->flags))dev->features) &&
@@ -1606,7 +1610,8 @@ static void igc_process_skb_fields(struct igc_ring *rx_ring,
static void igc_vlan_mode(struct net_device *netdev, netdev_features_t features) {
- bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
- bool enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
struct igc_adapter *adapter = netdev_priv(netdev); struct igc_hw *hw = &adapter->hw; u32 ctrl;features);
@@ -1894,7 +1899,8 @@ static bool igc_cleanup_headers(struct igc_ring *rx_ring, if (unlikely(igc_test_staterr(rx_desc, IGC_RXDEXT_STATERR_RXE))) { struct net_device *netdev = rx_ring->netdev;
if (!(netdev->features & NETIF_F_RXALL)) {
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
}netdev->features)) { dev_kfree_skb_any(skb); return true;
@@ -4913,29 +4919,32 @@ static void igc_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */
- if (*features & NETIF_F_HW_VLAN_CTAG_RX)
*features |= NETIF_F_HW_VLAN_CTAG_TX;
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features))
elsenetdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features);
*features &= ~NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
features);
}
static int igc_set_features(struct net_device *netdev, netdev_features_t features) {
- netdev_features_t changed = netdev->features ^ features; struct igc_adapter *adapter = netdev_priv(netdev);
- netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX)
netdev_feature_xor(&changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igc_vlan_mode(netdev, features);
/* Add VLAN support */
- if (!(changed & (NETIF_F_RXALL | NETIF_F_NTUPLE)))
- if (!netdev_feature_test_bits(NETIF_F_RXALL | NETIF_F_NTUPLE, changed)) return 0;
- if (!(features & NETIF_F_NTUPLE))
- if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) igc_flush_nfc_rules(adapter);
- netdev->features = features;
netdev_feature_copy(&netdev->features, features);
if (netif_running(netdev)) igc_reinit_locked(adapter);
@@ -4953,28 +4962,31 @@ static void igc_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) {
*features &= ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6,
features);
return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_TSO |
NETIF_F_TSO6,
features);
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;
if (skb->encapsulation &&
!netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features))
netdev_feature_clear_bits(NETIF_F_TSO_BIT, features);
}
static void igc_tsync_interrupt(struct igc_adapter *adapter)
@@ -6230,14 +6242,14 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* Add supported features to the features list*/
- netdev->features |= NETIF_F_SG;
- netdev->features |= NETIF_F_TSO;
- netdev->features |= NETIF_F_TSO6;
- netdev->features |= NETIF_F_TSO_ECN;
- netdev->features |= NETIF_F_RXCSUM;
- netdev->features |= NETIF_F_HW_CSUM;
- netdev->features |= NETIF_F_SCTP_CRC;
- netdev->features |= NETIF_F_HW_TC;
netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_SCTP_CRC_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features);
#define IGC_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \
@@ -6246,8 +6258,11 @@ static int igc_probe(struct pci_dev *pdev, NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IGC_GSO_PARTIAL_FEATURES;
- netdev->features |= NETIF_F_GSO_PARTIAL | IGC_GSO_PARTIAL_FEATURES;
netdev_feature_zero(&netdev->gso_partial_features);
netdev_feature_set_bits(IGC_GSO_PARTIAL_FEATURES,
&netdev->gso_partial_features);
netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGC_GSO_PARTIAL_FEATURES,
&netdev->features);
/* setup the private structure */ err = igc_sw_init(adapter);
@@ -6255,15 +6270,19 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* copy netdev features into list of user selectable features */
- netdev->hw_features |= NETIF_F_NTUPLE;
- netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX;
- netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
- netdev->hw_features |= netdev->features;
netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
&netdev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
&netdev->hw_features);
netdev_feature_or(&netdev->hw_features, netdev->hw_features,
netdev->features);
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
- netdev->vlan_features |= netdev->features;
netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
netdev->features);
/* MTU range: 68 - 9216 */ netdev->min_mtu = ETH_MIN_MTU;
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 34c1bfc..c56ac31 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -300,20 +300,26 @@ static void ixgb_fix_features(struct net_device *netdev, * Tx VLAN insertion does not work per HW design when Rx stripping is * disabled. */
- if (!(*features & NETIF_F_HW_VLAN_CTAG_RX))
*features &= ~NETIF_F_HW_VLAN_CTAG_TX;
if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features))
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
features);
}
static int ixgb_set_features(struct net_device *netdev, netdev_features_t features) { struct ixgb_adapter *adapter = netdev_priv(netdev);
- netdev_features_t changed = features ^ netdev->features;
- netdev_features_t changed;
- if (!(changed & (NETIF_F_RXCSUM|NETIF_F_HW_VLAN_CTAG_RX)))
- netdev_feature_xor(&changed, features, netdev->features);
- if (!netdev_feature_test_bits(NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_RX,
return 0;changed))
- adapter->rx_csum = !!(features & NETIF_F_RXCSUM);
adapter->rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
features);
if (netif_running(netdev)) { ixgb_down(adapter, true);
@@ -432,18 +438,22 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init;
- netdev->hw_features = NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
- netdev->features = netdev->hw_features |
NETIF_F_HW_VLAN_CTAG_FILTER;
- netdev->hw_features |= NETIF_F_RXCSUM;
netdev_feature_zero(&netdev->hw_features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX,
&netdev->hw_features);
netdev_feature_copy(&netdev->features, netdev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&netdev->features);
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features);
if (pci_using_dac) {
netdev->features |= NETIF_F_HIGHDMA;
netdev->vlan_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT,
&netdev->vlan_features);
}
/* MTU range: 68 - 16114 */
@@ -1098,7 +1108,8 @@ ixgb_set_multi(struct net_device *netdev) }
alloc_failed:
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
ixgb_vlan_strip_enable(adapter); else ixgb_vlan_strip_disable(adapter);netdev->features))
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index 72e6ebf..5516574 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c @@ -319,7 +319,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) int max_frame = adapter->netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
#ifdef IXGBE_FCOE
if (adapter->netdev->features & NETIF_F_FCOE_MTU)
if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT,
#endifadapter->netdev->features)) max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 4ceaca0..fa681c6 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -2391,7 +2391,7 @@ static bool ixgbe_update_rsc(struct ixgbe_adapter *adapter)
/* nothing to do if LRO or RSC are not enabled */ if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) ||
!(netdev->features & NETIF_F_LRO))
!netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features))
return false;
/* check the feature flag value and enable RSC if necessary */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 0fcd820..57009d1 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c @@ -644,7 +644,8 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) u32 etqf;
/* Minimal functionality for FCoE requires at least CRC offloads */
- if (!(adapter->netdev->features & NETIF_F_FCOE_CRC))
if (!netdev_feature_test_bit(NETIF_F_FCOE_CRC_BIT,
adapter->netdev->features))
return;
/* Enable L2 EtherType filter for FCoE, needed for FCoE CRC and DDP */
@@ -858,7 +859,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
/* enable FCoE and notify stack */ adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
- netdev->features |= NETIF_F_FCOE_MTU;
netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); netdev_features_change(netdev);
/* release existing queues and reallocate them */
@@ -898,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_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features);
netdev_features_change(netdev);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c index 0218f6c..38fe6323 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c @@ -978,7 +978,8 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state);
#ifdef IXGBE_FCOE
if (adapter->netdev->features & NETIF_F_FCOE_MTU) {
if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT,
adapter->netdev->features)) { struct ixgbe_ring_feature *f; f = &adapter->ring_feature[RING_F_FCOE]; if ((rxr_idx >= f->offset) &&
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index c43c99a..742947f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1423,7 +1423,8 @@ static inline void ixgbe_rx_hash(struct ixgbe_ring *ring, { u16 rss_type;
- if (!(ring->netdev->features & NETIF_F_RXHASH))
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
ring->netdev->features))
return;
rss_type = le16_to_cpu(rx_desc->wb.lower.lo_dword.hs_rss.pkt_info) &
@@ -1473,7 +1474,8 @@ static inline void ixgbe_rx_checksum(struct ixgbe_ring *ring, skb_checksum_none_assert(skb);
/* Rx csum disabled */
- if (!(ring->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
ring->netdev->features))
return;
/* check for VXLAN and Geneve packets */
@@ -1692,7 +1694,8 @@ void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring, if (unlikely(flags & IXGBE_FLAG_RX_HWTSTAMP_ENABLED)) ixgbe_ptp_rx_hwtstamp(rx_ring, rx_desc, skb);
- if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan); __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);dev->features) &&
@@ -1890,7 +1893,8 @@ bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, if (!netdev || (unlikely(ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_ERR_FRAME_ERR_MASK) &&
!(netdev->features & NETIF_F_RXALL)))) {
!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
dev_kfree_skb_any(skb); return true; }netdev->features)))) {
@@ -4897,9 +4901,11 @@ void ixgbe_set_rx_mode(struct net_device *netdev) struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_hw *hw = &adapter->hw; u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE;
- netdev_features_t features = netdev->features;
netdev_features_t features; int count;
netdev_feature_copy(&features, netdev->features);
/* Check for Promiscuous and All Multicast modes */ fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
@@ -4915,7 +4921,8 @@ 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_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
} else { if (netdev->flags & IFF_ALLMULTI) { fctrl |= IXGBE_FCTRL_MPE;&features);
@@ -4954,7 +4961,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) }
/* This is useful for sniffing bad packets. */
- if (features & NETIF_F_RXALL) {
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, features)) { /* UPE and MPE will be handled by normal PROMISC logic
fctrl |= (IXGBE_FCTRL_SBP | /* Receive bad packets */
- in e1000e_set_rx_mode */
@@ -4967,12 +4974,12 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
- if (features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) ixgbe_vlan_strip_enable(adapter); else ixgbe_vlan_strip_disable(adapter);
- if (features & NETIF_F_HW_VLAN_CTAG_FILTER)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) ixgbe_vlan_promisc_disable(adapter); else ixgbe_vlan_promisc_enable(adapter);
@@ -5054,7 +5061,8 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter) netif_set_gso_max_size(adapter->netdev, 32768);
#ifdef IXGBE_FCOE
- if (adapter->netdev->features & NETIF_F_FCOE_MTU)
- if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT,
max_frame = max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE); #endifadapter->netdev->features))
@@ -5111,7 +5119,7 @@ static int ixgbe_hpbthresh(struct ixgbe_adapter *adapter, int pb)
#ifdef IXGBE_FCOE /* FCoE traffic class uses FCOE jumbo frames */
- if ((dev->features & NETIF_F_FCOE_MTU) &&
- if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, dev->features) && (tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) && (pb == ixgbe_fcoe_get_tc(adapter))) tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
@@ -5172,7 +5180,7 @@ static int ixgbe_lpbthresh(struct ixgbe_adapter *adapter, int pb)
#ifdef IXGBE_FCOE /* FCoE traffic class uses FCOE jumbo frames */
- if ((dev->features & NETIF_F_FCOE_MTU) &&
- if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT, dev->features) && (tc < IXGBE_FCOE_JUMBO_FRAME_SIZE) && (pb == netdev_get_prio_tc_map(dev, adapter->fcoe.up))) tc = IXGBE_FCOE_JUMBO_FRAME_SIZE;
@@ -8698,7 +8706,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, #ifdef IXGBE_FCOE /* setup tx offload for FCoE */ if ((protocol == htons(ETH_P_FCOE)) &&
(tx_ring->netdev->features & (NETIF_F_FSO | NETIF_F_FCOE_CRC))) {
netdev_feature_test_bits(NETIF_F_FSO | NETIF_F_FCOE_CRC,
tso = ixgbe_fso(tx_ring, first, &hdr_len); if (tso < 0) goto out_drop;tx_ring->netdev->features)) {
@@ -9688,16 +9697,17 @@ static void ixgbe_fix_features(struct net_device *netdev, struct ixgbe_adapter *adapter = netdev_priv(netdev);
/* If Rx checksum is disabled, then RSC/LRO should also be disabled */
- if (!(*features & NETIF_F_RXCSUM))
*features &= ~NETIF_F_LRO;
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features))
netdev_feature_clear_bit(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_clear_bit(NETIF_F_LRO_BIT, features);
- if (adapter->xdp_prog && (*features & NETIF_F_LRO)) {
- if (adapter->xdp_prog &&
e_dev_err("LRO is not supported with XDP\n");netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) {
*features &= ~NETIF_F_LRO;
} }netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
@@ -9721,11 +9731,13 @@ static int ixgbe_set_features(struct net_device *netdev, netdev_features_t features) { struct ixgbe_adapter *adapter = netdev_priv(netdev);
- netdev_features_t changed = netdev->features ^ features;
netdev_features_t changed; bool need_reset = false;
netdev_feature_xor(&changed, netdev->features, features);
/* Make sure RSC matches LRO, reset if change */
- if (!(features & NETIF_F_LRO)) {
- if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) need_reset = true; adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
@@ -9735,7 +9747,8 @@ static int ixgbe_set_features(struct net_device *netdev, adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; need_reset = true;
} else if ((changed ^ features) & NETIF_F_LRO) {
} else if (!netdev_feature_test_bit(NETIF_F_LRO_BIT,
}changed)) { e_info(probe, "rx-usecs set too low, " "disabling RSC\n");
@@ -9745,7 +9758,8 @@ static int ixgbe_set_features(struct net_device *netdev, * Check if Flow Director n-tuple support or hw_tc support was * enabled or disabled. If the state changed, we need to reset. */
- if ((features & NETIF_F_NTUPLE) || (features & NETIF_F_HW_TC)) {
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) ||
/* turn off ATR, enable perfect filters and reset */ if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) need_reset = true;netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features)) {
@@ -9772,17 +9786,19 @@ static int ixgbe_set_features(struct net_device *netdev, adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; }
- if (changed & NETIF_F_RXALL)
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) need_reset = true;
- netdev->features = features;
- netdev_feature_copy(&netdev->features, features);
- if ((changed & NETIF_F_HW_L2FW_DOFFLOAD) && adapter->num_rx_pools > 1)
- if (netdev_feature_test_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, changed) &&
ixgbe_reset_l2fw_offload(adapter); else if (need_reset) ixgbe_do_reset(netdev);adapter->num_rx_pools > 1)
- else if (changed & (NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER))
else if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER,
changed))
ixgbe_set_rx_mode(netdev);
return 1;
@@ -10073,22 +10089,24 @@ static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) {
*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);
netdev_feature_clear_bits(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,
features);
return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_GSO_UDP_L4 |
NETIF_F_TSO |
NETIF_F_TSO6,
return; }features);
@@ -10097,11 +10115,12 @@ static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, * 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 &&
#ifdef CONFIG_IXGBE_IPSEC if (!secpath_exists(skb)) #endif!netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) {
*features &= ~NETIF_F_TSO;
} }netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
@@ -10787,12 +10806,14 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) skip_sriov:
#endif
- netdev->features = NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM;
netdev_feature_zero(&netdev->features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM,
&netdev->features);
#define IXGBE_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \
@@ -10801,12 +10822,17 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IXGBE_GSO_PARTIAL_FEATURES;
- netdev->features |= NETIF_F_GSO_PARTIAL |
IXGBE_GSO_PARTIAL_FEATURES;
netdev_feature_zero(&netdev->gso_partial_features);
netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES,
&netdev->gso_partial_features);
netdev_feature_set_bits(NETIF_F_GSO_PARTIAL |
IXGBE_GSO_PARTIAL_FEATURES,
&netdev->features);
if (hw->mac.type >= ixgbe_mac_82599EB)
netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4;
netdev_feature_set_bits(NETIF_F_SCTP_CRC |
NETIF_F_GSO_UDP_L4,
&netdev->features);
#ifdef CONFIG_IXGBE_IPSEC #define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \
@@ -10814,35 +10840,45 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_ESP)
if (adapter->ipsec)
netdev->features |= IXGBE_ESP_FEATURES;
#endif /* copy netdev features into list of user selectable features */netdev_feature_set_bits(IXGBE_ESP_FEATURES, &netdev->features);
- netdev->hw_features |= netdev->features |
NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_RXALL |
NETIF_F_HW_L2FW_DOFFLOAD;
netdev_feature_or(&netdev->hw_features, netdev->hw_features,
netdev->features);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_RXALL |
NETIF_F_HW_L2FW_DOFFLOAD,
&netdev->hw_features);
if (hw->mac.type >= ixgbe_mac_82599EB)
netdev->hw_features |= NETIF_F_NTUPLE |
NETIF_F_HW_TC;
netdev_feature_set_bits(NETIF_F_NTUPLE |
NETIF_F_HW_TC,
&netdev->hw_features);
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
- netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
- netdev->hw_enc_features |= netdev->vlan_features;
- netdev->mpls_features |= NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_HW_CSUM;
- netdev->mpls_features |= IXGBE_GSO_PARTIAL_FEATURES;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
netdev->features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->vlan_features);
netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features,
netdev->vlan_features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_HW_CSUM,
&netdev->mpls_features);
netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES,
&netdev->mpls_features);
/* set this bit last since it cannot be part of vlan_features */
- netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX,
&netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->priv_flags |= IFF_SUPP_NOFCS;
@@ -10870,18 +10906,20 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) fcoe_l = min_t(int, IXGBE_FCRETA_SIZE, num_online_cpus()); adapter->ring_feature[RING_F_FCOE].limit = fcoe_l;
netdev->features |= NETIF_F_FSO |
NETIF_F_FCOE_CRC;
netdev_feature_set_bits(NETIF_F_FSO |
NETIF_F_FCOE_CRC,
&netdev->features);
netdev->vlan_features |= NETIF_F_FSO |
NETIF_F_FCOE_CRC |
NETIF_F_FCOE_MTU;
netdev_feature_set_bits(NETIF_F_FSO |
NETIF_F_FCOE_CRC |
NETIF_F_FCOE_MTU,
} #endif /* IXGBE_FCOE */ if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)&netdev->vlan_features);
netdev->hw_features |= NETIF_F_LRO;
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->hw_features);
netdev->features |= NETIF_F_LRO;
netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->features);
if (ixgbe_check_fw_error(adapter)) { err = -EIO;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 214a38d..7a89d8e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -491,7 +491,8 @@ static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf s32 err = 0;
#ifdef CONFIG_FCOE
if (dev->features & NETIF_F_FCOE_MTU)
if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT,
dev->features)) pf_max_frame = max_t(int, pf_max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
@@ -869,7 +870,8 @@ static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf) int pf_max_frame = dev->mtu + ETH_HLEN;
#ifdef CONFIG_FCOE
if (dev->features & NETIF_F_FCOE_MTU)
if (netdev_feature_test_bit(NETIF_F_FCOE_MTU_BIT,
dev->features)) pf_max_frame = max_t(int, pf_max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c b/drivers/net/ethernet/intel/ixgbevf/ipsec.c index e3e4676..60288ef 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c +++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c @@ -104,7 +104,8 @@ void ixgbevf_ipsec_restore(struct ixgbevf_adapter *adapter) struct net_device *netdev = adapter->netdev; int i;
- if (!(adapter->netdev->features & NETIF_F_HW_ESP))
if (!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT,
adapter->netdev->features))
return;
/* reload the Rx and Tx keys */
@@ -654,8 +655,10 @@ void ixgbevf_init_ipsec_offload(struct ixgbevf_adapter *adapter) NETIF_F_HW_ESP_TX_CSUM | \ NETIF_F_GSO_ESP)
- adapter->netdev->features |= IXGBEVF_ESP_FEATURES;
- adapter->netdev->hw_enc_features |= IXGBEVF_ESP_FEATURES;
netdev_feature_set_bits(IXGBEVF_ESP_FEATURES,
&adapter->netdev->features);
netdev_feature_set_bits(IXGBEVF_ESP_FEATURES,
&adapter->netdev->hw_enc_features);
return;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index f2f6d00..f3d7e74 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -444,7 +444,8 @@ static inline void ixgbevf_rx_hash(struct ixgbevf_ring *ring, { u16 rss_type;
- if (!(ring->netdev->features & NETIF_F_RXHASH))
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
ring->netdev->features))
return;
rss_type = le16_to_cpu(rx_desc->wb.lower.lo_dword.hs_rss.pkt_info) &
@@ -471,7 +472,8 @@ static inline void ixgbevf_rx_checksum(struct ixgbevf_ring *ring, skb_checksum_none_assert(skb);
/* Rx csum disabled */
- if (!(ring->netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
ring->netdev->features))
return;
/* if IP and error */
@@ -742,7 +744,8 @@ static bool ixgbevf_cleanup_headers(struct ixgbevf_ring *rx_ring, IXGBE_RXDADV_ERR_FRAME_ERR_MASK))) { struct net_device *netdev = rx_ring->netdev;
if (!(netdev->features & NETIF_F_RXALL)) {
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
}netdev->features)) { dev_kfree_skb_any(skb); return true;
@@ -4389,28 +4392,31 @@ static void ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev, /* 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)) {
*features &= ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6,
features);
return; }
network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); 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);
netdev_feature_clear_bits(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
NETIF_F_TSO |
NETIF_F_TSO6,
features);
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;
if (skb->encapsulation &&
!netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features))
netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
}
static int ixgbevf_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
@@ -4581,12 +4587,14 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_sw_init; }
- netdev->hw_features = NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC;
netdev_feature_zero(&netdev->hw_features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_RXCSUM |
NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC,
&netdev->hw_features);
#define IXGBEVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \
@@ -4595,27 +4603,37 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev->gso_partial_features = IXGBEVF_GSO_PARTIAL_FEATURES;
- netdev->hw_features |= NETIF_F_GSO_PARTIAL |
IXGBEVF_GSO_PARTIAL_FEATURES;
- netdev_feature_zero(&netdev->gso_partial_features);
- netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES,
&netdev->gso_partial_features);
- netdev_feature_set_bits(NETIF_F_GSO_PARTIAL |
IXGBEVF_GSO_PARTIAL_FEATURES,
&netdev->hw_features);
- netdev->features = netdev->hw_features;
netdev_feature_copy(&netdev->features, netdev->hw_features);
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
- netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
- netdev->mpls_features |= NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_HW_CSUM;
- netdev->mpls_features |= IXGBEVF_GSO_PARTIAL_FEATURES;
- netdev->hw_enc_features |= netdev->vlan_features;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
netdev->features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->vlan_features);
netdev_feature_set_bits(NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_HW_CSUM,
&netdev->mpls_features);
netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES,
&netdev->mpls_features);
netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features,
netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */
- netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_TX,
&netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 8 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 47 ++++++----- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 100 +++++++++++++++--------- 3 files changed, 97 insertions(+), 58 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c index c1aae0f..da15dbf 100644 --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c @@ -1234,10 +1234,12 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) SET_NETDEV_DEV(ndev, dev);
if (HAS_CAP_TSO(priv->hw_cap)) - ndev->hw_features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->hw_features);
- ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; - ndev->vlan_features |= ndev->features; + netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->hw_features); + netdev_feature_or(&ndev->vlan_features, ndev->vlan_features, + ndev->features);
ret = hix5hd2_init_hw_desc_queue(priv); if (ret) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 1e08c18..7567afe 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -479,7 +479,8 @@ static void hns_nic_rx_checksum(struct hns_nic_ring_data *ring_data, u32 l4id;
/* check if RX checksum offload is enabled */ - if (unlikely(!(netdev->features & NETIF_F_RXCSUM))) + if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features))) return;
/* In hardware, we only support checksum for the following protocols: @@ -1774,11 +1775,13 @@ static int hns_nic_set_features(struct net_device *netdev,
switch (priv->enet_ver) { case AE_VERSION_1: - if (features & (NETIF_F_TSO | NETIF_F_TSO6)) + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, + features)) netdev_info(netdev, "enet v1 do not support tso!\n"); break; default: - if (features & (NETIF_F_TSO | NETIF_F_TSO6)) { + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, + features)) { priv->ops.fill_desc = fill_tso_desc; priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso; /* The chip only support 7*4096 */ @@ -1789,7 +1792,7 @@ static int hns_nic_set_features(struct net_device *netdev, } break; } - netdev->features = features; + netdev_feature_copy(&netdev->features, features); return 0; }
@@ -1800,8 +1803,9 @@ static void hns_nic_fix_features(struct net_device *netdev,
switch (priv->enet_ver) { case AE_VERSION_1: - *features &= ~(NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_HW_VLAN_CTAG_FILTER); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_HW_VLAN_CTAG_FILTER, + features); break; default: break; @@ -2162,8 +2166,8 @@ static void hns_nic_set_priv_ops(struct net_device *netdev) priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx; } else { priv->ops.get_rxd_bnum = get_v2rx_desc_bnum; - if ((netdev->features & NETIF_F_TSO) || - (netdev->features & NETIF_F_TSO6)) { + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, + netdev->features)) { priv->ops.fill_desc = fill_tso_desc; priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso; /* This chip only support 7*4096 */ @@ -2324,22 +2328,27 @@ static int hns_nic_dev_probe(struct platform_device *pdev) ndev->netdev_ops = &hns_nic_netdev_ops; hns_ethtool_set_ops(ndev);
- ndev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO; - ndev->vlan_features |= - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; - ndev->vlan_features |= NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | + NETIF_F_GRO, &ndev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, &ndev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO, + &ndev->vlan_features);
/* MTU range: 68 - 9578 (v1) or 9706 (v2) */ ndev->min_mtu = MAC_MIN_MTU; switch (priv->enet_ver) { case AE_VERSION_2: - ndev->features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_NTUPLE; - ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6; - ndev->vlan_features |= NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_NTUPLE, &ndev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | NETIF_F_SG | + NETIF_F_GSO | NETIF_F_GRO | + NETIF_F_TSO | NETIF_F_TSO6, + &ndev->features); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &ndev->vlan_features); ndev->max_mtu = MAC_MAX_MTU_V2 - (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN); break; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 91f5417..b113c70 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -376,6 +376,13 @@ static const struct hns3_rx_ptype hns3_rx_ptype_tbl[] = { #define HNS3_INVALID_PTYPE \ ARRAY_SIZE(hns3_rx_ptype_tbl)
+static const int hns3_features_array[] = { + NETIF_F_HW_VLAN_CTAG_FILTER_BIT, NETIF_F_HW_VLAN_CTAG_TX_BIT, + NETIF_F_HW_VLAN_CTAG_RX_BIT, NETIF_F_RXCSUM_BIT, NETIF_F_SG_BIT, + NETIF_F_GSO_BIT, NETIF_F_GRO_BIT, NETIF_F_TSO_BIT, NETIF_F_TSO6_BIT, + NETIF_F_GSO_GRE_BIT, NETIF_F_SCTP_CRC_BIT, NETIF_F_FRAGLIST_BIT +}; + static irqreturn_t hns3_irq_handle(int irq, void *vector) { struct hns3_enet_tqp_vector *tqp_vector = vector; @@ -1481,7 +1488,8 @@ static int hns3_handle_vtags(struct hns3_enet_ring *tx_ring, return -EINVAL;
if (skb->protocol == htons(ETH_P_8021Q) && - !(handle->kinfo.netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) { + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + handle->kinfo.netdev->features)) { /* When HW VLAN acceleration is turned off, and the stack * sets the protocol to 802.1q, the driver just need to * set the protocol to the encapsulated ethertype. @@ -2302,48 +2310,56 @@ static int hns3_nic_do_ioctl(struct net_device *netdev, static int hns3_nic_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = priv->ae_handle; + netdev_features_t changed; bool enable; int ret;
- if (changed & (NETIF_F_GRO_HW) && h->ae_algo->ops->set_gro_en) { - enable = !!(features & NETIF_F_GRO_HW); + netdev_feature_xor(&changed, netdev->features, features); + + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, changed) && + h->ae_algo->ops->set_gro_en) { + enable = netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features); ret = h->ae_algo->ops->set_gro_en(h, enable); if (ret) return ret; }
- if ((changed & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed) && h->ae_algo->ops->enable_hw_strip_rxvtag) { - enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX); + enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features); ret = h->ae_algo->ops->enable_hw_strip_rxvtag(h, enable); if (ret) return ret; }
- if ((changed & NETIF_F_NTUPLE) && h->ae_algo->ops->enable_fd) { - enable = !!(features & NETIF_F_NTUPLE); + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, changed) && + h->ae_algo->ops->enable_fd) { + enable = netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features); h->ae_algo->ops->enable_fd(h, enable); }
- if ((netdev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) && + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, netdev->features) && + !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && h->ae_algo->ops->cls_flower_active(h)) { netdev_err(netdev, "there are offloaded TC filters active, cannot disable HW TC offload"); return -EINVAL; }
- if ((changed & NETIF_F_HW_VLAN_CTAG_FILTER) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + changed) && h->ae_algo->ops->enable_vlan_filter) { - enable = !!(features & NETIF_F_HW_VLAN_CTAG_FILTER); + enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features); ret = h->ae_algo->ops->enable_vlan_filter(h, enable); if (ret) return ret; }
- netdev->features = features; + netdev_feature_copy(&netdev->features, features); return 0; }
@@ -2372,7 +2388,8 @@ static void hns3_features_check(struct sk_buff *skb, struct net_device *dev, * len of 480 bytes. */ if (len > HNS3_MAX_HDR_LEN) - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
static void hns3_nic_get_stats64(struct net_device *netdev, @@ -3124,46 +3141,56 @@ static void hns3_set_default_feature(struct net_device *netdev)
netdev->priv_flags |= IFF_UNICAST_FLT;
- netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; + netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, + &netdev->gso_partial_features);
- netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST; + netdev_feature_set_bit_array(hns3_features_array, + ARRAY_SIZE(hns3_features_array), + &netdev->features);
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { - netdev->features |= NETIF_F_GRO_HW; + netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &netdev->features);
if (!(h->flags & HNAE3_SUPPORT_VF)) - netdev->features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, + &netdev->features); }
if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps)) - netdev->features |= NETIF_F_GSO_UDP_L4; + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, + &netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps)) - netdev->features |= NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); else - netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps)) - netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, + &netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps)) - netdev->features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features);
- netdev->hw_features |= netdev->features; + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + 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_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->hw_features);
- netdev->vlan_features |= netdev->features & - ~(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_HW | NETIF_F_NTUPLE | - NETIF_F_HW_TC); + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_HW | + NETIF_F_NTUPLE | NETIF_F_HW_TC, + &netdev->hw_enc_features);
- netdev->hw_enc_features |= netdev->vlan_features | NETIF_F_TSO_MANGLEID; + netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, + &netdev->hw_enc_features); }
static int hns3_alloc_buffer(struct hns3_enet_ring *ring, @@ -3722,7 +3749,7 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
skb_checksum_none_assert(skb);
- if (!(netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features)) return;
if (test_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state)) @@ -4030,7 +4057,8 @@ static int hns3_handle_bdinfo(struct hns3_enet_ring *ring, struct sk_buff *skb) * ot_vlan_tag in two layer tag case, and stored at vlan_tag * in one layer tag case. */ - if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) { u16 vlan_tag;
if (hns3_parse_vlan_tag(ring, desc, l234info, &vlan_tag))
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 8 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 47 ++++++----- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 100 +++++++++++++++--------- 3 files changed, 97 insertions(+), 58 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c index c1aae0f..da15dbf 100644 --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c @@ -1234,10 +1234,12 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) SET_NETDEV_DEV(ndev, dev);
if (HAS_CAP_TSO(priv->hw_cap))
ndev->hw_features |= NETIF_F_SG;
netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->hw_features);
- ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
- ndev->vlan_features |= ndev->features;
netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features);
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->hw_features);
netdev_feature_or(&ndev->vlan_features, ndev->vlan_features,
ndev->features);
ret = hix5hd2_init_hw_desc_queue(priv); if (ret)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 1e08c18..7567afe 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -479,7 +479,8 @@ static void hns_nic_rx_checksum(struct hns_nic_ring_data *ring_data, u32 l4id;
/* check if RX checksum offload is enabled */
- if (unlikely(!(netdev->features & NETIF_F_RXCSUM)))
if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
netdev->features)))
return;
/* In hardware, we only support checksum for the following protocols:
@@ -1774,11 +1775,13 @@ static int hns_nic_set_features(struct net_device *netdev,
switch (priv->enet_ver) { case AE_VERSION_1:
if (features & (NETIF_F_TSO | NETIF_F_TSO6))
if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6,
break; default:features)) netdev_info(netdev, "enet v1 do not support tso!\n");
if (features & (NETIF_F_TSO | NETIF_F_TSO6)) {
if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6,
features)) { priv->ops.fill_desc = fill_tso_desc; priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso; /* The chip only support 7*4096 */
@@ -1789,7 +1792,7 @@ static int hns_nic_set_features(struct net_device *netdev, } break; }
- netdev->features = features;
- netdev_feature_copy(&netdev->features, features); return 0; }
@@ -1800,8 +1803,9 @@ static void hns_nic_fix_features(struct net_device *netdev,
switch (priv->enet_ver) { case AE_VERSION_1:
*features &= ~(NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_HW_VLAN_CTAG_FILTER);
netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_HW_VLAN_CTAG_FILTER,
break; default: break;features);
@@ -2162,8 +2166,8 @@ static void hns_nic_set_priv_ops(struct net_device *netdev) priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx; } else { priv->ops.get_rxd_bnum = get_v2rx_desc_bnum;
if ((netdev->features & NETIF_F_TSO) ||
(netdev->features & NETIF_F_TSO6)) {
if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6,
netdev->features)) { priv->ops.fill_desc = fill_tso_desc; priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso; /* This chip only support 7*4096 */
@@ -2324,22 +2328,27 @@ static int hns_nic_dev_probe(struct platform_device *pdev) ndev->netdev_ops = &hns_nic_netdev_ops; hns_ethtool_set_ops(ndev);
- ndev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
NETIF_F_GRO;
- ndev->vlan_features |=
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM;
- ndev->vlan_features |= NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
NETIF_F_GRO, &ndev->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM, &ndev->vlan_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO,
&ndev->vlan_features);
/* MTU range: 68 - 9578 (v1) or 9706 (v2) */ ndev->min_mtu = MAC_MIN_MTU; switch (priv->enet_ver) { case AE_VERSION_2:
ndev->features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_NTUPLE;
ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6;
ndev->vlan_features |= NETIF_F_TSO | NETIF_F_TSO6;
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_NTUPLE, &ndev->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM | NETIF_F_SG |
NETIF_F_GSO | NETIF_F_GRO |
NETIF_F_TSO | NETIF_F_TSO6,
&ndev->features);
it should be "ndev->hw_features", not "ndev->features"
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6,
ndev->max_mtu = MAC_MAX_MTU_V2 - (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN); break;&ndev->vlan_features);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 91f5417..b113c70 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -376,6 +376,13 @@ static const struct hns3_rx_ptype hns3_rx_ptype_tbl[] = { #define HNS3_INVALID_PTYPE \ ARRAY_SIZE(hns3_rx_ptype_tbl)
+static const int hns3_features_array[] = {
- NETIF_F_HW_VLAN_CTAG_FILTER_BIT, NETIF_F_HW_VLAN_CTAG_TX_BIT,
- NETIF_F_HW_VLAN_CTAG_RX_BIT, NETIF_F_RXCSUM_BIT, NETIF_F_SG_BIT,
- NETIF_F_GSO_BIT, NETIF_F_GRO_BIT, NETIF_F_TSO_BIT, NETIF_F_TSO6_BIT,
- NETIF_F_GSO_GRE_BIT, NETIF_F_SCTP_CRC_BIT, NETIF_F_FRAGLIST_BIT
+};
- static irqreturn_t hns3_irq_handle(int irq, void *vector) { struct hns3_enet_tqp_vector *tqp_vector = vector;
@@ -1481,7 +1488,8 @@ static int hns3_handle_vtags(struct hns3_enet_ring *tx_ring, return -EINVAL;
if (skb->protocol == htons(ETH_P_8021Q) &&
!(handle->kinfo.netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) {
!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
/* When HW VLAN acceleration is turned off, and the stackhandle->kinfo.netdev->features)) {
- sets the protocol to 802.1q, the driver just need to
- set the protocol to the encapsulated ethertype.
@@ -2302,48 +2310,56 @@ static int hns3_nic_do_ioctl(struct net_device *netdev, static int hns3_nic_set_features(struct net_device *netdev, netdev_features_t features) {
- netdev_features_t changed = netdev->features ^ features; struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = priv->ae_handle;
- netdev_features_t changed; bool enable; int ret;
- if (changed & (NETIF_F_GRO_HW) && h->ae_algo->ops->set_gro_en) {
enable = !!(features & NETIF_F_GRO_HW);
- netdev_feature_xor(&changed, netdev->features, features);
- if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, changed) &&
h->ae_algo->ops->set_gro_en) {
ret = h->ae_algo->ops->set_gro_en(h, enable); if (ret) return ret; }enable = netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features);
- if ((changed & NETIF_F_HW_VLAN_CTAG_RX) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed) && h->ae_algo->ops->enable_hw_strip_rxvtag) {
enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
ret = h->ae_algo->ops->enable_hw_strip_rxvtag(h, enable); if (ret) return ret; }features);
- if ((changed & NETIF_F_NTUPLE) && h->ae_algo->ops->enable_fd) {
enable = !!(features & NETIF_F_NTUPLE);
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, changed) &&
h->ae_algo->ops->enable_fd) {
h->ae_algo->ops->enable_fd(h, enable); }enable = netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features);
- if ((netdev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) &&
- if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, netdev->features) &&
netdev_err(netdev, "there are offloaded TC filters active, cannot disable HW TC offload"); return -EINVAL; }!netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && h->ae_algo->ops->cls_flower_active(h)) {
- if ((changed & NETIF_F_HW_VLAN_CTAG_FILTER) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
h->ae_algo->ops->enable_vlan_filter) {changed) &&
enable = !!(features & NETIF_F_HW_VLAN_CTAG_FILTER);
enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
ret = h->ae_algo->ops->enable_vlan_filter(h, enable); if (ret) return ret; }features);
- netdev->features = features;
- netdev_feature_copy(&netdev->features, features); return 0; }
@@ -2372,7 +2388,8 @@ static void hns3_features_check(struct sk_buff *skb, struct net_device *dev, * len of 480 bytes. */ if (len > HNS3_MAX_HDR_LEN)
*features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK,
features);
}
static void hns3_nic_get_stats64(struct net_device *netdev,
@@ -3124,46 +3141,56 @@ static void hns3_set_default_feature(struct net_device *netdev)
netdev->priv_flags |= IFF_UNICAST_FLT;
- netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
- netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT,
&netdev->gso_partial_features);
- netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST;
netdev_feature_set_bit_array(hns3_features_array,
ARRAY_SIZE(hns3_features_array),
&netdev->features);
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
netdev->features |= NETIF_F_GRO_HW;
netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &netdev->features);
if (!(h->flags & HNAE3_SUPPORT_VF))
netdev->features |= NETIF_F_NTUPLE;
netdev_feature_set_bit(NETIF_F_NTUPLE_BIT,
&netdev->features);
}
if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps))
netdev->features |= NETIF_F_GSO_UDP_L4;
netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT,
&netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps))
netdev->features |= NETIF_F_HW_CSUM;
elsenetdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features);
netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
&netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps))
netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,
&netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps))
netdev->features |= NETIF_F_HW_TC;
netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features);
- netdev->hw_features |= netdev->features;
- netdev_feature_or(&netdev->hw_features, netdev->hw_features,
if (!test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps))netdev->features);
netdev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&netdev->hw_features);
- netdev->vlan_features |= netdev->features &
~(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_HW | NETIF_F_NTUPLE |
NETIF_F_HW_TC);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features,
netdev->features);
- netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_HW |
NETIF_F_NTUPLE | NETIF_F_HW_TC,
&netdev->hw_enc_features);
- netdev->hw_enc_features |= netdev->vlan_features | NETIF_F_TSO_MANGLEID;
netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features,
netdev->vlan_features);
netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT,
&netdev->hw_enc_features);
}
static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
@@ -3722,7 +3749,7 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
skb_checksum_none_assert(skb);
- if (!(netdev->features & NETIF_F_RXCSUM))
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features)) return;
if (test_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state))
@@ -4030,7 +4057,8 @@ static int hns3_handle_bdinfo(struct hns3_enet_ring *ring, struct sk_buff *skb) * ot_vlan_tag in two layer tag case, and stored at vlan_tag * in one layer tag case. */
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
netdev->features)) {
u16 vlan_tag;
if (hns3_parse_vlan_tag(ring, desc, l234info, &vlan_tag))
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 4 +- drivers/net/ethernet/mellanox/mlx4/en_main.c | 8 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 181 +++++++++++------- drivers/net/ethernet/mellanox/mlx4/en_resources.c | 4 +- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 19 +- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 5 +- .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 18 +- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 8 +- .../ethernet/mellanox/mlx5/core/en_accel/ktls.c | 15 +- .../net/ethernet/mellanox/mlx5/core/en_accel/tls.c | 16 +- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 6 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 205 ++++++++++++--------- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 25 +-- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 9 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 19 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 36 ++-- 19 files changed, 344 insertions(+), 242 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 3616b77..56de7d3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c @@ -1233,13 +1233,13 @@ static int mlx4_en_check_rxfh_func(struct net_device *dev, u8 hfunc) if (hfunc == ETH_RSS_HASH_TOP) { if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP)) return -EINVAL; - if (!(dev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, dev->features)) en_warn(priv, "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n"); return 0; } else if (hfunc == ETH_RSS_HASH_XOR) { if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR)) return -EINVAL; - if (dev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, dev->features)) en_warn(priv, "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n"); return 0; } diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c index 109472d..6762fff 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c @@ -103,7 +103,7 @@ void mlx4_en_update_loopback_state(struct net_device *dev, { struct mlx4_en_priv *priv = netdev_priv(dev);
- if (features & NETIF_F_LOOPBACK) + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features)) priv->ctrl_flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK); else priv->ctrl_flags &= cpu_to_be32(~MLX4_WQE_CTRL_FORCE_LOOPBACK); @@ -115,7 +115,8 @@ void mlx4_en_update_loopback_state(struct net_device *dev, * and not performing the selftest or flb disabled */ if (mlx4_is_mfunc(priv->mdev->dev) && - !(features & NETIF_F_LOOPBACK) && !priv->validate_loopback) + !netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features) && + !priv->validate_loopback) priv->flags |= MLX4_EN_FLAG_RX_FILTER_NEEDED;
/* Set dmac in Tx WQE if we are in SRIOV mode or if loopback selftest @@ -130,7 +131,8 @@ void mlx4_en_update_loopback_state(struct net_device *dev, priv->rss_map.indir_qp && priv->rss_map.indir_qp->qpn) { int i; int err = 0; - int loopback = !!(features & NETIF_F_LOOPBACK); + int loopback = netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, + features);
for (i = 0; i < priv->rx_ring_num; i++) { int ret; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 06bc81d..f0bb981 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -2489,11 +2489,11 @@ static void mlx4_en_fix_features(struct net_device *netdev, * enable/disable make sure S-TAG flag is always in same state as * C-TAG. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features) && !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) - *features |= NETIF_F_HW_VLAN_STAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_STAG_RX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, features); }
static int mlx4_en_set_features(struct net_device *netdev, @@ -2503,14 +2503,16 @@ static int mlx4_en_set_features(struct net_device *netdev, bool reset = false; int ret = 0;
- if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_RXFCS)) { + if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_RXFCS_BIT)) { en_info(priv, "Turn %s RX-FCS\n", - (features & NETIF_F_RXFCS) ? "ON" : "OFF"); + netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + features) ? "ON" : "OFF"); reset = true; }
- if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_RXALL)) { - u8 ignore_fcs_value = (features & NETIF_F_RXALL) ? 1 : 0; + if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_RXALL_BIT)) { + u8 ignore_fcs_value = netdev_feature_test_bit(NETIF_F_RXALL_BIT, + features) ? 1 : 0;
en_info(priv, "Turn %s RX-ALL\n", ignore_fcs_value ? "ON" : "OFF"); @@ -2520,23 +2522,27 @@ static int mlx4_en_set_features(struct net_device *netdev, return ret; }
- if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_RX)) { + if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_RX_BIT)) { en_info(priv, "Turn %s RX vlan strip offload\n", - (features & NETIF_F_HW_VLAN_CTAG_RX) ? "ON" : "OFF"); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features) ? "ON" : "OFF"); reset = true; }
- if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_TX)) + if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_CTAG_TX_BIT)) en_info(priv, "Turn %s TX vlan strip offload\n", - (features & NETIF_F_HW_VLAN_CTAG_TX) ? "ON" : "OFF"); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features) ? "ON" : "OFF");
- if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_STAG_TX)) + if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_HW_VLAN_STAG_TX_BIT)) en_info(priv, "Turn %s TX S-VLAN strip offload\n", - (features & NETIF_F_HW_VLAN_STAG_TX) ? "ON" : "OFF"); + netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, + features) ? "ON" : "OFF");
- if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_LOOPBACK)) { + if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_LOOPBACK_BIT)) { en_info(priv, "Turn %s loopback\n", - (features & NETIF_F_LOOPBACK) ? "ON" : "OFF"); + netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, + features) ? "ON" : "OFF"); mlx4_en_update_loopback_state(netdev, features); }
@@ -2675,7 +2681,8 @@ static void mlx4_en_features_check(struct sk_buff *skb, struct net_device *dev, 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); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | + NETIF_F_GSO_MASK, features); } }
@@ -3301,42 +3308,59 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, /* * Set driver features */ - dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &dev->hw_features); if (mdev->LSO_support) - dev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &dev->hw_features);
if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { - dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL; - dev->features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL; - dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; - dev->hw_enc_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | - NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL; + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL, + &dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL, + &dev->features); + netdev_feature_zero(&dev->gso_partial_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, + &dev->gso_partial_features); + netdev_feature_zero(&dev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL, + &dev->hw_enc_features);
dev->udp_tunnel_nic_info = &mlx4_udp_tunnels; }
- dev->vlan_features = dev->hw_features; + netdev_feature_copy(&dev->vlan_features, dev->hw_features);
- dev->hw_features |= NETIF_F_RXCSUM | NETIF_F_RXHASH; - dev->features = dev->hw_features | NETIF_F_HIGHDMA | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER; - dev->hw_features |= NETIF_F_LOOPBACK | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_RXHASH, + &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_set_bits(NETIF_F_HIGHDMA | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &dev->features); + netdev_feature_set_bits(NETIF_F_LOOPBACK | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &dev->hw_features);
if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) { - dev->features |= NETIF_F_HW_VLAN_STAG_RX | - NETIF_F_HW_VLAN_STAG_FILTER; - dev->hw_features |= NETIF_F_HW_VLAN_STAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_STAG_RX | + NETIF_F_HW_VLAN_STAG_FILTER, + &dev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, + &dev->hw_features); }
if (mlx4_is_slave(mdev->dev)) { @@ -3345,38 +3369,43 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
err = get_phv_bit(mdev->dev, port, &phv); if (!err && phv) { - dev->hw_features |= NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, + &dev->hw_features); priv->pflags |= MLX4_EN_PRIV_FLAGS_PHV; } err = mlx4_get_is_vlan_offload_disabled(mdev->dev, port, &vlan_offload_disabled); if (!err && vlan_offload_disabled) { - dev->hw_features &= ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_STAG_TX | - NETIF_F_HW_VLAN_STAG_RX); - dev->features &= ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_STAG_TX | - NETIF_F_HW_VLAN_STAG_RX); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_STAG_TX | + NETIF_F_HW_VLAN_STAG_RX | + NETIF_F_HW_VLAN_STAG_FILTER, + &dev->hw_features); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_STAG_TX | + NETIF_F_HW_VLAN_STAG_RX, + &dev->features); } } else { if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PHV_EN && !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) - dev->hw_features |= NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, + &dev->hw_features); }
if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) - dev->hw_features |= NETIF_F_RXFCS; + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features);
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_IGNORE_FCS) - dev->hw_features |= NETIF_F_RXALL; + netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features);
if (mdev->dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED && mdev->dev->caps.dmfs_high_steer_mode != MLX4_STEERING_DMFS_A0_STATIC) - dev->hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features);
if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) dev->priv_flags |= IFF_UNICAST_FLT; @@ -3480,12 +3509,12 @@ int mlx4_en_reset_config(struct net_device *dev,
if (priv->hwtstamp_config.tx_type == ts_config.tx_type && priv->hwtstamp_config.rx_filter == ts_config.rx_filter && - !DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX) && - !DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS)) + !DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX_BIT) && + !DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS_BIT)) return 0; /* Nothing to change */
- if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX) && - (features & NETIF_F_HW_VLAN_CTAG_RX) && + if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX_BIT) && + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) && (priv->hwtstamp_config.rx_filter != HWTSTAMP_FILTER_NONE)) { en_warn(priv, "Can't turn ON rx vlan offload while time-stamping rx filter is ON\n"); return -EINVAL; @@ -3511,26 +3540,34 @@ int mlx4_en_reset_config(struct net_device *dev,
mlx4_en_safe_replace_resources(priv, tmp);
- if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX)) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) - dev->features |= NETIF_F_HW_VLAN_CTAG_RX; + if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX_BIT)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->features); else - dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->features); } else if (ts_config.rx_filter == HWTSTAMP_FILTER_NONE) { /* RX time-stamping is OFF, update the RX vlan offload * to the latest wanted state */ - if (dev->wanted_features & NETIF_F_HW_VLAN_CTAG_RX) - dev->features |= NETIF_F_HW_VLAN_CTAG_RX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->wanted_features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->features); else - dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->features); }
- if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS)) { - if (features & NETIF_F_RXFCS) - dev->features |= NETIF_F_RXFCS; + if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS_BIT)) { + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, features)) + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, + &dev->features); else - dev->features &= ~NETIF_F_RXFCS; + netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, + &dev->features); }
/* RX vlan offload and RX time-stamping can't co-exist ! @@ -3538,9 +3575,11 @@ int mlx4_en_reset_config(struct net_device *dev, * Turn Off RX vlan offload in case of time-stamping is ON */ if (ts_config.rx_filter != HWTSTAMP_FILTER_NONE) { - if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features)) en_warn(priv, "Turning off RX vlan offload since RX time-stamping is ON\n"); - dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->features); }
if (port_up) { diff --git a/drivers/net/ethernet/mellanox/mlx4/en_resources.c b/drivers/net/ethernet/mellanox/mlx4/en_resources.c index 6883ac7..8539d39 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_resources.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_resources.c @@ -76,12 +76,12 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, context->pri_path.counter_index != MLX4_SINK_COUNTER_INDEX(mdev->dev)) { /* disable multicast loopback to qp with same counter */ - if (!(dev->features & NETIF_F_LOOPBACK)) + if (!netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, dev->features)) context->pri_path.fl |= MLX4_FL_ETH_SRC_CHECK_MC_LB; context->pri_path.control |= MLX4_CTRL_ETH_SRC_CHECK_IF_COUNTER; } context->db_rec_addr = cpu_to_be64(priv->res.db.dma << 2); - if (!(dev->features & NETIF_F_HW_VLAN_CTAG_RX)) + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, dev->features)) context->param3 |= cpu_to_be32(1 << 30);
if (!is_tx && !rss && diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 442991d..3b50063 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -643,7 +643,8 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va, hw_checksum = csum_unfold((__force __sum16)cqe->checksum);
if (cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_CVLAN_PRESENT_MASK) && - !(dev_features & NETIF_F_HW_VLAN_CTAG_RX)) { + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev_features)) { hw_checksum = get_fixed_vlan_csum(hw_checksum, hdr); hdr += sizeof(struct vlan_hdr); } @@ -827,7 +828,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud } skb_record_rx_queue(skb, cq_ring);
- if (likely(dev->features & NETIF_F_RXCSUM)) { + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features))) { /* TODO: For IP non TCP/UDP packets when csum complete is * not an option (not supported or any other reason) we can * actually check cqe IPOK status bit and report @@ -839,7 +840,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud cqe->checksum == cpu_to_be16(0xffff)) { bool l2_tunnel;
- l2_tunnel = (dev->hw_enc_features & NETIF_F_RXCSUM) && + l2_tunnel = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->hw_enc_features) && (cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_L2_TUNNEL)); ip_summed = CHECKSUM_UNNECESSARY; hash_type = PKT_HASH_TYPE_L4; @@ -863,19 +865,21 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud ring->csum_none++; } skb->ip_summed = ip_summed; - if (dev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, dev->features)) skb_set_hash(skb, be32_to_cpu(cqe->immed_rss_invalid), hash_type);
if ((cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_CVLAN_PRESENT_MASK)) && - (dev->features & NETIF_F_HW_VLAN_CTAG_RX)) + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(cqe->sl_vid)); else if ((cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_SVLAN_PRESENT_MASK)) && - (dev->features & NETIF_F_HW_VLAN_STAG_RX)) + netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, + dev->features)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), be16_to_cpu(cqe->sl_vid));
@@ -1071,7 +1075,8 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn, /* Cancel FCS removal if FW allows */ if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) { context->param3 |= cpu_to_be32(1 << 29); - if (priv->dev->features & NETIF_F_RXFCS) + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + priv->dev->features)) ring->fcs_del = 0; else ring->fcs_del = ETH_FCS_LEN; diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index f3d1a20..5569f77 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -772,8 +772,9 @@ void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv); void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf); void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev);
-#define DEV_FEATURE_CHANGED(dev, new_features, feature) \ - ((dev->features & feature) ^ (new_features & feature)) +#define DEV_FEATURE_CHANGED(dev, new_features, feature_bit) \ + (netdev_feature_test_bit(feature_bit, (dev)->features) != \ + netdev_feature_test_bit(feature_bit, new_features))
int mlx4_en_moderation_update(struct mlx4_en_priv *priv); int mlx4_en_reset_config(struct net_device *dev, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c index 7cab08a..b703ea3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c @@ -540,16 +540,17 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)
mlx5_core_info(mdev, "mlx5e: IPSec ESP acceleration enabled\n"); netdev->xfrmdev_ops = &mlx5e_ipsec_xfrmdev_ops; - netdev->features |= NETIF_F_HW_ESP; - netdev->hw_enc_features |= NETIF_F_HW_ESP; + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, &netdev->hw_enc_features);
if (!MLX5_CAP_ETH(mdev, swp_csum)) { mlx5_core_dbg(mdev, "mlx5e: SWP checksum not supported\n"); return; }
- netdev->features |= NETIF_F_HW_ESP_TX_CSUM; - netdev->hw_enc_features |= NETIF_F_HW_ESP_TX_CSUM; + netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, + &netdev->hw_enc_features);
if (!(mlx5_accel_ipsec_device_caps(mdev) & MLX5_ACCEL_IPSEC_CAP_LSO) || !MLX5_CAP_ETH(mdev, swp_lso)) { @@ -558,10 +559,11 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv) }
if (mlx5_is_ipsec_device(mdev)) - netdev->gso_partial_features |= NETIF_F_GSO_ESP; + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, + &netdev->gso_partial_features);
mlx5_core_dbg(mdev, "mlx5e: ESP GSO capability turned on\n"); - netdev->features |= NETIF_F_GSO_ESP; - netdev->hw_features |= NETIF_F_GSO_ESP; - netdev->hw_enc_features |= NETIF_F_GSO_ESP; + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->hw_enc_features); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h index 62ab97c..b0e92a7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h @@ -123,7 +123,8 @@ mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features)
/* Disable CSUM and GSO for software IPsec */ out_disable: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
#else @@ -141,7 +142,10 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg) static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe) { return false; } static inline void mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features) -{ *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); } +{ + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); +} #endif /* CONFIG_MLX5_EN_IPSEC */
#endif /* __MLX5E_IPSEC_RXTX_H__ */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c index d93aadb..fcac1a2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c @@ -63,12 +63,15 @@ void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv) return;
if (mlx5e_accel_is_ktls_tx(mdev)) { - netdev->hw_features |= NETIF_F_HW_TLS_TX; - netdev->features |= NETIF_F_HW_TLS_TX; + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, + &netdev->features); }
if (mlx5e_accel_is_ktls_rx(mdev)) - netdev->hw_features |= NETIF_F_HW_TLS_RX; + netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, + &netdev->hw_features);
netdev->tlsdev_ops = &mlx5e_ktls_ops; } @@ -99,7 +102,8 @@ int mlx5e_ktls_init_rx(struct mlx5e_priv *priv) if (!priv->tls->rx_wq) return -ENOMEM;
- if (priv->netdev->features & NETIF_F_HW_TLS_RX) { + if (netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, + &priv->netdev->features)) { err = mlx5e_accel_fs_tcp_create(priv); if (err) { destroy_workqueue(priv->tls->rx_wq); @@ -115,7 +119,8 @@ void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv) if (!mlx5e_accel_is_ktls_rx(priv->mdev)) return;
- if (priv->netdev->features & NETIF_F_HW_TLS_RX) + if (netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, + &priv->netdev->features)) mlx5e_accel_fs_tcp_destroy(priv);
destroy_workqueue(priv->tls->rx_wq); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c index b8fc863..bd29987 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c @@ -203,18 +203,22 @@ void mlx5e_tls_build_netdev(struct mlx5e_priv *priv)
caps = mlx5_accel_tls_device_caps(priv->mdev); if (caps & MLX5_ACCEL_TLS_TX) { - netdev->features |= NETIF_F_HW_TLS_TX; - netdev->hw_features |= NETIF_F_HW_TLS_TX; + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, + &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, + &netdev->hw_features); }
if (caps & MLX5_ACCEL_TLS_RX) { - netdev->features |= NETIF_F_HW_TLS_RX; - netdev->hw_features |= NETIF_F_HW_TLS_RX; + netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, + &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, + &netdev->hw_features); }
if (!(caps & MLX5_ACCEL_TLS_LRO)) { - netdev->features &= ~NETIF_F_LRO; - netdev->hw_features &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->hw_features); }
netdev->tlsdev_ops = &mlx5e_tls_ops; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c index fe5d82f..ce62ed5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c @@ -181,7 +181,8 @@ static void _mlx5e_cleanup_tables(struct mlx5e_priv *priv)
void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv) { - if (!(priv->netdev->hw_features & NETIF_F_NTUPLE)) + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + priv->netdev->hw_features)) return;
_mlx5e_cleanup_tables(priv); @@ -358,7 +359,8 @@ int mlx5e_arfs_create_tables(struct mlx5e_priv *priv) int err = -ENOMEM; int i;
- if (!(priv->netdev->hw_features & NETIF_F_NTUPLE)) + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + priv->netdev->hw_features)) return 0;
priv->fs.arfs = kvzalloc(sizeof(*priv->fs.arfs), GFP_KERNEL); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 2cf59bb..03b7fad5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -460,7 +460,8 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
- arfs_enabled = opened && (priv->netdev->features & NETIF_F_NTUPLE); + arfs_enabled = opened && netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + priv->netdev->features); if (arfs_enabled) mlx5e_arfs_disable(priv);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c index 5c754e9..2cdab59 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -1286,7 +1286,8 @@ int mlx5e_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_feature_clear_bit(NETIF_F_NTUPLE_BIT, + &priv->netdev->hw_features); }
err = mlx5e_create_inner_ttc_table(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index e70e8c5..4d0158e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3093,12 +3093,12 @@ static int mlx5e_set_mac(struct net_device *netdev, void *addr) return 0; }
-#define MLX5E_SET_FEATURE(features, feature, enable) \ - do { \ - if (enable) \ - *features |= feature; \ - else \ - *features &= ~feature; \ +#define MLX5E_SET_FEATURE(features, feature, enable) \ + do { \ + if (enable) \ + netdev_feature_set_bit(feature, features); \ + else \ + netdev_feature_clear_bit(feature, features); \ } while (0)
typedef int (*mlx5e_feature_handler)(struct net_device *netdev, bool enable); @@ -3240,49 +3240,56 @@ static int set_feature_arfs(struct net_device *netdev, bool enable) static int mlx5e_handle_feature(struct net_device *netdev, netdev_features_t *features, netdev_features_t wanted_features, - netdev_features_t feature, + u32 feature_bit, mlx5e_feature_handler feature_handler) { - netdev_features_t changes = wanted_features ^ netdev->features; - bool enable = !!(wanted_features & feature); + netdev_features_t changes; + bool enable; int err;
- if (!(changes & feature)) + netdev_feature_xor(&changes, wanted_features, netdev->features); + enable = netdev_feature_test_bit(feature_bit, wanted_features); + + if (!netdev_feature_test_bit(feature_bit, changes)) return 0;
err = feature_handler(netdev, enable); if (err) { - netdev_err(netdev, "%s feature %pNF failed, err %d\n", - enable ? "Enable" : "Disable", &feature, err); + netdev_err(netdev, "%s feature bit %u failed, err %d\n", + enable ? "Enable" : "Disable", feature_bit, err); return err; }
- MLX5E_SET_FEATURE(features, feature, enable); + MLX5E_SET_FEATURE(features, feature_bit, enable); return 0; }
int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t oper_features = netdev->features; + netdev_features_t oper_features; int err = 0;
+ netdev_feature_copy(&oper_features, netdev->features); + #define MLX5E_HANDLE_FEATURE(feature, handler) \ mlx5e_handle_feature(netdev, &oper_features, features, feature, handler)
- err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER, + err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO_BIT, set_feature_lro); + err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, set_feature_cvlan_filter); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC, set_feature_hw_tc); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXALL, set_feature_rx_all); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXFCS, set_feature_rx_fcs); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_RX, set_feature_rx_vlan); + err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC_BIT, set_feature_hw_tc); + err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXALL_BIT, set_feature_rx_all); + err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXFCS_BIT, set_feature_rx_fcs); + err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_RX_BIT, + set_feature_rx_vlan); #ifdef CONFIG_MLX5_EN_ARFS - err |= MLX5E_HANDLE_FEATURE(NETIF_F_NTUPLE, set_feature_arfs); + err |= MLX5E_HANDLE_FEATURE(NETIF_F_NTUPLE_BIT, set_feature_arfs); #endif - err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TLS_RX, mlx5e_ktls_set_feature_rx); + err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TLS_RX_BIT, + mlx5e_ktls_set_feature_rx);
if (err) { - netdev->features = oper_features; + netdev_feature_copy(&netdev->features, oper_features); return -EINVAL; }
@@ -3292,16 +3299,16 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) static void mlx5e_fix_uplink_rep_features(struct net_device *netdev, netdev_features_t *features) { - *features &= ~NETIF_F_HW_TLS_RX; - if (netdev->features & NETIF_F_HW_TLS_RX) + netdev_feature_clear_bit(NETIF_F_HW_TLS_RX_BIT, features); + if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, netdev->features)) netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n");
- *features &= ~NETIF_F_HW_TLS_TX; - if (netdev->features & NETIF_F_HW_TLS_TX) + netdev_feature_clear_bit(NETIF_F_HW_TLS_TX_BIT, features); + if (netdev_feature_test_bit(NETIF_F_HW_TLS_TX_BIT, netdev->features)) netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n");
- *features &= ~NETIF_F_NTUPLE; - if (netdev->features & NETIF_F_NTUPLE) + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features); + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->features)) netdev_warn(netdev, "Disabling ntuple, not supported in switchdev mode\n"); }
@@ -3318,26 +3325,26 @@ static void 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_clear_bit(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"); }
if (!MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_STRIDING_RQ)) { - if (*features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n"); - *features &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } }
if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) { - *features &= ~NETIF_F_RXHASH; - if (netdev->features & NETIF_F_RXHASH) + netdev_feature_clear_bit(NETIF_F_RXHASH_BIT, features); + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n"); }
if (mlx5e_is_uplink_rep(priv)) - mlx5e_fix_uplink_rep_features(netdev, &features); + mlx5e_fix_uplink_rep_features(netdev, features);
mutex_unlock(&priv->state_lock); } @@ -3807,7 +3814,8 @@ static void mlx5e_tunnel_features_check(struct mlx5e_priv *priv,
out: /* Disable CSUM and GSO if the udp dport is not offloaded by HW */ - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, @@ -3820,7 +3828,8 @@ void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev,
/* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation && - (*features & NETIF_F_CSUM_MASK || *features & NETIF_F_GSO_MASK)) + (netdev_feature_test_bits(NETIF_F_CSUM_MASK, *features) || + netdev_feature_test_bits(NETIF_F_GSO_MASK, *features))) mlx5e_tunnel_features_check(priv, skb, features); }
@@ -4228,21 +4237,23 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
netdev->ethtool_ops = &mlx5e_ethtool_ops;
- netdev->vlan_features |= NETIF_F_SG; - netdev->vlan_features |= NETIF_F_HW_CSUM; - netdev->vlan_features |= NETIF_F_GRO; - netdev->vlan_features |= NETIF_F_TSO; - netdev->vlan_features |= NETIF_F_TSO6; - netdev->vlan_features |= NETIF_F_RXCSUM; - netdev->vlan_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->vlan_features);
- netdev->mpls_features |= NETIF_F_SG; - netdev->mpls_features |= NETIF_F_HW_CSUM; - netdev->mpls_features |= NETIF_F_TSO; - netdev->mpls_features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->mpls_features);
- netdev->hw_enc_features |= NETIF_F_HW_VLAN_CTAG_TX; - netdev->hw_enc_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_enc_features);
/* Tunneled LRO is not supported in the driver, and the same RQs are * shared between inner and outer TIRs, so the driver can't disable LRO @@ -4253,65 +4264,83 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) !MLX5_CAP_ETH(mdev, tunnel_lro_vxlan) && !MLX5_CAP_ETH(mdev, tunnel_lro_gre) && mlx5e_check_fragmented_striding_rq_cap(mdev)) - netdev->vlan_features |= NETIF_F_LRO; - - netdev->hw_features = netdev->vlan_features; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; - netdev->hw_features |= NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->vlan_features); + + netdev_feature_copy(&netdev->hw_features, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, + &netdev->hw_features);
if (mlx5e_tunnel_any_tx_proto_supported(mdev)) { - netdev->hw_enc_features |= NETIF_F_HW_CSUM; - netdev->hw_enc_features |= NETIF_F_TSO; - netdev->hw_enc_features |= NETIF_F_TSO6; - netdev->hw_enc_features |= NETIF_F_GSO_PARTIAL; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, + &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, + &netdev->hw_enc_features); }
if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; - netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; - netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &netdev->vlan_features); }
if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) { - netdev->hw_features |= NETIF_F_GSO_GRE; - netdev->hw_enc_features |= NETIF_F_GSO_GRE; - netdev->gso_partial_features |= NETIF_F_GSO_GRE; + netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, + &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, + &netdev->gso_partial_features); }
if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) { - netdev->hw_features |= NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_IPXIP6; - netdev->hw_enc_features |= NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_IPXIP6; - netdev->gso_partial_features |= NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_IPXIP6; + netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_IPXIP6, + &netdev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_IPXIP6, + &netdev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | + NETIF_F_GSO_IPXIP6, + &netdev->gso_partial_features); }
- netdev->hw_features |= NETIF_F_GSO_PARTIAL; - netdev->gso_partial_features |= NETIF_F_GSO_UDP_L4; - netdev->hw_features |= NETIF_F_GSO_UDP_L4; - netdev->features |= NETIF_F_GSO_UDP_L4; + netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, + &netdev->gso_partial_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &netdev->features);
mlx5_query_port_fcs(mdev, &fcs_supported, &fcs_enabled);
if (fcs_supported) - netdev->hw_features |= NETIF_F_RXALL; + netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features);
if (MLX5_CAP_ETH(mdev, scatter_fcs)) - netdev->hw_features |= NETIF_F_RXFCS; + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features);
if (mlx5_qos_is_supported(mdev)) - netdev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features);
- netdev->features = netdev->hw_features; + netdev_feature_copy(&netdev->features, netdev->hw_features);
/* Defaults */ if (fcs_enabled) - netdev->features &= ~NETIF_F_RXALL; - netdev->features &= ~NETIF_F_LRO; - netdev->features &= ~NETIF_F_RXFCS; + netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, &netdev->features);
#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f) if (FT_CAP(flow_modify_en) && @@ -4319,15 +4348,15 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) FT_CAP(identified_miss_table_mode) && FT_CAP(flow_table_modify)) { #if IS_ENABLED(CONFIG_MLX5_CLS_ACT) - netdev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); #endif #ifdef CONFIG_MLX5_EN_ARFS - netdev->hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); #endif }
- netdev->features |= NETIF_F_HIGHDMA; - netdev->features |= NETIF_F_HW_VLAN_STAG_FILTER; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, &netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index c54aaef..e1bd3b6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -628,19 +628,20 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev, netdev->watchdog_timeo = 15 * HZ;
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT) - netdev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); #endif - netdev->hw_features |= NETIF_F_SG; - netdev->hw_features |= NETIF_F_IP_CSUM; - netdev->hw_features |= NETIF_F_IPV6_CSUM; - netdev->hw_features |= NETIF_F_GRO; - netdev->hw_features |= NETIF_F_TSO; - netdev->hw_features |= NETIF_F_TSO6; - netdev->hw_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features);
- netdev->features |= netdev->hw_features; - netdev->features |= NETIF_F_VLAN_CHALLENGED; - netdev->features |= NETIF_F_NETNS_LOCAL; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &netdev->features); }
static int mlx5e_init_rep(struct mlx5_core_dev *mdev, @@ -1004,7 +1005,7 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) mlx5e_rep_neigh_init(rpriv); mlx5e_rep_bridge_init(priv);
- netdev->wanted_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->wanted_features);
rtnl_lock(); if (netif_running(netdev)) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index 3c65fd0..f869d50 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -976,7 +976,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, int network_depth = 0; __be16 proto;
- if (unlikely(!(netdev->features & NETIF_F_RXCSUM))) + if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features))) goto csum_none;
if (lro) { @@ -1073,7 +1074,7 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, rq->clock, get_cqe_ts(cqe)); skb_record_rx_queue(skb, rq->ix);
- if (likely(netdev->features & NETIF_F_RXHASH)) + if (likely(netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features))) mlx5e_skb_set_hash(cqe, skb);
if (cqe_has_vlan(cqe)) { @@ -1662,7 +1663,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
skb->protocol = *((__be16 *)(skb->data));
- if (netdev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features)) { skb->ip_summed = CHECKSUM_COMPLETE; skb->csum = csum_unfold((__force __sum16)cqe->check_sum); stats->csum_complete++; @@ -1676,7 +1677,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, rq->clock, get_cqe_ts(cqe)); skb_record_rx_queue(skb, rq->ix);
- if (likely(netdev->features & NETIF_F_RXHASH)) + if (likely(netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features))) mlx5e_skb_set_hash(cqe, skb);
/* 20 bytes of ipoib header and 4 for encap existing */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index e5c4344..223192f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -4821,7 +4821,7 @@ static int mlx5e_tc_netdev_event(struct notifier_block *this, priv = container_of(fs, struct mlx5e_priv, fs); peer_priv = netdev_priv(ndev); if (priv == peer_priv || - !(priv->netdev->features & NETIF_F_HW_TC)) + !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, priv->netdev->features)) return NOTIFY_DONE;
mlx5e_tc_hairpin_update_dead_peer(priv, peer_priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index 67571e5..b06c5fa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -87,14 +87,14 @@ int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev) mlx5e_timestamp_init(priv);
/* netdev init */ - netdev->hw_features |= NETIF_F_SG; - netdev->hw_features |= NETIF_F_IP_CSUM; - netdev->hw_features |= NETIF_F_IPV6_CSUM; - netdev->hw_features |= NETIF_F_GRO; - netdev->hw_features |= NETIF_F_TSO; - netdev->hw_features |= NETIF_F_TSO6; - netdev->hw_features |= NETIF_F_RXCSUM; - netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features);
netdev->netdev_ops = &mlx5i_netdev_ops; netdev->ethtool_ops = &mlx5i_ethtool_ops; @@ -326,7 +326,8 @@ 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_feature_clear_bit(NETIF_F_NTUPLE_BIT, + &priv->netdev->hw_features); }
err = mlx5e_create_ttc_table(priv); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 081408e..0654b174 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1080,43 +1080,45 @@ typedef int (*mlxsw_sp_feature_handler)(struct net_device *dev, bool enable);
static int mlxsw_sp_handle_feature(struct net_device *dev, netdev_features_t wanted_features, - netdev_features_t feature, + u32 feature_bit, mlxsw_sp_feature_handler feature_handler) { - netdev_features_t changes = wanted_features ^ dev->features; - bool enable = !!(wanted_features & feature); + bool enable = netdev_feature_test_bit(feature_bit, wanted_features); + netdev_features_t changes; int err;
- if (!(changes & feature)) + netdev_feature_xor(&changes, wanted_features, dev->features); + + if (!netdev_feature_test_bit(feature_bit, changes)) return 0;
err = feature_handler(dev, enable); if (err) { - netdev_err(dev, "%s feature %pNF failed, err %d\n", - enable ? "Enable" : "Disable", &feature, err); + netdev_err(dev, "%s feature bit %u failed, err %d\n", + enable ? "Enable" : "Disable", feature_bit, err); return err; }
if (enable) - dev->features |= feature; + netdev_feature_set_bit(feature_bit, &dev->features); else - dev->features &= ~feature; - + netdev_feature_clear_bit(feature_bit, &dev->features); return 0; } static int mlxsw_sp_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t oper_features = dev->features; + netdev_features_t oper_features; int err = 0;
- err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_HW_TC, + netdev_feature_copy(&oper_features, dev->features); + err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_HW_TC_BIT, mlxsw_sp_feature_hw_tc); - err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_LOOPBACK, + err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_LOOPBACK_BIT, mlxsw_sp_feature_loopback);
if (err) { - dev->features = oper_features; + netdev_feature_copy(&dev->features, oper_features); return -EINVAL; }
@@ -1521,9 +1523,11 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
netif_carrier_off(dev);
- dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | NETIF_F_SG | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC; - dev->hw_features |= NETIF_F_HW_TC | NETIF_F_LOOPBACK; + netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | + NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_TC, &dev->features); + netdev_feature_set_bits(NETIF_F_HW_TC | NETIF_F_LOOPBACK, + &dev->hw_features);
dev->min_mtu = 0; dev->max_mtu = ETH_MAX_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- .../net/ethernet/aquantia/atlantic/aq_filters.c | 12 ++++++---- drivers/net/ethernet/aquantia/atlantic/aq_macsec.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 27 ++++++++++++++------- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 28 +++++++++++++++------- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 3 ++- .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 3 ++- 7 files changed, 51 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c index 1bc4d33..8d0c174 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c @@ -164,7 +164,8 @@ aq_check_approve_fvlan(struct aq_nic_s *aq_nic, return -EINVAL; }
- if ((aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + aq_nic->ndev->features) && (!test_bit(be16_to_cpu(fsp->h_ext.vlan_tci) & VLAN_VID_MASK, aq_nic->active_vlans))) { netdev_err(aq_nic->ndev, @@ -236,7 +237,8 @@ aq_rule_is_not_support(struct aq_nic_s *aq_nic, { bool rule_is_not_support = false;
- if (!(aq_nic->ndev->features & NETIF_F_NTUPLE)) { + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + aq_nic->ndev->features)) { netdev_err(aq_nic->ndev, "ethtool: Please, to enable the RX flow control:\n" "ethtool -K %s ntuple on\n", aq_nic->ndev->name); @@ -836,7 +838,8 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic) aq_fvlan_rebuild(aq_nic, aq_nic->active_vlans, aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans);
- if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + aq_nic->ndev->features)) { for (i = 0; i < BITS_TO_LONGS(VLAN_N_VID); i++) hweight += hweight_long(aq_nic->active_vlans[i]);
@@ -851,7 +854,8 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic) if (err) return err;
- if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + aq_nic->ndev->features)) { if (hweight <= AQ_VLAN_MAX_FILTERS && hweight > 0) { err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, !(aq_nic->packet_filter & IFF_PROMISC)); diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c index 4a6dfac..0c10d8b 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c @@ -1490,7 +1490,7 @@ int aq_macsec_init(struct aq_nic_s *nic) if (!nic->macsec_cfg) return -ENOMEM;
- nic->ndev->features |= NETIF_F_HW_MACSEC; + netdev_feature_set_bit(NETIF_F_HW_MACSEC_BIT, &nic->ndev->features); nic->ndev->macsec_ops = &aq_macsec_ops;
return 0; diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index e22935c..a153b99 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c @@ -142,35 +142,42 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) static int aq_ndev_set_features(struct net_device *ndev, netdev_features_t features) { - bool is_vlan_tx_insert = !!(features & NETIF_F_HW_VLAN_CTAG_TX); - bool is_vlan_rx_strip = !!(features & NETIF_F_HW_VLAN_CTAG_RX); struct aq_nic_s *aq_nic = netdev_priv(ndev); bool need_ndev_restart = false; struct aq_nic_cfg_s *aq_cfg; + bool is_vlan_tx_insert; + bool is_vlan_rx_strip; bool is_lro = false; int err = 0;
+ is_vlan_tx_insert = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); + is_vlan_rx_strip = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features); aq_cfg = aq_nic_get_cfg(aq_nic);
- if (!(features & NETIF_F_NTUPLE)) { - if (aq_nic->ndev->features & NETIF_F_NTUPLE) { + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) { + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + aq_nic->ndev->features)) { err = aq_clear_rxnfc_all_rules(aq_nic); if (unlikely(err)) goto err_exit; } } - if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER)) { - if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + aq_nic->ndev->features)) { err = aq_filters_vlan_offload_off(aq_nic); if (unlikely(err)) goto err_exit; } }
- aq_cfg->features = features; + netdev_feature_copy(&aq_cfg->features, features);
if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) { - is_lro = features & NETIF_F_LRO; + is_lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, features);
if (aq_cfg->is_lro != is_lro) { aq_cfg->is_lro = is_lro; @@ -178,7 +185,9 @@ static int aq_ndev_set_features(struct net_device *ndev, } }
- if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + aq_nic->ndev->features) != + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw, aq_cfg);
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index 6c04986..5e73a46 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -144,9 +144,14 @@ void aq_nic_cfg_start(struct aq_nic_s *self) cfg->link_irq_vec = 0;
cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; - cfg->features = cfg->aq_hw_caps->hw_features; - cfg->is_vlan_rx_strip = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_RX); - cfg->is_vlan_tx_insert = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_TX); + netdev_feature_zero(&cfg->features); + netdev_feature_set_bits(cfg->aq_hw_caps->hw_features, &cfg->features); + cfg->is_vlan_rx_strip = + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + cfg->features); + cfg->is_vlan_tx_insert = + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + cfg->features); cfg->is_vlan_force_promisc = true;
for (i = 0; i < sizeof(cfg->prio_tc_map); i++) @@ -367,12 +372,17 @@ void aq_nic_ndev_init(struct aq_nic_s *self) const struct aq_hw_caps_s *aq_hw_caps = self->aq_nic_cfg.aq_hw_caps; struct aq_nic_cfg_s *aq_nic_cfg = &self->aq_nic_cfg;
- self->ndev->hw_features |= aq_hw_caps->hw_features; - self->ndev->features = aq_hw_caps->hw_features; - self->ndev->vlan_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM | - NETIF_F_RXHASH | NETIF_F_SG | - NETIF_F_LRO | NETIF_F_TSO | NETIF_F_TSO6; - self->ndev->gso_partial_features = NETIF_F_GSO_UDP_L4; + netdev_feature_set_bits(aq_hw_caps->hw_features, + &self->ndev->hw_features); + netdev_feature_zero(&self->ndev->features); + netdev_feature_set_bits(aq_hw_caps->hw_features, &self->ndev->features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM | + NETIF_F_RXHASH | NETIF_F_SG | + NETIF_F_LRO | NETIF_F_TSO | NETIF_F_TSO6, + &self->ndev->vlan_features); + netdev_feature_zero(&self->ndev->gso_partial_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, + &self->ndev->gso_partial_features); self->ndev->priv_flags = aq_hw_caps->hw_priv_flags; self->ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h index 1a71480..685adb5 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h @@ -38,7 +38,7 @@ struct aq_fc_info {
struct aq_nic_cfg_s { const struct aq_hw_caps_s *aq_hw_caps; - u64 features; + netdev_features_t features; u32 rxds; /* rx ring size, descriptors # */ u32 txds; /* tx ring size, descriptors # */ u32 vecs; /* allocated rx/tx vectors */ diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c index 24122cc..63f3cef 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c @@ -318,7 +318,8 @@ static void aq_rx_checksum(struct aq_ring_s *self, struct aq_ring_buff_s *buff, struct sk_buff *skb) { - if (!(self->aq_nic->ndev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + self->aq_nic->ndev->features)) return;
if (unlikely(buff->is_cso_err)) { diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index 9f1b150..778c78b 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c @@ -273,7 +273,8 @@ static int hw_atl_b0_hw_rss_set(struct aq_hw_s *self, int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, struct aq_nic_cfg_s *aq_nic_cfg) { - u64 rxcsum = !!(aq_nic_cfg->features & NETIF_F_RXCSUM); + u64 rxcsum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + aq_nic_cfg->features); unsigned int i;
/* TX checksums offloads*/
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/atheros/alx/main.c | 17 ++++++----- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 27 +++++++++++------- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 38 ++++++++++++++----------- drivers/net/ethernet/atheros/atlx/atl1.c | 15 ++++++---- drivers/net/ethernet/atheros/atlx/atl2.c | 21 ++++++++------ drivers/net/ethernet/atheros/atlx/atlx.c | 14 +++++---- 6 files changed, 78 insertions(+), 54 deletions(-)
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 922c600..2f79aa6 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -261,7 +261,8 @@ static int alx_clean_rx_irq(struct alx_rx_queue *rxq, int budget) skb->protocol = eth_type_trans(skb, rxq->netdev);
skb_checksum_none_assert(skb); - if (alx->dev->features & NETIF_F_RXCSUM && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + alx->dev->features) && !(rrd->word3 & (cpu_to_le32(1 << RRD_ERR_L4_SHIFT) | cpu_to_le32(1 << RRD_ERR_IPV4_SHIFT)))) { switch (ALX_GET_FIELD(le32_to_cpu(rrd->word2), @@ -1101,7 +1102,8 @@ static void alx_fix_features(struct net_device *netdev, netdev_features_t *features) { if (netdev->mtu > ALX_MAX_TSO_PKT_SIZE) - *features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, + features); }
static void alx_netif_stop(struct alx_priv *alx) @@ -1816,11 +1818,12 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } }
- netdev->hw_features = NETIF_F_SG | - NETIF_F_HW_CSUM | - NETIF_F_RXCSUM | - NETIF_F_TSO | - NETIF_F_TSO6; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_HW_CSUM | + NETIF_F_RXCSUM | + NETIF_F_TSO | + NETIF_F_TSO6, &netdev->hw_features);
if (alx_get_perm_macaddr(hw, hw->perm_addr)) { dev_warn(&pdev->dev, diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index f01a39f..db6784c 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -429,7 +429,7 @@ static void atl1c_set_multi(struct net_device *netdev)
static void __atl1c_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) { /* enable VLAN tag insert/strip */ *mac_ctrl_data |= MAC_CTRL_RMV_VLAN; } else { @@ -514,23 +514,27 @@ static void atl1c_fix_features(struct net_device *netdev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features);
if (hw->nic_type != athr_mt) { if (netdev->mtu > MAX_TSO_FRAME_SIZE) - *features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, + features); } }
static int atl1c_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, netdev->features, features); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl1c_vlan_mode(netdev, features);
return 0; @@ -2626,13 +2630,14 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev) atl1c_set_ethtool_ops(netdev);
/* TODO: add when ready */ - netdev->hw_features = NETIF_F_SG | + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | - NETIF_F_TSO6; - netdev->features = netdev->hw_features | - NETIF_F_HW_VLAN_CTAG_TX; + NETIF_F_TSO6, &netdev->hw_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, &netdev->features); return 0; }
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 3f66110..a37d08c 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -299,7 +299,7 @@ static void atl1e_set_multi(struct net_device *netdev) static void __atl1e_rx_mode(netdev_features_t features, u32 *mac_ctrl_data) {
- if (features & NETIF_F_RXALL) { + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, features)) { /* enable RX of ALL frames */ *mac_ctrl_data |= MAC_CTRL_DBG; } else { @@ -326,7 +326,7 @@ static void atl1e_rx_mode(struct net_device *netdev,
static void __atl1e_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) { /* enable VLAN tag insert/strip */ *mac_ctrl_data |= MAC_CTRL_RMV_VLAN; } else { @@ -389,24 +389,25 @@ static void atl1e_fix_features(struct net_device *netdev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int atl1e_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, netdev->features, features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl1e_vlan_mode(netdev, features);
- if (changed & NETIF_F_RXALL) + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) atl1e_rx_mode(netdev, features);
- return 0; }
@@ -1065,7 +1066,7 @@ static void atl1e_setup_mac_ctrl(struct atl1e_adapter *adapter) value |= MAC_CTRL_PROMIS_EN; if (netdev->flags & IFF_ALLMULTI) value |= MAC_CTRL_MC_ALL_EN; - if (netdev->features & NETIF_F_RXALL) + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, netdev->features)) value |= MAC_CTRL_DBG; AT_WRITE_REG(hw, REG_MAC_CTRL, value); } @@ -1427,7 +1428,8 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
/* error packet */ if ((prrs->pkt_flag & RRS_IS_ERR_FRAME) && - !(netdev->features & NETIF_F_RXALL)) { + !netdev_feature_test_bit(NETIF_F_RXALL_BIT, + netdev->features)) { if (prrs->err_flag & (RRS_ERR_BAD_CRC | RRS_ERR_DRIBBLE | RRS_ERR_CODE | RRS_ERR_TRUNC)) { @@ -1441,7 +1443,8 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
packet_size = ((prrs->word1 >> RRS_PKT_SIZE_SHIFT) & RRS_PKT_SIZE_MASK); - if (likely(!(netdev->features & NETIF_F_RXFCS))) + if (likely(!netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + netdev->features))) packet_size -= 4; /* CRC */
skb = netdev_alloc_skb_ip_align(netdev, packet_size); @@ -2267,11 +2270,14 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev) (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN); atl1e_set_ethtool_ops(netdev);
- netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_RX; - netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | + NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, &netdev->features); /* not enabled by default */ - netdev->hw_features |= NETIF_F_RXALL | NETIF_F_RXFCS; + netdev_feature_set_bits(NETIF_F_RXALL | NETIF_F_RXFCS, + &netdev->hw_features); return 0; }
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 68f6c0b..a717cd0 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c @@ -2988,15 +2988,18 @@ static int atl1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_common;
- netdev->features = NETIF_F_HW_CSUM; - netdev->features |= NETIF_F_SG; - netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX); + netdev_feature_zero(&netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &netdev->features);
- netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO | + NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features);
/* is this valid? see atl1_setup_mac_ctrl() */ - netdev->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features);
/* MTU range: 42 - 10218 */ netdev->min_mtu = ETH_ZLEN - (ETH_HLEN + VLAN_HLEN); diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index c4d303c..2db6936 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c @@ -342,7 +342,7 @@ static inline void atl2_irq_disable(struct atl2_adapter *adapter)
static void __atl2_vlan_mode(netdev_features_t features, u32 *ctrl) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) { /* enable VLAN tag insert/strip */ *ctrl |= MAC_CTRL_RMV_VLAN; } else { @@ -378,18 +378,20 @@ static void atl2_fix_features(struct net_device *netdev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int atl2_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, netdev->features, features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl2_vlan_mode(netdev, features);
return 0; @@ -1387,8 +1389,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init;
- netdev->hw_features = NETIF_F_HW_VLAN_CTAG_RX; - netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX); + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &netdev->features);
/* Init PHY as early as possible due to power saving issue */ atl2_phy_init(&adapter->hw); diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index 3b0dbc3..6e91bf6 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c @@ -207,7 +207,7 @@ static void atlx_link_chg_task(struct work_struct *work)
static void __atlx_vlan_mode(netdev_features_t features, u32 *ctrl) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) { /* enable VLAN tag insert/strip */ *ctrl |= MAC_CTRL_RMV_VLAN; } else { @@ -244,18 +244,20 @@ static void atlx_fix_features(struct net_device *netdev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int atlx_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, netdev->features, features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atlx_vlan_mode(netdev, features);
return 0;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 45 +++++++------ drivers/net/ethernet/chelsio/cxgb/sge.c | 12 ++-- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 54 ++++++++++------ drivers/net/ethernet/chelsio/cxgb3/sge.c | 10 +-- drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 16 ++--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 73 +++++++++++++--------- drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h | 3 +- drivers/net/ethernet/chelsio/cxgb4/sge.c | 14 +++-- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 33 ++++++---- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 8 ++- .../chelsio/inline_crypto/chtls/chtls_main.c | 3 +- 11 files changed, 167 insertions(+), 104 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index 0741ada..6847867 100644 --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c @@ -186,7 +186,8 @@ static void link_start(struct port_info *p)
static void enable_hw_csum(struct adapter *adapter) { - if (adapter->port[0].dev->hw_features & NETIF_F_TSO) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, + adapter->port[0].dev->hw_features)) t1_tp_set_ip_checksum_offload(adapter->tp, 1); /* for TSO only */ t1_tp_set_tcp_checksum_offload(adapter->tp, 1); } @@ -860,18 +861,20 @@ static void t1_fix_features(struct net_device *dev, netdev_features_t *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. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int t1_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = dev->features ^ features; struct adapter *adapter = dev->ml_priv; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, dev->features, features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) t1_vlan_mode(adapter, features);
return 0; @@ -1029,28 +1032,34 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->mem_start = mmio_start; netdev->mem_end = mmio_start + mmio_len - 1; netdev->ml_priv = adapter; - netdev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM; - netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM | NETIF_F_LLTX; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_RXCSUM, &netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_RXCSUM | NETIF_F_LLTX, + &netdev->features);
if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->features); if (vlan_tso_capable(adapter)) { - netdev->features |= - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features);
/* T204: disable TSO */ if (!(is_T2(adapter)) || bi->port_number != 4) { - netdev->hw_features |= NETIF_F_TSO; - netdev->features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &netdev->features); } }
netdev->netdev_ops = &cxgb_netdev_ops; - netdev->hard_header_len += (netdev->hw_features & NETIF_F_TSO) ? + netdev->hard_header_len += + netdev_feature_test_bit(NETIF_F_TSO_BIT, netdev->hw_features) ? sizeof(struct cpl_tx_pkt_lso) : sizeof(struct cpl_tx_pkt);
netif_napi_add(netdev, &adapter->napi, t1_poll, 64); diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c index cda01f2..62bb332 100644 --- a/drivers/net/ethernet/chelsio/cxgb/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb/sge.c @@ -737,7 +737,7 @@ void t1_vlan_mode(struct adapter *adapter, netdev_features_t features) { struct sge *sge = adapter->sge;
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) sge->sge_control |= F_VLAN_XTRACT; else sge->sge_control &= ~F_VLAN_XTRACT; @@ -922,7 +922,8 @@ void t1_sge_intr_enable(struct sge *sge) u32 en = SGE_INT_ENABLE; u32 val = readl(sge->adapter->regs + A_PL_ENABLE);
- if (sge->adapter->port[0].dev->hw_features & NETIF_F_TSO) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, + sge->adapter->port[0].dev->hw_features)) en &= ~F_PACKET_TOO_BIG; writel(en, sge->adapter->regs + A_SG_INT_ENABLE); writel(val | SGE_PL_INTR_MASK, sge->adapter->regs + A_PL_ENABLE); @@ -946,7 +947,8 @@ bool t1_sge_intr_error_handler(struct sge *sge) u32 cause = readl(adapter->regs + A_SG_INT_CAUSE); bool wake = false;
- if (adapter->port[0].dev->hw_features & NETIF_F_TSO) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, + adapter->port[0].dev->hw_features)) cause &= ~F_PACKET_TOO_BIG; if (cause & F_RESPQ_EXHAUSTED) sge->stats.respQ_empty++; @@ -1386,8 +1388,8 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) dev = adapter->port[p->iff].dev;
skb->protocol = eth_type_trans(skb, dev); - if ((dev->features & NETIF_F_RXCSUM) && p->csum == 0xffff && - skb->protocol == htons(ETH_P_IP) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features) && + p->csum == 0xffff && skb->protocol == htons(ETH_P_IP) && (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { ++st->rx_cso_good; skb->ip_summed = CHECKSUM_UNNECESSARY; diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 485cee4..36403ce 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -1183,15 +1183,18 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
if (adapter->params.rev > 0) { t3_set_vlan_accel(adapter, 1 << pi->port_id, - features & NETIF_F_HW_VLAN_CTAG_RX); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)); } else { /* single control for all ports */ - unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_CTAG_RX; + unsigned int i, have_vlans;
+ have_vlans = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features); for_each_port(adapter, i) have_vlans |= - adapter->port[i]->features & - NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + adapter->port[i]->features);
t3_set_vlan_accel(adapter, 1, have_vlans); } @@ -2245,9 +2248,11 @@ static int cxgb_siocdevprivate(struct net_device *dev,
if (t.lro >= 0) { if (t.lro) - dev->wanted_features |= NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_GRO_BIT, + &dev->wanted_features); else - dev->wanted_features &= ~NETIF_F_GRO; + netdev_feature_clear_bit(NETIF_F_GRO_BIT, + &dev->wanted_features); netdev_update_features(dev); }
@@ -2287,7 +2292,8 @@ static int cxgb_siocdevprivate(struct net_device *dev, t.fl_size[0] = q->fl_size; t.fl_size[1] = q->jumbo_size; t.polling = q->polling; - t.lro = !!(dev->features & NETIF_F_GRO); + t.lro = netdev_feature_test_bit(NETIF_F_GRO_BIT, + dev->features); t.intr_lat = q->coalesce_usecs; t.cong_thres = q->cong_thres; t.qnum = q1; @@ -2596,17 +2602,19 @@ static void cxgb_fix_features(struct net_device *dev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int cxgb_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, dev->features, features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) cxgb_vlan_mode(dev, features);
return 0; @@ -3210,6 +3218,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) resource_size_t mmio_start, mmio_len; const struct adapter_info *ai; struct adapter *adapter = NULL; + netdev_features_t tmp; struct port_info *pi;
if (!cxgb3_wq) { @@ -3312,13 +3321,22 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->irq = pdev->irq; netdev->mem_start = mmio_start; netdev->mem_end = mmio_start + mmio_len - 1; - netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; - netdev->features |= netdev->hw_features | - NETIF_F_HW_VLAN_CTAG_TX; - netdev->vlan_features |= netdev->features & VLAN_FEAT; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_TSO | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->hw_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->features); + netdev_feature_copy(&tmp, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, &tmp); + netdev_feature_or(&netdev->vlan_features, + netdev->vlan_features, tmp); if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->features);
netdev->netdev_ops = &cxgb_netdev_ops; netdev->ethtool_ops = &cxgb_ethtool_ops; diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c index cb5c79c..7abdfbb 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c @@ -2095,8 +2095,8 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq, skb_pull(skb, sizeof(*p) + pad); skb->protocol = eth_type_trans(skb, adap->port[p->iff]); pi = netdev_priv(skb->dev); - if ((skb->dev->features & NETIF_F_RXCSUM) && p->csum_valid && - p->csum == htons(0xffff) && !p->fragment) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, skb->dev->features) && + p->csum_valid && p->csum == htons(0xffff) && !p->fragment) { qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; skb->ip_summed = CHECKSUM_UNNECESSARY; } else @@ -2179,7 +2179,8 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, offset = 2 + sizeof(struct cpl_rx_pkt); cpl = qs->lro_va = sd->pg_chunk.va + 2;
- if ((qs->netdev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + qs->netdev->features) && cpl->csum_valid && cpl->csum == htons(0xffff)) { skb->ip_summed = CHECKSUM_UNNECESSARY; qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; @@ -2341,7 +2342,8 @@ static int process_responses(struct adapter *adap, struct sge_qset *qs,
while (likely(budget_left && is_new_response(r, q))) { int packet_complete, eth, ethpad = 2; - int lro = !!(qs->netdev->features & NETIF_F_GRO); + int lro = netdev_feature_test_bit(NETIF_F_GRO_BIT, + qs->netdev->features); struct sk_buff *skb = NULL; u32 len, flags; __be32 rss_hi, rss_lo; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c index 33b2c0c..a10ee67 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c @@ -79,10 +79,10 @@ int cxgb_fcoe_enable(struct net_device *netdev)
dev_info(adap->pdev_dev, "Enabling FCoE offload features\n");
- 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_feature_set_bit(NETIF_F_FCOE_CRC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->vlan_features);
netdev_features_change(netdev);
@@ -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_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, &netdev->vlan_features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->vlan_features);
netdev_features_change(netdev);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 251b095..8d0e00f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -513,7 +513,8 @@ static int link_start(struct net_device *dev) */ ret = t4_set_rxmode(pi->adapter, mb, pi->viid, pi->viid_mirror, dev->mtu, -1, -1, -1, - !!(dev->features & NETIF_F_HW_VLAN_CTAG_RX), true); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features), true); if (ret == 0) ret = cxgb4_update_mac_filt(pi, pi->viid, &pi->xact_addr_filt, dev->dev_addr, true, &pi->smt_idx); @@ -1272,18 +1273,24 @@ int cxgb4_set_rspq_intr_params(struct sge_rspq *q,
static int cxgb_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = dev->features ^ features; const struct port_info *pi = netdev_priv(dev); + netdev_features_t changed; int err;
- if (!(changed & NETIF_F_HW_VLAN_CTAG_RX)) + netdev_feature_xor(&changed, dev->features, features); + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) return 0;
err = t4_set_rxmode(pi->adapter, pi->adapter->mbox, pi->viid, pi->viid_mirror, -1, -1, -1, -1, - !!(features & NETIF_F_HW_VLAN_CTAG_RX), true); - if (unlikely(err)) - dev->features = features ^ NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features), true); + if (unlikely(err)) { + netdev_feature_copy(&dev->features, features); + netdev_feature_change_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->features); + } + return err; }
@@ -1460,7 +1467,8 @@ static int cxgb4_port_mirror_start(struct net_device *dev) ret = t4_set_rxmode(adap, adap->mbox, pi->viid, pi->viid_mirror, dev->mtu, (dev->flags & IFF_PROMISC) ? 1 : 0, (dev->flags & IFF_ALLMULTI) ? 1 : 0, 1, - !!(dev->features & NETIF_F_HW_VLAN_CTAG_RX), true); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features), true); if (ret) { dev_err(adap->pdev_dev, "Failed start up Rx mode for Mirror VI 0x%x, ret: %d\n", @@ -3848,15 +3856,16 @@ static void cxgb_features_check(struct sk_buff *skb, struct net_device *dev, return;
/* Offload is not supported for this encapsulated packet */ - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
static void cxgb_fix_features(struct net_device *dev, netdev_features_t *features) { /* Disable GRO, if RX_CSUM is disabled */ - if (!(*features & NETIF_F_RXCSUM)) - *features &= ~NETIF_F_GRO; + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_GRO_BIT, features); }
static const struct net_device_ops cxgb4_netdev_ops = { @@ -6824,35 +6833,41 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) pi->port_id = i; netdev->irq = pdev->irq;
- netdev->hw_features = NETIF_F_SG | TSO_FLAGS | + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | TSO_FLAGS | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_GRO | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_TC | NETIF_F_NTUPLE; + NETIF_F_HW_TC | NETIF_F_NTUPLE, &netdev->hw_features);
if (chip_ver > CHELSIO_T5) { - netdev->hw_enc_features |= NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_TSO | NETIF_F_TSO6; - - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_HW_TLS_RECORD; + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_TSO | NETIF_F_TSO6, + &netdev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_HW_TLS_RECORD, + &netdev->hw_features);
if (adapter->rawf_cnt) netdev->udp_tunnel_nic_info = &cxgb_udp_tunnels; }
if (highdma) - netdev->hw_features |= NETIF_F_HIGHDMA; - netdev->features |= netdev->hw_features; - netdev->vlan_features = netdev->features & VLAN_FEAT; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->hw_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_copy(&netdev->vlan_features, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, &netdev->vlan_features); #if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE) if (pi->adapter->params.crypto & FW_CAPS_CONFIG_TLS_HW) { - netdev->hw_features |= NETIF_F_HW_TLS_TX; + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, + &netdev->hw_features); netdev->tlsdev_ops = &cxgb4_ktls_ops; /* initialize the refcount */ refcount_set(&pi->adapter->chcr_ktls.ktls_refcount, 0); @@ -6860,8 +6875,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) #endif /* CONFIG_CHELSIO_TLS_DEVICE */ #if IS_ENABLED(CONFIG_CHELSIO_IPSEC_INLINE) if (pi->adapter->params.crypto & FW_CAPS_CONFIG_IPSEC_INLINE) { - netdev->hw_enc_features |= NETIF_F_HW_ESP; - netdev->features |= NETIF_F_HW_ESP; + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, + &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, + &netdev->features); netdev->xfrmdev_ops = &cxgb4_xfrmdev_ops; } #endif /* CONFIG_CHELSIO_IPSEC_INLINE */ diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h index 70a07b7..bcaa075 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h @@ -41,7 +41,8 @@ static inline bool can_tc_u32_offload(struct net_device *dev) { struct adapter *adap = netdev2adap(dev);
- return (dev->features & NETIF_F_HW_TC) && adap->tc_u32 ? true : false; + return netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features) && + adap->tc_u32 ? true : false; }
int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls); diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index 6a099cb..67d2a37 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c @@ -3466,7 +3466,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, if (pi->rxtstamp) cxgb4_sgetim_to_hwtstamp(adapter, skb_hwtstamps(skb), gl->sgetstamp); - if (rxq->rspq.netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + rxq->rspq.netdev->features)) skb_set_hash(skb, (__force u32)pkt->rsshdr.hash_val, PKT_HASH_TYPE_L3);
@@ -3708,7 +3709,8 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, }
csum_ok = pkt->csum_calc && !err_vec && - (q->netdev->features & NETIF_F_RXCSUM); + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + q->netdev->features);
if (err_vec) rxq->stats.bad_rx_pkts++; @@ -3719,9 +3721,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, return 0; }
- if (((pkt->l2info & htonl(RXF_TCP_F)) || - tnl_hdr_len) && - (q->netdev->features & NETIF_F_GRO) && csum_ok && !pkt->ip_frag) { + if (((pkt->l2info & htonl(RXF_TCP_F)) || tnl_hdr_len) && + netdev_feature_test_bit(NETIF_F_GRO_BIT, q->netdev->features) && + csum_ok && !pkt->ip_frag) { do_gro(rxq, si, pkt, tnl_hdr_len); return 0; } @@ -3752,7 +3754,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
skb->protocol = eth_type_trans(skb, q->netdev); skb_record_rx_queue(skb, q->idx); - if (skb->dev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, skb->dev->features)) skb_set_hash(skb, (__force u32)pkt->rsshdr.hash_val, PKT_HASH_TYPE_L3);
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index 0ee73d8..a59b0cf 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -1180,21 +1180,24 @@ static void cxgb4vf_fix_features(struct net_device *dev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (*features & NETIF_F_HW_VLAN_CTAG_RX) - *features |= NETIF_F_HW_VLAN_CTAG_TX; + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else - *features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features); }
static int cxgb4vf_set_features(struct net_device *dev, netdev_features_t features) { struct port_info *pi = netdev_priv(dev); - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, dev->features, features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1, - features & NETIF_F_HW_VLAN_CTAG_TX, 0); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features), 0);
return 0; } @@ -3073,13 +3076,19 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, pi->xact_addr_filt = -1; netdev->irq = pdev->irq;
- netdev->hw_features = NETIF_F_SG | TSO_FLAGS | NETIF_F_GRO | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; - netdev->features = netdev->hw_features; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | TSO_FLAGS | NETIF_F_GRO | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->hw_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); if (pci_using_dac) - netdev->features |= NETIF_F_HIGHDMA; - netdev->vlan_features = netdev->features & VLAN_FEAT; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->features); + netdev_feature_copy(&netdev->vlan_features, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, &netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->min_mtu = 81; diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 7bc80ee..d2a2cc3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c @@ -1617,7 +1617,8 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp, struct sk_buff *skb; const struct cpl_rx_pkt *pkt = (void *)rsp; bool csum_ok = pkt->csum_calc && !pkt->err_vec && - (rspq->netdev->features & NETIF_F_RXCSUM); + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + rspq->netdev->features); struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); struct adapter *adapter = rspq->adapter; struct sge *s = &adapter->sge; @@ -1628,8 +1629,9 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp, * enabled, handle the packet in the GRO path. */ if ((pkt->l2info & cpu_to_be32(RXF_TCP_F)) && - (rspq->netdev->features & NETIF_F_GRO) && csum_ok && - !pkt->ip_frag) { + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + rspq->netdev->features) && + csum_ok && !pkt->ip_frag) { do_gro(rxq, gl, pkt); return 0; } diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c index 9098b3e..d879cf9 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_main.c @@ -135,7 +135,8 @@ static int chtls_inline_feature(struct tls_toe_device *dev)
for (i = 0; i < cdev->lldi->nports; i++) { netdev = cdev->ports[i]; - if (netdev->features & NETIF_F_HW_TLS_RECORD) + if (netdev_feature_test_bit(NETIF_F_HW_TLS_RECORD_BIT, + netdev->features)) return 1; } return 0;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/davicom/dm9000.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index e842de6..cf34956 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -586,14 +586,17 @@ static int dm9000_set_features(struct net_device *dev, netdev_features_t features) { struct board_info *dm = to_dm9000_board(dev); - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed; unsigned long flags;
- if (!(changed & NETIF_F_RXCSUM)) + netdev_feature_xor(&changed, dev->features, features); + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0;
spin_lock_irqsave(&dm->lock, flags); - iow(dm, DM9000_RCSR, (features & NETIF_F_RXCSUM) ? RCSR_CSUM : 0); + iow(dm, DM9000_RCSR, + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) ? + RCSR_CSUM : 0); spin_unlock_irqrestore(&dm->lock, flags);
return 0; @@ -911,9 +914,10 @@ dm9000_init_dm9000(struct net_device *dev) db->io_mode = ior(db, DM9000_ISR) >> 6; /* ISR bit7:6 keeps I/O mode */
/* Checksum mode */ - if (dev->hw_features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->hw_features)) iow(db, DM9000_RCSR, - (dev->features & NETIF_F_RXCSUM) ? RCSR_CSUM : 0); + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features) ? RCSR_CSUM : 0);
iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ iow(db, DM9000_GPR, 0); @@ -1169,7 +1173,8 @@ dm9000_rx(struct net_device *dev)
/* Pass to upper layer */ skb->protocol = eth_type_trans(skb, dev); - if (dev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features)) { if ((((rxbyte & 0x1c) << 3) & rxbyte) == 0) skb->ip_summed = CHECKSUM_UNNECESSARY; else @@ -1643,8 +1648,11 @@ dm9000_probe(struct platform_device *pdev)
/* dm9000a/b are capable of hardware checksum offload */ if (db->type == TYPE_DM9000A || db->type == TYPE_DM9000B) { - ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_IP_CSUM; - ndev->features |= ndev->hw_features; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM, + &ndev->hw_features); + netdev_feature_or(&ndev->features, ndev->features, + ndev->hw_features); }
/* from this point we assume that we have found a DM9000 */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 23 ++++++----- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 44 ++++++++++++++-------- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 5 ++- drivers/net/ethernet/freescale/enetc/enetc.c | 34 +++++++++++------ drivers/net/ethernet/freescale/enetc/enetc_pf.c | 38 ++++++++++++------- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 16 ++++---- drivers/net/ethernet/freescale/fec_main.c | 29 ++++++++------ .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +- drivers/net/ethernet/freescale/gianfar.c | 39 +++++++++++-------- drivers/net/ethernet/freescale/gianfar_ethtool.c | 11 ++++-- 11 files changed, 151 insertions(+), 92 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 685d2d8..2087fd4 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -249,22 +249,25 @@ static int dpaa_netdev_init(struct net_device *net_dev, net_dev->min_mtu = ETH_MIN_MTU; net_dev->max_mtu = dpaa_get_max_mtu();
- net_dev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_LLTX | NETIF_F_RXHASH); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_LLTX | NETIF_F_RXHASH, + &net_dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, + &net_dev->hw_features);
- net_dev->hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA; /* The kernels enables GSO automatically, if we declare NETIF_F_SG. * For conformity, we'll still declare GSO explicitly. */ - net_dev->features |= NETIF_F_GSO; - net_dev->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_GSO_BIT, &net_dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &net_dev->features);
net_dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; /* we do not want shared skbs on TX */ net_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- net_dev->features |= net_dev->hw_features; - net_dev->vlan_features = net_dev->features; + netdev_feature_or(&net_dev->features, net_dev->features, + net_dev->hw_features); + netdev_feature_copy(&net_dev->vlan_features, net_dev->features);
if (is_valid_ether_addr(mac_addr)) { memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len); @@ -1729,7 +1732,8 @@ static u8 rx_csum_offload(const struct dpaa_priv *priv, const struct qm_fd *fd) * We know there were no parser errors (and implicitly no * L4 csum error), otherwise we wouldn't be here. */ - if ((priv->net_dev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + priv->net_dev->features) && (be32_to_cpu(fd->status) & FM_FD_STAT_L4CV)) return CHECKSUM_UNNECESSARY;
@@ -2728,7 +2732,8 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct qman_portal *portal, }
/* Extract the hash stored in the headroom before running XDP */ - if (net_dev->features & NETIF_F_RXHASH && priv->keygen_in_use && + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, net_dev->features) && + priv->keygen_in_use && !fman_port_get_hash_result_offset(priv->mac_dev->port[RX], &hash_offset)) { hash = be32_to_cpu(*(u32 *)(vaddr + hash_offset)); diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 7065c71..1f072eb 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -51,7 +51,8 @@ static void dpaa2_eth_validate_rx_csum(struct dpaa2_eth_priv *priv, skb_checksum_none_assert(skb);
/* HW checksum validation is disabled, nothing to do here */ - if (!(priv->net_dev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + priv->net_dev->features)) return;
/* Read checksum validation bits */ @@ -2141,26 +2142,30 @@ static int dpaa2_eth_set_features(struct net_device *net_dev, netdev_features_t features) { struct dpaa2_eth_priv *priv = netdev_priv(net_dev); - netdev_features_t changed = features ^ net_dev->features; + netdev_features_t changed; bool enable; int err;
- if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { - enable = !!(features & NETIF_F_HW_VLAN_CTAG_FILTER); + netdev_feature_xor(&changed, features, net_dev->features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { + enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features); err = dpaa2_eth_set_rx_vlan_filtering(priv, enable); if (err) return err; }
- if (changed & NETIF_F_RXCSUM) { - enable = !!(features & NETIF_F_RXCSUM); + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { + enable = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features); err = dpaa2_eth_set_rx_csum(priv, enable); if (err) return err; }
- if (changed & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) { - enable = !!(features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)); + if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + changed)) { + enable = netdev_feature_test_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, features); err = dpaa2_eth_set_tx_csum(priv, enable); if (err) return err; @@ -4103,14 +4108,17 @@ static int dpaa2_eth_netdev_init(struct net_device *net_dev) net_dev->priv_flags &= ~not_supported;
/* Features */ - net_dev->features = NETIF_F_RXCSUM | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_SG | NETIF_F_HIGHDMA | - NETIF_F_LLTX | NETIF_F_HW_TC; - net_dev->hw_features = net_dev->features; + netdev_feature_zero(&net_dev->features); + netdev_feature_set_bits(NETIF_F_RXCSUM | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_SG | NETIF_F_HIGHDMA | + NETIF_F_LLTX | NETIF_F_HW_TC, + &net_dev->features); + netdev_feature_copy(&net_dev->hw_features, net_dev->features);
if (priv->dpni_attrs.vlan_filter_entries) - net_dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &net_dev->hw_features);
return 0; } @@ -4393,12 +4401,16 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) goto err_netdev_init;
/* Configure checksum offload based on current interface flags */ - err = dpaa2_eth_set_rx_csum(priv, !!(net_dev->features & NETIF_F_RXCSUM)); + err = dpaa2_eth_set_rx_csum(priv, + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + net_dev->features)); if (err) goto err_csum;
err = dpaa2_eth_set_tx_csum(priv, - !!(net_dev->features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))); + netdev_feature_test_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, + net_dev->features)); if (err) goto err_csum;
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index d260993..aaad94f 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -3262,9 +3262,10 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw, /* The DPAA2 switch's ingress path depends on the VLAN table, * thus we are not able to disable VLAN filtering. */ - port_netdev->features = NETIF_F_HW_VLAN_CTAG_FILTER | + netdev_feature_zero(&port_netdev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER | - NETIF_F_HW_TC; + NETIF_F_HW_TC, &port_netdev->features);
err = dpaa2_switch_port_init(port_priv, port_idx); if (err) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 3ca93ad..c114fe1 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -720,7 +720,8 @@ static void enetc_get_offloads(struct enetc_bdr *rx_ring, struct enetc_ndev_priv *priv = netdev_priv(rx_ring->ndev);
/* TODO: hashing */ - if (rx_ring->ndev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + rx_ring->ndev->features)) { u16 inet_csum = le16_to_cpu(rxbd->r.inet_csum);
skb->csum = csum_unfold((__force __sum16)~htons(inet_csum)); @@ -1769,7 +1770,8 @@ static void enetc_setup_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring) enetc_txbdr_wr(hw, idx, ENETC_TBICR0, ENETC_TBICR0_ICEN | 0x1);
tbmr = ENETC_TBMR_EN; - if (tx_ring->ndev->features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + tx_ring->ndev->features)) tbmr |= ENETC_TBMR_VIH;
/* enable ring */ @@ -1810,7 +1812,8 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring) if (rx_ring->ext_en) rbmr |= ENETC_RBMR_BDS;
- if (rx_ring->ndev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + rx_ring->ndev->features)) rbmr |= ENETC_RBMR_VTE;
rx_ring->rcir = hw->reg + ENETC_BDR(RX, idx, ENETC_RBCIR); @@ -2354,22 +2357,29 @@ static void enetc_enable_txvlan(struct net_device *ndev, bool en) int enetc_set_features(struct net_device *ndev, netdev_features_t features) { - netdev_features_t changed = ndev->features ^ features; + netdev_features_t changed; int err = 0;
- if (changed & NETIF_F_RXHASH) - enetc_set_rss(ndev, !!(features & NETIF_F_RXHASH)); + netdev_feature_xor(&changed, ndev->features, features);
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) + enetc_set_rss(ndev, netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + features)); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) enetc_enable_rxvlan(ndev, - !!(features & NETIF_F_HW_VLAN_CTAG_RX)); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features));
- if (changed & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, changed)) enetc_enable_txvlan(ndev, - !!(features & NETIF_F_HW_VLAN_CTAG_TX)); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features));
- if (changed & NETIF_F_HW_TC) - err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC)); + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, changed)) + err = enetc_set_psfp(ndev, + netdev_feature_test_bit(NETIF_F_HW_TC_BIT, + features));
return err; } diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 60d94e0..3432d31 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -704,20 +704,26 @@ static int enetc_sriov_configure(struct pci_dev *pdev, int num_vfs) static int enetc_pf_set_features(struct net_device *ndev, netdev_features_t features) { - netdev_features_t changed = ndev->features ^ features; struct enetc_ndev_priv *priv = netdev_priv(ndev); + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { + netdev_feature_xor(&changed, ndev->features, features); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + changed)) { struct enetc_pf *pf = enetc_si_priv(priv->si);
- if (!!(features & NETIF_F_HW_VLAN_CTAG_FILTER)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features)) enetc_disable_si_vlan_promisc(pf, 0); else enetc_enable_si_vlan_promisc(pf, 0); }
- if (changed & NETIF_F_LOOPBACK) - enetc_set_loopback(ndev, !!(features & NETIF_F_LOOPBACK)); + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed)) + enetc_set_loopback(ndev, + netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, + features));
return enetc_set_features(ndev, features); } @@ -758,15 +764,19 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->watchdog_timeo = 5 * HZ; ndev->max_mtu = ENETC_MAX_MTU;
- ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK; - ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_LOOPBACK, &ndev->hw_features); + netdev_feature_zero(&ndev->features); + netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &ndev->features);
if (si->num_rss) - ndev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features);
ndev->priv_flags |= IFF_UNICAST_FLT;
@@ -775,8 +785,8 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { priv->active_offloads |= ENETC_F_QCI; - ndev->features |= NETIF_F_HW_TC; - ndev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->hw_features); }
/* pick up primary MAC address from SI */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c index 4577226..c7a6f62 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -308,7 +308,7 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data) return -EINVAL;
/* Do not support TXSTART and TX CSUM offload simutaniously */ - if (ndev->features & NETIF_F_CSUM_MASK) + if (netdev_feature_test_bits(NETIF_F_CSUM_MASK, ndev->features)) return -EBUSY;
/* TSD and Qbv are mutually exclusive in hardware */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index 1a9d1e8..553902f 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -120,15 +120,17 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->watchdog_timeo = 5 * HZ; ndev->max_mtu = ENETC_MAX_MTU;
- ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &ndev->hw_features); + netdev_feature_zero(&ndev->features); + netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &ndev->features);
if (si->num_rss) - ndev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features);
/* pick up primary MAC address from SI */ enetc_get_primary_mac_addr(&si->hw, ndev->dev_addr); diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index fdff37b..dd5881e 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1553,7 +1553,8 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
/* If this is a VLAN packet remove the VLAN Tag */ vlan_packet_rcvd = false; - if ((ndev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + ndev->features) && fep->bufdesc_ex && (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) { /* Push and remove the vlan tag */ @@ -3368,13 +3369,14 @@ static inline void fec_enet_set_netdev_features(struct net_device *netdev, netdev_features_t features) { struct fec_enet_private *fep = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- netdev->features = features; + netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_copy(&netdev->features, features);
/* Receive checksum has been changed */ - if (changed & NETIF_F_RXCSUM) { - if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) fep->csum_flags |= FLAG_RX_CSUM_ENABLED; else fep->csum_flags &= ~FLAG_RX_CSUM_ENABLED; @@ -3385,9 +3387,12 @@ static int fec_set_features(struct net_device *netdev, netdev_features_t features) { struct fec_enet_private *fep = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (netif_running(netdev) && changed & NETIF_F_RXCSUM) { + netdev_feature_xor(&changed, features, netdev->features); + + if (netif_running(netdev) && + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { napi_disable(&fep->napi); netif_tx_lock_bh(netdev); fec_stop(netdev); @@ -3554,14 +3559,16 @@ static int fec_enet_init(struct net_device *ndev)
if (fep->quirks & FEC_QUIRK_HAS_VLAN) /* enable hw VLAN support */ - ndev->features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &ndev->features);
if (fep->quirks & FEC_QUIRK_HAS_CSUM) { ndev->gso_max_segs = FEC_MAX_TSO_SEGS;
/* enable hw accelerator */ - ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM - | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | NETIF_F_SG | + NETIF_F_TSO, &ndev->features); fep->csum_flags |= FLAG_RX_CSUM_ENABLED; }
@@ -3570,7 +3577,7 @@ static int fec_enet_init(struct net_device *ndev) fep->rx_align = 0x3f; }
- ndev->hw_features = ndev->features; + netdev_feature_copy(&ndev->hw_features, ndev->features);
fec_restart(ndev);
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 2db6e38..0796556 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -1026,7 +1026,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
netif_carrier_off(ndev);
- ndev->features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features);
ret = register_netdev(ndev); if (ret) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index af6ad94..852b5d5 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -160,7 +160,8 @@ static void gfar_rx_offload_en(struct gfar_private *priv) /* set this when rx hw offload (TOE) functions are being used */ priv->uses_rxfcb = 0;
- if (priv->ndev->features & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX)) + if (netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX, + priv->ndev->features)) priv->uses_rxfcb = 1;
if (priv->hwts_rx_en || priv->rx_filer_enable) @@ -182,7 +183,7 @@ static void gfar_mac_rx_config(struct gfar_private *priv) if (priv->ndev->flags & IFF_PROMISC) rctrl |= RCTRL_PROM;
- if (priv->ndev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, priv->ndev->features)) rctrl |= RCTRL_CHECKSUMMING;
if (priv->extended_hash) @@ -197,7 +198,8 @@ static void gfar_mac_rx_config(struct gfar_private *priv) if (priv->hwts_rx_en) rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE;
- if (priv->ndev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + priv->ndev->features)) rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
/* Clear the LFC bit */ @@ -216,7 +218,8 @@ static void gfar_mac_tx_config(struct gfar_private *priv) struct gfar __iomem *regs = priv->gfargrp[0].regs; u32 tctrl = 0;
- if (priv->ndev->features & NETIF_F_IP_CSUM) + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, + priv->ndev->features)) tctrl |= TCTRL_INIT_CSUM;
if (priv->prio_sched_en) @@ -227,7 +230,8 @@ static void gfar_mac_tx_config(struct gfar_private *priv) gfar_write(®s->tr47wt, DEFAULT_WRRS_WEIGHT); }
- if (priv->ndev->features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + priv->ndev->features)) tctrl |= TCTRL_VLINS;
gfar_write(®s->tctrl, tctrl); @@ -2484,14 +2488,15 @@ static void gfar_process_frame(struct net_device *ndev, struct sk_buff *skb) /* Trim off the FCS */ pskb_trim(skb, skb->len - ETH_FCS_LEN);
- if (ndev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, ndev->features)) gfar_rx_checksum(skb, fcb);
/* There's need to check for NETIF_F_HW_VLAN_CTAG_RX here. * Even if vlan rx accel is disabled, on some chips * RXFCB_VLN is pseudo randomly set. */ - if (ndev->features & NETIF_F_HW_VLAN_CTAG_RX && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + ndev->features) && be16_to_cpu(fcb->flags) & RXFCB_VLN) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(fcb->vlctl)); @@ -3242,16 +3247,20 @@ static int gfar_probe(struct platform_device *ofdev) }
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) { - dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_RXCSUM; - dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_RXCSUM | NETIF_F_HIGHDMA; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_RXCSUM, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_RXCSUM | NETIF_F_HIGHDMA, + &dev->features); }
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) { - dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - dev->features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &dev->features); }
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; @@ -3264,7 +3273,7 @@ static int gfar_probe(struct platform_device *ofdev) if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) priv->padding = 8 + DEFAULT_PADDING;
- if (dev->features & NETIF_F_IP_CSUM || + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, dev->features) || priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index cc7d4f9..ee85e48 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -499,18 +499,21 @@ static int gfar_spauseparam(struct net_device *dev,
int gfar_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = dev->features ^ features; struct gfar_private *priv = netdev_priv(dev); + netdev_features_t changed; int err = 0;
- if (!(changed & (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_RXCSUM))) + netdev_feature_xor(&changed, dev->features, features); + + if (!netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_RXCSUM, changed)) return 0;
while (test_and_set_bit_lock(GFAR_RESETTING, &priv->state)) cpu_relax();
- dev->features = features; + netdev_feature_copy(&dev->features, features);
if (dev->flags & IFF_UP) { /* Now we take down the rings to rebuild them */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 45 +++++++++++++++-------- drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c | 20 ++++++---- drivers/net/ethernet/synopsys/dwc-xlgmac-net.c | 41 +++++++++++++-------- 3 files changed, 68 insertions(+), 38 deletions(-)
diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c index df26cea..4e61f92c 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c @@ -179,34 +179,47 @@ static int xlgmac_init(struct xlgmac_pdata *pdata)
/* Set device features */ if (pdata->hw_feat.tso) { - netdev->hw_features = NETIF_F_TSO; - netdev->hw_features |= NETIF_F_TSO6; - netdev->hw_features |= NETIF_F_SG; - netdev->hw_features |= NETIF_F_IP_CSUM; - netdev->hw_features |= NETIF_F_IPV6_CSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &netdev->hw_features); } else if (pdata->hw_feat.tx_coe) { - netdev->hw_features = NETIF_F_IP_CSUM; - netdev->hw_features |= NETIF_F_IPV6_CSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &netdev->hw_features); }
if (pdata->hw_feat.rx_coe) { - netdev->hw_features |= NETIF_F_RXCSUM; - netdev->hw_features |= NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); }
if (pdata->hw_feat.rss) - netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, + &netdev->hw_features);
- netdev->vlan_features |= netdev->hw_features; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->hw_features);
- netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features); if (pdata->hw_feat.sa_vlan_ins) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_features); if (pdata->hw_feat.vlhash) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->hw_features);
- netdev->features |= netdev->hw_features; - pdata->netdev_features = netdev->features; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_copy(&pdata->netdev_features, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c index bf6c1c6..c7d6013 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c @@ -263,7 +263,8 @@ static int xlgmac_set_promiscuous_mode(struct xlgmac_pdata *pdata, if (enable) { xlgmac_disable_rx_vlan_filtering(pdata); } else { - if (pdata->netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + pdata->netdev->features)) xlgmac_enable_rx_vlan_filtering(pdata); }
@@ -404,7 +405,8 @@ static void xlgmac_config_jumbo_enable(struct xlgmac_pdata *pdata)
static void xlgmac_config_checksum_offload(struct xlgmac_pdata *pdata) { - if (pdata->netdev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + pdata->netdev->features)) xlgmac_enable_rx_csum(pdata); else xlgmac_disable_rx_csum(pdata); @@ -425,12 +427,14 @@ static void xlgmac_config_vlan_support(struct xlgmac_pdata *pdata) /* Set the current VLAN Hash Table register value */ xlgmac_update_vlan_hash_table(pdata);
- if (pdata->netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + pdata->netdev->features)) xlgmac_enable_rx_vlan_filtering(pdata); else xlgmac_disable_rx_vlan_filtering(pdata);
- if (pdata->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + pdata->netdev->features)) xlgmac_enable_rx_vlan_stripping(pdata); else xlgmac_disable_rx_vlan_stripping(pdata); @@ -2433,7 +2437,8 @@ static void xlgmac_config_rss(struct xlgmac_pdata *pdata) if (!pdata->hw_feat.rss) return;
- if (pdata->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + pdata->netdev->features)) ret = xlgmac_enable_rss(pdata); else ret = xlgmac_disable_rss(pdata); @@ -2760,7 +2765,7 @@ static int xlgmac_dev_read(struct xlgmac_channel *channel) 0);
/* Set checksum done indicator as appropriate */ - if (netdev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features)) pkt_info->attributes = XLGMAC_SET_REG_BITS( pkt_info->attributes, RX_PACKET_ATTRIBUTES_CSUM_DONE_POS, @@ -2779,7 +2784,8 @@ static int xlgmac_dev_read(struct xlgmac_channel *channel) if (!err || !etlt) { /* No error if err is 0 or etlt is 0 */ if ((etlt == 0x09) && - (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) { + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) { pkt_info->attributes = XLGMAC_SET_REG_BITS( pkt_info->attributes, RX_PACKET_ATTRIBUTES_VLAN_CTAG_POS, diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c index 1db7104..f4dfef74 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c @@ -879,39 +879,49 @@ static void xlgmac_poll_controller(struct net_device *netdev) static int xlgmac_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t rxhash, rxcsum, rxvlan, rxvlan_filter; struct xlgmac_pdata *pdata = netdev_priv(netdev); struct xlgmac_hw_ops *hw_ops = &pdata->hw_ops; + bool rxhash, rxcsum, rxvlan, rxvlan_filter; int ret = 0;
- rxhash = pdata->netdev_features & NETIF_F_RXHASH; - rxcsum = pdata->netdev_features & NETIF_F_RXCSUM; - rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX; - rxvlan_filter = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_FILTER; + rxhash = netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + pdata->netdev_features); + rxcsum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + pdata->netdev_features); + rxvlan = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + pdata->netdev_features); + rxvlan_filter = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + pdata->netdev_features);
- if ((features & NETIF_F_RXHASH) && !rxhash) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && !rxhash) ret = hw_ops->enable_rss(pdata); - else if (!(features & NETIF_F_RXHASH) && rxhash) + else if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && + rxhash) ret = hw_ops->disable_rss(pdata); if (ret) return ret;
- if ((features & NETIF_F_RXCSUM) && !rxcsum) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && !rxcsum) hw_ops->enable_rx_csum(pdata); - else if (!(features & NETIF_F_RXCSUM) && rxcsum) + else if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && + rxcsum) hw_ops->disable_rx_csum(pdata);
- if ((features & NETIF_F_HW_VLAN_CTAG_RX) && !rxvlan) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) && + !rxvlan) hw_ops->enable_rx_vlan_stripping(pdata); - else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) && rxvlan) + else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features) && rxvlan) hw_ops->disable_rx_vlan_stripping(pdata);
- if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) && !rxvlan_filter) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features) && !rxvlan_filter) hw_ops->enable_rx_vlan_filtering(pdata); - else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && rxvlan_filter) + else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features) && rxvlan_filter) hw_ops->disable_rx_vlan_filtering(pdata);
- pdata->netdev_features = features; + netdev_feature_copy(&pdata->netdev_features, features);
return 0; } @@ -1219,7 +1229,8 @@ static int xlgmac_rx_poll(struct xlgmac_channel *channel, int budget)
/* Be sure we don't exceed the configured MTU */ max_len = netdev->mtu + ETH_HLEN; - if (!(netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features) && (skb->protocol == htons(ETH_P_8021Q))) max_len += VLAN_HLEN;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/sfc/ef10.c | 33 +++++++++++++------- drivers/net/ethernet/sfc/ef100_nic.c | 39 ++++++++++++++++-------- drivers/net/ethernet/sfc/ef100_rx.c | 6 ++-- drivers/net/ethernet/sfc/ef100_tx.c | 11 ++++--- drivers/net/ethernet/sfc/ef10_sriov.c | 6 ++-- drivers/net/ethernet/sfc/efx.c | 30 +++++++++++-------- drivers/net/ethernet/sfc/efx_common.c | 36 ++++++++++++++-------- drivers/net/ethernet/sfc/falcon/efx.c | 45 ++++++++++++++++++---------- drivers/net/ethernet/sfc/falcon/net_driver.h | 4 +-- drivers/net/ethernet/sfc/falcon/rx.c | 6 ++-- drivers/net/ethernet/sfc/farch.c | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 18 +++++++---- drivers/net/ethernet/sfc/mcdi_port_common.c | 3 +- drivers/net/ethernet/sfc/net_driver.h | 4 +-- drivers/net/ethernet/sfc/rx.c | 3 +- drivers/net/ethernet/sfc/rx_common.c | 3 +- 16 files changed, 162 insertions(+), 87 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index e7e2223..7bb1c8c 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -627,7 +627,8 @@ static int efx_ef10_probe(struct efx_nic *efx)
if (nic_data->datapath_caps & (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_INCLUDE_FCS_LBN)) - efx->net_dev->hw_features |= NETIF_F_RXFCS; + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, + &efx->net_dev->hw_features);
rc = efx_mcdi_port_get_number(efx); if (rc < 0) @@ -1304,9 +1305,11 @@ static void efx_ef10_fini_nic(struct efx_nic *efx) static int efx_ef10_init_nic(struct efx_nic *efx) { struct efx_ef10_nic_data *nic_data = efx->nic_data; - netdev_features_t hw_enc_features = 0; + netdev_features_t hw_enc_features; int rc;
+ netdev_feature_zero(&hw_enc_features); + if (nic_data->must_check_datapath_caps) { rc = efx_ef10_init_datapath_caps(efx); if (rc) @@ -1351,18 +1354,27 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
/* add encapsulated checksum offload features */ if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx)) - hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &hw_enc_features); /* add encapsulated TSO features */ if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { netdev_features_t encap_tso_features;
- encap_tso_features = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | - NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM; - - hw_enc_features |= encap_tso_features | NETIF_F_TSO; - efx->net_dev->features |= encap_tso_features; + netdev_feature_zero(&encap_tso_features); + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_GRE | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_GRE_CSUM, + &encap_tso_features); + + netdev_feature_or(&hw_enc_features, hw_enc_features, + encap_tso_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &hw_enc_features); + netdev_feature_or(&efx->net_dev->features, + efx->net_dev->features, + encap_tso_features); } - efx->net_dev->hw_enc_features = hw_enc_features; + netdev_feature_copy(&efx->net_dev->hw_enc_features, hw_enc_features);
/* don't fail init if RSS setup doesn't work */ rc = efx->type->rx_push_rss_config(efx, false, @@ -2694,7 +2706,8 @@ static u16 efx_ef10_handle_rx_event_errors(struct efx_channel *channel, bool handled = false;
if (EFX_QWORD_FIELD(*event, ESF_DZ_RX_ECRC_ERR)) { - if (!(efx->net_dev->features & NETIF_F_RXALL)) { + if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, + efx->net_dev->features)) { if (!efx->loopback_selftest) channel->n_rx_eth_crc_err += n_packets; return EFX_RX_PKT_DISCARD; diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 518268c..35f6dd0 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -184,17 +184,26 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) { struct net_device *net_dev = efx->net_dev; - netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL | - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM; - - net_dev->features |= tso; - net_dev->hw_features |= tso; - net_dev->hw_enc_features |= tso; + netdev_features_t tso; + + netdev_feature_zero(&tso); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_PARTIAL | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM, + &tso); + + netdev_feature_or(&net_dev->features, net_dev->features, tso); + netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, + tso); + netdev_feature_or(&net_dev->hw_enc_features, + net_dev->hw_enc_features, tso); /* EF100 HW can only offload outer checksums if they are UDP, * so for GRE_CSUM we have to use GSO_PARTIAL. */ - net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; + netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, + &net_dev->gso_partial_features); } efx->num_mac_stats = MCDI_WORD(outbuf, GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS); @@ -1111,11 +1120,15 @@ static int ef100_probe_main(struct efx_nic *efx) return -ENOMEM; efx->nic_data = nic_data; nic_data->efx = efx; - net_dev->features |= efx->type->offload_features; - net_dev->hw_features |= efx->type->offload_features; - net_dev->hw_enc_features |= efx->type->offload_features; - net_dev->vlan_features |= NETIF_F_HW_CSUM | NETIF_F_SG | - NETIF_F_HIGHDMA | NETIF_F_ALL_TSO; + netdev_feature_set_bits(efx->type->offload_features, + &net_dev->features); + netdev_feature_set_bits(efx->type->offload_features, + &net_dev->hw_features); + netdev_feature_set_bits(efx->type->offload_features, + &net_dev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | + NETIF_F_HIGHDMA | NETIF_F_ALL_TSO, + &net_dev->vlan_features);
/* Populate design-parameter defaults */ nic_data->tso_max_hdr_len = ESE_EF100_DP_GZ_TSO_MAX_HDR_LEN_DEFAULT; diff --git a/drivers/net/ethernet/sfc/ef100_rx.c b/drivers/net/ethernet/sfc/ef100_rx.c index 85207ac..ffd7d7c 100644 --- a/drivers/net/ethernet/sfc/ef100_rx.c +++ b/drivers/net/ethernet/sfc/ef100_rx.c @@ -64,7 +64,8 @@ void __ef100_rx_packet(struct efx_channel *channel) prefix = (u32 *)(eh - ESE_GZ_RX_PKT_PREFIX_LEN);
if (ef100_has_fcs_error(channel, prefix) && - unlikely(!(efx->net_dev->features & NETIF_F_RXALL))) + unlikely(!netdev_feature_test_bit(NETIF_F_RXALL_BIT, + efx->net_dev->features))) goto out;
rx_buf->len = le16_to_cpu((__force __le16)PREFIX_FIELD(prefix, LENGTH)); @@ -76,7 +77,8 @@ void __ef100_rx_packet(struct efx_channel *channel) goto out; }
- if (likely(efx->net_dev->features & NETIF_F_RXCSUM)) { + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + efx->net_dev->features))) { if (PREFIX_FIELD(prefix, NT_OR_INNER_L3_CLASS) == 1) { ++channel->n_rx_ip_hdr_chksum_err; } else { diff --git a/drivers/net/ethernet/sfc/ef100_tx.c b/drivers/net/ethernet/sfc/ef100_tx.c index 26ef51d..087c18e 100644 --- a/drivers/net/ethernet/sfc/ef100_tx.c +++ b/drivers/net/ethernet/sfc/ef100_tx.c @@ -61,7 +61,7 @@ static bool ef100_tx_can_tso(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
if (!skb_is_gso_tcp(skb)) return false; - if (!(efx->net_dev->features & NETIF_F_TSO)) + if (!netdev_feature_test_bit(NETIF_F_TSO_BIT, efx->net_dev->features)) return false;
mss = skb_shinfo(skb)->gso_size; @@ -175,9 +175,11 @@ static void ef100_make_send_desc(struct efx_nic *efx, ESF_GZ_TX_SEND_LEN, buffer->len, ESF_GZ_TX_SEND_ADDR, buffer->dma_addr);
- if (likely(efx->net_dev->features & NETIF_F_HW_CSUM)) + if (likely(netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, + efx->net_dev->features))) ef100_set_tx_csum_partial(skb, buffer, txd); - if (efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + efx->net_dev->features) && skb && skb_vlan_tag_present(skb)) ef100_set_tx_hw_vlan(skb, txd); } @@ -202,7 +204,8 @@ static void ef100_make_tso_desc(struct efx_nic *efx,
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID) mangleid = ESE_GZ_TX_DESC_IP4_ID_NO_OP; - if (efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + efx->net_dev->features)) vlan_enable = skb_vlan_tag_present(skb);
len = skb->len - buffer->len; diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c index 752d640..2e449b5 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -243,9 +243,11 @@ static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx)
if (port_flags & (1 << MC_CMD_VPORT_ALLOC_IN_FLAG_VLAN_RESTRICT_LBN)) - efx->fixed_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &efx->fixed_features); else - efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &efx->fixed_features);
return 0;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index a295e26..ed142f3 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1029,6 +1029,7 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) { struct net_device *net_dev = efx->net_dev; int rc = efx_pci_probe_main(efx); + netdev_features_t tmp;
if (rc) return rc; @@ -1041,29 +1042,34 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) }
/* Determine netdevice features */ - net_dev->features |= (efx->type->offload_features | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL); + netdev_feature_set_bits(efx->type->offload_features | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL, + &net_dev->features); + if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) - net_dev->features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &net_dev->features); /* Check whether device supports TSO */ if (!efx->type->tso_versions || !efx->type->tso_versions(efx)) - net_dev->features &= ~NETIF_F_ALL_TSO; + netdev_feature_clear_bits(NETIF_F_ALL_TSO, &net_dev->features); /* Mask for features that also apply to VLAN devices */ - net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG | - NETIF_F_HIGHDMA | NETIF_F_ALL_TSO | - NETIF_F_RXCSUM); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | + NETIF_F_HIGHDMA | NETIF_F_ALL_TSO | + NETIF_F_RXCSUM, &net_dev->vlan_features);
- net_dev->hw_features |= net_dev->features & ~efx->fixed_features; + netdev_feature_andnot(&tmp, net_dev->features, efx->fixed_features); + netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, tmp);
/* Disable receiving frames with bad FCS, by default. */ - net_dev->features &= ~NETIF_F_RXALL; + netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &net_dev->features);
/* 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; - net_dev->features |= efx->fixed_features; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &net_dev->features); + netdev_feature_or(&net_dev->features, net_dev->features, + efx->fixed_features);
rc = efx_register_netdev(efx); if (!rc) @@ -1096,7 +1102,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct efx_nic_type *) entry->driver_data; - efx->fixed_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev); diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c index a101fa5..0135373 100644 --- a/drivers/net/ethernet/sfc/efx_common.c +++ b/drivers/net/ethernet/sfc/efx_common.c @@ -211,10 +211,12 @@ void efx_set_rx_mode(struct net_device *net_dev) int efx_set_features(struct net_device *net_dev, netdev_features_t data) { struct efx_nic *efx = netdev_priv(net_dev); + netdev_features_t changed; int rc;
/* If disabling RX n-tuple filtering, clear existing filters */ - if (net_dev->features & ~data & NETIF_F_NTUPLE) { + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, net_dev->features) && + !netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, data)) { rc = efx->type->filter_clear_rx(efx, EFX_FILTER_PRI_MANUAL); if (rc) return rc; @@ -223,8 +225,9 @@ int efx_set_features(struct net_device *net_dev, netdev_features_t data) /* If Rx VLAN filter is changed, update filters via mac_reconfigure. * If rx-fcs is changed, mac_reconfigure updates that too. */ - if ((net_dev->features ^ data) & (NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_RXFCS)) { + netdev_feature_xor(&changed, net_dev->features, data); + if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_RXFCS, changed)) { /* efx_set_rx_mode() will schedule MAC work to update filters * when a new features are finally set in net_dev. */ @@ -363,8 +366,8 @@ void efx_start_monitor(struct efx_nic *efx) */ static void efx_start_datapath(struct efx_nic *efx) { - netdev_features_t old_features = efx->net_dev->features; bool old_rx_scatter = efx->rx_scatter; + netdev_features_t old_features; size_t rx_buf_len;
/* Calculate the rx buffer allocation parameters required to @@ -409,10 +412,14 @@ static void efx_start_datapath(struct efx_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */ - efx->net_dev->hw_features |= efx->net_dev->features; - efx->net_dev->hw_features &= ~efx->fixed_features; - efx->net_dev->features |= efx->fixed_features; - if (efx->net_dev->features != old_features) + netdev_feature_copy(&old_features, efx->net_dev->features); + netdev_feature_or(&efx->net_dev->hw_features, + efx->net_dev->hw_features, efx->net_dev->features); + netdev_feature_andnot(&efx->net_dev->hw_features, + efx->net_dev->hw_features, efx->fixed_features); + netdev_feature_or(&efx->net_dev->features, efx->net_dev->features, + efx->fixed_features); + if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev);
/* RX filters may also have scatter-enabled flags */ @@ -1359,17 +1366,20 @@ void efx_features_check(struct sk_buff *skb, struct net_device *dev, struct efx_nic *efx = netdev_priv(dev);
if (skb->encapsulation) { - if (*features & NETIF_F_GSO_MASK) + if (netdev_feature_test_bits(NETIF_F_GSO_MASK, *features)) /* 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)) + netdev_feature_clear_bits(NETIF_F_GSO_MASK, + features); + if (netdev_feature_test_bits(NETIF_F_GSO_MASK | + NETIF_F_CSUM_MASK, *features)) if (!efx_can_encap_offloads(efx, skb)) - *features &= ~(NETIF_F_GSO_MASK | - NETIF_F_CSUM_MASK); + netdev_feature_clear_bits(NETIF_F_GSO_MASK | + NETIF_F_CSUM_MASK, + features); } }
diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index c177ea0..af4aeb0 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c @@ -592,8 +592,8 @@ static int ef4_probe_channels(struct ef4_nic *efx) */ static void ef4_start_datapath(struct ef4_nic *efx) { - netdev_features_t old_features = efx->net_dev->features; bool old_rx_scatter = efx->rx_scatter; + netdev_features_t old_features; struct ef4_tx_queue *tx_queue; struct ef4_rx_queue *rx_queue; struct ef4_channel *channel; @@ -640,10 +640,14 @@ static void ef4_start_datapath(struct ef4_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */ - efx->net_dev->hw_features |= efx->net_dev->features; - efx->net_dev->hw_features &= ~efx->fixed_features; - efx->net_dev->features |= efx->fixed_features; - if (efx->net_dev->features != old_features) + netdev_feature_copy(&old_features, efx->net_dev->features); + netdev_feature_or(&efx->net_dev->hw_features, + efx->net_dev->hw_features, efx->net_dev->features); + netdev_feature_andnot(&efx->net_dev->hw_features, + efx->net_dev->hw_features, efx->fixed_features); + netdev_feature_or(&efx->net_dev->features, efx->net_dev->features, + efx->net_dev->features); + if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev);
/* RX filters may also have scatter-enabled flags */ @@ -2192,17 +2196,21 @@ static void ef4_set_rx_mode(struct net_device *net_dev) static int ef4_set_features(struct net_device *net_dev, netdev_features_t data) { struct ef4_nic *efx = netdev_priv(net_dev); + netdev_features_t changed; int rc;
/* If disabling RX n-tuple filtering, clear existing filters */ - if (net_dev->features & ~data & NETIF_F_NTUPLE) { + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, net_dev->features) && + !netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, data)) { rc = efx->type->filter_clear_rx(efx, EF4_FILTER_PRI_MANUAL); if (rc) return rc; }
/* If Rx VLAN filter is changed, update filters via mac_reconfigure */ - if ((net_dev->features ^ data) & NETIF_F_HW_VLAN_CTAG_FILTER) { + netdev_feature_xor(&changed, net_dev->features, data); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + changed)) { /* ef4_set_rx_mode() will schedule MAC work to update filters * when a new features are finally set in net_dev. */ @@ -2925,7 +2933,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct ef4_nic_type *) entry->driver_data; - efx->fixed_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev); @@ -2947,20 +2955,27 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, if (rc) goto fail3;
- net_dev->features |= (efx->type->offload_features | NETIF_F_SG | - NETIF_F_RXCSUM); + netdev_feature_set_bits(efx->type->offload_features, + &net_dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM, + &net_dev->features); /* Mask for features that also apply to VLAN devices */ - net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG | - NETIF_F_HIGHDMA | NETIF_F_RXCSUM); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | + NETIF_F_HIGHDMA | NETIF_F_RXCSUM, + &net_dev->vlan_features);
- net_dev->hw_features = net_dev->features & ~efx->fixed_features; + netdev_feature_copy(&net_dev->hw_features, net_dev->features); + netdev_feature_clear_bits(efx->type->offload_features, + &net_dev->hw_features);
/* 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; - net_dev->features |= efx->fixed_features; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &net_dev->features); + netdev_feature_or(&net_dev->features, net_dev->features, + efx->fixed_features);
rc = ef4_register_netdev(efx); if (rc) diff --git a/drivers/net/ethernet/sfc/falcon/net_driver.h b/drivers/net/ethernet/sfc/falcon/net_driver.h index 6fabfe7..10d7db7 100644 --- a/drivers/net/ethernet/sfc/falcon/net_driver.h +++ b/drivers/net/ethernet/sfc/falcon/net_driver.h @@ -1153,7 +1153,7 @@ struct ef4_nic_type { bool always_rx_scatter; unsigned int max_interrupt_mode; unsigned int timer_period_max; - netdev_features_t offload_features; + u64 offload_features; unsigned int max_rx_ip_filters; };
@@ -1303,7 +1303,7 @@ static inline void ef4_supported_features(const struct ef4_nic *efx, { const struct net_device *net_dev = efx->net_dev;
- *supported = net_dev->features | net_dev->hw_features; + netdev_feature_or(supported, net_dev->features, net_dev->hw_features); }
/* Get the current TX queue insert index. */ diff --git a/drivers/net/ethernet/sfc/falcon/rx.c b/drivers/net/ethernet/sfc/falcon/rx.c index 966f13e..0fc41f8 100644 --- a/drivers/net/ethernet/sfc/falcon/rx.c +++ b/drivers/net/ethernet/sfc/falcon/rx.c @@ -438,7 +438,8 @@ ef4_rx_packet_gro(struct ef4_channel *channel, struct ef4_rx_buffer *rx_buf, return; }
- if (efx->net_dev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + efx->net_dev->features)) skb_set_hash(skb, ef4_rx_buf_hash(efx, eh), PKT_HASH_TYPE_L3); skb->ip_summed = ((rx_buf->flags & EF4_RX_PKT_CSUMMED) ? @@ -667,7 +668,8 @@ void __ef4_rx_packet(struct ef4_channel *channel) goto out; }
- if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM))) + if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + efx->net_dev->features))) rx_buf->flags &= ~EF4_RX_PKT_CSUMMED;
if ((rx_buf->flags & EF4_RX_PKT_TCP) && !channel->type->receive_skb) diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 148dcd4..8e95075 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c @@ -921,7 +921,7 @@ static u16 efx_farch_handle_rx_not_ok(struct efx_rx_queue *rx_queue, (void) rx_ev_other_err; #endif
- if (efx->net_dev->features & NETIF_F_RXALL) + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, efx->net_dev->features)) /* don't discard frame for CRC error */ rx_ev_eth_crc_err = false;
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c index 8e788c3..2a9a692 100644 --- a/drivers/net/ethernet/sfc/mcdi_filters.c +++ b/drivers/net/ethernet/sfc/mcdi_filters.c @@ -1322,16 +1322,20 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) goto fail;
efx_supported_features(efx, &supported); - if ((supported & NETIF_F_HW_VLAN_CTAG_FILTER) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + supported) && !(efx_mcdi_filter_match_supported(table, false, (EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_LOC_MAC)) && efx_mcdi_filter_match_supported(table, false, (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_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &net_dev->features); + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &efx->fixed_features); + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &net_dev->hw_features); }
table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS, @@ -1343,7 +1347,8 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
table->mc_promisc_last = false; table->vlan_filter = - !!(efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + efx->net_dev->features); INIT_LIST_HEAD(&table->vlan_list); init_rwsem(&table->lock);
@@ -1760,7 +1765,8 @@ void efx_mcdi_filter_sync_rx_mode(struct efx_nic *efx) * Do it in advance to avoid conflicts for unicast untagged and * VLAN 0 tagged filters. */ - vlan_filter = !!(net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER); + vlan_filter = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + net_dev->features); if (table->vlan_filter != vlan_filter) { table->vlan_filter = vlan_filter; efx_mcdi_filter_remove_old(efx); diff --git a/drivers/net/ethernet/sfc/mcdi_port_common.c b/drivers/net/ethernet/sfc/mcdi_port_common.c index 4bd3ef8..81c4a8d 100644 --- a/drivers/net/ethernet/sfc/mcdi_port_common.c +++ b/drivers/net/ethernet/sfc/mcdi_port_common.c @@ -1097,7 +1097,8 @@ int efx_mcdi_set_mac(struct efx_nic *efx)
MCDI_POPULATE_DWORD_1(cmdbytes, SET_MAC_IN_FLAGS, SET_MAC_IN_FLAG_INCLUDE_FCS, - !!(efx->net_dev->features & NETIF_F_RXFCS)); + netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + efx->net_dev->features));
switch (efx->wanted_fc) { case EFX_FC_RX | EFX_FC_TX: diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index cfeb37f..a4e0ff7 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1469,7 +1469,7 @@ struct efx_nic_type { bool option_descriptors; unsigned int min_interrupt_mode; unsigned int timer_period_max; - netdev_features_t offload_features; + u64 offload_features; int mcdi_max_ver; unsigned int max_rx_ip_filters; u32 hwtstamp_filters; @@ -1678,7 +1678,7 @@ static inline void efx_supported_features(const struct efx_nic *efx, { const struct net_device *net_dev = efx->net_dev;
- *supported = net_dev->features | net_dev->hw_features; + netdev_feature_or(supported, net_dev->features, net_dev->hw_features); }
/* Get the current TX queue insert index. */ diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 6067509..1a9cb9a 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c @@ -387,7 +387,8 @@ void __efx_rx_packet(struct efx_channel *channel) if (!efx_do_xdp(efx, channel, rx_buf, &eh)) goto out;
- if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM))) + if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + efx->net_dev->features))) rx_buf->flags &= ~EFX_RX_PKT_CSUMMED;
if ((rx_buf->flags & EFX_RX_PKT_TCP) && !channel->type->receive_skb) diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c index 68fc7d3..d10a28e 100644 --- a/drivers/net/ethernet/sfc/rx_common.c +++ b/drivers/net/ethernet/sfc/rx_common.c @@ -525,7 +525,8 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, return; }
- if (efx->net_dev->features & NETIF_F_RXHASH && + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + efx->net_dev->features) && efx_rx_buf_hash_valid(efx, eh)) skb_set_hash(skb, efx_rx_buf_hash(efx, eh), PKT_HASH_TYPE_L3);
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/sfc/ef10.c | 33 +++++++++++++------- drivers/net/ethernet/sfc/ef100_nic.c | 39 ++++++++++++++++-------- drivers/net/ethernet/sfc/ef100_rx.c | 6 ++-- drivers/net/ethernet/sfc/ef100_tx.c | 11 ++++--- drivers/net/ethernet/sfc/ef10_sriov.c | 6 ++-- drivers/net/ethernet/sfc/efx.c | 30 +++++++++++-------- drivers/net/ethernet/sfc/efx_common.c | 36 ++++++++++++++-------- drivers/net/ethernet/sfc/falcon/efx.c | 45 ++++++++++++++++++---------- drivers/net/ethernet/sfc/falcon/net_driver.h | 4 +-- drivers/net/ethernet/sfc/falcon/rx.c | 6 ++-- drivers/net/ethernet/sfc/farch.c | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 18 +++++++---- drivers/net/ethernet/sfc/mcdi_port_common.c | 3 +- drivers/net/ethernet/sfc/net_driver.h | 4 +-- drivers/net/ethernet/sfc/rx.c | 3 +- drivers/net/ethernet/sfc/rx_common.c | 3 +- 16 files changed, 162 insertions(+), 87 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index e7e2223..7bb1c8c 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -627,7 +627,8 @@ static int efx_ef10_probe(struct efx_nic *efx)
if (nic_data->datapath_caps & (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_INCLUDE_FCS_LBN))
efx->net_dev->hw_features |= NETIF_F_RXFCS;
netdev_feature_set_bit(NETIF_F_RXFCS_BIT,
&efx->net_dev->hw_features);
rc = efx_mcdi_port_get_number(efx); if (rc < 0)
@@ -1304,9 +1305,11 @@ static void efx_ef10_fini_nic(struct efx_nic *efx) static int efx_ef10_init_nic(struct efx_nic *efx) { struct efx_ef10_nic_data *nic_data = efx->nic_data;
- netdev_features_t hw_enc_features = 0;
netdev_features_t hw_enc_features; int rc;
netdev_feature_zero(&hw_enc_features);
if (nic_data->must_check_datapath_caps) { rc = efx_ef10_init_datapath_caps(efx); if (rc)
@@ -1351,18 +1354,27 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
/* add encapsulated checksum offload features */ if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx))
hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
/* add encapsulated TSO features */ if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { netdev_features_t encap_tso_features;&hw_enc_features);
encap_tso_features = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM;
hw_enc_features |= encap_tso_features | NETIF_F_TSO;
efx->net_dev->features |= encap_tso_features;
netdev_feature_zero(&encap_tso_features);
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_GRE |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE_CSUM,
&encap_tso_features);
netdev_feature_or(&hw_enc_features, hw_enc_features,
encap_tso_features);
netdev_feature_set_bit(NETIF_F_TSO_BIT, &hw_enc_features);
netdev_feature_or(&efx->net_dev->features,
efx->net_dev->features,
}encap_tso_features);
- efx->net_dev->hw_enc_features = hw_enc_features;
netdev_feature_copy(&efx->net_dev->hw_enc_features, hw_enc_features);
/* don't fail init if RSS setup doesn't work */ rc = efx->type->rx_push_rss_config(efx, false,
@@ -2694,7 +2706,8 @@ static u16 efx_ef10_handle_rx_event_errors(struct efx_channel *channel, bool handled = false;
if (EFX_QWORD_FIELD(*event, ESF_DZ_RX_ECRC_ERR)) {
if (!(efx->net_dev->features & NETIF_F_RXALL)) {
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
efx->net_dev->features)) { if (!efx->loopback_selftest) channel->n_rx_eth_crc_err += n_packets; return EFX_RX_PKT_DISCARD;
diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 518268c..35f6dd0 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -184,17 +184,26 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) { struct net_device *net_dev = efx->net_dev;
netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
net_dev->features |= tso;
net_dev->hw_features |= tso;
net_dev->hw_enc_features |= tso;
netdev_features_t tso;
netdev_feature_zero(&tso);
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM,
&tso);
netdev_feature_or(&net_dev->features, net_dev->features, tso);
netdev_feature_or(&net_dev->hw_features, net_dev->hw_features,
tso);
netdev_feature_or(&net_dev->hw_enc_features,
/* EF100 HW can only offload outer checksums if they are UDP,net_dev->hw_enc_features, tso);
*/
- so for GRE_CSUM we have to use GSO_PARTIAL.
net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT,
} efx->num_mac_stats = MCDI_WORD(outbuf, GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);&net_dev->gso_partial_features);
@@ -1111,11 +1120,15 @@ static int ef100_probe_main(struct efx_nic *efx) return -ENOMEM; efx->nic_data = nic_data; nic_data->efx = efx;
- net_dev->features |= efx->type->offload_features;
- net_dev->hw_features |= efx->type->offload_features;
- net_dev->hw_enc_features |= efx->type->offload_features;
- net_dev->vlan_features |= NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO;
netdev_feature_set_bits(efx->type->offload_features,
&net_dev->features);
netdev_feature_set_bits(efx->type->offload_features,
&net_dev->hw_features);
netdev_feature_set_bits(efx->type->offload_features,
&net_dev->hw_enc_features);
netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO,
&net_dev->vlan_features);
/* Populate design-parameter defaults */ nic_data->tso_max_hdr_len = ESE_EF100_DP_GZ_TSO_MAX_HDR_LEN_DEFAULT;
diff --git a/drivers/net/ethernet/sfc/ef100_rx.c b/drivers/net/ethernet/sfc/ef100_rx.c index 85207ac..ffd7d7c 100644 --- a/drivers/net/ethernet/sfc/ef100_rx.c +++ b/drivers/net/ethernet/sfc/ef100_rx.c @@ -64,7 +64,8 @@ void __ef100_rx_packet(struct efx_channel *channel) prefix = (u32 *)(eh - ESE_GZ_RX_PKT_PREFIX_LEN);
if (ef100_has_fcs_error(channel, prefix) &&
unlikely(!(efx->net_dev->features & NETIF_F_RXALL)))
unlikely(!netdev_feature_test_bit(NETIF_F_RXALL_BIT,
efx->net_dev->features)))
goto out;
rx_buf->len = le16_to_cpu((__force __le16)PREFIX_FIELD(prefix, LENGTH));
@@ -76,7 +77,8 @@ void __ef100_rx_packet(struct efx_channel *channel) goto out; }
- if (likely(efx->net_dev->features & NETIF_F_RXCSUM)) {
- if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
if (PREFIX_FIELD(prefix, NT_OR_INNER_L3_CLASS) == 1) { ++channel->n_rx_ip_hdr_chksum_err; } else {efx->net_dev->features))) {
diff --git a/drivers/net/ethernet/sfc/ef100_tx.c b/drivers/net/ethernet/sfc/ef100_tx.c index 26ef51d..087c18e 100644 --- a/drivers/net/ethernet/sfc/ef100_tx.c +++ b/drivers/net/ethernet/sfc/ef100_tx.c @@ -61,7 +61,7 @@ static bool ef100_tx_can_tso(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
if (!skb_is_gso_tcp(skb)) return false;
- if (!(efx->net_dev->features & NETIF_F_TSO))
if (!netdev_feature_test_bit(NETIF_F_TSO_BIT, efx->net_dev->features)) return false;
mss = skb_shinfo(skb)->gso_size;
@@ -175,9 +175,11 @@ static void ef100_make_send_desc(struct efx_nic *efx, ESF_GZ_TX_SEND_LEN, buffer->len, ESF_GZ_TX_SEND_ADDR, buffer->dma_addr);
- if (likely(efx->net_dev->features & NETIF_F_HW_CSUM))
- if (likely(netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT,
ef100_set_tx_csum_partial(skb, buffer, txd);efx->net_dev->features)))
- if (efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
skb && skb_vlan_tag_present(skb)) ef100_set_tx_hw_vlan(skb, txd); }efx->net_dev->features) &&
@@ -202,7 +204,8 @@ static void ef100_make_tso_desc(struct efx_nic *efx,
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID) mangleid = ESE_GZ_TX_DESC_IP4_ID_NO_OP;
- if (efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_TX)
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT,
efx->net_dev->features))
vlan_enable = skb_vlan_tag_present(skb);
len = skb->len - buffer->len;
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c index 752d640..2e449b5 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -243,9 +243,11 @@ static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx)
if (port_flags & (1 << MC_CMD_VPORT_ALLOC_IN_FLAG_VLAN_RESTRICT_LBN))
efx->fixed_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
else&efx->fixed_features);
efx->fixed_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&efx->fixed_features);
return 0;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index a295e26..ed142f3 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1029,6 +1029,7 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) { struct net_device *net_dev = efx->net_dev; int rc = efx_pci_probe_main(efx);
netdev_features_t tmp;
if (rc) return rc;
@@ -1041,29 +1042,34 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) }
/* Determine netdevice features */
- net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL);
- netdev_feature_set_bits(efx->type->offload_features | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL,
&net_dev->features);
- if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM))
net_dev->features |= NETIF_F_TSO6;
/* Check whether device supports TSO */ if (!efx->type->tso_versions || !efx->type->tso_versions(efx))netdev_feature_set_bit(NETIF_F_TSO6_BIT, &net_dev->features);
net_dev->features &= ~NETIF_F_ALL_TSO;
/* Mask for features that also apply to VLAN devices */netdev_feature_clear_bits(NETIF_F_ALL_TSO, &net_dev->features);
- net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
NETIF_F_RXCSUM);
- netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
NETIF_F_RXCSUM, &net_dev->vlan_features);
- net_dev->hw_features |= net_dev->features & ~efx->fixed_features;
netdev_feature_andnot(&tmp, net_dev->features, efx->fixed_features);
netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, tmp);
/* Disable receiving frames with bad FCS, by default. */
- net_dev->features &= ~NETIF_F_RXALL;
netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &net_dev->features);
/* 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;
- net_dev->features |= efx->fixed_features;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->features);
netdev_feature_or(&net_dev->features, net_dev->features,
efx->fixed_features);
rc = efx_register_netdev(efx); if (!rc)
@@ -1096,7 +1102,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct efx_nic_type *) entry->driver_data;
- efx->fixed_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev);
diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c index a101fa5..0135373 100644 --- a/drivers/net/ethernet/sfc/efx_common.c +++ b/drivers/net/ethernet/sfc/efx_common.c @@ -211,10 +211,12 @@ void efx_set_rx_mode(struct net_device *net_dev) int efx_set_features(struct net_device *net_dev, netdev_features_t data) { struct efx_nic *efx = netdev_priv(net_dev);
netdev_features_t changed; int rc;
/* If disabling RX n-tuple filtering, clear existing filters */
- if (net_dev->features & ~data & NETIF_F_NTUPLE) {
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, net_dev->features) &&
rc = efx->type->filter_clear_rx(efx, EFX_FILTER_PRI_MANUAL); if (rc) return rc;!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, data)) {
@@ -223,8 +225,9 @@ int efx_set_features(struct net_device *net_dev, netdev_features_t data) /* If Rx VLAN filter is changed, update filters via mac_reconfigure. * If rx-fcs is changed, mac_reconfigure updates that too. */
- if ((net_dev->features ^ data) & (NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_RXFCS)) {
- netdev_feature_xor(&changed, net_dev->features, data);
- if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_FILTER |
/* efx_set_rx_mode() will schedule MAC work to update filtersNETIF_F_RXFCS, changed)) {
*/
- when a new features are finally set in net_dev.
@@ -363,8 +366,8 @@ void efx_start_monitor(struct efx_nic *efx) */ static void efx_start_datapath(struct efx_nic *efx) {
- netdev_features_t old_features = efx->net_dev->features; bool old_rx_scatter = efx->rx_scatter;
netdev_features_t old_features; size_t rx_buf_len;
/* Calculate the rx buffer allocation parameters required to
@@ -409,10 +412,14 @@ static void efx_start_datapath(struct efx_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */
- efx->net_dev->hw_features |= efx->net_dev->features;
- efx->net_dev->hw_features &= ~efx->fixed_features;
- efx->net_dev->features |= efx->fixed_features;
- if (efx->net_dev->features != old_features)
netdev_feature_copy(&old_features, efx->net_dev->features);
netdev_feature_or(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->net_dev->features);
netdev_feature_andnot(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->fixed_features);
netdev_feature_or(&efx->net_dev->features, efx->net_dev->features,
efx->fixed_features);
if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev);
/* RX filters may also have scatter-enabled flags */
@@ -1359,17 +1366,20 @@ void efx_features_check(struct sk_buff *skb, struct net_device *dev, struct efx_nic *efx = netdev_priv(dev);
if (skb->encapsulation) {
if (*features & NETIF_F_GSO_MASK)
if (netdev_feature_test_bits(NETIF_F_GSO_MASK, *features)) /* 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))
netdev_feature_clear_bits(NETIF_F_GSO_MASK,
features);
if (netdev_feature_test_bits(NETIF_F_GSO_MASK |
NETIF_F_CSUM_MASK, *features)) if (!efx_can_encap_offloads(efx, skb))
*features &= ~(NETIF_F_GSO_MASK |
NETIF_F_CSUM_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK |
NETIF_F_CSUM_MASK,
} }features);
diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index c177ea0..af4aeb0 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c @@ -592,8 +592,8 @@ static int ef4_probe_channels(struct ef4_nic *efx) */ static void ef4_start_datapath(struct ef4_nic *efx) {
- netdev_features_t old_features = efx->net_dev->features; bool old_rx_scatter = efx->rx_scatter;
- netdev_features_t old_features; struct ef4_tx_queue *tx_queue; struct ef4_rx_queue *rx_queue; struct ef4_channel *channel;
@@ -640,10 +640,14 @@ static void ef4_start_datapath(struct ef4_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */
- efx->net_dev->hw_features |= efx->net_dev->features;
- efx->net_dev->hw_features &= ~efx->fixed_features;
- efx->net_dev->features |= efx->fixed_features;
- if (efx->net_dev->features != old_features)
netdev_feature_copy(&old_features, efx->net_dev->features);
netdev_feature_or(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->net_dev->features);
netdev_feature_andnot(&efx->net_dev->hw_features,
efx->net_dev->hw_features, efx->fixed_features);
netdev_feature_or(&efx->net_dev->features, efx->net_dev->features,
efx->net_dev->features);
if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev);
/* RX filters may also have scatter-enabled flags */
@@ -2192,17 +2196,21 @@ static void ef4_set_rx_mode(struct net_device *net_dev) static int ef4_set_features(struct net_device *net_dev, netdev_features_t data) { struct ef4_nic *efx = netdev_priv(net_dev);
netdev_features_t changed; int rc;
/* If disabling RX n-tuple filtering, clear existing filters */
- if (net_dev->features & ~data & NETIF_F_NTUPLE) {
if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, net_dev->features) &&
!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, data)) {
rc = efx->type->filter_clear_rx(efx, EF4_FILTER_PRI_MANUAL); if (rc) return rc; }
/* If Rx VLAN filter is changed, update filters via mac_reconfigure */
- if ((net_dev->features ^ data) & NETIF_F_HW_VLAN_CTAG_FILTER) {
- netdev_feature_xor(&changed, net_dev->features, data);
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
/* ef4_set_rx_mode() will schedule MAC work to update filterschanged)) {
*/
- when a new features are finally set in net_dev.
@@ -2925,7 +2933,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct ef4_nic_type *) entry->driver_data;
- efx->fixed_features |= NETIF_F_HIGHDMA;
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev);
@@ -2947,20 +2955,27 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, if (rc) goto fail3;
- net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
NETIF_F_RXCSUM);
- netdev_feature_set_bits(efx->type->offload_features,
&net_dev->features);
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM,
/* Mask for features that also apply to VLAN devices */&net_dev->features);
- net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_RXCSUM);
- netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG |
NETIF_F_HIGHDMA | NETIF_F_RXCSUM,
&net_dev->vlan_features);
- net_dev->hw_features = net_dev->features & ~efx->fixed_features;
- netdev_feature_copy(&net_dev->hw_features, net_dev->features);
- netdev_feature_clear_bits(efx->type->offload_features,
&net_dev->hw_features);
it's "efx->fixed_features", not "efx->type->offload_features", so it should be “netdev_feature_andnot(net_dev->hw_features, net_dev->features, efx->fixed_features)” will fix it in next version
/* 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;
- net_dev->features |= efx->fixed_features;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->features);
netdev_feature_or(&net_dev->features, net_dev->features,
efx->fixed_features);
rc = ef4_register_netdev(efx); if (rc)
diff --git a/drivers/net/ethernet/sfc/falcon/net_driver.h b/drivers/net/ethernet/sfc/falcon/net_driver.h index 6fabfe7..10d7db7 100644 --- a/drivers/net/ethernet/sfc/falcon/net_driver.h +++ b/drivers/net/ethernet/sfc/falcon/net_driver.h @@ -1153,7 +1153,7 @@ struct ef4_nic_type { bool always_rx_scatter; unsigned int max_interrupt_mode; unsigned int timer_period_max;
- netdev_features_t offload_features;
- u64 offload_features; unsigned int max_rx_ip_filters; };
@@ -1303,7 +1303,7 @@ static inline void ef4_supported_features(const struct ef4_nic *efx, { const struct net_device *net_dev = efx->net_dev;
- *supported = net_dev->features | net_dev->hw_features;
netdev_feature_or(supported, net_dev->features, net_dev->hw_features); }
/* Get the current TX queue insert index. */
diff --git a/drivers/net/ethernet/sfc/falcon/rx.c b/drivers/net/ethernet/sfc/falcon/rx.c index 966f13e..0fc41f8 100644 --- a/drivers/net/ethernet/sfc/falcon/rx.c +++ b/drivers/net/ethernet/sfc/falcon/rx.c @@ -438,7 +438,8 @@ ef4_rx_packet_gro(struct ef4_channel *channel, struct ef4_rx_buffer *rx_buf, return; }
- if (efx->net_dev->features & NETIF_F_RXHASH)
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
skb_set_hash(skb, ef4_rx_buf_hash(efx, eh), PKT_HASH_TYPE_L3); skb->ip_summed = ((rx_buf->flags & EF4_RX_PKT_CSUMMED) ?efx->net_dev->features))
@@ -667,7 +668,8 @@ void __ef4_rx_packet(struct ef4_channel *channel) goto out; }
- if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM)))
if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
efx->net_dev->features)))
rx_buf->flags &= ~EF4_RX_PKT_CSUMMED;
if ((rx_buf->flags & EF4_RX_PKT_TCP) && !channel->type->receive_skb)
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 148dcd4..8e95075 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c @@ -921,7 +921,7 @@ static u16 efx_farch_handle_rx_not_ok(struct efx_rx_queue *rx_queue, (void) rx_ev_other_err; #endif
- if (efx->net_dev->features & NETIF_F_RXALL)
- if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, efx->net_dev->features)) /* don't discard frame for CRC error */ rx_ev_eth_crc_err = false;
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c index 8e788c3..2a9a692 100644 --- a/drivers/net/ethernet/sfc/mcdi_filters.c +++ b/drivers/net/ethernet/sfc/mcdi_filters.c @@ -1322,16 +1322,20 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) goto fail;
efx_supported_features(efx, &supported);
- if ((supported & NETIF_F_HW_VLAN_CTAG_FILTER) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
!(efx_mcdi_filter_match_supported(table, false, (EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_LOC_MAC)) && efx_mcdi_filter_match_supported(table, false, (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");supported) &&
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_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->features);
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&efx->fixed_features);
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
&net_dev->hw_features);
}
table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS,
@@ -1343,7 +1347,8 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
table->mc_promisc_last = false; table->vlan_filter =
!!(efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER);
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
INIT_LIST_HEAD(&table->vlan_list); init_rwsem(&table->lock);efx->net_dev->features);
@@ -1760,7 +1765,8 @@ void efx_mcdi_filter_sync_rx_mode(struct efx_nic *efx) * Do it in advance to avoid conflicts for unicast untagged and * VLAN 0 tagged filters. */
- vlan_filter = !!(net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER);
- vlan_filter = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
if (table->vlan_filter != vlan_filter) { table->vlan_filter = vlan_filter; efx_mcdi_filter_remove_old(efx);net_dev->features);
diff --git a/drivers/net/ethernet/sfc/mcdi_port_common.c b/drivers/net/ethernet/sfc/mcdi_port_common.c index 4bd3ef8..81c4a8d 100644 --- a/drivers/net/ethernet/sfc/mcdi_port_common.c +++ b/drivers/net/ethernet/sfc/mcdi_port_common.c @@ -1097,7 +1097,8 @@ int efx_mcdi_set_mac(struct efx_nic *efx)
MCDI_POPULATE_DWORD_1(cmdbytes, SET_MAC_IN_FLAGS, SET_MAC_IN_FLAG_INCLUDE_FCS,
!!(efx->net_dev->features & NETIF_F_RXFCS));
netdev_feature_test_bit(NETIF_F_RXFCS_BIT,
efx->net_dev->features));
switch (efx->wanted_fc) { case EFX_FC_RX | EFX_FC_TX:
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index cfeb37f..a4e0ff7 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1469,7 +1469,7 @@ struct efx_nic_type { bool option_descriptors; unsigned int min_interrupt_mode; unsigned int timer_period_max;
- netdev_features_t offload_features;
- u64 offload_features; int mcdi_max_ver; unsigned int max_rx_ip_filters; u32 hwtstamp_filters;
@@ -1678,7 +1678,7 @@ static inline void efx_supported_features(const struct efx_nic *efx, { const struct net_device *net_dev = efx->net_dev;
- *supported = net_dev->features | net_dev->hw_features;
netdev_feature_or(supported, net_dev->features, net_dev->hw_features); }
/* Get the current TX queue insert index. */
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 6067509..1a9cb9a 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c @@ -387,7 +387,8 @@ void __efx_rx_packet(struct efx_channel *channel) if (!efx_do_xdp(efx, channel, rx_buf, &eh)) goto out;
- if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM)))
if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
efx->net_dev->features)))
rx_buf->flags &= ~EFX_RX_PKT_CSUMMED;
if ((rx_buf->flags & EFX_RX_PKT_TCP) && !channel->type->receive_skb)
diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c index 68fc7d3..d10a28e 100644 --- a/drivers/net/ethernet/sfc/rx_common.c +++ b/drivers/net/ethernet/sfc/rx_common.c @@ -525,7 +525,8 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, return; }
- if (efx->net_dev->features & NETIF_F_RXHASH &&
- if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
efx_rx_buf_hash_valid(efx, eh)) skb_set_hash(skb, efx_rx_buf_hash(efx, eh), PKT_HASH_TYPE_L3);efx->net_dev->features) &&
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 6 ++++-- drivers/net/ethernet/qualcomm/emac/emac.c | 25 +++++++++++++--------- .../net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 11 ++++++---- drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 10 +++++---- 4 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c index 87b8c03..15a87e9 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c @@ -286,7 +286,8 @@ void emac_mac_mode_config(struct emac_adapter *adpt) mac = readl(adpt->base + EMAC_MAC_CTRL); mac &= ~(VLAN_STRIP | PROM_MODE | MULTI_ALL | MAC_LP_EN);
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) mac |= VLAN_STRIP;
if (netdev->flags & IFF_PROMISC) @@ -1143,7 +1144,8 @@ void emac_mac_rx_process(struct emac_adapter *adpt, struct emac_rx_queue *rx_q, skb_put(skb, RRD_PKT_SIZE(&rrd) - ETH_FCS_LEN); skb->dev = netdev; skb->protocol = eth_type_trans(skb, skb->dev); - if (netdev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features)) skb->ip_summed = RRD_L4F(&rrd) ? CHECKSUM_NONE : CHECKSUM_UNNECESSARY; else diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index 9015a38..71c403c 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c @@ -175,13 +175,16 @@ static irqreturn_t emac_isr(int _irq, void *data) static int emac_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = features ^ netdev->features; struct emac_adapter *adpt = netdev_priv(netdev); + netdev_features_t changed; + + netdev_feature_xor(&changed, features, netdev->features);
/* We only need to reprogram the hardware if the VLAN tag features * have changed, and if it's already running. */ - if (!(changed & (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX))) + if (!netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, changed)) return 0;
if (!netif_running(netdev)) @@ -190,7 +193,7 @@ static int emac_set_features(struct net_device *netdev, /* emac_mac_mode_config() uses netdev->features to configure the EMAC, * so make sure it's set first. */ - netdev->features = features; + netdev_feature_copy(&netdev->features, features);
return emac_reinit_locked(adpt); } @@ -668,13 +671,15 @@ static int emac_probe(struct platform_device *pdev) }
/* set hw features */ - netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | - NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; - netdev->hw_features = netdev->features; - - netdev->vlan_features |= NETIF_F_SG | NETIF_F_HW_CSUM | - NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | + NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, &netdev->features); + netdev_feature_copy(&netdev->hw_features, netdev->features); + + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | + NETIF_F_TSO | NETIF_F_TSO6, + &netdev->vlan_features);
/* MTU range: 46 - 9194 */ netdev->min_mtu = EMAC_MIN_ETH_FRAME_SIZE - diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 3676976..45fb2da 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -406,7 +406,8 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len) struct rmnet_priv *priv = netdev_priv(skb->dev); struct rmnet_map_dl_csum_trailer *csum_trailer;
- if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) { + if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + skb->dev->features))) { priv->stats.csum_sw++; return -EOPNOTSUPP; } @@ -439,8 +440,9 @@ static void rmnet_map_v4_checksum_uplink_packet(struct sk_buff *skb, ul_header = (struct rmnet_map_ul_csum_header *) skb_push(skb, sizeof(struct rmnet_map_ul_csum_header));
- if (unlikely(!(orig_dev->features & - (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)))) + if (unlikely(!netdev_feature_test_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, + orig_dev->features))) goto sw_csum;
if (skb->ip_summed != CHECKSUM_PARTIAL) @@ -506,7 +508,8 @@ int rmnet_map_process_next_hdr_packet(struct sk_buff *skb, if (nexthdr_type != RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD) return -EINVAL;
- if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) { + if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + skb->dev->features))) { priv->stats.csum_sw++; } else if (next_hdr->csum_info & MAPV5_CSUMINFO_VALID_FLAG) { priv->stats.csum_ok++; diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c index 13d8eb4..d6d3dab 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c @@ -236,7 +236,7 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev) rmnet_dev->needs_free_netdev = true; rmnet_dev->ethtool_ops = &rmnet_ethtool_ops;
- rmnet_dev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &rmnet_dev->features);
/* This perm addr will be used as interface identifier by IPv6 */ rmnet_dev->addr_assign_type = NET_ADDR_RANDOM; @@ -261,9 +261,11 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, return -EBUSY; }
- rmnet_dev->hw_features = NETIF_F_RXCSUM; - rmnet_dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - rmnet_dev->hw_features |= NETIF_F_SG; + netdev_feature_zero(&rmnet_dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &rmnet_dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &rmnet_dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &rmnet_dev->hw_features);
priv->real_dev = real_dev;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/nvidia/forcedeth.c | 60 ++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index cce9f8d..103599b 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -3052,7 +3052,8 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit) * here. Even if vlan rx accel is disabled, * NV_RX3_VLAN_TAG_PRESENT is pseudo randomly set. */ - if (dev->features & NETIF_F_HW_VLAN_CTAG_RX && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features) && vlanflags & NV_RX3_VLAN_TAG_PRESENT) { u16 vid = vlanflags & NV_RX3_VLAN_TAG_MASK;
@@ -4874,7 +4875,7 @@ static int nv_set_loopback(struct net_device *dev, netdev_features_t features)
spin_lock_irqsave(&np->lock, flags); miicontrol = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); - if (features & NETIF_F_LOOPBACK) { + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features)) { if (miicontrol & BMCR_LOOPBACK) { spin_unlock_irqrestore(&np->lock, flags); netdev_info(dev, "Loopback already enabled\n"); @@ -4924,8 +4925,9 @@ static void nv_fix_features(struct net_device *dev, netdev_features_t *features) { /* vlan is dependent on rx checksum offload */ - if (*features & (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX)) - *features |= NETIF_F_RXCSUM; + if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, *features)) + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, features); }
static void nv_vlan_mode(struct net_device *dev, netdev_features_t features) @@ -4934,12 +4936,12 @@ static void nv_vlan_mode(struct net_device *dev, netdev_features_t features)
spin_lock_irq(&np->lock);
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP; else np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP;
- if (features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) np->txrxctl_bits |= NVREG_TXRXCTL_VLANINS; else np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS; @@ -4953,19 +4955,22 @@ static int nv_set_features(struct net_device *dev, netdev_features_t features) { struct fe_priv *np = netdev_priv(dev); u8 __iomem *base = get_hwbase(dev); - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed; int retval;
- if ((changed & NETIF_F_LOOPBACK) && netif_running(dev)) { + netdev_feature_xor(&changed, dev->features, features); + + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && + netif_running(dev)) { retval = nv_set_loopback(dev, features); if (retval != 0) return retval; }
- if (changed & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { spin_lock_irq(&np->lock);
- if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; else np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK; @@ -4976,7 +4981,8 @@ static int nv_set_features(struct net_device *dev, netdev_features_t features) spin_unlock_irq(&np->lock); }
- if (changed & (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX)) + if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, changed)) nv_vlan_mode(dev, features);
return 0; @@ -5607,7 +5613,7 @@ static int nv_open(struct net_device *dev) /* If the loopback feature was set while the device was down, make sure * that it's set correctly now. */ - if (dev->features & NETIF_F_LOOPBACK) + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, dev->features)) nv_set_loopback(dev, dev->features);
return 0; @@ -5784,7 +5790,8 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) dev_info(&pci_dev->dev, "64-bit DMA failed, using 32-bit addressing\n"); else - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &dev->features); if (pci_set_consistent_dma_mask(pci_dev, DMA_BIT_MASK(39))) { dev_info(&pci_dev->dev, "64-bit DMA (consistent) failed, using 32-bit ring buffers\n"); @@ -5806,21 +5813,23 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
if (id->driver_data & DEV_HAS_CHECKSUM) { np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; - dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_RXCSUM, + &dev->hw_features); }
np->vlanctl_bits = 0; if (id->driver_data & DEV_HAS_VLAN) { np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; - dev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, + &dev->hw_features); }
- dev->features |= dev->hw_features; + netdev_feature_or(&dev->features, dev->features, dev->hw_features);
/* Add loopback capability to the device. */ - dev->hw_features |= NETIF_F_LOOPBACK; + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &dev->hw_features);
/* MTU range: 64 - 1500 or 9100 */ dev->min_mtu = ETH_ZLEN + ETH_FCS_LEN; @@ -6111,13 +6120,16 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) dev->name, np->phy_oui, np->phyaddr, dev->dev_addr);
dev_info(&pci_dev->dev, "%s%s%s%s%s%s%s%s%s%s%sdesc-v%u\n", - dev->features & NETIF_F_HIGHDMA ? "highdma " : "", - dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ? + netdev_feature_test_bit(NETIF_F_HIGHDMA_BIT, dev->features) ? + "highdma " : "", + netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_SG, + dev->features) ? "csum " : "", - dev->features & (NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX) ? + netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, + dev->features) ? "vlan " : "", - dev->features & (NETIF_F_LOOPBACK) ? + netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, dev->features) ? "loopback " : "", id->driver_data & DEV_HAS_POWER_CNTRL ? "pwrctl " : "", id->driver_data & DEV_HAS_MGMT_UNIT ? "mgmt " : "",
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/faraday/ftgmac100.c | 38 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index ff76e40..0ca939e 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -333,7 +333,8 @@ static void ftgmac100_start_hw(struct ftgmac100 *priv) maccr |= FTGMAC100_MACCR_HT_MULTI_EN;
/* Vlan filtering enabled */ - if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + priv->netdev->features)) maccr |= FTGMAC100_MACCR_RM_VLAN;
/* Hit the HW */ @@ -517,7 +518,8 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed) * by HW as one of the supported checksummed protocols before * we accept the HW test results. */ - if (netdev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features)) { u32 err_bits = FTGMAC100_RXDES1_TCP_CHKSUM_ERR | FTGMAC100_RXDES1_UDP_CHKSUM_ERR | FTGMAC100_RXDES1_IP_CHKSUM_ERR; @@ -532,7 +534,8 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed) skb_put(skb, size);
/* Extract vlan tag */ - if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features) && (csum_vlan & FTGMAC100_RXDES1_VLANTAG_AVAIL)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), csum_vlan & 0xffff); @@ -1579,17 +1582,19 @@ static int ftgmac100_set_features(struct net_device *netdev, netdev_features_t features) { struct ftgmac100 *priv = netdev_priv(netdev); - netdev_features_t changed = netdev->features ^ features; + netdev_features_t changed;
if (!netif_running(netdev)) return 0;
+ netdev_feature_xor(&changed, netdev->features, features); /* Update the vlan filtering bit */ - if (changed & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { u32 maccr;
maccr = ioread32(priv->base + FTGMAC100_OFFSET_MACCR); - if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + priv->netdev->features)) maccr |= FTGMAC100_MACCR_RM_VLAN; else maccr &= ~FTGMAC100_MACCR_RM_VLAN; @@ -1900,19 +1905,26 @@ static int ftgmac100_probe(struct platform_device *pdev) priv->tx_q_entries = priv->new_tx_q_entries = DEF_TX_QUEUE_ENTRIES;
/* Base feature set */ - netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM | - NETIF_F_GRO | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HW_CSUM | + NETIF_F_GRO | NETIF_F_SG | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX, + &netdev->hw_features);
if (priv->use_ncsi) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->hw_features);
/* 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_feature_clear_bit(NETIF_F_HW_CSUM_BIT, + &netdev->hw_features); if (np && of_get_property(np, "no-hw-checksum", NULL)) - netdev->hw_features &= ~(NETIF_F_HW_CSUM | NETIF_F_RXCSUM); - netdev->features |= netdev->hw_features; + netdev_feature_clear_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM, + &netdev->hw_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features);
/* register network device */ err = register_netdev(netdev);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/google/gve/gve_adminq.c | 6 ++++-- drivers/net/ethernet/google/gve/gve_main.c | 31 ++++++++++++++++------------ drivers/net/ethernet/google/gve/gve_rx.c | 6 +++--- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 8 ++++--- 4 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c index f089d33..e63476b 100644 --- a/drivers/net/ethernet/google/gve/gve_adminq.c +++ b/drivers/net/ethernet/google/gve/gve_adminq.c @@ -542,7 +542,8 @@ static int gve_adminq_create_rx_queue(struct gve_priv *priv, u32 queue_index) cmd.create_rx_queue.rx_buff_ring_size = cpu_to_be16(priv->options_dqo_rda.rx_buff_ring_entries); cmd.create_rx_queue.enable_rsc = - !!(priv->dev->features & NETIF_F_LRO); + netdev_feature_test_bit(NETIF_F_LRO_BIT, + priv->dev->features); }
return gve_adminq_issue_cmd(priv, &cmd); @@ -717,7 +718,8 @@ int gve_adminq_describe_device(struct gve_priv *priv) err = gve_set_desc_cnt(priv, descriptor); } else { /* DQO supports LRO. */ - priv->dev->hw_features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, + &priv->dev->hw_features); err = gve_set_desc_cnt_dqo(priv, descriptor, dev_op_dqo_rda); } if (err) diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 099a2bc..9baa48f 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -1113,12 +1113,16 @@ static void gve_tx_timeout(struct net_device *dev, unsigned int txqueue) static int gve_set_features(struct net_device *netdev, netdev_features_t features) { - const netdev_features_t orig_features = netdev->features; struct gve_priv *priv = netdev_priv(netdev); + netdev_features_t orig_features; int err;
- if ((netdev->features & NETIF_F_LRO) != (features & NETIF_F_LRO)) { - netdev->features ^= NETIF_F_LRO; + netdev_feature_copy(&orig_features, netdev->features); + + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) != + netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { + netdev_feature_change_bit(NETIF_F_LRO_BIT, &netdev->features); + if (netif_carrier_ok(netdev)) { /* To make this process as simple as possible we * teardown the device, set the new configuration, @@ -1140,7 +1144,7 @@ static int gve_set_features(struct net_device *netdev, return 0; err: /* Reverts the change on error. */ - netdev->features = orig_features; + netdev_feature_copy(&netdev->features, orig_features); netif_err(priv, drv, netdev, "Set features failed! !!! DISABLING ALL QUEUES !!!\n"); return err; @@ -1518,15 +1522,16 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * Features might be set in other locations as well (such as * `gve_adminq_describe_device`). */ - dev->hw_features = NETIF_F_HIGHDMA; - dev->hw_features |= NETIF_F_SG; - dev->hw_features |= NETIF_F_HW_CSUM; - dev->hw_features |= NETIF_F_TSO; - dev->hw_features |= NETIF_F_TSO6; - dev->hw_features |= NETIF_F_TSO_ECN; - dev->hw_features |= NETIF_F_RXCSUM; - dev->hw_features |= NETIF_F_RXHASH; - dev->features = dev->hw_features; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features); dev->watchdog_timeo = 5 * HZ; dev->min_mtu = ETH_MIN_MTU; netif_carrier_off(dev); diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c index bb82613..d76e89a 100644 --- a/drivers/net/ethernet/google/gve/gve_rx.c +++ b/drivers/net/ethernet/google/gve/gve_rx.c @@ -428,7 +428,7 @@ static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc, return false; }
- if (likely(feat & NETIF_F_RXCSUM)) { + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, feat))) { /* NIC passes up the partial sum */ if (rx_desc->csum) skb->ip_summed = CHECKSUM_COMPLETE; @@ -438,7 +438,7 @@ static bool gve_rx(struct gve_rx_ring *rx, struct gve_rx_desc *rx_desc, }
/* parse flags & pass relevant info up */ - if (likely(feat & NETIF_F_RXHASH) && + if (likely(netdev_feature_test_bit(NETIF_F_RXHASH_BIT, feat)) && gve_needs_rss(rx_desc->flags_seq)) skb_set_hash(skb, be32_to_cpu(rx_desc->rss_hash), gve_rss_type(rx_desc->flags_seq)); @@ -591,7 +591,7 @@ bool gve_rx_poll(struct gve_notify_block *block, int budget) netdev_features_t feat; bool repoll = false;
- feat = block->napi.dev->features; + netdev_feature_copy(&feat, block->napi.dev->features);
/* If budget is 0, do all the work */ if (budget == 0) diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c index 8500621..8e55d11 100644 --- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c +++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c @@ -637,10 +637,10 @@ static int gve_rx_complete_skb(struct gve_rx_ring *rx, struct napi_struct *napi,
skb_record_rx_queue(rx->skb_head, rx->q_num);
- if (feat & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, feat)) gve_rx_skb_hash(rx->skb_head, desc, ptype);
- if (feat & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, feat)) gve_rx_skb_csum(rx->skb_head, desc, ptype);
/* RSC packets must set gso_size otherwise the TCP stack will complain @@ -663,7 +663,7 @@ static int gve_rx_complete_skb(struct gve_rx_ring *rx, struct napi_struct *napi, int gve_rx_poll_dqo(struct gve_notify_block *block, int budget) { struct napi_struct *napi = &block->napi; - netdev_features_t feat = napi->dev->features; + netdev_features_t feat;
struct gve_rx_ring *rx = block->rx; struct gve_rx_compl_queue_dqo *complq = &rx->dqo.complq; @@ -672,6 +672,8 @@ int gve_rx_poll_dqo(struct gve_notify_block *block, int budget) u64 bytes = 0; int err;
+ netdev_feature_copy(&feat, napi->dev->features); + while (work_done < budget) { struct gve_rx_compl_desc_dqo *compl_desc = &complq->desc_ring[complq->head];
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_main.c | 74 ++++++++++++++++---------- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 5 +- 2 files changed, 50 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 0be4559..244f265 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -894,9 +894,9 @@ static void hinic_fix_features(struct net_device *netdev, struct hinic_dev *nic_dev = netdev_priv(netdev);
/* If Rx checksum is disabled, then LRO should also be disabled */ - if (!(*features & NETIF_F_RXCSUM)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n"); - *features &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } }
@@ -941,19 +941,25 @@ static const struct net_device_ops hinicvf_netdev_ops = {
static void netdev_features_init(struct net_device *netdev) { - netdev->hw_features = NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_RXCSUM | NETIF_F_LRO | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM;
- netdev->vlan_features = netdev->hw_features; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_RXCSUM | NETIF_F_LRO | + NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, + &netdev->hw_features);
- netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_copy(&netdev->vlan_features, netdev->hw_features);
- netdev->hw_enc_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | - NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | - NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, &netdev->features); + + netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | + NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | + NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL, + &netdev->hw_enc_features); }
static void hinic_refresh_nic_cfg(struct hinic_dev *nic_dev) @@ -1073,52 +1079,66 @@ static int set_features(struct hinic_dev *nic_dev, netdev_features_t pre_features, netdev_features_t features, bool force_change) { - netdev_features_t changed = force_change ? ~0 : pre_features ^ features; u32 csum_en = HINIC_RX_CSUM_OFFLOAD_EN; - netdev_features_t failed_features = 0; + netdev_features_t failed_features; + netdev_features_t changed; int ret = 0; int err = 0;
- if (changed & NETIF_F_TSO) { - ret = hinic_port_set_tso(nic_dev, (features & NETIF_F_TSO) ? + if (force_change) + netdev_feature_fill(&changed); + else + netdev_feature_xor(&changed, pre_features, features); + + netdev_feature_zero(&failed_features); + + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, changed)) { + ret = hinic_port_set_tso(nic_dev, + netdev_feature_test_bit(NETIF_F_TSO_BIT, + features) ? HINIC_TSO_ENABLE : HINIC_TSO_DISABLE); if (ret) { err = ret; - failed_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &failed_features); } }
- if (changed & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { ret = hinic_set_rx_csum_offload(nic_dev, csum_en); if (ret) { err = ret; - failed_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &failed_features); } }
- if (changed & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) { ret = hinic_set_rx_lro_state(nic_dev, - !!(features & NETIF_F_LRO), + netdev_feature_test_bit(NETIF_F_LRO_BIT, + features), HINIC_LRO_RX_TIMER_DEFAULT, HINIC_LRO_MAX_WQE_NUM_DEFAULT); if (ret) { err = ret; - failed_features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, + &failed_features); } }
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { ret = hinic_set_rx_vlan_offload(nic_dev, - !!(features & - NETIF_F_HW_VLAN_CTAG_RX)); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)); if (ret) { err = ret; - failed_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &failed_features); } }
if (err) { - nic_dev->netdev->features = features ^ failed_features; + netdev_feature_xor(&nic_dev->netdev->features, features, failed_features); return -EIO; }
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c index fed3b6b..1e07978 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -106,7 +106,7 @@ static void rx_csum(struct hinic_rxq *rxq, u32 status,
csum_err = HINIC_RQ_CQE_STATUS_GET(status, CSUM_ERR);
- if (!(netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features)) return;
if (!csum_err) { @@ -411,7 +411,8 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget)
offload_type = be32_to_cpu(cqe->offload_type); vlan_len = be32_to_cpu(cqe->len); - if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features) && HINIC_GET_RX_VLAN_OFFLOAD_EN(offload_type)) { vid = HINIC_GET_RX_VLAN_TAG(vlan_len); __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/ibm/ehea/ehea_main.c | 22 ++++++---- drivers/net/ethernet/ibm/emac/core.c | 7 +++- drivers/net/ethernet/ibm/ibmveth.c | 70 +++++++++++++++++++------------ drivers/net/ethernet/ibm/ibmvnic.c | 60 ++++++++++++++++---------- 4 files changed, 102 insertions(+), 57 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index d5df131..b7ca1c6 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c @@ -2991,14 +2991,20 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, dev->netdev_ops = &ehea_netdev_ops; ehea_set_ethtool_ops(dev);
- dev->hw_features = NETIF_F_SG | NETIF_F_TSO | - NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX; - dev->features = NETIF_F_SG | NETIF_F_TSO | - NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM; - dev->vlan_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | - NETIF_F_IP_CSUM; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | + NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX, + &dev->hw_features); + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | + NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM, + &dev->features); + netdev_feature_zero(&dev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | + NETIF_F_IP_CSUM, &dev->hw_features); dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
/* MTU range: 68 - 9022 */ diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 664a91a..ff175e7 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3170,8 +3170,11 @@ static int emac_probe(struct platform_device *ofdev) goto err_detach_tah;
if (dev->tah_dev) { - ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG; - ndev->features |= ndev->hw_features | NETIF_F_RXCSUM; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, + &ndev->hw_features); + netdev_feature_copy(&ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); } ndev->watchdog_timeo = 5 * HZ; if (emac_phy_supports_gige(dev->phy_mode)) { diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 1afffce..7b9246d 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -761,8 +761,8 @@ static void ibmveth_fix_features(struct net_device *dev, * checksummed. */
- if (!(*features & NETIF_F_RXCSUM)) - *features &= ~NETIF_F_CSUM_MASK; + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features); }
static int ibmveth_set_csum_offload(struct net_device *dev, u32 data) @@ -810,7 +810,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_feature_clear_bit(NETIF_F_IP_CSUM_BIT, + &dev->features);
} else { adapter->fw_ipv4_csum_support = data; @@ -828,7 +829,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_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, + &dev->features);
} else adapter->fw_ipv6_csum_support = data; @@ -888,7 +890,9 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) set_attr, clr_attr, &ret_attr);
if (data == 1) - dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_TSO | + NETIF_F_TSO6, + &dev->features); rc1 = -EIO;
} else { @@ -900,7 +904,8 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) * support tcp6/ipv6 */ if (data == 1) { - dev->features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, + &dev->features); netdev_info(dev, "TSO feature requires all partitions to have updated driver"); } adapter->large_send = data; @@ -916,23 +921,32 @@ static int ibmveth_set_features(struct net_device *dev, netdev_features_t features) { struct ibmveth_adapter *adapter = netdev_priv(dev); - int rx_csum = !!(features & NETIF_F_RXCSUM); - int large_send = !!(features & (NETIF_F_TSO | NETIF_F_TSO6)); int rc1 = 0, rc2 = 0; + int large_send; + int rx_csum; + + rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features); + large_send = netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, + features);
if (rx_csum != adapter->rx_csum) { rc1 = ibmveth_set_csum_offload(dev, rx_csum); - if (rc1 && !adapter->rx_csum) - dev->features = - features & ~(NETIF_F_CSUM_MASK | - NETIF_F_RXCSUM); + if (rc1 && !adapter->rx_csum) { + netdev_feature_copy(&dev->features, features); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | + NETIF_F_RXCSUM, + &dev->features); + } }
if (large_send != adapter->large_send) { rc2 = ibmveth_set_tso(dev, large_send); - if (rc2 && !adapter->large_send) - dev->features = - features & ~(NETIF_F_TSO | NETIF_F_TSO6); + if (rc2 && !adapter->large_send) { + netdev_feature_copy(&dev->features, features); + netdev_feature_clear_bits(NETIF_F_TSO | + NETIF_F_TSO6, + &dev->features); + } }
return rc1 ? rc1 : rc2; @@ -1696,30 +1710,34 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) netdev->netdev_ops = &ibmveth_netdev_ops; netdev->ethtool_ops = &netdev_ethtool_ops; SET_NETDEV_DEV(netdev, &dev->dev); - netdev->hw_features = NETIF_F_SG; - if (vio_get_attribute(dev, "ibm,illan-options", NULL) != NULL) { - netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; - } + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + if (vio_get_attribute(dev, "ibm,illan-options", NULL) != NULL) + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, &netdev->hw_features);
- netdev->features |= netdev->hw_features; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features);
ret = h_illan_attributes(adapter->vdev->unit_address, 0, 0, &ret_attr);
/* If running older firmware, TSO should not be enabled by default */ if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_LRG_SND_SUPPORT) && !old_large_send) { - netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; - netdev->features |= netdev->hw_features; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &netdev->hw_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); } else { - netdev->hw_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); }
adapter->is_active_trunk = false; if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_ACTIVE_TRUNK)) { adapter->is_active_trunk = true; - netdev->hw_features |= NETIF_F_FRAGLIST; - netdev->features |= NETIF_F_FRAGLIST; + netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, &netdev->features); }
netdev->min_mtu = IBMVETH_MIN_MTU; diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index e3a07c96..5bf74aa 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2823,7 +2823,7 @@ static void ibmvnic_features_check(struct sk_buff *skb, struct net_device *dev, if (skb_is_gso(skb)) { if (skb_shinfo(skb)->gso_size < 224 || skb_shinfo(skb)->gso_segs == 1) - *features &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); } }
@@ -4321,7 +4321,7 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) struct ibmvnic_control_ip_offload_buffer *ctrl_buf = &adapter->ip_offload_ctrl; struct ibmvnic_query_ip_offload_buffer *buf = &adapter->ip_offload_buf; struct device *dev = &adapter->vdev->dev; - netdev_features_t old_hw_features = 0; + netdev_features_t old_hw_features; union ibmvnic_crq crq;
adapter->ip_offload_ctrl_tok = @@ -4351,39 +4351,56 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) ctrl_buf->large_rx_ipv6 = 0;
if (adapter->state != VNIC_PROBING) { - old_hw_features = adapter->netdev->hw_features; - adapter->netdev->hw_features = 0; + netdev_feature_copy(&old_hw_features, + adapter->netdev->hw_features); + netdev_feature_zero(&adapter->netdev->hw_features); }
- adapter->netdev->hw_features = NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO, + &adapter->netdev->hw_features);
if (buf->tcp_ipv4_chksum || buf->udp_ipv4_chksum) - adapter->netdev->hw_features |= NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, + &adapter->netdev->hw_features);
if (buf->tcp_ipv6_chksum || buf->udp_ipv6_chksum) - adapter->netdev->hw_features |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, + &adapter->netdev->hw_features);
- if ((adapter->netdev->features & - (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))) - adapter->netdev->hw_features |= NETIF_F_RXCSUM; + if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + adapter->netdev->features)) + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &adapter->netdev->hw_features);
if (buf->large_tx_ipv4) - adapter->netdev->hw_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &adapter->netdev->hw_features); if (buf->large_tx_ipv6) - adapter->netdev->hw_features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &adapter->netdev->hw_features);
if (adapter->state == VNIC_PROBING) { - adapter->netdev->features |= adapter->netdev->hw_features; - } else if (old_hw_features != adapter->netdev->hw_features) { - netdev_features_t tmp = 0; + netdev_feature_or(&adapter->netdev->features, + adapter->netdev->features, + adapter->netdev->hw_features); + } else if (!netdev_feature_equal(old_hw_features, + adapter->netdev->hw_features)) { + netdev_features_t tmp; + + netdev_feature_zero(&tmp);
/* disable features no longer supported */ - adapter->netdev->features &= adapter->netdev->hw_features; + netdev_feature_and(&adapter->netdev->features, + adapter->netdev->features, + adapter->netdev->hw_features); /* turn on features now supported if previously enabled */ - tmp = (old_hw_features ^ adapter->netdev->hw_features) & - adapter->netdev->hw_features; - adapter->netdev->features |= - tmp & adapter->netdev->wanted_features; + netdev_feature_xor(&tmp, old_hw_features, + adapter->netdev->hw_features); + netdev_feature_and(&tmp, tmp, adapter->netdev->hw_features); + netdev_feature_and(&tmp, tmp, + adapter->netdev->wanted_features); + netdev_feature_or(&adapter->netdev->features, + adapter->netdev->features, tmp); }
memset(&crq, 0, sizeof(crq)); @@ -4881,7 +4898,8 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq, adapter->vlan_header_insertion = be64_to_cpu(crq->query_capability.number); if (adapter->vlan_header_insertion) - netdev->features |= NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, + &netdev->features); netdev_dbg(netdev, "vlan_header_insertion = %lld\n", adapter->vlan_header_insertion); break;
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/ibm/ehea/ehea_main.c | 22 ++++++---- drivers/net/ethernet/ibm/emac/core.c | 7 +++- drivers/net/ethernet/ibm/ibmveth.c | 70 +++++++++++++++++++------------ drivers/net/ethernet/ibm/ibmvnic.c | 60 ++++++++++++++++---------- 4 files changed, 102 insertions(+), 57 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index d5df131..b7ca1c6 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c @@ -2991,14 +2991,20 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, dev->netdev_ops = &ehea_netdev_ops; ehea_set_ethtool_ops(dev);
- dev->hw_features = NETIF_F_SG | NETIF_F_TSO |
NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX;
- dev->features = NETIF_F_SG | NETIF_F_TSO |
NETIF_F_HIGHDMA | NETIF_F_IP_CSUM |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM;
- dev->vlan_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA |
NETIF_F_IP_CSUM;
netdev_feature_zero(&dev->hw_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO |
NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX,
&dev->hw_features);
netdev_feature_zero(&dev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO |
NETIF_F_HIGHDMA | NETIF_F_IP_CSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM,
&dev->features);
netdev_feature_zero(&dev->vlan_features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA |
NETIF_F_IP_CSUM, &dev->hw_features);
dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
/* MTU range: 68 - 9022 */
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 664a91a..ff175e7 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3170,8 +3170,11 @@ static int emac_probe(struct platform_device *ofdev) goto err_detach_tah;
if (dev->tah_dev) {
ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG;
ndev->features |= ndev->hw_features | NETIF_F_RXCSUM;
netdev_feature_zero(&ndev->hw_features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG,
&ndev->hw_features);
netdev_feature_copy(&ndev->features, ndev->hw_features);
} ndev->watchdog_timeo = 5 * HZ; if (emac_phy_supports_gige(dev->phy_mode)) {netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features);
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 1afffce..7b9246d 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -761,8 +761,8 @@ static void ibmveth_fix_features(struct net_device *dev, * checksummed. */
- if (!(*features & NETIF_F_RXCSUM))
*features &= ~NETIF_F_CSUM_MASK;
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features))
netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
}
static int ibmveth_set_csum_offload(struct net_device *dev, u32 data)
@@ -810,7 +810,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_feature_clear_bit(NETIF_F_IP_CSUM_BIT,
&dev->features);
} else { adapter->fw_ipv4_csum_support = data;
@@ -828,7 +829,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_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT,
&dev->features);
} else adapter->fw_ipv6_csum_support = data;
@@ -888,7 +890,9 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) set_attr, clr_attr, &ret_attr);
if (data == 1)
dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
netdev_feature_clear_bits(NETIF_F_TSO |
NETIF_F_TSO6,
&dev->features); rc1 = -EIO;
} else {
@@ -900,7 +904,8 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) * support tcp6/ipv6 */ if (data == 1) {
dev->features &= ~NETIF_F_TSO6;
netdev_feature_clear_bit(NETIF_F_TSO6_BIT,
} adapter->large_send = data;&dev->features); netdev_info(dev, "TSO feature requires all partitions to have updated driver");
@@ -916,23 +921,32 @@ static int ibmveth_set_features(struct net_device *dev, netdev_features_t features) { struct ibmveth_adapter *adapter = netdev_priv(dev);
- int rx_csum = !!(features & NETIF_F_RXCSUM);
- int large_send = !!(features & (NETIF_F_TSO | NETIF_F_TSO6)); int rc1 = 0, rc2 = 0;
int large_send;
int rx_csum;
rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features);
large_send = netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6,
features);
if (rx_csum != adapter->rx_csum) { rc1 = ibmveth_set_csum_offload(dev, rx_csum);
if (rc1 && !adapter->rx_csum)
dev->features =
features & ~(NETIF_F_CSUM_MASK |
NETIF_F_RXCSUM);
if (rc1 && !adapter->rx_csum) {
netdev_feature_copy(&dev->features, features);
netdev_feature_clear_bits(NETIF_F_CSUM_MASK |
NETIF_F_RXCSUM,
&dev->features);
}
}
if (large_send != adapter->large_send) { rc2 = ibmveth_set_tso(dev, large_send);
if (rc2 && !adapter->large_send)
dev->features =
features & ~(NETIF_F_TSO | NETIF_F_TSO6);
if (rc2 && !adapter->large_send) {
netdev_feature_copy(&dev->features, features);
netdev_feature_clear_bits(NETIF_F_TSO |
NETIF_F_TSO6,
&dev->features);
}
}
return rc1 ? rc1 : rc2;
@@ -1696,30 +1710,34 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) netdev->netdev_ops = &ibmveth_netdev_ops; netdev->ethtool_ops = &netdev_ethtool_ops; SET_NETDEV_DEV(netdev, &dev->dev);
- netdev->hw_features = NETIF_F_SG;
- if (vio_get_attribute(dev, "ibm,illan-options", NULL) != NULL) {
netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM;
- }
- netdev_feature_zero(&netdev->hw_features);
- netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features);
- if (vio_get_attribute(dev, "ibm,illan-options", NULL) != NULL)
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM, &netdev->hw_features);
- netdev->features |= netdev->hw_features;
netdev_feature_or(&netdev->features, netdev->features,
netdev->hw_features);
ret = h_illan_attributes(adapter->vdev->unit_address, 0, 0, &ret_attr);
/* If running older firmware, TSO should not be enabled by default */ if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_LRG_SND_SUPPORT) && !old_large_send) {
netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
netdev->features |= netdev->hw_features;
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6,
&netdev->hw_features);
netdev_feature_or(&netdev->features, netdev->features,
} else {netdev->hw_features);
netdev->hw_features |= NETIF_F_TSO;
netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features);
}
adapter->is_active_trunk = false; if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_ACTIVE_TRUNK)) { adapter->is_active_trunk = true;
netdev->hw_features |= NETIF_F_FRAGLIST;
netdev->features |= NETIF_F_FRAGLIST;
netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT,
&netdev->hw_features);
netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, &netdev->features);
}
netdev->min_mtu = IBMVETH_MIN_MTU;
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index e3a07c96..5bf74aa 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2823,7 +2823,7 @@ static void ibmvnic_features_check(struct sk_buff *skb, struct net_device *dev, if (skb_is_gso(skb)) { if (skb_shinfo(skb)->gso_size < 224 || skb_shinfo(skb)->gso_segs == 1)
*features &= ~NETIF_F_GSO_MASK;
} }netdev_feature_clear_bits(NETIF_F_GSO_MASK, features);
@@ -4321,7 +4321,7 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) struct ibmvnic_control_ip_offload_buffer *ctrl_buf = &adapter->ip_offload_ctrl; struct ibmvnic_query_ip_offload_buffer *buf = &adapter->ip_offload_buf; struct device *dev = &adapter->vdev->dev;
- netdev_features_t old_hw_features = 0;
- netdev_features_t old_hw_features; union ibmvnic_crq crq;
forgot to call initialize "old_hw_features", will fix it in next version
adapter->ip_offload_ctrl_tok = @@ -4351,39 +4351,56 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) ctrl_buf->large_rx_ipv6 = 0;
if (adapter->state != VNIC_PROBING) {
old_hw_features = adapter->netdev->hw_features;
adapter->netdev->hw_features = 0;
netdev_feature_copy(&old_hw_features,
adapter->netdev->hw_features);
}netdev_feature_zero(&adapter->netdev->hw_features);
- adapter->netdev->hw_features = NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO;
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO,
&adapter->netdev->hw_features);
if (buf->tcp_ipv4_chksum || buf->udp_ipv4_chksum)
adapter->netdev->hw_features |= NETIF_F_IP_CSUM;
netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT,
&adapter->netdev->hw_features);
if (buf->tcp_ipv6_chksum || buf->udp_ipv6_chksum)
adapter->netdev->hw_features |= NETIF_F_IPV6_CSUM;
netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT,
&adapter->netdev->hw_features);
- if ((adapter->netdev->features &
(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)))
adapter->netdev->hw_features |= NETIF_F_RXCSUM;
if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
adapter->netdev->features))
netdev_feature_set_bit(NETIF_F_RXCSUM_BIT,
&adapter->netdev->hw_features);
if (buf->large_tx_ipv4)
adapter->netdev->hw_features |= NETIF_F_TSO;
netdev_feature_set_bit(NETIF_F_TSO_BIT,
if (buf->large_tx_ipv6)&adapter->netdev->hw_features);
adapter->netdev->hw_features |= NETIF_F_TSO6;
netdev_feature_set_bit(NETIF_F_TSO6_BIT,
&adapter->netdev->hw_features);
if (adapter->state == VNIC_PROBING) {
adapter->netdev->features |= adapter->netdev->hw_features;
- } else if (old_hw_features != adapter->netdev->hw_features) {
netdev_features_t tmp = 0;
netdev_feature_or(&adapter->netdev->features,
adapter->netdev->features,
adapter->netdev->hw_features);
} else if (!netdev_feature_equal(old_hw_features,
adapter->netdev->hw_features)) {
netdev_features_t tmp;
netdev_feature_zero(&tmp);
/* disable features no longer supported */
adapter->netdev->features &= adapter->netdev->hw_features;
netdev_feature_and(&adapter->netdev->features,
adapter->netdev->features,
/* turn on features now supported if previously enabled */adapter->netdev->hw_features);
tmp = (old_hw_features ^ adapter->netdev->hw_features) &
adapter->netdev->hw_features;
adapter->netdev->features |=
tmp & adapter->netdev->wanted_features;
netdev_feature_xor(&tmp, old_hw_features,
adapter->netdev->hw_features);
netdev_feature_and(&tmp, tmp, adapter->netdev->hw_features);
netdev_feature_and(&tmp, tmp,
adapter->netdev->wanted_features);
netdev_feature_or(&adapter->netdev->features,
adapter->netdev->features, tmp);
}
memset(&crq, 0, sizeof(crq));
@@ -4881,7 +4898,8 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq, adapter->vlan_header_insertion = be64_to_cpu(crq->query_capability.number); if (adapter->vlan_header_insertion)
netdev->features |= NETIF_F_HW_VLAN_STAG_TX;
netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT,
netdev_dbg(netdev, "vlan_header_insertion = %lld\n", adapter->vlan_header_insertion); break;&netdev->features);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 123 ++++++++++++++--------- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 9 +- 2 files changed, 79 insertions(+), 53 deletions(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index f52c47a..1b2094d 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1478,37 +1478,37 @@ static __le64 ionic_netdev_features_to_nic(netdev_features_t features) { u64 wanted = 0;
- if (features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) wanted |= IONIC_ETH_HW_VLAN_TX_TAG; - if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) wanted |= IONIC_ETH_HW_VLAN_RX_STRIP; - if (features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) wanted |= IONIC_ETH_HW_VLAN_RX_FILTER; - if (features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features)) wanted |= IONIC_ETH_HW_RX_HASH; - if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) wanted |= IONIC_ETH_HW_RX_CSUM; - if (features & NETIF_F_SG) + if (netdev_feature_test_bit(NETIF_F_SG_BIT, features)) wanted |= IONIC_ETH_HW_TX_SG; - if (features & NETIF_F_HW_CSUM) + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features)) wanted |= IONIC_ETH_HW_TX_CSUM; - if (features & NETIF_F_TSO) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, features)) wanted |= IONIC_ETH_HW_TSO; - if (features & NETIF_F_TSO6) + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, features)) wanted |= IONIC_ETH_HW_TSO_IPV6; - if (features & NETIF_F_TSO_ECN) + if (netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, features)) wanted |= IONIC_ETH_HW_TSO_ECN; - if (features & NETIF_F_GSO_GRE) + if (netdev_feature_test_bit(NETIF_F_GSO_GRE_BIT, features)) wanted |= IONIC_ETH_HW_TSO_GRE; - if (features & NETIF_F_GSO_GRE_CSUM) + if (netdev_feature_test_bit(NETIF_F_GSO_GRE_CSUM_BIT, features)) wanted |= IONIC_ETH_HW_TSO_GRE_CSUM; - if (features & NETIF_F_GSO_IPXIP4) + if (netdev_feature_test_bit(NETIF_F_GSO_IPXIP4_BIT, features)) wanted |= IONIC_ETH_HW_TSO_IPXIP4; - if (features & NETIF_F_GSO_IPXIP6) + if (netdev_feature_test_bit(NETIF_F_GSO_IPXIP6_BIT, features)) wanted |= IONIC_ETH_HW_TSO_IPXIP6; - if (features & NETIF_F_GSO_UDP_TUNNEL) + if (netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, features)) wanted |= IONIC_ETH_HW_TSO_UDP; - if (features & NETIF_F_GSO_UDP_TUNNEL_CSUM) + if (netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, features)) wanted |= IONIC_ETH_HW_TSO_UDP_CSUM;
return cpu_to_le64(wanted); @@ -1548,7 +1548,7 @@ static int ionic_set_nic_features(struct ionic_lif *lif, if ((old_hw_features ^ lif->hw_features) & IONIC_ETH_HW_RX_HASH) ionic_lif_rss_config(lif, lif->rss_types, NULL, NULL);
- if ((vlan_flags & features) && + if (netdev_feature_test_bits(vlan_flags, features) && !(vlan_flags & le64_to_cpu(ctx.comp.lif_setattr.features))) dev_info_once(lif->ionic->dev, "NIC is not supporting vlan offload, likely in SmartNIC mode\n");
@@ -1597,63 +1597,85 @@ static int ionic_init_nic_features(struct ionic_lif *lif) int err;
/* set up what we expect to support by default */ - features = NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_SG | - NETIF_F_HW_CSUM | - NETIF_F_RXCSUM | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_TSO_ECN; + netdev_feature_zero(&features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_SG | + NETIF_F_HW_CSUM | + NETIF_F_RXCSUM | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_TSO_ECN, + &features);
if (lif->nxqs > 1) - features |= NETIF_F_RXHASH; + netdev_feature_set_bits(NETIF_F_RXHASH_BIT, &features);
err = ionic_set_nic_features(lif, features); if (err) return err;
/* tell the netdev what we actually can support */ - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
if (lif->hw_features & IONIC_ETH_HW_VLAN_TX_TAG) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_VLAN_RX_STRIP) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_VLAN_RX_FILTER) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_RX_HASH) - netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, + &netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_TX_SG) - netdev->hw_features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features);
if (lif->hw_features & IONIC_ETH_HW_TX_CSUM) - netdev->hw_enc_features |= NETIF_F_HW_CSUM; + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_RX_CSUM) - netdev->hw_enc_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO) - netdev->hw_enc_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPV6) - netdev->hw_enc_features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_ECN) - netdev->hw_enc_features |= NETIF_F_TSO_ECN; + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_GRE) - netdev->hw_enc_features |= NETIF_F_GSO_GRE; + netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_GRE_CSUM) - netdev->hw_enc_features |= NETIF_F_GSO_GRE_CSUM; + netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPXIP4) - netdev->hw_enc_features |= NETIF_F_GSO_IPXIP4; + netdev_feature_set_bit(NETIF_F_GSO_IPXIP4_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPXIP6) - netdev->hw_enc_features |= NETIF_F_GSO_IPXIP6; + netdev_feature_set_bit(NETIF_F_GSO_IPXIP6_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_UDP) - netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_UDP_CSUM) - netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; - - netdev->hw_features |= netdev->hw_enc_features; - netdev->features |= netdev->hw_features; - netdev->vlan_features |= netdev->features & ~NETIF_F_VLAN_FEATURES; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, + &netdev->hw_enc_features); + + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->hw_enc_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_clear_bits(NETIF_F_VLAN_FEATURES, + &netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE; @@ -2104,7 +2126,7 @@ static int ionic_txrx_init(struct ionic_lif *lif) } }
- if (lif->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, lif->netdev->features)) ionic_lif_rss_init(lif);
ionic_set_rx_mode(lif->netdev, CAN_SLEEP); @@ -3059,7 +3081,8 @@ void ionic_lif_deinit(struct ionic_lif *lif) cancel_work_sync(&lif->deferred.work); cancel_work_sync(&lif->tx_timeout_work); ionic_rx_filters_deinit(lif); - if (lif->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + lif->netdev->features)) ionic_lif_rss_deinit(lif); }
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index 37c3958..8c0cf92 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -252,7 +252,8 @@ static void ionic_rx_clean(struct ionic_queue *q,
skb_record_rx_queue(skb, q->index);
- if (likely(netdev->features & NETIF_F_RXHASH)) { + if (likely(netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + netdev->features))) { switch (comp->pkt_type_color & IONIC_RXQ_COMP_PKT_TYPE_MASK) { case IONIC_PKT_TYPE_IPV4: case IONIC_PKT_TYPE_IPV6: @@ -269,7 +270,8 @@ static void ionic_rx_clean(struct ionic_queue *q, } }
- if (likely(netdev->features & NETIF_F_RXCSUM) && + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features)) && (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC)) { skb->ip_summed = CHECKSUM_COMPLETE; skb->csum = (__force __wsum)le16_to_cpu(comp->csum); @@ -283,7 +285,8 @@ static void ionic_rx_clean(struct ionic_queue *q, (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_IP_BAD))) stats->csum_error++;
- if (likely(netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (likely(netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features)) && (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_VLAN)) { __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), le16_to_cpu(comp->vlan_tci));
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/jme.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 7b8eefd..007e418 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c @@ -715,7 +715,7 @@ jme_set_clean_rxdesc(struct jme_adapter *jme, int i) rxdesc->desc1.bufaddrl = cpu_to_le32( (__u64)rxbi->mapping & 0xFFFFFFFFUL); rxdesc->desc1.datalen = cpu_to_le16(rxbi->len); - if (jme->dev->features & NETIF_F_HIGHDMA) + if (netdev_feature_test_bit(NETIF_F_HIGHDMA_BIT, jme->dev->features)) rxdesc->desc1.flags = RXFLAG_64BIT; wmb(); rxdesc->desc1.flags |= RXFLAG_OWN | RXFLAG_INT; @@ -2019,7 +2019,8 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx) struct jme_ring *txring = &(jme->txring[0]); struct txdesc *txdesc = txring->desc, *ctxdesc; struct jme_buffer_info *txbi = txring->bufinf, *ctxbi; - bool hidma = jme->dev->features & NETIF_F_HIGHDMA; + bool hidma = netdev_feature_test_bit(NETIF_F_HIGHDMA_BIT, + jme->dev->features); int i, nr_frags = skb_shinfo(skb)->nr_frags; int mask = jme->tx_ring_mask; u32 len; @@ -2674,7 +2675,8 @@ static void jme_fix_features(struct net_device *netdev, netdev_features_t *features) { if (netdev->mtu > 1900) - *features &= ~(NETIF_F_ALL_TSO | NETIF_F_CSUM_MASK); + netdev_feature_clear_bits(NETIF_F_ALL_TSO | NETIF_F_CSUM_MASK, + features); }
static int @@ -2683,7 +2685,7 @@ jme_set_features(struct net_device *netdev, netdev_features_t features) struct jme_adapter *jme = netdev_priv(netdev);
spin_lock_bh(&jme->rxmcs_lock); - if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) jme->reg_rxmcs |= RXMCS_CHECKSUM; else jme->reg_rxmcs &= ~RXMCS_CHECKSUM; @@ -2967,21 +2969,25 @@ jme_init_one(struct pci_dev *pdev, netdev->netdev_ops = &jme_netdev_ops; netdev->ethtool_ops = &jme_ethtool_ops; netdev->watchdog_timeo = TX_TIMEOUT; - netdev->hw_features = NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | - NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_RXCSUM; - netdev->features = NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | - NETIF_F_SG | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_RXCSUM, + &netdev->hw_features); + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_SG | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->features); if (using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
/* MTU range: 1280 - 9202*/ netdev->min_mtu = IPV6_MIN_MTU; @@ -3044,7 +3050,7 @@ jme_init_one(struct pci_dev *pdev, jme->reg_gpreg1 = GPREG1_DEFAULT;
if (jme->reg_rxmcs & RXMCS_CHECKSUM) - netdev->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features);
/* * Get Max Read Req Size from PCI Config Space
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/micrel/ksz884x.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index a0ee155..18f50360 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -6504,7 +6504,7 @@ static int netdev_set_features(struct net_device *dev, mutex_lock(&hw_priv->lock);
/* see note in hw_setup() */ - if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) hw->rx_cfg |= DMA_RX_CSUM_TCP | DMA_RX_CSUM_IP; else hw->rx_cfg &= ~(DMA_RX_CSUM_TCP | DMA_RX_CSUM_IP); @@ -6702,15 +6702,17 @@ static int __init netdev_init(struct net_device *dev) /* 500 ms timeout */ dev->watchdog_timeo = HZ / 2;
- dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_RXCSUM; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_RXCSUM, + &dev->hw_features);
/* * Hardware does not really support IPv6 checksum generation, but * driver actually runs faster with this on. */ - dev->hw_features |= NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IPV6_CSUM_BIT, &dev->hw_features);
- dev->features |= dev->hw_features; + netdev_feature_or(&dev->features, dev->features, dev->hw_features);
sema_init(&priv->proc_sem, 1);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/cavium/liquidio/lio_core.c | 6 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 89 +++++++++++++--------- drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 73 +++++++++++------- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 44 ++++++----- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +- 5 files changed, 133 insertions(+), 81 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c index 2a0d64e..70e8361 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_core.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c @@ -660,7 +660,8 @@ liquidio_push_packet(u32 __maybe_unused octeon_id, skb_pull(skb, rh->r_dh.len * BYTES_PER_DHLEN_UNIT); skb->protocol = eth_type_trans(skb, skb->dev);
- if ((netdev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features) && (((rh->r_dh.encap_on) && (rh->r_dh.csum_verified & CNNIC_TUN_CSUM_VERIFIED)) || (!(rh->r_dh.encap_on) && @@ -681,7 +682,8 @@ liquidio_push_packet(u32 __maybe_unused octeon_id, }
/* inbound VLAN tag */ - if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features) && rh->r_dh.vlan) { u16 priority = rh->r_dh.priority; u16 vid = rh->r_dh.vlan; diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 0230a63..a0aa543 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -2721,31 +2721,37 @@ static void liquidio_fix_features(struct net_device *netdev, { struct lio *lio = netdev_priv(netdev);
- if ((*request & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_RXCSUM)) - *request &= ~NETIF_F_RXCSUM; + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if ((*request & NETIF_F_HW_CSUM) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_HW_CSUM)) - *request &= ~NETIF_F_HW_CSUM; + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if ((*request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO)) - *request &= ~NETIF_F_TSO; + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) && + !(lio->dev_capability & NETIF_F_TSO)) + netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if ((*request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6)) - *request &= ~NETIF_F_TSO6; + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) && + !(lio->dev_capability & NETIF_F_TSO6)) + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if ((*request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO)) - *request &= ~NETIF_F_LRO; + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) && + !(lio->dev_capability & NETIF_F_LRO)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/*Disable LRO if RXCSUM is off */ - if (!(*request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO)) - *request &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
- if ((*request & NETIF_F_HW_VLAN_CTAG_FILTER) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + *request) && !(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER)) - *request &= ~NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + request); }
/** @@ -2758,40 +2764,45 @@ static int liquidio_set_features(struct net_device *netdev, { struct lio *lio = netdev_priv(netdev);
- if ((features & NETIF_F_LRO) && + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && (lio->dev_capability & NETIF_F_LRO) && - !(netdev->features & NETIF_F_LRO)) + !netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6); - else if (!(features & NETIF_F_LRO) && + else if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && (lio->dev_capability & NETIF_F_LRO) && - (netdev->features & NETIF_F_LRO)) + netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_DISABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
/* Sending command to firmware to enable/disable RX checksum * offload settings using ethtool */ - if (!(netdev->features & NETIF_F_RXCSUM) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features) && (lio->enc_dev_capability & NETIF_F_RXCSUM) && - (features & NETIF_F_RXCSUM)) + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_ENABLE); - else if ((netdev->features & NETIF_F_RXCSUM) && + else if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features) && (lio->enc_dev_capability & NETIF_F_RXCSUM) && - !(features & NETIF_F_RXCSUM)) + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_DISABLE);
- if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features) && (lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER) && - !(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + !netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_VLAN_FILTER_CTL, OCTNET_CMD_VLAN_FILTER_ENABLE); - else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && + else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features) && (lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER) && - (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_VLAN_FILTER_CTL, OCTNET_CMD_VLAN_FILTER_DISABLE);
@@ -3576,25 +3587,35 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
- netdev->hw_enc_features = (lio->enc_dev_capability & - ~NETIF_F_LRO); + netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_set_bits(lio->enc_dev_capability, + &netdev->hw_enc_features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, + &netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
lio->dev_capability |= NETIF_F_GSO_UDP_TUNNEL;
- netdev->vlan_features = lio->dev_capability; + netdev_feature_zero(&netdev->vlan_features); + netdev_feature_set_bits(lio->dev_capability, + &netdev->vlan_features); /* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
- netdev->features = (lio->dev_capability & ~NETIF_F_LRO); + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(lio->dev_capability, + &netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features);
- netdev->hw_features = lio->dev_capability; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(lio->dev_capability, + &netdev->hw_features); /*HW_VLAN_RX and HW_VLAN_FILTER is always on*/ - netdev->hw_features = netdev->hw_features & - ~NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE; @@ -3662,7 +3683,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) else octeon_dev->priv_flags = 0x0;
- if (netdev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index cec5b9c..e5f242e 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -1820,27 +1820,31 @@ static void liquidio_fix_features(struct net_device *netdev, { struct lio *lio = netdev_priv(netdev);
- if ((*request & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_RXCSUM)) - *request &= ~NETIF_F_RXCSUM; + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if ((*request & NETIF_F_HW_CSUM) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_HW_CSUM)) - *request &= ~NETIF_F_HW_CSUM; + netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, request);
- if ((*request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO)) - *request &= ~NETIF_F_TSO; + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) && + !(lio->dev_capability & NETIF_F_TSO)) + netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if ((*request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6)) - *request &= ~NETIF_F_TSO6; + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) && + !(lio->dev_capability & NETIF_F_TSO6)) + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if ((*request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO)) - *request &= ~NETIF_F_LRO; + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) && + !(lio->dev_capability & NETIF_F_LRO)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/* Disable LRO if RXCSUM is off */ - if (!(*request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO)) - *request &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, request); }
/** \brief Net device set features @@ -1851,25 +1855,29 @@ static int liquidio_set_features(struct net_device *netdev, netdev_features_t features) { struct lio *lio = netdev_priv(netdev); + netdev_features_t changed;
- if (!((netdev->features ^ features) & NETIF_F_LRO)) + netdev_feature_xor(&changed, netdev->features, features); + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) return 0;
- if ((features & NETIF_F_LRO) && (lio->dev_capability & NETIF_F_LRO)) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && + (lio->dev_capability & NETIF_F_LRO)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6); - else if (!(features & NETIF_F_LRO) && + else if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && (lio->dev_capability & NETIF_F_LRO)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_DISABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6); - if (!(netdev->features & NETIF_F_RXCSUM) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features) && (lio->enc_dev_capability & NETIF_F_RXCSUM) && - (features & NETIF_F_RXCSUM)) + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_ENABLE); - else if ((netdev->features & NETIF_F_RXCSUM) && + else if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features) && (lio->enc_dev_capability & NETIF_F_RXCSUM) && - !(features & NETIF_F_RXCSUM)) + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_DISABLE);
@@ -2108,20 +2116,33 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
- netdev->hw_enc_features = - (lio->enc_dev_capability & ~NETIF_F_LRO); + netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_set_bits(lio->enc_dev_capability, + &netdev->hw_enc_features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, + &netdev->hw_enc_features); + netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
- netdev->vlan_features = lio->dev_capability; + netdev_feature_zero(&netdev->vlan_features); + netdev_feature_set_bits(lio->enc_dev_capability, + &netdev->vlan_features); + /* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
- netdev->features = (lio->dev_capability & ~NETIF_F_LRO); + netdev_feature_zero(&netdev->features); + netdev_feature_set_bits(lio->enc_dev_capability, + &netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features);
- netdev->hw_features = lio->dev_capability; - netdev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(lio->enc_dev_capability, + &netdev->hw_features); + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE; @@ -2185,7 +2206,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) else octeon_dev->priv_flags = 0x0;
- if (netdev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 9f736ef..2887d71 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -732,7 +732,7 @@ static inline void nicvf_set_rxhash(struct net_device *netdev, u8 hash_type; u32 hash;
- if (!(netdev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) return;
switch (cqe_rx->rss_alg) { @@ -823,7 +823,7 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev, nicvf_set_rxhash(netdev, cqe_rx, skb);
skb_record_rx_queue(skb, rq_idx); - if (netdev->hw_features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features)) { /* HW by default verifies TCP/UDP/SCTP checksums */ skb->ip_summed = CHECKSUM_UNNECESSARY; } else { @@ -837,7 +837,7 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev, __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs((__force __be16)cqe_rx->vlan_tci));
- if (napi && (netdev->features & NETIF_F_GRO)) + if (napi && netdev_feature_test_bit(NETIF_F_GRO_BIT, netdev->features)) napi_gro_receive(napi, skb); else netif_receive_skb(skb); @@ -1768,7 +1768,8 @@ static int nicvf_config_loopback(struct nicvf *nic,
mbx.lbk.msg = NIC_MBOX_MSG_LOOPBACK; mbx.lbk.vf_id = nic->vf_id; - mbx.lbk.enable = (features & NETIF_F_LOOPBACK) != 0; + mbx.lbk.enable = netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, + features);
return nicvf_send_msg_to_pf(nic, &mbx); } @@ -1778,21 +1779,24 @@ static void nicvf_fix_features(struct net_device *netdev, { struct nicvf *nic = netdev_priv(netdev);
- if ((*features & NETIF_F_LOOPBACK) && + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, *features) && netif_running(netdev) && !nic->loopback_supported) - *features &= ~NETIF_F_LOOPBACK; + netdev_feature_clear_bit(NETIF_F_LOOPBACK_BIT, features); }
static int nicvf_set_features(struct net_device *netdev, netdev_features_t features) { struct nicvf *nic = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) + netdev_feature_xor(&changed, features, netdev->features); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) nicvf_config_vlan_stripping(nic, features);
- if ((changed & NETIF_F_LOOPBACK) && netif_running(netdev)) + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && + netif_running(netdev)) return nicvf_config_loopback(nic, features);
return 0; @@ -2211,18 +2215,22 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_unregister_interrupts;
- netdev->hw_features = (NETIF_F_RXCSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_GRO | NETIF_F_TSO6 | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_HW_VLAN_CTAG_RX); + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_GRO | NETIF_F_TSO6 | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features);
- netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features);
- netdev->features |= netdev->hw_features; - netdev->hw_features |= NETIF_F_LOOPBACK; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &netdev->hw_features);
- netdev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_zero(&netdev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, + &netdev->hw_features);
netdev->netdev_ops = &nicvf_netdev_ops; netdev->watchdog_timeo = NICVF_TX_TIMEOUT; diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 50bbe79..5e95b42 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -714,7 +714,7 @@ void nicvf_config_vlan_stripping(struct nicvf *nic, netdev_features_t features) rq_cfg = nicvf_queue_reg_read(nic, NIC_QSET_RQ_GEN_CFG, 0);
/* Enable first VLAN stripping */ - if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) rq_cfg |= (1ULL << 25); else rq_cfg &= ~(1ULL << 25);
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/cavium/liquidio/lio_core.c | 6 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 89 +++++++++++++--------- drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 73 +++++++++++------- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 44 ++++++----- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +- 5 files changed, 133 insertions(+), 81 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c index 2a0d64e..70e8361 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_core.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c @@ -660,7 +660,8 @@ liquidio_push_packet(u32 __maybe_unused octeon_id, skb_pull(skb, rh->r_dh.len * BYTES_PER_DHLEN_UNIT); skb->protocol = eth_type_trans(skb, skb->dev);
if ((netdev->features & NETIF_F_RXCSUM) &&
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
(((rh->r_dh.encap_on) && (rh->r_dh.csum_verified & CNNIC_TUN_CSUM_VERIFIED)) || (!(rh->r_dh.encap_on) &&netdev->features) &&
@@ -681,7 +682,8 @@ liquidio_push_packet(u32 __maybe_unused octeon_id, }
/* inbound VLAN tag */
if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
rh->r_dh.vlan) { u16 priority = rh->r_dh.priority; u16 vid = rh->r_dh.vlan;netdev->features) &&
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 0230a63..a0aa543 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -2721,31 +2721,37 @@ static void liquidio_fix_features(struct net_device *netdev, { struct lio *lio = netdev_priv(netdev);
- if ((*request & NETIF_F_RXCSUM) &&
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_RXCSUM))
*request &= ~NETIF_F_RXCSUM;
netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if ((*request & NETIF_F_HW_CSUM) &&
- if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_HW_CSUM))
*request &= ~NETIF_F_HW_CSUM;
netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
it should be "NETIF_F_HW_CSUM_BIT", not "NETIF_F_RXCSUM_BIT"
- if ((*request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO))
*request &= ~NETIF_F_TSO;
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) &&
!(lio->dev_capability & NETIF_F_TSO))
netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if ((*request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6))
*request &= ~NETIF_F_TSO6;
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) &&
!(lio->dev_capability & NETIF_F_TSO6))
netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if ((*request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO))
*request &= ~NETIF_F_LRO;
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) &&
!(lio->dev_capability & NETIF_F_LRO))
netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/*Disable LRO if RXCSUM is off */
- if (!(*request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) &&
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) &&
netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO))
*request &= ~NETIF_F_LRO;
netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
- if ((*request & NETIF_F_HW_VLAN_CTAG_FILTER) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
!(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER))*request) &&
*request &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
request);
}
/**
@@ -2758,40 +2764,45 @@ static int liquidio_set_features(struct net_device *netdev, { struct lio *lio = netdev_priv(netdev);
- if ((features & NETIF_F_LRO) &&
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && (lio->dev_capability & NETIF_F_LRO) &&
!(netdev->features & NETIF_F_LRO))
liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);!netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features))
- else if (!(features & NETIF_F_LRO) &&
- else if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && (lio->dev_capability & NETIF_F_LRO) &&
(netdev->features & NETIF_F_LRO))
netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features))
liquidio_set_feature(netdev, OCTNET_CMD_LRO_DISABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
/* Sending command to firmware to enable/disable RX checksum
- offload settings using ethtool
*/
- if (!(netdev->features & NETIF_F_RXCSUM) &&
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features) && (lio->enc_dev_capability & NETIF_F_RXCSUM) &&
(features & NETIF_F_RXCSUM))
liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_ENABLE);netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features))
- else if ((netdev->features & NETIF_F_RXCSUM) &&
- else if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
(lio->enc_dev_capability & NETIF_F_RXCSUM) &&netdev->features) &&
!(features & NETIF_F_RXCSUM))
liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_DISABLE);!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features))
- if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER) &&features) &&
!(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
liquidio_set_feature(netdev, OCTNET_CMD_VLAN_FILTER_CTL, OCTNET_CMD_VLAN_FILTER_ENABLE);netdev->features))
- else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) &&
- else if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER) &&features) &&
(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT,
liquidio_set_feature(netdev, OCTNET_CMD_VLAN_FILTER_CTL, OCTNET_CMD_VLAN_FILTER_DISABLE);netdev->features))
@@ -3576,25 +3587,35 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
netdev->hw_enc_features = (lio->enc_dev_capability &
~NETIF_F_LRO);
netdev_feature_zero(&netdev->hw_enc_features);
netdev_feature_set_bits(lio->enc_dev_capability,
&netdev->hw_enc_features);
netdev_feature_clear_bit(NETIF_F_LRO_BIT,
&netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
lio->dev_capability |= NETIF_F_GSO_UDP_TUNNEL;
netdev->vlan_features = lio->dev_capability;
netdev_feature_zero(&netdev->vlan_features);
netdev_feature_set_bits(lio->dev_capability,
/* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;&netdev->vlan_features);
netdev->features = (lio->dev_capability & ~NETIF_F_LRO);
netdev_feature_zero(&netdev->features);
netdev_feature_set_bits(lio->dev_capability,
&netdev->features);
netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features);
netdev->hw_features = lio->dev_capability;
netdev_feature_zero(&netdev->hw_features);
netdev_feature_set_bits(lio->dev_capability,
/*HW_VLAN_RX and HW_VLAN_FILTER is always on*/&netdev->hw_features);
netdev->hw_features = netdev->hw_features &
~NETIF_F_HW_VLAN_CTAG_RX;
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
&netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE;
@@ -3662,7 +3683,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) else octeon_dev->priv_flags = 0x0;
if (netdev->features & NETIF_F_LRO)
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index cec5b9c..e5f242e 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -1820,27 +1820,31 @@ static void liquidio_fix_features(struct net_device *netdev, { struct lio *lio = netdev_priv(netdev);
- if ((*request & NETIF_F_RXCSUM) &&
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_RXCSUM))
*request &= ~NETIF_F_RXCSUM;
netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if ((*request & NETIF_F_HW_CSUM) &&
- if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && !(lio->dev_capability & NETIF_F_HW_CSUM))
*request &= ~NETIF_F_HW_CSUM;
netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, request);
- if ((*request & NETIF_F_TSO) && !(lio->dev_capability & NETIF_F_TSO))
*request &= ~NETIF_F_TSO;
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) &&
!(lio->dev_capability & NETIF_F_TSO))
netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if ((*request & NETIF_F_TSO6) && !(lio->dev_capability & NETIF_F_TSO6))
*request &= ~NETIF_F_TSO6;
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) &&
!(lio->dev_capability & NETIF_F_TSO6))
netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if ((*request & NETIF_F_LRO) && !(lio->dev_capability & NETIF_F_LRO))
*request &= ~NETIF_F_LRO;
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) &&
!(lio->dev_capability & NETIF_F_LRO))
netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/* Disable LRO if RXCSUM is off */
- if (!(*request & NETIF_F_RXCSUM) && (netdev->features & NETIF_F_LRO) &&
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) &&
netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO))
*request &= ~NETIF_F_LRO;
netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
}
/** \brief Net device set features
@@ -1851,25 +1855,29 @@ static int liquidio_set_features(struct net_device *netdev, netdev_features_t features) { struct lio *lio = netdev_priv(netdev);
- netdev_features_t changed;
- if (!((netdev->features ^ features) & NETIF_F_LRO))
- netdev_feature_xor(&changed, netdev->features, features);
- if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) return 0;
- if ((features & NETIF_F_LRO) && (lio->dev_capability & NETIF_F_LRO))
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features) &&
liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);(lio->dev_capability & NETIF_F_LRO))
- else if (!(features & NETIF_F_LRO) &&
- else if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && (lio->dev_capability & NETIF_F_LRO)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_DISABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
- if (!(netdev->features & NETIF_F_RXCSUM) &&
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features) && (lio->enc_dev_capability & NETIF_F_RXCSUM) &&
(features & NETIF_F_RXCSUM))
liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_ENABLE);netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features))
- else if ((netdev->features & NETIF_F_RXCSUM) &&
- else if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
(lio->enc_dev_capability & NETIF_F_RXCSUM) &&netdev->features) &&
!(features & NETIF_F_RXCSUM))
liquidio_set_rxcsum_command(netdev, OCTNET_CMD_TNL_RX_CSUM_CTL, OCTNET_CMD_RXCSUM_DISABLE);!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features))
@@ -2108,20 +2116,33 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
netdev->hw_enc_features =
(lio->enc_dev_capability & ~NETIF_F_LRO);
netdev_feature_zero(&netdev->hw_enc_features);
netdev_feature_set_bits(lio->enc_dev_capability,
&netdev->hw_enc_features);
netdev_feature_clear_bit(NETIF_F_LRO_BIT,
&netdev->hw_enc_features);
- netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
netdev->vlan_features = lio->dev_capability;
netdev_feature_zero(&netdev->vlan_features);
netdev_feature_set_bits(lio->enc_dev_capability,
&netdev->vlan_features);
- /* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
netdev->features = (lio->dev_capability & ~NETIF_F_LRO);
netdev_feature_zero(&netdev->features);
netdev_feature_set_bits(lio->enc_dev_capability,
&netdev->features);
netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features);
netdev->hw_features = lio->dev_capability;
netdev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
netdev_feature_zero(&netdev->hw_features);
netdev_feature_set_bits(lio->enc_dev_capability,
&netdev->hw_features);
netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT,
&netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE;
@@ -2185,7 +2206,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) else octeon_dev->priv_flags = 0x0;
if (netdev->features & NETIF_F_LRO)
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) liquidio_set_feature(netdev, OCTNET_CMD_LRO_ENABLE, OCTNIC_LROIPV4 | OCTNIC_LROIPV6);
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 9f736ef..2887d71 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -732,7 +732,7 @@ static inline void nicvf_set_rxhash(struct net_device *netdev, u8 hash_type; u32 hash;
- if (!(netdev->features & NETIF_F_RXHASH))
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) return;
switch (cqe_rx->rss_alg) {
@@ -823,7 +823,7 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev, nicvf_set_rxhash(netdev, cqe_rx, skb);
skb_record_rx_queue(skb, rq_idx);
- if (netdev->hw_features & NETIF_F_RXCSUM) {
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features)) { /* HW by default verifies TCP/UDP/SCTP checksums */ skb->ip_summed = CHECKSUM_UNNECESSARY; } else {
@@ -837,7 +837,7 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev, __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs((__force __be16)cqe_rx->vlan_tci));
- if (napi && (netdev->features & NETIF_F_GRO))
- if (napi && netdev_feature_test_bit(NETIF_F_GRO_BIT, netdev->features)) napi_gro_receive(napi, skb); else netif_receive_skb(skb);
@@ -1768,7 +1768,8 @@ static int nicvf_config_loopback(struct nicvf *nic,
mbx.lbk.msg = NIC_MBOX_MSG_LOOPBACK; mbx.lbk.vf_id = nic->vf_id;
- mbx.lbk.enable = (features & NETIF_F_LOOPBACK) != 0;
mbx.lbk.enable = netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT,
features);
return nicvf_send_msg_to_pf(nic, &mbx); }
@@ -1778,21 +1779,24 @@ static void nicvf_fix_features(struct net_device *netdev, { struct nicvf *nic = netdev_priv(netdev);
- if ((*features & NETIF_F_LOOPBACK) &&
- if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, *features) && netif_running(netdev) && !nic->loopback_supported)
*features &= ~NETIF_F_LOOPBACK;
netdev_feature_clear_bit(NETIF_F_LOOPBACK_BIT, features);
}
static int nicvf_set_features(struct net_device *netdev, netdev_features_t features) { struct nicvf *nic = netdev_priv(netdev);
- netdev_features_t changed = features ^ netdev->features;
- netdev_features_t changed;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX)
- netdev_feature_xor(&changed, features, netdev->features);
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) nicvf_config_vlan_stripping(nic, features);
- if ((changed & NETIF_F_LOOPBACK) && netif_running(netdev))
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) &&
netif_running(netdev))
return nicvf_config_loopback(nic, features);
return 0;
@@ -2211,18 +2215,22 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_unregister_interrupts;
- netdev->hw_features = (NETIF_F_RXCSUM | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_GRO | NETIF_F_TSO6 |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_HW_VLAN_CTAG_RX);
- netdev_feature_zero(&netdev->hw_features);
- netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_GRO | NETIF_F_TSO6 |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features);
- netdev->hw_features |= NETIF_F_RXHASH;
- netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features);
- netdev->features |= netdev->hw_features;
- netdev->hw_features |= NETIF_F_LOOPBACK;
- netdev_feature_or(&netdev->features, netdev->features,
netdev->hw_features);
- netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &netdev->hw_features);
- netdev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6;
- netdev_feature_zero(&netdev->vlan_features);
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6,
&netdev->hw_features);
it should be "netdev->vlan_features", not "netdev->hw_features"
netdev->netdev_ops = &nicvf_netdev_ops; netdev->watchdog_timeo = NICVF_TX_TIMEOUT; diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 50bbe79..5e95b42 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -714,7 +714,7 @@ void nicvf_config_vlan_stripping(struct nicvf *nic, netdev_features_t features) rq_cfg = nicvf_queue_reg_read(nic, NIC_QSET_RQ_GEN_CFG, 0);
/* Enable first VLAN stripping */
- if (features & NETIF_F_HW_VLAN_CTAG_RX)
- if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) rq_cfg |= (1ULL << 25); else rq_cfg &= ~(1ULL << 25);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/cadence/macb_main.c | 65 ++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 25 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index ff54f2a..8c39bc5 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1381,7 +1381,8 @@ static int gem_rx(struct macb_queue *queue, struct napi_struct *napi,
skb->protocol = eth_type_trans(skb, bp->dev); skb_checksum_none_assert(skb); - if (bp->dev->features & NETIF_F_RXCSUM && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + bp->dev->features) && !(bp->dev->flags & IFF_PROMISC) && GEM_BFEXT(RX_CSUM, ctrl) & GEM_RX_CSUM_CHECKED_MASK) skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -1998,7 +1999,8 @@ static unsigned int macb_tx_map(struct macb *bp, if (i == queue->tx_head) { ctrl |= MACB_BF(TX_LSO, lso_ctrl); ctrl |= MACB_BF(TX_TCP_SEQ_SRC, seq_ctrl); - if ((bp->dev->features & NETIF_F_HW_CSUM) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, + bp->dev->features) && skb->ip_summed != CHECKSUM_PARTIAL && !lso_ctrl) ctrl |= MACB_BIT(TX_NOCRC); } else @@ -2052,7 +2054,7 @@ static void macb_features_check(struct sk_buff *skb, struct net_device *dev, * 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 &= ~MACB_NETIF_LSO; + netdev_feature_clear_bits(MACB_NETIF_LSO, features); return; }
@@ -2063,7 +2065,7 @@ static void macb_features_check(struct sk_buff *skb, struct net_device *dev, const skb_frag_t *frag = &skb_shinfo(skb)->frags[f];
if (!IS_ALIGNED(skb_frag_size(frag), MACB_TX_LEN_ALIGN)) { - *features &= ~MACB_NETIF_LSO; + netdev_feature_clear_bits(MACB_NETIF_LSO, features); return; } } @@ -2097,7 +2099,7 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) struct sk_buff *nskb; u32 fcs;
- if (!(ndev->features & NETIF_F_HW_CSUM) || + if (!netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, ndev->features) || !((*skb)->ip_summed != CHECKSUM_PARTIAL) || skb_shinfo(*skb)->gso_size) /* Not available for GSO */ return 0; @@ -2575,7 +2577,8 @@ static void macb_configure_dma(struct macb *bp) else dmacfg |= GEM_BIT(ENDIA_DESC); /* CPU in big endian */
- if (bp->dev->features & NETIF_F_HW_CSUM) + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, + bp->dev->features)) dmacfg |= GEM_BIT(TXCOEN); else dmacfg &= ~GEM_BIT(TXCOEN); @@ -2611,7 +2614,9 @@ static void macb_init_hw(struct macb *bp) config |= MACB_BIT(BIG); /* Receive oversized frames */ if (bp->dev->flags & IFF_PROMISC) config |= MACB_BIT(CAF); /* Copy All Frames */ - else if (macb_is_gem(bp) && bp->dev->features & NETIF_F_RXCSUM) + else if (macb_is_gem(bp) && + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + bp->dev->features)) config |= GEM_BIT(RXCOEN); if (!(bp->dev->flags & IFF_BROADCAST)) config |= MACB_BIT(NBC); /* No BroadCast */ @@ -2722,7 +2727,8 @@ static void macb_set_rx_mode(struct net_device *dev) cfg &= ~MACB_BIT(CAF);
/* Enable RX checksum offload only if requested */ - if (macb_is_gem(bp) && dev->features & NETIF_F_RXCSUM) + if (macb_is_gem(bp) && + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) cfg |= GEM_BIT(RXCOEN); }
@@ -3226,7 +3232,7 @@ static void gem_enable_flow_filters(struct macb *bp, bool enable) u32 t2_scr; int num_t2_scr;
- if (!(netdev->features & NETIF_F_NTUPLE)) + if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->features)) return;
num_t2_scr = GEM_BFEXT(T2SCR, gem_readl(bp, DCFG8)); @@ -3585,7 +3591,7 @@ static inline void macb_set_txcsum_feature(struct macb *bp, return;
val = gem_readl(bp, DMACFG); - if (features & NETIF_F_HW_CSUM) + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features)) val |= GEM_BIT(TXCOEN); else val &= ~GEM_BIT(TXCOEN); @@ -3603,7 +3609,8 @@ static inline void macb_set_rxcsum_feature(struct macb *bp, return;
val = gem_readl(bp, NCFGR); - if ((features & NETIF_F_RXCSUM) && !(netdev->flags & IFF_PROMISC)) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && + !(netdev->flags & IFF_PROMISC)) val |= GEM_BIT(RXCOEN); else val &= ~GEM_BIT(RXCOEN); @@ -3617,25 +3624,28 @@ static inline void macb_set_rxflow_feature(struct macb *bp, if (!macb_is_gem(bp)) return;
- gem_enable_flow_filters(bp, !!(features & NETIF_F_NTUPLE)); + gem_enable_flow_filters(bp, netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, + features)); }
static int macb_set_features(struct net_device *netdev, netdev_features_t features) { struct macb *bp = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed; + + netdev_feature_xor(&changed, features, netdev->features);
/* TX checksum offload */ - if (changed & NETIF_F_HW_CSUM) + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, changed)) macb_set_txcsum_feature(bp, features);
/* RX checksum offload */ - if (changed & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) macb_set_rxcsum_feature(bp, features);
/* RX Flow Filters */ - if (changed & NETIF_F_NTUPLE) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, changed)) macb_set_rxflow_feature(bp, features);
return 0; @@ -3644,8 +3654,10 @@ static int macb_set_features(struct net_device *netdev, static void macb_restore_features(struct macb *bp) { struct net_device *netdev = bp->dev; - netdev_features_t features = netdev->features; struct ethtool_rx_fs_item *item; + netdev_features_t features; + + netdev_feature_copy(&features, netdev->features);
/* TX checksum offload */ macb_set_txcsum_feature(bp, features); @@ -3931,18 +3943,20 @@ static int macb_init(struct platform_device *pdev) }
/* Set features */ - dev->hw_features = NETIF_F_SG; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features);
/* Check LSO capability */ if (GEM_BFEXT(PBUF_LSO, gem_readl(bp, DCFG6))) - dev->hw_features |= MACB_NETIF_LSO; + netdev_feature_set_bits(MACB_NETIF_LSO, &dev->hw_features);
/* Checksum offload is only available on gem with packet buffer */ if (macb_is_gem(bp) && !(bp->caps & MACB_CAPS_FIFO_MODE)) - dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM, + &dev->hw_features); if (bp->caps & MACB_CAPS_SG_DISABLED) - dev->hw_features &= ~NETIF_F_SG; - dev->features = dev->hw_features; + netdev_feature_clear_bit(NETIF_F_SG_BIT, &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features);
/* Check RX Flow Filters support. * Max Rx flows set by availability of screeners & compare regs: @@ -3960,7 +3974,8 @@ static int macb_init(struct platform_device *pdev) reg = GEM_BFINS(ETHTCMP, (uint16_t)ETH_P_IP, reg); gem_writel_n(bp, ETHT, SCRT2_ETHT, reg); /* Filtering is supported in hw but don't enable it in kernel now */ - dev->hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, + &dev->hw_features); /* init Rx flow definitions */ bp->rx_fs_list.count = 0; spin_lock_init(&bp->rx_fs_lock); @@ -4928,7 +4943,7 @@ static int __maybe_unused macb_suspend(struct device *dev) if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) bp->pm_data.usrio = macb_or_gem_readl(bp, USRIO);
- if (netdev->hw_features & NETIF_F_NTUPLE) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features)) bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT);
if (bp->ptp_info) @@ -4995,7 +5010,7 @@ static int __maybe_unused macb_resume(struct device *dev) ++q, ++queue) napi_enable(&queue->napi);
- if (netdev->hw_features & NETIF_F_NTUPLE) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features)) gem_writel_n(bp, ETHT, SCRT2_ETHT, bp->pm_data.scrt2);
if (!(bp->caps & MACB_CAPS_USRIO_DISABLED))
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 50 +++++++++++++++++++---------- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +- 2 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 6a6ef1c..ae314ec 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -1348,7 +1348,8 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, skb_set_hash(skb, hash, PKT_HASH_TYPE_L4); }
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + netdev->features) && (trxd.rxd2 & RX_DMA_VTAG)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), RX_DMA_VID(trxd.rxd3)); @@ -2024,14 +2025,14 @@ static int mtk_hwlro_get_fdir_all(struct net_device *dev, static void mtk_fix_features(struct net_device *dev, netdev_features_t *features) { - if (!(*features & NETIF_F_LRO)) { + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { struct mtk_mac *mac = netdev_priv(dev); int ip_cnt = mtk_hwlro_get_ip_cnt(mac);
if (ip_cnt) { netdev_info(dev, "RX flow is programmed, LRO should keep on\n");
- *features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, features); } } } @@ -2040,10 +2041,11 @@ static int mtk_set_features(struct net_device *dev, netdev_features_t features) { int err = 0;
- if (!((dev->features ^ features) & NETIF_F_LRO)) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features) == + netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) return 0;
- if (!(features & NETIF_F_LRO)) + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) mtk_hwlro_netdev_disable(dev);
return err; @@ -2859,13 +2861,15 @@ static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
switch (cmd->cmd) { case ETHTOOL_GRXRINGS: - if (dev->hw_features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + dev->hw_features)) { cmd->data = MTK_MAX_RX_RING_NUM; ret = 0; } break; case ETHTOOL_GRXCLSRLCNT: - if (dev->hw_features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + dev->hw_features)) { struct mtk_mac *mac = netdev_priv(dev);
cmd->rule_cnt = mac->hwlro_ip_cnt; @@ -2873,11 +2877,13 @@ static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, } break; case ETHTOOL_GRXCLSRULE: - if (dev->hw_features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + dev->hw_features)) ret = mtk_hwlro_get_fdir_entry(dev, cmd); break; case ETHTOOL_GRXCLSRLALL: - if (dev->hw_features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + dev->hw_features)) ret = mtk_hwlro_get_fdir_all(dev, cmd, rule_locs); break; @@ -2894,11 +2900,13 @@ static int mtk_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
switch (cmd->cmd) { case ETHTOOL_SRXCLSRLINS: - if (dev->hw_features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + dev->hw_features)) ret = mtk_hwlro_add_ipaddr(dev, cmd); break; case ETHTOOL_SRXCLSRLDEL: - if (dev->hw_features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, + dev->hw_features)) ret = mtk_hwlro_del_ipaddr(dev, cmd); break; default: @@ -3023,13 +3031,21 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) eth->netdev[id]->netdev_ops = &mtk_netdev_ops; eth->netdev[id]->base_addr = (unsigned long)eth->base;
- eth->netdev[id]->hw_features = eth->soc->hw_features; + netdev_feature_zero(ð->netdev[id]->hw_features); + netdev_feature_set_bits(eth->soc->hw_features, + ð->netdev[id]->hw_features); if (eth->hwlro) - eth->netdev[id]->hw_features |= NETIF_F_LRO; - - eth->netdev[id]->vlan_features = eth->soc->hw_features & - ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX); - eth->netdev[id]->features |= eth->soc->hw_features; + netdev_feature_set_bit(NETIF_F_LRO_BIT, + ð->netdev[id]->hw_features); + + netdev_feature_zero(ð->netdev[id]->vlan_features); + netdev_feature_set_bits(eth->soc->hw_features, + ð->netdev[id]->vlan_features); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + ð->netdev[id]->vlan_features); + netdev_feature_set_bits(eth->soc->hw_features, + ð->netdev[id]->features); eth->netdev[id]->ethtool_ops = &mtk_ethtool_ops;
eth->netdev[id]->irq = eth->irq[0]; diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index 5ef70dd..a7ab8e3 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -844,7 +844,7 @@ struct mtk_soc_data { u32 required_clks; bool required_pctl; u8 offload_version; - netdev_features_t hw_features; + u64 hw_features; };
/* currently no SoC has more than 2 macs */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/marvell/mv643xx_eth.c | 14 +++-- drivers/net/ethernet/marvell/mvneta.c | 16 +++-- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 71 ++++++++++++++-------- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 3 +- .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 68 +++++++++++++-------- .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 8 ++- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 22 ++++--- .../net/ethernet/marvell/prestera/prestera_main.c | 3 +- drivers/net/ethernet/marvell/skge.c | 11 ++-- drivers/net/ethernet/marvell/sky2.c | 68 +++++++++++++-------- 11 files changed, 177 insertions(+), 109 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 6502c5c..dcb77f8 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -1677,7 +1677,9 @@ static int mv643xx_eth_set_features(struct net_device *dev, netdev_features_t features) { struct mv643xx_eth_private *mp = netdev_priv(dev); - bool rx_csum = features & NETIF_F_RXCSUM; + bool rx_csum; + + rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features);
wrlp(mp, PORT_CONFIG, rx_csum ? 0x02000000 : 0x00000000);
@@ -3182,11 +3184,13 @@ static int mv643xx_eth_probe(struct platform_device *pdev) dev->watchdog_timeo = 2 * HZ; dev->base_addr = 0;
- dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; - dev->vlan_features = dev->features; + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO, + &dev->features); + netdev_feature_copy(&dev->vlan_features, dev->features);
- dev->features |= NETIF_F_RXCSUM; - dev->hw_features = dev->features; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + netdev_feature_copy(&dev->hw_features, dev->features);
dev->priv_flags |= IFF_UNICAST_FLT; dev->gso_max_segs = MV643XX_MAX_TSO_SEGS; diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index e259338..a6a0be2 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -1807,7 +1807,7 @@ static void mvneta_rx_error(struct mvneta_port *pp, /* Handle RX checksum offload based on the descriptor's status */ static int mvneta_rx_csum(struct mvneta_port *pp, u32 status) { - if ((pp->dev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, pp->dev->features) && (status & MVNETA_RXD_L3_IP4) && (status & MVNETA_RXD_L4_CSUM_OK)) return CHECKSUM_UNNECESSARY; @@ -3776,7 +3776,8 @@ static void mvneta_fix_features(struct net_device *dev, struct mvneta_port *pp = netdev_priv(dev);
if (pp->tx_csum_limit && dev->mtu > pp->tx_csum_limit) { - *features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); + netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_TSO, + features); netdev_info(dev, "Disable IP checksum for MTU greater than %dB\n", pp->tx_csum_limit); @@ -5333,10 +5334,13 @@ static int mvneta_probe(struct platform_device *pdev) } }
- dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_RXCSUM; - dev->hw_features |= dev->features; - dev->vlan_features |= dev->features; + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_RXCSUM, &dev->features); + netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(&dev->vlan_features, dev->vlan_features, + dev->features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; dev->gso_max_segs = MVNETA_MAX_TSO_SEGS;
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 744f58f..f8540d8 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1265,7 +1265,10 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) static void mvpp2_set_hw_csum(struct mvpp2_port *port, enum mvpp2_bm_pool_log_num new_long_pool) { - const netdev_features_t csums = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_features_t csums; + + netdev_feature_zero(&csums); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, &csums);
/* Update L4 checksum when jumbo enable/disable on port. * Only port 0 supports hardware checksum offload due to @@ -1274,11 +1277,15 @@ static void mvpp2_set_hw_csum(struct mvpp2_port *port, * has 7 bits, so the maximum L3 offset is 128. */ if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { - port->dev->features &= ~csums; - port->dev->hw_features &= ~csums; + netdev_feature_andnot(&port->dev->features, + port->dev->features, csums); + netdev_feature_andnot(&port->dev->hw_features, + port->dev->hw_features, csums); } else { - port->dev->features |= csums; - port->dev->hw_features |= csums; + netdev_feature_or(&port->dev->features, port->dev->features, + csums); + netdev_feature_or(&port->dev->hw_features, + port->dev->hw_features, csums); } }
@@ -1340,18 +1347,25 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu)
/* Update L4 checksum when jumbo enable/disable on port */ if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { - dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); - dev->hw_features &= ~(NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM); + netdev_feature_clear_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, + &dev->features); + netdev_feature_clear_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, + &dev->hw_features); } else { - dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, + &dev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, + &dev->hw_features); } }
out_set: dev->mtu = mtu; - dev->wanted_features = dev->features; + netdev_feature_copy(&dev->wanted_features, dev->features);
netdev_update_features(dev); return 0; @@ -4898,7 +4912,8 @@ static int mvpp2_prs_mac_da_accept_list(struct mvpp2_port *port,
static void mvpp2_set_rx_promisc(struct mvpp2_port *port, bool enable) { - if (!enable && (port->dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + if (!enable && netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + port->dev->features)) mvpp2_prs_vid_enable_filtering(port); else mvpp2_prs_vid_disable_filtering(port); @@ -5273,11 +5288,14 @@ static int mvpp2_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) static int mvpp2_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = dev->features ^ features; struct mvpp2_port *port = netdev_priv(dev); + netdev_features_t changed; + + netdev_feature_xor(&changed, dev->features, features);
- if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { - if (features & NETIF_F_HW_VLAN_CTAG_FILTER) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features)) { mvpp2_prs_vid_enable_filtering(port); } else { /* Invalidate all registered VID filters for this @@ -5289,8 +5307,8 @@ static int mvpp2_set_features(struct net_device *dev, } }
- if (changed & NETIF_F_RXHASH) { - if (features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features)) mvpp22_port_rss_enable(port); else mvpp22_port_rss_disable(port); @@ -6909,21 +6927,24 @@ static int mvpp2_port_probe(struct platform_device *pdev, } }
- features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO; - dev->features = features | NETIF_F_RXCSUM; - dev->hw_features |= features | NETIF_F_RXCSUM | NETIF_F_GRO | - NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_zero(&features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_TSO, &features); + netdev_feature_copy(&dev->features, features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + netdev_feature_or(&dev->hw_features, dev->hw_features, features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_GRO | + NETIF_F_HW_VLAN_CTAG_FILTER, &dev->hw_features);
if (mvpp22_rss_is_supported(port)) { - dev->hw_features |= NETIF_F_RXHASH; - dev->features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->features); }
if (!port->priv->percpu_pools) mvpp2_set_hw_csum(port, port->pool_long->id);
- dev->vlan_features |= features; + netdev_feature_or(&dev->vlan_features, dev->vlan_features, features); dev->gso_max_segs = MVPP2_MAX_TSO_SEGS; dev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c index ce799b7..34f9e9e 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -482,7 +482,8 @@ 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_feature_clear_bit(NETIF_F_GSO_UDP_L4_BIT, + &pfvf->netdev->hw_features); }
void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c index b906a0e..bdae193 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -673,7 +673,7 @@ static int otx2_get_rxnfc(struct net_device *dev,
static int otx2_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *nfc) { - bool ntuple = !!(dev->features & NETIF_F_NTUPLE); + bool ntuple = netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, dev->features); struct otx2_nic *pfvf = netdev_priv(dev); int ret = -EOPNOTSUPP;
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index 1709313..872d4e5 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1788,15 +1788,17 @@ static void otx2_fix_features(struct net_device *dev, netdev_features_t *features) { /* check if n-tuple filters are ON */ - if ((*features & NETIF_F_HW_TC) && (dev->features & NETIF_F_NTUPLE)) { + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, *features) && + netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features)) { netdev_info(dev, "Disabling n-tuple filters\n"); - *features &= ~NETIF_F_NTUPLE; + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features); }
/* check if tc hw offload is ON */ - if ((*features & NETIF_F_NTUPLE) && (dev->features & NETIF_F_HW_TC)) { + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) && + netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, dev->features)) { netdev_info(dev, "Disabling TC hardware offload\n"); - *features &= ~NETIF_F_HW_TC; + netdev_feature_clear_bit(NETIF_F_HW_TC_BIT, features); } }
@@ -1849,22 +1851,29 @@ static void otx2_do_set_rx_mode(struct work_struct *work) static int otx2_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = features ^ netdev->features; - bool ntuple = !!(features & NETIF_F_NTUPLE); + bool ntuple = netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features); struct otx2_nic *pf = netdev_priv(netdev); + netdev_features_t changed;
- if ((changed & NETIF_F_LOOPBACK) && netif_running(netdev)) + netdev_feature_xor(&changed, features, netdev->features); + + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && + netif_running(netdev)) return otx2_cgx_config_loopback(pf, - features & NETIF_F_LOOPBACK); + netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, + features));
- if ((changed & NETIF_F_HW_VLAN_CTAG_RX) && netif_running(netdev)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed) && + netif_running(netdev)) return otx2_enable_rxvlan(pf, - features & NETIF_F_HW_VLAN_CTAG_RX); + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features));
- if ((changed & NETIF_F_NTUPLE) && !ntuple) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, changed) && !ntuple) otx2_destroy_ntuple_flows(pf);
- if ((netdev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) && + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, netdev->features) && + !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && pf->tc_info.num_entries) { netdev_err(netdev, "Can't disable TC hardware offload while flows are active\n"); return -EBUSY; @@ -2561,36 +2570,43 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id) */ pf->iommu_domain = iommu_get_domain_for_dev(dev);
- netdev->hw_features = (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | - NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_L4); - netdev->features |= netdev->hw_features; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | + NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_L4, &netdev->hw_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features);
- netdev->hw_features |= NETIF_F_LOOPBACK | NETIF_F_RXALL; + netdev_feature_set_bits(NETIF_F_LOOPBACK | NETIF_F_RXALL, + &netdev->hw_features);
err = otx2_mcam_flow_init(pf); if (err) goto err_ptp_destroy;
if (pf->flags & OTX2_FLAG_NTUPLE_SUPPORT) - netdev->hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features);
if (pf->flags & OTX2_FLAG_UCAST_FLTR_SUPPORT) netdev->priv_flags |= IFF_UNICAST_FLT;
/* Support TSO on tag interface */ - netdev->vlan_features |= netdev->features; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &netdev->hw_features); if (pf->flags & OTX2_FLAG_RX_VLAN_SUPPORT) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_STAG_RX; - netdev->features |= netdev->hw_features; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_STAG_RX, + &netdev->hw_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features);
/* HW supports tc offload but mutually exclusive with n-tuple filters */ if (pf->flags & OTX2_FLAG_TC_FLOWER_SUPPORT) - netdev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features);
netdev->gso_max_segs = OTX2_MAX_GSO_SEGS; netdev->watchdog_timeo = OTX2_TX_TIMEOUT; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c index 22ec03a..1304653 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c @@ -171,7 +171,8 @@ static void otx2_set_rxhash(struct otx2_nic *pfvf, struct otx2_rss_info *rss; u32 hash = 0;
- if (!(pfvf->netdev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + pfvf->netdev->features)) return;
rss = &pfvf->hw.rss_info; @@ -261,7 +262,7 @@ static bool otx2_check_rcv_errors(struct otx2_nic *pfvf, }
/* If RXALL is enabled pass on packets to stack. */ - if (pfvf->netdev->features & NETIF_F_RXALL) + if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, pfvf->netdev->features)) return false;
/* Free buffer back to pool */ @@ -308,7 +309,8 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf, otx2_set_rxhash(pfvf, cqe, skb);
skb_record_rx_queue(skb, cq->cq_idx); - if (pfvf->netdev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + pfvf->netdev->features)) skb->ip_summed = CHECKSUM_UNNECESSARY;
napi_gro_frags(napi); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c index a8bee5a..e23791b 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -616,16 +616,20 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Assign default mac address */ otx2_get_mac_from_af(netdev);
- netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | - NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_L4; - netdev->features = netdev->hw_features; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | + NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_L4, &netdev->hw_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); /* Support TSO on tag interface */ - netdev->vlan_features |= netdev->features; - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; - netdev->features |= netdev->hw_features; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX, + &netdev->hw_features); + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features);
netdev->gso_max_segs = OTX2_MAX_GSO_SEGS; netdev->watchdog_timeo = OTX2_TX_TIMEOUT; diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 44c6708..0867c77 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -316,7 +316,8 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id) if (err) goto err_dl_port_register;
- dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC; + netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC, + &dev->features); dev->netdev_ops = &prestera_netdev_ops; dev->ethtool_ops = &prestera_ethtool_ops;
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 150c06e..66fda62 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c @@ -3105,7 +3105,7 @@ static struct sk_buff *skge_rx_get(struct net_device *dev,
skb_put(skb, len);
- if (dev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) { skb->csum = le16_to_cpu(csum); skb->ip_summed = CHECKSUM_COMPLETE; } @@ -3821,7 +3821,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, dev->max_mtu = ETH_JUMBO_MTU;
if (highmem) - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
skge = netdev_priv(dev); netif_napi_add(dev, &skge->napi, skge_poll, NAPI_WEIGHT); @@ -3852,9 +3852,10 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, if (is_genesis(hw)) timer_setup(&skge->link_timer, xm_link_timer, 0); else { - dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_RXCSUM; - dev->features |= dev->hw_features; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_RXCSUM, &dev->hw_features); + netdev_feature_or(&dev->features, dev->features, + dev->hw_features); }
/* read the mac address */ diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index dd4705c..263b88b 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -1274,8 +1274,9 @@ static void rx_set_checksum(struct sky2_port *sky2)
sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), - (sky2->netdev->features & NETIF_F_RXCSUM) - ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + sky2->netdev->features) ? + BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); }
/* Enable/disable receive hash calculation (RSS) */ @@ -1292,7 +1293,7 @@ static void rx_set_rss(struct net_device *dev, netdev_features_t features) }
/* Program RSS initial values */ - if (features & NETIF_F_RXHASH) { + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features)) { u32 rss_key[10];
netdev_rss_key_fill(rss_key, sizeof(rss_key)); @@ -1407,24 +1408,26 @@ static void sky2_vlan_mode(struct net_device *dev, netdev_features_t features) struct sky2_hw *hw = sky2->hw; u16 port = sky2->port;
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_ON); else sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF);
- if (features & NETIF_F_HW_VLAN_CTAG_TX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) { sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_ON);
- dev->vlan_features |= SKY2_VLAN_OFFLOADS; + netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, + &dev->vlan_features); } else { sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
/* Can't do transmit offload of vlan without hw vlan */ - dev->vlan_features &= ~SKY2_VLAN_OFFLOADS; + netdev_feature_clear_bits(SKY2_VLAN_OFFLOADS, + &dev->vlan_features); } }
@@ -2678,7 +2681,8 @@ 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_feature_clear_bit(NETIF_F_RXCSUM_BIT, + &sky2->netdev->features); sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), BMU_DIS_RX_CHKSUM); } @@ -2744,7 +2748,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
/* This chip reports checksum status differently */ if (hw->flags & SKY2_HW_NEW_LE) { - if ((dev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features) && (le->css & (CSS_ISIPV4 | CSS_ISIPV6)) && (le->css & CSS_TCPUDPCSOK)) skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -2768,7 +2773,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) sky2_rx_tag(sky2, length); fallthrough; case OP_RXCHKS: - if (likely(dev->features & NETIF_F_RXCSUM)) + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features))) sky2_rx_checksum(sky2, status); break;
@@ -4365,35 +4371,40 @@ static void 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 | NETIF_F_SG | NETIF_F_CSUM_MASK); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_SG | + NETIF_F_CSUM_MASK, features); }
/* Some hardware requires receive checksum for RSS to work. */ - if ((*features & NETIF_F_RXHASH) && - !(*features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, *features) && + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features) && (sky2->hw->flags & SKY2_HW_RSS_CHKSUM)) { netdev_info(dev, "receive hashing forces receive checksum\n"); - *features |= NETIF_F_RXCSUM; + netdev_feature_clear_bits(NETIF_F_RXCSUM_BIT, features); } }
static int sky2_set_features(struct net_device *dev, netdev_features_t features) { struct sky2_port *sky2 = netdev_priv(dev); - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed;
- if ((changed & NETIF_F_RXCSUM) && + netdev_feature_xor(&changed, dev->features, features); + + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed) && !(sky2->hw->flags & SKY2_HW_NEW_LE)) { sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), - (features & NETIF_F_RXCSUM) + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + features) ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); }
- if (changed & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) rx_set_rss(dev, features);
- if (changed & (NETIF_F_HW_VLAN_CTAG_TX|NETIF_F_HW_VLAN_CTAG_RX)) + if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, changed)) sky2_vlan_mode(dev, features);
return 0; @@ -4748,7 +4759,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, /* Auto speed and flow control */ sky2->flags = SKY2_FLAG_AUTO_SPEED | SKY2_FLAG_AUTO_PAUSE; if (hw->chip_id != CHIP_ID_YUKON_XL) - dev->hw_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features);
sky2->flow_mode = FC_BOTH;
@@ -4767,22 +4778,25 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
sky2->port = port;
- dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO, + &dev->hw_features);
if (highmem) - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
/* Enable receive hashing unless hardware is known broken */ if (!(hw->flags & SKY2_HW_RSS_BROKEN)) - dev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features);
if (!(hw->flags & SKY2_HW_VLAN_BROKEN)) { - dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - dev->vlan_features |= SKY2_VLAN_OFFLOADS; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &dev->hw_features); + netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, + &dev->vlan_features); }
- dev->features |= dev->hw_features; + netdev_feature_or(&dev->features, dev->features, dev->hw_features);
/* MTU range: 60 - 1500 or 9000 */ dev->min_mtu = ETH_ZLEN;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/socionext/netsec.c | 10 ++++++---- drivers/net/ethernet/socionext/sni_ave.c | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index d15f7b3..2859f4c 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -1747,7 +1747,8 @@ static int netsec_netdev_set_features(struct net_device *ndev, { struct netsec_priv *priv = netdev_priv(ndev);
- priv->rx_cksum_offload_flag = !!(features & NETIF_F_RXCSUM); + priv->rx_cksum_offload_flag = + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features);
return 0; } @@ -2101,9 +2102,10 @@ static int netsec_probe(struct platform_device *pdev) ndev->netdev_ops = &netsec_netdev_ops; ndev->ethtool_ops = &netsec_ethtool_ops;
- ndev->features |= NETIF_F_HIGHDMA | NETIF_F_RXCSUM | NETIF_F_GSO | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - ndev->hw_features = ndev->features; + netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_RXCSUM | NETIF_F_GSO | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &ndev->features); + netdev_feature_copy(&ndev->hw_features, ndev->features);
priv->rx_cksum_offload_flag = true;
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c index ae31ed9..efdcb7f 100644 --- a/drivers/net/ethernet/socionext/sni_ave.c +++ b/drivers/net/ethernet/socionext/sni_ave.c @@ -1594,8 +1594,10 @@ static int ave_probe(struct platform_device *pdev) ndev->ethtool_ops = &ave_ethtool_ops; SET_NETDEV_DEV(ndev, dev);
- ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_RXCSUM); - ndev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_RXCSUM); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, + &ndev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, + &ndev->hw_features);
ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- .../net/ethernet/qlogic/netxen/netxen_nic_init.c | 3 +- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 44 +++++++++------ drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 14 +++-- drivers/net/ethernet/qlogic/qede/qede_fp.c | 9 ++- drivers/net/ethernet/qlogic/qede/qede_main.c | 65 +++++++++++++--------- drivers/net/ethernet/qlogic/qla3xxx.c | 5 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 57 +++++++++++-------- drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 3 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 48 +++++++++------- 10 files changed, 152 insertions(+), 98 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index 35ec9aa..ffa7b51 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c @@ -1497,7 +1497,8 @@ static struct sk_buff *netxen_process_rxbuf(struct netxen_adapter *adapter, if (!skb) goto no_skb;
- if (likely((adapter->netdev->features & NETIF_F_RXCSUM) + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + adapter->netdev->features) && cksum == STATUS_CKSUM_OK)) { adapter->stats.csummed++; skb->ip_summed = CHECKSUM_UNNECESSARY; diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 2516688..487b203 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -520,10 +520,10 @@ static void netxen_set_multicast_list(struct net_device *dev) static void netxen_fix_features(struct net_device *dev, netdev_features_t *features) { - if (!(*features & NETIF_F_RXCSUM)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { netdev_info(dev, "disabling LRO as RXCSUM is off\n");
- *features &= ~NETIF_F_LRO; + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } }
@@ -533,16 +533,18 @@ static int netxen_set_features(struct net_device *dev, struct netxen_adapter *adapter = netdev_priv(dev); int hw_lro;
- if (!((dev->features ^ features) & NETIF_F_LRO)) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features) == + netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) return 0;
- hw_lro = (features & NETIF_F_LRO) ? NETXEN_NIC_LRO_ENABLED - : NETXEN_NIC_LRO_DISABLED; + hw_lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, features) ? + NETXEN_NIC_LRO_ENABLED : NETXEN_NIC_LRO_DISABLED;
if (netxen_config_hw_lro(adapter, hw_lro)) return -EIO;
- if (!(features & NETIF_F_LRO) && netxen_send_lro_cleanup(adapter)) + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && + netxen_send_lro_cleanup(adapter)) return -EIO;
return 0; @@ -1116,7 +1118,7 @@ __netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) netxen_config_intr_coalesce(adapter);
- if (netdev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) netxen_config_hw_lro(adapter, NETXEN_NIC_LRO_ENABLED);
netxen_napi_enable(adapter); @@ -1343,26 +1345,33 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
netdev->ethtool_ops = &netxen_nic_ethtool_ops;
- netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_RXCSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + NETIF_F_RXCSUM, &netdev->hw_features);
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) - netdev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_IPV6_CSUM | NETIF_F_TSO6, + &netdev->hw_features);
- netdev->vlan_features |= netdev->hw_features; + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->hw_features);
if (adapter->pci_using_dac) { - netdev->features |= NETIF_F_HIGHDMA; - netdev->vlan_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->vlan_features); }
if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_features);
if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO) - netdev->hw_features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, + &netdev->hw_features);
- netdev->features |= netdev->hw_features; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features);
netdev->irq = adapter->msix_entries[0].vector;
@@ -1870,7 +1879,8 @@ netxen_tso_check(struct net_device *netdev, vlan_oob = 1; }
- if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, + netdev->features) && skb_shinfo(skb)->gso_size > 0) {
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index 9c6aa68..9bfa18c 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c @@ -1023,7 +1023,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_feature_clear_bit(NETIF_F_GRO_HW_BIT, &ndev->features);
/* Set the mtu field and re-start the interface if needed */ args.u.mtu = new_mtu; diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index d92870c..3024190 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -909,7 +909,7 @@ void qede_vlan_mark_nonconfigured(struct qede_dev *edev) static void qede_set_features_reload(struct qede_dev *edev, struct qede_reload_args *args) { - edev->ndev->features = args->u.features; + netdev_feature_copy(&edev->ndev->features, args->u.features); }
void qede_fix_features(struct net_device *dev, netdev_features_t *features) @@ -917,23 +917,25 @@ void qede_fix_features(struct net_device *dev, netdev_features_t *features) struct qede_dev *edev = netdev_priv(dev);
if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE || - !(*features & NETIF_F_GRO)) - *features &= ~NETIF_F_GRO_HW; + !netdev_feature_test_bit(NETIF_F_GRO_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); }
int qede_set_features(struct net_device *dev, netdev_features_t features) { struct qede_dev *edev = netdev_priv(dev); - netdev_features_t changes = features ^ dev->features; + netdev_features_t changes; bool need_reload = false;
- if (changes & NETIF_F_GRO_HW) + netdev_feature_xor(&changes, features, dev->features); + + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, changes)) need_reload = true;
if (need_reload) { struct qede_reload_args args;
- args.u.features = features; + netdev_feature_copy(&args.u.features, features); args.func = &qede_set_features_reload;
/* Make sure that we definitely need to reload. diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index 8a459d2..2d49c95 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c @@ -1780,15 +1780,18 @@ void qede_features_check(struct sk_buff *skb, struct net_device *dev, skb_transport_header(skb)) > hdrlen || (ntohs(udp_hdr(skb)->dest) != vxln_port && ntohs(udp_hdr(skb)->dest) != gnv_port)) { - *features &= ~(NETIF_F_CSUM_MASK | - NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | + NETIF_F_GSO_MASK, + features); 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. */ - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | + NETIF_F_GSO_MASK, + features); return; } } diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index d400e9b..dee4af6 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c @@ -789,47 +789,59 @@ static void qede_init_ndev(struct qede_dev *edev) ndev->priv_flags |= IFF_UNICAST_FLT;
/* user-changeble features */ - hw_features = NETIF_F_GRO | NETIF_F_GRO_HW | NETIF_F_SG | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC; + netdev_feature_zero(&hw_features); + netdev_feature_set_bits(NETIF_F_GRO | NETIF_F_GRO_HW | NETIF_F_SG | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC, + &hw_features);
if (edev->dev_info.common.b_arfs_capable) - hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &hw_features);
if (edev->dev_info.common.vxlan_enable || edev->dev_info.common.geneve_enable) udp_tunnel_enable = true;
if (udp_tunnel_enable || edev->dev_info.common.gre_enable) { - hw_features |= NETIF_F_TSO_ECN; - ndev->hw_enc_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &hw_features); + netdev_feature_zero(&ndev->hw_enc_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | - NETIF_F_RXCSUM; + NETIF_F_RXCSUM, + &ndev->hw_enc_features); }
if (udp_tunnel_enable) { - hw_features |= (NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM); - ndev->hw_enc_features |= (NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM); + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &hw_features); + netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &ndev->hw_enc_features);
qede_set_udp_tunnels(edev); }
if (edev->dev_info.common.gre_enable) { - hw_features |= (NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM); - ndev->hw_enc_features |= (NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM); + netdev_feature_set_bits(NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM, + &hw_features); + netdev_feature_set_bits(NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM, + &ndev->hw_enc_features); }
- ndev->vlan_features = hw_features | NETIF_F_RXHASH | NETIF_F_RXCSUM | - NETIF_F_HIGHDMA; - ndev->features = hw_features | NETIF_F_RXHASH | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HIGHDMA | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_copy(&ndev->vlan_features, hw_features); + netdev_feature_set_bits(NETIF_F_RXHASH | NETIF_F_RXCSUM | + NETIF_F_HIGHDMA, &ndev->vlan_features); + netdev_feature_copy(&ndev->features, hw_features); + netdev_feature_set_bits(NETIF_F_RXHASH | NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HIGHDMA | + NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_TX, &ndev->features);
- ndev->hw_features = hw_features; + netdev_feature_copy(&ndev->hw_features, hw_features);
/* MTU range: 46 - 9600 */ ndev->min_mtu = ETH_ZLEN - ETH_HLEN; @@ -1495,7 +1507,8 @@ 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_feature_clear_bit(NETIF_F_GRO_HW_BIT, + &edev->ndev->features); }
/* Allocate the parallel driver ring for Rx buffers */ @@ -1536,7 +1549,8 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq) } }
- edev->gro_disable = !(edev->ndev->features & NETIF_F_GRO_HW); + edev->gro_disable = !netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, + edev->ndev->features); if (!edev->gro_disable) qede_set_tpa_param(rxq); err: @@ -2369,7 +2383,8 @@ 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_feature_clear_bit(NETIF_F_NTUPLE_BIT, + &edev->ndev->features); edev->dev_info.common.b_arfs_capable = false; }
@@ -2701,9 +2716,9 @@ static void qede_get_generic_tlv_data(void *dev, struct qed_generic_tlvs *data) struct netdev_hw_addr *ha; int i;
- if (edev->ndev->features & NETIF_F_IP_CSUM) + if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, edev->ndev->features)) data->feat_flags |= QED_TLV_IP_CSUM; - if (edev->ndev->features & NETIF_F_TSO) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, edev->ndev->features)) data->feat_flags |= QED_TLV_LSO;
ether_addr_copy(data->mac[0], edev->ndev->dev_addr); diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index c00ad57..c396ee0 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c @@ -3797,9 +3797,10 @@ static int ql3xxx_probe(struct pci_dev *pdev, qdev->msg_enable = netif_msg_init(debug, default_msg);
if (pci_using_dac) - ndev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); if (qdev->device_id == QL3032_DEVICE_ID) - ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, + &ndev->features);
qdev->mem_map_registers = pci_ioremap_bar(pdev, 1); if (!qdev->mem_map_registers) { diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 2367923..625fcf3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -1026,27 +1026,33 @@ static void qlcnic_process_flags(struct qlcnic_adapter *adapter, u32 offload_flags = adapter->offload_flags;
if (offload_flags & BIT_0) { - *features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, features); adapter->rx_csum = 1; if (QLCNIC_IS_TSO_CAPABLE(adapter)) { if (!(offload_flags & BIT_1)) - *features &= ~NETIF_F_TSO; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, + features); else - *features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + features);
if (!(offload_flags & BIT_2)) - *features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, + features); else - *features |= NETIF_F_TSO6; + netdev_feature_set_bit(NETIF_F_TSO6_BIT, + features); } } else { - *features &= ~(NETIF_F_RXCSUM | - NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM); + netdev_feature_clear_bits(NETIF_F_RXCSUM | + NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, + features);
if (QLCNIC_IS_TSO_CAPABLE(adapter)) - *features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, + features); adapter->rx_csum = 0; } } @@ -1061,30 +1067,37 @@ void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) { qlcnic_process_flags(adapter, features); } else { - changed = *features ^ netdev->features; - *features ^= changed & (NETIF_F_RXCSUM | - NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | - NETIF_F_TSO | - NETIF_F_TSO6); + netdev_feature_xor(&changed, *features, + netdev->features); + netdev_feature_and_bits(NETIF_F_RXCSUM | + NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | + NETIF_F_TSO | + NETIF_F_TSO6, + &changed); + netdev_feature_xor(features, *features, changed); } }
- if (!(*features & NETIF_F_RXCSUM)) - *features &= ~NETIF_F_LRO; + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
int qlcnic_set_features(struct net_device *netdev, netdev_features_t features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = netdev->features ^ features; - int hw_lro = (features & NETIF_F_LRO) ? QLCNIC_LRO_ENABLED : 0; + netdev_features_t changed; + int hw_lro; + + netdev_feature_xor(&changed, netdev->features, features); + hw_lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, features) ? + QLCNIC_LRO_ENABLED : 0;
- if (!(changed & NETIF_F_LRO)) + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) return 0;
- netdev->features ^= NETIF_F_LRO; + netdev_feature_change_bit(NETIF_F_LRO_BIT, &netdev->features);
if (qlcnic_config_hw_lro(adapter, hw_lro)) return -EIO; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index af4c516..1af8e9f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c @@ -1151,7 +1151,8 @@ static struct sk_buff *qlcnic_process_rxbuf(struct qlcnic_adapter *adapter, PCI_DMA_FROMDEVICE);
skb = buffer->skb; - if (likely((adapter->netdev->features & NETIF_F_RXCSUM) && + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + adapter->netdev->features) && (cksum == STATUS_CKSUM_OK || cksum == STATUS_CKSUM_LOOP))) { adapter->stats.csummed++; skb->ip_summed = CHECKSUM_UNNECESSARY; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 75ade18..37e1ddb 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -1886,7 +1886,7 @@ int __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
qlcnic_config_def_intr_coalesce(adapter);
- if (netdev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features)) qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED);
set_bit(__QLCNIC_DEV_UP, &adapter->state); @@ -2275,48 +2275,56 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev, netdev->ethtool_ops = (qlcnic_sriov_vf_check(adapter)) ? &qlcnic_sriov_vf_ethtool_ops : &qlcnic_ethtool_ops;
- netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | - NETIF_F_IPV6_CSUM | NETIF_F_GRO | - NETIF_F_HW_VLAN_CTAG_RX); - netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | + NETIF_F_IPV6_CSUM | NETIF_F_GRO | + NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &netdev->vlan_features);
if (QLCNIC_IS_TSO_CAPABLE(adapter)) { - netdev->features |= (NETIF_F_TSO | NETIF_F_TSO6); - netdev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &netdev->features); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &netdev->vlan_features); }
if (pci_using_dac) { - netdev->features |= NETIF_F_HIGHDMA; - netdev->vlan_features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &netdev->vlan_features); }
if (qlcnic_vlan_tx_check(adapter)) - netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->features);
if (qlcnic_sriov_vf_check(adapter)) - netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features);
if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) - netdev->features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->features);
if (qlcnic_encap_tx_offload(adapter)) { - netdev->features |= NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &netdev->features);
/* encapsulation Tx offload supported by Adapter */ - netdev->hw_enc_features = NETIF_F_IP_CSUM | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_TSO | - NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_TSO | + NETIF_F_TSO6, + &netdev->hw_enc_features); }
if (qlcnic_encap_rx_offload(adapter)) { - netdev->hw_enc_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &qlcnic_udp_tunnels; }
- netdev->hw_features = netdev->features; + netdev_feature_copy(&netdev->hw_features, netdev->features); netdev->priv_flags |= IFF_UNICAST_FLT; netdev->irq = adapter->msix_entries[0].vector;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/netronome/nfp/crypto/tls.c | 12 ++- .../net/ethernet/netronome/nfp/nfp_net_common.c | 95 ++++++++++++++-------- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 64 +++++++++------ drivers/net/ethernet/netronome/nfp/nfp_port.c | 3 +- 4 files changed, 109 insertions(+), 65 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/crypto/tls.c b/drivers/net/ethernet/netronome/nfp/crypto/tls.c index 84d66d13..a5bee5d 100644 --- a/drivers/net/ethernet/netronome/nfp/crypto/tls.c +++ b/drivers/net/ethernet/netronome/nfp/crypto/tls.c @@ -587,12 +587,16 @@ int nfp_net_tls_init(struct nfp_net *nn) return err;
if (nn->tlv_caps.crypto_ops & NFP_NET_TLS_OPCODE_MASK_RX) { - netdev->hw_features |= NETIF_F_HW_TLS_RX; - netdev->features |= NETIF_F_HW_TLS_RX; + netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, + &netdev->features); } if (nn->tlv_caps.crypto_ops & NFP_NET_TLS_OPCODE_MASK_TX) { - netdev->hw_features |= NETIF_F_HW_TLS_TX; - netdev->features |= NETIF_F_HW_TLS_TX; + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, + &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, + &netdev->features); }
netdev->tlsdev_ops = &nfp_net_tls_ops; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 6261596..5732b63 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -1594,7 +1594,7 @@ static void nfp_net_rx_csum(struct nfp_net_dp *dp, { skb_checksum_none_assert(skb);
- if (!(dp->netdev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dp->netdev->features)) return;
if (meta->csum_type) { @@ -1638,7 +1638,7 @@ static void nfp_net_set_hash(struct net_device *netdev, struct nfp_meta_parsed *meta, unsigned int type, __be32 *hash) { - if (!(netdev->features & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) return;
switch (type) { @@ -3518,8 +3518,8 @@ static void nfp_net_stat64(struct net_device *netdev, static int nfp_net_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed = netdev->features ^ features; struct nfp_net *nn = netdev_priv(netdev); + netdev_features_t changed; u32 new_ctrl; int err;
@@ -3527,51 +3527,60 @@ static int nfp_net_set_features(struct net_device *netdev,
new_ctrl = nn->dp.ctrl;
- if (changed & NETIF_F_RXCSUM) { - if (features & NETIF_F_RXCSUM) + netdev_feature_xor(&changed, netdev->features, features); + + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) new_ctrl |= nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY; else new_ctrl &= ~NFP_NET_CFG_CTRL_RXCSUM_ANY; }
- if (changed & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) { - if (features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) + if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + changed)) { + if (netdev_feature_test_bits(NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, features)) new_ctrl |= NFP_NET_CFG_CTRL_TXCSUM; else new_ctrl &= ~NFP_NET_CFG_CTRL_TXCSUM; }
- if (changed & (NETIF_F_TSO | NETIF_F_TSO6)) { - if (features & (NETIF_F_TSO | NETIF_F_TSO6)) + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, changed)) { + if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, + features)) new_ctrl |= nn->cap & NFP_NET_CFG_CTRL_LSO2 ?: NFP_NET_CFG_CTRL_LSO; else new_ctrl &= ~NFP_NET_CFG_CTRL_LSO_ANY; }
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) { - if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) new_ctrl |= NFP_NET_CFG_CTRL_RXVLAN; else new_ctrl &= ~NFP_NET_CFG_CTRL_RXVLAN; }
- if (changed & NETIF_F_HW_VLAN_CTAG_TX) { - if (features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + features)) new_ctrl |= NFP_NET_CFG_CTRL_TXVLAN; else new_ctrl &= ~NFP_NET_CFG_CTRL_TXVLAN; }
- if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { - if (features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + changed)) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + features)) new_ctrl |= NFP_NET_CFG_CTRL_CTAG_FILTER; else new_ctrl &= ~NFP_NET_CFG_CTRL_CTAG_FILTER; }
- if (changed & NETIF_F_SG) { - if (features & NETIF_F_SG) + if (netdev_feature_test_bit(NETIF_F_SG_BIT, changed)) { + if (netdev_feature_test_bit(NETIF_F_SG_BIT, features)) new_ctrl |= NFP_NET_CFG_CTRL_GATHER; else new_ctrl &= ~NFP_NET_CFG_CTRL_GATHER; @@ -3620,7 +3629,7 @@ static void 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; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); }
/* VXLAN/GRE check */ @@ -3632,7 +3641,8 @@ static void nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, l4_hdr = ipv6_hdr(skb)->nexthdr; break; default: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); return; }
@@ -3642,7 +3652,8 @@ static void nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, (l4_hdr == IPPROTO_UDP && (skb_inner_mac_header(skb) - skb_transport_header(skb) != sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) { - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); return; } } @@ -4030,67 +4041,79 @@ static void nfp_net_netdev_init(struct nfp_net *nn) if (nn->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- netdev->hw_features = NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->hw_features); + if (nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY) { - netdev->hw_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &netdev->hw_features); nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY; } if (nn->cap & NFP_NET_CFG_CTRL_TXCSUM) { - netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_TXCSUM; } if (nn->cap & NFP_NET_CFG_CTRL_GATHER) { - netdev->hw_features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_GATHER; } if ((nn->cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) || nn->cap & NFP_NET_CFG_CTRL_LSO2) { - netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &netdev->hw_features); nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_LSO2 ?: NFP_NET_CFG_CTRL_LSO; } if (nn->cap & NFP_NET_CFG_CTRL_RSS_ANY) - netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, + &netdev->hw_features); if (nn->cap & NFP_NET_CFG_CTRL_VXLAN) { if (nn->cap & NFP_NET_CFG_CTRL_LSO) - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &netdev->hw_features); netdev->udp_tunnel_nic_info = &nfp_udp_tunnels; nn->dp.ctrl |= NFP_NET_CFG_CTRL_VXLAN; } if (nn->cap & NFP_NET_CFG_CTRL_NVGRE) { if (nn->cap & NFP_NET_CFG_CTRL_LSO) - netdev->hw_features |= NETIF_F_GSO_GRE; + netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, + &netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_NVGRE; } if (nn->cap & (NFP_NET_CFG_CTRL_VXLAN | NFP_NET_CFG_CTRL_NVGRE)) - netdev->hw_enc_features = netdev->hw_features; + netdev_feature_copy(&netdev->hw_enc_features, + netdev->hw_features);
- netdev->vlan_features = netdev->hw_features; + netdev_feature_copy(&netdev->vlan_features, netdev->hw_features);
if (nn->cap & NFP_NET_CFG_CTRL_RXVLAN) { - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_RXVLAN; } if (nn->cap & NFP_NET_CFG_CTRL_TXVLAN) { if (nn->cap & NFP_NET_CFG_CTRL_LSO2) { nn_warn(nn, "Device advertises both TSO2 and TXVLAN. Refusing to enable TXVLAN.\n"); } else { - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_TXVLAN; } } if (nn->cap & NFP_NET_CFG_CTRL_CTAG_FILTER) { - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_CTAG_FILTER; }
- netdev->features = netdev->hw_features; + netdev_feature_copy(&netdev->features, netdev->hw_features);
if (nfp_app_has_tc(nn->app) && nn->port) - netdev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features);
/* Advertise but disable TSO by default. */ - netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, + &netdev->features); nn->dp.ctrl &= ~NFP_NET_CFG_CTRL_LSO_ANY;
/* Finalise the netdev setup */ diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index ef14623..372c72c 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -236,19 +236,23 @@ static void nfp_repr_fix_features(struct net_device *netdev, netdev_features_t *features) { struct nfp_repr *repr = netdev_priv(netdev); - netdev_features_t old_features = *features; netdev_features_t lower_features; + netdev_features_t old_features; struct net_device *lower_dev;
lower_dev = repr->dst->u.port_info.lower_dev;
- lower_features = lower_dev->features; - if (lower_features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) - lower_features |= NETIF_F_HW_CSUM; + netdev_feature_copy(&old_features, *features); + netdev_feature_copy(&lower_features, lower_dev->features); + if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + lower_features)) + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &lower_features);
netdev_intersect_features(features, *features, lower_features); - *features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC); - *features |= NETIF_F_LLTX; + netdev_feature_and_bits(NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC, + &old_features); + netdev_feature_or(features, *features, old_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
const struct net_device_ops nfp_repr_netdev_ops = { @@ -339,54 +343,66 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, if (repr_cap & NFP_NET_CFG_CTRL_LIVE_ADDR) netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- netdev->hw_features = NETIF_F_HIGHDMA; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_RXCSUM_ANY) - netdev->hw_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_TXCSUM) - netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_GATHER) - netdev->hw_features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); if ((repr_cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) || repr_cap & NFP_NET_CFG_CTRL_LSO2) - netdev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_RSS_ANY) - netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, + &netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_VXLAN) { if (repr_cap & NFP_NET_CFG_CTRL_LSO) - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, + &netdev->hw_features); } if (repr_cap & NFP_NET_CFG_CTRL_NVGRE) { if (repr_cap & NFP_NET_CFG_CTRL_LSO) - netdev->hw_features |= NETIF_F_GSO_GRE; + netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, + &netdev->hw_features); } if (repr_cap & (NFP_NET_CFG_CTRL_VXLAN | NFP_NET_CFG_CTRL_NVGRE)) - netdev->hw_enc_features = netdev->hw_features; + netdev_feature_copy(&netdev->hw_enc_features, + netdev->hw_features);
- netdev->vlan_features = netdev->hw_features; + netdev_feature_copy(&netdev->vlan_features, netdev->hw_features);
if (repr_cap & NFP_NET_CFG_CTRL_RXVLAN) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_TXVLAN) { if (repr_cap & NFP_NET_CFG_CTRL_LSO2) netdev_warn(netdev, "Device advertises both TSO2 and TXVLAN. Refusing to enable TXVLAN.\n"); else - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->hw_features); } if (repr_cap & NFP_NET_CFG_CTRL_CTAG_FILTER) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->hw_features);
- netdev->features = netdev->hw_features; + netdev_feature_copy(&netdev->features, netdev->hw_features);
/* Advertise but disable TSO by default. */ - netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, + &netdev->features); netdev->gso_max_segs = NFP_NET_LSO_MAX_SEGS;
netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL; - netdev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &netdev->features);
if (nfp_app_has_tc(app)) { - netdev->features |= NETIF_F_HW_TC; - netdev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); }
err = nfp_app_repr_init(app, netdev); diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c index 93c5bfc..67ba30f 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_port.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c @@ -66,7 +66,8 @@ int nfp_port_set_features(struct net_device *netdev, netdev_features_t features) if (!port) return 0;
- if ((netdev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) && + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, netdev->features) && + !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && port->tc_offload_cnt) { netdev_err(netdev, "Cannot disable HW TC offload while offloads active\n"); return -EBUSY;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/mscc/ocelot.c | 3 ++- drivers/net/ethernet/mscc/ocelot_net.c | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index adfb978..11f1f6d 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -819,7 +819,8 @@ int ocelot_xtr_poll_frame(struct ocelot *ocelot, int grp, struct sk_buff **nskb) /* Update the statistics if part of the FCS was read before */ len -= ETH_FCS_LEN - sz;
- if (unlikely(dev->features & NETIF_F_RXFCS)) { + if (unlikely(netdev_feature_test_bit(NETIF_F_RXFCS_BIT, + dev->features))) { buf = (u32 *)skb_put(skb, ETH_FCS_LEN); *buf = val; } diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index de900ea..abbf17a 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -760,7 +760,7 @@ static void ocelot_vlan_mode(struct ocelot *ocelot, int port,
/* Filtering */ val = ocelot_read(ocelot, ANA_VLANMASK); - if (features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) val |= BIT(port); else val &= ~BIT(port); @@ -770,19 +770,22 @@ static void ocelot_vlan_mode(struct ocelot *ocelot, int port, static int ocelot_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed = dev->features ^ features; struct ocelot_port_private *priv = netdev_priv(dev); struct ocelot *ocelot = priv->port.ocelot; int port = priv->chip_port; + netdev_features_t changed;
- if ((dev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) && + netdev_feature_xor(&changed, dev->features, features); + + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features) && + !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && priv->tc.offload_cnt) { netdev_err(dev, "Cannot disable HW TC offload while offloads active\n"); return -EBUSY; }
- if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) ocelot_vlan_mode(ocelot, port, features);
return 0; @@ -1552,9 +1555,10 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target, dev->netdev_ops = &ocelot_port_netdev_ops; dev->ethtool_ops = &ocelot_ethtool_ops;
- dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS | - NETIF_F_HW_TC; - dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS | + NETIF_F_HW_TC, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC, + &dev->features);
memcpy(dev->dev_addr, ocelot->base_mac, ETH_ALEN); dev->dev_addr[ETH_ALEN - 1] += port;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 13 ++++++++----- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index bc35d57..e91ac9f 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -2216,9 +2216,11 @@ static int pch_gbe_set_features(struct net_device *netdev, netdev_features_t features) { struct pch_gbe_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (!(changed & NETIF_F_RXCSUM)) + netdev_feature_xor(&changed, features, netdev->features); + + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0;
if (netif_running(netdev)) @@ -2529,9 +2531,10 @@ static int pch_gbe_probe(struct pci_dev *pdev, netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD; netif_napi_add(netdev, &adapter->napi, pch_gbe_napi_poll, PCH_GBE_RX_WEIGHT); - netdev->hw_features = NETIF_F_RXCSUM | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - netdev->features = netdev->hw_features; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &netdev->hw_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); pch_gbe_set_ethtool_ops(netdev);
/* MTU range: 46 - 10300 */ diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c index 81fc5a6..1e3a909 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c @@ -477,7 +477,8 @@ 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_feature_clear_bit(NETIF_F_RXCSUM_BIT, + &dev->features); } { /* Checksum Offload Enable/Disable */ static const struct pch_gbe_option opt = { @@ -489,7 +490,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) val = XsumTX; pch_gbe_validate_option(&val, &opt, adapter); if (!val) - dev->features &= ~NETIF_F_CSUM_MASK; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, + &dev->features); } { /* Flow Control */ static const struct pch_gbe_option opt = {
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/neterion/s2io.c | 32 ++++++++++++------- drivers/net/ethernet/neterion/vxge/vxge-main.c | 43 ++++++++++++++++---------- 2 files changed, 47 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index 09c0e839..0e3f500 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c @@ -6567,14 +6567,17 @@ static void s2io_ethtool_get_strings(struct net_device *dev, static int s2io_set_features(struct net_device *dev, netdev_features_t features) { struct s2io_nic *sp = netdev_priv(dev); - netdev_features_t changed = (features ^ dev->features) & NETIF_F_LRO; + netdev_features_t changed;
- if (changed && netif_running(dev)) { + netdev_feature_xor(&changed, features, dev->features); + + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, changed) && + netif_running(dev)) { int rc;
s2io_stop_all_tx_queue(sp); s2io_card_down(sp); - dev->features = features; + netdev_feature_copy(&dev->features, features); rc = s2io_card_up(sp); if (rc) s2io_reset(sp); @@ -7120,7 +7123,8 @@ static int s2io_card_up(struct s2io_nic *sp) struct ring_info *ring = &mac_control->rings[i];
ring->mtu = dev->mtu; - ring->lro = !!(dev->features & NETIF_F_LRO); + ring->lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, + dev->features); ret = fill_rx_buffers(sp, ring, 1); if (ret) { DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n", @@ -7154,7 +7158,7 @@ static int s2io_card_up(struct s2io_nic *sp) /* Setting its receive mode */ s2io_set_multicast(dev, true);
- if (dev->features & NETIF_F_LRO) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) { /* Initialize max aggregatable pkts per session based on MTU */ sp->lro_max_aggr_per_sess = ((1<<16) - 1) / dev->mtu; /* Check if we can use (if specified) user provided value */ @@ -7366,7 +7370,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) if ((rxdp->Control_1 & TCP_OR_UDP_FRAME) && ((!ring_data->lro) || (!(rxdp->Control_1 & RXD_FRAME_IP_FRAG))) && - (dev->features & NETIF_F_RXCSUM)) { + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) { l3_csum = RXD_GET_L3_CKSUM(rxdp->Control_1); l4_csum = RXD_GET_L4_CKSUM(rxdp->Control_1); if ((l3_csum == L3_CKSUM_OK) && (l4_csum == L4_CKSUM_OK)) { @@ -7861,13 +7865,17 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) /* Driver entry points */ dev->netdev_ops = &s2io_netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; - dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_RXCSUM | NETIF_F_LRO; - dev->features |= dev->hw_features | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_RXCSUM | NETIF_F_LRO, + &dev->hw_features); + netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &dev->features); if (sp->high_dma_flag == true) - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); dev->watchdog_timeo = WATCH_DOG_TIMEOUT; INIT_WORK(&sp->rst_timer_task, s2io_restart_nic); INIT_WORK(&sp->set_link_task, s2io_set_link); diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 5f720e9..2ead012 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -490,7 +490,8 @@ vxge_rx_1b_compl(struct __vxge_hw_ring *ringh, void *dtr,
if ((ext_info.proto & VXGE_HW_FRAME_PROTO_TCP_OR_UDP) && !(ext_info.proto & VXGE_HW_FRAME_PROTO_IP_FRAG) && - (dev->features & NETIF_F_RXCSUM) && /* Offload Rx side CSUM */ + netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features) && /* Offload Rx side CSUM */ ext_info.l3_cksum == VXGE_HW_L3_CKSUM_OK && ext_info.l4_cksum == VXGE_HW_L4_CKSUM_OK) skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -2642,27 +2643,33 @@ static void vxge_poll_vp_lockup(struct timer_list *t) static void vxge_fix_features(struct net_device *dev, netdev_features_t *features) { - netdev_features_t changed = dev->features ^ *features; + netdev_features_t changed; + + netdev_feature_xor(&changed, dev->features, *features);
/* Enabling RTH requires some of the logic in vxge_device_register and a * vpath reset. Due to these restrictions, only allow modification * while the interface is down. */ - if ((changed & NETIF_F_RXHASH) && netif_running(dev)) - *features ^= NETIF_F_RXHASH; + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed) && + netif_running(dev)) + netdev_feature_change_bit(NETIF_F_RXHASH_BIT, features); }
static int vxge_set_features(struct net_device *dev, netdev_features_t features) { struct vxgedev *vdev = netdev_priv(dev); - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed; + + netdev_feature_xor(&changed, dev->features, features);
- if (!(changed & NETIF_F_RXHASH)) + if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) return 0;
/* !netif_running() ensured by vxge_fix_features() */
- vdev->devh->config.rth_en = !!(features & NETIF_F_RXHASH); + vdev->devh->config.rth_en = netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + features); vxge_reset_all_vpaths(vdev);
return 0; @@ -3391,16 +3398,20 @@ static int vxge_device_register(struct __vxge_hw_device *hldev,
SET_NETDEV_DEV(ndev, &vdev->pdev->dev);
- ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_HW_VLAN_CTAG_TX, + &ndev->hw_features); if (vdev->config.rth_steering != NO_STEERING) - ndev->hw_features |= NETIF_F_RXHASH; - - ndev->features |= ndev->hw_features | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features);
+ netdev_feature_or(&ndev->features, ndev->features, + ndev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &ndev->hw_features);
ndev->netdev_ops = &vxge_netdev_ops;
@@ -3424,7 +3435,7 @@ static int vxge_device_register(struct __vxge_hw_device *hldev, "%s : checksumming enabled", __func__);
if (high_dma) { - ndev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); vxge_debug_init(vxge_hw_device_trace_level_get(hldev), "%s : using High DMA", __func__); }
在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/neterion/s2io.c | 32 ++++++++++++------- drivers/net/ethernet/neterion/vxge/vxge-main.c | 43 ++++++++++++++++---------- 2 files changed, 47 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index 09c0e839..0e3f500 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c @@ -6567,14 +6567,17 @@ static void s2io_ethtool_get_strings(struct net_device *dev, static int s2io_set_features(struct net_device *dev, netdev_features_t features) { struct s2io_nic *sp = netdev_priv(dev);
- netdev_features_t changed = (features ^ dev->features) & NETIF_F_LRO;
- netdev_features_t changed;
- if (changed && netif_running(dev)) {
netdev_feature_xor(&changed, features, dev->features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, changed) &&
netif_running(dev)) {
int rc;
s2io_stop_all_tx_queue(sp); s2io_card_down(sp);
dev->features = features;
rc = s2io_card_up(sp); if (rc) s2io_reset(sp);netdev_feature_copy(&dev->features, features);
@@ -7120,7 +7123,8 @@ static int s2io_card_up(struct s2io_nic *sp) struct ring_info *ring = &mac_control->rings[i];
ring->mtu = dev->mtu;
ring->lro = !!(dev->features & NETIF_F_LRO);
ring->lro = netdev_feature_test_bit(NETIF_F_LRO_BIT,
ret = fill_rx_buffers(sp, ring, 1); if (ret) { DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n",dev->features);
@@ -7154,7 +7158,7 @@ static int s2io_card_up(struct s2io_nic *sp) /* Setting its receive mode */ s2io_set_multicast(dev, true);
- if (dev->features & NETIF_F_LRO) {
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) { /* Initialize max aggregatable pkts per session based on MTU */ sp->lro_max_aggr_per_sess = ((1<<16) - 1) / dev->mtu; /* Check if we can use (if specified) user provided value */
@@ -7366,7 +7370,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) if ((rxdp->Control_1 & TCP_OR_UDP_FRAME) && ((!ring_data->lro) || (!(rxdp->Control_1 & RXD_FRAME_IP_FRAG))) &&
(dev->features & NETIF_F_RXCSUM)) {
l3_csum = RXD_GET_L3_CKSUM(rxdp->Control_1); l4_csum = RXD_GET_L4_CKSUM(rxdp->Control_1); if ((l3_csum == L3_CKSUM_OK) && (l4_csum == L4_CKSUM_OK)) {netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) {
@@ -7861,13 +7865,17 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) /* Driver entry points */ dev->netdev_ops = &s2io_netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops;
- dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_RXCSUM | NETIF_F_LRO;
- dev->features |= dev->hw_features |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
- netdev_feature_zero(&dev->hw_features);
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_RXCSUM | NETIF_F_LRO,
&dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features);
- netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX,
if (sp->high_dma_flag == true)&dev->features);
dev->features |= NETIF_F_HIGHDMA;
dev->watchdog_timeo = WATCH_DOG_TIMEOUT; INIT_WORK(&sp->rst_timer_task, s2io_restart_nic); INIT_WORK(&sp->set_link_task, s2io_set_link);netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 5f720e9..2ead012 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -490,7 +490,8 @@ vxge_rx_1b_compl(struct __vxge_hw_ring *ringh, void *dtr,
if ((ext_info.proto & VXGE_HW_FRAME_PROTO_TCP_OR_UDP) && !(ext_info.proto & VXGE_HW_FRAME_PROTO_IP_FRAG) &&
(dev->features & NETIF_F_RXCSUM) && /* Offload Rx side CSUM */
netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
ext_info.l3_cksum == VXGE_HW_L3_CKSUM_OK && ext_info.l4_cksum == VXGE_HW_L4_CKSUM_OK) skb->ip_summed = CHECKSUM_UNNECESSARY;dev->features) && /* Offload Rx side CSUM */
@@ -2642,27 +2643,33 @@ static void vxge_poll_vp_lockup(struct timer_list *t) static void vxge_fix_features(struct net_device *dev, netdev_features_t *features) {
- netdev_features_t changed = dev->features ^ *features;
netdev_features_t changed;
netdev_feature_xor(&changed, dev->features, *features);
/* Enabling RTH requires some of the logic in vxge_device_register and a
- vpath reset. Due to these restrictions, only allow modification
- while the interface is down.
*/
- if ((changed & NETIF_F_RXHASH) && netif_running(dev))
*features ^= NETIF_F_RXHASH;
if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed) &&
netif_running(dev))
netdev_feature_change_bit(NETIF_F_RXHASH_BIT, features);
}
static int vxge_set_features(struct net_device *dev, netdev_features_t features) { struct vxgedev *vdev = netdev_priv(dev);
- netdev_features_t changed = dev->features ^ features;
- netdev_features_t changed;
- netdev_feature_xor(&changed, dev->features, features);
- if (!(changed & NETIF_F_RXHASH))
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) return 0;
/* !netif_running() ensured by vxge_fix_features() */
- vdev->devh->config.rth_en = !!(features & NETIF_F_RXHASH);
vdev->devh->config.rth_en = netdev_feature_test_bit(NETIF_F_RXHASH_BIT,
features);
vxge_reset_all_vpaths(vdev);
return 0;
@@ -3391,16 +3398,20 @@ static int vxge_device_register(struct __vxge_hw_device *hldev,
SET_NETDEV_DEV(ndev, &vdev->pdev->dev);
- ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_HW_VLAN_CTAG_TX;
- netdev_feature_zero(&ndev->hw_features);
- netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_HW_VLAN_CTAG_TX,
if (vdev->config.rth_steering != NO_STEERING)&ndev->hw_features);
ndev->hw_features |= NETIF_F_RXHASH;
- ndev->features |= ndev->hw_features |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER;
netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features);
netdev_feature_or(&ndev->features, ndev->features,
ndev->hw_features);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER,
&ndev->hw_features);
it shoule be "&ndev->features " rather than “&ndev->hw_features” here, I will fix it at next version.
ndev->netdev_ops = &vxge_netdev_ops;
@@ -3424,7 +3435,7 @@ static int vxge_device_register(struct __vxge_hw_device *hldev, "%s : checksumming enabled", __func__);
if (high_dma) {
ndev->features |= NETIF_F_HIGHDMA;
vxge_debug_init(vxge_hw_device_trace_level_get(hldev), "%s : using High DMA", __func__); }netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/cortina/gemini.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index a759db0..81b4045 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -1980,17 +1980,19 @@ static void gmac_fix_features(struct net_device *netdev, netdev_features_t *features) { if (netdev->mtu + ETH_HLEN + VLAN_HLEN > MTU_SIZE_BIT_MASK) - *features &= ~GMAC_OFFLOAD_FEATURES; + netdev_feature_clear_bits(GMAC_OFFLOAD_FEATURES, features); }
static int gmac_set_features(struct net_device *netdev, netdev_features_t features) { struct gemini_ethernet_port *port = netdev_priv(netdev); - int enable = features & NETIF_F_RXCSUM; unsigned long flags; + int enable; u32 reg;
+ enable = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features); + spin_lock_irqsave(&port->config_lock, flags);
reg = readl(port->gmac_base + GMAC_CONFIG0); @@ -2448,8 +2450,10 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) spin_lock_init(&port->config_lock); gmac_clear_hw_stats(netdev);
- netdev->hw_features = GMAC_OFFLOAD_FEATURES; - netdev->features |= GMAC_OFFLOAD_FEATURES | NETIF_F_GRO; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES, &netdev->hw_features); + netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES | NETIF_F_GRO, + &netdev->features); /* We can handle jumbo frames up to 10236 bytes so, let's accept * payloads of 10236 bytes minus VLAN and ethernet header */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 3 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 56 ++++++++++++++-------- .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 ++- 3 files changed, 41 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index b217453..3d0028f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -712,7 +712,8 @@ static void dwmac4_set_filter(struct mac_device_info *hw, }
/* VLAN filtering */ - if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + dev->features)) value |= GMAC_PACKET_FILTER_VTFE;
writel(value, ioaddr + GMAC_PACKET_FILTER); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 14c8c1c..f94950f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3100,7 +3100,7 @@ static void stmmac_mac_config_rss(struct stmmac_priv *priv) return; }
- if (priv->dev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, priv->dev->features)) priv->rss.enable = true; else priv->rss.enable = false; @@ -4410,9 +4410,11 @@ static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb) vlan_proto = veth->h_vlan_proto;
if ((vlan_proto == htons(ETH_P_8021Q) && - dev->features & NETIF_F_HW_VLAN_CTAG_RX) || + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features)) || (vlan_proto == htons(ETH_P_8021AD) && - dev->features & NETIF_F_HW_VLAN_STAG_RX)) { + netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, + dev->features))) { /* pop the vlan tag */ vlanid = ntohs(veth->h_vlan_TCI); memmove(skb->data + VLAN_HLEN, veth, ETH_ALEN * 2); @@ -5456,10 +5458,10 @@ static void 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_clear_bit(NETIF_F_RXCSUM_BIT, features);
if (!priv->plat->tx_coe) - *features &= ~NETIF_F_CSUM_MASK; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
/* Some GMAC devices have a bugged Jumbo frame support that * needs to have the Tx COE disabled for oversized frames @@ -5467,11 +5469,11 @@ static void stmmac_fix_features(struct net_device *dev, * the TX csum insertion in the TDES and not use SF. */ if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN)) - *features &= ~NETIF_F_CSUM_MASK; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features);
/* Disable tso if asked by ethtool */ if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { - if (*features & NETIF_F_TSO) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features)) priv->tso = true; else priv->tso = false; @@ -5486,7 +5488,7 @@ static int stmmac_set_features(struct net_device *netdev, u32 chan;
/* Keep the COE Type in case of csum is supporting */ - if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) priv->hw->rx_csum = priv->plat->rx_coe; else priv->hw->rx_csum = 0; @@ -6856,24 +6858,28 @@ int stmmac_dvr_probe(struct device *device,
ndev->netdev_ops = &stmmac_netdev_ops;
- ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM, + &ndev->hw_features);
ret = stmmac_tc_init(priv, priv); if (!ret) { - ndev->hw_features |= NETIF_F_HW_TC; + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->hw_features); }
if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { - ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, + &ndev->hw_features); if (priv->plat->has_gmac4) - ndev->hw_features |= NETIF_F_GSO_UDP_L4; + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, + &ndev->hw_features); priv->tso = true; dev_info(priv->device, "TSO feature enabled\n"); }
if (priv->dma_cap.sphen) { - ndev->hw_features |= NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_GRO_BIT, &ndev->hw_features); priv->sph_cap = true; priv->sph = priv->sph_cap; dev_info(priv->device, "SPH feature enabled\n"); @@ -6911,19 +6917,27 @@ int stmmac_dvr_probe(struct device *device, } }
- ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; + netdev_feature_or(&ndev->features, ndev->features, + ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); ndev->watchdog_timeo = msecs_to_jiffies(watchdog); #ifdef STMMAC_VLAN_TAG_USED /* Both mac100 and gmac support receive VLAN tag detection */ - ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_STAG_RX, + &ndev->features); if (priv->dma_cap.vlhash) { - ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; - ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &ndev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, + &ndev->features); } if (priv->dma_cap.vlins) { - ndev->features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &ndev->features); if (priv->dma_cap.dvlan) - ndev->features |= NETIF_F_HW_VLAN_STAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, + &ndev->features); } #endif priv->msg_enable = netif_msg_init(debug, default_msg_level); @@ -6935,7 +6949,7 @@ int stmmac_dvr_probe(struct device *device, priv->rss.table[i] = ethtool_rxfh_indir_default(i, rxq);
if (priv->dma_cap.rssen && priv->plat->rss_en) - ndev->features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->features);
/* MTU range: 46 - hw-specific max */ ndev->min_mtu = ETH_ZLEN - ETH_HLEN; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c index 0462dcc..6064052 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c @@ -974,7 +974,8 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv) { int ret, prev_cap = priv->dma_cap.vlhash;
- if (!(priv->dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + priv->dev->features)) return -EOPNOTSUPP;
priv->dma_cap.vlhash = 0; @@ -1068,7 +1069,8 @@ static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv) { int ret, prev_cap = priv->dma_cap.vlhash;
- if (!(priv->dev->features & NETIF_F_HW_VLAN_STAG_FILTER)) + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, + priv->dev->features)) return -EOPNOTSUPP;
priv->dma_cap.vlhash = 0;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/calxeda/xgmac.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index b6a0664..1079252 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c @@ -974,7 +974,7 @@ static int xgmac_hw_init(struct net_device *dev)
ctrl |= XGMAC_CONTROL_DDIC | XGMAC_CONTROL_JE | XGMAC_CONTROL_ACS | XGMAC_CONTROL_CAR; - if (dev->features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) ctrl |= XGMAC_CONTROL_IPC; writel(ctrl, ioaddr + XGMAC_CONTROL);
@@ -1491,13 +1491,15 @@ static int xgmac_set_features(struct net_device *dev, netdev_features_t features u32 ctrl; struct xgmac_priv *priv = netdev_priv(dev); void __iomem *ioaddr = priv->base; - netdev_features_t changed = dev->features ^ features; + netdev_features_t changed;
- if (!(changed & NETIF_F_RXCSUM)) + netdev_feature_xor(&changed, dev->features, features); + + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0;
ctrl = readl(ioaddr + XGMAC_CONTROL); - if (features & NETIF_F_RXCSUM) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) ctrl |= XGMAC_CONTROL_IPC; else ctrl &= ~XGMAC_CONTROL_IPC; @@ -1773,11 +1775,13 @@ static int xgmac_probe(struct platform_device *pdev) if (device_can_wakeup(priv->device)) priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
- ndev->hw_features = NETIF_F_SG | NETIF_F_HIGHDMA; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, + &ndev->hw_features); + if (readl(priv->base + XGMAC_DMA_HW_FEATURE) & DMA_HW_FEAT_TXCOESEL) - ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM; - ndev->features |= ndev->hw_features; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM, &ndev->hw_features); + netdev_feature_or(&ndev->features, &ndev->features, &ndev->hw_features); ndev->priv_flags |= IFF_UNICAST_FLT;
/* MTU range: 46 - 9000 */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/altera/altera_tse_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index 1c00d71..b488140 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -354,7 +354,9 @@ static inline void tse_rx_vlan(struct net_device *dev, struct sk_buff *skb) { struct ethhdr *eth_hdr; u16 vid; - if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) && + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features) && !__vlan_get_tag(skb, &vid)) { eth_hdr = (struct ethhdr *)skb->data; memmove(skb->data + VLAN_HLEN, eth_hdr, ETH_ALEN * 2); @@ -1549,14 +1551,15 @@ 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; - ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; + netdev_feature_clear_bit(NETIF_F_SG_BIT, &ndev->hw_features); + netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features);
/* VLAN offloading of tagging, stripping and filtering is not * supported by hardware, but driver will accommodate the * extra 4-byte VLAN tag for processing by upper layers */ - ndev->features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &ndev->features);
/* setup NAPI interface */ netif_napi_add(ndev, &priv->napi, tse_poll, NAPI_POLL_WEIGHT);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 23 ++++++++++++++--------- drivers/net/ethernet/ti/cpsw.c | 6 ++++-- drivers/net/ethernet/ti/cpsw_new.c | 7 ++++--- drivers/net/ethernet/ti/netcp_core.c | 9 +++++---- 4 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 130346f..2830691 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -748,7 +748,8 @@ static void am65_cpsw_nuss_rx_csum(struct sk_buff *skb, u32 csum_info) */ skb_checksum_none_assert(skb);
- if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) + if (unlikely(!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + skb->dev->features))) return;
if ((csum_info & (AM65_CPSW_RX_PSD_IPV6_VALID | @@ -1974,19 +1975,23 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
port->ndev->min_mtu = AM65_CPSW_MIN_PACKET_SIZE; port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE; - port->ndev->hw_features = NETIF_F_SG | - NETIF_F_RXCSUM | - NETIF_F_HW_CSUM | - NETIF_F_HW_TC; - port->ndev->features = port->ndev->hw_features | - NETIF_F_HW_VLAN_CTAG_FILTER; - port->ndev->vlan_features |= NETIF_F_SG; + netdev_feature_zero(&port->ndev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_RXCSUM | + NETIF_F_HW_CSUM | + NETIF_F_HW_TC, + &port->ndev->hw_features); + netdev_feature_copy(&port->ndev->features, port->ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &port->ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &port->ndev->vlan_features); port->ndev->netdev_ops = &am65_cpsw_nuss_netdev_ops; port->ndev->ethtool_ops = &am65_cpsw_ethtool_ops_slave;
/* 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_feature_clear_bit(NETIF_F_HW_CSUM_BIT, + &port->ndev->features);
ndev_priv->stats = netdev_alloc_pcpu_stats(struct am65_cpsw_ndev_stats); if (!ndev_priv->stats) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 9f70e40..c11f2b0 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1464,7 +1464,8 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv)
priv_sl2->emac_port = 1; cpsw->slaves[1].ndev = ndev; - ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX, &ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; @@ -1643,7 +1644,8 @@ static int cpsw_probe(struct platform_device *pdev)
cpsw->slaves[0].ndev = ndev;
- ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX, &ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index ff3a96b0..95af37d 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -1405,9 +1405,10 @@ static int cpsw_create_ports(struct cpsw_common *cpsw)
cpsw->slaves[i].ndev = ndev;
- ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_NETNS_LOCAL; - + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_NETNS_LOCAL, + &ndev->features); ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; SET_NETDEV_DEV(ndev, dev); diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index eda2961..a0129d4 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -1976,10 +1976,11 @@ static int netcp_create_interface(struct netcp_device *netcp_device, return -ENOMEM; }
- ndev->features |= NETIF_F_SG; - ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; - ndev->hw_features = ndev->features; - ndev->vlan_features |= NETIF_F_SG; + netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &ndev->features); + netdev_feature_copy(&ndev->hw_features, ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->vlan_features);
/* MTU range: 68 - 9486 */ ndev->min_mtu = ETH_MIN_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/emulex/benet/be_main.c | 51 ++++++++++++++++++----------- 1 file changed, 31 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 27e8a1d..b8faf89 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -2406,14 +2406,16 @@ static void be_rx_compl_process(struct be_rx_obj *rxo, struct napi_struct *napi,
skb_fill_rx_data(rxo, skb, rxcp);
- if (likely((netdev->features & NETIF_F_RXCSUM) && csum_passed(rxcp))) + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features) && + csum_passed(rxcp))) skb->ip_summed = CHECKSUM_UNNECESSARY; else skb_checksum_none_assert(skb);
skb->protocol = eth_type_trans(skb, netdev); skb_record_rx_queue(skb, rxo - &adapter->rx_obj[0]); - if (netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, netdev->features)) skb_set_hash(skb, rxcp->rss_hash, PKT_HASH_TYPE_L3);
skb->csum_level = rxcp->tunneled; @@ -2471,7 +2473,8 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo, skb->data_len = rxcp->pkt_size; skb->ip_summed = CHECKSUM_UNNECESSARY; skb_record_rx_queue(skb, rxo - &adapter->rx_obj[0]); - if (adapter->netdev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + adapter->netdev->features)) skb_set_hash(skb, rxcp->rss_hash, PKT_HASH_TYPE_L3);
skb->csum_level = rxcp->tunneled; @@ -3999,9 +4002,10 @@ static int be_vxlan_set_port(struct net_device *netdev, unsigned int table, } adapter->vxlan_port = ti->port;
- netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_TUNNEL; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_TUNNEL, + &netdev->hw_enc_features);
dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n", be16_to_cpu(ti->port)); @@ -4023,7 +4027,7 @@ static int be_vxlan_unset_port(struct net_device *netdev, unsigned int table, adapter->flags &= ~BE_FLAGS_VXLAN_OFFLOADS; adapter->vxlan_port = 0;
- netdev->hw_enc_features = 0; + netdev_feature_zero(&netdev->hw_enc_features); return 0; }
@@ -5075,7 +5079,7 @@ static void be_features_check(struct sk_buff *skb, struct net_device *dev, * to Lancer and BE3 HW. Disable TSO6 feature. */ if (!skyhawk_chip(adapter) && is_ipv6_ext_hdr(skb)) - *features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(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 @@ -5084,7 +5088,7 @@ static void be_features_check(struct sk_buff *skb, struct net_device *dev, if (lancer_chip(adapter) && (skb_shinfo(skb)->gso_size < 256 || skb_shinfo(skb)->gso_segs == 1)) - *features &= ~NETIF_F_GSO_MASK; + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); }
/* The code below restricts offload features for some tunneled and @@ -5120,7 +5124,8 @@ static void be_features_check(struct sk_buff *skb, struct net_device *dev, sizeof(struct udphdr) + sizeof(struct vxlanhdr) || !adapter->vxlan_port || udp_hdr(skb)->dest != adapter->vxlan_port) { - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); return; } } @@ -5186,18 +5191,24 @@ static void be_netdev_init(struct net_device *netdev) { struct be_adapter *adapter = netdev_priv(netdev);
- netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_RXCSUM | + NETIF_F_HW_VLAN_CTAG_TX, + &netdev->hw_features); if ((be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS)) - netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features);
- netdev->features |= netdev->hw_features | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &netdev->features);
- netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT;
@@ -5841,7 +5852,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (!status) { - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); } else { status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (status) {
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/brocade/bna/bnad.c | 48 +++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ba47777..2e51cf6 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -698,7 +698,8 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) masked_flags = flags & flags_cksum_prot_mask;
if (likely - ((bnad->netdev->features & NETIF_F_RXCSUM) && + (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + bnad->netdev->features) && ((masked_flags == flags_tcp4) || (masked_flags == flags_udp4) || (masked_flags == flags_tcp6) || @@ -708,7 +709,8 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) skb_checksum_none_assert(skb);
if ((flags & BNA_CQ_EF_VLAN) && - (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + bnad->netdev->features)) __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cmpl->vlan_tag));
if (BNAD_RXBUF_IS_SK_BUFF(unmap_q->type)) @@ -2082,7 +2084,8 @@ bnad_init_rx_config(struct bnad *bnad, struct bna_rx_config *rx_config) }
rx_config->vlan_strip_status = - (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) ? + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + bnad->netdev->features) ? BNA_STATUS_T_ENABLED : BNA_STATUS_T_DISABLED; }
@@ -3349,14 +3352,17 @@ bnad_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid) static int bnad_set_features(struct net_device *dev, netdev_features_t features) { struct bnad *bnad = netdev_priv(dev); - netdev_features_t changed = features ^ dev->features; + netdev_features_t changed;
- if ((changed & NETIF_F_HW_VLAN_CTAG_RX) && netif_running(dev)) { + netdev_feature_xor(&changed, features, dev->features); + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed) && + netif_running(dev)) { unsigned long flags;
spin_lock_irqsave(&bnad->bna_lock, flags);
- if (features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + features)) bna_rx_vlan_strip_enable(bnad->rx_info[0].rx); else bna_rx_vlan_strip_disable(bnad->rx_info[0].rx); @@ -3425,19 +3431,27 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac) { struct net_device *netdev = bnad->netdev;
- netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX; - - netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6; - - netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &netdev->hw_features); + + netdev_feature_zero(&netdev->vlan_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6, + &netdev->vlan_features); + + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, + &netdev->features);
if (using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev->mem_start = bnad->mmio_start; netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/cisco/enic/enic_main.c | 63 ++++++++++++++++++----------- 1 file changed, 39 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index a2cc1d5..e5ddb39 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -293,7 +293,8 @@ static void enic_features_check(struct sk_buff *skb, struct net_device *dev, return;
out: - *features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, + features); }
int enic_is_dynamic(struct enic *enic) @@ -1357,8 +1358,9 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, skb_put(skb, bytes_written); skb->protocol = eth_type_trans(skb, netdev); skb_record_rx_queue(skb, q_number); - if ((netdev->features & NETIF_F_RXHASH) && rss_hash && - (type == 3)) { + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + netdev->features) && + rss_hash && (type == 3)) { switch (rss_type) { case CQ_ENET_RQ_DESC_RSS_TYPE_TCP_IPv4: case CQ_ENET_RQ_DESC_RSS_TYPE_TCP_IPv6: @@ -1400,7 +1402,9 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, * inner csum_ok. outer_csum_ok is set by hw when outer udp * csum is correct or is zero. */ - if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + netdev->features) && + !csum_not_calc && tcp_udp_csum_ok && outer_csum_ok && (ipv4_csum_ok || ipv6)) { skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -1411,7 +1415,8 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
skb_mark_napi_id(skb, &enic->napi[rq->index]); - if (!(netdev->features & NETIF_F_GRO)) + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, + netdev->features)) netif_receive_skb(skb); else napi_gro_receive(&enic->napi[q_number], skb); @@ -2895,34 +2900,42 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->watchdog_timeo = 2 * HZ; enic_set_ethtool_ops(netdev);
- netdev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); if (ENIC_SETTING(enic, LOOP)) { - netdev->features &= ~NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + &netdev->features); enic->loop_enable = 1; enic->loop_tag = enic->config.loop_tag; dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag); } if (ENIC_SETTING(enic, TXCSUM)) - netdev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, + &netdev->hw_features); if (ENIC_SETTING(enic, TSO)) - netdev->hw_features |= NETIF_F_TSO | - NETIF_F_TSO6 | NETIF_F_TSO_ECN; + netdev_feature_set_bits(NETIF_F_TSO | + NETIF_F_TSO6 | NETIF_F_TSO_ECN, + &netdev->hw_features); if (ENIC_SETTING(enic, RSS)) - netdev->hw_features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, + &netdev->hw_features); if (ENIC_SETTING(enic, RXCSUM)) - netdev->hw_features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, + &netdev->hw_features); if (ENIC_SETTING(enic, VXLAN)) { u64 patch_level; u64 a1 = 0;
- netdev->hw_enc_features |= NETIF_F_RXCSUM | - NETIF_F_TSO | - NETIF_F_TSO6 | - NETIF_F_TSO_ECN | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_HW_CSUM | - NETIF_F_GSO_UDP_TUNNEL_CSUM; - netdev->hw_features |= netdev->hw_enc_features; + netdev_feature_set_bits(NETIF_F_RXCSUM | + NETIF_F_TSO | + NETIF_F_TSO6 | + NETIF_F_TSO_ECN | + NETIF_F_GSO_UDP_TUNNEL | + NETIF_F_HW_CSUM | + NETIF_F_GSO_UDP_TUNNEL_CSUM, + &netdev->hw_enc_features); + netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->hw_enc_features); /* get bit mask from hw about supported offload bit level * BIT(0) = fw supports patch_level 0 * fcoe bit = encap @@ -2955,15 +2968,17 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } }
- netdev->features |= netdev->hw_features; - netdev->vlan_features |= netdev->features; + netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev->features);
#ifdef CONFIG_RFS_ACCEL - netdev->hw_features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); #endif
if (using_dac) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/3com/3c59x.c | 9 ++++++--- drivers/net/ethernet/3com/typhoon.c | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 17c1633..98b6b5b 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c @@ -1446,7 +1446,8 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, if (card_idx < MAX_UNITS && ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) || hw_checksums[card_idx] == 1)) { - dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, + &dev->features); } } else dev->netdev_ops = &vortex_netdev_ops; @@ -1454,8 +1455,10 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, if (print_info) { pr_info("%s: scatter/gather %sabled. h/w checksums %sabled\n", print_name, - (dev->features & NETIF_F_SG) ? "en":"dis", - (dev->features & NETIF_F_IP_CSUM) ? "en":"dis"); + netdev_feature_test_bit(NETIF_F_SG_BIT, + dev->features) ? "en" : "dis", + netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, + dev->features) ? "en" : "dis"); }
dev->ethtool_ops = &vortex_ethtool_ops; diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c index 05e15b6..5ec10b9 100644 --- a/drivers/net/ethernet/3com/typhoon.c +++ b/drivers/net/ethernet/3com/typhoon.c @@ -2458,10 +2458,12 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * on the current 3XP firmware -- it does not respect the offload * settings -- so we only allow the user to toggle the TX processing. */ - dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_TX; - dev->features = dev->hw_features | - NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM, + &dev->features);
err = register_netdev(dev); if (err < 0) {
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/aeroflex/greth.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index c560ad0..2c0fc81 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c @@ -914,7 +914,9 @@ static int greth_rx_gbit(struct net_device *dev, int limit)
skb_put(skb, pkt_len);
- if (dev->features & NETIF_F_RXCSUM && hw_checksummed(status)) + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features) && + hw_checksummed(status)) skb->ip_summed = CHECKSUM_UNNECESSARY; else skb_checksum_none_assert(skb); @@ -1483,9 +1485,11 @@ static int greth_of_probe(struct platform_device *ofdev) GRETH_REGSAVE(regs->status, 0xFF);
if (greth->gbit_mac) { - dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM; - dev->features = dev->hw_features | NETIF_F_HIGHDMA; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_RXCSUM, &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); greth_netdev_ops.ndo_start_xmit = greth_start_xmit_gbit; }
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/microsoft/mana/mana_en.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index fff7890..9f2d8eb 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -950,12 +950,14 @@ static void mana_rx_skb(void *buf_va, struct mana_rxcomp_oob *cqe, skb_checksum_none_assert(skb); skb_record_rx_queue(skb, rxq_idx);
- if ((ndev->features & NETIF_F_RXCSUM) && cqe->rx_iphdr_csum_succeed) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, ndev->features) && + cqe->rx_iphdr_csum_succeed) { if (cqe->rx_tcp_csum_succeed || cqe->rx_udp_csum_succeed) skb->ip_summed = CHECKSUM_UNNECESSARY; }
- if (cqe->rx_hashtype != 0 && (ndev->features & NETIF_F_RXHASH)) { + if (cqe->rx_hashtype != 0 && netdev_feature_test_bit(NETIF_F_RXHASH_BIT, + ndev->features)) { hash_value = cqe->ppi[0].pkt_hash;
if (cqe->rx_hashtype & MANA_HASH_L4) @@ -1790,12 +1792,14 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
netdev_lockdep_set_classes(ndev);
- ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - ndev->hw_features |= NETIF_F_RXCSUM; - ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; - ndev->hw_features |= NETIF_F_RXHASH; - ndev->features = ndev->hw_features; - ndev->vlan_features = 0; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->hw_features); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); + netdev_feature_copy(&ndev->features, ndev->hw_features); + netdev_feature_zero(&ndev->vlan_features);
err = register_netdev(ndev); if (err) {
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 31 +++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index fc99ad8..2f27418 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -1280,8 +1280,8 @@ myri10ge_vlan_rx(struct net_device *dev, void *addr, struct sk_buff *skb) va = addr; va += MXGEFW_PAD; veh = (struct vlan_ethhdr *)va; - if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) == - NETIF_F_HW_VLAN_CTAG_RX && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features) && veh->h_vlan_proto == htons(ETH_P_8021Q)) { /* fixup csum if needed */ if (skb->ip_summed == CHECKSUM_COMPLETE) { @@ -1359,7 +1359,7 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, int len, __wsum csum) skb->len = len; skb->data_len = len; skb->truesize += len; - if (dev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) { skb->ip_summed = CHECKSUM_COMPLETE; skb->csum = csum; } @@ -2884,9 +2884,12 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, struct sk_buff *segs, *curr, *next; struct myri10ge_priv *mgp = netdev_priv(dev); struct myri10ge_slice_state *ss; + netdev_features_t tmp; netdev_tx_t status;
- segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6); + netdev_feature_copy(&tmp, dev->features); + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, &tmp); + segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs)) goto drop;
@@ -3865,21 +3868,27 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->mtu = myri10ge_initial_mtu;
netdev->netdev_ops = &myri10ge_netdev_ops; - netdev->hw_features = mgp->features | NETIF_F_RXCSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(mgp->features | NETIF_F_RXCSUM, + &netdev->hw_features);
/* fake NETIF_F_HW_VLAN_CTAG_RX for good GRO performance */ - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + &netdev->hw_features);
- netdev->features = netdev->hw_features; + netdev_feature_copy(&netdev->features, netdev->hw_features);
if (dac_enabled) - netdev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + + netdev_feature_set_bits(mgp->features, &netdev->vlan_features);
- netdev->vlan_features |= mgp->features; if (mgp->fw_ver_tiny < 37) - netdev->vlan_features &= ~NETIF_F_TSO6; + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, + &netdev->vlan_features); if (mgp->fw_ver_tiny < 32) - netdev->vlan_features &= ~NETIF_F_TSO; + netdev_feature_clear_bit(NETIF_F_TSO_BIT, + &netdev->vlan_features);
/* make sure we can get an irq, and that MSI can be * setup (if available). */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/alacritech/slicoss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c index 696517e..9d0d007 100644 --- a/drivers/net/ethernet/alacritech/slicoss.c +++ b/drivers/net/ethernet/alacritech/slicoss.c @@ -1778,8 +1778,9 @@ static int slic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, dev); dev->irq = pdev->irq; dev->netdev_ops = &slic_netdev_ops; - dev->hw_features = NETIF_F_RXCSUM; - dev->features |= dev->hw_features; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_or(&dev->features, dev->features, dev->hw_features);
dev->ethtool_ops = &slic_ethtool_ops;
在 2021/8/11 22:46, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/alacritech/slicoss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c index 696517e..9d0d007 100644 --- a/drivers/net/ethernet/alacritech/slicoss.c +++ b/drivers/net/ethernet/alacritech/slicoss.c @@ -1778,8 +1778,9 @@ static int slic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, dev); dev->irq = pdev->irq; dev->netdev_ops = &slic_netdev_ops;
- dev->hw_features = NETIF_F_RXCSUM;
- dev->features |= dev->hw_features;
- netdev_feature_zero(&dev->hw_features);
it should be "dev->hw_features"
netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
netdev_feature_or(&dev->features, dev->features, dev->hw_features);
dev->ethtool_ops = &slic_ethtool_ops;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 14 +++++++++----- drivers/net/ethernet/toshiba/spider_net.c | 12 ++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index 55e6526..f502108 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -936,7 +936,7 @@ static void gelic_net_pass_skb_up(struct gelic_descr *descr, skb->protocol = eth_type_trans(skb, netdev);
/* checksum offload */ - if (netdev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features)) { if ((data_status & GELIC_DESCR_DATA_STATUS_CHK_MASK) && (!(data_error & GELIC_DESCR_DATA_ERROR_CHK_MASK))) skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -1461,11 +1461,14 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) int status; u64 v1, v2;
- netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, + &netdev->hw_features);
- netdev->features = NETIF_F_IP_CSUM; + netdev_feature_zero(&netdev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->features); if (GELIC_CARD_RX_CSUM_DEFAULT) - netdev->features |= NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features);
status = lv1_net_control(bus_id(card), dev_id(card), GELIC_LV1_GET_MAC_ADDRESS, @@ -1485,7 +1488,8 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) * As vlan is internally used, * we can not receive vlan packets */ - netdev->features |= NETIF_F_VLAN_CHALLENGED; + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, + &netdev->features); }
/* MTU range: 64 - 1518 */ diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index 087f0af..bbbdbe6d 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c @@ -963,7 +963,7 @@ spider_net_pass_skb_up(struct spider_net_descr *descr,
/* checksum offload */ skb_checksum_none_assert(skb); - if (netdev->features & NETIF_F_RXCSUM) { + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, netdev->features)) { if ( ( (data_status & SPIDER_NET_DATA_STATUS_CKSUM_MASK) == SPIDER_NET_DATA_STATUS_CKSUM_MASK) && !(data_error & SPIDER_NET_DATA_ERR_CKSUM_MASK)) @@ -2271,10 +2271,14 @@ spider_net_setup_netdev(struct spider_net_card *card)
spider_net_setup_netdev_ops(netdev);
- netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_IP_CSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM, + &netdev->hw_features); if (SPIDER_NET_RX_CSUM_DEFAULT) - netdev->features |= NETIF_F_RXCSUM; - netdev->features |= NETIF_F_IP_CSUM | NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_LLTX, + &netdev->features); + /* some time: NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | * NETIF_F_HW_VLAN_CTAG_FILTER */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/tehuti/tehuti.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index 8f6abae..d1df19e 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c @@ -1980,15 +1980,21 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* these fields are used for info purposes only * so we can have them same for all ports of the board */ ndev->if_port = port; - ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO - | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM - ; - ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_zero(&ndev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_RXCSUM, + &ndev->features); + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX, + &ndev->features);
if (pci_using_dac) - ndev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, + &ndev->features);
/************** priv ****************/ priv = nic->priv[port] = netdev_priv(ndev); @@ -2025,7 +2031,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * set multicast list callback has to use priv->tx_lock. */ #ifdef BDX_LLTX - ndev->features |= NETIF_F_LLTX; + netdev_feature_set_bit(NETIF_F_LLTX_BIT, &ndev->features); #endif /* MTU range: 60 - 16384 */ ndev->min_mtu = ETH_ZLEN;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/alteon/acenic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c index 9dc12b1..1e8a692 100644 --- a/drivers/net/ethernet/alteon/acenic.c +++ b/drivers/net/ethernet/alteon/acenic.c @@ -469,8 +469,9 @@ static int acenic_probe_one(struct pci_dev *pdev, ap->pdev = pdev; ap->name = pci_name(pdev);
- dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; - dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM, &dev->features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, &dev->features);
dev->watchdog_timeo = 5*HZ; dev->min_mtu = 0; @@ -590,7 +591,7 @@ static int acenic_probe_one(struct pci_dev *pdev, ap->name = dev->name;
if (ap->pci_using_dac) - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features);
pci_set_drvdata(pdev, dev);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/sgi/ioc3-eth.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c index 062f784..ee72fc5 100644 --- a/drivers/net/ethernet/sgi/ioc3-eth.c +++ b/drivers/net/ethernet/sgi/ioc3-eth.c @@ -397,7 +397,8 @@ static inline void ioc3_rx(struct net_device *dev) goto next; }
- if (likely(dev->features & NETIF_F_RXCSUM)) + if (likely(netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, + dev->features)) ioc3_tcpudp_checksum(skb, w0 & ERXBUF_IPCKSUM_MASK, len); @@ -926,8 +927,12 @@ static int ioc3eth_probe(struct platform_device *pdev) dev->watchdog_timeo = 5 * HZ; dev->netdev_ops = &ioc3_netdev_ops; dev->ethtool_ops = &ioc3_ethtool_ops; - dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM; - dev->features = NETIF_F_IP_CSUM | NETIF_F_HIGHDMA; + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, + &dev->hw_features); + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_HIGHDMA, + &dev->features);
sw_physid1 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID1); sw_physid2 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID2);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/ni/nixge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index 2d097dc..2098f3f 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -1271,7 +1271,8 @@ static int nixge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ndev); SET_NETDEV_DEV(ndev, &pdev->dev);
- ndev->features = NETIF_F_SG; + netdev_feature_zero(&ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); ndev->netdev_ops = &nixge_netdev_ops; ndev->ethtool_ops = &nixge_ethtool_ops;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/apm/xgene-v2/main.c | 5 ++--- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c index 860c18f..fabc904 100644 --- a/drivers/net/ethernet/apm/xgene-v2/main.c +++ b/drivers/net/ethernet/apm/xgene-v2/main.c @@ -648,14 +648,13 @@ static int xge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pdata); ndev->netdev_ops = &xgene_ndev_ops;
- ndev->features |= NETIF_F_GSO | - NETIF_F_GRO; + netdev_feature_set_bits(NETIF_F_GSO | NETIF_F_GRO, &ndev->features);
ret = xge_get_resources(pdata); if (ret) goto err;
- ndev->hw_features = ndev->features; + netdev_feature_copy(&ndev->hw_features, ndev->features); xge_set_ethtool_ops(ndev);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 5f1fc65..ed67bec 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -320,7 +320,8 @@ static int xgene_enet_work_msg(struct sk_buff *skb, u64 *hopinfo) unlikely(skb->protocol != htons(ETH_P_8021Q))) goto out;
- if (unlikely(!(skb->dev->features & NETIF_F_IP_CSUM))) + if (unlikely(!netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, + skb->dev->features))) goto out;
iph = ip_hdr(skb); @@ -331,7 +332,7 @@ static int xgene_enet_work_msg(struct sk_buff *skb, u64 *hopinfo) l4hlen = tcp_hdrlen(skb) >> 2; csum_enable = 1; proto = TSO_IPPROTO_TCP; - if (ndev->features & NETIF_F_TSO) { + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, ndev->features)) { hdr_len = ethhdr + ip_hdrlen(skb) + tcp_hdrlen(skb); mss = skb_shinfo(skb)->gso_size;
@@ -590,7 +591,7 @@ static void xgene_enet_rx_csum(struct sk_buff *skb) struct net_device *ndev = skb->dev; struct iphdr *iph = ip_hdr(skb);
- if (!(ndev->features & NETIF_F_RXCSUM)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, ndev->features)) return;
if (skb->protocol != htons(ETH_P_IP)) @@ -2032,10 +2033,11 @@ static int xgene_enet_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pdata); ndev->netdev_ops = &xgene_ndev_ops; xgene_enet_set_ethtool_ops(ndev); - ndev->features |= NETIF_F_IP_CSUM | - NETIF_F_GSO | - NETIF_F_GRO | - NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_IP_CSUM | + NETIF_F_GSO | + NETIF_F_GRO | + NETIF_F_SG, + &ndev->features);
of_id = of_match_device(xgene_enet_of_match, &pdev->dev); if (of_id) { @@ -2063,10 +2065,11 @@ static int xgene_enet_probe(struct platform_device *pdev) spin_lock_init(&pdata->mac_lock);
if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { - ndev->features |= NETIF_F_TSO | NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM, + &ndev->features); spin_lock_init(&pdata->mss_lock); } - ndev->hw_features = ndev->features; + netdev_feature_copy(&ndev->hw_features, ndev->features);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); if (ret) {
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/natsemi/ns83820.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c index 72794d1..ed2e9fe 100644 --- a/drivers/net/ethernet/natsemi/ns83820.c +++ b/drivers/net/ethernet/natsemi/ns83820.c @@ -2139,20 +2139,22 @@ static int ns83820_init_one(struct pci_dev *pci_dev, ns83820_getmac(dev, ndev->dev_addr);
/* Yes, we support dumb IP checksum on transmit */ - ndev->features |= NETIF_F_SG; - ndev->features |= NETIF_F_IP_CSUM; + netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features);
ndev->min_mtu = 0;
#ifdef NS83820_VLAN_ACCEL_SUPPORT /* We also support hardware vlan acceleration */ - ndev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &ndev->features); #endif
if (using_dac) { printk(KERN_INFO "%s: using 64 bit addressing.\n", ndev->name); - ndev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); }
printk(KERN_INFO "%s: ns83820 v" VERSION ": DP83820 v%u.%u: %pM io=0x%08lx irq=%d f=%s\n", @@ -2160,7 +2162,8 @@ static int ns83820_init_one(struct pci_dev *pci_dev, (unsigned)readl(dev->base + SRR) >> 8, (unsigned)readl(dev->base + SRR) & 0xff, ndev->dev_addr, addr, pci_dev->irq, - (ndev->features & NETIF_F_HIGHDMA) ? "h,sg" : "sg" + netdev_feature_test_bit(NETIF_F_HIGHDMA_BIT, + ndev->features) ? "h,sg" : "sg" );
#ifdef PHY_CODE_IS_FINISHED
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/pasemi/pasemi_mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index 040a15a..908ecef 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c @@ -1699,8 +1699,10 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64);
- dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG | - NETIF_F_HIGHDMA | NETIF_F_GSO; + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG | + NETIF_F_HIGHDMA | NETIF_F_GSO, + &dev->features);
mac->dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL); if (!mac->dma_pdev) {
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/rocker/rocker_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 53d407a..631ec69 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2589,7 +2589,8 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number) NAPI_POLL_WEIGHT); rocker_carrier_init(rocker_port);
- dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_SG, + &dev->features);
/* MTU range: 68 - 9000 */ dev->min_mtu = ROCKER_PORT_MIN_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/silan/sc92031.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/silan/sc92031.c b/drivers/net/ethernet/silan/sc92031.c index 1fd08a0..ad8aa98 100644 --- a/drivers/net/ethernet/silan/sc92031.c +++ b/drivers/net/ethernet/silan/sc92031.c @@ -1436,8 +1436,10 @@ static int sc92031_probe(struct pci_dev *pdev, const struct pci_device_id *id) SET_NETDEV_DEV(dev, &pdev->dev);
/* faked with skb_copy_and_csum_dev */ - dev->features = NETIF_F_SG | NETIF_F_HIGHDMA | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &dev->features);
dev->netdev_ops = &sc92031_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/adaptec/starfire.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c index e0f6cc9..a9dcdad 100644 --- a/drivers/net/ethernet/adaptec/starfire.c +++ b/drivers/net/ethernet/adaptec/starfire.c @@ -684,14 +684,17 @@ static int starfire_init_one(struct pci_dev *pdev, #ifdef ZEROCOPY /* Starfire can do TCP/UDP checksumming */ if (enable_hw_cksum) - dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, + &dev->features); #endif /* ZEROCOPY */
#ifdef VLAN_SUPPORT - dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &dev->features); #endif /* VLAN_RX_KILL_VID */ #ifdef ADDR_64BITS - dev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); #endif /* ADDR_64BITS */
/* Serial EEPROM reads are hidden by the hardware. */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/tundra/tsi108_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c index cf0917b..3ab07ea 100644 --- a/drivers/net/ethernet/tundra/tsi108_eth.c +++ b/drivers/net/ethernet/tundra/tsi108_eth.c @@ -1609,7 +1609,8 @@ tsi108_init_one(struct platform_device *pdev) * a new function skb_csum_dev() in net/core/skbuff.c). */
- dev->features = NETIF_F_HIGHDMA; + netdev_feature_zero(&dev->features); + netdev_feature_set_bits(NETIF_F_HIGHDMA_BIT, &dev->features);
spin_lock_init(&data->txlock); spin_lock_init(&data->misclock);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/via/via-rhine.c | 10 ++++++---- drivers/net/ethernet/via/via-velocity.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 961b623..952ce5e 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c @@ -966,12 +966,14 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks, netif_napi_add(dev, &rp->napi, rhine_napipoll, 64);
if (rp->quirks & rqRhineI) - dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, + &dev->features);
if (rp->quirks & rqMgmt) - dev->features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER; + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER, + &dev->features);
/* dev->name not defined before register_netdev()! */ rc = register_netdev(dev); diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 278f495..f8b4af1 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -2847,11 +2847,15 @@ static int velocity_probe(struct device *dev, int irq, netif_napi_add(netdev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT);
- netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_HW_VLAN_CTAG_TX; - netdev->features |= NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_IP_CSUM; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | + NETIF_F_HW_VLAN_CTAG_TX, + &netdev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_IP_CSUM, + &netdev->features);
/* MTU range: 64 - 9000 */ netdev->min_mtu = VELOCITY_MIN_MTU;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c index 811815f..54adf51 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c @@ -1134,7 +1134,7 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops, /* This chip doesn't support VLAN packets with normal MTU, * so disable VLAN for this device. */ - ndev->features |= NETIF_F_VLAN_CHALLENGED; + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &ndev->features);
err = register_netdev(ndev); if (err < 0) diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c index 46aae30..fe2b05e 100644 --- a/drivers/net/ethernet/wiznet/w5300.c +++ b/drivers/net/ethernet/wiznet/w5300.c @@ -608,7 +608,7 @@ static int w5300_probe(struct platform_device *pdev) /* This chip doesn't support VLAN packets with normal MTU, * so disable VLAN for this device. */ - ndev->features |= NETIF_F_VLAN_CHALLENGED; + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &ndev->features);
err = register_netdev(ndev); if (err < 0)
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/dnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c index 6c51cf9..70bfa91 100644 --- a/drivers/net/ethernet/dnet.c +++ b/drivers/net/ethernet/dnet.c @@ -763,7 +763,7 @@ static int dnet_probe(struct platform_device *pdev) return -ENOMEM;
/* TODO: Actually, we have some interesting features... */ - dev->features |= 0; + netdev_feature_set_bits(0, &dev->features);
bp = netdev_priv(dev); bp->dev = dev;
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/infiniband/ulp/ipoib/ipoib_main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 488d50a..5fd0b7a 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -220,7 +220,8 @@ static void ipoib_fix_features(struct net_device *dev, struct ipoib_dev_priv *priv = ipoib_priv(dev);
if (test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags)) - *features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO); + netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_TSO, + features); }
static int ipoib_change_mtu(struct net_device *dev, int new_mtu) @@ -1849,12 +1850,15 @@ static void ipoib_set_dev_features(struct ipoib_dev_priv *priv) priv->hca_caps = priv->ca->attrs.device_cap_flags;
if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) { - priv->dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM; + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, + &priv->dev->hw_features);
if (priv->hca_caps & IB_DEVICE_UD_TSO) - priv->dev->hw_features |= NETIF_F_TSO; + netdev_feature_set_bit(NETIF_F_TSO_BIT, + &priv->dev->hw_features);
- priv->dev->features |= priv->dev->hw_features; + netdev_feature_or(&priv->dev->features, priv->dev->features, + priv->dev->hw_features); } }
@@ -2117,8 +2121,8 @@ void ipoib_setup_common(struct net_device *dev) dev->addr_len = INFINIBAND_ALEN; dev->type = ARPHRD_INFINIBAND; dev->tx_queue_len = ipoib_sendq_size * 2; - dev->features = (NETIF_F_VLAN_CHALLENGED | - NETIF_F_HIGHDMA); + netdev_feature_set_bits(NETIF_F_VLAN_CHALLENGED | + NETIF_F_HIGHDMA, &dev->features); netif_keep_dst(dev);
memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- arch/um/drivers/vector_kern.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index cf3e781..f0ad82b 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -1345,7 +1345,8 @@ static void vector_net_tx_timeout(struct net_device *dev, unsigned int txqueue) static void vector_fix_features(struct net_device *dev, netdev_features_t *features) { - *features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); + netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, + &features); }
static int vector_set_features(struct net_device *dev, @@ -1356,7 +1357,7 @@ static int vector_set_features(struct net_device *dev, * no way to negotiate it on raw sockets, so we can change * only our side. */ - if (features & NETIF_F_GRO) + if (netdev_feature_test_bit(NETIF_F_GRO_BIT, features)) /* All new frame buffers will be GRO-sized */ vp->req_size = 65536; else @@ -1626,7 +1627,10 @@ static void vector_eth_configure( .bpf = NULL });
- dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST); + netdev_feature_zero(&dev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, + &dev->hw_features); + netdev_feature_copy(&dev->features, dev->hw_features); tasklet_setup(&vp->tx_poll, vector_tx_poll); INIT_WORK(&vp->reset_tx, vector_reset_tx);
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/staging/qlge/qlge_main.c | 59 +++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 8fcdf89..443d23e 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -386,7 +386,8 @@ static int qlge_set_mac_addr_reg(struct qlge_adapter *qdev, u8 *addr, u32 type, cam_output = (CAM_OUT_ROUTE_NIC | (qdev->func << CAM_OUT_FUNC_SHIFT) | (0 << CAM_OUT_CQ_ID_SHIFT)); - if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + qdev->ndev->features)) cam_output |= CAM_OUT_RV; /* route to NIC core */ qlge_write32(qdev, MAC_ADDR_DATA, cam_output); @@ -1399,7 +1400,8 @@ static void qlge_update_mac_hdr_len(struct qlge_adapter *qdev, { u16 *tags;
- if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + qdev->ndev->features)) return; if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) { tags = (u16 *)page; @@ -1514,7 +1516,7 @@ static void qlge_process_mac_rx_page(struct qlge_adapter *qdev, skb->protocol = eth_type_trans(skb, ndev); skb_checksum_none_assert(skb);
- if ((ndev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, ndev->features) && !(ib_mac_rsp->flags1 & IB_MAC_CSUM_ERR_MASK)) { /* TCP frame. */ if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_T) { @@ -1621,7 +1623,7 @@ static void qlge_process_mac_rx_skb(struct qlge_adapter *qdev, /* If rx checksum is on, and there are no * csum or frame errors. */ - if ((ndev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, ndev->features) && !(ib_mac_rsp->flags1 & IB_MAC_CSUM_ERR_MASK)) { /* TCP frame. */ if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_T) { @@ -1908,7 +1910,7 @@ static void qlge_process_mac_split_rx_intr(struct qlge_adapter *qdev, /* If rx checksum is on, and there are no * csum or frame errors. */ - if ((ndev->features & NETIF_F_RXCSUM) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, ndev->features) && !(ib_mac_rsp->flags1 & IB_MAC_CSUM_ERR_MASK)) { /* TCP frame. */ if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_T) { @@ -1947,7 +1949,8 @@ static unsigned long qlge_process_mac_rx_intr(struct qlge_adapter *qdev, { u32 length = le32_to_cpu(ib_mac_rsp->data_len); u16 vlan_id = ((ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) && - (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX)) ? + netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + qdev->ndev->features)) ? ((le16_to_cpu(ib_mac_rsp->vlan_id) & IB_MAC_IOCB_RSP_VLAN_MASK)) : 0xffff;
@@ -2227,7 +2230,7 @@ static void qlge_vlan_mode(struct net_device *ndev, netdev_features_t features) { struct qlge_adapter *qdev = netdev_to_qdev(ndev);
- if (features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) { qlge_write32(qdev, NIC_RCV_CFG, NIC_RCV_CFG_VLAN_MASK | NIC_RCV_CFG_VLAN_MATCH_AND_NON); } else { @@ -2256,7 +2259,7 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, }
/* update the features with resent change */ - ndev->features = features; + netdev_feature_copy(&ndev->features, features);
if (need_restart) { status = qlge_adapter_up(qdev); @@ -2273,10 +2276,12 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, static int qlge_set_features(struct net_device *ndev, netdev_features_t features) { - netdev_features_t changed = ndev->features ^ features; + netdev_features_t changed; int err;
- if (changed & NETIF_F_HW_VLAN_CTAG_RX) { + netdev_feature_xor(&changed, ndev->features, features); + + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { /* Update the behavior of vlan accel in the adapter */ err = qlge_update_hw_vlan_features(ndev, features); if (err) @@ -3575,7 +3580,8 @@ static int qlge_adapter_initialize(struct qlge_adapter *qdev) /* Set the default queue, and VLAN behavior. */ value = NIC_RCV_CFG_DFQ; mask = NIC_RCV_CFG_DFQ_MASK; - if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX) { + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + qdev->ndev->features)) { value |= NIC_RCV_CFG_RV; mask |= (NIC_RCV_CFG_RV << 16); } @@ -4571,23 +4577,26 @@ static int qlge_probe(struct pci_dev *pdev, goto netdev_free;
SET_NETDEV_DEV(ndev, &pdev->dev); - ndev->hw_features = NETIF_F_SG | - NETIF_F_IP_CSUM | - NETIF_F_TSO | - NETIF_F_TSO_ECN | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_RXCSUM; - ndev->features = ndev->hw_features; - ndev->vlan_features = ndev->hw_features; + netdev_feature_zero(&ndev->hw_features); + netdev_feature_set_bits(NETIF_F_SG | + NETIF_F_IP_CSUM | + NETIF_F_TSO | + NETIF_F_TSO_ECN | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_RXCSUM, + &ndev->hw_features); + netdev_feature_copy(&ndev->features, ndev->hw_features); + netdev_feature_copy(&ndev->vlan_features, ndev->hw_features); /* vlan gets same features (except vlan filter) */ - ndev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX); + netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_FILTER | + NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX, + &ndev->vlan_features);
if (test_bit(QL_DMA64, &qdev->flags)) - ndev->features |= NETIF_F_HIGHDMA; + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features);
/* * Set up net_device structure.
Add helper sk_nocaps_add_gso, to avoid declare netdev_features_t anyware.
Signed-off-by: Jian Shen shenjian15@huawei.com --- include/net/sock.h | 9 +++++++++ net/ipv4/tcp_ipv4.c | 4 ++-- net/ipv4/tcp_output.c | 2 +- net/ipv6/ip6_output.c | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h index 01f38c5..1baceb0 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2065,6 +2065,15 @@ static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) netdev_feature_andnot(&sk->sk_route_caps, sk->sk_route_caps, flags); }
+static inline void sk_nocaps_add_gso(struct sock *sk) +{ + netdev_features_t gso_flags; + + netdev_feature_zero(&gso_flags); + netdev_feature_set_bits(NETIF_F_GSO_MASK, &gso_flags); + sk_nocaps_add(sk, gso_flags); +} + static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, struct iov_iter *from, char *to, int copy, int offset) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 60f9ef0..f5a8b66 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1164,7 +1164,7 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, if (!md5sig) return -ENOMEM;
- sk_nocaps_add(sk, NETIF_F_GSO_MASK); + sk_nocaps_add_gso(sk); INIT_HLIST_HEAD(&md5sig->head); rcu_assign_pointer(tp->md5sig_info, md5sig); } @@ -1598,7 +1598,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, */ tcp_md5_do_add(newsk, addr, AF_INET, 32, l3index, key->key, key->keylen, GFP_ATOMIC); - sk_nocaps_add(newsk, NETIF_F_GSO_MASK); + sk_nocaps_add_gso(newsk); } #endif
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 29553fc..50ad159 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1362,7 +1362,7 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, #ifdef CONFIG_TCP_MD5SIG /* Calculate the MD5 hash, as we have all we need now */ if (md5) { - sk_nocaps_add(sk, NETIF_F_GSO_MASK); + sk_nocaps_add_gso(sk); tp->af_specific->calc_md5_hash(opts.hash_location, md5, sk, skb); } diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 78e01d4..c7e0600 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -977,7 +977,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
fail_toobig: if (skb->sk && dst_allfrag(skb_dst(skb))) - sk_nocaps_add(skb->sk, NETIF_F_GSO_MASK); + sk_nocaps_add_gso(skb->sk);
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); err = -EMSGSIZE;
Introduce macro __DECLARE_NETDEV_FEATURE_MASK for declare netdev_features_t. In the next patch, the macro will be replaced by DECLARE_BITMAP(name, NETDEV_FEATURE_COUNT).
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/bonding/bond_main.c | 20 ++++++++++---------- drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe.h | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 2 +- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- drivers/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 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 4 ++-- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- drivers/net/ethernet/broadcom/tg3.c | 6 +++--- drivers/net/ethernet/brocade/bna/bnad.c | 2 +- drivers/net/ethernet/cadence/macb_main.c | 4 ++-- drivers/net/ethernet/calxeda/xgmac.c | 2 +- drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 2 +- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 2 +- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 4 ++-- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 2 +- drivers/net/ethernet/davicom/dm9000.c | 2 +- drivers/net/ethernet/faraday/ftgmac100.c | 2 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +- drivers/net/ethernet/freescale/enetc/enetc.c | 2 +- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 4 ++-- drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +- drivers/net/ethernet/google/gve/gve_main.c | 2 +- drivers/net/ethernet/google/gve/gve_rx.c | 2 +- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/huawei/hinic/hinic_main.c | 4 ++-- drivers/net/ethernet/ibm/ibmvnic.c | 4 ++-- drivers/net/ethernet/intel/e100.c | 2 +- drivers/net/ethernet/intel/e1000/e1000_main.c | 2 +- drivers/net/ethernet/intel/e1000e/netdev.c | 2 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- drivers/net/ethernet/intel/iavf/iavf_main.c | 6 +++--- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++---- drivers/net/ethernet/intel/igb/igb_main.c | 2 +- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ++-- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +++--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +- drivers/net/ethernet/marvell/sky2.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++-- drivers/net/ethernet/mscc/ocelot_net.c | 2 +- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 2 +- drivers/net/ethernet/neterion/s2io.c | 2 +- drivers/net/ethernet/neterion/vxge/vxge-main.c | 4 ++-- drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 +- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 4 ++-- drivers/net/ethernet/nvidia/forcedeth.c | 2 +- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 2 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- drivers/net/ethernet/qlogic/qede/qede.h | 2 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 4 ++-- drivers/net/ethernet/qualcomm/emac/emac.c | 2 +- drivers/net/ethernet/realtek/8139too.c | 2 +- drivers/net/ethernet/renesas/ravb_main.c | 2 +- drivers/net/ethernet/renesas/sh_eth.c | 2 +- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 2 +- drivers/net/ethernet/sfc/ef10.c | 4 ++-- drivers/net/ethernet/sfc/ef100_nic.c | 2 +- drivers/net/ethernet/sfc/efx.c | 2 +- drivers/net/ethernet/sfc/efx_common.c | 4 ++-- drivers/net/ethernet/sfc/falcon/efx.c | 4 ++-- drivers/net/ethernet/sfc/falcon/net_driver.h | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 2 +- drivers/net/ethernet/sfc/net_driver.h | 2 +- drivers/net/ethernet/sun/sunvnet_common.c | 2 +- drivers/net/ethernet/synopsys/dwc-xlgmac.h | 2 +- drivers/net/hyperv/netvsc_drv.c | 2 +- drivers/net/hyperv/rndis_filter.c | 2 +- drivers/net/ipvlan/ipvlan.h | 2 +- drivers/net/ipvlan/ipvlan_main.c | 2 +- drivers/net/macsec.c | 2 +- drivers/net/macvlan.c | 5 +++-- drivers/net/net_failover.c | 8 ++++---- drivers/net/tap.c | 6 +++--- drivers/net/team/team.c | 10 +++++----- drivers/net/tun.c | 6 +++--- drivers/net/usb/ax88179_178a.c | 2 +- drivers/net/usb/r8152.c | 4 ++-- drivers/net/veth.c | 2 +- drivers/net/virtio_net.c | 2 +- drivers/net/vmxnet3/vmxnet3_ethtool.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 2 +- drivers/net/xen-netfront.c | 2 +- drivers/s390/net/qeth_core_main.c | 2 +- drivers/staging/qlge/qlge_main.c | 2 +- include/linux/if_macvlan.h | 2 +- include/linux/if_tap.h | 2 +- include/linux/netdev_features.h | 3 +++ include/linux/netdevice.h | 18 +++++++++--------- include/net/mac80211.h | 2 +- include/net/sock.h | 8 ++++---- include/net/udp.h | 2 +- lib/test_bpf.c | 2 +- net/8021q/vlan_dev.c | 6 +++--- net/bridge/br_if.c | 2 +- net/core/dev.c | 16 ++++++++-------- net/core/netpoll.c | 2 +- net/ethtool/features.c | 2 +- net/ethtool/ioctl.c | 6 +++--- net/hsr/hsr_device.c | 2 +- net/ipv4/esp4_offload.c | 2 +- net/ipv4/ip_output.c | 2 +- net/ipv4/tcp_offload.c | 2 +- net/ipv6/esp6_offload.c | 2 +- net/ipv6/ip6_output.c | 2 +- net/mac80211/iface.c | 2 +- net/mac80211/main.c | 2 +- net/sched/sch_cake.c | 2 +- net/sched/sch_netem.c | 2 +- net/sched/sch_taprio.c | 2 +- net/sched/sch_tbf.c | 2 +- 125 files changed, 198 insertions(+), 193 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 785b12c..fb1ad49 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1359,8 +1359,8 @@ static void bond_fix_features(struct net_device *dev, netdev_features_t *features) { struct bonding *bond = netdev_priv(dev); + __DECLARE_NETDEV_FEATURE_MASK(mask); struct list_head *iter; - netdev_features_t mask; struct slave *slave;
#if IS_ENABLED(CONFIG_TLS_DEVICE) @@ -1397,16 +1397,16 @@ static void bond_compute_features(struct bonding *bond) { unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; - netdev_features_t vlan_features; - netdev_features_t enc_features; - netdev_features_t vlan_mask; - netdev_features_t enc_mask; + __DECLARE_NETDEV_FEATURE_MASK(vlan_features); + __DECLARE_NETDEV_FEATURE_MASK(enc_features); + __DECLARE_NETDEV_FEATURE_MASK(vlan_mask); + __DECLARE_NETDEV_FEATURE_MASK(enc_mask); #ifdef CONFIG_XFRM_OFFLOAD - netdev_features_t xfrm_features; - netdev_features_t xfrm_mask; + __DECLARE_NETDEV_FEATURE_MASK(xfrm_features); + __DECLARE_NETDEV_FEATURE_MASK(xfrm_mask); #endif /* CONFIG_XFRM_OFFLOAD */ - netdev_features_t mpls_features; - netdev_features_t mpls_mask; + __DECLARE_NETDEV_FEATURE_MASK(mpls_features); + __DECLARE_NETDEV_FEATURE_MASK(mpls_mask); struct net_device *bond_dev = bond->dev; struct list_head *iter; struct slave *slave; @@ -2291,10 +2291,10 @@ static int __bond_release_one(struct net_device *bond_dev, bool all, bool unregister) { struct bonding *bond = netdev_priv(bond_dev); + __DECLARE_NETDEV_FEATURE_MASK(old_features); struct slave *slave, *oldcurrent; struct sockaddr_storage ss; int old_flags = bond_dev->flags; - netdev_features_t old_features;
netdev_feature_copy(&old_features, bond_dev->features); /* slave is not a slave or master is not master of this slave */ diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 3bbf12b..3eda740 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -4026,7 +4026,7 @@ static u32 ena_calc_max_io_queue_num(struct pci_dev *pdev, static void ena_set_dev_offloads(struct ena_com_dev_get_features_ctx *feat, struct net_device *netdev) { - netdev_features_t dev_features; + __DECLARE_NETDEV_FEATURE_MASK(dev_features);
netdev_feature_zero(&dev_features);
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index cbf23e0..1caffe1 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2186,7 +2186,7 @@ static void xgbe_fix_features(struct net_device *netdev, netdev_features_t *features) { struct xgbe_prv_data *pdata = netdev_priv(netdev); - netdev_features_t vxlan_base; + __DECLARE_NETDEV_FEATURE_MASK(vxlan_base);
netdev_feature_zero(&vxlan_base); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h index 3305979..7355056 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h @@ -1170,7 +1170,7 @@ struct xgbe_prv_data {
/* Netdev related settings */ unsigned char mac_addr[ETH_ALEN]; - netdev_features_t netdev_features; + __DECLARE_NETDEV_FEATURE_MASK(netdev_features); struct napi_struct napi; struct xgbe_mmc_stats mmc_stats; struct xgbe_ext_stats ext_stats; diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h index 685adb5..a1047df 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h @@ -38,7 +38,7 @@ struct aq_fc_info {
struct aq_nic_cfg_s { const struct aq_hw_caps_s *aq_hw_caps; - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); u32 rxds; /* rx ring size, descriptors # */ u32 txds; /* tx ring size, descriptors # */ u32 vecs; /* allocated rx/tx vectors */ diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index db6784c..86f8e88 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -530,7 +530,7 @@ static void atl1c_fix_features(struct net_device *netdev, static int atl1c_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, netdev->features, features);
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index a37d08c..5502fc9 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -399,7 +399,7 @@ static void atl1e_fix_features(struct net_device *netdev, static int atl1e_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index 2db6936..943f2af 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c @@ -388,7 +388,7 @@ static void atl2_fix_features(struct net_device *netdev, static int atl2_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index 6e91bf6..ea5b6d7 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c @@ -254,7 +254,7 @@ static void atlx_fix_features(struct net_device *netdev, static int atlx_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index c7b8b5a..c26e418 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -7745,7 +7745,7 @@ static int bnx2_set_features(struct net_device *dev, netdev_features_t features) { struct bnx2 *bp = netdev_priv(dev); - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
/* TSO with VLAN tag won't work with current firmware */ if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) { diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 6b3a37d..30c8ea6 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -4906,7 +4906,7 @@ void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) struct bnx2x *bp = netdev_priv(dev);
if (pci_num_vf(bp->pdev)) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, *features);
@@ -4944,8 +4944,8 @@ void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features)
int bnx2x_set_features(struct net_device *dev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(changes); struct bnx2x *bp = netdev_priv(dev); - netdev_features_t changes; bool bnx2x_reload = false; int rc;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3d907bb..a43ee06 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10922,7 +10922,8 @@ static bool bnxt_rfs_capable(struct bnxt *bp) static void bnxt_fix_features(struct net_device *dev, netdev_features_t *features) { - netdev_features_t vlan_features, tmp; + __DECLARE_NETDEV_FEATURE_MASK(vlan_features); + __DECLARE_NETDEV_FEATURE_MASK(tmp); struct bnxt *bp = netdev_priv(dev);
if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) && diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 7abbae3..3fcacec 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -7864,8 +7864,8 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi, struct netdev_queue *txq, struct sk_buff *skb) { u32 frag_cnt_est = skb_shinfo(skb)->gso_segs * 3; + __DECLARE_NETDEV_FEATURE_MASK(tmp); struct sk_buff *segs, *seg, *next; - netdev_features_t tmp;
/* Estimate the number of fragments in the worst case */ if (unlikely(tg3_tx_avail(tnapi) <= frag_cnt_est)) { @@ -8319,7 +8319,7 @@ static void tg3_fix_features(struct net_device *dev,
static int tg3_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && @@ -17611,13 +17611,13 @@ static void tg3_init_coal(struct tg3 *tp) static int tg3_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct net_device *dev; struct tg3 *tp; int i, err; u32 sndmbx, rcvmbx, intmbx; char str[40]; u64 dma_mask, persist_dma_mask; - netdev_features_t features;
netdev_feature_zero(&features);
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 2e51cf6..ed630ce 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -3351,8 +3351,8 @@ bnad_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
static int bnad_set_features(struct net_device *dev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(changed); struct bnad *bnad = netdev_priv(dev); - netdev_features_t changed;
netdev_feature_xor(&changed, features, dev->features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed) && diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 8c39bc5..c7c8fb0 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3631,8 +3631,8 @@ static inline void macb_set_rxflow_feature(struct macb *bp, static int macb_set_features(struct net_device *netdev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(changed); struct macb *bp = netdev_priv(netdev); - netdev_features_t changed;
netdev_feature_xor(&changed, features, netdev->features);
@@ -3653,9 +3653,9 @@ static int macb_set_features(struct net_device *netdev,
static void macb_restore_features(struct macb *bp) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct net_device *netdev = bp->dev; struct ethtool_rx_fs_item *item; - netdev_features_t features;
netdev_feature_copy(&features, netdev->features);
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index 1079252..3679fed 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c @@ -1490,8 +1490,8 @@ static int xgmac_set_features(struct net_device *dev, netdev_features_t features { u32 ctrl; struct xgmac_priv *priv = netdev_priv(dev); + __DECLARE_NETDEV_FEATURE_MASK(changed); void __iomem *ioaddr = priv->base; - netdev_features_t changed;
netdev_feature_xor(&changed, dev->features, features);
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index e5f242e..c0112f9 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -1854,8 +1854,8 @@ static void liquidio_fix_features(struct net_device *netdev, static int liquidio_set_features(struct net_device *netdev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(changed); struct lio *lio = netdev_priv(netdev); - netdev_features_t changed;
netdev_feature_xor(&changed, netdev->features, features); if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 2887d71..87bfd04 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1788,7 +1788,7 @@ static int nicvf_set_features(struct net_device *netdev, netdev_features_t features) { struct nicvf *nic = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index 6847867..e13455e 100644 --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c @@ -871,7 +871,7 @@ static void t1_fix_features(struct net_device *dev, netdev_features_t *features) static int t1_set_features(struct net_device *dev, netdev_features_t features) { struct adapter *adapter = dev->ml_priv; - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 36403ce..01b0ff1 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -2611,7 +2611,7 @@ static void cxgb_fix_features(struct net_device *dev,
static int cxgb_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) @@ -3216,9 +3216,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int i, err, pci_using_dac = 0; resource_size_t mmio_start, mmio_len; + __DECLARE_NETDEV_FEATURE_MASK(tmp); const struct adapter_info *ai; struct adapter *adapter = NULL; - netdev_features_t tmp; struct port_info *pi;
if (!cxgb3_wq) { diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 8d0e00f..c80cb72 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1274,7 +1274,7 @@ int cxgb4_set_rspq_intr_params(struct sge_rspq *q, static int cxgb_set_features(struct net_device *dev, netdev_features_t features) { const struct port_info *pi = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
netdev_feature_xor(&changed, dev->features, features); diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index a59b0cf..a41f04f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -1191,7 +1191,7 @@ static int cxgb4vf_set_features(struct net_device *dev, netdev_features_t features) { struct port_info *pi = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index cf34956..8e4ca68 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -586,7 +586,7 @@ static int dm9000_set_features(struct net_device *dev, netdev_features_t features) { struct board_info *dm = to_dm9000_board(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); unsigned long flags;
netdev_feature_xor(&changed, dev->features, features); diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 0ca939e..8552bba 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1582,7 +1582,7 @@ static int ftgmac100_set_features(struct net_device *netdev, netdev_features_t features) { struct ftgmac100 *priv = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
if (!netif_running(netdev)) return 0; diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 1f072eb..39f762c 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -2142,7 +2142,7 @@ static int dpaa2_eth_set_features(struct net_device *net_dev, netdev_features_t features) { struct dpaa2_eth_priv *priv = netdev_priv(net_dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); bool enable; int err;
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index c114fe1..b0b4778 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2357,7 +2357,7 @@ static void enetc_enable_txvlan(struct net_device *ndev, bool en) int enetc_set_features(struct net_device *ndev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int err = 0;
netdev_feature_xor(&changed, ndev->features, features); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index 3432d31..ce17652 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -705,7 +705,7 @@ static int enetc_pf_set_features(struct net_device *ndev, netdev_features_t features) { struct enetc_ndev_priv *priv = netdev_priv(ndev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, ndev->features, features);
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index dd5881e..51d30f8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3369,7 +3369,7 @@ static inline void fec_enet_set_netdev_features(struct net_device *netdev, netdev_features_t features) { struct fec_enet_private *fep = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features); netdev_feature_copy(&netdev->features, features); @@ -3387,7 +3387,7 @@ static int fec_set_features(struct net_device *netdev, netdev_features_t features) { struct fec_enet_private *fep = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index ee85e48..e6395f1 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -500,7 +500,7 @@ static int gfar_spauseparam(struct net_device *dev, int gfar_set_features(struct net_device *dev, netdev_features_t features) { struct gfar_private *priv = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int err = 0;
netdev_feature_xor(&changed, dev->features, features); diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 9baa48f..8984a87 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -1113,8 +1113,8 @@ static void gve_tx_timeout(struct net_device *dev, unsigned int txqueue) static int gve_set_features(struct net_device *netdev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(orig_features); struct gve_priv *priv = netdev_priv(netdev); - netdev_features_t orig_features; int err;
netdev_feature_copy(&orig_features, netdev->features); diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c index d76e89a..f91387e 100644 --- a/drivers/net/ethernet/google/gve/gve_rx.c +++ b/drivers/net/ethernet/google/gve/gve_rx.c @@ -587,8 +587,8 @@ bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget,
bool gve_rx_poll(struct gve_notify_block *block, int budget) { + __DECLARE_NETDEV_FEATURE_MASK(feat); struct gve_rx_ring *rx = block->rx; - netdev_features_t feat; bool repoll = false;
netdev_feature_copy(&feat, block->napi.dev->features); diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c index 8e55d11..90ac50d 100644 --- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c +++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c @@ -663,7 +663,7 @@ static int gve_rx_complete_skb(struct gve_rx_ring *rx, struct napi_struct *napi, int gve_rx_poll_dqo(struct gve_notify_block *block, int budget) { struct napi_struct *napi = &block->napi; - netdev_features_t feat; + __DECLARE_NETDEV_FEATURE_MASK(feat);
struct gve_rx_ring *rx = block->rx; struct gve_rx_compl_queue_dqo *complq = &rx->dqo.complq; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index b113c70..4e74a02 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2312,7 +2312,7 @@ static int hns3_nic_set_features(struct net_device *netdev, { struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = priv->ae_handle; - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); bool enable; int ret;
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 244f265..196462c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -1079,9 +1079,9 @@ static int set_features(struct hinic_dev *nic_dev, netdev_features_t pre_features, netdev_features_t features, bool force_change) { + __DECLARE_NETDEV_FEATURE_MASK(failed_features); + __DECLARE_NETDEV_FEATURE_MASK(changed); u32 csum_en = HINIC_RX_CSUM_OFFLOAD_EN; - netdev_features_t failed_features; - netdev_features_t changed; int ret = 0; int err = 0;
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 5bf74aa..1ced5c7 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -4320,8 +4320,8 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) { struct ibmvnic_control_ip_offload_buffer *ctrl_buf = &adapter->ip_offload_ctrl; struct ibmvnic_query_ip_offload_buffer *buf = &adapter->ip_offload_buf; + __DECLARE_NETDEV_FEATURE_MASK(old_hw_features); struct device *dev = &adapter->vdev->dev; - netdev_features_t old_hw_features; union ibmvnic_crq crq;
adapter->ip_offload_ctrl_tok = @@ -4385,7 +4385,7 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) adapter->netdev->hw_features); } else if (!netdev_feature_equal(old_hw_features, adapter->netdev->hw_features)) { - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_zero(&tmp);
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index abec49f..4208d8f 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -2794,8 +2794,8 @@ static int e100_close(struct net_device *netdev) static int e100_set_features(struct net_device *netdev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(changed); struct nic *nic = netdev_priv(netdev); - netdev_features_t changed;
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index f17057a..c9406d9 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -804,7 +804,7 @@ static int e1000_set_features(struct net_device *netdev, netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index a299f27..4e36331 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -7328,7 +7328,7 @@ static int e1000_set_features(struct net_device *netdev, netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c index e3747f3..dbefa24 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c @@ -1540,7 +1540,7 @@ static const struct net_device_ops fm10k_netdev_ops = {
struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) { - netdev_features_t hw_features; + __DECLARE_NETDEV_FEATURE_MASK(hw_features); struct fm10k_intfc *interface; struct net_device *dev;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index fd81fd0..be4f636 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -13310,6 +13310,8 @@ static const struct net_device_ops i40e_netdev_ops = { **/ static int i40e_config_netdev(struct i40e_vsi *vsi) { + __DECLARE_NETDEV_FEATURE_MASK(hw_enc_features); + __DECLARE_NETDEV_FEATURE_MASK(hw_features); struct i40e_pf *pf = vsi->back; struct i40e_hw *hw = &pf->hw; struct i40e_netdev_priv *np; @@ -13317,8 +13319,6 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) u8 broadcast[ETH_ALEN]; u8 mac_addr[ETH_ALEN]; int etherdev_size; - netdev_features_t hw_enc_features; - netdev_features_t hw_features;
etherdev_size = sizeof(struct i40e_netdev_priv); netdev = alloc_etherdev_mq(etherdev_size, vsi->alloc_queue_pairs); diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index f4d89e6..c4a5924 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3359,7 +3359,7 @@ static int iavf_set_features(struct net_device *netdev, netdev_features_t features) { struct iavf_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, netdev->features, features); /* Don't allow changing VLAN_RX flag when adapter is not capable @@ -3510,10 +3510,10 @@ int iavf_process_config(struct iavf_adapter *adapter) { struct virtchnl_vf_resource *vfres = adapter->vf_res; int i, num_req_queues = adapter->num_req_queues; + __DECLARE_NETDEV_FEATURE_MASK(hw_enc_features); struct net_device *netdev = adapter->netdev; + __DECLARE_NETDEV_FEATURE_MASK(hw_features); struct iavf_vsi *vsi = &adapter->vsi; - netdev_features_t hw_enc_features; - netdev_features_t hw_features;
/* got VF config message back from PF, now we can parse it */ for (i = 0; i < vfres->num_vsis; i++) { diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index dd9332a..32b0613 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3045,11 +3045,11 @@ static void ice_set_ops(struct net_device *netdev) */ static void ice_set_netdev_features(struct net_device *netdev) { + __DECLARE_NETDEV_FEATURE_MASK(csumo_features); + __DECLARE_NETDEV_FEATURE_MASK(vlano_features); + __DECLARE_NETDEV_FEATURE_MASK(dflt_features); + __DECLARE_NETDEV_FEATURE_MASK(tso_features); struct ice_pf *pf = ice_netdev_to_pf(netdev); - netdev_features_t csumo_features; - netdev_features_t vlano_features; - netdev_features_t dflt_features; - netdev_features_t tso_features;
if (ice_is_safe_mode(pf)) { /* safe mode */ diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 1f764d4..e4582a4 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2450,7 +2450,7 @@ static int igb_set_features(struct net_device *netdev, netdev_features_t features) { struct igb_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, netdev->features, features);
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index a384796..2bfdc74 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4930,7 +4930,7 @@ static int igc_set_features(struct net_device *netdev, netdev_features_t features) { struct igc_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, netdev->features, features);
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index c56ac31..4357e43 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -309,7 +309,7 @@ static int ixgb_set_features(struct net_device *netdev, netdev_features_t features) { struct ixgb_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 742947f..fc31773 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -4901,7 +4901,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_hw *hw = &adapter->hw; u32 fctrl, vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE; - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); int count;
netdev_feature_copy(&features, netdev->features); @@ -9731,7 +9731,7 @@ static int ixgbe_set_features(struct net_device *netdev, netdev_features_t features) { struct ixgbe_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); bool need_reset = false;
netdev_feature_xor(&changed, netdev->features, features); diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index f8540d8..295e0d1 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1265,7 +1265,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) static void mvpp2_set_hw_csum(struct mvpp2_port *port, enum mvpp2_bm_pool_log_num new_long_pool) { - netdev_features_t csums; + __DECLARE_NETDEV_FEATURE_MASK(csums);
netdev_feature_zero(&csums); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, &csums); @@ -5289,7 +5289,7 @@ static int mvpp2_set_features(struct net_device *dev, netdev_features_t features) { struct mvpp2_port *port = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features);
@@ -6743,7 +6743,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, struct mvpp2_port *port; struct mvpp2_port_pcpu *port_pcpu; struct device_node *port_node = to_of_node(port_fwnode); - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); struct net_device *dev; struct phylink *phylink; char *mac_from = ""; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index 872d4e5..de19cb3 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1853,7 +1853,7 @@ static int otx2_set_features(struct net_device *netdev, { bool ntuple = netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features); struct otx2_nic *pf = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index 263b88b..e46621c 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -4387,7 +4387,7 @@ static void sky2_fix_features(struct net_device *dev, static int sky2_set_features(struct net_device *dev, netdev_features_t features) { struct sky2_port *sky2 = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 4d0158e..1574f6b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3243,7 +3243,7 @@ static int mlx5e_handle_feature(struct net_device *netdev, u32 feature_bit, mlx5e_feature_handler feature_handler) { - netdev_features_t changes; + __DECLARE_NETDEV_FEATURE_MASK(changes); bool enable; int err;
@@ -3266,7 +3266,7 @@ static int mlx5e_handle_feature(struct net_device *netdev,
int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) { - netdev_features_t oper_features; + __DECLARE_NETDEV_FEATURE_MASK(oper_features); int err = 0;
netdev_feature_copy(&oper_features, netdev->features); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 0654b174..533e2a9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1084,7 +1084,7 @@ static int mlxsw_sp_handle_feature(struct net_device *dev, mlxsw_sp_feature_handler feature_handler) { bool enable = netdev_feature_test_bit(feature_bit, wanted_features); - netdev_features_t changes; + __DECLARE_NETDEV_FEATURE_MASK(changes); int err;
netdev_feature_xor(&changes, wanted_features, dev->features); @@ -1108,7 +1108,7 @@ static int mlxsw_sp_handle_feature(struct net_device *dev, static int mlxsw_sp_set_features(struct net_device *dev, netdev_features_t features) { - netdev_features_t oper_features; + __DECLARE_NETDEV_FEATURE_MASK(oper_features); int err = 0;
netdev_feature_copy(&oper_features, dev->features); diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index abbf17a..b73c31b 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -772,8 +772,8 @@ static int ocelot_set_features(struct net_device *dev, { struct ocelot_port_private *priv = netdev_priv(dev); struct ocelot *ocelot = priv->port.ocelot; + __DECLARE_NETDEV_FEATURE_MASK(changed); int port = priv->chip_port; - netdev_features_t changed;
netdev_feature_xor(&changed, dev->features, features);
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index 2f27418..c7d3f50 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -2884,7 +2884,7 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, struct sk_buff *segs, *curr, *next; struct myri10ge_priv *mgp = netdev_priv(dev); struct myri10ge_slice_state *ss; - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp); netdev_tx_t status;
netdev_feature_copy(&tmp, dev->features); diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index 0e3f500..79165cf 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c @@ -6567,7 +6567,7 @@ static void s2io_ethtool_get_strings(struct net_device *dev, static int s2io_set_features(struct net_device *dev, netdev_features_t features) { struct s2io_nic *sp = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, dev->features);
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 2ead012..6095786 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -2643,7 +2643,7 @@ static void vxge_poll_vp_lockup(struct timer_list *t) static void vxge_fix_features(struct net_device *dev, netdev_features_t *features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, *features);
@@ -2659,7 +2659,7 @@ static void vxge_fix_features(struct net_device *dev, static int vxge_set_features(struct net_device *dev, netdev_features_t features) { struct vxgedev *vdev = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features);
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 5732b63..f14bdf7 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -3519,7 +3519,7 @@ static int nfp_net_set_features(struct net_device *netdev, netdev_features_t features) { struct nfp_net *nn = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); u32 new_ctrl; int err;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index 372c72c..9bbfe47 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -235,9 +235,9 @@ static int nfp_repr_open(struct net_device *netdev) static void nfp_repr_fix_features(struct net_device *netdev, netdev_features_t *features) { + __DECLARE_NETDEV_FEATURE_MASK(lower_features); + __DECLARE_NETDEV_FEATURE_MASK(old_features); struct nfp_repr *repr = netdev_priv(netdev); - netdev_features_t lower_features; - netdev_features_t old_features; struct net_device *lower_dev;
lower_dev = repr->dst->u.port_info.lower_dev; diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 103599b..d4e89a9 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -4953,9 +4953,9 @@ static void nv_vlan_mode(struct net_device *dev, netdev_features_t features)
static int nv_set_features(struct net_device *dev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(changed); struct fe_priv *np = netdev_priv(dev); u8 __iomem *base = get_hwbase(dev); - netdev_features_t changed; int retval;
netdev_feature_xor(&changed, dev->features, features); diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index e91ac9f..350db45 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -2216,7 +2216,7 @@ static int pch_gbe_set_features(struct net_device *netdev, netdev_features_t features) { struct pch_gbe_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 1b2094d..57f418e 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1593,7 +1593,7 @@ static int ionic_set_nic_features(struct ionic_lif *lif, static int ionic_init_nic_features(struct ionic_lif *lif) { struct net_device *netdev = lif->netdev; - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); int err;
/* set up what we expect to support by default */ diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h index ed48bae..ff77e39 100644 --- a/drivers/net/ethernet/qlogic/qede/qede.h +++ b/drivers/net/ethernet/qlogic/qede/qede.h @@ -515,7 +515,7 @@ int qede_get_arfs_filter_count(struct qede_dev *edev); struct qede_reload_args { void (*func)(struct qede_dev *edev, struct qede_reload_args *args); union { - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); struct bpf_prog *new_prog; u16 mtu; } u; diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index 3024190..0d02657 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -924,7 +924,7 @@ void qede_fix_features(struct net_device *dev, netdev_features_t *features) int qede_set_features(struct net_device *dev, netdev_features_t features) { struct qede_dev *edev = netdev_priv(dev); - netdev_features_t changes; + __DECLARE_NETDEV_FEATURE_MASK(changes); bool need_reload = false;
netdev_feature_xor(&changes, features, dev->features); diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index dee4af6..b54235f 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c @@ -761,10 +761,10 @@ static struct qede_dev *qede_alloc_etherdev(struct qed_dev *cdev,
static void qede_init_ndev(struct qede_dev *edev) { + __DECLARE_NETDEV_FEATURE_MASK(hw_features); struct net_device *ndev = edev->ndev; struct pci_dev *pdev = edev->pdev; bool udp_tunnel_enable = false; - netdev_features_t hw_features;
pci_set_drvdata(pdev, ndev);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 625fcf3..ee055e9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -1060,7 +1060,7 @@ static void qlcnic_process_flags(struct qlcnic_adapter *adapter, void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
if (qlcnic_82xx_check(adapter) && (adapter->flags & QLCNIC_ESWITCH_ENABLED)) { @@ -1087,7 +1087,7 @@ void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) int qlcnic_set_features(struct net_device *netdev, netdev_features_t features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int hw_lro;
netdev_feature_xor(&changed, netdev->features, features); diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index 71c403c..53a83c1 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c @@ -176,7 +176,7 @@ static int emac_set_features(struct net_device *netdev, netdev_features_t features) { struct emac_adapter *adpt = netdev_priv(netdev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, features, netdev->features);
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index 59b5a95..bb8ed95 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c @@ -900,7 +900,7 @@ static struct net_device *rtl8139_init_board(struct pci_dev *pdev) static int rtl8139_set_features(struct net_device *dev, netdev_features_t features) { struct rtl8139_private *tp = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); unsigned long flags; void __iomem *ioaddr = tp->mmio_addr;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index e241508..3da1b31 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1856,7 +1856,7 @@ static void ravb_set_rx_csum(struct net_device *ndev, bool enable) static int ravb_set_features(struct net_device *ndev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, ndev->features, features);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 8b0e473..6cffae1 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2933,7 +2933,7 @@ static int sh_eth_set_features(struct net_device *ndev, netdev_features_t features) { struct sh_eth_private *mdp = netdev_priv(ndev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, ndev->features, features);
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index b70ce38..b8b6e31 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -1775,7 +1775,7 @@ static int sxgbe_set_features(struct net_device *dev, netdev_features_t features) { struct sxgbe_priv_data *priv = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, dev->features, features);
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 7bb1c8c..0877282 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -1305,7 +1305,7 @@ static void efx_ef10_fini_nic(struct efx_nic *efx) static int efx_ef10_init_nic(struct efx_nic *efx) { struct efx_ef10_nic_data *nic_data = efx->nic_data; - netdev_features_t hw_enc_features; + __DECLARE_NETDEV_FEATURE_MASK(hw_enc_features); int rc;
netdev_feature_zero(&hw_enc_features); @@ -1358,7 +1358,7 @@ static int efx_ef10_init_nic(struct efx_nic *efx) &hw_enc_features); /* add encapsulated TSO features */ if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { - netdev_features_t encap_tso_features; + __DECLARE_NETDEV_FEATURE_MASK(encap_tso_features);
netdev_feature_zero(&encap_tso_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 35f6dd0..d509814 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -184,7 +184,7 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) { struct net_device *net_dev = efx->net_dev; - netdev_features_t tso; + __DECLARE_NETDEV_FEATURE_MASK(tso);
netdev_feature_zero(&tso); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index ed142f3..71b5748 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1028,8 +1028,8 @@ static int efx_pci_probe_main(struct efx_nic *efx) static int efx_pci_probe_post_io(struct efx_nic *efx) { struct net_device *net_dev = efx->net_dev; + __DECLARE_NETDEV_FEATURE_MASK(tmp); int rc = efx_pci_probe_main(efx); - netdev_features_t tmp;
if (rc) return rc; diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c index 0135373..8eac246 100644 --- a/drivers/net/ethernet/sfc/efx_common.c +++ b/drivers/net/ethernet/sfc/efx_common.c @@ -211,7 +211,7 @@ void efx_set_rx_mode(struct net_device *net_dev) int efx_set_features(struct net_device *net_dev, netdev_features_t data) { struct efx_nic *efx = netdev_priv(net_dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int rc;
/* If disabling RX n-tuple filtering, clear existing filters */ @@ -366,8 +366,8 @@ void efx_start_monitor(struct efx_nic *efx) */ static void efx_start_datapath(struct efx_nic *efx) { + __DECLARE_NETDEV_FEATURE_MASK(old_features); bool old_rx_scatter = efx->rx_scatter; - netdev_features_t old_features; size_t rx_buf_len;
/* Calculate the rx buffer allocation parameters required to diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index af4aeb0..c097a25 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c @@ -592,8 +592,8 @@ static int ef4_probe_channels(struct ef4_nic *efx) */ static void ef4_start_datapath(struct ef4_nic *efx) { + __DECLARE_NETDEV_FEATURE_MASK(old_features); bool old_rx_scatter = efx->rx_scatter; - netdev_features_t old_features; struct ef4_tx_queue *tx_queue; struct ef4_rx_queue *rx_queue; struct ef4_channel *channel; @@ -2196,7 +2196,7 @@ static void ef4_set_rx_mode(struct net_device *net_dev) static int ef4_set_features(struct net_device *net_dev, netdev_features_t data) { struct ef4_nic *efx = netdev_priv(net_dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int rc;
/* If disabling RX n-tuple filtering, clear existing filters */ diff --git a/drivers/net/ethernet/sfc/falcon/net_driver.h b/drivers/net/ethernet/sfc/falcon/net_driver.h index 10d7db7..ec50ae2 100644 --- a/drivers/net/ethernet/sfc/falcon/net_driver.h +++ b/drivers/net/ethernet/sfc/falcon/net_driver.h @@ -849,7 +849,7 @@ struct ef4_nic { bool port_initialized; struct net_device *net_dev;
- netdev_features_t fixed_features; + __DECLARE_NETDEV_FEATURE_MASK(fixed_features);
struct ef4_buffer stats_buffer; u64 rx_nodesc_drops_total; diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c index 2a9a692..c199509 100644 --- a/drivers/net/ethernet/sfc/mcdi_filters.c +++ b/drivers/net/ethernet/sfc/mcdi_filters.c @@ -1297,8 +1297,8 @@ efx_mcdi_filter_table_probe_matches(struct efx_nic *efx, int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) { struct net_device *net_dev = efx->net_dev; + __DECLARE_NETDEV_FEATURE_MASK(supported); struct efx_mcdi_filter_table *table; - netdev_features_t supported; int rc;
if (!efx_rwsem_assert_write_locked(&efx->filter_sem)) diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index a4e0ff7..70e41d2 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1044,7 +1044,7 @@ struct efx_nic { bool port_initialized; struct net_device *net_dev;
- netdev_features_t fixed_features; + __DECLARE_NETDEV_FEATURE_MASK(fixed_features);
u16 num_mac_stats; struct efx_buffer stats_buffer; diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c index 44f4bff..534c10e 100644 --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c @@ -1224,7 +1224,7 @@ vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb, struct net_device *dev = VNET_PORT_TO_NET_DEVICE(port); struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING]; struct sk_buff *segs, *curr, *next; - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp); int maclen, datalen; int status; int gso_size, gso_type, gso_segs; diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac.h b/drivers/net/ethernet/synopsys/dwc-xlgmac.h index 8598aaf..a0f69cc 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac.h +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac.h @@ -606,7 +606,7 @@ struct xlgmac_pdata {
/* Netdev related settings */ unsigned char mac_addr[ETH_ALEN]; - netdev_features_t netdev_features; + __DECLARE_NETDEV_FEATURE_MASK(netdev_features); struct napi_struct napi;
/* Filtering support */ diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 22875a7..84b3bce 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1944,8 +1944,8 @@ static int netvsc_set_features(struct net_device *ndev, struct net_device_context *ndevctx = netdev_priv(ndev); struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); struct net_device *vf_netdev = rtnl_dereference(ndevctx->vf_netdev); + __DECLARE_NETDEV_FEATURE_MASK(change); struct ndis_offload_params offloads; - netdev_features_t change; int ret = 0;
if (!nvdev || nvdev->destroy) diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 115ebe0..f0206cd 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1348,7 +1348,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, struct ndis_offload hwcaps; struct ndis_offload_params offloads; unsigned int gso_max_size = GSO_MAX_SIZE; - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp); int ret;
/* Find HW offload capabilities */ diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h index 3837c89..84cd8f1 100644 --- a/drivers/net/ipvlan/ipvlan.h +++ b/drivers/net/ipvlan/ipvlan.h @@ -67,7 +67,7 @@ struct ipvl_dev { struct list_head addrs; struct ipvl_pcpu_stats __percpu *pcpu_stats; DECLARE_BITMAP(mac_filters, IPVLAN_MAC_FILTER_SIZE); - netdev_features_t sfeatures; + __DECLARE_NETDEV_FEATURE_MASK(sfeatures); u32 msg_enable; spinlock_t addrs_lock; }; diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 84ad786a..e77e4dc 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -242,7 +242,7 @@ static void ipvlan_fix_features(struct net_device *dev, netdev_features_t *features) { struct ipvl_dev *ipvlan = netdev_priv(dev); - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); netdev_feature_fill(&tmp); diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 5526d54..8693dec 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3478,7 +3478,7 @@ static void macsec_fix_features(struct net_device *dev, { struct macsec_dev *macsec = macsec_priv(dev); struct net_device *real_dev = macsec->real_dev; - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
if (macsec_is_offloaded(macsec)) { netdev_feature_copy(features, real_dev->features); diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 9ac38e2..d373b45 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1074,9 +1074,10 @@ static int macvlan_ethtool_get_ts_info(struct net_device *dev, static void macvlan_fix_features(struct net_device *dev, netdev_features_t *features) { + __DECLARE_NETDEV_FEATURE_MASK(lowerdev_features); struct macvlan_dev *vlan = netdev_priv(dev); - netdev_features_t lowerdev_features; - netdev_features_t mask, tmp; + __DECLARE_NETDEV_FEATURE_MASK(mask); + __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_copy(&lowerdev_features, vlan->lowerdev->features); netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 704e691..16375fb 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -384,10 +384,10 @@ static void net_failover_compute_features(struct net_device *dev) IFF_XMIT_DST_RELEASE_PERM; struct net_failover_info *nfo_info = netdev_priv(dev); struct net_device *primary_dev, *standby_dev; - netdev_features_t vlan_features; - netdev_features_t enc_features; - netdev_features_t vlan_mask; - netdev_features_t enc_mask; + __DECLARE_NETDEV_FEATURE_MASK(vlan_features); + __DECLARE_NETDEV_FEATURE_MASK(enc_features); + __DECLARE_NETDEV_FEATURE_MASK(vlan_mask); + __DECLARE_NETDEV_FEATURE_MASK(enc_mask);
netdev_feature_zero(&vlan_features); netdev_feature_set_bits(FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 03158fa..49da4d1 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -317,11 +317,11 @@ EXPORT_SYMBOL_GPL(tap_del_queues);
rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *skb = *pskb; struct net_device *dev = skb->dev; struct tap_dev *tap; struct tap_queue *q; - netdev_features_t features;
netdev_feature_zero(&features); netdev_feature_set_bits(TAP_FEATURES, &features); @@ -923,9 +923,9 @@ static int tap_ioctl_set_queue(struct file *file, unsigned int flags)
static int set_offload(struct tap_queue *q, unsigned long arg) { + __DECLARE_NETDEV_FEATURE_MASK(feature_mask); + __DECLARE_NETDEV_FEATURE_MASK(features); struct tap_dev *tap; - netdev_features_t features; - netdev_features_t feature_mask;
tap = rtnl_dereference(q->tap); if (!tap) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 207771e..79171c8 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -988,10 +988,10 @@ static void __team_compute_features(struct team *team) unsigned short max_hard_header_len = ETH_HLEN; unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; - netdev_features_t vlan_features; - netdev_features_t enc_features; - netdev_features_t mask_vlan; - netdev_features_t mask_enc; + __DECLARE_NETDEV_FEATURE_MASK(vlan_features); + __DECLARE_NETDEV_FEATURE_MASK(enc_features); + __DECLARE_NETDEV_FEATURE_MASK(mask_vlan); + __DECLARE_NETDEV_FEATURE_MASK(mask_enc);
netdev_feature_zero(&vlan_features); netdev_feature_set_bits(TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, @@ -2010,7 +2010,7 @@ static void team_fix_features(struct net_device *dev, { struct team_port *port; struct team *team = netdev_priv(dev); - netdev_features_t mask; + __DECLARE_NETDEV_FEATURE_MASK(mask);
netdev_feature_copy(&mask, *features); netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); diff --git a/drivers/net/tun.c b/drivers/net/tun.c index be45675..a464daf 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -183,7 +183,7 @@ struct tun_struct { kgid_t group;
struct net_device *dev; - netdev_features_t set_features; + __DECLARE_NETDEV_FEATURE_MASK(set_features); #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ NETIF_F_TSO6)
@@ -1083,7 +1083,7 @@ static void tun_net_fix_features(struct net_device *dev, netdev_features_t *features) { struct tun_struct *tun = netdev_priv(dev); - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_and(&tmp, *features, tun->set_features); netdev_feature_clear_bits(TUN_USER_FEATURES, features); @@ -2802,7 +2802,7 @@ static void tun_get_iff(struct tun_struct *tun, struct ifreq *ifr) * privs required. */ static int set_offload(struct tun_struct *tun, unsigned long arg) { - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features);
netdev_feature_zero(&features);
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 0099d55f..b11b4bb 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -952,7 +952,7 @@ ax88179_set_features(struct net_device *net, netdev_features_t features) { u8 tmp; struct usbnet *dev = netdev_priv(net); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed);
netdev_feature_xor(&changed, net->features, features);
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index ce74862..dbd3889 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2092,9 +2092,9 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb, struct sk_buff_head *list) { if (skb_shinfo(skb)->gso_size) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs, *seg, *next; struct sk_buff_head seg_list; - netdev_features_t features;
netdev_feature_copy(&features, tp->netdev->features); netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_IPV6_CSUM | @@ -3233,8 +3233,8 @@ static void rtl_rx_vlan_en(struct r8152 *tp, bool enable) static int rtl8152_set_features(struct net_device *dev, netdev_features_t features) { + __DECLARE_NETDEV_FEATURE_MASK(changed); struct r8152 *tp = netdev_priv(dev); - netdev_features_t changed; int ret;
ret = usb_autopm_get_interface(tp->intf); diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 39bfa02..6603dca 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1407,7 +1407,7 @@ static int veth_set_features(struct net_device *dev, netdev_features_t features) { struct veth_priv *priv = netdev_priv(dev); - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
netdev_feature_xor(&changed, features, dev->features); diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 5859f8f..1aa408f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -3125,7 +3125,7 @@ static int virtnet_probe(struct virtio_device *vdev) netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &dev->features);
if (gso) { - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_zero(&tmp); netdev_feature_set_bits(NETIF_F_ALL_TSO, &tmp); diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 0e36170..f365604 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -340,7 +340,7 @@ int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) struct vmxnet3_adapter *adapter = netdev_priv(netdev); u64 tun_offload_mask = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM; - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); unsigned long flags; u8 udp_tun_enabled;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index b50942f..3b1c2c2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -413,7 +413,7 @@ struct iwl_mvm_vif { bool csa_bcn_pending;
/* TCP Checksum Offload */ - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features);
struct iwl_probe_resp_data __rcu *probe_resp_data;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index c254ab4..f2070ed 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -836,8 +836,8 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb, struct ieee80211_hdr *hdr = (void *)skb->data; unsigned int mss = skb_shinfo(skb)->gso_size; unsigned int num_subframes, tcp_payload_len, subf_len, max_amsdu_len; + __DECLARE_NETDEV_FEATURE_MASK(netdev_flags); u16 snap_ip_tcp, pad; - netdev_features_t netdev_flags; u8 tid;
netdev_feature_zero(&netdev_flags); diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 53408f7..041efc0 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -648,7 +648,7 @@ static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev unsigned long flags; struct netfront_queue *queue = NULL; unsigned int num_queues = dev->real_num_tx_queues; - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); u16 queue_index; struct sk_buff *nskb;
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 3a586c1..b8cf8b6 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -6979,7 +6979,7 @@ void qeth_features_check(struct sk_buff *skb, struct net_device *dev, /* Traffic with local next-hop is not eligible for some offloads: */ if (skb->ip_summed == CHECKSUM_PARTIAL && READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) { - netdev_features_t restricted; + __DECLARE_NETDEV_FEATURE_MASK(restricted);
netdev_feature_zero(&restricted); if (skb_is_gso(skb) && !netif_needs_gso(skb, *features)) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 443d23e..f5205f6 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -2276,7 +2276,7 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, static int qlge_set_features(struct net_device *ndev, netdev_features_t features) { - netdev_features_t changed; + __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
netdev_feature_xor(&changed, ndev->features, features); diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index 10c94a39..101be70 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h @@ -26,7 +26,7 @@ struct macvlan_dev {
DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
- netdev_features_t set_features; + __DECLARE_NETDEV_FEATURE_MASK(set_features); enum macvlan_mode mode; u16 flags; unsigned int macaddr_count; diff --git a/include/linux/if_tap.h b/include/linux/if_tap.h index 915a187..e810704 100644 --- a/include/linux/if_tap.h +++ b/include/linux/if_tap.h @@ -40,7 +40,7 @@ struct tap_dev { struct list_head queue_list; int numvtaps; int numqueues; - netdev_features_t tap_features; + __DECLARE_NETDEV_FEATURE_MASK(tap_features); int minor;
void (*update_features)(struct tap_dev *tap, netdev_features_t features); diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 9744780..0bd12e9 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -101,6 +101,9 @@ enum { /**/NETDEV_FEATURE_COUNT };
+#define __DECLARE_NETDEV_FEATURE_MASK(name) \ + netdev_features_t name + /* copy'n'paste compression ;) */ #define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit)) #define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 51fdb9f..b920249 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1990,13 +1990,13 @@ struct net_device { unsigned short needed_headroom; unsigned short needed_tailroom;
- netdev_features_t features; - netdev_features_t hw_features; - netdev_features_t wanted_features; - netdev_features_t vlan_features; - netdev_features_t hw_enc_features; - netdev_features_t mpls_features; - netdev_features_t gso_partial_features; + __DECLARE_NETDEV_FEATURE_MASK(features); + __DECLARE_NETDEV_FEATURE_MASK(hw_features); + __DECLARE_NETDEV_FEATURE_MASK(wanted_features); + __DECLARE_NETDEV_FEATURE_MASK(vlan_features); + __DECLARE_NETDEV_FEATURE_MASK(hw_enc_features); + __DECLARE_NETDEV_FEATURE_MASK(mpls_features); + __DECLARE_NETDEV_FEATURE_MASK(gso_partial_features);
unsigned int min_mtu; unsigned int max_mtu; @@ -5028,7 +5028,7 @@ void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, static inline void netdev_add_tso_features(netdev_features_t *features, netdev_features_t mask) { - netdev_features_t one; + __DECLARE_NETDEV_FEATURE_MASK(one);
netdev_feature_zero(&one); netdev_feature_set_bits(NETIF_F_ALL_TSO, &one); @@ -5048,7 +5048,7 @@ void netif_skb_features(struct sk_buff *skb, netdev_features_t *features);
static inline bool net_gso_ok(netdev_features_t features, int gso_type) { - netdev_features_t feature; + __DECLARE_NETDEV_FEATURE_MASK(feature);
/* check flags correspondence */ BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d8a1d09..ea9817f 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -2617,7 +2617,7 @@ struct ieee80211_hw { int units_pos; s16 accuracy; } radiotap_timestamp; - netdev_features_t netdev_features; + __DECLARE_NETDEV_FEATURE_MASK(netdev_features); u8 uapsd_queues; u8 uapsd_max_sp_len; u8 n_cipher_schemes; diff --git a/include/net/sock.h b/include/net/sock.h index 1baceb0..9d0d8e8 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -455,9 +455,9 @@ struct sock { unsigned long sk_pacing_rate; /* bytes per second */ unsigned long sk_max_pacing_rate; struct page_frag sk_frag; - netdev_features_t sk_route_caps; - netdev_features_t sk_route_nocaps; - netdev_features_t sk_route_forced_caps; + __DECLARE_NETDEV_FEATURE_MASK(sk_route_caps); + __DECLARE_NETDEV_FEATURE_MASK(sk_route_nocaps); + __DECLARE_NETDEV_FEATURE_MASK(sk_route_forced_caps); int sk_gso_type; unsigned int sk_gso_max_size; gfp_t sk_allocation; @@ -2067,7 +2067,7 @@ static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags)
static inline void sk_nocaps_add_gso(struct sock *sk) { - netdev_features_t gso_flags; + __DECLARE_NETDEV_FEATURE_MASK(gso_flags);
netdev_feature_zero(&gso_flags); netdev_feature_set_bits(NETIF_F_GSO_MASK, &gso_flags); diff --git a/include/net/udp.h b/include/net/udp.h index 3855b97..42681e7 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -481,7 +481,7 @@ void udpv6_encap_enable(void); static inline struct sk_buff *udp_rcv_segment(struct sock *sk, struct sk_buff *skb, bool ipv4) { - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs;
netdev_feature_zero(&features); diff --git a/lib/test_bpf.c b/lib/test_bpf.c index 44d8197..c2680ef 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -8875,7 +8875,7 @@ static __init struct sk_buff *build_test_skb_linear_no_head_frag(void) struct skb_segment_test { const char *descr; struct sk_buff *(*build_skb)(void); - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); };
static struct skb_segment_test skb_segment_tests[] __initconst = { diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index a010612..4062917 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -640,9 +640,9 @@ static void vlan_dev_fix_features(struct net_device *dev, netdev_features_t *features) { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; - netdev_features_t lower_features; - netdev_features_t old_features; - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(lower_features); + __DECLARE_NETDEV_FEATURE_MASK(old_features); + __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_copy(&tmp, real_dev->vlan_features); netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &tmp); diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index c94e329..5cf6837 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -534,8 +534,8 @@ static void br_set_gso_limits(struct net_bridge *br) */ void br_features_recompute(struct net_bridge *br, netdev_features_t *features) { + __DECLARE_NETDEV_FEATURE_MASK(mask); struct net_bridge_port *p; - netdev_features_t mask;
if (list_empty(&br->port_list)) return; diff --git a/net/core/dev.c b/net/core/dev.c index a71d35d..fcbffe7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3181,7 +3181,7 @@ static u16 skb_tx_hash(const struct net_device *dev,
static void skb_warn_bad_offload(const struct sk_buff *skb) { - static const netdev_features_t null_features; + static __DECLARE_NETDEV_FEATURE_MASK(null_features); struct net_device *dev = skb->dev; const char *name = "";
@@ -3380,7 +3380,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, * work. */ if (netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, features)) { - netdev_features_t partial_features; + __DECLARE_NETDEV_FEATURE_MASK(partial_features); struct net_device *dev = skb->dev;
netdev_feature_and(&partial_features, dev->features, @@ -3647,7 +3647,7 @@ EXPORT_SYMBOL(skb_csum_hwoffload_help);
static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev, bool *again) { - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features);
netif_skb_features(skb, &features); skb = validate_xmit_vlan(skb, features); @@ -9791,7 +9791,7 @@ static void netdev_sync_upper_features(struct net_device *lower, struct net_device *upper, netdev_features_t *features) { - netdev_features_t upper_disables; + __DECLARE_NETDEV_FEATURE_MASK(upper_disables); int feature_bit;
netdev_feature_zero(&upper_disables); @@ -9811,7 +9811,7 @@ static void netdev_sync_upper_features(struct net_device *lower, static void netdev_sync_lower_features(struct net_device *upper, struct net_device *lower, netdev_features_t features) { - netdev_features_t upper_disables; + __DECLARE_NETDEV_FEATURE_MASK(upper_disables); int feature_bit;
netdev_feature_zero(&upper_disables); @@ -9941,8 +9941,8 @@ static void netdev_fix_features(struct net_device *dev,
int __netdev_update_features(struct net_device *dev) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct net_device *upper, *lower; - netdev_features_t features; struct list_head *iter; int err = -1;
@@ -9989,7 +9989,7 @@ int __netdev_update_features(struct net_device *dev) netdev_sync_lower_features(dev, lower, features);
if (!err) { - netdev_features_t diff; + __DECLARE_NETDEV_FEATURE_MASK(diff);
netdev_feature_xor(&diff, features, dev->features);
@@ -11361,7 +11361,7 @@ static int dev_cpu_dead(unsigned int oldcpu) void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, netdev_features_t one, netdev_features_t mask) { - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, mask)) netdev_feature_set_bits(NETIF_F_CSUM_MASK, &mask); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index d2fc92b..83cfc0c 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -74,8 +74,8 @@ static netdev_tx_t netpoll_start_xmit(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq) { + __DECLARE_NETDEV_FEATURE_MASK(features); netdev_tx_t status = NETDEV_TX_OK; - netdev_features_t features;
netif_skb_features(skb, &features);
diff --git a/net/ethtool/features.c b/net/ethtool/features.c index 1c9f4df..93c6238 100644 --- a/net/ethtool/features.c +++ b/net/ethtool/features.c @@ -38,8 +38,8 @@ static int features_prepare_data(const struct ethnl_req_info *req_base, struct genl_info *info) { struct features_reply_data *data = FEATURES_REPDATA(reply_base); + __DECLARE_NETDEV_FEATURE_MASK(all_features); struct net_device *dev = reply_base->dev; - netdev_features_t all_features;
ethnl_features_to_bitmap32(data->hw, dev->hw_features); ethnl_features_to_bitmap32(data->wanted, dev->wanted_features); diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index dcfe8b3..a51cd59 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -231,8 +231,8 @@ static void ethtool_get_feature_mask(u32 eth_cmd, netdev_features_t *mask) static int ethtool_get_one_feature(struct net_device *dev, char __user *useraddr, u32 ethcmd) { + __DECLARE_NETDEV_FEATURE_MASK(mask); struct ethtool_value edata; - netdev_features_t mask;
ethtool_get_feature_mask(ethcmd, &mask); edata.cmd = ethcmd; @@ -246,8 +246,8 @@ static int ethtool_get_one_feature(struct net_device *dev, static int ethtool_set_one_feature(struct net_device *dev, void __user *useraddr, u32 ethcmd) { + __DECLARE_NETDEV_FEATURE_MASK(mask); struct ethtool_value edata; - netdev_features_t mask;
if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT; @@ -2695,9 +2695,9 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr) int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr) { struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); + __DECLARE_NETDEV_FEATURE_MASK(old_features); u32 ethcmd, sub_cmd; int rc; - netdev_features_t old_features;
if (!dev) return -ENODEV; diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index b7ba16b..7a4c5e7 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -180,7 +180,7 @@ static int hsr_dev_close(struct net_device *dev) static void hsr_features_recompute(struct hsr_priv *hsr, netdev_features_t *features) { - netdev_features_t mask; + __DECLARE_NETDEV_FEATURE_MASK(mask); struct hsr_port *port;
netdev_feature_copy(&mask, *features); diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c index 77c876e..0fe1af1 100644 --- a/net/ipv4/esp4_offload.c +++ b/net/ipv4/esp4_offload.c @@ -190,7 +190,7 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, struct ip_esp_hdr *esph; struct crypto_aead *aead; struct xfrm_offload *xo = xfrm_offload(skb); - netdev_features_t esp_features; + __DECLARE_NETDEV_FEATURE_MASK(esp_features); struct sec_path *sp;
if (!xo) diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index fb0288a..f79509b 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -233,8 +233,8 @@ static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *s static int ip_finish_output_gso(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int mtu) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs, *nskb; - netdev_features_t features; int ret = 0;
/* common case: seglen is <= mtu diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index 4bf0a0d..2f4b748 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -55,6 +55,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, netdev_features_t features) { struct sk_buff *segs = ERR_PTR(-EINVAL); + __DECLARE_NETDEV_FEATURE_MASK(tmp); unsigned int sum_truesize = 0; struct tcphdr *th; unsigned int thlen; @@ -65,7 +66,6 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, struct sk_buff *gso_skb = skb; __sum16 newcheck; bool ooo_okay, copy_destructor; - netdev_features_t tmp;
th = tcp_hdr(skb); thlen = th->doff * 4; diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c index 5c2e0da..3ce9360 100644 --- a/net/ipv6/esp6_offload.c +++ b/net/ipv6/esp6_offload.c @@ -229,7 +229,7 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb, struct ip_esp_hdr *esph; struct crypto_aead *aead; struct xfrm_offload *xo = xfrm_offload(skb); - netdev_features_t esp_features; + __DECLARE_NETDEV_FEATURE_MASK(esp_features); struct sec_path *sp;
if (!xo) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index c7e0600..72acb06 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -138,8 +138,8 @@ static int ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int mtu) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs, *nskb; - netdev_features_t features; int ret = 0;
/* Please see corresponding comment in ip_finish_output_gso diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 784f87a..f6dde47 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1991,7 +1991,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ieee80211_setup_sdata(sdata, type);
if (ndev) { - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
ndev->ieee80211_ptr->use_4addr = params->use_4addr; if (type == NL80211_IFTYPE_STATION) diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 9b69e53..eccb0a3 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -909,7 +909,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) int channels, max_bitrates; bool supp_ht, supp_vht, supp_he; struct cfg80211_chan_def dflt_chandef = {}; - netdev_features_t tmp; + __DECLARE_NETDEV_FEATURE_MASK(tmp);
if (ieee80211_hw_check(hw, QUEUE_CONTROL) && (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE || diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index 2324b5a..a76c798 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -1739,8 +1739,8 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, b->max_skblen = len;
if (skb_is_gso(skb) && q->rate_flags & CAKE_FLAG_SPLIT_GSO) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs, *nskb; - netdev_features_t features; unsigned int slen = 0, numsegs = 0;
netif_skb_features(skb, &features); diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 4aabeb20..313591a 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -412,8 +412,8 @@ static void tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch) static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) { + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs; - netdev_features_t features;
netif_skb_features(skb, &features); netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index c5114a7..f5975d5 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -453,7 +453,7 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, */ if (skb_is_gso(skb) && !FULL_OFFLOAD_IS_ENABLED(q->flags)) { unsigned int slen = 0, numsegs = 0, len = qdisc_pkt_len(skb); - netdev_features_t features; + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs, *nskb; int ret;
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 8ac786f..6b6b347 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -191,8 +191,8 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) { struct tbf_sched_data *q = qdisc_priv(sch); + __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs, *nskb; - netdev_features_t features; unsigned int len = 0, prev_len = qdisc_pkt_len(skb); int ret, nb;
This patch extend the type of netdev_features_t to bitmap, so it can support more than 64 bits. Changes the typedef of netdev_features_t to unsigned long *, and use the macro __DECLARE_NETDEV_FEATURE_MASK to declare a netdev feature bitmap.
Then rewrite all the netdev_feature_xxx helpers with the new prototype. For the "netdev_features_t" is "unsigned long *" now, it's unnecessary to use "netdev_features_t *" in these helpers. So removes them, and modify the codes which call them. So does the functions prototype mentioned in the first 23 patches. With these changes, we can keep the behaviour consitent with linkmode_xxx helpers.
It also changes the implement for ethtool set/get features. It's unnecessary to convert netdev features to bitmap, and vice versa.
For the type of netdev_features_t is bitmap now, so use %*pb to print the features, rather than %pNF.
Signed-off-by: Jian Shen shenjian15@huawei.com --- arch/um/drivers/vector_kern.c | 10 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 +- drivers/net/bareudp.c | 14 +- drivers/net/bonding/bond_main.c | 74 ++++---- drivers/net/bonding/bond_options.c | 8 +- drivers/net/can/dev/dev.c | 4 +- drivers/net/can/slcan.c | 4 +- drivers/net/dsa/xrs700x/xrs700x.c | 4 +- drivers/net/dummy.c | 12 +- drivers/net/ethernet/3com/3c59x.c | 2 +- drivers/net/ethernet/3com/typhoon.c | 8 +- drivers/net/ethernet/adaptec/starfire.c | 6 +- drivers/net/ethernet/aeroflex/greth.c | 8 +- drivers/net/ethernet/alacritech/slicoss.c | 6 +- drivers/net/ethernet/alteon/acenic.c | 6 +- drivers/net/ethernet/altera/altera_tse_main.c | 8 +- drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 2 +- drivers/net/ethernet/amazon/ena/ena_netdev.c | 30 ++-- drivers/net/ethernet/amd/amd8111e.c | 4 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 24 +-- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 18 +- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 +- drivers/net/ethernet/aquantia/atlantic/aq_macsec.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 16 +- drivers/net/ethernet/atheros/alx/main.c | 6 +- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 14 +- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 16 +- drivers/net/ethernet/atheros/atlx/atl1.c | 14 +- drivers/net/ethernet/atheros/atlx/atl2.c | 12 +- drivers/net/ethernet/atheros/atlx/atlx.c | 6 +- drivers/net/ethernet/broadcom/b44.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 6 +- drivers/net/ethernet/broadcom/bgmac.c | 8 +- drivers/net/ethernet/broadcom/bnx2.c | 27 ++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 20 +-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 40 ++--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 70 ++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 10 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +- drivers/net/ethernet/broadcom/tg3.c | 32 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 16 +- drivers/net/ethernet/cadence/macb_main.c | 20 +-- drivers/net/ethernet/calxeda/xgmac.c | 8 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 38 ++-- drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 38 ++-- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 20 +-- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 20 +-- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 26 +-- drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 16 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 34 ++-- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 18 +- drivers/net/ethernet/cisco/enic/enic_main.c | 26 +-- drivers/net/ethernet/cortina/gemini.c | 8 +- drivers/net/ethernet/davicom/dm9000.c | 8 +- drivers/net/ethernet/dnet.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 18 +- drivers/net/ethernet/ethoc.c | 2 +- drivers/net/ethernet/faraday/ftgmac100.c | 14 +- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 10 +- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 +- drivers/net/ethernet/freescale/enetc/enetc.c | 2 +- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 16 +- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 10 +- drivers/net/ethernet/freescale/fec_main.c | 12 +- .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +- drivers/net/ethernet/freescale/gianfar.c | 10 +- drivers/net/ethernet/freescale/gianfar_ethtool.c | 4 +- drivers/net/ethernet/google/gve/gve_adminq.c | 2 +- drivers/net/ethernet/google/gve/gve_main.c | 26 +-- drivers/net/ethernet/google/gve/gve_rx.c | 2 +- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 2 +- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 8 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 16 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 36 ++-- drivers/net/ethernet/huawei/hinic/hinic_main.c | 34 ++-- drivers/net/ethernet/ibm/ehea/ehea_main.c | 12 +- drivers/net/ethernet/ibm/emac/core.c | 8 +- drivers/net/ethernet/ibm/ibmveth.c | 38 ++-- drivers/net/ethernet/ibm/ibmvnic.c | 34 ++-- drivers/net/ethernet/intel/e100.c | 10 +- drivers/net/ethernet/intel/e1000/e1000_main.c | 28 +-- drivers/net/ethernet/intel/e1000e/netdev.c | 38 ++-- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 19 +- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 8 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 36 ++-- drivers/net/ethernet/intel/iavf/iavf_main.c | 48 ++--- drivers/net/ethernet/intel/ice/ice_main.c | 46 ++--- drivers/net/ethernet/intel/igb/igb_main.c | 42 ++--- drivers/net/ethernet/intel/igbvf/netdev.c | 28 +-- drivers/net/ethernet/intel/igc/igc_main.c | 46 ++--- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 20 +-- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 60 +++---- drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 30 ++-- drivers/net/ethernet/jme.c | 14 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 10 +- drivers/net/ethernet/marvell/mvneta.c | 10 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 42 ++--- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 28 +-- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 12 +- .../net/ethernet/marvell/prestera/prestera_main.c | 2 +- drivers/net/ethernet/marvell/skge.c | 6 +- drivers/net/ethernet/marvell/sky2.c | 29 ++- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 66 +++---- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 16 +- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 4 +- .../ethernet/mellanox/mlx5/core/en_accel/ktls.c | 11 +- .../net/ethernet/mellanox/mlx5/core/en_accel/tls.c | 12 +- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 118 ++++++------ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 26 +-- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 18 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 14 +- drivers/net/ethernet/micrel/ksz884x.c | 8 +- drivers/net/ethernet/microchip/lan743x_main.c | 6 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 14 +- drivers/net/ethernet/mscc/ocelot_net.c | 6 +- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 20 +-- drivers/net/ethernet/natsemi/ns83820.c | 8 +- drivers/net/ethernet/neterion/s2io.c | 14 +- drivers/net/ethernet/neterion/vxge/vxge-main.c | 18 +- drivers/net/ethernet/netronome/nfp/crypto/tls.c | 8 +- .../net/ethernet/netronome/nfp/nfp_net_common.c | 42 ++--- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 52 +++--- drivers/net/ethernet/ni/nixge.c | 4 +- drivers/net/ethernet/nvidia/forcedeth.c | 16 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 8 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 4 +- drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 48 ++--- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 22 +-- drivers/net/ethernet/qlogic/qede/qede.h | 4 +- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 10 +- drivers/net/ethernet/qlogic/qede/qede_fp.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 34 ++-- drivers/net/ethernet/qlogic/qla3xxx.c | 4 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 16 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 28 +-- drivers/net/ethernet/qualcomm/emac/emac.c | 12 +- drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 10 +- drivers/net/ethernet/realtek/8139cp.c | 14 +- drivers/net/ethernet/realtek/8139too.c | 10 +- drivers/net/ethernet/realtek/r8169_main.c | 30 ++-- drivers/net/ethernet/renesas/ravb_main.c | 12 +- drivers/net/ethernet/renesas/sh_eth.c | 14 +- drivers/net/ethernet/rocker/rocker_main.c | 2 +- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 10 +- drivers/net/ethernet/sfc/ef10.c | 18 +- drivers/net/ethernet/sfc/ef100_nic.c | 20 +-- drivers/net/ethernet/sfc/ef10_sriov.c | 4 +- drivers/net/ethernet/sfc/efx.c | 20 +-- drivers/net/ethernet/sfc/efx_common.c | 16 +- drivers/net/ethernet/sfc/efx_common.h | 2 +- drivers/net/ethernet/sfc/falcon/efx.c | 28 ++- drivers/net/ethernet/sfc/falcon/net_driver.h | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 8 +- drivers/net/ethernet/sfc/net_driver.h | 2 +- drivers/net/ethernet/sgi/ioc3-eth.c | 8 +- drivers/net/ethernet/silan/sc92031.c | 4 +- drivers/net/ethernet/socionext/netsec.c | 4 +- drivers/net/ethernet/socionext/sni_ave.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 32 ++-- drivers/net/ethernet/sun/cassini.c | 4 +- drivers/net/ethernet/sun/ldmvsw.c | 6 +- drivers/net/ethernet/sun/niu.c | 10 +- drivers/net/ethernet/sun/sungem.c | 8 +- drivers/net/ethernet/sun/sunhme.c | 16 +- drivers/net/ethernet/sun/sunvnet.c | 6 +- drivers/net/ethernet/sun/sunvnet_common.c | 4 +- drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 36 ++-- drivers/net/ethernet/synopsys/dwc-xlgmac-net.c | 2 +- drivers/net/ethernet/tehuti/tehuti.c | 12 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 12 +- drivers/net/ethernet/ti/cpsw.c | 4 +- drivers/net/ethernet/ti/cpsw_new.c | 2 +- drivers/net/ethernet/ti/netcp_core.c | 8 +- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 12 +- drivers/net/ethernet/toshiba/spider_net.c | 8 +- drivers/net/ethernet/tundra/tsi108_eth.c | 4 +- drivers/net/ethernet/via/via-rhine.c | 4 +- drivers/net/ethernet/via/via-velocity.c | 6 +- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 6 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 8 +- drivers/net/fjes/fjes_main.c | 2 +- drivers/net/geneve.c | 14 +- drivers/net/gtp.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 24 +-- drivers/net/hyperv/rndis_filter.c | 26 +-- drivers/net/ifb.c | 8 +- drivers/net/ipa/ipa_modem.c | 4 +- drivers/net/ipvlan/ipvlan_main.c | 30 ++-- drivers/net/ipvlan/ipvtap.c | 4 +- drivers/net/loopback.c | 8 +- drivers/net/macsec.c | 20 +-- drivers/net/macvlan.c | 46 ++--- drivers/net/macvtap.c | 6 +- drivers/net/net_failover.c | 40 ++--- drivers/net/netdevsim/ipsec.c | 4 +- drivers/net/netdevsim/netdev.c | 4 +- drivers/net/nlmon.c | 4 +- drivers/net/ppp/ppp_generic.c | 2 +- drivers/net/tap.c | 24 +-- drivers/net/team/team.c | 46 ++--- drivers/net/tun.c | 34 ++-- drivers/net/usb/aqc111.c | 14 +- drivers/net/usb/ax88179_178a.c | 10 +- drivers/net/usb/cdc-phonet.c | 2 +- drivers/net/usb/cdc_mbim.c | 2 +- drivers/net/usb/lan78xx.c | 16 +- drivers/net/usb/r8152.c | 22 +-- drivers/net/usb/smsc75xx.c | 6 +- drivers/net/usb/smsc95xx.c | 6 +- drivers/net/veth.c | 34 ++-- drivers/net/virtio_net.c | 34 ++-- drivers/net/vmxnet3/vmxnet3_drv.c | 26 +-- drivers/net/vmxnet3/vmxnet3_ethtool.c | 12 +- drivers/net/vmxnet3/vmxnet3_int.h | 4 +- drivers/net/vxlan.c | 16 +- drivers/net/wireguard/device.c | 8 +- drivers/net/wireless/ath/ath10k/mac.c | 4 +- drivers/net/wireless/ath/ath11k/mac.c | 4 +- drivers/net/wireless/ath/ath6kl/main.c | 10 +- drivers/net/wireless/ath/wil6210/netdev.c | 6 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 4 +- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 +- drivers/net/xen-netback/interface.c | 10 +- drivers/net/xen-netfront.c | 22 +-- drivers/s390/net/qeth_core_main.c | 54 +++--- drivers/s390/net/qeth_l2_main.c | 28 +-- drivers/s390/net/qeth_l3_main.c | 16 +- drivers/staging/qlge/qlge_main.c | 16 +- include/linux/if_vlan.h | 2 +- include/linux/netdev_features.h | 147 ++++++++------- include/linux/netdevice.h | 34 ++-- include/net/sock.h | 8 +- include/net/udp.h | 6 +- include/net/vxlan.h | 4 +- lib/vsprintf.c | 4 +- net/8021q/vlan.c | 2 +- net/8021q/vlan.h | 8 +- net/8021q/vlan_dev.c | 34 ++-- net/bridge/br_device.c | 14 +- net/bridge/br_if.c | 6 +- net/bridge/br_private.h | 2 +- net/core/dev.c | 198 +++++++++++---------- net/core/netpoll.c | 2 +- net/core/skbuff.c | 2 +- net/core/sock.c | 10 +- net/dsa/slave.c | 14 +- net/ethtool/features.c | 92 ++++------ net/ethtool/ioctl.c | 136 +++++++++----- net/hsr/hsr_device.c | 18 +- net/ipv4/af_inet.c | 4 +- net/ipv4/esp4_offload.c | 4 +- net/ipv4/gre_offload.c | 4 +- net/ipv4/ip_gre.c | 28 +-- net/ipv4/ip_output.c | 4 +- net/ipv4/ip_tunnel.c | 2 +- net/ipv4/ip_vti.c | 2 +- net/ipv4/ipip.c | 6 +- net/ipv4/ipmr.c | 2 +- net/ipv4/tcp.c | 6 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_offload.c | 4 +- net/ipv4/udp_offload.c | 10 +- net/ipv6/af_inet6.c | 2 +- net/ipv6/esp6_offload.c | 6 +- net/ipv6/inet6_connection_sock.c | 2 +- net/ipv6/ip6_gre.c | 14 +- net/ipv6/ip6_offload.c | 2 +- net/ipv6/ip6_output.c | 4 +- net/ipv6/ip6_tunnel.c | 8 +- net/ipv6/ip6mr.c | 2 +- net/ipv6/sit.c | 8 +- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/udp_offload.c | 2 +- net/mac80211/iface.c | 8 +- net/mac80211/main.c | 4 +- net/nsh/nsh.c | 2 +- net/sched/sch_taprio.c | 4 +- net/wireless/core.c | 11 +- 301 files changed, 2351 insertions(+), 2343 deletions(-)
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index f0ad82b..68796ca 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -1343,10 +1343,10 @@ static void vector_net_tx_timeout(struct net_device *dev, unsigned int txqueue) }
static void vector_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &features); + features); }
static int vector_set_features(struct net_device *dev, @@ -1627,10 +1627,10 @@ static void vector_eth_configure( .bpf = NULL });
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); tasklet_setup(&vp->tx_poll, vector_tx_poll); INIT_WORK(&vp->reset_tx, vector_reset_tx);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 5fd0b7a..f49f7a5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -215,7 +215,7 @@ static int ipoib_stop(struct net_device *dev) }
static void ipoib_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -1851,13 +1851,13 @@ static void ipoib_set_dev_features(struct ipoib_dev_priv *priv)
if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &priv->dev->hw_features); + priv->dev->hw_features);
if (priv->hca_caps & IB_DEVICE_UD_TSO) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &priv->dev->hw_features); + priv->dev->hw_features);
- netdev_feature_or(&priv->dev->features, priv->dev->features, + netdev_feature_or(priv->dev->features, priv->dev->features, priv->dev->hw_features); } } @@ -2122,7 +2122,7 @@ void ipoib_setup_common(struct net_device *dev) dev->type = ARPHRD_INFINIBAND; dev->tx_queue_len = ipoib_sendq_size * 2; netdev_feature_set_bits(NETIF_F_VLAN_CHALLENGED | - NETIF_F_HIGHDMA, &dev->features); + NETIF_F_HIGHDMA, dev->features); netif_keep_dst(dev);
memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN); diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 30d47c8..fb0e8e2 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -529,14 +529,14 @@ static void bareudp_setup(struct net_device *dev) dev->needs_free_netdev = true; SET_NETDEV_DEVTYPE(dev, &bareudp_type); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features); dev->hard_header_len = 0; dev->addr_len = 0; dev->mtu = ETH_DATA_LEN; diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index fb1ad49..e8fd253 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1356,7 +1356,7 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev) /*---------------------------------- IOCTL ----------------------------------*/
static void bond_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct bonding *bond = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(mask); @@ -1370,13 +1370,13 @@ static void bond_fix_features(struct net_device *dev, netdev_feature_clear_bits(BOND_TLS_FEATURES, features); #endif
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(mask, features);
netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
bond_for_each_slave(bond, slave, iter) { - netdev_increment_features(features, *features, + netdev_increment_features(features, features, slave->dev->features, mask); } netdev_add_tso_features(features, mask); @@ -1414,42 +1414,42 @@ static void bond_compute_features(struct bonding *bond) unsigned int gso_max_size = GSO_MAX_SIZE; u16 gso_max_segs = GSO_MAX_SEGS;
- netdev_feature_zero(&vlan_features); - netdev_feature_set_bits(BOND_VLAN_FEATURES, &vlan_features); - netdev_feature_copy(&vlan_mask, vlan_features); - netdev_feature_zero(&enc_features); - netdev_feature_set_bits(BOND_ENC_FEATURES, &enc_features); - netdev_feature_copy(&enc_mask, enc_features); + netdev_feature_zero(vlan_features); + netdev_feature_set_bits(BOND_VLAN_FEATURES, vlan_features); + netdev_feature_copy(vlan_mask, vlan_features); + netdev_feature_zero(enc_features); + netdev_feature_set_bits(BOND_ENC_FEATURES, enc_features); + netdev_feature_copy(enc_mask, enc_features); #ifdef CONFIG_XFRM_OFFLOAD - netdev_feature_zero(&xfrm_features); - netdev_feature_set_bits(BOND_XFRM_FEATURES, &xfrm_features); - netdev_feature_copy(&xfrm_mask, xfrm_features); + netdev_feature_zero(xfrm_features); + netdev_feature_set_bits(BOND_XFRM_FEATURES, xfrm_features); + netdev_feature_copy(xfrm_mask, xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */ - netdev_feature_zero(&mpls_features); - netdev_feature_set_bits(BOND_MPLS_FEATURES, &mpls_features); - netdev_feature_copy(&mpls_mask, mpls_features); + netdev_feature_zero(mpls_features); + netdev_feature_set_bits(BOND_MPLS_FEATURES, mpls_features); + netdev_feature_copy(mpls_mask, mpls_features);
if (!bond_has_slaves(bond)) goto done; - netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &vlan_features); - netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &mpls_features); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, mpls_features);
bond_for_each_slave(bond, slave, iter) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, slave->dev->vlan_features, vlan_mask);
- netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, slave->dev->hw_enc_features, enc_mask);
#ifdef CONFIG_XFRM_OFFLOAD - netdev_increment_features(&xfrm_features, xfrm_features, + netdev_increment_features(xfrm_features, xfrm_features, slave->dev->hw_enc_features, xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */
- netdev_increment_features(&mpls_features, mpls_features, + netdev_increment_features(mpls_features, mpls_features, slave->dev->mpls_features, mpls_mask);
@@ -1463,16 +1463,16 @@ static void bond_compute_features(struct bonding *bond) bond_dev->hard_header_len = max_hard_header_len;
done: - netdev_feature_copy(&bond_dev->vlan_features, vlan_features); - netdev_feature_copy(&bond_dev->hw_enc_features, enc_features); + netdev_feature_copy(bond_dev->vlan_features, vlan_features); + netdev_feature_copy(bond_dev->hw_enc_features, enc_features); netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX, &mpls_features); + NETIF_F_HW_VLAN_STAG_TX, mpls_features); #ifdef CONFIG_XFRM_OFFLOAD - netdev_feature_or(&bond_dev->vlan_features, bond_dev->vlan_features, + netdev_feature_or(bond_dev->vlan_features, bond_dev->vlan_features, xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */ - netdev_feature_copy(&bond_dev->mpls_features, mpls_features); + netdev_feature_copy(bond_dev->mpls_features, mpls_features); bond_dev->gso_max_segs = gso_max_segs; netif_set_gso_max_size(bond_dev, gso_max_size);
@@ -2296,7 +2296,7 @@ static int __bond_release_one(struct net_device *bond_dev, struct sockaddr_storage ss; int old_flags = bond_dev->flags;
- netdev_feature_copy(&old_features, bond_dev->features); + netdev_feature_copy(old_features, bond_dev->features); /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || !netdev_has_upper_dev(slave_dev, bond_dev)) { @@ -5423,7 +5423,7 @@ void bond_setup(struct net_device *bond_dev) #endif /* CONFIG_XFRM_OFFLOAD */
/* don't acquire bond device's netif_tx_lock when transmitting */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &bond_dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, bond_dev->features);
/* By default, we declare the bond to be fully * VLAN hardware accelerated capable. Special @@ -5433,30 +5433,30 @@ void bond_setup(struct net_device *bond_dev) */
/* Don't allow bond devices to change network namespaces. */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &bond_dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, bond_dev->features);
- netdev_feature_zero(&bond_dev->hw_features); + netdev_feature_zero(bond_dev->hw_features); netdev_feature_set_bits(BOND_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &bond_dev->hw_features); + bond_dev->hw_features);
- netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &bond_dev->hw_features); - netdev_feature_or(&bond_dev->features, bond_dev->features, + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, bond_dev->hw_features); + netdev_feature_or(bond_dev->features, bond_dev->features, bond_dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &bond_dev->features); + bond_dev->features); #ifdef CONFIG_XFRM_OFFLOAD - netdev_feature_set_bits(BOND_XFRM_FEATURES, &bond_dev->hw_features); + netdev_feature_set_bits(BOND_XFRM_FEATURES, bond_dev->hw_features); /* Only enable XFRM features if this is an active-backup config */ if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) netdev_feature_set_bits(BOND_XFRM_FEATURES, - &bond_dev->features); + bond_dev->features); #endif /* CONFIG_XFRM_OFFLOAD */ #if IS_ENABLED(CONFIG_TLS_DEVICE) if (bond_sk_check(bond)) - netdev_feature_set_bits(BOND_TLS_FEATURES, &bond_dev->features); + netdev_feature_set_bits(BOND_TLS_FEATURES, bond_dev->features); #endif }
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index b0c3a28..bc36053 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -779,10 +779,10 @@ static bool bond_set_xfrm_features(struct bonding *bond)
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) netdev_feature_set_bits(BOND_XFRM_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features); else netdev_feature_clear_bits(BOND_XFRM_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features);
return true; } @@ -794,10 +794,10 @@ static bool bond_set_tls_features(struct bonding *bond)
if (bond_sk_check(bond)) netdev_feature_set_bits(BOND_TLS_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features); else netdev_feature_clear_bits(BOND_TLS_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features);
return true; } diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 45c7d48..a4b4c22 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -232,8 +232,8 @@ void can_setup(struct net_device *dev)
/* New-style flags. */ dev->flags = IFF_NOARP; - netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, dev->features); }
/* Allocate and setup space for the CAN network device */ diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 8af2cf0..e647242 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c @@ -450,8 +450,8 @@ static void slc_setup(struct net_device *dev)
/* New-style flags. */ dev->flags = IFF_NOARP; - netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, dev->features); }
/****************************************** diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c index 898426c..a6951eb 100644 --- a/drivers/net/dsa/xrs700x/xrs700x.c +++ b/drivers/net/dsa/xrs700x/xrs700x.c @@ -640,7 +640,7 @@ static int xrs700x_hsr_join(struct dsa_switch *ds, int port, for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; netdev_feature_set_bits(XRS7000X_SUPPORTED_HSR_FEATURES, - &slave->features); + slave->features); }
return 0; @@ -695,7 +695,7 @@ static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; netdev_feature_clear_bits(XRS7000X_SUPPORTED_HSR_FEATURES, - &slave->features); + slave->features); }
return 0; diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 54ebb63..993a972 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -123,13 +123,13 @@ static void dummy_setup(struct net_device *dev) dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; - netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | - NETIF_F_LLTX, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + NETIF_F_LLTX, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); eth_hw_addr_random(dev);
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 98b6b5b..76d9493 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c @@ -1447,7 +1447,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) || hw_checksums[card_idx] == 1)) { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &dev->features); + dev->features); } } else dev->netdev_ops = &vortex_netdev_ops; diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c index 5ec10b9..b6d10f7 100644 --- a/drivers/net/ethernet/3com/typhoon.c +++ b/drivers/net/ethernet/3com/typhoon.c @@ -2458,12 +2458,12 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * on the current 3XP firmware -- it does not respect the offload * settings -- so we only allow the user to toggle the TX processing. */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM, - &dev->features); + dev->features);
err = register_netdev(dev); if (err < 0) { diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c index a9dcdad..ff9a7e4e 100644 --- a/drivers/net/ethernet/adaptec/starfire.c +++ b/drivers/net/ethernet/adaptec/starfire.c @@ -685,16 +685,16 @@ static int starfire_init_one(struct pci_dev *pdev, /* Starfire can do TCP/UDP checksumming */ if (enable_hw_cksum) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &dev->features); + dev->features); #endif /* ZEROCOPY */
#ifdef VLAN_SUPPORT netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features); #endif /* VLAN_RX_KILL_VID */ #ifdef ADDR_64BITS - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); #endif /* ADDR_64BITS */
/* Serial EEPROM reads are hidden by the hardware. */ diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index 2c0fc81..65d5080 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c @@ -1485,11 +1485,11 @@ static int greth_of_probe(struct platform_device *ofdev) GRETH_REGSAVE(regs->status, 0xFF);
if (greth->gbit_mac) { - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + NETIF_F_RXCSUM, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); greth_netdev_ops.ndo_start_xmit = greth_start_xmit_gbit; }
diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c index 9d0d007..c8eba4b 100644 --- a/drivers/net/ethernet/alacritech/slicoss.c +++ b/drivers/net/ethernet/alacritech/slicoss.c @@ -1778,9 +1778,9 @@ static int slic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, dev); dev->irq = pdev->irq; dev->netdev_ops = &slic_netdev_ops; - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
dev->ethtool_ops = &slic_ethtool_ops;
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c index 1e8a692..7fcf793 100644 --- a/drivers/net/ethernet/alteon/acenic.c +++ b/drivers/net/ethernet/alteon/acenic.c @@ -469,9 +469,9 @@ static int acenic_probe_one(struct pci_dev *pdev, ap->pdev = pdev; ap->name = pci_name(pdev);
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM, &dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM, dev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->features); + NETIF_F_HW_VLAN_CTAG_RX, dev->features);
dev->watchdog_timeo = 5*HZ; dev->min_mtu = 0; @@ -591,7 +591,7 @@ static int acenic_probe_one(struct pci_dev *pdev, ap->name = dev->name;
if (ap->pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
pci_set_drvdata(pdev, dev);
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index b488140..9945210 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -1551,15 +1551,15 @@ static int altera_tse_probe(struct platform_device *pdev) /* Scatter/gather IO is not supported, * so it is turned off */ - netdev_feature_clear_bit(NETIF_F_SG_BIT, &ndev->hw_features); - netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features);
/* VLAN offloading of tagging, stripping and filtering is not * supported by hardware, but driver will accommodate the * extra 4-byte VLAN tag for processing by upper layers */ - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, ndev->features);
/* setup NAPI interface */ netif_napi_add(ndev, &priv->napi, tse_poll, NAPI_POLL_WEIGHT); diff --git a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h index f5ec35f..ff51c2e 100644 --- a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +++ b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h @@ -839,7 +839,7 @@ struct ena_admin_host_info { u32 driver_version;
/* features bitmap */ - u32 supported_network_features[2]; + u32 supported_network_features[DIV_ROUND_UP(NETDEV_FEATURE_COUNT, 32)];
/* ENA spec version of driver */ u16 ena_spec_version; diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 3eda740..730d890 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -3944,10 +3944,8 @@ static void ena_update_hints(struct ena_adapter *adapter, static void ena_update_host_info(struct ena_admin_host_info *host_info, struct net_device *netdev) { - host_info->supported_network_features[0] = - netdev->features & GENMASK_ULL(31, 0); - host_info->supported_network_features[1] = - (netdev->features & GENMASK_ULL(63, 32)) >> 32; + bitmap_to_arr32(host_info->supported_network_features, netdev->features, + NETDEV_FEATURE_COUNT); }
static void ena_timer_service(struct timer_list *t) @@ -4028,43 +4026,43 @@ static void ena_set_dev_offloads(struct ena_com_dev_get_features_ctx *feat, { __DECLARE_NETDEV_FEATURE_MASK(dev_features);
- netdev_feature_zero(&dev_features); + netdev_feature_zero(dev_features);
/* Set offload features */ if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK) - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK) - netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK) - netdev_feature_set_bit(NETIF_F_TSO_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK) - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK) - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, dev_features);
if (feat->offload.rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev_features);
if (feat->offload.rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev_features);
- netdev_feature_copy(&netdev->features, dev_features); + netdev_feature_copy(netdev->features, dev_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXHASH | NETIF_F_HIGHDMA, - &netdev->features); + netdev->features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); }
diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c index 1757eac..29ba85d 100644 --- a/drivers/net/ethernet/amd/amd8111e.c +++ b/drivers/net/ethernet/amd/amd8111e.c @@ -1792,7 +1792,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev, #if AMD8111E_VLAN_TAG_USED netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->features); + dev->features); #endif
lp = netdev_priv(dev); @@ -1833,7 +1833,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev, #if AMD8111E_VLAN_TAG_USED netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->features); + dev->features); #endif /* Probe the external PHY */ amd8111e_probe_ext_phy(dev); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 1caffe1..2e99007 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2183,39 +2183,39 @@ static int xgbe_setup_tc(struct net_device *netdev, enum tc_setup_type type, }
static void xgbe_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct xgbe_prv_data *pdata = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(vxlan_base);
- netdev_feature_zero(&vxlan_base); + netdev_feature_zero(vxlan_base); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_RX_UDP_TUNNEL_PORT, - &vxlan_base); + vxlan_base);
if (!pdata->hw_feat.vxn) return;
/* VXLAN CSUM requires VXLAN base */ if (netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - *features) && - !netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, *features)) { + features) && + !netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, features)) { netdev_notice(netdev, "forcing tx udp tunnel support\n"); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, features); }
/* Can't do one without doing the other */ - if (!netdev_feature_subset(*features, vxlan_base)) { + if (!netdev_feature_subset(features, vxlan_base)) { netdev_notice(netdev, "forcing both tx and rx udp tunnel support\n"); - netdev_feature_or(features, *features, vxlan_base); + netdev_feature_or(features, features, vxlan_base); }
if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - *features)) { + features)) { if (!netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - *features)) { + features)) { netdev_notice(netdev, "forcing tx udp tunnel checksumming on\n"); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, @@ -2223,7 +2223,7 @@ static void xgbe_fix_features(struct net_device *netdev, } } else { if (netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - *features)) { + features)) { netdev_notice(netdev, "forcing tx udp tunnel checksumming off\n"); netdev_feature_clear_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, @@ -2277,7 +2277,7 @@ static int xgbe_set_features(struct net_device *netdev, features) && rxvlan_filter) hw_if->disable_rx_vlan_filtering(pdata);
- netdev_feature_copy(&features, pdata->netdev_features); + netdev_feature_copy(features, pdata->netdev_features);
DBGPR("<--xgbe_set_features\n");
@@ -2285,7 +2285,7 @@ static int xgbe_set_features(struct net_device *netdev, }
static void xgbe_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); vxlan_features_check(skb, features); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index ace7324..a99b757 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c @@ -342,7 +342,7 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) #endif
/* Set device features */ - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -353,14 +353,14 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER, - &netdev->hw_features); + netdev->hw_features);
if (pdata->hw_feat.rss) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features);
if (pdata->hw_feat.vxn) { - netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -370,11 +370,11 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) NETIF_F_GRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_features); + netdev->hw_features);
netdev->udp_tunnel_nic_info = xgbe_get_udp_tunnel_info(); } @@ -384,11 +384,11 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_copy(&pdata->netdev_features, netdev->features); + netdev_feature_copy(pdata->netdev_features, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->min_mtu = 0; diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c index fabc904..068b0f1 100644 --- a/drivers/net/ethernet/apm/xgene-v2/main.c +++ b/drivers/net/ethernet/apm/xgene-v2/main.c @@ -648,13 +648,13 @@ static int xge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pdata); ndev->netdev_ops = &xgene_ndev_ops;
- netdev_feature_set_bits(NETIF_F_GSO | NETIF_F_GRO, &ndev->features); + netdev_feature_set_bits(NETIF_F_GSO | NETIF_F_GRO, ndev->features);
ret = xge_get_resources(pdata); if (ret) goto err;
- netdev_feature_copy(&ndev->hw_features, ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features); xge_set_ethtool_ops(ndev);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index ed67bec..10a6b16 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -2037,7 +2037,7 @@ static int xgene_enet_probe(struct platform_device *pdev) NETIF_F_GSO | NETIF_F_GRO | NETIF_F_SG, - &ndev->features); + ndev->features);
of_id = of_match_device(xgene_enet_of_match, &pdev->dev); if (of_id) { @@ -2066,10 +2066,10 @@ static int xgene_enet_probe(struct platform_device *pdev)
if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM, - &ndev->features); + ndev->features); spin_lock_init(&pdata->mss_lock); } - netdev_feature_copy(&ndev->hw_features, ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); if (ret) { diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c index 0c10d8b..591f589 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c @@ -1490,7 +1490,7 @@ int aq_macsec_init(struct aq_nic_s *nic) if (!nic->macsec_cfg) return -ENOMEM;
- netdev_feature_set_bit(NETIF_F_HW_MACSEC_BIT, &nic->ndev->features); + netdev_feature_set_bit(NETIF_F_HW_MACSEC_BIT, nic->ndev->features); nic->ndev->macsec_ops = &aq_macsec_ops;
return 0; diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index a153b99..4496bb5 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c @@ -174,7 +174,7 @@ static int aq_ndev_set_features(struct net_device *ndev, } }
- netdev_feature_copy(&aq_cfg->features, features); + netdev_feature_copy(aq_cfg->features, features);
if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) { is_lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, features); diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index 5e73a46..4c7ae4b 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -144,8 +144,8 @@ void aq_nic_cfg_start(struct aq_nic_s *self) cfg->link_irq_vec = 0;
cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; - netdev_feature_zero(&cfg->features); - netdev_feature_set_bits(cfg->aq_hw_caps->hw_features, &cfg->features); + netdev_feature_zero(cfg->features); + netdev_feature_set_bits(cfg->aq_hw_caps->hw_features, cfg->features); cfg->is_vlan_rx_strip = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, cfg->features); @@ -373,16 +373,16 @@ void aq_nic_ndev_init(struct aq_nic_s *self) struct aq_nic_cfg_s *aq_nic_cfg = &self->aq_nic_cfg;
netdev_feature_set_bits(aq_hw_caps->hw_features, - &self->ndev->hw_features); - netdev_feature_zero(&self->ndev->features); - netdev_feature_set_bits(aq_hw_caps->hw_features, &self->ndev->features); + self->ndev->hw_features); + netdev_feature_zero(self->ndev->features); + netdev_feature_set_bits(aq_hw_caps->hw_features, self->ndev->features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_SG | NETIF_F_LRO | NETIF_F_TSO | NETIF_F_TSO6, - &self->ndev->vlan_features); - netdev_feature_zero(&self->ndev->gso_partial_features); + self->ndev->vlan_features); + netdev_feature_zero(self->ndev->gso_partial_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &self->ndev->gso_partial_features); + self->ndev->gso_partial_features); self->ndev->priv_flags = aq_hw_caps->hw_priv_flags; self->ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 2f79aa6..4451513 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -1099,7 +1099,7 @@ static int alx_init_sw(struct alx_priv *alx)
static void alx_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (netdev->mtu > ALX_MAX_TSO_PKT_SIZE) netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, @@ -1818,12 +1818,12 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } }
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | - NETIF_F_TSO6, &netdev->hw_features); + NETIF_F_TSO6, netdev->hw_features);
if (alx_get_perm_macaddr(hw, hw->perm_addr)) { dev_warn(&pdev->dev, diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 86f8e88..3e32dc0 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -505,7 +505,7 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, }
static void atl1c_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_hw *hw = &adapter->hw; @@ -514,7 +514,7 @@ static void atl1c_fix_features(struct net_device *netdev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -532,7 +532,7 @@ static int atl1c_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl1c_vlan_mode(netdev, features); @@ -2630,14 +2630,14 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev) atl1c_set_ethtool_ops(netdev);
/* TODO: add when ready */ - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | - NETIF_F_TSO6, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, &netdev->features); + NETIF_F_TSO6, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, netdev->features); return 0; }
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 5502fc9..377bb40 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -383,13 +383,13 @@ static int atl1e_set_mac_addr(struct net_device *netdev, void *p) }
static void atl1e_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -401,7 +401,7 @@ static int atl1e_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl1e_vlan_mode(netdev, features);
@@ -2270,14 +2270,14 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev) (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN); atl1e_set_ethtool_ops(netdev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, netdev->features); /* not enabled by default */ netdev_feature_set_bits(NETIF_F_RXALL | NETIF_F_RXFCS, - &netdev->hw_features); + netdev->hw_features); return 0; }
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index a717cd0..0310f35 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c @@ -2988,18 +2988,18 @@ static int atl1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_common;
- netdev_feature_zero(&netdev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->features); + netdev_feature_zero(netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->hw_features);
/* is this valid? see atl1_setup_mac_ctrl() */ - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features);
/* MTU range: 42 - 10218 */ netdev->min_mtu = ETH_ZLEN - (ETH_HLEN + VLAN_HLEN); diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index 943f2af..0513696 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c @@ -372,13 +372,13 @@ static void atl2_restore_vlan(struct atl2_adapter *adapter) }
static void atl2_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -390,7 +390,7 @@ static int atl2_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl2_vlan_mode(netdev, features);
@@ -1389,11 +1389,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features);
/* Init PHY as early as possible due to power saving issue */ atl2_phy_init(&adapter->hw); diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index ea5b6d7..0474ae3 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c @@ -238,13 +238,13 @@ static void atlx_restore_vlan(struct atlx_adapter *adapter) }
static void atlx_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -256,7 +256,7 @@ static int atlx_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atlx_vlan_mode(netdev, features);
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 80c0998..0b35f6a 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c @@ -2353,7 +2353,7 @@ static int b44_init_one(struct ssb_device *sdev, SET_NETDEV_DEV(dev, sdev->dev);
/* No interesting netdevice features in this card... */ - netdev_feature_set_bits(0, &dev->features); + netdev_feature_set_bits(0, dev->features);
bp = netdev_priv(dev); bp->sdev = sdev; diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index e1df027..630b415 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -2568,9 +2568,9 @@ static int bcm_sysport_probe(struct platform_device *pdev)
netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_HW_VLAN_CTAG_TX, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + NETIF_F_HW_VLAN_CTAG_TX, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features); dev->max_mtu = UMAC_MAX_MTU_SIZE;
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index c99800b..7ff3d3a 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -1535,11 +1535,11 @@ int bgmac_enet_probe(struct bgmac *bgmac) goto err_dma_free; }
- netdev_feature_zero(&net_dev->features); + netdev_feature_zero(net_dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &net_dev->features); - netdev_feature_copy(&net_dev->hw_features, net_dev->features); - netdev_feature_copy(&net_dev->vlan_features, net_dev->features); + NETIF_F_IPV6_CSUM, net_dev->features); + netdev_feature_copy(net_dev->hw_features, net_dev->features); + netdev_feature_copy(net_dev->vlan_features, net_dev->features);
/* Omit FCS from max MTU size */ net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN; diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index c26e418..a60786d 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -7749,19 +7749,18 @@ bnx2_set_features(struct net_device *dev, netdev_features_t features)
/* TSO with VLAN tag won't work with current firmware */ if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) { - netdev_feature_copy(&tmp, dev->hw_features); - netdev_feature_and_bits(NETIF_F_ALL_TSO, &tmp); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, - tmp); + netdev_feature_copy(tmp, dev->hw_features); + netdev_feature_and_bits(NETIF_F_ALL_TSO, tmp); + netdev_feature_or(dev->vlan_features, dev->vlan_features, tmp); } else { - netdev_feature_clear_bits(NETIF_F_ALL_TSO, &dev->vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_TSO, dev->vlan_features); }
if ((netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) != !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) && netif_running(dev)) { bnx2_netif_stop(bp, false); - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); bnx2_set_rx_mode(dev); bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); bnx2_netif_start(bp, false); @@ -8233,7 +8232,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
/* Configure DMA attributes. */ if (pci_set_dma_mask(pdev, dma_mask) == 0) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (rc) { dev_err(&pdev->dev, @@ -8601,27 +8600,27 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_RXHASH | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features);
if (BNX2_CHIP(bp) == BNX2_CHIP_5709) netdev_feature_set_bits(NETIF_F_IPV6_CSUM | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features);
- netdev_feature_copy(&dev->vlan_features, dev->hw_features); + netdev_feature_copy(dev->vlan_features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); dev->priv_flags |= IFF_UNICAST_FLT; dev->min_mtu = MIN_ETHERNET_PACKET_SIZE; dev->max_mtu = MAX_ETHERNET_JUMBO_PACKET_SIZE;
if (!(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->hw_features); + dev->hw_features);
if ((rc = register_netdev(dev))) { dev_err(&pdev->dev, "Cannot register net device\n"); diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 30c8ea6..36b5366 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -4893,7 +4893,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) dev->mtu = new_mtu;
if (!bnx2x_mtu_allows_gro(new_mtu)) - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, dev->features);
if (IS_PF(bp) && SHMEM2_HAS(bp, curr_cfg)) SHMEM2_WR(bp, curr_cfg, CURR_CFG_MET_OS); @@ -4901,19 +4901,19 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) return bnx2x_reload_if_running(dev); }
-void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) +void bnx2x_fix_features(struct net_device *dev, netdev_features_t features) { struct bnx2x *bp = netdev_priv(dev);
if (pci_num_vf(bp->pdev)) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, *features); + netdev_feature_xor(changed, dev->features, features);
/* Revert the requested changes in features if they * would require internal reload of PF in bnx2x_set_features(). */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && !bp->disable_tpa) { if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) @@ -4932,13 +4932,13 @@ void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) }
/* TPA requires Rx CSUM offloading */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
- if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features) || + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, features) || !bnx2x_mtu_allows_gro(dev->mtu)) netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); - if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
@@ -4949,7 +4949,7 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) bool bnx2x_reload = false; int rc;
- netdev_feature_xor(&changes, dev->features, features); + netdev_feature_xor(changes, dev->features, features);
/* VFs or non SRIOV PFs should be able to change loopback feature */ if (!pci_num_vf(bp->pdev)) { @@ -4967,14 +4967,14 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) }
/* Don't care about GRO changes */ - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &changes); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, changes);
if (!netdev_feature_empty(changes)) bnx2x_reload = true;
if (bnx2x_reload) { if (bp->recovery_state == BNX2X_RECOVERY_DONE) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); rc = bnx2x_reload_if_running(dev); return rc ? rc : 1; } diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index 4c66ef3..f4c82b9 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h @@ -606,7 +606,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu); int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type); #endif
-void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features); +void bnx2x_fix_features(struct net_device *dev, netdev_features_t features); int bnx2x_set_features(struct net_device *dev, netdev_features_t features);
/** diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 82cfee2..23ae839 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12384,9 +12384,9 @@ static int bnx2x_init_bp(struct bnx2x *bp) /* Set TPA flags */ if (bp->disable_tpa) { netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->hw_features); + bp->dev->hw_features); netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->features); + bp->dev->features); }
if (CHIP_IS_E1(bp)) @@ -12888,7 +12888,7 @@ static int bnx2x_get_phys_port_id(struct net_device *netdev, }
static void bnx2x_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* * A skb with gso_size + header length > 9700 will cause a @@ -13243,62 +13243,62 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
dev->priv_flags |= IFF_UNICAST_FLT;
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | NETIF_F_GRO_HW | NETIF_F_RXHASH | - NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, dev->hw_features); if (!chip_is_e1x) { netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL, &dev->hw_features); + NETIF_F_GSO_PARTIAL, dev->hw_features);
- netdev_feature_zero(&dev->hw_enc_features); + netdev_feature_zero(dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL, &dev->hw_enc_features); + NETIF_F_GSO_PARTIAL, dev->hw_enc_features);
- netdev_feature_zero(&dev->gso_partial_features); + netdev_feature_zero(dev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &dev->gso_partial_features); + dev->gso_partial_features);
if (IS_PF(bp)) dev->udp_tunnel_nic_info = &bnx2x_udp_tunnels; }
- netdev_feature_zero(&dev->vlan_features); + netdev_feature_zero(dev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | - NETIF_F_HIGHDMA, &dev->vlan_features); + NETIF_F_HIGHDMA, dev->vlan_features);
if (IS_PF(bp)) { if (chip_is_e1x) bp->accept_any_vlan = true; else netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->hw_features); + dev->hw_features); } /* For VF we'll know whether to enable VLAN filtering after * getting a response to CHANNEL_TLV_ACQUIRE from PF. */
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, dev->features);
/* Add Loopback capability to the device */ - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, dev->features);
#ifdef BCM_DCBNL dev->dcbnl_ops = &bnx2x_dcbnl_ops; @@ -14002,9 +14002,9 @@ static int bnx2x_init_one(struct pci_dev *pdev, /* VF with OLD Hypervisor or old PF do not support filtering */ if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->features); + dev->features); } #endif } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index a43ee06..da1a097 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6502,9 +6502,9 @@ static int __bnxt_reserve_rings(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_AGG_RINGS; bp->flags |= BNXT_FLAG_NO_AGG_RINGS; netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &bp->dev->hw_features); + bp->dev->hw_features); netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &bp->dev->features); + bp->dev->features); bnxt_set_ring_params(bp); } } @@ -10229,7 +10229,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) !(bp->flags & BNXT_FLAG_USING_MSIX)) { /* disable RFS if falling back to INTA */ netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &bp->dev->hw_features); + bp->dev->hw_features); bp->flags &= ~BNXT_FLAG_RFS; }
@@ -10920,13 +10920,13 @@ static bool bnxt_rfs_capable(struct bnxt *bp) }
static void bnxt_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(vlan_features); __DECLARE_NETDEV_FEATURE_MASK(tmp); struct bnxt *bp = netdev_priv(dev);
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) && !bnxt_rfs_capable(bp)) netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features);
@@ -10934,26 +10934,26 @@ static void bnxt_fix_features(struct net_device *dev, netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, features);
- if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, features)) netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
/* Both CTAG and STAG VLAN accelaration on the RX side have to be * turned on or off together. */ - netdev_feature_zero(&tmp); - netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, &tmp); - netdev_feature_and(&vlan_features, *features, tmp); + netdev_feature_zero(tmp); + netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, tmp); + netdev_feature_and(vlan_features, features, tmp); if (!netdev_feature_equal(vlan_features, tmp)) { if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, dev->features)) netdev_feature_clear_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, - &dev->features); + dev->features); else if (!netdev_feature_empty(vlan_features)) netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, - &dev->features); + dev->features); } #ifdef CONFIG_BNXT_SRIOV if (BNXT_VF(bp) && bp->vf.vlan) @@ -11124,7 +11124,7 @@ static bool bnxt_tunl_check(struct bnxt *bp, struct sk_buff *skb, u8 l4_proto) }
static void bnxt_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct bnxt *bp = netdev_priv(dev); u8 *l4_proto; @@ -11984,15 +11984,15 @@ static void bnxt_set_dflt_rfs(struct bnxt *bp) { struct net_device *dev = bp->dev;
- netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); - netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, dev->hw_features); + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, dev->features); bp->flags &= ~BNXT_FLAG_RFS; if (bnxt_rfs_supported(bp)) { - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, dev->hw_features); if (bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS; netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &dev->features); + dev->features); } } } @@ -12972,9 +12972,9 @@ static int bnxt_get_dflt_rings(struct bnxt *bp, int *max_rx, int *max_tx, } bp->flags |= BNXT_FLAG_NO_AGG_RINGS; netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->hw_features); + bp->dev->hw_features); netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->features); + bp->dev->features); bnxt_set_ring_params(bp); }
@@ -13089,7 +13089,7 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp) bp->tx_nr_rings_per_tc = bp->tx_nr_rings; if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS; - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &bp->dev->features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, bp->dev->features); } init_dflt_ring_err: bnxt_ulp_irq_restart(bp, rc); @@ -13310,7 +13310,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) goto init_err_pci_clean; }
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | @@ -13318,38 +13318,38 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_PARTIAL | NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_GRO, - &dev->hw_features); + dev->hw_features);
if (BNXT_SUPPORTS_TPA(bp)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->hw_features);
- netdev_feature_zero(&dev->hw_enc_features); + netdev_feature_zero(dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_PARTIAL, &dev->hw_enc_features); + NETIF_F_GSO_PARTIAL, dev->hw_enc_features); dev->udp_tunnel_nic_info = &bnxt_udp_tunnels;
- netdev_feature_zero(&dev->gso_partial_features); + netdev_feature_zero(dev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM, - &dev->gso_partial_features); - netdev_feature_copy(&dev->vlan_features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->vlan_features); + dev->gso_partial_features); + netdev_feature_copy(dev->vlan_features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->vlan_features); if (bp->fw_cap & BNXT_FW_CAP_VLAN_RX_STRIP) netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, - &dev->hw_features); + dev->hw_features); if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_TX, - &dev->hw_features); + dev->hw_features); if (BNXT_SUPPORTS_TPA(bp)) - netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, dev->features)) - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, dev->features); dev->priv_flags |= IFF_UNICAST_FLT;
#ifdef CONFIG_BNXT_SRIOV diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 0a3fbb4..902540c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -2041,8 +2041,8 @@ int bnxt_init_tc(struct bnxt *bp) goto destroy_decap_table;
tc_info->enabled = true; - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, bp->dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, bp->dev->features); bp->tc_info = tc_info;
/* init indirect block notifications */ diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c index b1d4534..b9b1180 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c @@ -464,12 +464,12 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, /* Just inherit all the featues of the parent PF as the VF-R * uses the RX/TX rings of the parent PF */ - netdev_feature_copy(&dev->hw_features, pf_dev->hw_features); - netdev_feature_copy(&dev->gso_partial_features, + netdev_feature_copy(dev->hw_features, pf_dev->hw_features); + netdev_feature_copy(dev->gso_partial_features, pf_dev->gso_partial_features); - netdev_feature_copy(&dev->vlan_features, pf_dev->vlan_features); - netdev_feature_copy(&dev->hw_enc_features, pf_dev->hw_enc_features); - netdev_feature_copy(&dev->features, pf_dev->features); + netdev_feature_copy(dev->vlan_features, pf_dev->vlan_features); + netdev_feature_copy(dev->hw_enc_features, pf_dev->hw_enc_features); + netdev_feature_copy(dev->features, pf_dev->features); bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx, dev->perm_addr); ether_addr_copy(dev->dev_addr, dev->perm_addr); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 18cc0e3..f97c2b7 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -298,7 +298,7 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog) if (rx > 1) { bp->flags &= ~BNXT_FLAG_NO_AGG_RINGS; netdev_feature_set_bit(NETIF_F_LRO_BIT, - &bp->dev->hw_features); + bp->dev->hw_features); } } bp->tx_nr_rings_xdp = tx_xdp; diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 70cf8be..a2893f2 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3957,9 +3957,9 @@ static int bcmgenet_probe(struct platform_device *pdev)
/* Set default features */ netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | - NETIF_F_RXCSUM, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + NETIF_F_RXCSUM, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features);
/* Request the WOL interrupt and advertise suspend if available */ diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3fcacec..3df551e 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -7883,8 +7883,8 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi, netif_tx_wake_queue(txq); }
- netdev_feature_copy(&tmp, tp->dev->features); - netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, &tmp); + netdev_feature_copy(tmp, tp->dev->features); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, tmp); segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs) || !segs) goto tg3_tso_bug_end; @@ -8309,7 +8309,7 @@ static void tg3_set_loopback(struct net_device *dev, netdev_features_t features) }
static void tg3_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct tg3 *tp = netdev_priv(dev);
@@ -8321,7 +8321,7 @@ static int tg3_set_features(struct net_device *dev, netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && netif_running(dev)) tg3_set_loopback(dev, features); @@ -17619,7 +17619,7 @@ static int tg3_init_one(struct pci_dev *pdev, char str[40]; u64 dma_mask, persist_dma_mask;
- netdev_feature_zero(&features); + netdev_feature_zero(features);
err = pci_enable_device(pdev); if (err) { @@ -17762,7 +17762,7 @@ static int tg3_init_one(struct pci_dev *pdev, if (dma_mask > DMA_BIT_MASK(32)) { err = pci_set_dma_mask(pdev, dma_mask); if (!err) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, features); err = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (err < 0) { @@ -17788,11 +17788,11 @@ static int tg3_init_one(struct pci_dev *pdev, */ if (tg3_chip_rev_id(tp) != CHIPREV_ID_5700_B0) { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM, &features); + NETIF_F_RXCSUM, features);
if (tg3_flag(tp, 5755_PLUS)) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &features); + features); }
/* TSO is on by default on chips that support hardware TSO. @@ -17803,23 +17803,23 @@ static int tg3_init_one(struct pci_dev *pdev, tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) && netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features)) - netdev_feature_set_bit(NETIF_F_TSO_BIT, &features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, features); if (tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) { if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features)) - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, features); if (tg3_flag(tp, HW_TSO_3) || tg3_asic_rev(tp) == ASIC_REV_5761 || (tg3_asic_rev(tp) == ASIC_REV_5784 && tg3_chip_rev(tp) != CHIPREV_5784_AX) || tg3_asic_rev(tp) == ASIC_REV_5785 || tg3_asic_rev(tp) == ASIC_REV_57780) - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, features); }
- netdev_feature_or(&dev->features, dev->features, features); + netdev_feature_or(dev->features, dev->features, features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, features); + NETIF_F_HW_VLAN_CTAG_RX, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, features);
/* * Add loopback capability only for a subset of devices that support @@ -17829,9 +17829,9 @@ static int tg3_init_one(struct pci_dev *pdev, if (tg3_asic_rev(tp) != ASIC_REV_5780 && !tg3_flag(tp, CPMU_PRESENT)) /* Add the loopback capability */ - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, features);
- netdev_feature_or(&dev->hw_features, dev->hw_features, features); + netdev_feature_or(dev->hw_features, dev->hw_features, features); dev->priv_flags |= IFF_UNICAST_FLT;
/* MTU range: 60 - 9000 or 1500, depending on hardware */ diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ed630ce..16262c7 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -3354,7 +3354,7 @@ static int bnad_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); struct bnad *bnad = netdev_priv(dev);
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed) && netif_running(dev)) { unsigned long flags; @@ -3431,27 +3431,27 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac) { struct net_device *netdev = bnad->netdev;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
if (using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
netdev->mem_start = bnad->mmio_start; netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index c7c8fb0..6e91123 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2035,7 +2035,7 @@ static unsigned int macb_tx_map(struct macb *bp, }
static void macb_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int nr_frags, f; unsigned int hdrlen; @@ -3634,7 +3634,7 @@ static int macb_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); struct macb *bp = netdev_priv(netdev);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
/* TX checksum offload */ if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, changed)) @@ -3657,7 +3657,7 @@ static void macb_restore_features(struct macb *bp) struct net_device *netdev = bp->dev; struct ethtool_rx_fs_item *item;
- netdev_feature_copy(&features, netdev->features); + netdev_feature_copy(features, netdev->features);
/* TX checksum offload */ macb_set_txcsum_feature(bp, features); @@ -3943,20 +3943,20 @@ static int macb_init(struct platform_device *pdev) }
/* Set features */ - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->hw_features);
/* Check LSO capability */ if (GEM_BFEXT(PBUF_LSO, gem_readl(bp, DCFG6))) - netdev_feature_set_bits(MACB_NETIF_LSO, &dev->hw_features); + netdev_feature_set_bits(MACB_NETIF_LSO, dev->hw_features);
/* Checksum offload is only available on gem with packet buffer */ if (macb_is_gem(bp) && !(bp->caps & MACB_CAPS_FIFO_MODE)) netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features); if (bp->caps & MACB_CAPS_SG_DISABLED) - netdev_feature_clear_bit(NETIF_F_SG_BIT, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features);
/* Check RX Flow Filters support. * Max Rx flows set by availability of screeners & compare regs: @@ -3975,7 +3975,7 @@ static int macb_init(struct platform_device *pdev) gem_writel_n(bp, ETHT, SCRT2_ETHT, reg); /* Filtering is supported in hw but don't enable it in kernel now */ netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &dev->hw_features); + dev->hw_features); /* init Rx flow definitions */ bp->rx_fs_list.count = 0; spin_lock_init(&bp->rx_fs_lock); diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index 3679fed..6588841a 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c @@ -1493,7 +1493,7 @@ static int xgmac_set_features(struct net_device *dev, netdev_features_t features __DECLARE_NETDEV_FEATURE_MASK(changed); void __iomem *ioaddr = priv->base;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0; @@ -1776,12 +1776,12 @@ static int xgmac_probe(struct platform_device *pdev) priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, - &ndev->hw_features); + ndev->hw_features);
if (readl(priv->base + XGMAC_DMA_HW_FEATURE) & DMA_HW_FEAT_TXCOESEL) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &ndev->hw_features); - netdev_feature_or(&ndev->features, &ndev->features, &ndev->hw_features); + NETIF_F_RXCSUM, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); ndev->priv_flags |= IFF_UNICAST_FLT;
/* MTU range: 46 - 9000 */ diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index a0aa543..a927725 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -2717,38 +2717,38 @@ static const struct udp_tunnel_nic_info liquidio_udp_tunnels = { * Return: updated features list */ static void liquidio_fix_features(struct net_device *netdev, - netdev_features_t *request) + netdev_features_t request) { struct lio *lio = netdev_priv(netdev);
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && !(lio->dev_capability & NETIF_F_RXCSUM)) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, request) && !(lio->dev_capability & NETIF_F_HW_CSUM)) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, request) && !(lio->dev_capability & NETIF_F_TSO)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, request) && !(lio->dev_capability & NETIF_F_TSO6)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, request) && !(lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/*Disable LRO if RXCSUM is off */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - *request) && + request) && !(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, request); @@ -3587,35 +3587,35 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
lio->dev_capability |= NETIF_F_GSO_UDP_TUNNEL;
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(lio->dev_capability, - &netdev->vlan_features); + netdev->vlan_features); /* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
- netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(lio->dev_capability, - &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(lio->dev_capability, - &netdev->hw_features); + netdev->hw_features); /*HW_VLAN_RX and HW_VLAN_FILTER is always on*/ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE; diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index c0112f9..dfbd484 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -1816,32 +1816,32 @@ static const struct udp_tunnel_nic_info liquidio_udp_tunnels = { * @returns updated features list */ static void liquidio_fix_features(struct net_device *netdev, - netdev_features_t *request) + netdev_features_t request) { struct lio *lio = netdev_priv(netdev);
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && !(lio->dev_capability & NETIF_F_RXCSUM)) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, request) && !(lio->dev_capability & NETIF_F_HW_CSUM)) netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, request) && !(lio->dev_capability & NETIF_F_TSO)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, request) && !(lio->dev_capability & NETIF_F_TSO6)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, request) && !(lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/* Disable LRO if RXCSUM is off */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request); @@ -1857,7 +1857,7 @@ static int liquidio_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); struct lio *lio = netdev_priv(netdev);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) return 0;
@@ -2116,33 +2116,33 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->vlan_features); + netdev->vlan_features);
/* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
- netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->hw_features); + netdev->hw_features); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE; diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 87bfd04..d7fb3e0 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1775,11 +1775,11 @@ static int nicvf_config_loopback(struct nicvf *nic, }
static void nicvf_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct nicvf *nic = netdev_priv(netdev);
- if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features) && netif_running(netdev) && !nic->loopback_supported) netdev_feature_clear_bit(NETIF_F_LOOPBACK_BIT, features); } @@ -1790,7 +1790,7 @@ static int nicvf_set_features(struct net_device *netdev, struct nicvf *nic = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) nicvf_config_vlan_stripping(nic, features); @@ -2215,22 +2215,22 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_unregister_interrupts;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_GRO | NETIF_F_TSO6 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->hw_features);
- netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, netdev->hw_features);
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features);
netdev->netdev_ops = &nicvf_netdev_ops; netdev->watchdog_timeo = NICVF_TX_TIMEOUT; diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index e13455e..f1c68ca 100644 --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c @@ -855,13 +855,13 @@ static int t1_set_mac_addr(struct net_device *dev, void *p) return 0; }
-static void t1_fix_features(struct net_device *dev, netdev_features_t *features) +static void t1_fix_features(struct net_device *dev, netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -873,7 +873,7 @@ static int t1_set_features(struct net_device *dev, netdev_features_t features) struct adapter *adapter = dev->ml_priv; __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) t1_vlan_mode(adapter, features);
@@ -1033,27 +1033,27 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->mem_end = mmio_start + mmio_len - 1; netdev->ml_priv = adapter; netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM, &netdev->hw_features); + NETIF_F_RXCSUM, netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_LLTX, - &netdev->features); + netdev->features);
if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->features); + netdev->features); if (vlan_tso_capable(adapter)) { netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
/* T204: disable TSO */ if (!(is_T2(adapter)) || bi->port_number != 4) { netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); } }
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 01b0ff1..7eec868 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -2249,10 +2249,10 @@ static int cxgb_siocdevprivate(struct net_device *dev, if (t.lro >= 0) { if (t.lro) netdev_feature_set_bit(NETIF_F_GRO_BIT, - &dev->wanted_features); + dev->wanted_features); else netdev_feature_clear_bit(NETIF_F_GRO_BIT, - &dev->wanted_features); + dev->wanted_features); netdev_update_features(dev); }
@@ -2596,13 +2596,13 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) }
static void cxgb_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -2613,7 +2613,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) cxgb_vlan_mode(dev, features);
@@ -3321,22 +3321,22 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->irq = pdev->irq; netdev->mem_start = mmio_start; netdev->mem_end = mmio_start + mmio_len - 1; - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->features); - netdev_feature_copy(&tmp, netdev->features); - netdev_feature_and_bits(VLAN_FEAT, &tmp); - netdev_feature_or(&netdev->vlan_features, + netdev->features); + netdev_feature_copy(tmp, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, tmp); + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, tmp); if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->features); + netdev->features);
netdev->netdev_ops = &cxgb_netdev_ops; netdev->ethtool_ops = &cxgb_ethtool_ops; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c index a10ee67..eb1d9bb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c @@ -79,10 +79,10 @@ int cxgb_fcoe_enable(struct net_device *netdev)
dev_info(adap->pdev_dev, "Enabling FCoE offload features\n");
- netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, netdev->vlan_features);
netdev_features_change(netdev);
@@ -110,10 +110,10 @@ int cxgb_fcoe_disable(struct net_device *netdev)
fcoe->flags &= ~CXGB_FCOE_ENABLED;
- netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, &netdev->vlan_features); - netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->vlan_features); + netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, netdev->vlan_features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, netdev->vlan_features);
netdev_features_change(netdev);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c80cb72..f566b5e 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1277,7 +1277,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) return 0;
@@ -1286,9 +1286,9 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features), true); if (unlikely(err)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_change_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
return err; @@ -3843,7 +3843,7 @@ static const struct udp_tunnel_nic_info cxgb_udp_tunnels = { };
static void cxgb_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct port_info *pi = netdev_priv(dev); struct adapter *adapter = pi->adapter; @@ -3861,10 +3861,10 @@ static void cxgb_features_check(struct sk_buff *skb, struct net_device *dev, }
static void cxgb_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* Disable GRO, if RX_CSUM is disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_GRO_BIT, features); }
@@ -6833,12 +6833,12 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) pi->port_id = i; netdev->irq = pdev->irq;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | TSO_FLAGS | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_GRO | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_TC | NETIF_F_NTUPLE, &netdev->hw_features); + NETIF_F_HW_TC | NETIF_F_NTUPLE, netdev->hw_features);
if (chip_ver > CHELSIO_T5) { netdev_feature_set_bits(NETIF_F_IP_CSUM | @@ -6847,11 +6847,11 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_HW_TLS_RECORD, - &netdev->hw_features); + netdev->hw_features);
if (adapter->rawf_cnt) netdev->udp_tunnel_nic_info = &cxgb_udp_tunnels; @@ -6859,15 +6859,15 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (highdma) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_copy(&netdev->vlan_features, netdev->features); - netdev_feature_and_bits(VLAN_FEAT, &netdev->vlan_features); + netdev_feature_copy(netdev->vlan_features, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, netdev->vlan_features); #if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE) if (pi->adapter->params.crypto & FW_CAPS_CONFIG_TLS_HW) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev->tlsdev_ops = &cxgb4_ktls_ops; /* initialize the refcount */ refcount_set(&pi->adapter->chcr_ktls.ktls_refcount, 0); @@ -6876,9 +6876,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) #if IS_ENABLED(CONFIG_CHELSIO_IPSEC_INLINE) if (pi->adapter->params.crypto & FW_CAPS_CONFIG_IPSEC_INLINE) { netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, - &netdev->features); + netdev->features); netdev->xfrmdev_ops = &cxgb4_xfrmdev_ops; } #endif /* CONFIG_CHELSIO_IPSEC_INLINE */ diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index a41f04f..696791c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -1174,13 +1174,13 @@ static int cxgb4vf_change_mtu(struct net_device *dev, int new_mtu) }
static void cxgb4vf_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -1193,7 +1193,7 @@ static int cxgb4vf_set_features(struct net_device *dev, struct port_info *pi = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1, netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -3076,19 +3076,19 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, pi->xact_addr_filt = -1; netdev->irq = pdev->irq;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | TSO_FLAGS | NETIF_F_GRO | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->features); - netdev_feature_copy(&netdev->vlan_features, netdev->features); - netdev_feature_and_bits(VLAN_FEAT, &netdev->vlan_features); + netdev->features); + netdev_feature_copy(netdev->vlan_features, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->min_mtu = 81; diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index e5ddb39..0953577 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -241,7 +241,7 @@ static const struct udp_tunnel_nic_info enic_udp_tunnels = { };
static void enic_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { const struct ethhdr *eth = (struct ethhdr *)skb_inner_mac_header(skb); struct enic *enic = netdev_priv(dev); @@ -2901,27 +2901,27 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) enic_set_ethtool_ops(netdev);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features); if (ENIC_SETTING(enic, LOOP)) { netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->features); + netdev->features); enic->loop_enable = 1; enic->loop_tag = enic->config.loop_tag; dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag); } if (ENIC_SETTING(enic, TXCSUM)) netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, TSO)) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, RSS)) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, RXCSUM)) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, VXLAN)) { u64 patch_level; u64 a1 = 0; @@ -2933,8 +2933,8 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_HW_CSUM | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->hw_enc_features); + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->hw_enc_features); /* get bit mask from hw about supported offload bit level * BIT(0) = fw supports patch_level 0 @@ -2968,17 +2968,17 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } }
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features);
#ifdef CONFIG_RFS_ACCEL - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features); #endif
if (using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 81b4045..9d97521 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -1977,7 +1977,7 @@ static int gmac_change_mtu(struct net_device *netdev, int new_mtu) }
static void gmac_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (netdev->mtu + ETH_HLEN + VLAN_HLEN > MTU_SIZE_BIT_MASK) netdev_feature_clear_bits(GMAC_OFFLOAD_FEATURES, features); @@ -2450,10 +2450,10 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) spin_lock_init(&port->config_lock); gmac_clear_hw_stats(netdev);
- netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES, netdev->hw_features); netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES | NETIF_F_GRO, - &netdev->features); + netdev->features); /* We can handle jumbo frames up to 10236 bytes so, let's accept * payloads of 10236 bytes minus VLAN and ethernet header */ diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 8e4ca68..16c75f1 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -589,7 +589,7 @@ static int dm9000_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changed); unsigned long flags;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0;
@@ -1648,10 +1648,10 @@ dm9000_probe(struct platform_device *pdev)
/* dm9000a/b are capable of hardware checksum offload */ if (db->type == TYPE_DM9000A || db->type == TYPE_DM9000B) { - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &ndev->hw_features); - netdev_feature_or(&ndev->features, ndev->features, + ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); }
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c index 70bfa91..7fe4bf6 100644 --- a/drivers/net/ethernet/dnet.c +++ b/drivers/net/ethernet/dnet.c @@ -763,7 +763,7 @@ static int dnet_probe(struct platform_device *pdev) return -ENOMEM;
/* TODO: Actually, we have some interesting features... */ - netdev_feature_set_bits(0, &dev->features); + netdev_feature_set_bits(0, dev->features);
bp = netdev_priv(dev); bp->dev = dev; diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index b8faf89..a5ea320 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -4005,7 +4005,7 @@ static int be_vxlan_set_port(struct net_device *netdev, unsigned int table, netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL, - &netdev->hw_enc_features); + netdev->hw_enc_features);
dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n", be16_to_cpu(ti->port)); @@ -4027,7 +4027,7 @@ static int be_vxlan_unset_port(struct net_device *netdev, unsigned int table, adapter->flags &= ~BE_FLAGS_VXLAN_OFFLOADS; adapter->vxlan_port = 0;
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); return 0; }
@@ -5069,7 +5069,7 @@ static struct be_cmd_work *be_alloc_work(struct be_adapter *adapter, }
static void be_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct be_adapter *adapter = netdev_priv(dev); u8 l4_hdr = 0; @@ -5196,19 +5196,19 @@ static void be_netdev_init(struct net_device *netdev) NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->hw_features); + netdev->hw_features); if ((be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS)) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &netdev->features); + netdev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->vlan_features); + netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT;
@@ -5852,7 +5852,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (!status) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); } else { status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (status) { diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c index d2f0f93..40b5850 100644 --- a/drivers/net/ethernet/ethoc.c +++ b/drivers/net/ethernet/ethoc.c @@ -1219,7 +1219,7 @@ static int ethoc_probe(struct platform_device *pdev) /* setup the net_device structure */ netdev->netdev_ops = ðoc_netdev_ops; netdev->watchdog_timeo = ETHOC_TIMEOUT; - netdev_feature_set_bits(0, &netdev->features); + netdev_feature_set_bits(0, netdev->features); netdev->ethtool_ops = ðoc_ethtool_ops;
/* setup NAPI */ diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 8552bba..a740729 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1587,7 +1587,7 @@ static int ftgmac100_set_features(struct net_device *netdev, if (!netif_running(netdev)) return 0;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); /* Update the vlan filtering bit */ if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { u32 maccr; @@ -1905,25 +1905,25 @@ static int ftgmac100_probe(struct platform_device *pdev) priv->tx_q_entries = priv->new_tx_q_entries = DEF_TX_QUEUE_ENTRIES;
/* Base feature set */ - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_GRO | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->hw_features); + netdev->hw_features);
if (priv->use_ncsi) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
/* AST2400 doesn't have working HW checksum generation */ if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac"))) netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); if (np && of_get_property(np, "no-hw-checksum", NULL)) netdev_feature_clear_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
/* register network device */ diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 2087fd4..e967aa4 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -251,23 +251,23 @@ static int dpaa_netdev_init(struct net_device *net_dev,
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_LLTX | NETIF_F_RXHASH, - &net_dev->hw_features); + net_dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, - &net_dev->hw_features); + net_dev->hw_features);
/* The kernels enables GSO automatically, if we declare NETIF_F_SG. * For conformity, we'll still declare GSO explicitly. */ - netdev_feature_set_bit(NETIF_F_GSO_BIT, &net_dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &net_dev->features); + netdev_feature_set_bit(NETIF_F_GSO_BIT, net_dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, net_dev->features);
net_dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; /* we do not want shared skbs on TX */ net_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- netdev_feature_or(&net_dev->features, net_dev->features, + netdev_feature_or(net_dev->features, net_dev->features, net_dev->hw_features); - netdev_feature_copy(&net_dev->vlan_features, net_dev->features); + netdev_feature_copy(net_dev->vlan_features, net_dev->features);
if (is_valid_ether_addr(mac_addr)) { memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len); diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 39f762c..f68417a 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -2146,7 +2146,7 @@ static int dpaa2_eth_set_features(struct net_device *net_dev, bool enable; int err;
- netdev_feature_xor(&changed, features, net_dev->features); + netdev_feature_xor(changed, features, net_dev->features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features); @@ -4108,17 +4108,17 @@ static int dpaa2_eth_netdev_init(struct net_device *net_dev) net_dev->priv_flags &= ~not_supported;
/* Features */ - netdev_feature_zero(&net_dev->features); + netdev_feature_zero(net_dev->features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_LLTX | NETIF_F_HW_TC, - &net_dev->features); - netdev_feature_copy(&net_dev->hw_features, net_dev->features); + net_dev->features); + netdev_feature_copy(net_dev->hw_features, net_dev->features);
if (priv->dpni_attrs.vlan_filter_entries) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->hw_features); + net_dev->hw_features);
return 0; } diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index aaad94f..23a27db 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -3262,10 +3262,10 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw, /* The DPAA2 switch's ingress path depends on the VLAN table, * thus we are not able to disable VLAN filtering. */ - netdev_feature_zero(&port_netdev->features); + netdev_feature_zero(port_netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER | - NETIF_F_HW_TC, &port_netdev->features); + NETIF_F_HW_TC, port_netdev->features);
err = dpaa2_switch_port_init(port_priv, port_idx); if (err) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index b0b4778..2c7b76d 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2360,7 +2360,7 @@ int enetc_set_features(struct net_device *ndev, __DECLARE_NETDEV_FEATURE_MASK(changed); int err = 0;
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) enetc_set_rss(ndev, netdev_feature_test_bit(NETIF_F_RXHASH_BIT, diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index ce17652..9c16228c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -707,7 +707,7 @@ static int enetc_pf_set_features(struct net_device *ndev, struct enetc_ndev_priv *priv = netdev_priv(ndev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { @@ -764,19 +764,19 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->watchdog_timeo = 5 * HZ; ndev->max_mtu = ENETC_MAX_MTU;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_LOOPBACK, &ndev->hw_features); - netdev_feature_zero(&ndev->features); + NETIF_F_LOOPBACK, ndev->hw_features); + netdev_feature_zero(ndev->features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
if (si->num_rss) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features);
ndev->priv_flags |= IFF_UNICAST_FLT;
@@ -785,8 +785,8 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { priv->active_offloads |= ENETC_F_QCI; - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, ndev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, ndev->hw_features); }
/* pick up primary MAC address from SI */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index 553902f..31c7bb6 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -120,17 +120,17 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->watchdog_timeo = 5 * HZ; ndev->max_mtu = ENETC_MAX_MTU;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->hw_features); - netdev_feature_zero(&ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->hw_features); + netdev_feature_zero(ndev->features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
if (si->num_rss) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features);
/* pick up primary MAC address from SI */ enetc_get_primary_mac_addr(&si->hw, ndev->dev_addr); diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 51d30f8..9f10ea2 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3371,8 +3371,8 @@ static inline void fec_enet_set_netdev_features(struct net_device *netdev, struct fec_enet_private *fep = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); - netdev_feature_copy(&netdev->features, features); + netdev_feature_xor(changed, features, netdev->features); + netdev_feature_copy(netdev->features, features);
/* Receive checksum has been changed */ if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { @@ -3389,7 +3389,7 @@ static int fec_set_features(struct net_device *netdev, struct fec_enet_private *fep = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netif_running(netdev) && netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { @@ -3560,7 +3560,7 @@ static int fec_enet_init(struct net_device *ndev) if (fep->quirks & FEC_QUIRK_HAS_VLAN) /* enable hw VLAN support */ netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &ndev->features); + ndev->features);
if (fep->quirks & FEC_QUIRK_HAS_CSUM) { ndev->gso_max_segs = FEC_MAX_TSO_SEGS; @@ -3568,7 +3568,7 @@ static int fec_enet_init(struct net_device *ndev) /* enable hw accelerator */ netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | - NETIF_F_TSO, &ndev->features); + NETIF_F_TSO, ndev->features); fep->csum_flags |= FLAG_RX_CSUM_ENABLED; }
@@ -3577,7 +3577,7 @@ static int fec_enet_init(struct net_device *ndev) fep->rx_align = 0x3f; }
- netdev_feature_copy(&ndev->hw_features, ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features);
fec_restart(ndev);
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 0796556..cd64e4a 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -1026,7 +1026,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
netif_carrier_off(ndev);
- netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features);
ret = register_netdev(ndev); if (ret) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 852b5d5..575a77a 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -3247,20 +3247,20 @@ static int gfar_probe(struct platform_device *ofdev) }
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) { - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_RXCSUM, &dev->hw_features); + NETIF_F_RXCSUM, dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HIGHDMA, - &dev->features); + dev->features); }
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) { netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index e6395f1..bfdb705 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -503,7 +503,7 @@ int gfar_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); int err = 0;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (!netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | @@ -513,7 +513,7 @@ int gfar_set_features(struct net_device *dev, netdev_features_t features) while (test_and_set_bit_lock(GFAR_RESETTING, &priv->state)) cpu_relax();
- netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features);
if (dev->flags & IFF_UP) { /* Now we take down the rings to rebuild them */ diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c index e63476b..d37717f 100644 --- a/drivers/net/ethernet/google/gve/gve_adminq.c +++ b/drivers/net/ethernet/google/gve/gve_adminq.c @@ -719,7 +719,7 @@ int gve_adminq_describe_device(struct gve_priv *priv) } else { /* DQO supports LRO. */ netdev_feature_set_bit(NETIF_F_LRO_BIT, - &priv->dev->hw_features); + priv->dev->hw_features); err = gve_set_desc_cnt_dqo(priv, descriptor, dev_op_dqo_rda); } if (err) diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 8984a87..12d44d3 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -1117,11 +1117,11 @@ static int gve_set_features(struct net_device *netdev, struct gve_priv *priv = netdev_priv(netdev); int err;
- netdev_feature_copy(&orig_features, netdev->features); + netdev_feature_copy(orig_features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) != netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { - netdev_feature_change_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_change_bit(NETIF_F_LRO_BIT, netdev->features);
if (netif_carrier_ok(netdev)) { /* To make this process as simple as possible we @@ -1144,7 +1144,7 @@ static int gve_set_features(struct net_device *netdev, return 0; err: /* Reverts the change on error. */ - netdev_feature_copy(&netdev->features, orig_features); + netdev_feature_copy(netdev->features, orig_features); netif_err(priv, drv, netdev, "Set features failed! !!! DISABLING ALL QUEUES !!!\n"); return err; @@ -1522,16 +1522,16 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * Features might be set in other locations as well (such as * `gve_adminq_describe_device`). */ - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); dev->watchdog_timeo = 5 * HZ; dev->min_mtu = ETH_MIN_MTU; netif_carrier_off(dev); diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c index f91387e..27c420d 100644 --- a/drivers/net/ethernet/google/gve/gve_rx.c +++ b/drivers/net/ethernet/google/gve/gve_rx.c @@ -591,7 +591,7 @@ bool gve_rx_poll(struct gve_notify_block *block, int budget) struct gve_rx_ring *rx = block->rx; bool repoll = false;
- netdev_feature_copy(&feat, block->napi.dev->features); + netdev_feature_copy(feat, block->napi.dev->features);
/* If budget is 0, do all the work */ if (budget == 0) diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c index 90ac50d..7ceeb64 100644 --- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c +++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c @@ -672,7 +672,7 @@ int gve_rx_poll_dqo(struct gve_notify_block *block, int budget) u64 bytes = 0; int err;
- netdev_feature_copy(&feat, napi->dev->features); + netdev_feature_copy(feat, napi->dev->features);
while (work_done < budget) { struct gve_rx_compl_desc_dqo *compl_desc = diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c index da15dbf..aa5faf1 100644 --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c @@ -1234,11 +1234,11 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) SET_NETDEV_DEV(ndev, dev);
if (HAS_CAP_TSO(priv->hw_cap)) - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->hw_features);
- netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->hw_features); - netdev_feature_or(&ndev->vlan_features, ndev->vlan_features, + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->hw_features); + netdev_feature_or(ndev->vlan_features, ndev->vlan_features, ndev->features);
ret = hix5hd2_init_hw_desc_queue(priv); diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 7567afe..1d03427 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -1792,12 +1792,12 @@ static int hns_nic_set_features(struct net_device *netdev, } break; } - netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); return 0; }
static void hns_nic_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct hns_nic_priv *priv = netdev_priv(netdev);
@@ -2330,25 +2330,25 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO, &ndev->features); + NETIF_F_GRO, ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &ndev->vlan_features); + NETIF_F_RXCSUM, ndev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO, - &ndev->vlan_features); + ndev->vlan_features);
/* MTU range: 68 - 9578 (v1) or 9706 (v2) */ ndev->min_mtu = MAC_MIN_MTU; switch (priv->enet_ver) { case AE_VERSION_2: netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_NTUPLE, &ndev->features); + NETIF_F_NTUPLE, ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6, - &ndev->features); + ndev->features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &ndev->vlan_features); + ndev->vlan_features); ndev->max_mtu = MAC_MAX_MTU_V2 - (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN); break; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 4e74a02..5298900 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2316,7 +2316,7 @@ static int hns3_nic_set_features(struct net_device *netdev, bool enable; int ret;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, changed) && h->ae_algo->ops->set_gro_en) { @@ -2359,12 +2359,12 @@ static int hns3_nic_set_features(struct net_device *netdev, return ret; }
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); return 0; }
static void hns3_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { #define HNS3_MAX_HDR_LEN 480U #define HNS3_MAX_L4_HDR_LEN 60U @@ -3142,55 +3142,55 @@ static void hns3_set_default_feature(struct net_device *netdev) netdev->priv_flags |= IFF_UNICAST_FLT;
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
netdev_feature_set_bit_array(hns3_features_array, ARRAY_SIZE(hns3_features_array), - &netdev->features); + netdev->features);
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { - netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, netdev->features);
if (!(h->flags & HNAE3_SUPPORT_VF)) netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &netdev->features); + netdev->features); }
if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps)) netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &netdev->features); + netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps)) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->features); else netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->features); + netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps)) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->features); + netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps)) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); if (!test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_HW | NETIF_F_NTUPLE | NETIF_F_HW_TC, - &netdev->hw_enc_features); + netdev->hw_enc_features);
- netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
static int hns3_alloc_buffer(struct hns3_enet_ring *ring, diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 196462c..676bcee 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -889,12 +889,12 @@ static int hinic_set_features(struct net_device *netdev, }
static void hinic_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct hinic_dev *nic_dev = netdev_priv(netdev);
/* If Rx checksum is disabled, then LRO should also be disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } @@ -942,24 +942,24 @@ static const struct net_device_ops hinicvf_netdev_ops = { static void netdev_features_init(struct net_device *netdev) {
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, &netdev->features); + netdev_feature_copy(netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, netdev->features);
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
static void hinic_refresh_nic_cfg(struct hinic_dev *nic_dev) @@ -1086,11 +1086,11 @@ static int set_features(struct hinic_dev *nic_dev, int err = 0;
if (force_change) - netdev_feature_fill(&changed); + netdev_feature_fill(changed); else - netdev_feature_xor(&changed, pre_features, features); + netdev_feature_xor(changed, pre_features, features);
- netdev_feature_zero(&failed_features); + netdev_feature_zero(failed_features);
if (netdev_feature_test_bit(NETIF_F_TSO_BIT, changed)) { ret = hinic_port_set_tso(nic_dev, @@ -1100,7 +1100,7 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_TSO_BIT, - &failed_features); + failed_features); } }
@@ -1109,7 +1109,7 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &failed_features); + failed_features); } }
@@ -1122,7 +1122,7 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_LRO_BIT, - &failed_features); + failed_features); } }
@@ -1133,12 +1133,12 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &failed_features); + failed_features); } }
if (err) { - netdev_feature_xor(&nic_dev->netdev->features, features, failed_features); + netdev_feature_xor(nic_dev->netdev->features, features, failed_features); return -EIO; }
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index b7ca1c6..e5a9906 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c @@ -2991,20 +2991,20 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, dev->netdev_ops = &ehea_netdev_ops; ehea_set_ethtool_ops(dev);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX, - &dev->hw_features); - netdev_feature_zero(&dev->features); + dev->hw_features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM, - &dev->features); - netdev_feature_zero(&dev->vlan_features); + dev->features); + netdev_feature_zero(dev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | - NETIF_F_IP_CSUM, &dev->hw_features); + NETIF_F_IP_CSUM, dev->hw_features); dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
/* MTU range: 68 - 9022 */ diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index ff175e7..04779a9 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3170,11 +3170,11 @@ static int emac_probe(struct platform_device *ofdev) goto err_detach_tah;
if (dev->tah_dev) { - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &ndev->hw_features); - netdev_feature_copy(&ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); + ndev->hw_features); + netdev_feature_copy(ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features); } ndev->watchdog_timeo = 5 * HZ; if (emac_phy_supports_gige(dev->phy_mode)) { diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 7b9246d..a175d32 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -750,7 +750,7 @@ static void netdev_get_drvinfo(struct net_device *dev, }
static void ibmveth_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* * Since the ibmveth firmware interface does not have the @@ -761,7 +761,7 @@ static void ibmveth_fix_features(struct net_device *dev, * checksummed. */
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features); }
@@ -811,7 +811,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data)
if (data == 1) netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, - &dev->features); + dev->features);
} else { adapter->fw_ipv4_csum_support = data; @@ -830,7 +830,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data)
if (data == 1) netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, - &dev->features); + dev->features);
} else adapter->fw_ipv6_csum_support = data; @@ -892,7 +892,7 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) if (data == 1) netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &dev->features); + dev->features); rc1 = -EIO;
} else { @@ -905,7 +905,7 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) */ if (data == 1) { netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &dev->features); + dev->features); netdev_info(dev, "TSO feature requires all partitions to have updated driver"); } adapter->large_send = data; @@ -932,20 +932,20 @@ static int ibmveth_set_features(struct net_device *dev, if (rx_csum != adapter->rx_csum) { rc1 = ibmveth_set_csum_offload(dev, rx_csum); if (rc1 && !adapter->rx_csum) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_RXCSUM, - &dev->features); + dev->features); } }
if (large_send != adapter->large_send) { rc2 = ibmveth_set_tso(dev, large_send); if (rc2 && !adapter->large_send) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &dev->features); + dev->features); } }
@@ -1710,13 +1710,13 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) netdev->netdev_ops = &ibmveth_netdev_ops; netdev->ethtool_ops = &netdev_ethtool_ops; SET_NETDEV_DEV(netdev, &dev->dev); - netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); if (vio_get_attribute(dev, "ibm,illan-options", NULL) != NULL) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &netdev->hw_features); + NETIF_F_RXCSUM, netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
ret = h_illan_attributes(adapter->vdev->unit_address, 0, 0, &ret_attr); @@ -1725,19 +1725,19 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_LRG_SND_SUPPORT) && !old_large_send) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); } else { - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); }
adapter->is_active_trunk = false; if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_ACTIVE_TRUNK)) { adapter->is_active_trunk = true; netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, &netdev->features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, netdev->features); }
netdev->min_mtu = IBMVETH_MIN_MTU; diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 1ced5c7..375b748 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2814,7 +2814,7 @@ static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu) }
static void ibmvnic_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* Some backing hardware adapters can not * handle packets with a MSS less than 224 @@ -4351,55 +4351,55 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) ctrl_buf->large_rx_ipv6 = 0;
if (adapter->state != VNIC_PROBING) { - netdev_feature_copy(&old_hw_features, + netdev_feature_copy(old_hw_features, adapter->netdev->hw_features); - netdev_feature_zero(&adapter->netdev->hw_features); + netdev_feature_zero(adapter->netdev->hw_features); }
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (buf->tcp_ipv4_chksum || buf->udp_ipv4_chksum) netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (buf->tcp_ipv6_chksum || buf->udp_ipv6_chksum) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, adapter->netdev->features)) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (buf->large_tx_ipv4) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features); if (buf->large_tx_ipv6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (adapter->state == VNIC_PROBING) { - netdev_feature_or(&adapter->netdev->features, + netdev_feature_or(adapter->netdev->features, adapter->netdev->features, adapter->netdev->hw_features); } else if (!netdev_feature_equal(old_hw_features, adapter->netdev->hw_features)) { __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_zero(&tmp); + netdev_feature_zero(tmp);
/* disable features no longer supported */ - netdev_feature_and(&adapter->netdev->features, + netdev_feature_and(adapter->netdev->features, adapter->netdev->features, adapter->netdev->hw_features); /* turn on features now supported if previously enabled */ - netdev_feature_xor(&tmp, old_hw_features, + netdev_feature_xor(tmp, old_hw_features, adapter->netdev->hw_features); - netdev_feature_and(&tmp, tmp, adapter->netdev->hw_features); - netdev_feature_and(&tmp, tmp, + netdev_feature_and(tmp, tmp, adapter->netdev->hw_features); + netdev_feature_and(tmp, tmp, adapter->netdev->wanted_features); - netdev_feature_or(&adapter->netdev->features, + netdev_feature_or(adapter->netdev->features, adapter->netdev->features, tmp); }
@@ -4899,7 +4899,7 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq, be64_to_cpu(crq->query_capability.number); if (adapter->vlan_header_insertion) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &netdev->features); + netdev->features); netdev_dbg(netdev, "vlan_header_insertion = %lld\n", adapter->vlan_header_insertion); break; diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 4208d8f..5263a6a 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -2797,12 +2797,12 @@ static int e100_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); struct nic *nic = netdev_priv(netdev);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (!netdev_feature_test_bits(NETIF_F_RXFCS | NETIF_F_RXALL, changed)) return 0;
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); e100_exec_cb(nic, NULL, e100_configure); return 1; } @@ -2831,9 +2831,9 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (!(netdev = alloc_etherdev(sizeof(struct nic)))) return -ENOMEM;
- netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS; - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, netdev->hw_features);
netdev->netdev_ops = &e100_netdev_ops; netdev->ethtool_ops = &e100_ethtool_ops; @@ -2891,7 +2891,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* D100 MAC doesn't allow rx of vlan packets with normal MTU */ if (nic->mac < mac_82558_D101_A4) netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, - &netdev->features); + netdev->features);
/* locks must be initialized before calling hw_reset */ spin_lock_init(&nic->cb_lock); diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index c9406d9..c69fd24 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -788,12 +788,12 @@ static int e1000_is_need_ioport(struct pci_dev *pdev) }
static void e1000_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -806,7 +806,7 @@ static int e1000_set_features(struct net_device *netdev, struct e1000_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) e1000_vlan_mode(netdev, features); @@ -814,7 +814,7 @@ static int e1000_set_features(struct net_device *netdev, if (!netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_RXALL, changed)) return 0;
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); adapter->rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features);
@@ -1037,40 +1037,40 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }
if (hw->mac_type >= e1000_82543) { - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_zero(&netdev->features); + netdev->hw_features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER, - &netdev->features); + netdev->features); }
if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_82547)) - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_RXALL | NETIF_F_RXFCS, - &netdev->hw_features); + netdev->hw_features);
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO | NETIF_F_SG, - &netdev->vlan_features); + netdev->vlan_features);
/* Do not set IFF_UNICAST_FLT for VMWare's 82545EM */ if (hw->device_id != E1000_DEV_ID_82545EM_COPPER || diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 4e36331..241d671 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -5316,15 +5316,15 @@ static void e1000_watchdog_task(struct work_struct *work) case SPEED_100: e_info("10/100 speed: disabling TSO\n"); netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); break; case SPEED_1000: netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); break; default: /* oops */ @@ -5332,9 +5332,9 @@ static void e1000_watchdog_task(struct work_struct *work) } if (hw->mac.type == e1000_pch_spt) { netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); } }
@@ -7305,7 +7305,7 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter) }
static void e1000_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; @@ -7317,7 +7317,7 @@ static void e1000_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -7330,7 +7330,7 @@ static int e1000_set_features(struct net_device *netdev, struct e1000_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, changed)) adapter->flags |= FLAG_TSO_FORCE; @@ -7356,7 +7356,7 @@ static int e1000_set_features(struct net_device *netdev, } }
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netif_running(netdev)) e1000e_reinit_locked(adapter); @@ -7546,7 +7546,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) "PHY reset is blocked due to SOL/IDER session.\n");
/* Set initial default active device features */ - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | @@ -7555,30 +7555,30 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_CSUM, - &netdev->features); + netdev->features);
/* Set user-changeable features (subset of all device features) */ - netdev_feature_copy(&netdev->hw_features, netdev->features); - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); + netdev_feature_copy(netdev->hw_features, netdev->features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS; - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, netdev->hw_features);
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_CSUM, - &netdev->vlan_features); + netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT;
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
/* MTU range: 68 - max_hw_frame_size */ diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c index ed2871d..f66803b 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c @@ -775,7 +775,7 @@ static int fm10k_tso(struct fm10k_ring *tx_ring,
err_vxlan: netdev_feature_clear_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &tx_ring->netdev->features); + tx_ring->netdev->features); if (net_ratelimit()) netdev_err(tx_ring->netdev, "TSO requested for unsupported tunnel, disabling offload\n"); diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c index dbefa24..8525dee 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c @@ -1505,7 +1505,7 @@ static void fm10k_dfwd_del_station(struct net_device *dev, void *priv) }
static void fm10k_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { if (!skb->encapsulation || fm10k_tx_encap_offload(skb)) return; @@ -1565,7 +1565,7 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) NETIF_F_TSO_ECN | NETIF_F_RXHASH | NETIF_F_RXCSUM, - &dev->features); + dev->features);
/* Only the PF can support VXLAN and NVGRE tunnel offloads */ if (info->mac == fm10k_mac_pf) { @@ -1576,22 +1576,22 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_IPV6_CSUM | NETIF_F_SG, - &dev->hw_enc_features); + dev->hw_enc_features);
netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &dev->features); + dev->features);
dev->udp_tunnel_nic_info = &fm10k_udp_tunnels; }
/* all features defined to this point should be changeable */ - netdev_feature_copy(&hw_features, dev->features); + netdev_feature_copy(hw_features, dev->features);
/* allow user to enable L2 forwarding acceleration */ - netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, hw_features);
/* configure VLAN features */ - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features);
/* we want to leave these both on as we cannot disable VLAN tag @@ -1601,12 +1601,11 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features);
dev->priv_flags |= IFF_UNICAST_FLT;
- netdev_feature_or(&dev->hw_features, dev->hw_features, - hw_features); + netdev_feature_or(dev->hw_features, dev->hw_features, hw_features);
/* MTU range: 68 - 15342 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c index 48c1206..6611cb8 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c @@ -306,10 +306,10 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface)
if (hw->mac.vlan_override) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->features); + netdev->features); else netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->features); + netdev->features); }
err = netif_running(netdev) ? fm10k_open(netdev) : 0; @@ -2012,9 +2012,9 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
/* update netdev with DMA restrictions */ if (dma_get_mask(&pdev->dev) > DMA_BIT_MASK(32)) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
/* reset and initialize the hardware so it is in a known state */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index be4f636..681a5b2 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -12878,7 +12878,7 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, * @features: Offload features that the stack believes apply **/ static void i40e_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { size_t len;
@@ -13329,7 +13329,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) np = netdev_priv(netdev); np->vsi = vsi;
- netdev_feature_zero(&hw_enc_features); + netdev_feature_zero(hw_enc_features); netdev_feature_set_bits(NETIF_F_SG_BIT | NETIF_F_IP_CSUM_BIT | NETIF_F_IPV6_CSUM_BIT | @@ -13350,50 +13350,50 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) NETIF_F_SCTP_CRC_BIT | NETIF_F_RXHASH_BIT | NETIF_F_RXCSUM_BIT, - &hw_enc_features); + hw_enc_features);
if (!(pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE)) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
netdev->udp_tunnel_nic_info = &pf->udp_tunnel_nic;
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
- netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, hw_enc_features);
/* record features VLANs can make use of */ - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); + netdev->vlan_features);
/* enable macvlan offloads */ netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&hw_features, hw_enc_features); + netdev_feature_copy(hw_features, hw_enc_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &hw_features); + hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &hw_features); + hw_features);
if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) { - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &hw_features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, hw_features); }
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
if (vsi->type == I40E_VSI_MAIN) { SET_NETDEV_DEV(netdev, &pf->pdev->dev); diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index c4a5924..d36e9b4 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3361,7 +3361,7 @@ static int iavf_set_features(struct net_device *netdev, struct iavf_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); /* Don't allow changing VLAN_RX flag when adapter is not capable * of VLAN offload */ @@ -3390,7 +3390,7 @@ static int iavf_set_features(struct net_device *netdev, * @features: Offload features that the stack believes apply **/ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { size_t len;
@@ -3449,7 +3449,7 @@ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, * Returns fixed-up features bits **/ static void iavf_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct iavf_adapter *adapter = netdev_priv(netdev);
@@ -3542,7 +3542,7 @@ int iavf_process_config(struct iavf_adapter *adapter) } adapter->num_req_queues = 0;
- netdev_feature_zero(&hw_enc_features); + netdev_feature_zero(hw_enc_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -3554,7 +3554,7 @@ int iavf_process_config(struct iavf_adapter *adapter) NETIF_F_SCTP_CRC | NETIF_F_RXHASH | NETIF_F_RXCSUM, - &hw_enc_features); + hw_enc_features);
/* advertise to stack only if offloads for encapsulated packets is * supported @@ -3567,49 +3567,49 @@ int iavf_process_config(struct iavf_adapter *adapter) NETIF_F_GSO_IPXIP6 | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &hw_enc_features); + hw_enc_features);
if (!(vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM)) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->hw_enc_features); - netdev_feature_or(&netdev->hw_enc_features, + netdev->hw_enc_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, hw_enc_features); } /* record features VLANs can make use of */ - netdev_feature_or(&netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); + netdev->vlan_features);
/* Write features and hw_features separately to avoid polluting * with, or dropping, features that are set when we registered. */ - netdev_feature_copy(&hw_features, hw_enc_features); + netdev_feature_copy(hw_features, hw_enc_features);
/* Enable VLAN features if supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &hw_features); + NETIF_F_HW_VLAN_CTAG_RX, hw_features); /* Enable cloud filter if ADQ is supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, hw_features); if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_USO) - netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, hw_features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, hw_features);
- netdev_feature_or(&netdev->features, netdev->features, hw_features); + netdev_feature_or(netdev->features, netdev->features, hw_features);
if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
@@ -3621,24 +3621,24 @@ int iavf_process_config(struct iavf_adapter *adapter) netdev->wanted_features) || netdev->mtu < 576) netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_TSO6_BIT, netdev->wanted_features) || netdev->mtu < 576) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, netdev->wanted_features)) netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, netdev->wanted_features)) netdev_feature_clear_bit(NETIF_F_GRO_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_GSO_BIT, netdev->wanted_features)) netdev_feature_clear_bit(NETIF_F_GSO_BIT, - &netdev->features); + netdev->features); }
adapter->vsi.id = adapter->vsi_res->vsi_id; diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 32b0613..b1ecc09 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3053,34 +3053,34 @@ static void ice_set_netdev_features(struct net_device *netdev)
if (ice_is_safe_mode(pf)) { /* safe mode */ - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, - &netdev->features); - netdev_feature_copy(&netdev->hw_features, netdev->features); + netdev->features); + netdev_feature_copy(netdev->hw_features, netdev->features); return; }
- netdev_feature_zero(&dflt_features); + netdev_feature_zero(dflt_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_NTUPLE | NETIF_F_RXHASH, - &dflt_features); + dflt_features);
- netdev_feature_zero(&csumo_features); + netdev_feature_zero(csumo_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SCTP_CRC | NETIF_F_IPV6_CSUM, - &csumo_features); + csumo_features);
- netdev_feature_zero(&vlano_features); + netdev_feature_zero(vlano_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &vlano_features); + vlano_features);
- netdev_feature_zero(&tso_features); + netdev_feature_zero(tso_features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | @@ -3092,34 +3092,34 @@ static void ice_set_netdev_features(struct net_device *netdev) NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6 | NETIF_F_GSO_UDP_L4, - &tso_features); + tso_features);
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM, - &netdev->gso_partial_features); + netdev->gso_partial_features); /* set features that user can change */ - netdev_feature_or(&netdev->hw_features, dflt_features, + netdev_feature_or(netdev->hw_features, dflt_features, csumo_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, vlano_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, tso_features);
/* add support for HW_CSUM on packets with MPLS header */ - netdev_feature_zero(&netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); + netdev_feature_zero(netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features);
/* enable features */ - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); /* encap and VLAN devices inherit default, csumo and tso features */ - netdev_feature_or(&netdev->hw_enc_features, dflt_features, + netdev_feature_or(netdev->hw_enc_features, dflt_features, csumo_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, tso_features); - netdev_feature_or(&netdev->vlan_features, dflt_features, + netdev_feature_or(netdev->vlan_features, dflt_features, csumo_features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, tso_features); }
@@ -7199,7 +7199,7 @@ int ice_stop(struct net_device *netdev) */ static void ice_features_check(struct sk_buff *skb, struct net_device __always_unused *netdev, - netdev_features_t *features) + netdev_features_t features) { size_t len;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index e4582a4..3d67f5c 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2434,12 +2434,12 @@ void igb_reset(struct igb_adapter *adapter) }
static void igb_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -2452,7 +2452,7 @@ static int igb_set_features(struct net_device *netdev, struct igb_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igb_vlan_mode(netdev, features); @@ -2475,7 +2475,7 @@ static int igb_set_features(struct net_device *netdev, adapter->nfc_filter_count = 0; }
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netif_running(netdev)) igb_reinit_locked(adapter); @@ -2507,7 +2507,7 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], #define IGB_MAX_NETWORK_HDR_LEN 511
static void igb_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -2539,7 +2539,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
@@ -3278,14 +3278,14 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_CSUM, - &netdev->features); + netdev->features);
if (hw->mac.type >= e1000_82576) netdev_feature_set_bits(NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4, - &netdev->features); + netdev->features);
if (hw->mac.type >= e1000_i350) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
#define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -3294,41 +3294,41 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IGB_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES, - &netdev->features); + netdev->features);
/* copy netdev features into list of user selectable features */ - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXALL, - &netdev->hw_features); + netdev->hw_features);
if (hw->mac.type >= e1000_i350) netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &netdev->hw_features); + netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 2cad7a2..4b89ee6 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2620,7 +2620,7 @@ static int igbvf_set_features(struct net_device *netdev, #define IGBVF_MAX_NETWORK_HDR_LEN 511
static void igbvf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -2650,7 +2650,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
@@ -2770,14 +2770,14 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
adapter->bd_number = cards_found++;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_SCTP_CRC, - &netdev->hw_features); + netdev->hw_features);
#define IGBVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -2786,31 +2786,31 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IGBVF_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGBVF_GSO_PARTIAL_FEATURES, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
/* MTU range: 68 - 9216 */ netdev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 2bfdc74..e25464a 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4914,12 +4914,12 @@ static void igc_get_stats64(struct net_device *netdev, }
static void igc_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -4932,7 +4932,7 @@ static int igc_set_features(struct net_device *netdev, struct igc_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igc_vlan_mode(netdev, features); @@ -4944,7 +4944,7 @@ static int igc_set_features(struct net_device *netdev, if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) igc_flush_nfc_rules(adapter);
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netif_running(netdev)) igc_reinit_locked(adapter); @@ -4955,7 +4955,7 @@ static int igc_set_features(struct net_device *netdev, }
static void igc_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -4985,7 +4985,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bits(NETIF_F_TSO_BIT, features); }
@@ -6242,14 +6242,14 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* Add supported features to the features list*/ - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_SCTP_CRC_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_SCTP_CRC_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
#define IGC_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -6258,11 +6258,11 @@ static int igc_probe(struct pci_dev *pdev, NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IGC_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGC_GSO_PARTIAL_FEATURES, - &netdev->features); + netdev->features);
/* setup the private structure */ err = igc_sw_init(adapter); @@ -6270,18 +6270,18 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* copy netdev features into list of user selectable features */ - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->hw_features); + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features);
/* MTU range: 68 - 9216 */ diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 4357e43..1e75c76 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -294,13 +294,13 @@ ixgb_reset(struct ixgb_adapter *adapter) }
static void ixgb_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { /* * Tx VLAN insertion does not work per HW design when Rx stripping is * disabled. */ - if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); } @@ -311,7 +311,7 @@ ixgb_set_features(struct net_device *netdev, netdev_features_t features) struct ixgb_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (!netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX, @@ -438,22 +438,22 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features); + netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features);
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
/* MTU range: 68 - 16114 */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 57009d1..2c2eaa2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c @@ -859,7 +859,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
/* enable FCoE and notify stack */ adapter->flags |= IXGBE_FLAG_FCOE_ENABLED; - netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, netdev->features); netdev_features_change(netdev);
/* release existing queues and reallocate them */ @@ -899,7 +899,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
/* disable FCoE and notify stack */ adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; - netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, netdev->features);
netdev_features_change(netdev);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index fc31773..cae9740 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -4904,7 +4904,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) __DECLARE_NETDEV_FEATURE_MASK(features); int count;
- netdev_feature_copy(&features, netdev->features); + netdev_feature_copy(features, netdev->features);
/* Check for Promiscuous and All Multicast modes */ fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); @@ -4922,7 +4922,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); vmolr |= IXGBE_VMOLR_MPE; netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &features); + features); } else { if (netdev->flags & IFF_ALLMULTI) { fctrl |= IXGBE_FCTRL_MPE; @@ -9692,12 +9692,12 @@ void ixgbe_do_reset(struct net_device *netdev) }
static void ixgbe_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct ixgbe_adapter *adapter = netdev_priv(netdev);
/* If Rx checksum is disabled, then RSC/LRO should also be disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
/* Turn off LRO if not RSC capable */ @@ -9705,7 +9705,7 @@ static void ixgbe_fix_features(struct net_device *netdev, netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
if (adapter->xdp_prog && - netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { e_dev_err("LRO is not supported with XDP\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } @@ -9734,7 +9734,7 @@ static int ixgbe_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); bool need_reset = false;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
/* Make sure RSC matches LRO, reset if change */ if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { @@ -9789,7 +9789,7 @@ static int ixgbe_set_features(struct net_device *netdev, if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) need_reset = true;
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, changed) && adapter->num_rx_pools > 1) @@ -10082,7 +10082,7 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv) #define IXGBE_MAX_NETWORK_HDR_LEN 511
static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -10116,7 +10116,7 @@ static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, * the TSO, so it's the exception. */ if (skb->encapsulation && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) { + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) { #ifdef CONFIG_IXGBE_IPSEC if (!secpath_exists(skb)) #endif @@ -10806,14 +10806,14 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) skip_sriov:
#endif - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_CSUM, - &netdev->features); + netdev->features);
#define IXGBE_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -10822,17 +10822,17 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IXGBE_GSO_PARTIAL_FEATURES, - &netdev->features); + netdev->features);
if (hw->mac.type >= ixgbe_mac_82599EB) netdev_feature_set_bits(NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4, - &netdev->features); + netdev->features);
#ifdef CONFIG_IXGBE_IPSEC #define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \ @@ -10840,45 +10840,45 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_ESP)
if (adapter->ipsec) - netdev_feature_set_bits(IXGBE_ESP_FEATURES, &netdev->features); + netdev_feature_set_bits(IXGBE_ESP_FEATURES, netdev->features); #endif /* copy netdev features into list of user selectable features */ - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXALL | NETIF_F_HW_L2FW_DOFFLOAD, - &netdev->hw_features); + netdev->hw_features);
if (hw->mac.type >= ixgbe_mac_82599EB) netdev_feature_set_bits(NETIF_F_NTUPLE | NETIF_F_HW_TC, - &netdev->hw_features); + netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_CSUM, - &netdev->mpls_features); + netdev->mpls_features); netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES, - &netdev->mpls_features); + netdev->mpls_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->priv_flags |= IFF_SUPP_NOFCS; @@ -10908,18 +10908,18 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_feature_set_bits(NETIF_F_FSO | NETIF_F_FCOE_CRC, - &netdev->features); + netdev->features);
netdev_feature_set_bits(NETIF_F_FSO | NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU, - &netdev->vlan_features); + netdev->vlan_features); } #endif /* IXGBE_FCOE */ if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->hw_features); if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->features);
if (ixgbe_check_fw_error(adapter)) { err = -EIO; diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c b/drivers/net/ethernet/intel/ixgbevf/ipsec.c index 60288ef..3288a0d5 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c +++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c @@ -656,9 +656,9 @@ void ixgbevf_init_ipsec_offload(struct ixgbevf_adapter *adapter) NETIF_F_GSO_ESP)
netdev_feature_set_bits(IXGBEVF_ESP_FEATURES, - &adapter->netdev->features); + adapter->netdev->features); netdev_feature_set_bits(IXGBEVF_ESP_FEATURES, - &adapter->netdev->hw_enc_features); + adapter->netdev->hw_enc_features);
return;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index f3d7e74..8a85159 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -4385,7 +4385,7 @@ static void ixgbevf_get_stats(struct net_device *netdev, #define IXGBEVF_MAX_NETWORK_HDR_LEN 511
static void ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -4415,7 +4415,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
@@ -4587,14 +4587,14 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_sw_init; }
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_SCTP_CRC, - &netdev->hw_features); + netdev->hw_features);
#define IXGBEVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -4603,37 +4603,37 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IXGBEVF_GSO_PARTIAL_FEATURES, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); + netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_CSUM, - &netdev->mpls_features); + netdev->mpls_features); netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES, - &netdev->mpls_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->mpls_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 007e418..1f97b1d 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c @@ -2672,7 +2672,7 @@ jme_set_msglevel(struct net_device *netdev, u32 value) }
static void jme_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (netdev->mtu > 1900) netdev_feature_clear_bits(NETIF_F_ALL_TSO | NETIF_F_CSUM_MASK, @@ -2969,15 +2969,15 @@ jme_init_one(struct pci_dev *pdev, netdev->netdev_ops = &jme_netdev_ops; netdev->ethtool_ops = &jme_ethtool_ops; netdev->watchdog_timeo = TX_TIMEOUT; - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM, - &netdev->hw_features); - netdev_feature_zero(&netdev->features); + netdev->hw_features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | @@ -2985,9 +2985,9 @@ jme_init_one(struct pci_dev *pdev, NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->features); + netdev->features); if (using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
/* MTU range: 1280 - 9202*/ netdev->min_mtu = IPV6_MIN_MTU; @@ -3050,7 +3050,7 @@ jme_init_one(struct pci_dev *pdev, jme->reg_gpreg1 = GPREG1_DEFAULT;
if (jme->reg_rxmcs & RXMCS_CHECKSUM) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features);
/* * Get Max Read Req Size from PCI Config Space diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index dcb77f8..52bffcd 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -3184,13 +3184,13 @@ static int mv643xx_eth_probe(struct platform_device *pdev) dev->watchdog_timeo = 2 * HZ; dev->base_addr = 0;
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO, - &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + dev->features); + netdev_feature_copy(dev->vlan_features, dev->features);
- netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_copy(&dev->hw_features, dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_copy(dev->hw_features, dev->features);
dev->priv_flags |= IFF_UNICAST_FLT; dev->gso_max_segs = MV643XX_MAX_TSO_SEGS; diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index a6a0be2..2e20bfc 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3771,7 +3771,7 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) }
static void mvneta_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct mvneta_port *pp = netdev_priv(dev);
@@ -5334,12 +5334,12 @@ static int mvneta_probe(struct platform_device *pdev) } }
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_RXCSUM, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + NETIF_F_TSO | NETIF_F_RXCSUM, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; dev->gso_max_segs = MVNETA_MAX_TSO_SEGS; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 295e0d1..8e0c291 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1267,8 +1267,8 @@ static void mvpp2_set_hw_csum(struct mvpp2_port *port, { __DECLARE_NETDEV_FEATURE_MASK(csums);
- netdev_feature_zero(&csums); - netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, &csums); + netdev_feature_zero(csums); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, csums);
/* Update L4 checksum when jumbo enable/disable on port. * Only port 0 supports hardware checksum offload due to @@ -1277,14 +1277,14 @@ static void mvpp2_set_hw_csum(struct mvpp2_port *port, * has 7 bits, so the maximum L3 offset is 128. */ if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { - netdev_feature_andnot(&port->dev->features, + netdev_feature_andnot(port->dev->features, port->dev->features, csums); - netdev_feature_andnot(&port->dev->hw_features, + netdev_feature_andnot(port->dev->hw_features, port->dev->hw_features, csums); } else { - netdev_feature_or(&port->dev->features, port->dev->features, + netdev_feature_or(port->dev->features, port->dev->features, csums); - netdev_feature_or(&port->dev->hw_features, + netdev_feature_or(port->dev->hw_features, port->dev->hw_features, csums); } } @@ -1349,23 +1349,23 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu) if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->features); + dev->features); netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->hw_features); + dev->hw_features); } else { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->hw_features); + dev->hw_features); } }
out_set: dev->mtu = mtu; - netdev_feature_copy(&dev->wanted_features, dev->features); + netdev_feature_copy(dev->wanted_features, dev->features);
netdev_update_features(dev); return 0; @@ -5291,7 +5291,7 @@ static int mvpp2_set_features(struct net_device *dev, struct mvpp2_port *port = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, @@ -6927,24 +6927,24 @@ static int mvpp2_port_probe(struct platform_device *pdev, } }
- netdev_feature_zero(&features); + netdev_feature_zero(features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | NETIF_F_TSO, &features); - netdev_feature_copy(&dev->features, features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, features); + NETIF_F_IPV6_CSUM | NETIF_F_TSO, features); + netdev_feature_copy(dev->features, features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_GRO | - NETIF_F_HW_VLAN_CTAG_FILTER, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_FILTER, dev->hw_features);
if (mvpp22_rss_is_supported(port)) { - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, dev->features); }
if (!port->priv->percpu_pools) mvpp2_set_hw_csum(port, port->pool_long->id);
- netdev_feature_or(&dev->vlan_features, dev->vlan_features, features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, features); dev->gso_max_segs = MVPP2_MAX_TSO_SEGS; dev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c index 34f9e9e..307ef95 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -483,7 +483,7 @@ void otx2_setup_segmentation(struct otx2_nic *pfvf) netdev_info(pfvf->netdev, "Failed to get LSO index for UDP GSO offload, disabling\n"); netdev_feature_clear_bit(NETIF_F_GSO_UDP_L4_BIT, - &pfvf->netdev->hw_features); + pfvf->netdev->hw_features); }
void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index de19cb3..baba90f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1785,17 +1785,17 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev) }
static void otx2_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* check if n-tuple filters are ON */ - if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features)) { netdev_info(dev, "Disabling n-tuple filters\n"); netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features); }
/* check if tc hw offload is ON */ - if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) && netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, dev->features)) { netdev_info(dev, "Disabling TC hardware offload\n"); netdev_feature_clear_bit(NETIF_F_HW_TC_BIT, features); @@ -1855,7 +1855,7 @@ static int otx2_set_features(struct net_device *netdev, struct otx2_nic *pf = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && netif_running(netdev)) @@ -2570,43 +2570,43 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id) */ pf->iommu_domain = iommu_get_domain_for_dev(dev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_L4, &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + NETIF_F_GSO_UDP_L4, netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev_feature_set_bits(NETIF_F_LOOPBACK | NETIF_F_RXALL, - &netdev->hw_features); + netdev->hw_features);
err = otx2_mcam_flow_init(pf); if (err) goto err_ptp_destroy;
if (pf->flags & OTX2_FLAG_NTUPLE_SUPPORT) - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features);
if (pf->flags & OTX2_FLAG_UCAST_FLTR_SUPPORT) netdev->priv_flags |= IFF_UNICAST_FLT;
/* Support TSO on tag interface */ - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &netdev->hw_features); + netdev->hw_features); if (pf->flags & OTX2_FLAG_RX_VLAN_SUPPORT) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
/* HW supports tc offload but mutually exclusive with n-tuple filters */ if (pf->flags & OTX2_FLAG_TC_FLOWER_SUPPORT) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features);
netdev->gso_max_segs = OTX2_MAX_GSO_SEGS; netdev->watchdog_timeo = OTX2_TX_TIMEOUT; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c index e23791b..a2a7350 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -616,19 +616,19 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Assign default mac address */ otx2_get_mac_from_af(netdev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_L4, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + NETIF_F_GSO_UDP_L4, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); /* Support TSO on tag interface */ - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev->gso_max_segs = OTX2_MAX_GSO_SEGS; diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 0867c77..999f21f 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -317,7 +317,7 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id) goto err_dl_port_register;
netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC, - &dev->features); + dev->features); dev->netdev_ops = &prestera_netdev_ops; dev->ethtool_ops = &prestera_ethtool_ops;
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 66fda62..75a0a66 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c @@ -3821,7 +3821,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, dev->max_mtu = ETH_JUMBO_MTU;
if (highmem) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
skge = netdev_priv(dev); netif_napi_add(dev, &skge->napi, skge_poll, NAPI_WEIGHT); @@ -3853,8 +3853,8 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, timer_setup(&skge->link_timer, xm_link_timer, 0); else { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_RXCSUM, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, + NETIF_F_RXCSUM, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); }
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index e46621c..5446e5a 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -1419,15 +1419,14 @@ static void sky2_vlan_mode(struct net_device *dev, netdev_features_t features) sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_ON);
- netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, - &dev->vlan_features); + netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, dev->vlan_features); } else { sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
/* Can't do transmit offload of vlan without hw vlan */ netdev_feature_clear_bits(SKY2_VLAN_OFFLOADS, - &dev->vlan_features); + dev->vlan_features); } }
@@ -2682,7 +2681,7 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status) * really broken, will get disabled again */ netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &sky2->netdev->features); + sky2->netdev->features); sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), BMU_DIS_RX_CHKSUM); } @@ -4361,7 +4360,7 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom }
static void sky2_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { const struct sky2_port *sky2 = netdev_priv(dev); const struct sky2_hw *hw = sky2->hw; @@ -4376,8 +4375,8 @@ static void sky2_fix_features(struct net_device *dev, }
/* Some hardware requires receive checksum for RSS to work. */ - if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && (sky2->hw->flags & SKY2_HW_RSS_CHKSUM)) { netdev_info(dev, "receive hashing forces receive checksum\n"); netdev_feature_clear_bits(NETIF_F_RXCSUM_BIT, features); @@ -4389,7 +4388,7 @@ static int sky2_set_features(struct net_device *dev, netdev_features_t features) struct sky2_port *sky2 = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed) && !(sky2->hw->flags & SKY2_HW_NEW_LE)) { @@ -4759,7 +4758,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, /* Auto speed and flow control */ sky2->flags = SKY2_FLAG_AUTO_SPEED | SKY2_FLAG_AUTO_PAUSE; if (hw->chip_id != CHIP_ID_YUKON_XL) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features);
sky2->flow_mode = FC_BOTH;
@@ -4779,24 +4778,24 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, sky2->port = port;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO, - &dev->hw_features); + dev->hw_features);
if (highmem) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
/* Enable receive hashing unless hardware is known broken */ if (!(hw->flags & SKY2_HW_RSS_BROKEN)) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, dev->hw_features);
if (!(hw->flags & SKY2_HW_VLAN_BROKEN)) { netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, - &dev->vlan_features); + dev->vlan_features); }
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
/* MTU range: 60 - 1500 or 9000 */ dev->min_mtu = ETH_ZLEN; diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index ae314ec..aebd650 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -2023,9 +2023,9 @@ static int mtk_hwlro_get_fdir_all(struct net_device *dev, }
static void mtk_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { - if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { struct mtk_mac *mac = netdev_priv(dev); int ip_cnt = mtk_hwlro_get_ip_cnt(mac);
@@ -3031,21 +3031,21 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) eth->netdev[id]->netdev_ops = &mtk_netdev_ops; eth->netdev[id]->base_addr = (unsigned long)eth->base;
- netdev_feature_zero(ð->netdev[id]->hw_features); + netdev_feature_zero(eth->netdev[id]->hw_features); netdev_feature_set_bits(eth->soc->hw_features, - ð->netdev[id]->hw_features); + eth->netdev[id]->hw_features); if (eth->hwlro) netdev_feature_set_bit(NETIF_F_LRO_BIT, - ð->netdev[id]->hw_features); + eth->netdev[id]->hw_features);
- netdev_feature_zero(ð->netdev[id]->vlan_features); + netdev_feature_zero(eth->netdev[id]->vlan_features); netdev_feature_set_bits(eth->soc->hw_features, - ð->netdev[id]->vlan_features); + eth->netdev[id]->vlan_features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - ð->netdev[id]->vlan_features); + eth->netdev[id]->vlan_features); netdev_feature_set_bits(eth->soc->hw_features, - ð->netdev[id]->features); + eth->netdev[id]->features); eth->netdev[id]->ethtool_ops = &mtk_ethtool_ops;
eth->netdev[id]->irq = eth->irq[0]; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f0bb981..7a4f5fe 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -2480,7 +2480,7 @@ static int mlx4_en_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) }
static void mlx4_en_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct mlx4_en_priv *en_priv = netdev_priv(netdev); struct mlx4_en_dev *mdev = en_priv->mdev; @@ -2489,7 +2489,7 @@ static void mlx4_en_fix_features(struct net_device *netdev, * enable/disable make sure S-TAG flag is always in same state as * C-TAG. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) && !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, features); else @@ -2665,7 +2665,7 @@ static const struct udp_tunnel_nic_info mlx4_udp_tunnels = { };
static void mlx4_en_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); vxlan_features_check(skb, features); @@ -3308,59 +3308,59 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, /* * Set driver features */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &dev->hw_features); + NETIF_F_IPV6_CSUM, dev->hw_features); if (mdev->LSO_support) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features);
if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &dev->features); - netdev_feature_zero(&dev->gso_partial_features); + dev->features); + netdev_feature_zero(dev->gso_partial_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &dev->gso_partial_features); - netdev_feature_zero(&dev->hw_enc_features); + dev->gso_partial_features); + netdev_feature_zero(dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &dev->hw_enc_features); + dev->hw_enc_features);
dev->udp_tunnel_nic_info = &mlx4_udp_tunnels; }
- netdev_feature_copy(&dev->vlan_features, dev->hw_features); + netdev_feature_copy(dev->vlan_features, dev->hw_features);
netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_RXHASH, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_LOOPBACK | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->hw_features); + dev->hw_features);
if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) { netdev_feature_set_bits(NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_FILTER, - &dev->features); + dev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, - &dev->hw_features); + dev->hw_features); }
if (mlx4_is_slave(mdev->dev)) { @@ -3370,7 +3370,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, err = get_phv_bit(mdev->dev, port, &phv); if (!err && phv) { netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &dev->hw_features); + dev->hw_features); priv->pflags |= MLX4_EN_PRIV_FLAGS_PHV; } err = mlx4_get_is_vlan_offload_disabled(mdev->dev, port, @@ -3381,31 +3381,31 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_FILTER, - &dev->hw_features); + dev->hw_features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_STAG_RX, - &dev->features); + dev->features); } } else { if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PHV_EN && !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &dev->hw_features); + dev->hw_features); }
if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, dev->hw_features);
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_IGNORE_FCS) - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, dev->hw_features);
if (mdev->dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED && mdev->dev->caps.dmfs_high_steer_mode != MLX4_STEERING_DMFS_A0_STATIC) - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, dev->hw_features);
if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) dev->priv_flags |= IFF_UNICAST_FLT; @@ -3544,10 +3544,10 @@ int mlx4_en_reset_config(struct net_device *dev, if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); } else if (ts_config.rx_filter == HWTSTAMP_FILTER_NONE) { /* RX time-stamping is OFF, update the RX vlan offload * to the latest wanted state @@ -3555,19 +3555,19 @@ int mlx4_en_reset_config(struct net_device *dev, if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, dev->wanted_features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS_BIT)) { if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, features)) netdev_feature_set_bit(NETIF_F_RXFCS_BIT, - &dev->features); + dev->features); else netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, - &dev->features); + dev->features); }
/* RX vlan offload and RX time-stamping can't co-exist ! @@ -3579,7 +3579,7 @@ int mlx4_en_reset_config(struct net_device *dev, dev->features)) en_warn(priv, "Turning off RX vlan offload since RX time-stamping is ON\n"); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
if (port_up) { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 5111c2c..e69ba39 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -1121,7 +1121,7 @@ void mlx5e_rx_dim_work(struct work_struct *work); void mlx5e_tx_dim_work(struct work_struct *work);
void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features); + 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_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c index b703ea3..8195e04 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c @@ -540,17 +540,17 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)
mlx5_core_info(mdev, "mlx5e: IPSec ESP acceleration enabled\n"); netdev->xfrmdev_ops = &mlx5e_ipsec_xfrmdev_ops; - netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, netdev->hw_enc_features);
if (!MLX5_CAP_ETH(mdev, swp_csum)) { mlx5_core_dbg(mdev, "mlx5e: SWP checksum not supported\n"); return; }
- netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
if (!(mlx5_accel_ipsec_device_caps(mdev) & MLX5_ACCEL_IPSEC_CAP_LSO) || !MLX5_CAP_ETH(mdev, swp_lso)) { @@ -560,10 +560,10 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)
if (mlx5_is_ipsec_device(mdev)) netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
mlx5_core_dbg(mdev, "mlx5e: ESP GSO capability turned on\n"); - netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, netdev->hw_enc_features); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h index b0e92a7..05a6c8f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h @@ -94,7 +94,7 @@ void mlx5e_ipsec_tx_build_eseg(struct mlx5e_priv *priv, struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg);
static inline void -mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features) +mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features) { struct xfrm_offload *xo = xfrm_offload(skb); struct sec_path *sp = skb_sec_path(skb); @@ -141,7 +141,7 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg)
static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe) { return false; } static inline void -mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features) +mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features) { netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, features); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c index fcac1a2..086c041 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c @@ -64,14 +64,13 @@ void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
if (mlx5e_accel_is_ktls_tx(mdev)) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, netdev->features); }
if (mlx5e_accel_is_ktls_rx(mdev)) netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
netdev->tlsdev_ops = &mlx5e_ktls_ops; } @@ -103,7 +102,7 @@ int mlx5e_ktls_init_rx(struct mlx5e_priv *priv) return -ENOMEM;
if (netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &priv->netdev->features)) { + priv->netdev->features)) { err = mlx5e_accel_fs_tcp_create(priv); if (err) { destroy_workqueue(priv->tls->rx_wq); @@ -120,7 +119,7 @@ void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv) return;
if (netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &priv->netdev->features)) + priv->netdev->features)) mlx5e_accel_fs_tcp_destroy(priv);
destroy_workqueue(priv->tls->rx_wq); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c index bd29987..f8e8d20 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c @@ -204,21 +204,21 @@ void mlx5e_tls_build_netdev(struct mlx5e_priv *priv) caps = mlx5_accel_tls_device_caps(priv->mdev); if (caps & MLX5_ACCEL_TLS_TX) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (caps & MLX5_ACCEL_TLS_RX) { netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (!(caps & MLX5_ACCEL_TLS_LRO)) { - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->hw_features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->hw_features); }
netdev->tlsdev_ops = &mlx5e_tls_ops; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c index 2cdab59..f3a3fd3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -1287,7 +1287,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) netdev_err(priv->netdev, "Failed to create arfs tables, err=%d\n", err); netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &priv->netdev->hw_features); + priv->netdev->hw_features); }
err = mlx5e_create_inner_ttc_table(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 1574f6b..0800d27 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3238,7 +3238,7 @@ static int set_feature_arfs(struct net_device *netdev, bool enable) #endif
static int mlx5e_handle_feature(struct net_device *netdev, - netdev_features_t *features, + netdev_features_t features, netdev_features_t wanted_features, u32 feature_bit, mlx5e_feature_handler feature_handler) @@ -3247,7 +3247,7 @@ static int mlx5e_handle_feature(struct net_device *netdev, bool enable; int err;
- netdev_feature_xor(&changes, wanted_features, netdev->features); + netdev_feature_xor(changes, wanted_features, netdev->features); enable = netdev_feature_test_bit(feature_bit, wanted_features);
if (!netdev_feature_test_bit(feature_bit, changes)) @@ -3269,10 +3269,10 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(oper_features); int err = 0;
- netdev_feature_copy(&oper_features, netdev->features); + netdev_feature_copy(oper_features, netdev->features);
#define MLX5E_HANDLE_FEATURE(feature, handler) \ - mlx5e_handle_feature(netdev, &oper_features, features, feature, handler) + mlx5e_handle_feature(netdev, oper_features, features, feature, handler)
err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO_BIT, set_feature_lro); err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, @@ -3289,7 +3289,7 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) mlx5e_ktls_set_feature_rx);
if (err) { - netdev_feature_copy(&netdev->features, oper_features); + netdev_feature_copy(netdev->features, oper_features); return -EINVAL; }
@@ -3297,7 +3297,7 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) }
static void mlx5e_fix_uplink_rep_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { netdev_feature_clear_bit(NETIF_F_HW_TLS_RX_BIT, features); if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, netdev->features)) @@ -3313,7 +3313,7 @@ static void mlx5e_fix_uplink_rep_features(struct net_device *netdev, }
static void mlx5e_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_params *params; @@ -3331,7 +3331,7 @@ static void mlx5e_fix_features(struct net_device *netdev, }
if (!MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_STRIDING_RQ)) { - if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } @@ -3764,7 +3764,7 @@ static bool mlx5e_gre_tunnel_inner_proto_offload_supported(struct mlx5_core_dev
static void mlx5e_tunnel_features_check(struct mlx5e_priv *priv, struct sk_buff *skb, - netdev_features_t *features) + netdev_features_t features) { unsigned int offset = 0; struct udphdr *udph; @@ -3819,7 +3819,7 @@ static void mlx5e_tunnel_features_check(struct mlx5e_priv *priv, }
void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -3828,8 +3828,8 @@ void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev,
/* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation && - (netdev_feature_test_bits(NETIF_F_CSUM_MASK, *features) || - netdev_feature_test_bits(NETIF_F_GSO_MASK, *features))) + (netdev_feature_test_bits(NETIF_F_CSUM_MASK, features) || + netdev_feature_test_bits(NETIF_F_GSO_MASK, features))) mlx5e_tunnel_features_check(priv, skb, features); }
@@ -4237,23 +4237,23 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
netdev->ethtool_ops = &mlx5e_ethtool_ops;
- netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->vlan_features);
- netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->mpls_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
/* Tunneled LRO is not supported in the driver, and the same RQs are * shared between inner and outer TIRs, so the driver can't disable LRO @@ -4264,83 +4264,83 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) !MLX5_CAP_ETH(mdev, tunnel_lro_vxlan) && !MLX5_CAP_ETH(mdev, tunnel_lro_gre) && mlx5e_check_fragmented_striding_rq_cap(mdev)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->vlan_features);
- netdev_feature_copy(&netdev->hw_features, netdev->vlan_features); + netdev_feature_copy(netdev->hw_features, netdev->vlan_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features);
if (mlx5e_tunnel_any_tx_proto_supported(mdev)) { netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) { netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features); }
if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) { netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6, - &netdev->gso_partial_features); + netdev->gso_partial_features); }
- netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, netdev->hw_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &netdev->gso_partial_features); - netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &netdev->features); + netdev->gso_partial_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, netdev->features);
mlx5_query_port_fcs(mdev, &fcs_supported, &fcs_enabled);
if (fcs_supported) - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, netdev->hw_features);
if (MLX5_CAP_ETH(mdev, scatter_fcs)) - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, netdev->hw_features);
if (mlx5_qos_is_supported(mdev)) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
/* Defaults */ if (fcs_enabled) - netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_RXALL_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, netdev->features);
#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f) if (FT_CAP(flow_modify_en) && @@ -4348,15 +4348,15 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) FT_CAP(identified_miss_table_mode) && FT_CAP(flow_table_modify)) { #if IS_ENABLED(CONFIG_MLX5_CLS_ACT) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features); #endif #ifdef CONFIG_MLX5_EN_ARFS - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features); #endif }
- netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index e1bd3b6..15f2af6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -628,20 +628,20 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev, netdev->watchdog_timeo = 15 * HZ;
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features); #endif - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features); - - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features); + + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, netdev->features); }
static int mlx5e_init_rep(struct mlx5_core_dev *mdev, @@ -1005,7 +1005,7 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) mlx5e_rep_neigh_init(rpriv); mlx5e_rep_bridge_init(priv);
- netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->wanted_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->wanted_features);
rtnl_lock(); if (netif_running(netdev)) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index b06c5fa..2e18a68 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -87,14 +87,14 @@ int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev) mlx5e_timestamp_init(priv);
/* netdev init */ - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->hw_features);
netdev->netdev_ops = &mlx5i_netdev_ops; netdev->ethtool_ops = &mlx5i_ethtool_ops; @@ -327,7 +327,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) netdev_err(priv->netdev, "Failed to create arfs tables, err=%d\n", err); netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &priv->netdev->hw_features); + priv->netdev->hw_features); }
err = mlx5e_create_ttc_table(priv); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 533e2a9..77e3dbd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1087,7 +1087,7 @@ static int mlxsw_sp_handle_feature(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changes); int err;
- netdev_feature_xor(&changes, wanted_features, dev->features); + netdev_feature_xor(changes, wanted_features, dev->features);
if (!netdev_feature_test_bit(feature_bit, changes)) return 0; @@ -1100,9 +1100,9 @@ static int mlxsw_sp_handle_feature(struct net_device *dev, }
if (enable) - netdev_feature_set_bit(feature_bit, &dev->features); + netdev_feature_set_bit(feature_bit, dev->features); else - netdev_feature_clear_bit(feature_bit, &dev->features); + netdev_feature_clear_bit(feature_bit, dev->features); return 0; } static int mlxsw_sp_set_features(struct net_device *dev, @@ -1111,14 +1111,14 @@ static int mlxsw_sp_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(oper_features); int err = 0;
- netdev_feature_copy(&oper_features, dev->features); + netdev_feature_copy(oper_features, dev->features); err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_HW_TC_BIT, mlxsw_sp_feature_hw_tc); err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_LOOPBACK_BIT, mlxsw_sp_feature_loopback);
if (err) { - netdev_feature_copy(&dev->features, oper_features); + netdev_feature_copy(dev->features, oper_features); return -EINVAL; }
@@ -1525,9 +1525,9 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_TC, &dev->features); + NETIF_F_HW_TC, dev->features); netdev_feature_set_bits(NETIF_F_HW_TC | NETIF_F_LOOPBACK, - &dev->hw_features); + dev->hw_features);
dev->min_mtu = 0; dev->max_mtu = ETH_MAX_MTU; diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index 18f50360..040abd7 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -6702,17 +6702,17 @@ static int __init netdev_init(struct net_device *dev) /* 500 ms timeout */ dev->watchdog_timeo = HZ / 2;
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features);
/* * Hardware does not really support IPv6 checksum generation, but * driver actually runs faster with this on. */ - netdev_feature_set_bits(NETIF_F_IPV6_CSUM_BIT, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_IPV6_CSUM_BIT, dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
sema_init(&priv->proc_sem, 1);
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index 00f06f6..b392733 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -2807,10 +2807,10 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
adapter->netdev->netdev_ops = &lan743x_netdev_ops; adapter->netdev->ethtool_ops = &lan743x_ethtool_ops; - netdev_feature_zero(&adapter->netdev->features); + netdev_feature_zero(adapter->netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM, - &adapter->netdev->features); - netdev_feature_copy(&adapter->netdev->hw_features, + adapter->netdev->features); + netdev_feature_copy(adapter->netdev->hw_features, adapter->netdev->features);
/* carrier off reporting is important to ethtool even BEFORE open */ diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 9f2d8eb..95998b8 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -1792,14 +1792,14 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
netdev_lockdep_set_classes(ndev);
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->hw_features); - netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, &ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); - netdev_feature_copy(&ndev->features, ndev->hw_features); - netdev_feature_zero(&ndev->vlan_features); + NETIF_F_IPV6_CSUM, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->hw_features); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features); + netdev_feature_copy(ndev->features, ndev->hw_features); + netdev_feature_zero(ndev->vlan_features);
err = register_netdev(ndev); if (err) { diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index b73c31b..181857f 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -775,7 +775,7 @@ static int ocelot_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changed); int port = priv->chip_port;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features) && !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && @@ -1556,9 +1556,9 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target, dev->ethtool_ops = &ocelot_ethtool_ops;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS | - NETIF_F_HW_TC, &dev->hw_features); + NETIF_F_HW_TC, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC, - &dev->features); + dev->features);
memcpy(dev->dev_addr, ocelot->base_mac, ETH_ALEN); dev->dev_addr[ETH_ALEN - 1] += port; diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index c7d3f50..c6883b4 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -2887,8 +2887,8 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, __DECLARE_NETDEV_FEATURE_MASK(tmp); netdev_tx_t status;
- netdev_feature_copy(&tmp, dev->features); - netdev_feature_clear_bit(NETIF_F_TSO6_BIT, &tmp); + netdev_feature_copy(tmp, dev->features); + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, tmp); segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs)) goto drop; @@ -3868,27 +3868,27 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->mtu = myri10ge_initial_mtu;
netdev->netdev_ops = &myri10ge_netdev_ops; - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(mgp->features | NETIF_F_RXCSUM, - &netdev->hw_features); + netdev->hw_features);
/* fake NETIF_F_HW_VLAN_CTAG_RX for good GRO performance */ netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (dac_enabled) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_set_bits(mgp->features, &netdev->vlan_features); + netdev_feature_set_bits(mgp->features, netdev->vlan_features);
if (mgp->fw_ver_tiny < 37) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->vlan_features); + netdev->vlan_features); if (mgp->fw_ver_tiny < 32) netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->vlan_features); + netdev->vlan_features);
/* make sure we can get an irq, and that MSI can be * setup (if available). */ diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c index ed2e9fe..8f1a675 100644 --- a/drivers/net/ethernet/natsemi/ns83820.c +++ b/drivers/net/ethernet/natsemi/ns83820.c @@ -2139,8 +2139,8 @@ static int ns83820_init_one(struct pci_dev *pci_dev, ns83820_getmac(dev, ndev->dev_addr);
/* Yes, we support dumb IP checksum on transmit */ - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, ndev->features);
ndev->min_mtu = 0;
@@ -2148,13 +2148,13 @@ static int ns83820_init_one(struct pci_dev *pci_dev, /* We also support hardware vlan acceleration */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &ndev->features); + ndev->features); #endif
if (using_dac) { printk(KERN_INFO "%s: using 64 bit addressing.\n", ndev->name); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); }
printk(KERN_INFO "%s: ns83820 v" VERSION ": DP83820 v%u.%u: %pM io=0x%08lx irq=%d f=%s\n", diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index 79165cf..81a3c6f 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c @@ -6569,7 +6569,7 @@ static int s2io_set_features(struct net_device *dev, netdev_features_t features) struct s2io_nic *sp = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, changed) && netif_running(dev)) { @@ -6577,7 +6577,7 @@ static int s2io_set_features(struct net_device *dev, netdev_features_t features)
s2io_stop_all_tx_queue(sp); s2io_card_down(sp); - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); rc = s2io_card_up(sp); if (rc) s2io_reset(sp); @@ -7865,17 +7865,17 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) /* Driver entry points */ dev->netdev_ops = &s2io_netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_LRO, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->features); + dev->features); if (sp->high_dma_flag == true) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); dev->watchdog_timeo = WATCH_DOG_TIMEOUT; INIT_WORK(&sp->rst_timer_task, s2io_restart_nic); INIT_WORK(&sp->set_link_task, s2io_set_link); diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 6095786..bb260cd 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -2641,11 +2641,11 @@ static void vxge_poll_vp_lockup(struct timer_list *t) }
static void vxge_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, *features); + netdev_feature_xor(changed, dev->features, features);
/* Enabling RTH requires some of the logic in vxge_device_register and a * vpath reset. Due to these restrictions, only allow modification @@ -2661,7 +2661,7 @@ static int vxge_set_features(struct net_device *dev, netdev_features_t features) struct vxgedev *vdev = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) return 0; @@ -3398,20 +3398,20 @@ static int vxge_device_register(struct __vxge_hw_device *hldev,
SET_NETDEV_DEV(ndev, &vdev->pdev->dev);
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX, - &ndev->hw_features); + ndev->hw_features); if (vdev->config.rth_steering != NO_STEERING) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features);
- netdev_feature_or(&ndev->features, ndev->features, + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &ndev->hw_features); + ndev->hw_features);
ndev->netdev_ops = &vxge_netdev_ops;
@@ -3435,7 +3435,7 @@ static int vxge_device_register(struct __vxge_hw_device *hldev, "%s : checksumming enabled", __func__);
if (high_dma) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); vxge_debug_init(vxge_hw_device_trace_level_get(hldev), "%s : using High DMA", __func__); } diff --git a/drivers/net/ethernet/netronome/nfp/crypto/tls.c b/drivers/net/ethernet/netronome/nfp/crypto/tls.c index a5bee5d..bdd799f 100644 --- a/drivers/net/ethernet/netronome/nfp/crypto/tls.c +++ b/drivers/net/ethernet/netronome/nfp/crypto/tls.c @@ -588,15 +588,15 @@ int nfp_net_tls_init(struct nfp_net *nn)
if (nn->tlv_caps.crypto_ops & NFP_NET_TLS_OPCODE_MASK_RX) { netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->features); + netdev->features); } if (nn->tlv_caps.crypto_ops & NFP_NET_TLS_OPCODE_MASK_TX) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->features); + netdev->features); }
netdev->tlsdev_ops = &nfp_net_tls_ops; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index f14bdf7..43bcb61 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -3527,7 +3527,7 @@ static int nfp_net_set_features(struct net_device *netdev,
new_ctrl = nn->dp.ctrl;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) @@ -3590,8 +3590,10 @@ static int nfp_net_set_features(struct net_device *netdev, if (err) return err;
- nn_dbg(nn, "Feature change 0x%llx -> 0x%llx (changed=0x%llx)\n", - netdev->features, features, changed); + nn_dbg(nn, "Feature change %*pb -> %*pb (changed=%*pb)\n", + NETDEV_FEATURE_COUNT, netdev->features, + NETDEV_FEATURE_COUNT, features, + NETDEV_FEATURE_COUNT, changed);
if (new_ctrl == nn->dp.ctrl) return 0; @@ -3608,7 +3610,7 @@ static int nfp_net_set_features(struct net_device *netdev, }
static void nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { u8 l4_hdr;
@@ -4041,54 +4043,54 @@ static void nfp_net_netdev_init(struct nfp_net *nn) if (nn->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->hw_features);
if (nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY; } if (nn->cap & NFP_NET_CFG_CTRL_TXCSUM) { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_TXCSUM; } if (nn->cap & NFP_NET_CFG_CTRL_GATHER) { - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_GATHER; } if ((nn->cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) || nn->cap & NFP_NET_CFG_CTRL_LSO2) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_LSO2 ?: NFP_NET_CFG_CTRL_LSO; } if (nn->cap & NFP_NET_CFG_CTRL_RSS_ANY) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (nn->cap & NFP_NET_CFG_CTRL_VXLAN) { if (nn->cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_features); + netdev->hw_features); netdev->udp_tunnel_nic_info = &nfp_udp_tunnels; nn->dp.ctrl |= NFP_NET_CFG_CTRL_VXLAN; } if (nn->cap & NFP_NET_CFG_CTRL_NVGRE) { if (nn->cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_NVGRE; } if (nn->cap & (NFP_NET_CFG_CTRL_VXLAN | NFP_NET_CFG_CTRL_NVGRE)) - netdev_feature_copy(&netdev->hw_enc_features, + netdev_feature_copy(netdev->hw_enc_features, netdev->hw_features);
- netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features);
if (nn->cap & NFP_NET_CFG_CTRL_RXVLAN) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_RXVLAN; } if (nn->cap & NFP_NET_CFG_CTRL_TXVLAN) { @@ -4096,24 +4098,24 @@ static void nfp_net_netdev_init(struct nfp_net *nn) nn_warn(nn, "Device advertises both TSO2 and TXVLAN. Refusing to enable TXVLAN.\n"); } else { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_TXVLAN; } } if (nn->cap & NFP_NET_CFG_CTRL_CTAG_FILTER) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_CTAG_FILTER; }
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (nfp_app_has_tc(nn->app) && nn->port) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features);
/* Advertise but disable TSO by default. */ netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->features); + netdev->features); nn->dp.ctrl &= ~NFP_NET_CFG_CTRL_LSO_ANY;
/* Finalise the netdev setup */ diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index 9bbfe47..c22945e 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -233,7 +233,7 @@ static int nfp_repr_open(struct net_device *netdev) }
static void nfp_repr_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(lower_features); __DECLARE_NETDEV_FEATURE_MASK(old_features); @@ -242,16 +242,16 @@ static void nfp_repr_fix_features(struct net_device *netdev,
lower_dev = repr->dst->u.port_info.lower_dev;
- netdev_feature_copy(&old_features, *features); - netdev_feature_copy(&lower_features, lower_dev->features); + netdev_feature_copy(old_features, features); + netdev_feature_copy(lower_features, lower_dev->features); if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, lower_features)) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &lower_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, lower_features);
- netdev_intersect_features(features, *features, lower_features); + netdev_intersect_features(features, features, lower_features); netdev_feature_and_bits(NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC, - &old_features); - netdev_feature_or(features, *features, old_features); + old_features); + netdev_feature_or(features, features, old_features); netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
@@ -343,66 +343,66 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, if (repr_cap & NFP_NET_CFG_CTRL_LIVE_ADDR) netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_RXCSUM_ANY) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_TXCSUM) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_GATHER) - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); if ((repr_cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) || repr_cap & NFP_NET_CFG_CTRL_LSO2) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_RSS_ANY) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_VXLAN) { if (repr_cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_features); + netdev->hw_features); } if (repr_cap & NFP_NET_CFG_CTRL_NVGRE) { if (repr_cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_features); + netdev->hw_features); } if (repr_cap & (NFP_NET_CFG_CTRL_VXLAN | NFP_NET_CFG_CTRL_NVGRE)) - netdev_feature_copy(&netdev->hw_enc_features, + netdev_feature_copy(netdev->hw_enc_features, netdev->hw_features);
- netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features);
if (repr_cap & NFP_NET_CFG_CTRL_RXVLAN) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_TXVLAN) { if (repr_cap & NFP_NET_CFG_CTRL_LSO2) netdev_warn(netdev, "Device advertises both TSO2 and TXVLAN. Refusing to enable TXVLAN.\n"); else netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); } if (repr_cap & NFP_NET_CFG_CTRL_CTAG_FILTER) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
/* Advertise but disable TSO by default. */ netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->features); + netdev->features); netdev->gso_max_segs = NFP_NET_LSO_MAX_SEGS;
netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, netdev->features);
if (nfp_app_has_tc(app)) { - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features); }
err = nfp_app_repr_init(app, netdev); diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index 2098f3f..4f56fb0 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -1271,8 +1271,8 @@ static int nixge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ndev); SET_NETDEV_DEV(ndev, &pdev->dev);
- netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); ndev->netdev_ops = &nixge_netdev_ops; ndev->ethtool_ops = &nixge_ethtool_ops;
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index d4e89a9..7aed110 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -4922,11 +4922,11 @@ static int nv_set_loopback(struct net_device *dev, netdev_features_t features) }
static void nv_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* vlan is dependent on rx checksum offload */ if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, *features)) + NETIF_F_HW_VLAN_CTAG_RX, features)) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, features); }
@@ -4958,7 +4958,7 @@ static int nv_set_features(struct net_device *dev, netdev_features_t features) u8 __iomem *base = get_hwbase(dev); int retval;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && netif_running(dev)) { @@ -5791,7 +5791,7 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) "64-bit DMA failed, using 32-bit addressing\n"); else netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &dev->features); + dev->features); if (pci_set_consistent_dma_mask(pci_dev, DMA_BIT_MASK(39))) { dev_info(&pci_dev->dev, "64-bit DMA (consistent) failed, using 32-bit ring buffers\n"); @@ -5815,7 +5815,7 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features); }
np->vlanctl_bits = 0; @@ -5823,13 +5823,13 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &dev->hw_features); + dev->hw_features); }
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
/* Add loopback capability to the device. */ - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, dev->hw_features);
/* MTU range: 64 - 1500 or 9100 */ dev->min_mtu = ETH_ZLEN + ETH_FCS_LEN; diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 350db45..285f99e 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -2218,7 +2218,7 @@ static int pch_gbe_set_features(struct net_device *netdev, struct pch_gbe_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0; @@ -2531,10 +2531,10 @@ static int pch_gbe_probe(struct pci_dev *pdev, netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD; netif_napi_add(netdev, &adapter->napi, pch_gbe_napi_poll, PCH_GBE_RX_WEIGHT); - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + NETIF_F_IPV6_CSUM, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); pch_gbe_set_ethtool_ops(netdev);
/* MTU range: 46 - 10300 */ diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c index 1e3a909..2f714aa 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c @@ -478,7 +478,7 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) pch_gbe_validate_option(&val, &opt, adapter); if (!val) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &dev->features); + dev->features); } { /* Checksum Offload Enable/Disable */ static const struct pch_gbe_option opt = { @@ -491,7 +491,7 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) pch_gbe_validate_option(&val, &opt, adapter); if (!val) netdev_feature_clear_bits(NETIF_F_CSUM_MASK, - &dev->features); + dev->features); } { /* Flow Control */ static const struct pch_gbe_option opt = { diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index 908ecef..f04814f 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c @@ -1699,10 +1699,10 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64);
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_GSO, - &dev->features); + dev->features);
mac->dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL); if (!mac->dma_pdev) { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 57f418e..0dcda4b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1597,7 +1597,7 @@ static int ionic_init_nic_features(struct ionic_lif *lif) int err;
/* set up what we expect to support by default */ - netdev_feature_zero(&features); + netdev_feature_zero(features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | @@ -1607,75 +1607,75 @@ static int ionic_init_nic_features(struct ionic_lif *lif) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN, - &features); + features);
if (lif->nxqs > 1) - netdev_feature_set_bits(NETIF_F_RXHASH_BIT, &features); + netdev_feature_set_bits(NETIF_F_RXHASH_BIT, features);
err = ionic_set_nic_features(lif, features); if (err) return err;
/* tell the netdev what we actually can support */ - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
if (lif->hw_features & IONIC_ETH_HW_VLAN_TX_TAG) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_VLAN_RX_STRIP) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_VLAN_RX_FILTER) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_RX_HASH) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_TX_SG) - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features);
if (lif->hw_features & IONIC_ETH_HW_TX_CSUM) netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_RX_CSUM) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPV6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_ECN) netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_GRE) netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_GRE_CSUM) netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPXIP4) netdev_feature_set_bit(NETIF_F_GSO_IPXIP4_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPXIP6) netdev_feature_set_bit(NETIF_F_GSO_IPXIP6_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_UDP) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_UDP_CSUM) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->hw_enc_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_clear_bits(NETIF_F_VLAN_FEATURES, - &netdev->vlan_features); + netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE; diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 487b203..07602ae 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -518,9 +518,9 @@ static void netxen_set_multicast_list(struct net_device *dev) }
static void netxen_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { netdev_info(dev, "disabling LRO as RXCSUM is off\n");
netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); @@ -1345,32 +1345,32 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
netdev->ethtool_ops = &netxen_nic_ethtool_ops;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_RXCSUM, &netdev->hw_features); + NETIF_F_RXCSUM, netdev->hw_features);
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) netdev_feature_set_bits(NETIF_F_IPV6_CSUM | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->hw_features);
if (adapter->pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features);
if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO) netdev_feature_set_bit(NETIF_F_LRO_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev->irq = adapter->msix_entries[0].vector; diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h index ff77e39..5ced59a 100644 --- a/drivers/net/ethernet/qlogic/qede/qede.h +++ b/drivers/net/ethernet/qlogic/qede/qede.h @@ -528,7 +528,7 @@ int qede_xdp_transmit(struct net_device *dev, int n_frames, u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev); void qede_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features); + 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); @@ -545,7 +545,7 @@ int qede_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid); void qede_vlan_mark_nonconfigured(struct qede_dev *edev); int qede_configure_vlan_filters(struct qede_dev *edev);
-void qede_fix_features(struct net_device *dev, netdev_features_t *features); +void qede_fix_features(struct net_device *dev, netdev_features_t features); int qede_set_features(struct net_device *dev, netdev_features_t features); void qede_set_rx_mode(struct net_device *ndev); void qede_config_rx_mode(struct net_device *ndev); diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index 9bfa18c..7f82f7d 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c @@ -1023,7 +1023,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) - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &ndev->features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, ndev->features);
/* Set the mtu field and re-start the interface if needed */ args.u.mtu = new_mtu; diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index 0d02657..f858c1a 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -909,15 +909,15 @@ void qede_vlan_mark_nonconfigured(struct qede_dev *edev) static void qede_set_features_reload(struct qede_dev *edev, struct qede_reload_args *args) { - netdev_feature_copy(&edev->ndev->features, args->u.features); + netdev_feature_copy(edev->ndev->features, args->u.features); }
-void qede_fix_features(struct net_device *dev, netdev_features_t *features) +void qede_fix_features(struct net_device *dev, netdev_features_t features) { struct qede_dev *edev = netdev_priv(dev);
if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE || - !netdev_feature_test_bit(NETIF_F_GRO_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_GRO_BIT, features)) netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); }
@@ -927,7 +927,7 @@ int qede_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changes); bool need_reload = false;
- netdev_feature_xor(&changes, features, dev->features); + netdev_feature_xor(changes, features, dev->features);
if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, changes)) need_reload = true; @@ -935,7 +935,7 @@ int qede_set_features(struct net_device *dev, netdev_features_t features) if (need_reload) { struct qede_reload_args args;
- netdev_feature_copy(&args.u.features, features); + netdev_feature_copy(args.u.features, features); args.func = &qede_set_features_reload;
/* Make sure that we definitely need to reload. diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index 2d49c95..f636d8b 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c @@ -1748,7 +1748,7 @@ u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, #define QEDE_MAX_TUN_HDR_LEN 48
void qede_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { if (skb->encapsulation) { u8 l4_proto = 0; diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index b54235f..394afd0 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c @@ -789,36 +789,36 @@ static void qede_init_ndev(struct qede_dev *edev) ndev->priv_flags |= IFF_UNICAST_FLT;
/* user-changeble features */ - netdev_feature_zero(&hw_features); + netdev_feature_zero(hw_features); netdev_feature_set_bits(NETIF_F_GRO | NETIF_F_GRO_HW | NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC, - &hw_features); + hw_features);
if (edev->dev_info.common.b_arfs_capable) - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, hw_features);
if (edev->dev_info.common.vxlan_enable || edev->dev_info.common.geneve_enable) udp_tunnel_enable = true;
if (udp_tunnel_enable || edev->dev_info.common.gre_enable) { - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &hw_features); - netdev_feature_zero(&ndev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, hw_features); + netdev_feature_zero(ndev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_RXCSUM, - &ndev->hw_enc_features); + ndev->hw_enc_features); }
if (udp_tunnel_enable) { netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &hw_features); + hw_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &ndev->hw_enc_features); + ndev->hw_enc_features);
qede_set_udp_tunnels(edev); } @@ -826,22 +826,22 @@ static void qede_init_ndev(struct qede_dev *edev) if (edev->dev_info.common.gre_enable) { netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM, - &hw_features); + hw_features); netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM, - &ndev->hw_enc_features); + ndev->hw_enc_features); }
- netdev_feature_copy(&ndev->vlan_features, hw_features); + netdev_feature_copy(ndev->vlan_features, hw_features); netdev_feature_set_bits(NETIF_F_RXHASH | NETIF_F_RXCSUM | - NETIF_F_HIGHDMA, &ndev->vlan_features); - netdev_feature_copy(&ndev->features, hw_features); + NETIF_F_HIGHDMA, ndev->vlan_features); + netdev_feature_copy(ndev->features, hw_features); netdev_feature_set_bits(NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_TX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_TX, ndev->features);
- netdev_feature_copy(&ndev->hw_features, hw_features); + netdev_feature_copy(ndev->hw_features, hw_features);
/* MTU range: 46 - 9600 */ ndev->min_mtu = ETH_ZLEN - ETH_HLEN; @@ -1508,7 +1508,7 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq) } else { rxq->rx_buf_seg_size = PAGE_SIZE; netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, - &edev->ndev->features); + edev->ndev->features); }
/* Allocate the parallel driver ring for Rx buffers */ @@ -2384,7 +2384,7 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
if (qede_alloc_arfs(edev)) { netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &edev->ndev->features); + edev->ndev->features); edev->dev_info.common.b_arfs_capable = false; }
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index c396ee0..51cc821 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c @@ -3797,10 +3797,10 @@ static int ql3xxx_probe(struct pci_dev *pdev, qdev->msg_enable = netif_msg_init(debug, default_msg);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); if (qdev->device_id == QL3032_DEVICE_ID) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &ndev->features); + ndev->features);
qdev->mem_map_registers = pci_ioremap_bar(pdev, 1); if (!qdev->mem_map_registers) { diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 7fbf895..5b012bd 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1622,7 +1622,7 @@ int qlcnic_82xx_read_phys_port_id(struct qlcnic_adapter *); int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu); int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *, u32); int qlcnic_change_mtu(struct net_device *netdev, int new_mtu); -void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features); +void qlcnic_fix_features(struct net_device *netdev, netdev_features_t features); int qlcnic_set_features(struct net_device *netdev, netdev_features_t features); int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable); void qlcnic_update_cmd_producer(struct qlcnic_host_tx_ring *); diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index ee055e9..85edd77 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -1021,7 +1021,7 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu) }
static void qlcnic_process_flags(struct qlcnic_adapter *adapter, - netdev_features_t *features) + netdev_features_t features) { u32 offload_flags = adapter->offload_flags;
@@ -1057,7 +1057,7 @@ static void qlcnic_process_flags(struct qlcnic_adapter *adapter, } }
-void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) +void qlcnic_fix_features(struct net_device *netdev, netdev_features_t features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed); @@ -1067,19 +1067,19 @@ void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) { qlcnic_process_flags(adapter, features); } else { - netdev_feature_xor(&changed, *features, + netdev_feature_xor(changed, features, netdev->features); netdev_feature_and_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &changed); - netdev_feature_xor(features, *features, changed); + changed); + netdev_feature_xor(features, features, changed); } }
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
@@ -1090,14 +1090,14 @@ int qlcnic_set_features(struct net_device *netdev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); int hw_lro;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); hw_lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, features) ? QLCNIC_LRO_ENABLED : 0;
if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) return 0;
- netdev_feature_change_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_change_bit(NETIF_F_LRO_BIT, netdev->features);
if (qlcnic_config_hw_lro(adapter, hw_lro)) return -EIO; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 37e1ddb..20253b05 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -493,7 +493,7 @@ static const struct udp_tunnel_nic_info qlcnic_udp_tunnels = { };
static void qlcnic_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); vxlan_features_check(skb, features); @@ -2277,54 +2277,54 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_IPV6_CSUM | NETIF_F_GRO | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &netdev->vlan_features); + NETIF_F_IPV6_CSUM, netdev->vlan_features);
if (QLCNIC_IS_TSO_CAPABLE(adapter)) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->features); + netdev->features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features); }
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
if (qlcnic_vlan_tx_check(adapter)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->features); + netdev->features);
if (qlcnic_sriov_vf_check(adapter)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->features);
if (qlcnic_encap_tx_offload(adapter)) { netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->features); + netdev->features);
/* encapsulation Tx offload supported by Adapter */ netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
if (qlcnic_encap_rx_offload(adapter)) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &qlcnic_udp_tunnels; }
- netdev_feature_copy(&netdev->hw_features, netdev->features); + netdev_feature_copy(netdev->hw_features, netdev->features); netdev->priv_flags |= IFF_UNICAST_FLT; netdev->irq = adapter->msix_entries[0].vector;
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index 53a83c1..c8be875 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c @@ -178,7 +178,7 @@ static int emac_set_features(struct net_device *netdev, struct emac_adapter *adpt = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
/* We only need to reprogram the hardware if the VLAN tag features * have changed, and if it's already running. @@ -193,7 +193,7 @@ static int emac_set_features(struct net_device *netdev, /* emac_mac_mode_config() uses netdev->features to configure the EMAC, * so make sure it's set first. */ - netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
return emac_reinit_locked(adpt); } @@ -671,15 +671,15 @@ static int emac_probe(struct platform_device *pdev) }
/* set hw features */ - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX, &netdev->features); - netdev_feature_copy(&netdev->hw_features, netdev->features); + NETIF_F_HW_VLAN_CTAG_TX, netdev->features); + netdev_feature_copy(netdev->hw_features, netdev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
/* MTU range: 46 - 9194 */ netdev->min_mtu = EMAC_MIN_ETH_FRAME_SIZE - diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c index d6d3dab..4d03846 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c @@ -236,7 +236,7 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev) rmnet_dev->needs_free_netdev = true; rmnet_dev->ethtool_ops = &rmnet_ethtool_ops;
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &rmnet_dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, rmnet_dev->features);
/* This perm addr will be used as interface identifier by IPv6 */ rmnet_dev->addr_assign_type = NET_ADDR_RANDOM; @@ -261,11 +261,11 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, return -EBUSY; }
- netdev_feature_zero(&rmnet_dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &rmnet_dev->hw_features); + netdev_feature_zero(rmnet_dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, rmnet_dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &rmnet_dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &rmnet_dev->hw_features); + rmnet_dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, rmnet_dev->hw_features);
priv->real_dev = real_dev;
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 626b3f2..97913ad 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -1855,7 +1855,7 @@ static void cp_set_d3_state (struct cp_private *cp) }
static void cp_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { if (skb_shinfo(skb)->gso_size > MSSMask) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); @@ -1968,8 +1968,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) cp->cpcmd = (pci_using_dac ? PCIDAC : 0) | PCIMulRW | RxChkSum | CpRxOn | CpTxOn;
- netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features);
regs = ioremap(pciaddr, CP_REGS_SIZE); if (!regs) { @@ -1996,16 +1996,16 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->features); + NETIF_F_HW_VLAN_CTAG_RX, dev->features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HIGHDMA, &dev->vlan_features); + NETIF_F_HIGHDMA, dev->vlan_features);
/* MTU range: 60 - 4096 */ dev->min_mtu = CP_MIN_MTU; diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index bb8ed95..7cd11b6 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c @@ -904,7 +904,7 @@ static int rtl8139_set_features(struct net_device *dev, netdev_features_t featur unsigned long flags; void __iomem *ioaddr = tp->mmio_addr;
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features);
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) return 0; @@ -1011,11 +1011,11 @@ static int rtl8139_init_one(struct pci_dev *pdev, * features */ netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA, - &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + dev->features); + netdev_feature_copy(dev->vlan_features, dev->features);
- netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, dev->hw_features);
/* MTU range: 68 - 1770 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index e1bdc34..849e07a 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -1466,7 +1466,7 @@ static int rtl8169_get_regs_len(struct net_device *dev) }
static void rtl8169_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct rtl8169_private *tp = netdev_priv(dev);
@@ -4334,7 +4334,7 @@ static unsigned int rtl_last_frag_len(struct sk_buff *skb) }
/* Workaround for hw issues with TSO on RTL8168evl */ -static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t *features) +static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t features) { /* IPv4 header has options field */ if (vlan_get_protocol(skb) == htons(ETH_P_IP) && @@ -4351,7 +4351,7 @@ static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t *features) }
static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { int transport_offset = skb_transport_offset(skb); struct rtl8169_private *tp = netdev_priv(dev); @@ -5328,7 +5328,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (sizeof(dma_addr_t) > 4 && tp->mac_version >= RTL_GIGA_MAC_VER_18 && !dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
rtl_init_rxcfg(tp);
@@ -5352,13 +5352,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_napi_add(dev, &tp->napi, rtl8169_poll, NAPI_POLL_WEIGHT);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); - netdev_feature_zero(&dev->vlan_features); + NETIF_F_HW_VLAN_CTAG_RX, dev->hw_features); + netdev_feature_zero(dev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO, - &dev->vlan_features); + dev->vlan_features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
/* @@ -5368,13 +5368,13 @@ 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 */ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->hw_features); + dev->hw_features);
if (rtl_chip_supports_csum_v2(tp)) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &dev->hw_features); + dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
/* There has been a number of reports that using SG/TSO results in * tx timeouts. However for a lot of people SG/TSO works fine. @@ -5383,18 +5383,18 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) */ if (rtl_chip_supports_csum_v2(tp)) { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features); dev->gso_max_size = RTL_GSO_MAX_SIZE_V2; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V2; } else { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO, - &dev->hw_features); + dev->hw_features); dev->gso_max_size = RTL_GSO_MAX_SIZE_V1; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V1; }
- netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, dev->hw_features);
/* configure chip for default features */ rtl8169_set_features(dev, dev->features); diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 3da1b31..e9a417c 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1858,14 +1858,14 @@ static int ravb_set_features(struct net_device *ndev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) ravb_set_rx_csum(ndev, netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features));
- netdev_feature_copy(&ndev->features, features); + netdev_feature_copy(ndev->features, features);
return 0; } @@ -2058,10 +2058,10 @@ static int ravb_probe(struct platform_device *pdev) if (!ndev) return -ENOMEM;
- netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); - netdev_feature_zero(&ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features); + netdev_feature_zero(ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features);
pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 6cffae1..0d5857b 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2935,7 +2935,7 @@ static int sh_eth_set_features(struct net_device *ndev, struct sh_eth_private *mdp = netdev_priv(ndev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed) && mdp->cd->rx_csum) @@ -2943,7 +2943,7 @@ static int sh_eth_set_features(struct net_device *ndev, netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features));
- netdev_feature_copy(&ndev->features, features); + netdev_feature_copy(ndev->features, features);
return 0; } @@ -3297,10 +3297,10 @@ static int sh_eth_drv_probe(struct platform_device *pdev) ndev->min_mtu = ETH_MIN_MTU;
if (mdp->cd->rx_csum) { - netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); - netdev_feature_zero(&ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->hw_features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features); + netdev_feature_zero(ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->hw_features); }
/* set function */ @@ -3353,7 +3353,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) } mdp->port = port; netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &ndev->features); + ndev->features);
/* Need to init only the first port of the two sharing a TSU */ if (port == 0) { diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 631ec69..91766f5 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2590,7 +2590,7 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number) rocker_carrier_init(rocker_port);
netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_SG, - &dev->features); + dev->features);
/* MTU range: 68 - 9000 */ dev->min_mtu = ROCKER_PORT_MIN_MTU; diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index b8b6e31..8afe255 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -1777,7 +1777,7 @@ static int sxgbe_set_features(struct net_device *dev, struct sxgbe_priv_data *priv = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { @@ -2104,13 +2104,13 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
ndev->netdev_ops = &sxgbe_netdev_ops;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GRO, &ndev->hw_features); - netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + NETIF_F_GRO, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); ndev->watchdog_timeo = msecs_to_jiffies(TX_TIMEO);
/* assign filtering support */ diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 0877282..05c4c7d3 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -628,7 +628,7 @@ static int efx_ef10_probe(struct efx_nic *efx) if (nic_data->datapath_caps & (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_INCLUDE_FCS_LBN)) netdev_feature_set_bit(NETIF_F_RXFCS_BIT, - &efx->net_dev->hw_features); + efx->net_dev->hw_features);
rc = efx_mcdi_port_get_number(efx); if (rc < 0) @@ -1308,7 +1308,7 @@ static int efx_ef10_init_nic(struct efx_nic *efx) __DECLARE_NETDEV_FEATURE_MASK(hw_enc_features); int rc;
- netdev_feature_zero(&hw_enc_features); + netdev_feature_zero(hw_enc_features);
if (nic_data->must_check_datapath_caps) { rc = efx_ef10_init_datapath_caps(efx); @@ -1355,26 +1355,26 @@ static int efx_ef10_init_nic(struct efx_nic *efx) /* add encapsulated checksum offload features */ if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx)) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &hw_enc_features); + hw_enc_features); /* add encapsulated TSO features */ if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { __DECLARE_NETDEV_FEATURE_MASK(encap_tso_features);
- netdev_feature_zero(&encap_tso_features); + netdev_feature_zero(encap_tso_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM, - &encap_tso_features); + encap_tso_features);
- netdev_feature_or(&hw_enc_features, hw_enc_features, + netdev_feature_or(hw_enc_features, hw_enc_features, encap_tso_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &hw_enc_features); - netdev_feature_or(&efx->net_dev->features, + netdev_feature_set_bit(NETIF_F_TSO_BIT, hw_enc_features); + netdev_feature_or(efx->net_dev->features, efx->net_dev->features, encap_tso_features); } - netdev_feature_copy(&efx->net_dev->hw_enc_features, hw_enc_features); + netdev_feature_copy(efx->net_dev->hw_enc_features, hw_enc_features);
/* don't fail init if RSS setup doesn't work */ rc = efx->type->rx_push_rss_config(efx, false, diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index d509814..88cba7cb 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -186,24 +186,24 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx) struct net_device *net_dev = efx->net_dev; __DECLARE_NETDEV_FEATURE_MASK(tso);
- netdev_feature_zero(&tso); + netdev_feature_zero(tso); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM, - &tso); + tso);
- netdev_feature_or(&net_dev->features, net_dev->features, tso); - netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, + netdev_feature_or(net_dev->features, net_dev->features, tso); + netdev_feature_or(net_dev->hw_features, net_dev->hw_features, tso); - netdev_feature_or(&net_dev->hw_enc_features, + netdev_feature_or(net_dev->hw_enc_features, net_dev->hw_enc_features, tso); /* EF100 HW can only offload outer checksums if they are UDP, * so for GRE_CSUM we have to use GSO_PARTIAL. */ netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &net_dev->gso_partial_features); + net_dev->gso_partial_features); } efx->num_mac_stats = MCDI_WORD(outbuf, GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS); @@ -1121,14 +1121,14 @@ static int ef100_probe_main(struct efx_nic *efx) efx->nic_data = nic_data; nic_data->efx = efx; netdev_feature_set_bits(efx->type->offload_features, - &net_dev->features); + net_dev->features); netdev_feature_set_bits(efx->type->offload_features, - &net_dev->hw_features); + net_dev->hw_features); netdev_feature_set_bits(efx->type->offload_features, - &net_dev->hw_enc_features); + net_dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_ALL_TSO, - &net_dev->vlan_features); + net_dev->vlan_features);
/* Populate design-parameter defaults */ nic_data->tso_max_hdr_len = ESE_EF100_DP_GZ_TSO_MAX_HDR_LEN_DEFAULT; diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c index 2e449b5..56276ca 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -244,10 +244,10 @@ static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx) if (port_flags & (1 << MC_CMD_VPORT_ALLOC_IN_FLAG_VLAN_RESTRICT_LBN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &efx->fixed_features); + efx->fixed_features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &efx->fixed_features); + efx->fixed_features);
return 0;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 71b5748..e871118 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1044,31 +1044,31 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) /* Determine netdevice features */ netdev_feature_set_bits(efx->type->offload_features | NETIF_F_SG | NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL, - &net_dev->features); + net_dev->features);
if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &net_dev->features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, net_dev->features); /* Check whether device supports TSO */ if (!efx->type->tso_versions || !efx->type->tso_versions(efx)) - netdev_feature_clear_bits(NETIF_F_ALL_TSO, &net_dev->features); + netdev_feature_clear_bits(NETIF_F_ALL_TSO, net_dev->features); /* Mask for features that also apply to VLAN devices */ netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_ALL_TSO | - NETIF_F_RXCSUM, &net_dev->vlan_features); + NETIF_F_RXCSUM, net_dev->vlan_features);
- netdev_feature_andnot(&tmp, net_dev->features, efx->fixed_features); - netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, tmp); + netdev_feature_andnot(tmp, net_dev->features, efx->fixed_features); + netdev_feature_or(net_dev->hw_features, net_dev->hw_features, tmp);
/* Disable receiving frames with bad FCS, by default. */ - netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &net_dev->features); + netdev_feature_clear_bit(NETIF_F_RXALL_BIT, net_dev->features);
/* 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). */ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->features); - netdev_feature_or(&net_dev->features, net_dev->features, + net_dev->features); + netdev_feature_or(net_dev->features, net_dev->features, efx->fixed_features);
rc = efx_register_netdev(efx); @@ -1102,7 +1102,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct efx_nic_type *) entry->driver_data; - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev); diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c index 8eac246..ee9af0b 100644 --- a/drivers/net/ethernet/sfc/efx_common.c +++ b/drivers/net/ethernet/sfc/efx_common.c @@ -225,7 +225,7 @@ int efx_set_features(struct net_device *net_dev, netdev_features_t data) /* If Rx VLAN filter is changed, update filters via mac_reconfigure. * If rx-fcs is changed, mac_reconfigure updates that too. */ - netdev_feature_xor(&changed, net_dev->features, data); + netdev_feature_xor(changed, net_dev->features, data); if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS, changed)) { /* efx_set_rx_mode() will schedule MAC work to update filters @@ -412,12 +412,12 @@ static void efx_start_datapath(struct efx_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */ - netdev_feature_copy(&old_features, efx->net_dev->features); - netdev_feature_or(&efx->net_dev->hw_features, + netdev_feature_copy(old_features, efx->net_dev->features); + netdev_feature_or(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->net_dev->features); - netdev_feature_andnot(&efx->net_dev->hw_features, + netdev_feature_andnot(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->fixed_features); - netdev_feature_or(&efx->net_dev->features, efx->net_dev->features, + netdev_feature_or(efx->net_dev->features, efx->net_dev->features, efx->fixed_features); if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev); @@ -1361,12 +1361,12 @@ static bool efx_can_encap_offloads(struct efx_nic *efx, struct sk_buff *skb) }
void efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct efx_nic *efx = netdev_priv(dev);
if (skb->encapsulation) { - if (netdev_feature_test_bits(NETIF_F_GSO_MASK, *features)) + if (netdev_feature_test_bits(NETIF_F_GSO_MASK, features)) /* Hardware can only do TSO with at most 208 bytes * of headers. */ @@ -1375,7 +1375,7 @@ void efx_features_check(struct sk_buff *skb, struct net_device *dev, netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); if (netdev_feature_test_bits(NETIF_F_GSO_MASK | - NETIF_F_CSUM_MASK, *features)) + NETIF_F_CSUM_MASK, features)) if (!efx_can_encap_offloads(efx, skb)) netdev_feature_clear_bits(NETIF_F_GSO_MASK | NETIF_F_CSUM_MASK, diff --git a/drivers/net/ethernet/sfc/efx_common.h b/drivers/net/ethernet/sfc/efx_common.h index c4fea39..83d632b 100644 --- a/drivers/net/ethernet/sfc/efx_common.h +++ b/drivers/net/ethernet/sfc/efx_common.h @@ -106,7 +106,7 @@ int efx_change_mtu(struct net_device *net_dev, int new_mtu); extern const struct pci_error_handlers efx_err_handlers;
void efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features); + 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/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index c097a25..37fa253 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c @@ -640,12 +640,12 @@ static void ef4_start_datapath(struct ef4_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */ - netdev_feature_copy(&old_features, efx->net_dev->features); - netdev_feature_or(&efx->net_dev->hw_features, + netdev_feature_copy(old_features, efx->net_dev->features); + netdev_feature_or(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->net_dev->features); - netdev_feature_andnot(&efx->net_dev->hw_features, + netdev_feature_andnot(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->fixed_features); - netdev_feature_or(&efx->net_dev->features, efx->net_dev->features, + netdev_feature_or(efx->net_dev->features, efx->net_dev->features, efx->net_dev->features); if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev); @@ -2208,7 +2208,7 @@ static int ef4_set_features(struct net_device *net_dev, netdev_features_t data) }
/* If Rx VLAN filter is changed, update filters via mac_reconfigure */ - netdev_feature_xor(&changed, net_dev->features, data); + netdev_feature_xor(changed, net_dev->features, data); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { /* ef4_set_rx_mode() will schedule MAC work to update filters @@ -2933,7 +2933,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct ef4_nic_type *) entry->driver_data; - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev); @@ -2955,26 +2955,24 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, if (rc) goto fail3;
- netdev_feature_set_bits(efx->type->offload_features, - &net_dev->features); - netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM, - &net_dev->features); + netdev_feature_set_bits(efx->type->offload_features, net_dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM, net_dev->features); /* Mask for features that also apply to VLAN devices */ netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_RXCSUM, - &net_dev->vlan_features); + net_dev->vlan_features);
- netdev_feature_copy(&net_dev->hw_features, net_dev->features); + netdev_feature_copy(net_dev->hw_features, net_dev->features); netdev_feature_clear_bits(efx->type->offload_features, - &net_dev->hw_features); + net_dev->hw_features);
/* 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). */ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->features); - netdev_feature_or(&net_dev->features, net_dev->features, + net_dev->features); + netdev_feature_or(net_dev->features, net_dev->features, efx->fixed_features);
rc = ef4_register_netdev(efx); diff --git a/drivers/net/ethernet/sfc/falcon/net_driver.h b/drivers/net/ethernet/sfc/falcon/net_driver.h index ec50ae2..64edf15 100644 --- a/drivers/net/ethernet/sfc/falcon/net_driver.h +++ b/drivers/net/ethernet/sfc/falcon/net_driver.h @@ -1299,7 +1299,7 @@ static inline struct ef4_rx_buffer *ef4_rx_buffer(struct ef4_rx_queue *rx_queue, * always in features. */ static inline void ef4_supported_features(const struct ef4_nic *efx, - netdev_features_t *supported) + netdev_features_t supported) { const struct net_device *net_dev = efx->net_dev;
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c index c199509..6e8257a 100644 --- a/drivers/net/ethernet/sfc/mcdi_filters.c +++ b/drivers/net/ethernet/sfc/mcdi_filters.c @@ -1321,7 +1321,7 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) if (rc) goto fail;
- efx_supported_features(efx, &supported); + efx_supported_features(efx, supported); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, supported) && !(efx_mcdi_filter_match_supported(table, false, @@ -1331,11 +1331,11 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) netif_info(efx, probe, net_dev, "VLAN filters are not supported in this firmware variant\n"); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->features); + net_dev->features); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &efx->fixed_features); + efx->fixed_features); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->hw_features); + net_dev->hw_features); }
table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS, diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 70e41d2..b7c36ea 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1674,7 +1674,7 @@ efx_channel_tx_old_fill_level(struct efx_channel *channel) * always in features. */ static inline void efx_supported_features(const struct efx_nic *efx, - netdev_features_t *supported) + netdev_features_t supported) { const struct net_device *net_dev = efx->net_dev;
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c index ee72fc5..8c8e17b 100644 --- a/drivers/net/ethernet/sgi/ioc3-eth.c +++ b/drivers/net/ethernet/sgi/ioc3-eth.c @@ -927,12 +927,12 @@ static int ioc3eth_probe(struct platform_device *pdev) dev->watchdog_timeo = 5 * HZ; dev->netdev_ops = &ioc3_netdev_ops; dev->ethtool_ops = &ioc3_ethtool_ops; - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); - netdev_feature_zero(&dev->features); + dev->hw_features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_HIGHDMA, - &dev->features); + dev->features);
sw_physid1 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID1); sw_physid2 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID2); diff --git a/drivers/net/ethernet/silan/sc92031.c b/drivers/net/ethernet/silan/sc92031.c index ad8aa98..758d7f2 100644 --- a/drivers/net/ethernet/silan/sc92031.c +++ b/drivers/net/ethernet/silan/sc92031.c @@ -1436,10 +1436,10 @@ static int sc92031_probe(struct pci_dev *pdev, const struct pci_device_id *id) SET_NETDEV_DEV(dev, &pdev->dev);
/* faked with skb_copy_and_csum_dev */ - netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->features); + dev->features);
dev->netdev_ops = &sc92031_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 2859f4c..da988e5 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -2104,8 +2104,8 @@ static int netsec_probe(struct platform_device *pdev)
netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_RXCSUM | NETIF_F_GSO | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &ndev->features); - netdev_feature_copy(&ndev->hw_features, ndev->features); + ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features);
priv->rx_cksum_offload_flag = true;
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c index efdcb7f..34a4776 100644 --- a/drivers/net/ethernet/socionext/sni_ave.c +++ b/drivers/net/ethernet/socionext/sni_ave.c @@ -1595,9 +1595,9 @@ static int ave_probe(struct platform_device *pdev) SET_NETDEV_DEV(ndev, dev);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &ndev->features); + ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &ndev->hw_features); + ndev->hw_features);
ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f94950f..af6f22a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5453,7 +5453,7 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) }
static void stmmac_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct stmmac_priv *priv = netdev_priv(dev);
@@ -5473,7 +5473,7 @@ static void stmmac_fix_features(struct net_device *dev,
/* Disable tso if asked by ethtool */ if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { - if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, features)) priv->tso = true; else priv->tso = false; @@ -6858,28 +6858,28 @@ int stmmac_dvr_probe(struct device *device,
ndev->netdev_ops = &stmmac_netdev_ops;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM, - &ndev->hw_features); + ndev->hw_features);
ret = stmmac_tc_init(priv, priv); if (!ret) { - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, ndev->hw_features); }
if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &ndev->hw_features); + ndev->hw_features); if (priv->plat->has_gmac4) netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &ndev->hw_features); + ndev->hw_features); priv->tso = true; dev_info(priv->device, "TSO feature enabled\n"); }
if (priv->dma_cap.sphen) { - netdev_feature_set_bit(NETIF_F_GRO_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, ndev->hw_features); priv->sph_cap = true; priv->sph = priv->sph_cap; dev_info(priv->device, "SPH feature enabled\n"); @@ -6917,27 +6917,27 @@ int stmmac_dvr_probe(struct device *device, } }
- netdev_feature_or(&ndev->features, ndev->features, + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); ndev->watchdog_timeo = msecs_to_jiffies(watchdog); #ifdef STMMAC_VLAN_TAG_USED /* Both mac100 and gmac support receive VLAN tag detection */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX, - &ndev->features); + ndev->features); if (priv->dma_cap.vlhash) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &ndev->features); + ndev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, - &ndev->features); + ndev->features); } if (priv->dma_cap.vlins) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &ndev->features); + ndev->features); if (priv->dma_cap.dvlan) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &ndev->features); + ndev->features); } #endif priv->msg_enable = netif_msg_init(debug, default_msg_level); @@ -6949,7 +6949,7 @@ int stmmac_dvr_probe(struct device *device, priv->rss.table[i] = ethtool_rxfh_indir_default(i, rxq);
if (priv->dma_cap.rssen && priv->plat->rss_en) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->features);
/* MTU range: 46 - hw-specific max */ ndev->min_mtu = ETH_ZLEN - ETH_HLEN; diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index 785e11f..6d5bc5b 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c @@ -5085,10 +5085,10 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* Cassini features. */ if ((cp->cas_flags & CAS_FLAG_NO_HW_CSUM) == 0) netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->features); + dev->features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
/* MTU range: 60 - varies or 9000 */ dev->min_mtu = CAS_MIN_MTU; diff --git a/drivers/net/ethernet/sun/ldmvsw.c b/drivers/net/ethernet/sun/ldmvsw.c index 7c32d54..5ef0922 100644 --- a/drivers/net/ethernet/sun/ldmvsw.c +++ b/drivers/net/ethernet/sun/ldmvsw.c @@ -249,9 +249,9 @@ static struct net_device *vsw_alloc_netdev(u8 hwaddr[], dev->ethtool_ops = &vsw_ethtool_ops; dev->watchdog_timeo = VSW_TX_TIMEOUT;
- netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, &dev->features); - netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, dev->features); + netdev_feature_copy(dev->features, dev->hw_features);
/* MTU range: 68 - 65535 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 97f62ec..5c598d1 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -9711,11 +9711,11 @@ static void niu_device_announce(struct niu *np)
static void niu_set_basic_features(struct net_device *dev) { - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXHASH, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); }
static int niu_pci_init_one(struct pci_dev *pdev, @@ -9783,7 +9783,7 @@ static int niu_pci_init_one(struct pci_dev *pdev, dma_mask = DMA_BIT_MASK(44); err = pci_set_dma_mask(pdev, dma_mask); if (!err) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); err = pci_set_consistent_dma_mask(pdev, dma_mask); if (err) { dev_err(&pdev->dev, "Unable to obtain 44 bit DMA for consistent allocations, aborting\n"); diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 79b2435..859ec88 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c @@ -2988,12 +2988,12 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, dev);
/* We can do scatter/gather and HW checksum */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
/* MTU range: 68 - 1500 (Jumbo mode is broken) */ dev->min_mtu = GEM_MIN_MTU; diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 22de1ad..daa55d1 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -2825,11 +2825,11 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe) dev->ethtool_ops = &hme_ethtool_ops;
/* Happy Meal can do it all... */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features);
hp->irq = op->archdata.irqs[0];
@@ -3143,11 +3143,11 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, dev->ethtool_ops = &hme_ethtool_ops;
/* Happy Meal can do it all... */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features);
#if defined(CONFIG_SBUS) && defined(CONFIG_PCI) /* Hook up PCI register/descriptor accessors. */ diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 1c5c858..334d501 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c @@ -312,11 +312,11 @@ static struct vnet *vnet_new(const u64 *local_mac, dev->ethtool_ops = &vnet_ethtool_ops; dev->watchdog_timeo = VNET_TX_TIMEOUT;
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_GSO | NETIF_F_ALL_TSO | NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features);
/* MTU range: 68 - 65535 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c index 534c10e..d637d1c 100644 --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c @@ -1275,8 +1275,8 @@ vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb, skb_shinfo(skb)->gso_size = datalen; skb_shinfo(skb)->gso_segs = gso_segs; } - netdev_feature_copy(&tmp, dev->features); - netdev_feature_clear_bit(NETIF_F_TSO_BIT, &tmp); + netdev_feature_copy(tmp, dev->features); + netdev_feature_clear_bit(NETIF_F_TSO_BIT, tmp); segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs)) goto out_dropped; diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c index 4e61f92c..9594094 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c @@ -179,47 +179,47 @@ static int xlgmac_init(struct xlgmac_pdata *pdata)
/* Set device features */ if (pdata->hw_feat.tso) { - netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); } else if (pdata->hw_feat.tx_coe) { - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (pdata->hw_feat.rx_coe) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->hw_features); }
if (pdata->hw_feat.rss) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); if (pdata->hw_feat.sa_vlan_ins) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); if (pdata->hw_feat.vlhash) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_copy(&pdata->netdev_features, netdev->features); + netdev_feature_copy(pdata->netdev_features, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c index f4dfef74..f5037cc 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c @@ -921,7 +921,7 @@ static int xlgmac_set_features(struct net_device *netdev, features) && rxvlan_filter) hw_ops->disable_rx_vlan_filtering(pdata);
- netdev_feature_copy(&pdata->netdev_features, features); + netdev_feature_copy(pdata->netdev_features, features);
return 0; } diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index d1df19e..0c50aa2 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c @@ -1980,21 +1980,21 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* these fields are used for info purposes only * so we can have them same for all ports of the board */ ndev->if_port = port; - netdev_feature_zero(&ndev->features); + netdev_feature_zero(ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM, - &ndev->features); - netdev_feature_zero(&ndev->hw_features); + ndev->features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX, - &ndev->features); + ndev->features);
if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &ndev->features); + ndev->features);
/************** priv ****************/ priv = nic->priv[port] = netdev_priv(ndev); @@ -2031,7 +2031,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * set multicast list callback has to use priv->tx_lock. */ #ifdef BDX_LLTX - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, ndev->features); #endif /* MTU range: 60 - 16384 */ ndev->min_mtu = ETH_ZLEN; diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 2830691..6e0beff 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1975,23 +1975,23 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
port->ndev->min_mtu = AM65_CPSW_MIN_PACKET_SIZE; port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE; - netdev_feature_zero(&port->ndev->hw_features); + netdev_feature_zero(port->ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_HW_TC, - &port->ndev->hw_features); - netdev_feature_copy(&port->ndev->features, port->ndev->hw_features); + port->ndev->hw_features); + netdev_feature_copy(port->ndev->features, port->ndev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &port->ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &port->ndev->vlan_features); + port->ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, port->ndev->vlan_features); port->ndev->netdev_ops = &am65_cpsw_nuss_netdev_ops; port->ndev->ethtool_ops = &am65_cpsw_ethtool_ops_slave;
/* Disable TX checksum offload by default due to HW bug */ if (common->pdata.quirks & AM65_CPSW_QUIRK_I2027_NO_TX_CSUM) netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, - &port->ndev->features); + port->ndev->features);
ndev_priv->stats = netdev_alloc_pcpu_stats(struct am65_cpsw_ndev_stats); if (!ndev_priv->stats) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index c11f2b0..5093572 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1465,7 +1465,7 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv) priv_sl2->emac_port = 1; cpsw->slaves[1].ndev = ndev; netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; @@ -1645,7 +1645,7 @@ static int cpsw_probe(struct platform_device *pdev) cpsw->slaves[0].ndev = ndev;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index 95af37d..513a025e 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -1408,7 +1408,7 @@ static int cpsw_create_ports(struct cpsw_common *cpsw) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_NETNS_LOCAL, - &ndev->features); + ndev->features); ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; SET_NETDEV_DEV(ndev, dev); diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index a0129d4..a6c4dbb 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -1976,11 +1976,11 @@ static int netcp_create_interface(struct netcp_device *netcp_device, return -ENOMEM; }
- netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &ndev->features); - netdev_feature_copy(&ndev->hw_features, ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->vlan_features); + ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->vlan_features);
/* MTU range: 68 - 9486 */ ndev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index f502108..4637329 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -1461,14 +1461,14 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) int status; u64 v1, v2;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_zero(&netdev->features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->features); + netdev_feature_zero(netdev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, netdev->features); if (GELIC_CARD_RX_CSUM_DEFAULT) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features);
status = lv1_net_control(bus_id(card), dev_id(card), GELIC_LV1_GET_MAC_ADDRESS, @@ -1489,7 +1489,7 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) * we can not receive vlan packets */ netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, - &netdev->features); + netdev->features); }
/* MTU range: 64 - 1518 */ diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index bbbdbe6d..7b2f67a 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c @@ -2271,13 +2271,13 @@ spider_net_setup_netdev(struct spider_net_card *card)
spider_net_setup_netdev_ops(netdev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &netdev->hw_features); + netdev->hw_features); if (SPIDER_NET_RX_CSUM_DEFAULT) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_LLTX, - &netdev->features); + netdev->features);
/* some time: NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | * NETIF_F_HW_VLAN_CTAG_FILTER diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c index 3ab07ea..e2ae886 100644 --- a/drivers/net/ethernet/tundra/tsi108_eth.c +++ b/drivers/net/ethernet/tundra/tsi108_eth.c @@ -1609,8 +1609,8 @@ tsi108_init_one(struct platform_device *pdev) * a new function skb_csum_dev() in net/core/skbuff.c). */
- netdev_feature_zero(&dev->features); - netdev_feature_set_bits(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bits(NETIF_F_HIGHDMA_BIT, dev->features);
spin_lock_init(&data->txlock); spin_lock_init(&data->misclock); diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 952ce5e..429ccb4 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c @@ -967,13 +967,13 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks,
if (rp->quirks & rqRhineI) netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &dev->features); + dev->features);
if (rp->quirks & rqMgmt) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features);
/* dev->name not defined before register_netdev()! */ rc = register_netdev(dev); diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index f8b4af1..c41e48e 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -2847,15 +2847,15 @@ static int velocity_probe(struct device *dev, int irq, netif_napi_add(netdev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_IP_CSUM, - &netdev->features); + netdev->features);
/* MTU range: 64 - 9000 */ netdev->min_mtu = VELOCITY_MIN_MTU; diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c index 54adf51..3e82f74 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c @@ -1134,7 +1134,7 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops, /* This chip doesn't support VLAN packets with normal MTU, * so disable VLAN for this device. */ - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, ndev->features);
err = register_netdev(ndev); if (err < 0) diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c index fe2b05e..54e92fe 100644 --- a/drivers/net/ethernet/wiznet/w5300.c +++ b/drivers/net/ethernet/wiznet/w5300.c @@ -608,7 +608,7 @@ static int w5300_probe(struct platform_device *pdev) /* This chip doesn't support VLAN packets with normal MTU, * so disable VLAN for this device. */ - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, ndev->features);
err = register_netdev(ndev); if (err < 0) diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 74224e1..d00d619 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c @@ -1382,8 +1382,8 @@ static int temac_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ndev); SET_NETDEV_DEV(ndev, &pdev->dev); - netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); ndev->netdev_ops = &temac_netdev_ops; ndev->ethtool_ops = &temac_ethtool_ops; #if 0 @@ -1467,7 +1467,7 @@ static int temac_probe(struct platform_device *pdev) } if (lp->temac_features & TEMAC_FEATURE_TX_CSUM) /* Can checksum TCP/UDP over IPv4. */ - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, ndev->features);
/* Defaults for IRQ delay/coalescing setup. These are * configuration values, so does not belong in device-tree. diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 54aaaa4..f4370343 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -1849,8 +1849,8 @@ static int axienet_probe(struct platform_device *pdev)
SET_NETDEV_DEV(ndev, &pdev->dev); ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ - netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); ndev->netdev_ops = &axienet_netdev_ops; ndev->ethtool_ops = &axienet_ethtool_ops;
@@ -1914,7 +1914,7 @@ static int axienet_probe(struct platform_device *pdev) lp->features |= XAE_FEATURE_PARTIAL_TX_CSUM; /* Can checksum TCP/UDP over IPv4. */ netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &ndev->features); + ndev->features); break; case 2: lp->csum_offload_on_tx_path = @@ -1922,7 +1922,7 @@ static int axienet_probe(struct platform_device *pdev) lp->features |= XAE_FEATURE_FULL_TX_CSUM; /* Can checksum TCP/UDP over IPv4. */ netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &ndev->features); + ndev->features); break; default: lp->csum_offload_on_tx_path = XAE_NO_CSUM_OFFLOAD; diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 583d21a..a621ad6 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1345,7 +1345,7 @@ static void fjes_netdev_setup(struct net_device *netdev) netdev->min_mtu = fjes_support_mtu[0]; netdev->max_mtu = fjes_support_mtu[3]; netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features); }
static void fjes_irq_watch_task(struct work_struct *work) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index d2179c1..c09d445 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1219,16 +1219,16 @@ static void geneve_setup(struct net_device *dev)
SET_NETDEV_DEVTYPE(dev, &geneve_type);
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features);
/* MTU range: 68 - (something less than 65535) */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index ddc55d3..f456cc2 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -639,7 +639,7 @@ static void gtp_link_setup(struct net_device *dev) dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->priv_flags |= IFF_NO_QUEUE; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
dev->needed_headroom = LL_MAX_HEADER + max_gtp_header_len; diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 84b3bce..572532e 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1207,8 +1207,8 @@ static void netvsc_init_settings(struct net_device *dev) ndc->speed = SPEED_UNKNOWN; ndc->duplex = DUPLEX_FULL;
- netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->features); }
static int netvsc_get_link_ksettings(struct net_device *dev, @@ -1923,7 +1923,7 @@ static int netvsc_set_ringparam(struct net_device *ndev, }
static void netvsc_fix_features(struct net_device *ndev, - netdev_features_t *features) + netdev_features_t features) { struct net_device_context *ndevctx = netdev_priv(ndev); struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); @@ -1931,7 +1931,7 @@ static void netvsc_fix_features(struct net_device *ndev, if (!nvdev || nvdev->destroy) return;
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && netvsc_xdp_get(nvdev)) { netdev_feature_change_bit(NETIF_F_LRO_BIT, features); netdev_info(ndev, "Skip LRO - unsupported with XDP\n"); @@ -1951,7 +1951,7 @@ static int netvsc_set_features(struct net_device *ndev, if (!nvdev || nvdev->destroy) return -ENODEV;
- netdev_feature_xor(&change, features, ndev->features); + netdev_feature_xor(change, features, ndev->features);
if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, change)) goto syncvf; @@ -1969,15 +1969,15 @@ static int netvsc_set_features(struct net_device *ndev, ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads);
if (ret) { - netdev_feature_change_bit(NETIF_F_LRO_BIT, &features); - netdev_feature_copy(&ndev->features, features); + netdev_feature_change_bit(NETIF_F_LRO_BIT, features); + netdev_feature_copy(ndev->features, features); }
syncvf: if (!vf_netdev) return ret;
- netdev_feature_copy(&vf_netdev->wanted_features, features); + netdev_feature_copy(vf_netdev->wanted_features, features); netdev_update_features(vf_netdev);
return ret; @@ -2391,7 +2391,7 @@ static int netvsc_register_vf(struct net_device *vf_netdev) if (ndev->needed_headroom < vf_netdev->needed_headroom) ndev->needed_headroom = vf_netdev->needed_headroom;
- netdev_feature_copy(&vf_netdev->wanted_features, ndev->features); + netdev_feature_copy(vf_netdev->wanted_features, ndev->features); netdev_update_features(vf_netdev);
prog = netvsc_xdp_get(netvsc_dev); @@ -2556,10 +2556,10 @@ static int netvsc_probe(struct hv_device *dev, schedule_work(&nvdev->subchan_work);
/* hw_features computed in rndis_netdev_set_hwcaps() */ - netdev_feature_copy(&net->features, net->hw_features); + netdev_feature_copy(net->features, net->hw_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &net->features); - netdev_feature_copy(&net->vlan_features, net->features); + NETIF_F_HW_VLAN_CTAG_RX, net->features); + netdev_feature_copy(net->vlan_features, net->features);
netdev_lockdep_set_classes(net);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index f0206cd..21d1b4c 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1364,17 +1364,17 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device,
/* Reset previously set hw_features flags */ netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, - &net->hw_features); + net->hw_features); net_device_ctx->tx_checksum_mask = 0;
/* Compute tx offload settings based on hw capabilities */ - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &net->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &net->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, net->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, net->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, net->hw_features);
if ((hwcaps.csum.ip4_txcsum & NDIS_TXCSUM_ALL_TCP4) == NDIS_TXCSUM_ALL_TCP4) { /* Can checksum TCP */ - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, net->hw_features); net_device_ctx->tx_checksum_mask |= TRANSPORT_INFO_IPV4_TCP;
offloads.tcp_ip_v4_csum = NDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; @@ -1382,7 +1382,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, if (hwcaps.lsov2.ip4_encap & NDIS_OFFLOAD_ENCAP_8023) { offloads.lso_v2_ipv4 = NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; netdev_feature_set_bit(NETIF_F_TSO_BIT, - &net->hw_features); + net->hw_features);
if (hwcaps.lsov2.ip4_maxsz < gso_max_size) gso_max_size = hwcaps.lsov2.ip4_maxsz; @@ -1396,7 +1396,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device,
if ((hwcaps.csum.ip6_txcsum & NDIS_TXCSUM_ALL_TCP6) == NDIS_TXCSUM_ALL_TCP6) { netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &net->hw_features); + net->hw_features);
offloads.tcp_ip_v6_csum = NDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; net_device_ctx->tx_checksum_mask |= TRANSPORT_INFO_IPV6_TCP; @@ -1405,7 +1405,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, (hwcaps.lsov2.ip6_opts & NDIS_LSOV2_CAP_IP6) == NDIS_LSOV2_CAP_IP6) { offloads.lso_v2_ipv6 = NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &net->hw_features); + net->hw_features);
if (hwcaps.lsov2.ip6_maxsz < gso_max_size) gso_max_size = hwcaps.lsov2.ip6_maxsz; @@ -1418,7 +1418,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, }
if (hwcaps.rsc.ip4 && hwcaps.rsc.ip6) { - netdev_feature_set_bit(NETIF_F_LRO_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, net->hw_features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, net->features)) { offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED; @@ -1432,10 +1432,10 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, /* In case some hw_features disappeared we need to remove them from * net->features list as they're no longer supported. */ - netdev_feature_fill(&tmp); - netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, &tmp); - netdev_feature_or(&tmp, tmp, net->hw_features); - netdev_feature_and(&net->features, net->features, tmp); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, tmp); + netdev_feature_or(tmp, tmp, net->hw_features); + netdev_feature_and(net->features, net->features, tmp);
netif_set_gso_max_size(net, gso_max_size);
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 91add5a..2ba5bae 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -213,13 +213,13 @@ static void ifb_setup(struct net_device *dev) ether_setup(dev); dev->tx_queue_len = TX_Q_LIMIT;
- netdev_feature_set_bits(IFB_FEATURES, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + netdev_feature_set_bits(IFB_FEATURES, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); netdev_feature_set_bits(IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX), - &dev->features); + dev->features);
dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index f0ce8d6..3b75d861 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -165,8 +165,8 @@ static void ipa_modem_netdev_setup(struct net_device *netdev) netdev->needed_headroom = sizeof(struct rmnet_map_header); netdev->needed_tailroom = IPA_NETDEV_TAILROOM; netdev->watchdog_timeo = IPA_NETDEV_TIMEOUT * HZ; - netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); }
/** ipa_modem_suspend() - suspend callback diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index e77e4dc..144f21f 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -135,13 +135,13 @@ static int ipvlan_init(struct net_device *dev)
dev->state = (dev->state & ~IPVLAN_STATE_MASK) | (phy_dev->state & IPVLAN_STATE_MASK); - netdev_feature_copy(&dev->features, phy_dev->features); - netdev_feature_and_bits(IPVLAN_FEATURES, &dev->features); - netdev_feature_set_bits(IPVLAN_ALWAYS_ON, &dev->features); - netdev_feature_copy(&dev->vlan_features, phy_dev->vlan_features); - netdev_feature_and_bits(IPVLAN_FEATURES, &dev->vlan_features); - netdev_feature_set_bits(IPVLAN_ALWAYS_ON_OFLOADS, &dev->vlan_features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + netdev_feature_copy(dev->features, phy_dev->features); + netdev_feature_and_bits(IPVLAN_FEATURES, dev->features); + netdev_feature_set_bits(IPVLAN_ALWAYS_ON, dev->features); + netdev_feature_copy(dev->vlan_features, phy_dev->vlan_features); + netdev_feature_and_bits(IPVLAN_FEATURES, dev->vlan_features); + netdev_feature_set_bits(IPVLAN_ALWAYS_ON_OFLOADS, dev->vlan_features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); dev->gso_max_size = phy_dev->gso_max_size; dev->gso_max_segs = phy_dev->gso_max_segs; @@ -239,18 +239,18 @@ static netdev_tx_t ipvlan_start_xmit(struct sk_buff *skb, }
static void ipvlan_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct ipvl_dev *ipvlan = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); - netdev_feature_fill(&tmp); - netdev_feature_clear_bits(IPVLAN_FEATURES, &tmp); - netdev_feature_or(&tmp, tmp, ipvlan->sfeatures); - netdev_feature_and(features, *features, tmp); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(IPVLAN_FEATURES, tmp); + netdev_feature_or(tmp, tmp, ipvlan->sfeatures); + netdev_feature_and(features, features, tmp); netdev_increment_features(features, ipvlan->phy_dev->features, - *features, *features); + features, features); netdev_feature_set_bits(IPVLAN_ALWAYS_ON, features); netdev_feature_and_bits(IPVLAN_FEATURES | IPVLAN_ALWAYS_ON, features); } @@ -574,8 +574,8 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
ipvlan->phy_dev = phy_dev; ipvlan->dev = dev; - netdev_feature_zero(&ipvlan->sfeatures); - netdev_feature_set_bits(IPVLAN_FEATURES, &ipvlan->sfeatures); + netdev_feature_zero(ipvlan->sfeatures); + netdev_feature_set_bits(IPVLAN_FEATURES, ipvlan->sfeatures); if (!tb[IFLA_MTU]) ipvlan_adjust_mtu(ipvlan, phy_dev); INIT_LIST_HEAD(&ipvlan->addrs); diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c index e7fb343..4c07ec5 100644 --- a/drivers/net/ipvlan/ipvtap.c +++ b/drivers/net/ipvlan/ipvtap.c @@ -70,7 +70,7 @@ static void ipvtap_update_features(struct tap_dev *tap, struct ipvtap_dev *vlantap = container_of(tap, struct ipvtap_dev, tap); struct ipvl_dev *vlan = &vlantap->vlan;
- netdev_feature_copy(&vlan->sfeatures, features); + netdev_feature_copy(vlan->sfeatures, features); netdev_update_features(vlan->dev); }
@@ -86,7 +86,7 @@ static int ipvtap_newlink(struct net *src_net, struct net_device *dev, /* Since macvlan supports all offloads by default, make * tap support all offloads also. */ - netdev_feature_set_bits(TUN_OFFLOADS, &vlantap->tap.tap_features); + netdev_feature_set_bits(TUN_OFFLOADS, vlantap->tap.tap_features); vlantap->tap.count_tx_dropped = ipvtap_count_tx_dropped; vlantap->tap.update_features = ipvtap_update_features; vlantap->tap.count_rx_dropped = ipvtap_count_rx_dropped; diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 23cad64..a84b49c 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -174,15 +174,15 @@ static void gen_lo_setup(struct net_device *dev, dev->flags = IFF_LOOPBACK; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; netif_keep_dst(dev); - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); - netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SCTP_CRC | NETIF_F_HIGHDMA | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL | NETIF_F_VLAN_CHALLENGED | - NETIF_F_LOOPBACK, &dev->hw_features); + NETIF_F_LOOPBACK, dev->hw_features); dev->ethtool_ops = eth_ops; dev->header_ops = hdr_ops; dev->netdev_ops = dev_ops; diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 8693dec..e761ebb 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3441,15 +3441,15 @@ static int macsec_dev_init(struct net_device *dev) * VLAN_FEATURES - they require additional ops * HW_MACSEC - no reason to report it */ - netdev_feature_copy(&dev->features, real_dev->features); + netdev_feature_copy(dev->features, real_dev->features); netdev_feature_clear_bits(NETIF_F_VLAN_FEATURES | NETIF_F_HW_MACSEC, - &dev->features); + dev->features); } else { - netdev_feature_copy(&dev->features, real_dev->features); - netdev_feature_and_bits(SW_MACSEC_FEATURES, &dev->features); + netdev_feature_copy(dev->features, real_dev->features); + netdev_feature_and_bits(SW_MACSEC_FEATURES, dev->features); netdev_feature_set_bits(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); }
dev->needed_headroom = real_dev->needed_headroom + @@ -3474,7 +3474,7 @@ static void macsec_dev_uninit(struct net_device *dev) }
static void macsec_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct macsec_dev *macsec = macsec_priv(dev); struct net_device *real_dev = macsec->real_dev; @@ -3487,11 +3487,11 @@ static void macsec_fix_features(struct net_device *dev, return; }
- netdev_feature_copy(&tmp, real_dev->features); - netdev_feature_and_bits(SW_MACSEC_FEATURES, &tmp); + netdev_feature_copy(tmp, real_dev->features); + netdev_feature_and_bits(SW_MACSEC_FEATURES, tmp); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES, - &tmp); - netdev_feature_and(features, *features, tmp); + tmp); + netdev_feature_and(features, features, tmp); netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index d373b45..8502fd55 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -894,14 +894,14 @@ static int macvlan_init(struct net_device *dev)
dev->state = (dev->state & ~MACVLAN_STATE_MASK) | (lowerdev->state & MACVLAN_STATE_MASK); - netdev_feature_copy(&dev->features, lowerdev->features); - netdev_feature_and_bits(MACVLAN_FEATURES, &dev->features); - netdev_feature_set_bits(ALWAYS_ON_FEATURES, &dev->features); - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); - netdev_feature_copy(&dev->vlan_features, lowerdev->vlan_features); - netdev_feature_and_bits(MACVLAN_FEATURES, &dev->vlan_features); - netdev_feature_set_bits(ALWAYS_ON_OFFLOADS, &dev->vlan_features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + netdev_feature_copy(dev->features, lowerdev->features); + netdev_feature_and_bits(MACVLAN_FEATURES, dev->features); + netdev_feature_set_bits(ALWAYS_ON_FEATURES, dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->hw_features); + netdev_feature_copy(dev->vlan_features, lowerdev->vlan_features); + netdev_feature_and_bits(MACVLAN_FEATURES, dev->vlan_features); + netdev_feature_set_bits(ALWAYS_ON_OFFLOADS, dev->vlan_features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); dev->gso_max_size = lowerdev->gso_max_size; dev->gso_max_segs = lowerdev->gso_max_segs; @@ -1072,26 +1072,26 @@ static int macvlan_ethtool_get_ts_info(struct net_device *dev, }
static void macvlan_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(lowerdev_features); struct macvlan_dev *vlan = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(mask); __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_copy(&lowerdev_features, vlan->lowerdev->features); + netdev_feature_copy(lowerdev_features, vlan->lowerdev->features); netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); - netdev_feature_fill(&tmp); - netdev_feature_clear_bits(MACVLAN_FEATURES, &tmp); - netdev_feature_or(&tmp, tmp, vlan->set_features); - netdev_feature_and(features, *features, tmp); - netdev_feature_copy(&mask, *features); - - netdev_feature_fill(&tmp); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &tmp); - netdev_feature_or(&tmp, tmp, *features); - netdev_feature_and(&lowerdev_features, lowerdev_features, tmp); - netdev_increment_features(features, lowerdev_features, *features, mask); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(MACVLAN_FEATURES, tmp); + netdev_feature_or(tmp, tmp, vlan->set_features); + netdev_feature_and(features, features, tmp); + netdev_feature_copy(mask, features); + + netdev_feature_fill(tmp); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, tmp); + netdev_feature_or(tmp, tmp, features); + netdev_feature_and(lowerdev_features, lowerdev_features, tmp); + netdev_increment_features(features, lowerdev_features, features, mask); netdev_feature_set_bits(ALWAYS_ON_FEATURES, features); netdev_feature_and_bits(ALWAYS_ON_FEATURES | MACVLAN_FEATURES, features); @@ -1471,8 +1471,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, vlan->lowerdev = lowerdev; vlan->dev = dev; vlan->port = port; - netdev_feature_zero(&vlan->set_features); - netdev_feature_set_bits(MACVLAN_FEATURES, &vlan->set_features); + netdev_feature_zero(vlan->set_features); + netdev_feature_set_bits(MACVLAN_FEATURES, vlan->set_features);
vlan->mode = MACVLAN_MODE_VEPA; if (data && data[IFLA_MACVLAN_MODE]) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 2162080..8b605fe 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -74,7 +74,7 @@ static void macvtap_update_features(struct tap_dev *tap, struct macvtap_dev *vlantap = container_of(tap, struct macvtap_dev, tap); struct macvlan_dev *vlan = &vlantap->vlan;
- netdev_feature_copy(&vlan->set_features, features); + netdev_feature_copy(vlan->set_features, features); netdev_update_features(vlan->dev); }
@@ -90,8 +90,8 @@ static int macvtap_newlink(struct net *src_net, struct net_device *dev, /* Since macvlan supports all offloads by default, make * tap support all offloads also. */ - netdev_feature_zero(&vlantap->tap.tap_features); - netdev_feature_set_bits(TUN_OFFLOADS, &vlantap->tap.tap_features); + netdev_feature_zero(vlantap->tap.tap_features); + netdev_feature_set_bits(TUN_OFFLOADS, vlantap->tap.tap_features);
/* Register callbacks for rx/tx drops accounting and updating * net_device features diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 16375fb..09cf246 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -389,21 +389,21 @@ static void net_failover_compute_features(struct net_device *dev) __DECLARE_NETDEV_FEATURE_MASK(vlan_mask); __DECLARE_NETDEV_FEATURE_MASK(enc_mask);
- netdev_feature_zero(&vlan_features); + netdev_feature_zero(vlan_features); netdev_feature_set_bits(FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, - &vlan_features); - netdev_feature_zero(&enc_features); - netdev_feature_set_bits(FAILOVER_ENC_FEATURES, &enc_features); - netdev_feature_zero(&vlan_mask); - netdev_feature_set_bits(FAILOVER_VLAN_FEATURES, &vlan_mask); - netdev_feature_copy(&enc_mask, enc_features); + vlan_features); + netdev_feature_zero(enc_features); + netdev_feature_set_bits(FAILOVER_ENC_FEATURES, enc_features); + netdev_feature_zero(vlan_mask); + netdev_feature_set_bits(FAILOVER_VLAN_FEATURES, vlan_mask); + netdev_feature_copy(enc_mask, enc_features);
primary_dev = rcu_dereference(nfo_info->primary_dev); if (primary_dev) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, primary_dev->vlan_features, vlan_mask); - netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, primary_dev->hw_enc_features, enc_features);
@@ -414,10 +414,10 @@ static void net_failover_compute_features(struct net_device *dev)
standby_dev = rcu_dereference(nfo_info->standby_dev); if (standby_dev) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, standby_dev->vlan_features, vlan_mask); - netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, standby_dev->hw_enc_features, enc_features);
@@ -426,9 +426,9 @@ static void net_failover_compute_features(struct net_device *dev) max_hard_header_len = standby_dev->hard_header_len; }
- netdev_feature_copy(&dev->vlan_features, vlan_features); - netdev_feature_copy(&dev->hw_enc_features, enc_features); - netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->hw_enc_features); + netdev_feature_copy(dev->vlan_features, vlan_features); + netdev_feature_copy(dev->hw_enc_features, enc_features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, dev->hw_enc_features); dev->hard_header_len = max_hard_header_len;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; @@ -743,22 +743,22 @@ struct failover *net_failover_create(struct net_device *standby_dev) IFF_TX_SKB_SHARING);
/* don't acquire failover netdev's netif_tx_lock when transmitting */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &failover_dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, failover_dev->features);
/* Don't allow failover devices to change network namespaces. */ netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &failover_dev->features); + failover_dev->features);
- netdev_feature_zero(&failover_dev->hw_features); + netdev_feature_zero(failover_dev->hw_features); netdev_feature_set_bits(FAILOVER_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &failover_dev->hw_features); + failover_dev->hw_features);
netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, - &failover_dev->hw_features); - netdev_feature_or(&failover_dev->features, failover_dev->features, + failover_dev->hw_features); + netdev_feature_or(failover_dev->features, failover_dev->features, failover_dev->hw_features);
memcpy(failover_dev->dev_addr, standby_dev->dev_addr, diff --git a/drivers/net/netdevsim/ipsec.c b/drivers/net/netdevsim/ipsec.c index 3b77c37..8f30c9d 100644 --- a/drivers/net/netdevsim/ipsec.c +++ b/drivers/net/netdevsim/ipsec.c @@ -280,8 +280,8 @@ void nsim_ipsec_init(struct netdevsim *ns) NETIF_F_HW_ESP_TX_CSUM | \ NETIF_F_GSO_ESP)
- netdev_feature_set_bits(NSIM_ESP_FEATURES, &ns->netdev->features); - netdev_feature_set_bits(NSIM_ESP_FEATURES, &ns->netdev->hw_enc_features); + netdev_feature_set_bits(NSIM_ESP_FEATURES, ns->netdev->features); + netdev_feature_set_bits(NSIM_ESP_FEATURES, ns->netdev->hw_enc_features);
ns->ipsec.pfile = debugfs_create_file("ipsec", 0400, ns->nsim_dev_port->ddir, ns, diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 895b548..3186286 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -293,8 +293,8 @@ static void nsim_setup(struct net_device *dev) NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_CSUM | - NETIF_F_TSO, &dev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &dev->hw_features); + NETIF_F_TSO, dev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, dev->hw_features); dev->max_mtu = ETH_MAX_MTU; }
diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c index 66af978..bfacc43 100644 --- a/drivers/net/nlmon.c +++ b/drivers/net/nlmon.c @@ -89,9 +89,9 @@ static void nlmon_setup(struct net_device *dev) dev->ethtool_ops = &nlmon_ethtool_ops; dev->needs_free_netdev = true;
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | - NETIF_F_HIGHDMA | NETIF_F_LLTX, &dev->features); + NETIF_F_HIGHDMA | NETIF_F_LLTX, dev->features); dev->flags = IFF_NOARP;
/* That's rather a softlimit here, which, of course, diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 0c9d0bd..7fc05ed 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -1599,7 +1599,7 @@ static void ppp_setup(struct net_device *dev) dev->netdev_ops = &ppp_netdev_ops; SET_NETDEV_DEVTYPE(dev, &ppp_type);
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features);
dev->hard_header_len = PPP_HDRLEN; dev->mtu = PPP_MRU; diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 49da4d1..80012b7 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -323,8 +323,8 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) struct tap_dev *tap; struct tap_queue *q;
- netdev_feature_zero(&features); - netdev_feature_set_bits(TAP_FEATURES, &features); + netdev_feature_zero(features); + netdev_feature_set_bits(TAP_FEATURES, features);
tap = tap_dev_get_rcu(dev); if (!tap) @@ -341,7 +341,7 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) * enabled. */ if (q->flags & IFF_VNET_HDR) - netdev_feature_or(&features, features, tap->tap_features); + netdev_feature_or(features, features, tap->tap_features); if (netif_needs_gso(skb, features)) { struct sk_buff *segs = __skb_gso_segment(skb, features, false); struct sk_buff *next; @@ -931,22 +931,22 @@ static int set_offload(struct tap_queue *q, unsigned long arg) if (!tap) return -ENOLINK;
- netdev_feature_zero(&feature_mask); - netdev_feature_copy(&features, tap->dev->features); + netdev_feature_zero(feature_mask); + netdev_feature_copy(features, tap->dev->features);
if (arg & TUN_F_CSUM) { - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &feature_mask); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, feature_mask);
if (arg & (TUN_F_TSO4 | TUN_F_TSO6)) { if (arg & TUN_F_TSO_ECN) netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &feature_mask); + feature_mask); if (arg & TUN_F_TSO4) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &feature_mask); + feature_mask); if (arg & TUN_F_TSO6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &feature_mask); + feature_mask); } }
@@ -959,14 +959,14 @@ static int set_offload(struct tap_queue *q, unsigned long arg) * user-space will not receive TSO frames. */ if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, feature_mask)) - netdev_feature_set_bits(RX_OFFLOADS, &features); + netdev_feature_set_bits(RX_OFFLOADS, features); else - netdev_feature_clear_bits(RX_OFFLOADS, &features); + netdev_feature_clear_bits(RX_OFFLOADS, features);
/* tap_features are the same as features on tun/tap and * reflect user expectations. */ - netdev_feature_copy(&tap->tap_features, feature_mask); + netdev_feature_copy(tap->tap_features, feature_mask); if (tap->update_features) tap->update_features(tap, features);
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 79171c8..79413eb 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -993,21 +993,21 @@ static void __team_compute_features(struct team *team) __DECLARE_NETDEV_FEATURE_MASK(mask_vlan); __DECLARE_NETDEV_FEATURE_MASK(mask_enc);
- netdev_feature_zero(&vlan_features); + netdev_feature_zero(vlan_features); netdev_feature_set_bits(TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, - &vlan_features); - netdev_feature_zero(&enc_features); - netdev_feature_set_bits(TEAM_ENC_FEATURES, &enc_features); - netdev_feature_zero(&mask_vlan); - netdev_feature_set_bits(TEAM_VLAN_FEATURES, &mask_vlan); - netdev_feature_zero(&mask_enc); - netdev_feature_set_bits(TEAM_ENC_FEATURES, &mask_enc); + vlan_features); + netdev_feature_zero(enc_features); + netdev_feature_set_bits(TEAM_ENC_FEATURES, enc_features); + netdev_feature_zero(mask_vlan); + netdev_feature_set_bits(TEAM_VLAN_FEATURES, mask_vlan); + netdev_feature_zero(mask_enc); + netdev_feature_set_bits(TEAM_ENC_FEATURES, mask_enc);
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, port->dev->vlan_features, mask_vlan); - netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, port->dev->hw_enc_features, mask_enc);
dst_release_flag &= port->dev->priv_flags; @@ -1016,12 +1016,12 @@ static void __team_compute_features(struct team *team) } rcu_read_unlock();
- netdev_feature_copy(&team->dev->vlan_features, vlan_features); - netdev_feature_copy(&team->dev->hw_enc_features, enc_features); + netdev_feature_copy(team->dev->vlan_features, vlan_features); + netdev_feature_copy(team->dev->hw_enc_features, enc_features); netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &team->dev->hw_enc_features); + team->dev->hw_enc_features); team->dev->hard_header_len = max_hard_header_len;
team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; @@ -2006,19 +2006,19 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev) }
static void team_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct team_port *port; struct team *team = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(mask);
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(mask, features); netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { - netdev_increment_features(features, *features, + netdev_increment_features(features, features, port->dev->features, mask); } rcu_read_unlock(); @@ -2172,22 +2172,22 @@ static void team_setup(struct net_device *dev) */ dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, dev->features);
/* Don't allow team devices to change network namespaces. */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features);
netdev_feature_set_bits(TEAM_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->hw_features); + dev->hw_features);
- netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->features); + dev->features); }
static int team_newlink(struct net *src_net, struct net_device *dev, diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a464daf..18efa2f 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1080,14 +1080,14 @@ static void tun_net_mclist(struct net_device *dev) }
static void tun_net_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct tun_struct *tun = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_and(&tmp, *features, tun->set_features); + netdev_feature_and(tmp, features, tun->set_features); netdev_feature_clear_bits(TUN_USER_FEATURES, features); - netdev_feature_or(features, *features, tmp); + netdev_feature_or(features, features, tmp); }
static void tun_set_headroom(struct net_device *dev, int new_hr) @@ -2729,18 +2729,18 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) tun_net_init(dev); tun_flow_init(tun);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->vlan_features); + dev->vlan_features);
tun->flags = (tun->flags & ~TUN_FEATURES) | (ifr->ifr_flags & TUN_FEATURES); @@ -2804,24 +2804,24 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) { __DECLARE_NETDEV_FEATURE_MASK(features);
- netdev_feature_zero(&features); + netdev_feature_zero(features);
if (arg & TUN_F_CSUM) { - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features); arg &= ~TUN_F_CSUM;
if (arg & (TUN_F_TSO4|TUN_F_TSO6)) { if (arg & TUN_F_TSO_ECN) { netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &features); + features); arg &= ~TUN_F_TSO_ECN; } if (arg & TUN_F_TSO4) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &features); + features); if (arg & TUN_F_TSO6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &features); + features); arg &= ~(TUN_F_TSO4|TUN_F_TSO6); }
@@ -2833,10 +2833,10 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) if (arg) return -EINVAL;
- netdev_feature_copy(&tun->set_features, features); + netdev_feature_copy(tun->set_features, features); netdev_feature_clear_bits(TUN_USER_FEATURES, - &tun->dev->wanted_features); - netdev_feature_or(&tun->dev->wanted_features, + tun->dev->wanted_features); + netdev_feature_or(tun->dev->wanted_features, tun->dev->wanted_features, features); netdev_update_features(tun->dev);
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c index 1363f64..3aaa319 100644 --- a/drivers/net/usb/aqc111.c +++ b/drivers/net/usb/aqc111.c @@ -571,7 +571,7 @@ static int aqc111_set_features(struct net_device *net, u16 reg16 = 0; u8 reg8 = 0;
- netdev_feature_xor(&changed, net->features, features); + netdev_feature_xor(changed, net->features, features); if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { aqc111_read_cmd(dev, AQ_ACCESS_MAC, SFR_TXCOE_CTL, 1, 1, ®8); reg8 ^= SFR_TXCOE_TCP | SFR_TXCOE_UDP; @@ -733,10 +733,10 @@ static int aqc111_bind(struct usbnet *dev, struct usb_interface *intf) if (usb_device_no_sg_constraint(dev->udev)) dev->can_dma_sg = 1;
- netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, &dev->net->hw_features); - netdev_feature_set_bits(AQ_SUPPORT_FEATURE, &dev->net->features); + netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, dev->net->hw_features); + netdev_feature_set_bits(AQ_SUPPORT_FEATURE, dev->net->features); netdev_feature_set_bits(AQ_SUPPORT_VLAN_FEATURE, - &dev->net->vlan_features); + dev->net->vlan_features);
netif_set_gso_max_size(dev->net, 65535);
@@ -1000,10 +1000,10 @@ static int aqc111_reset(struct usbnet *dev) if (usb_device_no_sg_constraint(dev->udev)) dev->can_dma_sg = 1;
- netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, &dev->net->hw_features); - netdev_feature_set_bits(AQ_SUPPORT_FEATURE, &dev->net->features); + netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, dev->net->hw_features); + netdev_feature_set_bits(AQ_SUPPORT_FEATURE, dev->net->features); netdev_feature_set_bits(AQ_SUPPORT_VLAN_FEATURE, - &dev->net->vlan_features); + dev->net->vlan_features);
/* Power up ethernet PHY */ aqc111_data->phy_cfg = AQ_PHY_POWER_EN; diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index b11b4bb..1dc377d 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -954,7 +954,7 @@ ax88179_set_features(struct net_device *net, netdev_features_t features) struct usbnet *dev = netdev_priv(net); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, net->features, features); + netdev_feature_xor(changed, net->features, features);
if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); @@ -1380,10 +1380,10 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) dev->mii.supports_gmii = 1;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->features); + NETIF_F_RXCSUM, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->hw_features); + NETIF_F_RXCSUM, dev->net->hw_features);
/* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | @@ -1667,10 +1667,10 @@ static int ax88179_reset(struct usbnet *dev) 1, 1, tmp);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->features); + NETIF_F_RXCSUM, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->hw_features); + NETIF_F_RXCSUM, dev->net->hw_features);
/* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index a65be62..7fb5ccb 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -275,7 +275,7 @@ static const struct net_device_ops usbpn_ops = {
static void usbpn_setup(struct net_device *dev) { - netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); dev->netdev_ops = &usbpn_ops; dev->header_ops = &phonet_header_ops; dev->type = ARPHRD_PHONET; diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 100fe6c..3abec87 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c @@ -186,7 +186,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) /* no need to put the VLAN tci in the packet headers */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->net->features); + dev->net->features);
/* monitor VLAN additions and removals */ dev->net->netdev_ops = &cdc_mbim_netdev_ops; diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 65a9892..8582d6b 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2879,28 +2879,28 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
INIT_WORK(&pdata->set_vlan, lan78xx_deferred_vlan_write);
- netdev_feature_zero(&dev->net->features); + netdev_feature_zero(dev->net->features);
if (DEFAULT_TX_CSUM_ENABLE) netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &dev->net->features); + dev->net->features);
if (DEFAULT_RX_CSUM_ENABLE) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->net->features);
if (DEFAULT_TSO_CSUM_ENABLE) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG, - &dev->net->features); + dev->net->features);
if (DEFAULT_VLAN_RX_OFFLOAD) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->net->features); + dev->net->features);
if (DEFAULT_VLAN_FILTER_ENABLE) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->net->features); + dev->net->features);
- netdev_feature_copy(&dev->net->hw_features, dev->net->features); + netdev_feature_copy(dev->net->hw_features, dev->net->features);
ret = lan78xx_setup_irq_domain(dev); if (ret < 0) { @@ -3596,7 +3596,7 @@ static void lan78xx_tx_timeout(struct net_device *net, unsigned int txqueue)
static void lan78xx_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE) netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index dbd3889..79adf4e 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2096,9 +2096,9 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb, struct sk_buff *segs, *seg, *next; struct sk_buff_head seg_list;
- netdev_feature_copy(&features, tp->netdev->features); + netdev_feature_copy(features, tp->netdev->features); netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_IPV6_CSUM | - NETIF_F_TSO6, &features); + NETIF_F_TSO6, features); segs = skb_gso_segment(skb, features); if (IS_ERR(segs) || !segs) goto drop; @@ -2744,7 +2744,7 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev) }
static void rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { u32 mss = skb_shinfo(skb)->gso_size; int max_offset = mss ? GTTCPHO_MAX : TCPHO_MAX; @@ -3241,7 +3241,7 @@ static int rtl8152_set_features(struct net_device *dev, if (ret < 0) goto out;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
mutex_lock(&tp->control);
@@ -9562,23 +9562,23 @@ static int rtl8152_probe(struct usb_interface *intf, NETIF_F_TSO | NETIF_F_FRAGLIST | NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX, &netdev->features); - netdev_feature_zero(&netdev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, netdev->features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_FRAGLIST | NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX, &netdev->hw_features); - netdev_feature_zero(&netdev->vlan_features); + NETIF_F_HW_VLAN_CTAG_TX, netdev->hw_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | NETIF_F_IPV6_CSUM | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
if (tp->version == RTL_VER_01) { - netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, netdev->features); netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO) { diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 87ad300..cb4d880 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -1473,14 +1473,14 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
if (DEFAULT_TX_CSUM_ENABLE) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->net->features); + dev->net->features);
if (DEFAULT_RX_CSUM_ENABLE) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM, - &dev->net->hw_features); + dev->net->hw_features);
ret = smsc75xx_wait_ready(dev, 0); if (ret < 0) { diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index d6c5293..a5887a1 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1081,12 +1081,12 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) */ if (DEFAULT_TX_CSUM_ENABLE) netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &dev->net->features); + dev->net->features); if (DEFAULT_RX_CSUM_ENABLE) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &dev->net->hw_features); + dev->net->hw_features); set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
smsc95xx_init_mac_address(dev); diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 6603dca..c85a49c 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1077,7 +1077,7 @@ static int veth_enable_xdp(struct net_device *dev) * is supposed to get GRO working */ netdev_feature_set_bit(NETIF_F_GRO_BIT, - &dev->features); + dev->features); netdev_features_change(dev); } } @@ -1107,7 +1107,7 @@ static void veth_disable_xdp(struct net_device *dev) */ if (!veth_gro_requested(dev) && netif_running(dev)) { netdev_feature_clear_bit(NETIF_F_GRO_BIT, - &dev->features); + dev->features); netdev_features_change(dev); } } @@ -1386,7 +1386,7 @@ static int veth_get_iflink(const struct net_device *dev) }
static void veth_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct veth_priv *priv = netdev_priv(dev); struct net_device *peer; @@ -1410,7 +1410,7 @@ static int veth_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features);
if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, changed) || !(dev->flags & IFF_UP) || priv->_xdp_prog) @@ -1494,7 +1494,7 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
if (!old_prog) { netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &peer->hw_features); + peer->hw_features); peer->max_mtu = max_mtu; } } @@ -1506,7 +1506,7 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
if (peer) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &peer->hw_features); + peer->hw_features); peer->max_mtu = ETH_MAX_MTU; } } @@ -1571,24 +1571,24 @@ static void veth_setup(struct net_device *dev)
dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(VETH_FEATURES, &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(VETH_FEATURES, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX, - &dev->vlan_features); + dev->vlan_features); dev->needs_free_netdev = true; dev->priv_destructor = veth_dev_free; dev->max_mtu = ETH_MAX_MTU;
- netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bits(VETH_FEATURES, &dev->hw_features); - netdev_feature_copy(&dev->hw_enc_features, dev->hw_features); - netdev_feature_zero(&dev->mpls_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bits(VETH_FEATURES, dev->hw_features); + netdev_feature_copy(dev->hw_enc_features, dev->hw_features); + netdev_feature_zero(dev->mpls_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE, - &dev->mpls_features); + dev->mpls_features); }
/* @@ -1615,8 +1615,8 @@ static struct rtnl_link_ops veth_link_ops;
static void veth_disable_gro(struct net_device *dev) { - netdev_feature_clear_bit(NETIF_F_GRO_BIT, &dev->features); - netdev_feature_clear_bit(NETIF_F_GRO_BIT, &dev->wanted_features); + netdev_feature_clear_bit(NETIF_F_GRO_BIT, dev->features); + netdev_feature_clear_bit(NETIF_F_GRO_BIT, dev->wanted_features); netdev_update_features(dev); }
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 1aa408f..d43450b 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2880,7 +2880,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi) vi->cvq = vqs[total_vqs - 1]; if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &vi->dev->features); + vi->dev->features); }
for (i = 0; i < vi->max_queue_pairs; i++) { @@ -3091,8 +3091,8 @@ static int virtnet_probe(struct virtio_device *vdev) dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE | IFF_TX_SKB_NO_LINEAR; dev->netdev_ops = &virtnet_netdev; - netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
dev->ethtool_ops = &virtnet_ethtool_ops; SET_NETDEV_DEV(dev, &vdev->dev); @@ -3101,48 +3101,48 @@ static int virtnet_probe(struct virtio_device *vdev) if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { /* This opens up the world of extra features. */ netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->hw_features); + dev->hw_features); if (csum) netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->features); + dev->features);
if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features); } /* Individual feature bits: what can host handle? */ if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4)) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &dev->hw_features); + dev->hw_features); if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6)) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &dev->hw_features); + dev->hw_features); if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &dev->hw_features); + dev->hw_features);
- netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, dev->features);
if (gso) { __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_zero(&tmp); - netdev_feature_set_bits(NETIF_F_ALL_TSO, &tmp); - netdev_feature_and(&dev->features, dev->hw_features, + netdev_feature_zero(tmp); + netdev_feature_set_bits(NETIF_F_ALL_TSO, tmp); + netdev_feature_and(dev->features, dev->hw_features, tmp); } /* (!csum && gso) case will be fixed by register_netdev() */ } if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->features); if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->hw_features);
- netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features);
/* MTU range: 68 - 65535 */ dev->min_mtu = MIN_MTU; diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 5611a10..0bbde30 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -3172,20 +3172,20 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) { struct net_device *netdev = adapter->netdev;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO, - &netdev->hw_features); + netdev->hw_features);
if (VMXNET3_VERSION_GE_4(adapter)) { - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | @@ -3193,19 +3193,19 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
if (dma64) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->hw_features); - netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->vlan_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev->vlan_features); + netdev_feature_copy(netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features); }
@@ -3658,8 +3658,8 @@ vmxnet3_probe_device(struct pci_dev *pdev, adapter->intr.type == VMXNET3_IT_MSIX) { adapter->rss = true; netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->features); dev_dbg(&pdev->dev, "RSS is enabled.\n"); } else { adapter->rss = false; diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index f365604..185ebda 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -247,15 +247,15 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) }
void vmxnet3_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { /* If Rx checksum is disabled, then LRO should also be disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct vmxnet3_adapter *adapter = netdev_priv(netdev);
@@ -315,7 +315,7 @@ static void vmxnet3_enable_encap_offloads(struct net_device *netdev) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features); } }
@@ -331,7 +331,7 @@ static void vmxnet3_disable_encap_offloads(struct net_device *netdev) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features); } }
@@ -344,7 +344,7 @@ int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) unsigned long flags; u8 udp_tun_enabled;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); udp_tun_enabled = netdev_feature_test_bits(tun_offload_mask, netdev->features); if (netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_LRO | diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index aed4e1b..a64b049 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h @@ -476,11 +476,11 @@ void vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter);
void -vmxnet3_fix_features(struct net_device *netdev, netdev_features_t *features); +vmxnet3_fix_features(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 net_device *netdev, netdev_features_t features);
int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features); diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index e5f7235..e84dc21 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3294,17 +3294,17 @@ static void vxlan_setup(struct net_device *dev) dev->needs_free_netdev = true; SET_NETDEV_DEVTYPE(dev, &vxlan_type);
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features);
- netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features);
netif_keep_dst(dev); dev->priv_flags |= IFF_NO_QUEUE; diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c index 9c58f52..b689592 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -271,10 +271,10 @@ static void wg_setup(struct net_device *dev) dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP; dev->priv_flags |= IFF_NO_QUEUE; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->features); - netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->hw_features); - netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, dev->features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, dev->hw_features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, dev->hw_enc_features); dev->mtu = ETH_DATA_LEN - overhead; dev->max_mtu = round_down(INT_MAX, MESSAGE_PADDING_MULTIPLE) - overhead;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 493d15f..6875cc8 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -10120,9 +10120,9 @@ int ath10k_mac_register(struct ath10k *ar) ar->hw->wiphy->sar_capa = &ath10k_sar_capa;
if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { - netdev_feature_zero(&ar->hw->netdev_features); + netdev_feature_zero(ar->hw->netdev_features); netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &ar->hw->netdev_features); + ar->hw->netdev_features); }
if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index ba892c4..9ed47b7 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6570,9 +6570,9 @@ static int __ath11k_mac_register(struct ath11k *ar) ath11k_reg_init(ar);
if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { - netdev_feature_zero(&ar->hw->netdev_features); + netdev_feature_zero(ar->hw->netdev_features); netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &ar->hw->netdev_features); + ar->hw->netdev_features); ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); } diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index 2b15df2..8d2d6dd 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c @@ -1133,9 +1133,9 @@ static int ath6kl_set_features(struct net_device *dev, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &dev->features); + dev->features); return err; } } else if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && @@ -1145,9 +1145,9 @@ static int ath6kl_set_features(struct net_device *dev, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &dev->features); + dev->features); return err; } } @@ -1310,7 +1310,7 @@ void init_netdev(struct net_device *dev) if (!test_bit(ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM, ar->fw_capabilities)) netdev_feature_set_bit(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features);
return; } diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c index b29a4d6..15df5809 100644 --- a/drivers/net/wireless/ath/wil6210/netdev.c +++ b/drivers/net/wireless/ath/wil6210/netdev.c @@ -335,13 +335,13 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name, ndev->netdev_ops = &wil_netdev_ops; wil_set_ethtoolops(ndev); ndev->ieee80211_ptr = wdev; - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6, - &ndev->hw_features); + ndev->hw_features);
- netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features);
SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); wdev->netdev = ndev; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index d04bff1..7a76b73 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -616,9 +616,9 @@ static int brcmf_netdev_open(struct net_device *ndev) /* Get current TOE mode from dongle */ if (brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_ol) >= 0 && (toe_ol & TOE_TX_CSUM_OL) != 0) - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, ndev->features); else - netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, ndev->features);
if (brcmf_cfg80211_up(ndev)) { bphy_err(drvr, "failed to bring up cfg80211\n"); diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c index 81df856..421799d 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c @@ -102,9 +102,9 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, ieee80211_hw_set(hw, WANT_MONITOR_VIF);
if (priv->trans->max_skb_frags) { - netdev_feature_zero(&hw->netdev_features); + netdev_feature_zero(hw->netdev_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG, - &hw->netdev_features); + hw->netdev_features); }
hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 65d0125..62994f2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -388,9 +388,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) ieee80211_hw_set(hw, USES_RSS);
if (mvm->trans->max_skb_frags) { - netdev_feature_zero(&hw->netdev_features); + netdev_feature_zero(hw->netdev_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG, - &hw->netdev_features); + hw->netdev_features); }
hw->queues = IEEE80211_MAX_QUEUES; @@ -706,11 +706,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; }
- netdev_feature_copy(&hw->netdev_features, mvm->cfg->features); + netdev_feature_copy(hw->netdev_features, mvm->cfg->features); if (!iwl_mvm_is_csum_supported(mvm)) netdev_feature_clear_bits(IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, - &hw->netdev_features); + hw->netdev_features);
if (mvm->cfg->vht_mu_mimo_supported) wiphy_ext_feature_set(hw->wiphy, @@ -1455,7 +1455,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, goto out_unlock; }
- netdev_feature_or(&mvmvif->features, mvmvif->features, + netdev_feature_or(mvmvif->features, mvmvif->features, hw->netdev_features);
ret = iwl_mvm_mac_ctxt_add(mvm, vif); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index f2070ed..6a53e86 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -840,8 +840,8 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb, u16 snap_ip_tcp, pad; u8 tid;
- netdev_feature_zero(&netdev_flags); - netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_SG, &netdev_flags); + netdev_feature_zero(netdev_flags); + netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_SG, netdev_flags);
snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) + tcp_hdrlen(skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index e690e09..2fcd066 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -363,8 +363,8 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) hw->max_rates = 3; hw->max_report_rates = 7; hw->max_rate_tries = 11; - netdev_feature_zero(&hw->netdev_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features); + netdev_feature_zero(hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index a3ab1a5f..12b9530 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -217,8 +217,8 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; - netdev_feature_zero(&hw->netdev_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features); + netdev_feature_zero(hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 368d6cf..cf1aa49 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -51,8 +51,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = 64; hw->max_tx_aggregation_subframes = 128; - netdev_feature_zero(&hw->netdev_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features); + netdev_feature_zero(hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 8acfc1f..2bfd615 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c @@ -375,7 +375,7 @@ static int xenvif_change_mtu(struct net_device *dev, int mtu) }
static void xenvif_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct xenvif *vif = netdev_priv(dev);
@@ -532,13 +532,13 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, INIT_LIST_HEAD(&vif->fe_mcast_addr);
dev->netdev_ops = &xenvif_netdev_ops; - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); dev->ethtool_ops = &xenvif_ethtool_ops;
dev->tx_queue_len = XENVIF_QUEUE_LENGTH; diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 041efc0..8d1f06c 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -702,7 +702,7 @@ static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev spin_unlock_irqrestore(&queue->tx_lock, flags); goto drop; } - netif_skb_features(skb, &features); + netif_skb_features(skb, features); if (unlikely(netif_needs_gso(skb, features))) { spin_unlock_irqrestore(&queue->tx_lock, flags); goto drop; @@ -1341,24 +1341,24 @@ static void xennet_release_rx_bufs(struct netfront_queue *queue) }
static void xennet_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct netfront_info *np = netdev_priv(dev);
- if (netdev_feature_test_bit(NETIF_F_SG_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_SG_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0)) netdev_feature_clear_bit(NETIF_F_SG_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-ipv6-csum-offload", 0)) netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features); } @@ -1544,20 +1544,20 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
netdev->netdev_ops = &xennet_netdev_ops;
- netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | - NETIF_F_GSO_ROBUST, &netdev->features); - netdev_feature_zero(&netdev->hw_features); + NETIF_F_GSO_ROBUST, netdev->features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6, &netdev->features); + NETIF_F_TSO | NETIF_F_TSO6, netdev->features); /* * Assume that all hw features are available for now. This set * will be adjusted by the call to netdev_update_features() in * xennet_connect() which is the earliest point where we can * negotiate with the backend regarding supported features. */ - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev->ethtool_ops = &xennet_ethtool_ops; diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index b8cf8b6..deb7100 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -6394,10 +6394,10 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
dev->ethtool_ops = &qeth_ethtool_ops; dev->priv_flags &= ~IFF_TX_SKB_SHARING; - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->vlan_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->vlan_features); if (IS_IQD(card)) - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->features);
return dev; } @@ -6844,18 +6844,18 @@ void qeth_enable_hw_features(struct net_device *dev) struct qeth_card *card = dev->ml_priv; netdev_features_t features;
- netdev_feature_copy(&features, dev->features); + netdev_feature_copy(features, dev->features); /* force-off any feature that might need an IPA sequence. * netdev_update_features() will restart them. */ - netdev_feature_andnot(&dev->features, dev->features, + netdev_feature_andnot(dev->features, dev->features, dev->hw_features); /* toggle VLAN filter, so that VIDs are re-programmed: */ if (IS_LAYER2(card) && IS_VM_NIC(card)) { netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->features); + dev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->wanted_features); + dev->wanted_features); } netdev_update_features(dev); if (!netdev_feature_equal(features, dev->features)) @@ -6893,7 +6893,7 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) QETH_CARD_TEXT(card, 2, "setfeat"); QETH_CARD_HEX(card, 2, &features, sizeof(features));
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { rc = qeth_set_ipa_csum(card, netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, @@ -6901,7 +6901,7 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV4, &card->info.has_lp2lp_cso_v4); if (rc) - netdev_feature_change_bit(NETIF_F_IP_CSUM_BIT, &changed); + netdev_feature_change_bit(NETIF_F_IP_CSUM_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, changed)) { rc = qeth_set_ipa_csum(card, @@ -6910,14 +6910,14 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV6, &card->info.has_lp2lp_cso_v6); if (rc) - netdev_feature_change_bit(NETIF_F_IPV6_CSUM_BIT, &changed); + netdev_feature_change_bit(NETIF_F_IPV6_CSUM_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { rc = qeth_set_ipa_rx_csum(card, netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)); if (rc) - netdev_feature_change_bit(NETIF_F_RXCSUM_BIT, &changed); + netdev_feature_change_bit(NETIF_F_RXCSUM_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_TSO_BIT, changed)) { rc = qeth_set_ipa_tso(card, @@ -6925,7 +6925,7 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) features), QETH_PROT_IPV4); if (rc) - netdev_feature_change_bit(NETIF_F_TSO_BIT, &changed); + netdev_feature_change_bit(NETIF_F_TSO_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, changed)) { rc = qeth_set_ipa_tso(card, @@ -6933,24 +6933,24 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) features), QETH_PROT_IPV6); if (rc) - netdev_feature_change_bit(NETIF_F_TSO6_BIT, &changed); + netdev_feature_change_bit(NETIF_F_TSO6_BIT, changed); }
- netdev_feature_xor(&tmp1, dev->features, features); - netdev_feature_xor(&tmp2, dev->features, changed); + netdev_feature_xor(tmp1, dev->features, features); + netdev_feature_xor(tmp2, dev->features, changed); qeth_check_restricted_features(card, tmp1, tmp2);
/* everything changed successfully? */ - netdev_feature_xor(&tmp1, dev->features, features); + netdev_feature_xor(tmp1, dev->features, features); if (netdev_feature_equal(tmp1, changed)) return 0; /* something went wrong. save changed features and return error */ - netdev_feature_xor(&dev->features, dev->features, changed); + netdev_feature_xor(dev->features, dev->features, changed); return -EIO; } EXPORT_SYMBOL_GPL(qeth_set_features);
-void qeth_fix_features(struct net_device *dev, netdev_features_t *features) +void qeth_fix_features(struct net_device *dev, netdev_features_t features) { struct qeth_card *card = dev->ml_priv;
@@ -6967,12 +6967,12 @@ void qeth_fix_features(struct net_device *dev, netdev_features_t *features) if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features);
- QETH_CARD_HEX(card, 2, features, sizeof(*features)); + QETH_CARD_HEX(card, 2, features, sizeof(features)); } EXPORT_SYMBOL_GPL(qeth_fix_features);
void qeth_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct qeth_card *card = dev->ml_priv;
@@ -6981,27 +6981,27 @@ void qeth_features_check(struct sk_buff *skb, struct net_device *dev, READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) { __DECLARE_NETDEV_FEATURE_MASK(restricted);
- netdev_feature_zero(&restricted); - if (skb_is_gso(skb) && !netif_needs_gso(skb, *features)) - netdev_feature_set_bits(NETIF_F_ALL_TSO, &restricted); + netdev_feature_zero(restricted); + if (skb_is_gso(skb) && !netif_needs_gso(skb, features)) + netdev_feature_set_bits(NETIF_F_ALL_TSO, restricted);
switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): if (!card->info.has_lp2lp_cso_v4) netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &restricted); + restricted);
if (restricted && qeth_next_hop_is_local_v4(card, skb)) netdev_feature_andnot(features, features, - &restricted); + restricted); break; case htons(ETH_P_IPV6): if (!card->info.has_lp2lp_cso_v6) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &restricted); + restricted);
if (restricted && qeth_next_hop_is_local_v6(card, skb)) - netdev_feature_andnot(features, *features, + netdev_feature_andnot(features, features, restricted); break; default: diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index ecb9b1e..c919dc1 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -1080,49 +1080,49 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
if (IS_OSM(card)) { netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, - &card->dev->features); + card->dev->features); } else { if (!IS_VM_NIC(card)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &card->dev->features); + card->dev->features); }
if (IS_OSD(card) && !IS_VM_NIC(card)) { - netdev_feature_set_bit(NETIF_F_SG_BIT, &card->dev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, card->dev->features); /* OSA 3S and earlier has no RX/TX support */ if (qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) { netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } } if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM) || qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported(card, IPA_OUTBOUND_TSO)) { netdev_feature_set_bit(NETIF_F_TSO_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_TSO_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); }
if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 71feb90..ba27df3 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -1880,26 +1880,26 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
if (!IS_VM_NIC(card)) { netdev_feature_set_bit(NETIF_F_SG_BIT, - &card->dev->features); + card->dev->features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &card->dev->vlan_features); + card->dev->vlan_features); }
if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); }
/* allow for de-acceleration of NETIF_F_HW_VLAN_CTAG_TX: */ @@ -1924,7 +1924,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
card->dev->needed_headroom = headroom; netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &card->dev->features); + NETIF_F_HW_VLAN_CTAG_RX, card->dev->features);
netif_keep_dst(card->dev); if (netdev_feature_test_bit(NETIF_F_TSO | NETIF_F_TSO6, diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index f5205f6..4aec8ff 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -2259,7 +2259,7 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, }
/* update the features with resent change */ - netdev_feature_copy(&ndev->features, features); + netdev_feature_copy(ndev->features, features);
if (need_restart) { status = qlge_adapter_up(qdev); @@ -2279,7 +2279,7 @@ static int qlge_set_features(struct net_device *ndev, __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { /* Update the behavior of vlan accel in the adapter */ @@ -4577,7 +4577,7 @@ static int qlge_probe(struct pci_dev *pdev, goto netdev_free;
SET_NETDEV_DEV(ndev, &pdev->dev); - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | @@ -4586,17 +4586,17 @@ static int qlge_probe(struct pci_dev *pdev, NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM, - &ndev->hw_features); - netdev_feature_copy(&ndev->features, ndev->hw_features); - netdev_feature_copy(&ndev->vlan_features, ndev->hw_features); + ndev->hw_features); + netdev_feature_copy(ndev->features, ndev->hw_features); + netdev_feature_copy(ndev->vlan_features, ndev->hw_features); /* vlan gets same features (except vlan filter) */ netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &ndev->vlan_features); + ndev->vlan_features);
if (test_bit(QL_DMA64, &qdev->flags)) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features);
/* * Set up net_device structure. diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 9696e7a..d08b831 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -731,7 +731,7 @@ static inline bool skb_vlan_tagged_multi(struct sk_buff *skb) * Returns features without unsafe ones if the skb has multiple tags. */ static inline void vlan_features_check(struct sk_buff *skb, - netdev_features_t *features) + netdev_features_t features) { if (skb_vlan_tagged_multi(skb)) { /* In the case of multi-tagged packets, use a direct mask diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 0bd12e9..6881902 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -9,7 +9,7 @@ #include <linux/bitops.h> #include <asm/byteorder.h>
-typedef u64 netdev_features_t; +typedef unsigned long * netdev_features_t;
enum { NETIF_F_SG_BIT, /* Scatter/gather IO. */ @@ -101,11 +101,12 @@ enum { /**/NETDEV_FEATURE_COUNT };
+/* declare a netdev feature bitmap */ #define __DECLARE_NETDEV_FEATURE_MASK(name) \ - netdev_features_t name + DECLARE_BITMAP(name, NETDEV_FEATURE_COUNT)
/* copy'n'paste compression ;) */ -#define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit)) +#define __NETIF_F_BIT(bit) ((u64)1 << (bit)) #define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT)
#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC) @@ -172,37 +173,17 @@ enum { #define NETIF_F_HW_HSR_FWD __NETIF_F(HW_HSR_FWD) #define NETIF_F_HW_HSR_DUP __NETIF_F(HW_HSR_DUP)
-/* Finds the next feature with the highest number of the range of start till 0. - */ -static inline int find_next_netdev_feature(u64 feature, unsigned long start) -{ - /* like BITMAP_LAST_WORD_MASK() for u64 - * this sets the most significant 64 - start to 0. - */ - feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1)); - - return fls64(feature) - 1; -} - /* This goes for the MSB to the LSB through the set feature bits, * mask_addr should be a u64 and bit an int */ #define for_each_netdev_feature(mask_addr, bit) \ - for ((bit) = find_next_netdev_feature((mask_addr), \ - NETDEV_FEATURE_COUNT); \ - (bit) >= 0; \ - (bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) + for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
/* Features valid for ethtool to change */ /* = all defined minus driver/device-class-related */ #define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \ NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
-/* remember that ((t)1 << t_BITS) is undefined in C99 */ -#define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \ - (__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \ - ~NETIF_F_NEVER_CHANGE) - /* Segmentation offload feature mask */ #define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \ __NETIF_F_BIT(NETIF_F_GSO_SHIFT)) @@ -264,73 +245,72 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
-static inline void netdev_feature_zero(netdev_features_t *dst) +static inline void netdev_feature_zero(unsigned long *dst) { - *dst = 0; + bitmap_zero(dst, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_fill(netdev_features_t *dst) +static inline void netdev_feature_fill(unsigned long *dst) { - *dst = ~0; + bitmap_fill(dst, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_copy(netdev_features_t *dst, - const netdev_features_t src) +static inline void netdev_feature_copy(unsigned long *dst, + const unsigned long *src) { - *dst = src; + bitmap_copy(dst, src, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_and(netdev_features_t *dst, - const netdev_features_t a, - const netdev_features_t b) +static inline void netdev_feature_and(unsigned long *dst, + const unsigned long *a, + const unsigned long *b) { - *dst = a & b; + bitmap_and(dst, a, b, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_or(netdev_features_t *dst, - const netdev_features_t a, - const netdev_features_t b) +static inline void netdev_feature_or(unsigned long *dst, + const unsigned long *a, + const unsigned long *b) { - *dst = a | b; + bitmap_or(dst, a, b, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_xor(netdev_features_t *dst, - const netdev_features_t a, - const netdev_features_t b) +static inline void netdev_feature_xor(unsigned long *dst, + const unsigned long *a, + const unsigned long *b) { - *dst = a ^ b; + bitmap_xor(dst, a, b, NETDEV_FEATURE_COUNT); }
-static inline bool netdev_feature_empty(netdev_features_t src) +static inline bool netdev_feature_empty(const unsigned long *src) { - return src == 0; + return bitmap_empty(src, NETDEV_FEATURE_COUNT); }
-static inline bool netdev_feature_equal(const netdev_features_t src1, - const netdev_features_t src2) +static inline bool netdev_feature_equal(const unsigned long *src1, + const unsigned long *src2) { - return src1 == src2; + return bitmap_equal(src1, src2, NETDEV_FEATURE_COUNT); }
-static inline int netdev_feature_andnot(netdev_features_t *dst, - const netdev_features_t src1, - const netdev_features_t src2) +static inline int netdev_feature_andnot(netdev_features_t dst, + const unsigned long *src1, + const unsigned long *src2) { - *dst = src1 & ~src2; - return 0; + return bitmap_andnot(dst, src1, src2, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_set_bit(int nr, netdev_features_t *addr) +static inline void netdev_feature_set_bit(int nr, unsigned long *addr) { - *addr |= __NETIF_F_BIT(nr); + __set_bit(nr, addr); }
-static inline void netdev_feature_clear_bit(int nr, netdev_features_t *addr) +static inline void netdev_feature_clear_bit(int nr, unsigned long *addr) { - *addr &= ~(__NETIF_F_BIT(nr)); + __clear_bit(nr, addr); }
-static inline void netdev_feature_mod_bit(int nr, netdev_features_t *addr, +static inline void netdev_feature_mod_bit(int nr, unsigned long *addr, int set) { if (set) @@ -339,19 +319,19 @@ static inline void netdev_feature_mod_bit(int nr, netdev_features_t *addr, netdev_feature_clear_bit(nr, addr); }
-static inline void netdev_feature_change_bit(int nr, netdev_features_t *addr) +static inline void netdev_feature_change_bit(int nr, unsigned long *addr) { - *addr ^= __NETIF_F_BIT(nr); + __change_bit(nr, addr); }
-static inline int netdev_feature_test_bit(int nr, const netdev_features_t addr) +static inline int netdev_feature_test_bit(int nr, const unsigned long *addr) { - return (addr & __NETIF_F_BIT(nr)) > 0; + return test_bit(nr, addr); }
static inline void netdev_feature_set_bit_array(const int *array, int array_size, - netdev_features_t *addr) + unsigned long *addr) { int i;
@@ -360,41 +340,58 @@ static inline void netdev_feature_set_bit_array(const int *array, }
/* only be used for the first 64 bits features */ -static inline void netdev_feature_set_bits(u64 bits, netdev_features_t *addr) +static inline void netdev_feature_set_bits(u64 bits, unsigned long *addr) { - *addr |= bits; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_or(addr, addr, tmp); }
/* only be used for the first 64 bits features */ -static inline void netdev_feature_clear_bits(u64 bits, netdev_features_t *addr) +static inline void netdev_feature_clear_bits(u64 bits, unsigned long *addr) { - *addr &= ~bits; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_andnot(addr, addr, tmp); }
/* only be used for the first 64 bits features */ static inline bool netdev_feature_test_bits(u64 bits, - const netdev_features_t addr) + const unsigned long *addr) { - return (addr & bits) > 0; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_and(tmp, tmp, addr); + return netdev_feature_empty(tmp); }
/* only be used for the first 64 bits features */ static inline void netdev_feature_and_bits(u64 bits, - netdev_features_t *addr) + unsigned long *addr) { - *addr &= bits; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_and(addr, tmp, addr); }
static inline int netdev_feature_intersects(const netdev_features_t src1, const netdev_features_t src2) { - return (src1 & src2) > 0; + return bitmap_intersects(src1, src2, NETDEV_FEATURE_COUNT); }
-static inline int netdev_feature_subset(const netdev_features_t src1, - const netdev_features_t src2) +static inline int netdev_feature_subset(const unsigned long *src1, + const unsigned long *src2) { - return (src1 & src2) == src2; + return bitmap_subset(src1, src2, NETDEV_FEATURE_COUNT); }
#endif /* _LINUX_NETDEV_FEATURES_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b920249..30f4942 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1349,7 +1349,7 @@ struct net_device_ops { struct net_device *dev); 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); @@ -1477,7 +1477,7 @@ struct net_device_ops { struct net_device* (*ndo_sk_get_lower_dev)(struct net_device *dev, struct sock *sk); void (*ndo_fix_features)(struct net_device *dev, - netdev_features_t *features); + netdev_features_t features); int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); int (*ndo_neigh_construct)(struct net_device *dev, @@ -4994,7 +4994,7 @@ const char *netdev_drivername(const struct net_device *dev);
void linkwatch_run_queue(void);
-static inline void netdev_intersect_features(netdev_features_t *ret, +static inline void netdev_intersect_features(netdev_features_t ret, netdev_features_t f1, netdev_features_t f2) { @@ -5002,37 +5002,37 @@ static inline void netdev_intersect_features(netdev_features_t *ret, netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, f2)) { if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, f1)) netdev_feature_set_bits(NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &f1); + NETIF_F_IPV6_CSUM, f1); else netdev_feature_set_bits(NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &f2); + NETIF_F_IPV6_CSUM, f2); }
netdev_feature_and(ret, f1, f2); }
static inline void netdev_get_wanted_features(struct net_device *dev, - netdev_features_t *wanted) + netdev_features_t wanted) { netdev_feature_andnot(wanted, dev->features, dev->hw_features); - netdev_feature_or(wanted, *wanted, dev->wanted_features); + netdev_feature_or(wanted, wanted, dev->wanted_features); }
-void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, +void netdev_increment_features(netdev_features_t ret, netdev_features_t all, netdev_features_t one, netdev_features_t mask);
/* Allow TSO being used on stacked device : * Performing the GSO segmentation before last device * is a performance improvement. */ -static inline void netdev_add_tso_features(netdev_features_t *features, +static inline void netdev_add_tso_features(netdev_features_t features, netdev_features_t mask) { __DECLARE_NETDEV_FEATURE_MASK(one);
- netdev_feature_zero(&one); - netdev_feature_set_bits(NETIF_F_ALL_TSO, &one); - netdev_increment_features(features, *features, one, mask); + netdev_feature_zero(one); + netdev_feature_set_bits(NETIF_F_ALL_TSO, one); + netdev_increment_features(features, features, one, mask); }
int __netdev_update_features(struct net_device *dev); @@ -5043,10 +5043,10 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev);
void passthru_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features); -void netif_skb_features(struct sk_buff *skb, netdev_features_t *features); + netdev_features_t features); +void netif_skb_features(struct sk_buff *skb, netdev_features_t features);
-static inline bool net_gso_ok(netdev_features_t features, int gso_type) +static inline bool net_gso_ok(const unsigned long *features, int gso_type) { __DECLARE_NETDEV_FEATURE_MASK(feature);
@@ -5071,8 +5071,8 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type) BUILD_BUG_ON(SKB_GSO_UDP_L4 != (NETIF_F_GSO_UDP_L4 >> NETIF_F_GSO_SHIFT)); BUILD_BUG_ON(SKB_GSO_FRAGLIST != (NETIF_F_GSO_FRAGLIST >> NETIF_F_GSO_SHIFT));
- netdev_feature_zero(&feature); - netdev_feature_set_bit((u64)gso_type << NETIF_F_GSO_SHIFT, &feature); + netdev_feature_zero(feature); + netdev_feature_set_bit((u64)gso_type << NETIF_F_GSO_SHIFT, feature);
return netdev_feature_subset(features, feature);
diff --git a/include/net/sock.h b/include/net/sock.h index 9d0d8e8..64d1ade 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2061,16 +2061,16 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) { - netdev_feature_or(&sk->sk_route_nocaps, sk->sk_route_nocaps, flags); - netdev_feature_andnot(&sk->sk_route_caps, sk->sk_route_caps, flags); + netdev_feature_or(sk->sk_route_nocaps, sk->sk_route_nocaps, flags); + netdev_feature_andnot(sk->sk_route_caps, sk->sk_route_caps, flags); }
static inline void sk_nocaps_add_gso(struct sock *sk) { __DECLARE_NETDEV_FEATURE_MASK(gso_flags);
- netdev_feature_zero(&gso_flags); - netdev_feature_set_bits(NETIF_F_GSO_MASK, &gso_flags); + netdev_feature_zero(gso_flags); + netdev_feature_set_bits(NETIF_F_GSO_MASK, gso_flags); sk_nocaps_add(sk, gso_flags); }
diff --git a/include/net/udp.h b/include/net/udp.h index 42681e7..d09c555 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -484,15 +484,15 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk, __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs;
- netdev_feature_zero(&features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &features); + netdev_feature_zero(features); + netdev_feature_set_bit(NETIF_F_SG_BIT, features);
/* Avoid csum recalculation by skb_segment unless userspace explicitly * asks for the final checksum values */ if (!inet_get_convert_csum(sk)) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &features); + features);
/* UDP segmentation expects packets of type CHECKSUM_PARTIAL or * CHECKSUM_NONE in __udp_gso_segment. UDP GRO indeed builds partial diff --git a/include/net/vxlan.h b/include/net/vxlan.h index dba14ed..2e30dea 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -297,7 +297,7 @@ struct net_device *vxlan_dev_create(struct net *net, const char *name, u8 name_assign_type, struct vxlan_config *conf);
static inline void vxlan_features_check(struct sk_buff *skb, - netdev_features_t *features) + netdev_features_t features) { u8 l4_hdr = 0;
@@ -321,7 +321,7 @@ static inline void vxlan_features_check(struct sk_buff *skb, (skb_inner_mac_header(skb) - skb_transport_header(skb) != sizeof(struct udphdr) + sizeof(struct vxlanhdr)) || (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(*features, inner_eth_hdr(skb)->h_proto)))) + !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto)))) netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, features); } diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 26c8394..ab71ceb 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1754,8 +1754,8 @@ char *netdev_bits(char *buf, char *end, const void *addr,
switch (fmt[1]) { case 'F': - num = *(const netdev_features_t *)addr; - size = sizeof(netdev_features_t); + num = *(const u64 *)addr; + size = sizeof(u64); break; default: return error_string(buf, end, "(%pN?)", spec); diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 8a50def..d230e08 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -340,7 +340,7 @@ static void vlan_transfer_features(struct net_device *dev,
vlandev->priv_flags &= ~IFF_XMIT_DST_RELEASE; vlandev->priv_flags |= (vlan->real_dev->priv_flags & IFF_XMIT_DST_RELEASE); - vlan_tnl_features(vlan->real_dev, &vlandev->hw_enc_features); + vlan_tnl_features(vlan->real_dev, vlandev->hw_enc_features);
netdev_update_features(vlandev); } diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 10b792e..626255a 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -104,15 +104,15 @@ static inline struct net_device *vlan_find_dev(struct net_device *real_dev, }
static inline void vlan_tnl_features(struct net_device *real_dev, - netdev_features_t *tnl) + netdev_features_t tnl) { netdev_feature_zero(tnl); netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL, tnl); - netdev_feature_and(tnl, *tnl, real_dev->hw_enc_features); + netdev_feature_and(tnl, tnl, real_dev->hw_enc_features);
- if (netdev_feature_test_bits(NETIF_F_GSO_ENCAP_ALL, *tnl) && - netdev_feature_test_bits(NETIF_F_CSUM_MASK, *tnl)) { + if (netdev_feature_test_bits(NETIF_F_GSO_ENCAP_ALL, tnl) && + netdev_feature_test_bits(NETIF_F_CSUM_MASK, tnl)) { netdev_feature_clear_bits(NETIF_F_CSUM_MASK, tnl); netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, tnl); } diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 4062917..008c9fc 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -566,24 +566,24 @@ static int vlan_dev_init(struct net_device *dev) if (vlan->flags & VLAN_FLAG_BRIDGE_BINDING) dev->state |= (1 << __LINK_STATE_NOCARRIER);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL | NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC | - NETIF_F_ALL_FCOE, &dev->hw_features); + NETIF_F_ALL_FCOE, dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); dev->gso_max_size = real_dev->gso_max_size; dev->gso_max_segs = real_dev->gso_max_segs; if (netdev_feature_test_bits(NETIF_F_VLAN_FEATURES, dev->features)) netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n");
- netdev_feature_copy(&dev->vlan_features, real_dev->vlan_features); - netdev_feature_clear_bits(NETIF_F_ALL_FCOE, &dev->vlan_features); - vlan_tnl_features(real_dev, &dev->hw_enc_features); - netdev_feature_copy(&dev->mpls_features, real_dev->mpls_features); + netdev_feature_copy(dev->vlan_features, real_dev->vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_FCOE, dev->vlan_features); + vlan_tnl_features(real_dev, dev->hw_enc_features); + netdev_feature_copy(dev->mpls_features, real_dev->mpls_features);
/* ipv6 shared card related stuff */ dev->dev_id = real_dev->dev_id; @@ -637,29 +637,29 @@ void vlan_dev_uninit(struct net_device *dev) }
static void vlan_dev_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; __DECLARE_NETDEV_FEATURE_MASK(lower_features); __DECLARE_NETDEV_FEATURE_MASK(old_features); __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_copy(&tmp, real_dev->vlan_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &tmp); - netdev_feature_copy(&old_features, *features); - netdev_intersect_features(&lower_features, tmp, real_dev->features); + netdev_feature_copy(tmp, real_dev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, tmp); + netdev_feature_copy(old_features, features); + netdev_intersect_features(lower_features, tmp, real_dev->features);
/* Add HW_CSUM setting to preserve user ability to control * checksum offload on the vlan device. */ if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, lower_features)) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &lower_features); - netdev_intersect_features(features, *features, lower_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, lower_features); + netdev_intersect_features(features, features, lower_features);
netdev_feature_and_bits(NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE, - &old_features); - netdev_feature_or(features, *features, old_features); + old_features); + netdev_feature_or(features, features, old_features); netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index c9894b9..bb6984a 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -288,7 +288,7 @@ static int br_get_link_ksettings(struct net_device *dev, return 0; }
-static void br_fix_features(struct net_device *dev, netdev_features_t *features) +static void br_fix_features(struct net_device *dev, netdev_features_t features) { struct net_bridge *br = netdev_priv(dev);
@@ -490,17 +490,17 @@ void br_dev_setup(struct net_device *dev) SET_NETDEV_DEVTYPE(dev, &br_type); dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->features); - netdev_feature_zero(&dev->hw_features); + dev->features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX, &dev->hw_features); - netdev_feature_zero(&dev->vlan_features); - netdev_feature_set_bits(COMMON_FEATURES, &dev->vlan_features); + NETIF_F_HW_VLAN_STAG_TX, dev->hw_features); + netdev_feature_zero(dev->vlan_features); + netdev_feature_set_bits(COMMON_FEATURES, dev->vlan_features);
br->dev = dev; spin_lock_init(&br->lock); diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 5cf6837..8bd2768 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -532,7 +532,7 @@ static void br_set_gso_limits(struct net_bridge *br) /* * Recomputes features using slave's features */ -void br_features_recompute(struct net_bridge *br, netdev_features_t *features) +void br_features_recompute(struct net_bridge *br, netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(mask); struct net_bridge_port *p; @@ -540,11 +540,11 @@ void br_features_recompute(struct net_bridge *br, netdev_features_t *features) if (list_empty(&br->port_list)) return;
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(mask, features); netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features);
list_for_each_entry(p, &br->port_list, list) { - netdev_increment_features(features, *features, p->dev->features, + netdev_increment_features(features, features, p->dev->features, mask); } netdev_add_tso_features(features, mask); diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 241361c..63a00ee 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -809,7 +809,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, struct netlink_ext_ack *extack); int br_del_if(struct net_bridge *br, struct net_device *dev); void br_mtu_auto_adjust(struct net_bridge *br); -void br_features_recompute(struct net_bridge *br, netdev_features_t *features); +void br_features_recompute(struct net_bridge *br, netdev_features_t features); void br_port_flags_change(struct net_bridge_port *port, unsigned long mask); void br_manage_promisc(struct net_bridge *br); int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev); diff --git a/net/core/dev.c b/net/core/dev.c index fcbffe7..a72758a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1636,7 +1636,7 @@ void dev_disable_lro(struct net_device *dev) struct net_device *lower_dev; struct list_head *iter;
- netdev_feature_clear_bit(NETIF_F_LRO_BIT, &dev->wanted_features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, dev->wanted_features); netdev_update_features(dev);
if (unlikely(netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features))) @@ -1657,7 +1657,7 @@ EXPORT_SYMBOL(dev_disable_lro); */ static void dev_disable_gro_hw(struct net_device *dev) { - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->wanted_features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, dev->wanted_features); netdev_update_features(dev);
if (unlikely(netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, @@ -3383,15 +3383,15 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, __DECLARE_NETDEV_FEATURE_MASK(partial_features); struct net_device *dev = skb->dev;
- netdev_feature_and(&partial_features, dev->features, + netdev_feature_and(partial_features, dev->features, dev->gso_partial_features); netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, - &partial_features); - netdev_feature_or(&partial_features, partial_features, + partial_features); + netdev_feature_or(partial_features, partial_features, features); if (!skb_gso_ok(skb, partial_features)) netdev_feature_clear_bit(NETIF_F_GSO_PARTIAL_BIT, - &features); + features); }
BUILD_BUG_ON(SKB_GSO_CB_OFFSET + @@ -3450,21 +3450,21 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb) * instead of standard features for the netdev. */ #if IS_ENABLED(CONFIG_NET_MPLS_GSO) -static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, +static void net_mpls_features(struct sk_buff *skb, netdev_features_t features, __be16 type) { if (eth_p_mpls(type)) - netdev_feature_and(features, *features, + netdev_feature_and(features, features, skb->dev->mpls_features); } #else -static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, +static void net_mpls_features(struct sk_buff *skb, netdev_features_t features, __be16 type) { } #endif
-static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) +static void harmonize_features(struct sk_buff *skb, netdev_features_t features) { __be16 type;
@@ -3472,7 +3472,7 @@ static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) net_mpls_features(skb, features, type);
if (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(*features, type)) { + !can_checksum_protocol(features, type)) { netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, features); } @@ -3481,21 +3481,21 @@ static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) }
void passthru_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { } EXPORT_SYMBOL(passthru_features_check);
static void dflt_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); }
static void gso_features_check(const struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { u16 gso_segs = skb_shinfo(skb)->gso_segs;
@@ -3517,7 +3517,7 @@ static void gso_features_check(const struct sk_buff *skb, * segmented the frame. */ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL)) - netdev_feature_andnot(features, *features, + netdev_feature_andnot(features, features, dev->gso_partial_features);
/* Make sure to clear the IPv4 ID mangling feature if the @@ -3533,7 +3533,7 @@ static void gso_features_check(const struct sk_buff *skb, } }
-void netif_skb_features(struct sk_buff *skb, netdev_features_t *features) +void netif_skb_features(struct sk_buff *skb, netdev_features_t features) { struct net_device *dev = skb->dev;
@@ -3547,15 +3547,15 @@ void netif_skb_features(struct sk_buff *skb, netdev_features_t *features) * features for the netdev */ if (skb->encapsulation) - netdev_feature_and(features, *features, dev->hw_enc_features); + netdev_feature_and(features, features, dev->hw_enc_features);
if (skb_vlan_tagged(skb)) { netdev_features_t tmp;
- netdev_feature_copy(&tmp, dev->vlan_features); + netdev_feature_copy(tmp, dev->vlan_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX_BIT | - NETIF_F_HW_VLAN_STAG_TX_BIT, &tmp); - netdev_intersect_features(features, *features, tmp); + NETIF_F_HW_VLAN_STAG_TX_BIT, tmp); + netdev_intersect_features(features, features, tmp); }
if (dev->netdev_ops->ndo_features_check) @@ -3649,7 +3649,7 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device { __DECLARE_NETDEV_FEATURE_MASK(features);
- netif_skb_features(skb, &features); + netif_skb_features(skb, features); skb = validate_xmit_vlan(skb, features); if (unlikely(!skb)) goto out_null; @@ -9789,18 +9789,18 @@ static void net_set_todo(struct net_device *dev)
static void netdev_sync_upper_features(struct net_device *lower, struct net_device *upper, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(upper_disables); int feature_bit;
- netdev_feature_zero(&upper_disables); - netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, &upper_disables); + netdev_feature_zero(upper_disables); + netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, upper_disables);
for_each_netdev_feature(upper_disables, feature_bit) { if (!netdev_feature_test_bit(feature_bit, upper->wanted_features) && - netdev_feature_test_bit(feature_bit, *features)) { + netdev_feature_test_bit(feature_bit, features)) { netdev_dbg(lower, "Dropping feature bit %d, upper dev %s has it off.\n", feature_bit, upper->name); netdev_feature_clear_bit(feature_bit, features); @@ -9814,8 +9814,8 @@ static void netdev_sync_lower_features(struct net_device *upper, __DECLARE_NETDEV_FEATURE_MASK(upper_disables); int feature_bit;
- netdev_feature_zero(&upper_disables); - netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, &upper_disables); + netdev_feature_zero(upper_disables); + netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, upper_disables);
for_each_netdev_feature(upper_disables, feature_bit) { if (!netdev_feature_test_bit(feature_bit, features) && @@ -9823,7 +9823,7 @@ static void netdev_sync_lower_features(struct net_device *upper, netdev_dbg(upper, "Disabling feature bit %d on lower dev %s.\n", feature_bit, lower->name); netdev_feature_clear_bit(feature_bit, - &lower->wanted_features); + lower->wanted_features); __netdev_update_features(lower);
if (unlikely(netdev_feature_test_bit(feature_bit, @@ -9837,103 +9837,103 @@ static void netdev_sync_lower_features(struct net_device *upper, }
static void netdev_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* Fix illegal checksum combinations */ - if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features) && (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - *features))) { + features))) { netdev_warn(dev, "mixed HW and IP checksum settings.\n"); netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, features); }
/* TSO requires that SG is present as well. */ - if (netdev_feature_test_bits(NETIF_F_ALL_TSO, *features) && - !netdev_feature_test_bit(NETIF_F_SG_BIT, *features)) { + if (netdev_feature_test_bits(NETIF_F_ALL_TSO, features) && + !netdev_feature_test_bit(NETIF_F_SG_BIT, features)) { netdev_dbg(dev, "Dropping TSO features since no SG feature.\n"); netdev_feature_clear_bits(NETIF_F_ALL_TSO, features); }
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, features) && + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features) && + !netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features)) { netdev_dbg(dev, "Dropping TSO features since no CSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, features); }
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, features) && + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features) && + !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features)) { netdev_dbg(dev, "Dropping TSO6 features since no CSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features); }
/* TSO with IPv4 ID mangling requires IPv4 TSO be enabled */ - if (netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_TSO_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features) && + !netdev_feature_test_bit(NETIF_F_TSO_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_MANGLEID_BIT, features);
/* TSO ECN requires that TSO is present as well. */ - if (netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, features) && !netdev_feature_test_bits(NETIF_F_ALL_TSO & ~NETIF_F_TSO_ECN, - *features)) + features)) netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, features);
/* Software GSO depends on SG. */ - if (netdev_feature_test_bit(NETIF_F_GSO_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_SG_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_GSO_BIT, features) && + !netdev_feature_test_bit(NETIF_F_SG_BIT, features)) { netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n"); netdev_feature_clear_bit(NETIF_F_GSO_BIT, features); }
/* GSO partial features require GSO partial be set */ - if (netdev_feature_intersects(*features, dev->gso_partial_features) && - !netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, *features)) { + if (netdev_feature_intersects(features, dev->gso_partial_features) && + !netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, features)) { netdev_dbg(dev, "Dropping partially supported GSO features since no GSO partial.\n"); - netdev_feature_andnot(features, *features, + netdev_feature_andnot(features, features, dev->gso_partial_features); }
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { /* NETIF_F_GRO_HW implies doing RXCSUM since every packet * successfully merged by hardware must also have the * checksum verified by hardware. If the user does not * want to enable RXCSUM, logically, we should disable GRO_HW. */ - if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) { netdev_dbg(dev, "Dropping NETIF_F_GRO_HW since no RXCSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); } }
/* LRO/HW-GRO features cannot be combined with RX-FCS */ - if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, *features)) { - if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, features)) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { netdev_dbg(dev, "Dropping LRO feature since RX-FCS is requested.\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
- if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) { netdev_dbg(dev, "Dropping HW-GRO feature since RX-FCS is requested.\n"); netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); } }
- if (netdev_feature_test_bit(NETIF_F_HW_TLS_TX_BIT, *features)) { - if (!netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, *features) || - !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features) || - !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_HW_TLS_TX_BIT, features)) { + if (!netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features) || + !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features) || + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features)) { netdev_dbg(dev, "Dropping TLS TX HW offload feature since no CSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_HW_TLS_TX_BIT, features); } }
- if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, features) && + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { netdev_dbg(dev, "Dropping TLS RX HW offload feature since no RXCSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_HW_TLS_RX_BIT, features); } @@ -9948,23 +9948,24 @@ int __netdev_update_features(struct net_device *dev)
ASSERT_RTNL();
- netdev_get_wanted_features(dev, &features); + netdev_get_wanted_features(dev, features);
if (dev->netdev_ops->ndo_fix_features) - dev->netdev_ops->ndo_fix_features(dev, &features); + dev->netdev_ops->ndo_fix_features(dev, features);
/* driver might be less strict about feature dependencies */ - netdev_fix_features(dev, &features); + netdev_fix_features(dev, features);
/* some features can't be enabled if they're off on an upper device */ netdev_for_each_upper_dev_rcu(dev, upper, iter) - netdev_sync_upper_features(dev, upper, &features); + netdev_sync_upper_features(dev, upper, features);
if (netdev_feature_equal(dev->features, features)) goto sync_lower;
- netdev_dbg(dev, "Features changed: %pNF -> %pNF\n", - &dev->features, &features); + netdev_dbg(dev, "Features changed: %*pb -> %*pb\n", + NETDEV_FEATURE_COUNT, dev->features, + NETDEV_FEATURE_COUNT, features);
if (dev->netdev_ops->ndo_set_features) err = dev->netdev_ops->ndo_set_features(dev, features); @@ -9973,8 +9974,9 @@ int __netdev_update_features(struct net_device *dev)
if (unlikely(err < 0)) { netdev_err(dev, - "set_features() failed (%d); wanted %pNF, left %pNF\n", - err, &features, &dev->features); + "set_features() failed (%d); wanted %*pb, left %*pb\n", + err, NETDEV_FEATURE_COUNT, features, + NETDEV_FEATURE_COUNT, dev->features); /* return non-0 since some features might have changed and * it's better to fire a spurious notification than miss it */ @@ -9991,7 +9993,7 @@ int __netdev_update_features(struct net_device *dev) if (!err) { __DECLARE_NETDEV_FEATURE_MASK(diff);
- netdev_feature_xor(&diff, features, dev->features); + netdev_feature_xor(diff, features, dev->features);
if (netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, diff)) { /* udp_tunnel_{get,drop}_rx_info both need @@ -10003,7 +10005,7 @@ int __netdev_update_features(struct net_device *dev) */ if (netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, features)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); udp_tunnel_get_rx_info(dev); } else { udp_tunnel_drop_rx_info(dev); @@ -10013,7 +10015,7 @@ int __netdev_update_features(struct net_device *dev) if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, diff)) { if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); err |= vlan_get_rx_ctag_filter_info(dev); } else { vlan_drop_rx_ctag_filter_info(dev); @@ -10023,14 +10025,14 @@ int __netdev_update_features(struct net_device *dev) if (netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, diff)) { if (netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, features)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); err |= vlan_get_rx_stag_filter_info(dev); } else { vlan_drop_rx_stag_filter_info(dev); } }
- netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); }
return err < 0 ? 0 : 1; @@ -10277,22 +10279,22 @@ int register_netdevice(struct net_device *dev) * software offloads (GSO and GRO). */ netdev_feature_set_bits(NETIF_F_SOFT_FEATURES | NETIF_F_SOFT_FEATURES_OFF, - &dev->hw_features); - netdev_feature_set_bits(NETIF_F_SOFT_FEATURES, &dev->features); + dev->hw_features); + netdev_feature_set_bits(NETIF_F_SOFT_FEATURES, dev->features);
if (dev->udp_tunnel_nic_info) { netdev_feature_set_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, - &dev->features); + dev->features); netdev_feature_set_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, - &dev->hw_features); + dev->hw_features); }
- netdev_feature_and(&dev->wanted_features, dev->features, + netdev_feature_and(dev->wanted_features, dev->features, dev->hw_features);
if (!(dev->flags & IFF_LOOPBACK)) netdev_feature_set_bit(NETIF_F_NOCACHE_COPY_BIT, - &dev->hw_features); + dev->hw_features);
/* If IPv4 TCP segmentation offload is supported we should also * allow the device to enable segmenting the frame with the option @@ -10301,29 +10303,29 @@ int register_netdevice(struct net_device *dev) */ if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->hw_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->hw_features); + dev->hw_features); if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->vlan_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->vlan_features); + dev->vlan_features); if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->mpls_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->mpls_features); + dev->mpls_features); if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->hw_enc_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->hw_enc_features); + dev->hw_enc_features);
/* Make NETIF_F_HIGHDMA inheritable to VLAN devices. */ - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->vlan_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->vlan_features);
/* Make NETIF_F_SG inheritable to tunnel devices. */ netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO_PARTIAL, - &dev->hw_enc_features); + dev->hw_enc_features);
/* Make NETIF_F_SG inheritable to MPLS. */ - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->mpls_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->mpls_features);
ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev); ret = notifier_to_errno(ret); @@ -11358,29 +11360,29 @@ static int dev_cpu_dead(unsigned int oldcpu) * @one to the master device with current feature set @all. Will not * enable anything that is off in @mask. Returns the new feature set. */ -void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, +void netdev_increment_features(netdev_features_t ret, netdev_features_t all, netdev_features_t one, netdev_features_t mask) { __DECLARE_NETDEV_FEATURE_MASK(tmp);
if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, mask)) - netdev_feature_set_bits(NETIF_F_CSUM_MASK, &mask); - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &mask); + netdev_feature_set_bits(NETIF_F_CSUM_MASK, mask); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, mask);
netdev_feature_copy(ret, all); - netdev_feature_zero(&tmp); - netdev_feature_set_bits(NETIF_F_ONE_FOR_ALL | NETIF_F_CSUM_MASK, &tmp); - netdev_feature_and(&tmp, tmp, one); - netdev_feature_and(&tmp, tmp, mask); - netdev_feature_or(ret, *ret, tmp); + netdev_feature_zero(tmp); + netdev_feature_set_bits(NETIF_F_ONE_FOR_ALL | NETIF_F_CSUM_MASK, tmp); + netdev_feature_and(tmp, tmp, one); + netdev_feature_and(tmp, tmp, mask); + netdev_feature_or(ret, ret, tmp);
- netdev_feature_fill(&tmp); - netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &tmp); - netdev_feature_or(&tmp, tmp, one); - netdev_feature_and(ret, *ret, tmp); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, tmp); + netdev_feature_or(tmp, tmp, one); + netdev_feature_and(ret, ret, tmp);
/* If one device supports hw checksumming, set for all. */ - if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *ret)) + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, ret)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK & ~NETIF_F_HW_CSUM, ret); } diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 83cfc0c..8764ec8 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -77,7 +77,7 @@ static netdev_tx_t netpoll_start_xmit(struct sk_buff *skb, __DECLARE_NETDEV_FEATURE_MASK(features); netdev_tx_t status = NETDEV_TX_OK;
- netif_skb_features(skb, &features); + netif_skb_features(skb, features);
if (skb_vlan_tag_present(skb) && !vlan_hw_offload_capable(features, skb->vlan_proto)) { diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b41bfd0..d7a4021 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3993,7 +3993,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)) - netdev_feature_clear_bit(NETIF_F_SG_BIT, &features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, features); }
__skb_push(head_skb, doffset); diff --git a/net/core/sock.c b/net/core/sock.c index 11c04a6..6ed7f25 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2146,20 +2146,20 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) u32 max_segs = 1;
sk_dst_set(sk, dst); - netdev_feature_or(&sk->sk_route_caps, dst->dev->features, + netdev_feature_or(sk->sk_route_caps, dst->dev->features, sk->sk_route_forced_caps); if (netdev_feature_test_bit(NETIF_F_GSO_BIT, sk->sk_route_caps)) netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &sk->sk_route_caps); - netdev_feature_andnot(&sk->sk_route_caps, sk->sk_route_caps, + sk->sk_route_caps); + netdev_feature_andnot(sk->sk_route_caps, sk->sk_route_caps, sk->sk_route_nocaps); if (sk_can_gso(sk)) { if (dst->header_len && !xfrm_dst_offload_ok(dst)) { netdev_feature_clear_bits(NETIF_F_GSO_MASK, - &sk->sk_route_caps); + sk->sk_route_caps); } else { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &sk->sk_route_caps); + sk->sk_route_caps); sk->sk_gso_max_size = dst->dev->gso_max_size; max_segs = max_t(u32, dst->dev->gso_max_segs, 1); } diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 8ddfed4..c665fa4 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1815,16 +1815,16 @@ void dsa_slave_setup_tagger(struct net_device *slave)
p->xmit = cpu_dp->tag_ops->xmit;
- netdev_feature_copy(&slave->features, master->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->features); + netdev_feature_copy(slave->features, master->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, slave->features); if (ds->ops->port_vlan_add && ds->ops->port_vlan_del) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &slave->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->hw_features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &slave->features); + slave->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, slave->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, slave->features); if (slave->needed_tailroom) netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_FRAGLIST, - &slave->features); + slave->features); }
static struct lock_class_key dsa_slave_netdev_xmit_lock_key; @@ -1903,7 +1903,7 @@ int dsa_slave_create(struct dsa_port *port)
SET_NETDEV_DEV(slave_dev, port->ds->dev); slave_dev->dev.of_node = port->dn; - netdev_feature_copy(&slave_dev->features, master->vlan_features); + netdev_feature_copy(slave_dev->features, master->vlan_features);
p = netdev_priv(slave_dev); slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); diff --git a/net/ethtool/features.c b/net/ethtool/features.c index 93c6238..dd231c1 100644 --- a/net/ethtool/features.c +++ b/net/ethtool/features.c @@ -27,10 +27,7 @@ const struct nla_policy ethnl_features_get_policy[] = {
static void ethnl_features_to_bitmap32(u32 *dest, netdev_features_t src) { - unsigned int i; - - for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; i++) - dest[i] = src >> (32 * i); + bitmap_to_arr32(dest, src, NETDEV_FEATURE_COUNT); }
static int features_prepare_data(const struct ethnl_req_info *req_base, @@ -38,14 +35,17 @@ static int features_prepare_data(const struct ethnl_req_info *req_base, struct genl_info *info) { struct features_reply_data *data = FEATURES_REPDATA(reply_base); + __DECLARE_NETDEV_FEATURE_MASK(nochange_features); __DECLARE_NETDEV_FEATURE_MASK(all_features); struct net_device *dev = reply_base->dev;
ethnl_features_to_bitmap32(data->hw, dev->hw_features); ethnl_features_to_bitmap32(data->wanted, dev->wanted_features); ethnl_features_to_bitmap32(data->active, dev->features); - ethnl_features_to_bitmap32(data->nochange, NETIF_F_NEVER_CHANGE); - all_features = GENMASK_ULL(NETDEV_FEATURE_COUNT - 1, 0); + netdev_feature_zero(nochange_features); + netdev_feature_set_bits(NETIF_F_NEVER_CHANGE, nochange_features); + ethnl_features_to_bitmap32(data->nochange, nochange_features); + netdev_feature_fill(all_features); ethnl_features_to_bitmap32(data->all, all_features);
return 0; @@ -131,29 +131,6 @@ const struct nla_policy ethnl_features_set_policy[] = { [ETHTOOL_A_FEATURES_WANTED] = { .type = NLA_NESTED }, };
-static void ethnl_features_to_bitmap(unsigned long *dest, netdev_features_t val) -{ - const unsigned int words = BITS_TO_LONGS(NETDEV_FEATURE_COUNT); - unsigned int i; - - bitmap_zero(dest, NETDEV_FEATURE_COUNT); - for (i = 0; i < words; i++) - dest[i] = (unsigned long)(val >> (i * BITS_PER_LONG)); -} - -static netdev_features_t ethnl_bitmap_to_features(unsigned long *src) -{ - const unsigned int nft_bits = sizeof(netdev_features_t) * BITS_PER_BYTE; - const unsigned int words = BITS_TO_LONGS(NETDEV_FEATURE_COUNT); - netdev_features_t ret = 0; - unsigned int i; - - for (i = 0; i < words; i++) - ret |= (netdev_features_t)(src[i]) << (i * BITS_PER_LONG); - ret &= ~(netdev_features_t)0 >> (nft_bits - NETDEV_FEATURE_COUNT); - return ret; -} - static int features_send_reply(struct net_device *dev, struct genl_info *info, const unsigned long *wanted, const unsigned long *wanted_mask, @@ -210,14 +187,15 @@ static int features_send_reply(struct net_device *dev, struct genl_info *info,
int ethnl_set_features(struct sk_buff *skb, struct genl_info *info) { - DECLARE_BITMAP(wanted_diff_mask, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(active_diff_mask, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(old_active, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(old_wanted, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(new_active, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(new_wanted, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(req_wanted, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(req_mask, NETDEV_FEATURE_COUNT); + __DECLARE_NETDEV_FEATURE_MASK(wanted_diff_mask); + __DECLARE_NETDEV_FEATURE_MASK(active_diff_mask); + __DECLARE_NETDEV_FEATURE_MASK(old_active); + __DECLARE_NETDEV_FEATURE_MASK(old_wanted); + __DECLARE_NETDEV_FEATURE_MASK(new_active); + __DECLARE_NETDEV_FEATURE_MASK(new_wanted); + __DECLARE_NETDEV_FEATURE_MASK(req_wanted); + __DECLARE_NETDEV_FEATURE_MASK(req_mask); + __DECLARE_NETDEV_FEATURE_MASK(tmp); struct ethnl_req_info req_info = {}; struct nlattr **tb = info->attrs; struct net_device *dev; @@ -235,45 +213,43 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info) dev = req_info.dev;
rtnl_lock(); - ethnl_features_to_bitmap(old_active, dev->features); - ethnl_features_to_bitmap(old_wanted, dev->wanted_features); + netdev_feature_copy(old_active, dev->features); + netdev_feature_copy(old_wanted, dev->wanted_features); ret = ethnl_parse_bitset(req_wanted, req_mask, NETDEV_FEATURE_COUNT, tb[ETHTOOL_A_FEATURES_WANTED], netdev_features_strings, info->extack); if (ret < 0) goto out_rtnl; - if (ethnl_bitmap_to_features(req_mask) & ~NETIF_F_ETHTOOL_BITS) { + if (netdev_feature_test_bits(NETIF_F_NEVER_CHANGE, req_mask)) { GENL_SET_ERR_MSG(info, "attempt to change non-ethtool features"); ret = -EINVAL; goto out_rtnl; }
/* set req_wanted bits not in req_mask from old_wanted */ - bitmap_and(req_wanted, req_wanted, req_mask, NETDEV_FEATURE_COUNT); - bitmap_andnot(new_wanted, old_wanted, req_mask, NETDEV_FEATURE_COUNT); - bitmap_or(req_wanted, new_wanted, req_wanted, NETDEV_FEATURE_COUNT); - if (!bitmap_equal(req_wanted, old_wanted, NETDEV_FEATURE_COUNT)) { - dev->wanted_features &= ~dev->hw_features; - dev->wanted_features |= ethnl_bitmap_to_features(req_wanted) & dev->hw_features; + netdev_feature_and(req_wanted, req_wanted, req_mask); + netdev_feature_andnot(new_wanted, old_wanted, req_mask); + netdev_feature_or(req_wanted, new_wanted, req_wanted); + if (!netdev_feature_equal(req_wanted, old_wanted)) { + netdev_feature_andnot(dev->wanted_features, + dev->wanted_features, dev->hw_features); + netdev_feature_and(tmp, req_wanted, dev->hw_features); + netdev_feature_or(dev->wanted_features, dev->wanted_features, + tmp); __netdev_update_features(dev); } - ethnl_features_to_bitmap(new_active, dev->features); - mod = !bitmap_equal(old_active, new_active, NETDEV_FEATURE_COUNT); + mod = !netdev_feature_equal(old_active, new_active);
ret = 0; if (!(req_info.flags & ETHTOOL_FLAG_OMIT_REPLY)) { bool compact = req_info.flags & ETHTOOL_FLAG_COMPACT_BITSETS;
- bitmap_xor(wanted_diff_mask, req_wanted, new_active, - NETDEV_FEATURE_COUNT); - bitmap_xor(active_diff_mask, old_active, new_active, - NETDEV_FEATURE_COUNT); - bitmap_and(wanted_diff_mask, wanted_diff_mask, req_mask, - NETDEV_FEATURE_COUNT); - bitmap_and(req_wanted, req_wanted, wanted_diff_mask, - NETDEV_FEATURE_COUNT); - bitmap_and(new_active, new_active, active_diff_mask, - NETDEV_FEATURE_COUNT); + netdev_feature_xor(wanted_diff_mask, req_wanted, new_active); + netdev_feature_xor(active_diff_mask, old_active, new_active); + netdev_feature_and(wanted_diff_mask, wanted_diff_mask, + req_mask); + netdev_feature_and(req_wanted, req_wanted, wanted_diff_mask); + netdev_feature_and(new_active, new_active, active_diff_mask);
ret = features_send_reply(dev, info, req_wanted, wanted_diff_mask, new_active, diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index a51cd59..6e6e6d6 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -64,6 +64,11 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) .size = ETHTOOL_DEV_FEATURE_WORDS, }; struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS]; + __DECLARE_NETDEV_FEATURE_MASK(nochange_features); + u32 nochange[ETHTOOL_DEV_FEATURE_WORDS]; + u32 wanted[ETHTOOL_DEV_FEATURE_WORDS]; + u32 active[ETHTOOL_DEV_FEATURE_WORDS]; + u32 hw[ETHTOOL_DEV_FEATURE_WORDS]; u32 __user *sizeaddr; u32 copy_size; int i; @@ -71,12 +76,17 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) /* in case feature bits run out again */ BUILD_BUG_ON(ETHTOOL_DEV_FEATURE_WORDS * sizeof(u32) > sizeof(netdev_features_t));
+ bitmap_to_arr32(hw, dev->hw_features, NETDEV_FEATURE_COUNT); + bitmap_to_arr32(wanted, dev->wanted_features, NETDEV_FEATURE_COUNT); + bitmap_to_arr32(active, dev->features, NETDEV_FEATURE_COUNT); + netdev_feature_zero(nochange_features); + netdev_feature_set_bits(NETIF_F_NEVER_CHANGE, nochange_features); + bitmap_to_arr32(nochange, nochange_features, NETDEV_FEATURE_COUNT); for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) { - features[i].available = (u32)(dev->hw_features >> (32 * i)); - features[i].requested = (u32)(dev->wanted_features >> (32 * i)); - features[i].active = (u32)(dev->features >> (32 * i)); - features[i].never_changed = - (u32)(NETIF_F_NEVER_CHANGE >> (32 * i)); + features[i].available = hw[i]; + features[i].requested = wanted[i]; + features[i].active = active[i]; + features[i].never_changed = nochange[i]; }
sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size); @@ -99,7 +109,12 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr) { struct ethtool_sfeatures cmd; struct ethtool_set_features_block features[ETHTOOL_DEV_FEATURE_WORDS]; - netdev_features_t wanted = 0, valid = 0; + u32 requested_arr[ETHTOOL_DEV_FEATURE_WORDS]; + u32 valid_arr[ETHTOOL_DEV_FEATURE_WORDS]; + __DECLARE_NETDEV_FEATURE_MASK(nochange); + __DECLARE_NETDEV_FEATURE_MASK(wanted); + __DECLARE_NETDEV_FEATURE_MASK(valid); + __DECLARE_NETDEV_FEATURE_MASK(tmp); int i, ret = 0;
if (copy_from_user(&cmd, useraddr, sizeof(cmd))) @@ -112,24 +127,35 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr) if (copy_from_user(features, useraddr, sizeof(features))) return -EFAULT;
+ netdev_feature_zero(wanted); + netdev_feature_zero(valid); for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) { - valid |= (netdev_features_t)features[i].valid << (32 * i); - wanted |= (netdev_features_t)features[i].requested << (32 * i); + requested_arr[i] = features[i].requested; + valid_arr[i] = features[i].valid; } + bitmap_from_arr32(wanted, requested_arr, NETDEV_FEATURE_COUNT); + bitmap_from_arr32(valid, valid_arr, NETDEV_FEATURE_COUNT);
- if (valid & ~NETIF_F_ETHTOOL_BITS) + netdev_feature_zero(nochange); + netdev_feature_set_bits(NETIF_F_NEVER_CHANGE, nochange); + if (netdev_feature_intersects(valid, nochange)) return -EINVAL;
- if (valid & ~dev->hw_features) { - valid &= dev->hw_features; + netdev_feature_andnot(tmp, valid, dev->hw_features); + if (!netdev_feature_empty(tmp)) { + netdev_feature_and(valid, valid, dev->hw_features); ret |= ETHTOOL_F_UNSUPPORTED; }
- dev->wanted_features &= ~valid; - dev->wanted_features |= wanted & valid; + netdev_feature_andnot(dev->wanted_features, dev->wanted_features, + valid); + netdev_feature_and(tmp, wanted, valid); + netdev_feature_or(dev->wanted_features, dev->wanted_features, tmp); __netdev_update_features(dev);
- if ((dev->wanted_features ^ dev->features) & valid) + netdev_feature_xor(tmp, dev->wanted_features, dev->features); + netdev_feature_and(tmp, tmp, valid); + if (!netdev_feature_empty(tmp)) ret |= ETHTOOL_F_WISH;
return ret; @@ -194,34 +220,35 @@ static void __ethtool_get_strings(struct net_device *dev, ops->get_strings(dev, stringset, data); }
-static void ethtool_get_feature_mask(u32 eth_cmd, netdev_features_t *mask) +static void ethtool_get_feature_mask(u32 eth_cmd, netdev_features_t mask) { /* feature masks of legacy discrete ethtool ops */ - + netdev_feature_zero(mask); switch (eth_cmd) { case ETHTOOL_GTXCSUM: case ETHTOOL_STXCSUM: - *mask = NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC | NETIF_F_SCTP_CRC; + netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC | + NETIF_F_SCTP_CRC, mask); break; case ETHTOOL_GRXCSUM: case ETHTOOL_SRXCSUM: - *mask = NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, mask); break; case ETHTOOL_GSG: case ETHTOOL_SSG: - *mask = NETIF_F_SG | NETIF_F_FRAGLIST; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, mask); break; case ETHTOOL_GTSO: case ETHTOOL_STSO: - *mask = NETIF_F_ALL_TSO; + netdev_feature_set_bits(NETIF_F_ALL_TSO, mask); break; case ETHTOOL_GGSO: case ETHTOOL_SGSO: - *mask = NETIF_F_GSO; + netdev_feature_set_bit(NETIF_F_GSO_BIT, mask); break; case ETHTOOL_GGRO: case ETHTOOL_SGRO: - *mask = NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_GRO_BIT, mask); break; default: BUG(); @@ -234,9 +261,9 @@ static int ethtool_get_one_feature(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(mask); struct ethtool_value edata;
- ethtool_get_feature_mask(ethcmd, &mask); + ethtool_get_feature_mask(ethcmd, mask); edata.cmd = ethcmd; - edata.data = !!(dev->features & mask); + edata.data = netdev_feature_intersects(dev->features, mask);
if (copy_to_user(useraddr, &edata, sizeof(edata))) return -EFAULT; @@ -252,15 +279,17 @@ static int ethtool_set_one_feature(struct net_device *dev, if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT;
- ethtool_get_feature_mask(ethcmd, &mask); - mask &= dev->hw_features; - if (!mask) + ethtool_get_feature_mask(ethcmd, mask); + netdev_feature_and(mask, mask, dev->hw_features); + if (netdev_feature_empty(mask)) return -EOPNOTSUPP;
if (edata.data) - dev->wanted_features |= mask; + netdev_feature_and(dev->wanted_features, dev->wanted_features, + mask); else - dev->wanted_features &= ~mask; + netdev_feature_andnot(dev->wanted_features, + dev->wanted_features, mask);
__netdev_update_features(dev);
@@ -277,15 +306,17 @@ static u32 __ethtool_get_flags(struct net_device *dev) { u32 flags = 0;
- if (dev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) flags |= ETH_FLAG_LRO; - if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features)) flags |= ETH_FLAG_RXVLAN; - if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + dev->features)) flags |= ETH_FLAG_TXVLAN; - if (dev->features & NETIF_F_NTUPLE) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, dev->features)) flags |= ETH_FLAG_NTUPLE; - if (dev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, dev->features)) flags |= ETH_FLAG_RXHASH;
return flags; @@ -293,29 +324,38 @@ static u32 __ethtool_get_flags(struct net_device *dev)
static int __ethtool_set_flags(struct net_device *dev, u32 data) { - netdev_features_t features = 0, changed; + __DECLARE_NETDEV_FEATURE_MASK(features); + __DECLARE_NETDEV_FEATURE_MASK(changed); + __DECLARE_NETDEV_FEATURE_MASK(tmp);
if (data & ~ETH_ALL_FLAGS) return -EINVAL;
+ netdev_feature_zero(features); + if (data & ETH_FLAG_LRO) - features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, features); if (data & ETH_FLAG_RXVLAN) - features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features); if (data & ETH_FLAG_TXVLAN) - features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); if (data & ETH_FLAG_NTUPLE) - features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, features); if (data & ETH_FLAG_RXHASH) - features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, features);
/* allow changing only bits set in hw_features */ - changed = (features ^ dev->features) & ETH_ALL_FEATURES; - if (changed & ~dev->hw_features) - return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP; - - dev->wanted_features = - (dev->wanted_features & ~changed) | (features & changed); + netdev_feature_xor(changed, features, dev->features); + netdev_feature_and_bits(ETH_ALL_FEATURES, changed); + netdev_feature_andnot(tmp, changed, dev->hw_features); + if (!netdev_feature_empty(tmp)) + return netdev_feature_intersects(changed, dev->hw_features) ? + -EINVAL : -EOPNOTSUPP; + + netdev_feature_andnot(dev->wanted_features, dev->wanted_features, + changed); + netdev_feature_and(tmp, features, changed); + netdev_feature_or(dev->wanted_features, dev->wanted_features, tmp);
__netdev_update_features(dev);
@@ -2768,7 +2808,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr) if (rc < 0) goto out; } - old_features = dev->features; + netdev_feature_copy(old_features, dev->features);
switch (ethcmd) { case ETHTOOL_GSET: @@ -2983,7 +3023,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr) if (dev->ethtool_ops->complete) dev->ethtool_ops->complete(dev);
- if (old_features != dev->features) + if (!netdev_feature_equal(old_features, dev->features)) netdev_features_change(dev); out: if (dev->dev.parent) diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 7a4c5e7..3bbc438 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -178,12 +178,12 @@ static int hsr_dev_close(struct net_device *dev) }
static void hsr_features_recompute(struct hsr_priv *hsr, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(mask); struct hsr_port *port;
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(&mask, features);
/* Mask out all features that, if supported by one device, should be * enabled for all devices (see NETIF_F_ONE_FOR_ALL). @@ -194,12 +194,12 @@ static void hsr_features_recompute(struct hsr_priv *hsr, */ netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); hsr_for_each_port(hsr, port) - netdev_increment_features(features, *features, + netdev_increment_features(features, features, port->dev->features, mask); }
static void hsr_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct hsr_priv *hsr = netdev_priv(dev);
@@ -449,21 +449,21 @@ void hsr_dev_setup(struct net_device *dev) netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, dev->hw_features);
- netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features);
/* Prevent recursive tx locking */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features);
/* VLAN on top of HSR needs testing and probably some work on * hsr_header_create() etc. */ - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, dev->features); /* Not sure about this. Taken from bridge code. netdev_features.h says * it means "Does not change network namespaces". */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features); }
/* Return true if dev is a HSR master; return false otherwise. diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 80c62ed..b6ec8a9 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1299,7 +1299,7 @@ int inet_sk_rebuild_header(struct sock *sk) err = PTR_ERR(rt);
/* Routing failed... */ - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); /* * Other protocols have to map its equivalent state to TCP_SYN_SENT. * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme @@ -1361,7 +1361,7 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap) - netdev_feature_and(&features, features, + netdev_feature_and(features, features, skb->dev->hw_enc_features); SKB_GSO_CB(skb)->encap_level += ihl;
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c index 0fe1af1..c6a7b46 100644 --- a/net/ipv4/esp4_offload.c +++ b/net/ipv4/esp4_offload.c @@ -214,7 +214,7 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
- netdev_feature_copy(&esp_features, features); + netdev_feature_copy(esp_features, features); if ((!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, skb->dev->gso_partial_features) && !netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features)) || @@ -227,7 +227,7 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, !netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, skb->dev->gso_partial_features)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_SCTP_CRC, - &esp_features); + esp_features);
xo->flags |= XFRM_GSO_SEGMENT;
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index 65f22fa..7b14537 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c @@ -43,10 +43,10 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, need_csum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM); skb->encap_hdr_csum = need_csum;
- netdev_feature_and(&features, features, skb->dev->hw_enc_features); + netdev_feature_and(features, features, skb->dev->hw_enc_features);
if (need_csum) - netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, &features); + netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, features);
need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb)); /* Try to offload checksum if possible */ diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 9cf14d3..1045382 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -763,21 +763,21 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || tunnel->encap.type == TUNNEL_ENCAP_NONE) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); } else { netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); } - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); } else { netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); netdev_feature_clear_bits(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); } }
@@ -959,8 +959,8 @@ static void __gre_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph);
- netdev_feature_set_bits(GRE_FEATURES, &dev->features); - netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features); + netdev_feature_set_bits(GRE_FEATURES, dev->features); + netdev_feature_set_bits(GRE_FEATURES, dev->hw_features);
if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { /* TCP offload with GRE SEQ is not supported, nor @@ -970,15 +970,15 @@ static void __gre_tunnel_init(struct net_device *dev) if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || (tunnel->encap.type == TUNNEL_ENCAP_NONE)) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); }
/* Can use a lockless transmit, unless we generate * output sequences */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); } }
@@ -1306,8 +1306,8 @@ static int erspan_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen + erspan_hdr_len(tunnel->erspan_ver);
- netdev_feature_set_bits(GRE_FEATURES, &dev->features); - netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features); + netdev_feature_set_bits(GRE_FEATURES, dev->features); + netdev_feature_set_bits(GRE_FEATURES, dev->hw_features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; netif_keep_dst(dev);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index f79509b..70488cc 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -255,9 +255,9 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk, * bridged to a NETIF_F_TSO tunnel stacked over an interface with an * insufficient MTU. */ - netif_skb_features(skb, &features); + netif_skb_features(skb, features); BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_GSO_CB_OFFSET); - netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index ac5671e..1ba68f2 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -1073,7 +1073,7 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id, */ if (!IS_ERR(itn->fb_tunnel_dev)) { netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &itn->fb_tunnel_dev->features); + itn->fb_tunnel_dev->features);
itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev); ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev)); diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index bf94ef6..51ce35a 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -430,7 +430,7 @@ static int vti_tunnel_init(struct net_device *dev)
dev->flags = IFF_NOARP; dev->addr_len = 4; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
return ip_tunnel_init(dev); diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index b587d47..1861492 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -368,11 +368,11 @@ static void ipip_tunnel_setup(struct net_device *dev) dev->type = ARPHRD_TUNNEL; dev->flags = IFF_NOARP; dev->addr_len = 4; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
- netdev_feature_set_bits(IPIP_FEATURES, &dev->features); - netdev_feature_set_bits(IPIP_FEATURES, &dev->hw_features); + netdev_feature_set_bits(IPIP_FEATURES, dev->features); + netdev_feature_set_bits(IPIP_FEATURES, dev->hw_features); ip_tunnel_setup(dev, ipip_net_id); }
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 750a4a1..1f8f8d7 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -532,7 +532,7 @@ static void reg_vif_setup(struct net_device *dev) dev->flags = IFF_NOARP; dev->netdev_ops = ®_vif_netdev_ops; dev->needs_free_netdev = true; - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features); }
static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cdcafd5..d2e35c0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -462,8 +462,8 @@ void tcp_init_sock(struct sock *sk) WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]);
sk_sockets_allocated_inc(sk); - netdev_feature_zero(&sk->sk_route_forced_caps); - netdev_feature_set_bit(NETIF_F_GSO_BIT, &sk->sk_route_forced_caps); + netdev_feature_zero(sk->sk_route_forced_caps); + netdev_feature_set_bit(NETIF_F_GSO_BIT, sk->sk_route_forced_caps); } EXPORT_SYMBOL(tcp_init_sock);
@@ -1184,7 +1184,7 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, if (err) { tcp_set_state(sk, TCP_CLOSE); inet->inet_dport = 0; - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); } } flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0; diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f5a8b66..681433e 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -323,7 +323,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) */ tcp_set_state(sk, TCP_CLOSE); ip_rt_put(rt); - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); inet->inet_dport = 0; return err; } diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index 2f4b748..e602df5 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -82,8 +82,8 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, if (unlikely(skb->len <= mss)) goto out;
- netdev_feature_copy(&tmp, features); - netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &tmp); + netdev_feature_copy(tmp, features); + netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, tmp); if (skb_gso_ok(skb, tmp)) { /* Packet is from an untrusted source, reset gso_segs. */
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index ad9bfde..6a14cc3 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -71,18 +71,18 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, NETIF_F_IP_CSUM, skb->dev->features));
- netdev_feature_and(&features, features, skb->dev->hw_enc_features); + netdev_feature_and(features, features, skb->dev->hw_enc_features); if (need_csum) - netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, &features); + netdev_feature_clear_bit(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 * instead set the flag based on our outer checksum offload value. */ if (remcsum) { - netdev_feature_clear_bits(NETIF_F_CSUM_MASK, &features); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features); if (!need_csum || offload_csum) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features); }
/* segment inner packet. */ @@ -418,7 +418,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, * software prior to segmenting the frame. */ if (!skb->encap_hdr_csum) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features);
/* Fragment the skb. IP headers of the fragments are updated in * inet_gso_segment() diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 7b8eb28..cf2fb45 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -833,7 +833,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); if (IS_ERR(dst)) { - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); sk->sk_err_soft = -PTR_ERR(dst); return PTR_ERR(dst); } diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c index 3ce9360..6b98681 100644 --- a/net/ipv6/esp6_offload.c +++ b/net/ipv6/esp6_offload.c @@ -253,14 +253,14 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
- netdev_feature_copy(&esp_features, features); + netdev_feature_copy(esp_features, features); if (!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features) || x->xso.dev != skb->dev) netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_CSUM_MASK | - NETIF_F_SCTP_CRC, &esp_features); + NETIF_F_SCTP_CRC, esp_features); else if (!netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, features)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_SCTP_CRC, - &esp_features); + esp_features);
xo->flags |= XFRM_GSO_SEGMENT;
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 6d83148..7e156bb 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c @@ -121,7 +121,7 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused dst = inet6_csk_route_socket(sk, &fl6); if (IS_ERR(dst)) { sk->sk_err_soft = -PTR_ERR(dst); - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); kfree_skb(skb); return PTR_ERR(dst); } diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 336ddf0..8d053ac 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -385,7 +385,7 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
/* Can use a lockless transmit, unless we generate output sequences */ if (!(nt->parms.o_flags & TUNNEL_SEQ)) - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features);
ip6gre_tunnel_link(ign, nt); return nt; @@ -1439,8 +1439,8 @@ static void ip6gre_tnl_init_features(struct net_device *dev) { struct ip6_tnl *nt = netdev_priv(dev);
- netdev_feature_set_bits(GRE6_FEATURES, &dev->features); - netdev_feature_set_bits(GRE6_FEATURES, &dev->hw_features); + netdev_feature_set_bits(GRE6_FEATURES, dev->features); + netdev_feature_set_bits(GRE6_FEATURES, dev->hw_features);
if (!(nt->parms.o_flags & TUNNEL_SEQ)) { /* TCP offload with GRE SEQ is not supported, nor @@ -1450,15 +1450,15 @@ static void ip6gre_tnl_init_features(struct net_device *dev) if (!(nt->parms.o_flags & TUNNEL_CSUM) || nt->encap.type == TUNNEL_ENCAP_NONE) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); }
/* Can use a lockless transmit, unless we generate * output sequences */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); } }
@@ -1601,7 +1601,7 @@ static int __net_init ip6gre_init_net(struct net *net) * Allowing to move it to another netns is clearly unsafe. */ netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &ign->fb_tunnel_dev->features); + ign->fb_tunnel_dev->features);
ip6gre_fb_tunnel_init(ign->fb_tunnel_dev); diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 4c3ba4b..ee37ff8 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -93,7 +93,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap) - netdev_feature_and(&features, features, + netdev_feature_and(features, features, skb->dev->hw_enc_features); SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 72acb06..40705f5 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -146,8 +146,8 @@ ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk, * describing the cases where GSO segment length exceeds the * egress MTU. */ - netif_skb_features(skb, &features); - netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + netif_skb_features(skb, features); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 72add9a..0d03382 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1833,11 +1833,11 @@ static void ip6_tnl_dev_setup(struct net_device *dev) dev->type = ARPHRD_TUNNEL6; dev->flags |= IFF_NOARP; dev->addr_len = sizeof(struct in6_addr); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
- netdev_feature_set_bits(IPXIPX_FEATURES, &dev->features); - netdev_feature_set_bits(IPXIPX_FEATURES, &dev->hw_features); + netdev_feature_set_bits(IPXIPX_FEATURES, dev->features); + netdev_feature_set_bits(IPXIPX_FEATURES, dev->hw_features);
/* This perm addr will be used as interface identifier by IPv6 */ dev->addr_assign_type = NET_ADDR_RANDOM; @@ -2280,7 +2280,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) * Allowing to move it to another netns is clearly unsafe. */ netdev_feature_set_bits(NETIF_F_NETNS_LOCAL_BIT, - &ip6n->fb_tnl_dev->features); + ip6n->fb_tnl_dev->features);
err = ip6_fb_tnl_dev_init(ip6n->fb_tnl_dev); if (err < 0) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index daf2a4b..f261d27 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -636,7 +636,7 @@ static void reg_vif_setup(struct net_device *dev) dev->flags = IFF_NOARP; dev->netdev_ops = ®_vif_netdev_ops; dev->needs_free_netdev = true; - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features); }
static struct net_device *ip6mr_reg_vif(struct net *net, struct mr_table *mrt) diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 58aa232..32d105c 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1438,9 +1438,9 @@ static void ipip6_tunnel_setup(struct net_device *dev) dev->flags = IFF_NOARP; netif_keep_dst(dev); dev->addr_len = 4; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(SIT_FEATURES, &dev->features); - netdev_feature_set_bits(SIT_FEATURES, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(SIT_FEATURES, dev->features); + netdev_feature_set_bits(SIT_FEATURES, dev->hw_features); }
static int ipip6_tunnel_init(struct net_device *dev) @@ -1919,7 +1919,7 @@ static int __net_init sit_init_net(struct net *net) * Allowing to move it to another netns is clearly unsafe. */ netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &sitn->fb_tunnel_dev->features); + sitn->fb_tunnel_dev->features);
err = register_netdev(sitn->fb_tunnel_dev); if (err) diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 642d640..c68a113 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -341,7 +341,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, tcp_set_state(sk, TCP_CLOSE); failure: inet->inet_dport = 0; - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); return err; }
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index 5911c60..9090d43 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -69,7 +69,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, * software prior to segmenting the frame. */ if (!skb->encap_hdr_csum) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features);
/* Check if there is enough headroom to insert fragment header. */ tnl_hlen = skb_tnl_header_len(skb); diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index f6dde47..1e85b10 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1997,11 +1997,11 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, if (type == NL80211_IFTYPE_STATION) sdata->u.mgd.use_4addr = params->use_4addr;
- netdev_feature_or(&ndev->features, ndev->features, + netdev_feature_or(ndev->features, ndev->features, local->hw.netdev_features); - netdev_feature_copy(&tmp, ndev->features); - netdev_feature_and_bits(MAC80211_SUPPORTED_FEATURES_TX, &tmp); - netdev_feature_or(&ndev->hw_features, ndev->hw_features, tmp); + netdev_feature_copy(tmp, ndev->features); + netdev_feature_and_bits(MAC80211_SUPPORTED_FEATURES_TX, tmp); + netdev_feature_or(ndev->hw_features, ndev->hw_features, tmp);
netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index eccb0a3..c40b5d5 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -959,8 +959,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) }
/* Only HW csum features are currently compatible with mac80211 */ - netdev_feature_copy(&tmp, hw->netdev_features); - netdev_feature_clear_bits(MAC80211_SUPPORTED_FEATURES, &tmp); + netdev_feature_copy(tmp, hw->netdev_features); + netdev_feature_clear_bits(MAC80211_SUPPORTED_FEATURES, tmp); if (WARN_ON(!netdev_feature_empty(tmp))) return -EINVAL;
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c index a337412..7a6df6d 100644 --- a/net/nsh/nsh.c +++ b/net/nsh/nsh.c @@ -104,7 +104,7 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, skb->mac_len = proto == htons(ETH_P_TEB) ? ETH_HLEN : 0; skb->protocol = proto;
- netdev_feature_clear_bit(NETIF_F_SG_BIT, &features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, features); segs = skb_mac_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { skb_gso_error_unwind(skb, htons(ETH_P_NSH), nsh_len, diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index f5975d5..2f7c5f0 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -457,8 +457,8 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff *segs, *nskb; int ret;
- netif_skb_features(skb, &features); - netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + netif_skb_features(skb, features); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free); diff --git a/net/wireless/core.c b/net/wireless/core.c index 5849ebf..5c179a2 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -165,12 +165,12 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, if (!wdev->netdev) continue; netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); if (err) break; netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); }
if (err) { @@ -183,12 +183,12 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, if (!wdev->netdev) continue; netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); WARN_ON(err); netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); }
return err; @@ -1388,8 +1388,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, SET_NETDEV_DEVTYPE(dev, &wiphy_type); wdev->netdev = dev; /* can only change netns with wiphy */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features);
cfg80211_init_wdev(wdev); break;
This patch extend the type of netdev_features_t to bitmap, so it can support more than 64 bits. Changes the typedef of netdev_features_t to unsigned long *, and use the macro __DECLARE_NETDEV_FEATURE_MASK to declare a netdev feature bitmap.
Then rewrite all the netdev_feature_xxx helpers with the new prototype. For the "netdev_features_t" is "unsigned long *" now, it's unnecessary to use "netdev_features_t *" in these helpers. So removes them, and modify the codes which call them. So does the functions prototype mentioned in the first 23 patches. With these changes, we can keep the behaviour consitent with linkmode_xxx helpers, remove the
For the type of netdev_features_t is bitmap now, so use %*pb to print the features, rather than %pNF.
Signed-off-by: Jian Shen shenjian15@huawei.com --- arch/um/drivers/vector_kern.c | 10 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 +- drivers/net/bareudp.c | 14 +- drivers/net/bonding/bond_main.c | 74 ++++---- drivers/net/bonding/bond_options.c | 8 +- drivers/net/can/dev/dev.c | 4 +- drivers/net/can/slcan.c | 4 +- drivers/net/dsa/xrs700x/xrs700x.c | 4 +- drivers/net/dummy.c | 12 +- drivers/net/ethernet/3com/3c59x.c | 2 +- drivers/net/ethernet/3com/typhoon.c | 8 +- drivers/net/ethernet/adaptec/starfire.c | 6 +- drivers/net/ethernet/aeroflex/greth.c | 8 +- drivers/net/ethernet/alacritech/slicoss.c | 6 +- drivers/net/ethernet/alteon/acenic.c | 6 +- drivers/net/ethernet/altera/altera_tse_main.c | 8 +- drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 2 +- drivers/net/ethernet/amazon/ena/ena_netdev.c | 30 ++-- drivers/net/ethernet/amd/amd8111e.c | 4 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 24 +-- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 18 +- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 +- drivers/net/ethernet/aquantia/atlantic/aq_macsec.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 16 +- drivers/net/ethernet/atheros/alx/main.c | 6 +- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 14 +- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 16 +- drivers/net/ethernet/atheros/atlx/atl1.c | 14 +- drivers/net/ethernet/atheros/atlx/atl2.c | 12 +- drivers/net/ethernet/atheros/atlx/atlx.c | 6 +- drivers/net/ethernet/broadcom/b44.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 6 +- drivers/net/ethernet/broadcom/bgmac.c | 8 +- drivers/net/ethernet/broadcom/bnx2.c | 27 ++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 20 +-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 40 ++--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 70 ++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 10 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +- drivers/net/ethernet/broadcom/tg3.c | 32 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 16 +- drivers/net/ethernet/cadence/macb_main.c | 20 +-- drivers/net/ethernet/calxeda/xgmac.c | 8 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 38 ++-- drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 38 ++-- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 20 +-- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 20 +-- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 26 +-- drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 16 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 34 ++-- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 18 +- drivers/net/ethernet/cisco/enic/enic_main.c | 26 +-- drivers/net/ethernet/cortina/gemini.c | 8 +- drivers/net/ethernet/davicom/dm9000.c | 8 +- drivers/net/ethernet/dnet.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 18 +- drivers/net/ethernet/ethoc.c | 2 +- drivers/net/ethernet/faraday/ftgmac100.c | 14 +- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 10 +- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 +- drivers/net/ethernet/freescale/enetc/enetc.c | 2 +- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 16 +- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 10 +- drivers/net/ethernet/freescale/fec_main.c | 12 +- .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +- drivers/net/ethernet/freescale/gianfar.c | 10 +- drivers/net/ethernet/freescale/gianfar_ethtool.c | 4 +- drivers/net/ethernet/google/gve/gve_adminq.c | 2 +- drivers/net/ethernet/google/gve/gve_main.c | 26 +-- drivers/net/ethernet/google/gve/gve_rx.c | 2 +- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 2 +- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 8 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 16 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 36 ++-- drivers/net/ethernet/huawei/hinic/hinic_main.c | 34 ++-- drivers/net/ethernet/ibm/ehea/ehea_main.c | 12 +- drivers/net/ethernet/ibm/emac/core.c | 8 +- drivers/net/ethernet/ibm/ibmveth.c | 38 ++-- drivers/net/ethernet/ibm/ibmvnic.c | 34 ++-- drivers/net/ethernet/intel/e100.c | 10 +- drivers/net/ethernet/intel/e1000/e1000_main.c | 28 +-- drivers/net/ethernet/intel/e1000e/netdev.c | 38 ++-- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 19 +- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 8 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 36 ++-- drivers/net/ethernet/intel/iavf/iavf_main.c | 48 ++--- drivers/net/ethernet/intel/ice/ice_main.c | 46 ++--- drivers/net/ethernet/intel/igb/igb_main.c | 42 ++--- drivers/net/ethernet/intel/igbvf/netdev.c | 28 +-- drivers/net/ethernet/intel/igc/igc_main.c | 46 ++--- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 20 +-- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 60 +++---- drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 30 ++-- drivers/net/ethernet/jme.c | 14 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 10 +- drivers/net/ethernet/marvell/mvneta.c | 10 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 42 ++--- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 28 +-- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 12 +- .../net/ethernet/marvell/prestera/prestera_main.c | 2 +- drivers/net/ethernet/marvell/skge.c | 6 +- drivers/net/ethernet/marvell/sky2.c | 29 ++- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 66 +++---- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 16 +- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 4 +- .../ethernet/mellanox/mlx5/core/en_accel/ktls.c | 11 +- .../net/ethernet/mellanox/mlx5/core/en_accel/tls.c | 12 +- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 118 ++++++------ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 26 +-- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 18 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 14 +- drivers/net/ethernet/micrel/ksz884x.c | 8 +- drivers/net/ethernet/microchip/lan743x_main.c | 6 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 14 +- drivers/net/ethernet/mscc/ocelot_net.c | 6 +- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 20 +-- drivers/net/ethernet/natsemi/ns83820.c | 8 +- drivers/net/ethernet/neterion/s2io.c | 14 +- drivers/net/ethernet/neterion/vxge/vxge-main.c | 18 +- drivers/net/ethernet/netronome/nfp/crypto/tls.c | 8 +- .../net/ethernet/netronome/nfp/nfp_net_common.c | 42 ++--- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 52 +++--- drivers/net/ethernet/ni/nixge.c | 4 +- drivers/net/ethernet/nvidia/forcedeth.c | 16 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 8 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 4 +- drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 48 ++--- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 22 +-- drivers/net/ethernet/qlogic/qede/qede.h | 4 +- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 10 +- drivers/net/ethernet/qlogic/qede/qede_fp.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 34 ++-- drivers/net/ethernet/qlogic/qla3xxx.c | 4 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 16 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 28 +-- drivers/net/ethernet/qualcomm/emac/emac.c | 12 +- drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 10 +- drivers/net/ethernet/realtek/8139cp.c | 14 +- drivers/net/ethernet/realtek/8139too.c | 10 +- drivers/net/ethernet/realtek/r8169_main.c | 30 ++-- drivers/net/ethernet/renesas/ravb_main.c | 12 +- drivers/net/ethernet/renesas/sh_eth.c | 14 +- drivers/net/ethernet/rocker/rocker_main.c | 2 +- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 10 +- drivers/net/ethernet/sfc/ef10.c | 18 +- drivers/net/ethernet/sfc/ef100_nic.c | 20 +-- drivers/net/ethernet/sfc/ef10_sriov.c | 4 +- drivers/net/ethernet/sfc/efx.c | 20 +-- drivers/net/ethernet/sfc/efx_common.c | 16 +- drivers/net/ethernet/sfc/efx_common.h | 2 +- drivers/net/ethernet/sfc/falcon/efx.c | 28 ++- drivers/net/ethernet/sfc/falcon/net_driver.h | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 8 +- drivers/net/ethernet/sfc/net_driver.h | 2 +- drivers/net/ethernet/sgi/ioc3-eth.c | 8 +- drivers/net/ethernet/silan/sc92031.c | 4 +- drivers/net/ethernet/socionext/netsec.c | 4 +- drivers/net/ethernet/socionext/sni_ave.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 32 ++-- drivers/net/ethernet/sun/cassini.c | 4 +- drivers/net/ethernet/sun/ldmvsw.c | 6 +- drivers/net/ethernet/sun/niu.c | 10 +- drivers/net/ethernet/sun/sungem.c | 8 +- drivers/net/ethernet/sun/sunhme.c | 16 +- drivers/net/ethernet/sun/sunvnet.c | 6 +- drivers/net/ethernet/sun/sunvnet_common.c | 4 +- drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 36 ++-- drivers/net/ethernet/synopsys/dwc-xlgmac-net.c | 2 +- drivers/net/ethernet/tehuti/tehuti.c | 12 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 12 +- drivers/net/ethernet/ti/cpsw.c | 4 +- drivers/net/ethernet/ti/cpsw_new.c | 2 +- drivers/net/ethernet/ti/netcp_core.c | 8 +- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 12 +- drivers/net/ethernet/toshiba/spider_net.c | 8 +- drivers/net/ethernet/tundra/tsi108_eth.c | 4 +- drivers/net/ethernet/via/via-rhine.c | 4 +- drivers/net/ethernet/via/via-velocity.c | 6 +- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 6 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 8 +- drivers/net/fjes/fjes_main.c | 2 +- drivers/net/geneve.c | 14 +- drivers/net/gtp.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 24 +-- drivers/net/hyperv/rndis_filter.c | 26 +-- drivers/net/ifb.c | 8 +- drivers/net/ipa/ipa_modem.c | 4 +- drivers/net/ipvlan/ipvlan_main.c | 30 ++-- drivers/net/ipvlan/ipvtap.c | 4 +- drivers/net/loopback.c | 8 +- drivers/net/macsec.c | 20 +-- drivers/net/macvlan.c | 46 ++--- drivers/net/macvtap.c | 6 +- drivers/net/net_failover.c | 40 ++--- drivers/net/netdevsim/ipsec.c | 4 +- drivers/net/netdevsim/netdev.c | 4 +- drivers/net/nlmon.c | 4 +- drivers/net/ppp/ppp_generic.c | 2 +- drivers/net/tap.c | 24 +-- drivers/net/team/team.c | 46 ++--- drivers/net/tun.c | 34 ++-- drivers/net/usb/aqc111.c | 14 +- drivers/net/usb/ax88179_178a.c | 10 +- drivers/net/usb/cdc-phonet.c | 2 +- drivers/net/usb/cdc_mbim.c | 2 +- drivers/net/usb/lan78xx.c | 16 +- drivers/net/usb/r8152.c | 22 +-- drivers/net/usb/smsc75xx.c | 6 +- drivers/net/usb/smsc95xx.c | 6 +- drivers/net/veth.c | 34 ++-- drivers/net/virtio_net.c | 34 ++-- drivers/net/vmxnet3/vmxnet3_drv.c | 26 +-- drivers/net/vmxnet3/vmxnet3_ethtool.c | 12 +- drivers/net/vmxnet3/vmxnet3_int.h | 4 +- drivers/net/vxlan.c | 16 +- drivers/net/wireguard/device.c | 8 +- drivers/net/wireless/ath/ath10k/mac.c | 4 +- drivers/net/wireless/ath/ath11k/mac.c | 4 +- drivers/net/wireless/ath/ath6kl/main.c | 10 +- drivers/net/wireless/ath/wil6210/netdev.c | 6 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 4 +- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 +- drivers/net/xen-netback/interface.c | 10 +- drivers/net/xen-netfront.c | 22 +-- drivers/s390/net/qeth_core_main.c | 54 +++--- drivers/s390/net/qeth_l2_main.c | 28 +-- drivers/s390/net/qeth_l3_main.c | 16 +- drivers/staging/qlge/qlge_main.c | 16 +- include/linux/if_vlan.h | 2 +- include/linux/netdev_features.h | 147 ++++++++------- include/linux/netdevice.h | 34 ++-- include/net/sock.h | 8 +- include/net/udp.h | 6 +- include/net/vxlan.h | 4 +- net/8021q/vlan.c | 2 +- net/8021q/vlan.h | 8 +- net/8021q/vlan_dev.c | 34 ++-- net/bridge/br_device.c | 14 +- net/bridge/br_if.c | 6 +- net/bridge/br_private.h | 2 +- net/core/dev.c | 198 +++++++++++---------- net/core/netpoll.c | 2 +- net/core/skbuff.c | 2 +- net/core/sock.c | 10 +- net/dsa/slave.c | 14 +- net/ethtool/features.c | 92 ++++------ net/ethtool/ioctl.c | 136 +++++++++----- net/hsr/hsr_device.c | 18 +- net/ipv4/af_inet.c | 4 +- net/ipv4/esp4_offload.c | 4 +- net/ipv4/gre_offload.c | 4 +- net/ipv4/ip_gre.c | 28 +-- net/ipv4/ip_output.c | 4 +- net/ipv4/ip_tunnel.c | 2 +- net/ipv4/ip_vti.c | 2 +- net/ipv4/ipip.c | 6 +- net/ipv4/ipmr.c | 2 +- net/ipv4/tcp.c | 6 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_offload.c | 4 +- net/ipv4/udp_offload.c | 10 +- net/ipv6/af_inet6.c | 2 +- net/ipv6/esp6_offload.c | 6 +- net/ipv6/inet6_connection_sock.c | 2 +- net/ipv6/ip6_gre.c | 14 +- net/ipv6/ip6_offload.c | 2 +- net/ipv6/ip6_output.c | 4 +- net/ipv6/ip6_tunnel.c | 8 +- net/ipv6/ip6mr.c | 2 +- net/ipv6/sit.c | 8 +- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/udp_offload.c | 2 +- net/mac80211/iface.c | 8 +- net/mac80211/main.c | 4 +- net/nsh/nsh.c | 2 +- net/sched/sch_taprio.c | 4 +- net/wireless/core.c | 11 +- 300 files changed, 2349 insertions(+), 2341 deletions(-)
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index f0ad82b..68796ca 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -1343,10 +1343,10 @@ static void vector_net_tx_timeout(struct net_device *dev, unsigned int txqueue) }
static void vector_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &features); + features); }
static int vector_set_features(struct net_device *dev, @@ -1627,10 +1627,10 @@ static void vector_eth_configure( .bpf = NULL });
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); tasklet_setup(&vp->tx_poll, vector_tx_poll); INIT_WORK(&vp->reset_tx, vector_reset_tx);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 5fd0b7a..f49f7a5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -215,7 +215,7 @@ static int ipoib_stop(struct net_device *dev) }
static void ipoib_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -1851,13 +1851,13 @@ static void ipoib_set_dev_features(struct ipoib_dev_priv *priv)
if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &priv->dev->hw_features); + priv->dev->hw_features);
if (priv->hca_caps & IB_DEVICE_UD_TSO) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &priv->dev->hw_features); + priv->dev->hw_features);
- netdev_feature_or(&priv->dev->features, priv->dev->features, + netdev_feature_or(priv->dev->features, priv->dev->features, priv->dev->hw_features); } } @@ -2122,7 +2122,7 @@ void ipoib_setup_common(struct net_device *dev) dev->type = ARPHRD_INFINIBAND; dev->tx_queue_len = ipoib_sendq_size * 2; netdev_feature_set_bits(NETIF_F_VLAN_CHALLENGED | - NETIF_F_HIGHDMA, &dev->features); + NETIF_F_HIGHDMA, dev->features); netif_keep_dst(dev);
memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN); diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 30d47c8..fb0e8e2 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -529,14 +529,14 @@ static void bareudp_setup(struct net_device *dev) dev->needs_free_netdev = true; SET_NETDEV_DEVTYPE(dev, &bareudp_type); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features); dev->hard_header_len = 0; dev->addr_len = 0; dev->mtu = ETH_DATA_LEN; diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index fb1ad49..e8fd253 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1356,7 +1356,7 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev) /*---------------------------------- IOCTL ----------------------------------*/
static void bond_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct bonding *bond = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(mask); @@ -1370,13 +1370,13 @@ static void bond_fix_features(struct net_device *dev, netdev_feature_clear_bits(BOND_TLS_FEATURES, features); #endif
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(mask, features);
netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
bond_for_each_slave(bond, slave, iter) { - netdev_increment_features(features, *features, + netdev_increment_features(features, features, slave->dev->features, mask); } netdev_add_tso_features(features, mask); @@ -1414,42 +1414,42 @@ static void bond_compute_features(struct bonding *bond) unsigned int gso_max_size = GSO_MAX_SIZE; u16 gso_max_segs = GSO_MAX_SEGS;
- netdev_feature_zero(&vlan_features); - netdev_feature_set_bits(BOND_VLAN_FEATURES, &vlan_features); - netdev_feature_copy(&vlan_mask, vlan_features); - netdev_feature_zero(&enc_features); - netdev_feature_set_bits(BOND_ENC_FEATURES, &enc_features); - netdev_feature_copy(&enc_mask, enc_features); + netdev_feature_zero(vlan_features); + netdev_feature_set_bits(BOND_VLAN_FEATURES, vlan_features); + netdev_feature_copy(vlan_mask, vlan_features); + netdev_feature_zero(enc_features); + netdev_feature_set_bits(BOND_ENC_FEATURES, enc_features); + netdev_feature_copy(enc_mask, enc_features); #ifdef CONFIG_XFRM_OFFLOAD - netdev_feature_zero(&xfrm_features); - netdev_feature_set_bits(BOND_XFRM_FEATURES, &xfrm_features); - netdev_feature_copy(&xfrm_mask, xfrm_features); + netdev_feature_zero(xfrm_features); + netdev_feature_set_bits(BOND_XFRM_FEATURES, xfrm_features); + netdev_feature_copy(xfrm_mask, xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */ - netdev_feature_zero(&mpls_features); - netdev_feature_set_bits(BOND_MPLS_FEATURES, &mpls_features); - netdev_feature_copy(&mpls_mask, mpls_features); + netdev_feature_zero(mpls_features); + netdev_feature_set_bits(BOND_MPLS_FEATURES, mpls_features); + netdev_feature_copy(mpls_mask, mpls_features);
if (!bond_has_slaves(bond)) goto done; - netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &vlan_features); - netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &mpls_features); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, mpls_features);
bond_for_each_slave(bond, slave, iter) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, slave->dev->vlan_features, vlan_mask);
- netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, slave->dev->hw_enc_features, enc_mask);
#ifdef CONFIG_XFRM_OFFLOAD - netdev_increment_features(&xfrm_features, xfrm_features, + netdev_increment_features(xfrm_features, xfrm_features, slave->dev->hw_enc_features, xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */
- netdev_increment_features(&mpls_features, mpls_features, + netdev_increment_features(mpls_features, mpls_features, slave->dev->mpls_features, mpls_mask);
@@ -1463,16 +1463,16 @@ static void bond_compute_features(struct bonding *bond) bond_dev->hard_header_len = max_hard_header_len;
done: - netdev_feature_copy(&bond_dev->vlan_features, vlan_features); - netdev_feature_copy(&bond_dev->hw_enc_features, enc_features); + netdev_feature_copy(bond_dev->vlan_features, vlan_features); + netdev_feature_copy(bond_dev->hw_enc_features, enc_features); netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX, &mpls_features); + NETIF_F_HW_VLAN_STAG_TX, mpls_features); #ifdef CONFIG_XFRM_OFFLOAD - netdev_feature_or(&bond_dev->vlan_features, bond_dev->vlan_features, + netdev_feature_or(bond_dev->vlan_features, bond_dev->vlan_features, xfrm_features); #endif /* CONFIG_XFRM_OFFLOAD */ - netdev_feature_copy(&bond_dev->mpls_features, mpls_features); + netdev_feature_copy(bond_dev->mpls_features, mpls_features); bond_dev->gso_max_segs = gso_max_segs; netif_set_gso_max_size(bond_dev, gso_max_size);
@@ -2296,7 +2296,7 @@ static int __bond_release_one(struct net_device *bond_dev, struct sockaddr_storage ss; int old_flags = bond_dev->flags;
- netdev_feature_copy(&old_features, bond_dev->features); + netdev_feature_copy(old_features, bond_dev->features); /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || !netdev_has_upper_dev(slave_dev, bond_dev)) { @@ -5423,7 +5423,7 @@ void bond_setup(struct net_device *bond_dev) #endif /* CONFIG_XFRM_OFFLOAD */
/* don't acquire bond device's netif_tx_lock when transmitting */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &bond_dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, bond_dev->features);
/* By default, we declare the bond to be fully * VLAN hardware accelerated capable. Special @@ -5433,30 +5433,30 @@ void bond_setup(struct net_device *bond_dev) */
/* Don't allow bond devices to change network namespaces. */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &bond_dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, bond_dev->features);
- netdev_feature_zero(&bond_dev->hw_features); + netdev_feature_zero(bond_dev->hw_features); netdev_feature_set_bits(BOND_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &bond_dev->hw_features); + bond_dev->hw_features);
- netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &bond_dev->hw_features); - netdev_feature_or(&bond_dev->features, bond_dev->features, + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, bond_dev->hw_features); + netdev_feature_or(bond_dev->features, bond_dev->features, bond_dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &bond_dev->features); + bond_dev->features); #ifdef CONFIG_XFRM_OFFLOAD - netdev_feature_set_bits(BOND_XFRM_FEATURES, &bond_dev->hw_features); + netdev_feature_set_bits(BOND_XFRM_FEATURES, bond_dev->hw_features); /* Only enable XFRM features if this is an active-backup config */ if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) netdev_feature_set_bits(BOND_XFRM_FEATURES, - &bond_dev->features); + bond_dev->features); #endif /* CONFIG_XFRM_OFFLOAD */ #if IS_ENABLED(CONFIG_TLS_DEVICE) if (bond_sk_check(bond)) - netdev_feature_set_bits(BOND_TLS_FEATURES, &bond_dev->features); + netdev_feature_set_bits(BOND_TLS_FEATURES, bond_dev->features); #endif }
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index b0c3a28..bc36053 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -779,10 +779,10 @@ static bool bond_set_xfrm_features(struct bonding *bond)
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) netdev_feature_set_bits(BOND_XFRM_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features); else netdev_feature_clear_bits(BOND_XFRM_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features);
return true; } @@ -794,10 +794,10 @@ static bool bond_set_tls_features(struct bonding *bond)
if (bond_sk_check(bond)) netdev_feature_set_bits(BOND_TLS_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features); else netdev_feature_clear_bits(BOND_TLS_FEATURES, - &bond->dev->wanted_features); + bond->dev->wanted_features);
return true; } diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c index 45c7d48..a4b4c22 100644 --- a/drivers/net/can/dev/dev.c +++ b/drivers/net/can/dev/dev.c @@ -232,8 +232,8 @@ void can_setup(struct net_device *dev)
/* New-style flags. */ dev->flags = IFF_NOARP; - netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, dev->features); }
/* Allocate and setup space for the CAN network device */ diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 8af2cf0..e647242 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c @@ -450,8 +450,8 @@ static void slc_setup(struct net_device *dev)
/* New-style flags. */ dev->flags = IFF_NOARP; - netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, dev->features); }
/****************************************** diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xrs700x.c index 898426c..a6951eb 100644 --- a/drivers/net/dsa/xrs700x/xrs700x.c +++ b/drivers/net/dsa/xrs700x/xrs700x.c @@ -640,7 +640,7 @@ static int xrs700x_hsr_join(struct dsa_switch *ds, int port, for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; netdev_feature_set_bits(XRS7000X_SUPPORTED_HSR_FEATURES, - &slave->features); + slave->features); }
return 0; @@ -695,7 +695,7 @@ static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, for (i = 0; i < ARRAY_SIZE(hsr_pair); i++) { slave = dsa_to_port(ds, hsr_pair[i])->slave; netdev_feature_clear_bits(XRS7000X_SUPPORTED_HSR_FEATURES, - &slave->features); + slave->features); }
return 0; diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 54ebb63..993a972 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -123,13 +123,13 @@ static void dummy_setup(struct net_device *dev) dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; - netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | - NETIF_F_LLTX, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + NETIF_F_LLTX, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); eth_hw_addr_random(dev);
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 98b6b5b..76d9493 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c @@ -1447,7 +1447,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) || hw_checksums[card_idx] == 1)) { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &dev->features); + dev->features); } } else dev->netdev_ops = &vortex_netdev_ops; diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c index 5ec10b9..b6d10f7 100644 --- a/drivers/net/ethernet/3com/typhoon.c +++ b/drivers/net/ethernet/3com/typhoon.c @@ -2458,12 +2458,12 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * on the current 3XP firmware -- it does not respect the offload * settings -- so we only allow the user to toggle the TX processing. */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM, - &dev->features); + dev->features);
err = register_netdev(dev); if (err < 0) { diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c index a9dcdad..ff9a7e4e 100644 --- a/drivers/net/ethernet/adaptec/starfire.c +++ b/drivers/net/ethernet/adaptec/starfire.c @@ -685,16 +685,16 @@ static int starfire_init_one(struct pci_dev *pdev, /* Starfire can do TCP/UDP checksumming */ if (enable_hw_cksum) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &dev->features); + dev->features); #endif /* ZEROCOPY */
#ifdef VLAN_SUPPORT netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features); #endif /* VLAN_RX_KILL_VID */ #ifdef ADDR_64BITS - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); #endif /* ADDR_64BITS */
/* Serial EEPROM reads are hidden by the hardware. */ diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index 2c0fc81..65d5080 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c @@ -1485,11 +1485,11 @@ static int greth_of_probe(struct platform_device *ofdev) GRETH_REGSAVE(regs->status, 0xFF);
if (greth->gbit_mac) { - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + NETIF_F_RXCSUM, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); greth_netdev_ops.ndo_start_xmit = greth_start_xmit_gbit; }
diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c index 9d0d007..c8eba4b 100644 --- a/drivers/net/ethernet/alacritech/slicoss.c +++ b/drivers/net/ethernet/alacritech/slicoss.c @@ -1778,9 +1778,9 @@ static int slic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, dev); dev->irq = pdev->irq; dev->netdev_ops = &slic_netdev_ops; - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
dev->ethtool_ops = &slic_ethtool_ops;
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c index 1e8a692..7fcf793 100644 --- a/drivers/net/ethernet/alteon/acenic.c +++ b/drivers/net/ethernet/alteon/acenic.c @@ -469,9 +469,9 @@ static int acenic_probe_one(struct pci_dev *pdev, ap->pdev = pdev; ap->name = pci_name(pdev);
- netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM, &dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM, dev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->features); + NETIF_F_HW_VLAN_CTAG_RX, dev->features);
dev->watchdog_timeo = 5*HZ; dev->min_mtu = 0; @@ -591,7 +591,7 @@ static int acenic_probe_one(struct pci_dev *pdev, ap->name = dev->name;
if (ap->pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
pci_set_drvdata(pdev, dev);
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index b488140..9945210 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -1551,15 +1551,15 @@ static int altera_tse_probe(struct platform_device *pdev) /* Scatter/gather IO is not supported, * so it is turned off */ - netdev_feature_clear_bit(NETIF_F_SG_BIT, &ndev->hw_features); - netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features);
/* VLAN offloading of tagging, stripping and filtering is not * supported by hardware, but driver will accommodate the * extra 4-byte VLAN tag for processing by upper layers */ - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, ndev->features);
/* setup NAPI interface */ netif_napi_add(ndev, &priv->napi, tse_poll, NAPI_POLL_WEIGHT); diff --git a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h index f5ec35f..ff51c2e 100644 --- a/drivers/net/ethernet/amazon/ena/ena_admin_defs.h +++ b/drivers/net/ethernet/amazon/ena/ena_admin_defs.h @@ -839,7 +839,7 @@ struct ena_admin_host_info { u32 driver_version;
/* features bitmap */ - u32 supported_network_features[2]; + u32 supported_network_features[DIV_ROUND_UP(NETDEV_FEATURE_COUNT, 32)];
/* ENA spec version of driver */ u16 ena_spec_version; diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 3eda740..730d890 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -3944,10 +3944,8 @@ static void ena_update_hints(struct ena_adapter *adapter, static void ena_update_host_info(struct ena_admin_host_info *host_info, struct net_device *netdev) { - host_info->supported_network_features[0] = - netdev->features & GENMASK_ULL(31, 0); - host_info->supported_network_features[1] = - (netdev->features & GENMASK_ULL(63, 32)) >> 32; + bitmap_to_arr32(host_info->supported_network_features, netdev->features, + NETDEV_FEATURE_COUNT); }
static void ena_timer_service(struct timer_list *t) @@ -4028,43 +4026,43 @@ static void ena_set_dev_offloads(struct ena_com_dev_get_features_ctx *feat, { __DECLARE_NETDEV_FEATURE_MASK(dev_features);
- netdev_feature_zero(&dev_features); + netdev_feature_zero(dev_features);
/* Set offload features */ if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK) - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK) - netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK) - netdev_feature_set_bit(NETIF_F_TSO_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK) - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, dev_features);
if (feat->offload.tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK) - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, dev_features);
if (feat->offload.rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev_features);
if (feat->offload.rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev_features);
- netdev_feature_copy(&netdev->features, dev_features); + netdev_feature_copy(netdev->features, dev_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXHASH | NETIF_F_HIGHDMA, - &netdev->features); + netdev->features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); }
diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c index 1757eac..29ba85d 100644 --- a/drivers/net/ethernet/amd/amd8111e.c +++ b/drivers/net/ethernet/amd/amd8111e.c @@ -1792,7 +1792,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev, #if AMD8111E_VLAN_TAG_USED netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->features); + dev->features); #endif
lp = netdev_priv(dev); @@ -1833,7 +1833,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev, #if AMD8111E_VLAN_TAG_USED netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->features); + dev->features); #endif /* Probe the external PHY */ amd8111e_probe_ext_phy(dev); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 1caffe1..2e99007 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2183,39 +2183,39 @@ static int xgbe_setup_tc(struct net_device *netdev, enum tc_setup_type type, }
static void xgbe_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct xgbe_prv_data *pdata = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(vxlan_base);
- netdev_feature_zero(&vxlan_base); + netdev_feature_zero(vxlan_base); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_RX_UDP_TUNNEL_PORT, - &vxlan_base); + vxlan_base);
if (!pdata->hw_feat.vxn) return;
/* VXLAN CSUM requires VXLAN base */ if (netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - *features) && - !netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, *features)) { + features) && + !netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, features)) { netdev_notice(netdev, "forcing tx udp tunnel support\n"); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, features); }
/* Can't do one without doing the other */ - if (!netdev_feature_subset(*features, vxlan_base)) { + if (!netdev_feature_subset(features, vxlan_base)) { netdev_notice(netdev, "forcing both tx and rx udp tunnel support\n"); - netdev_feature_or(features, *features, vxlan_base); + netdev_feature_or(features, features, vxlan_base); }
if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - *features)) { + features)) { if (!netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - *features)) { + features)) { netdev_notice(netdev, "forcing tx udp tunnel checksumming on\n"); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, @@ -2223,7 +2223,7 @@ static void xgbe_fix_features(struct net_device *netdev, } } else { if (netdev_feature_test_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - *features)) { + features)) { netdev_notice(netdev, "forcing tx udp tunnel checksumming off\n"); netdev_feature_clear_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, @@ -2277,7 +2277,7 @@ static int xgbe_set_features(struct net_device *netdev, features) && rxvlan_filter) hw_if->disable_rx_vlan_filtering(pdata);
- netdev_feature_copy(&features, pdata->netdev_features); + netdev_feature_copy(features, pdata->netdev_features);
DBGPR("<--xgbe_set_features\n");
@@ -2285,7 +2285,7 @@ static int xgbe_set_features(struct net_device *netdev, }
static void xgbe_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); vxlan_features_check(skb, features); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index ace7324..a99b757 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c @@ -342,7 +342,7 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) #endif
/* Set device features */ - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -353,14 +353,14 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER, - &netdev->hw_features); + netdev->hw_features);
if (pdata->hw_feat.rss) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features);
if (pdata->hw_feat.vxn) { - netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -370,11 +370,11 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) NETIF_F_GRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_features); + netdev->hw_features);
netdev->udp_tunnel_nic_info = xgbe_get_udp_tunnel_info(); } @@ -384,11 +384,11 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_copy(&pdata->netdev_features, netdev->features); + netdev_feature_copy(pdata->netdev_features, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->min_mtu = 0; diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c index fabc904..068b0f1 100644 --- a/drivers/net/ethernet/apm/xgene-v2/main.c +++ b/drivers/net/ethernet/apm/xgene-v2/main.c @@ -648,13 +648,13 @@ static int xge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pdata); ndev->netdev_ops = &xgene_ndev_ops;
- netdev_feature_set_bits(NETIF_F_GSO | NETIF_F_GRO, &ndev->features); + netdev_feature_set_bits(NETIF_F_GSO | NETIF_F_GRO, ndev->features);
ret = xge_get_resources(pdata); if (ret) goto err;
- netdev_feature_copy(&ndev->hw_features, ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features); xge_set_ethtool_ops(ndev);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index ed67bec..10a6b16 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -2037,7 +2037,7 @@ static int xgene_enet_probe(struct platform_device *pdev) NETIF_F_GSO | NETIF_F_GRO | NETIF_F_SG, - &ndev->features); + ndev->features);
of_id = of_match_device(xgene_enet_of_match, &pdev->dev); if (of_id) { @@ -2066,10 +2066,10 @@ static int xgene_enet_probe(struct platform_device *pdev)
if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM, - &ndev->features); + ndev->features); spin_lock_init(&pdata->mss_lock); } - netdev_feature_copy(&ndev->hw_features, ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); if (ret) { diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c index 0c10d8b..591f589 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c @@ -1490,7 +1490,7 @@ int aq_macsec_init(struct aq_nic_s *nic) if (!nic->macsec_cfg) return -ENOMEM;
- netdev_feature_set_bit(NETIF_F_HW_MACSEC_BIT, &nic->ndev->features); + netdev_feature_set_bit(NETIF_F_HW_MACSEC_BIT, nic->ndev->features); nic->ndev->macsec_ops = &aq_macsec_ops;
return 0; diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index a153b99..4496bb5 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c @@ -174,7 +174,7 @@ static int aq_ndev_set_features(struct net_device *ndev, } }
- netdev_feature_copy(&aq_cfg->features, features); + netdev_feature_copy(aq_cfg->features, features);
if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) { is_lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, features); diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index 5e73a46..4c7ae4b 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -144,8 +144,8 @@ void aq_nic_cfg_start(struct aq_nic_s *self) cfg->link_irq_vec = 0;
cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; - netdev_feature_zero(&cfg->features); - netdev_feature_set_bits(cfg->aq_hw_caps->hw_features, &cfg->features); + netdev_feature_zero(cfg->features); + netdev_feature_set_bits(cfg->aq_hw_caps->hw_features, cfg->features); cfg->is_vlan_rx_strip = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, cfg->features); @@ -373,16 +373,16 @@ void aq_nic_ndev_init(struct aq_nic_s *self) struct aq_nic_cfg_s *aq_nic_cfg = &self->aq_nic_cfg;
netdev_feature_set_bits(aq_hw_caps->hw_features, - &self->ndev->hw_features); - netdev_feature_zero(&self->ndev->features); - netdev_feature_set_bits(aq_hw_caps->hw_features, &self->ndev->features); + self->ndev->hw_features); + netdev_feature_zero(self->ndev->features); + netdev_feature_set_bits(aq_hw_caps->hw_features, self->ndev->features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_SG | NETIF_F_LRO | NETIF_F_TSO | NETIF_F_TSO6, - &self->ndev->vlan_features); - netdev_feature_zero(&self->ndev->gso_partial_features); + self->ndev->vlan_features); + netdev_feature_zero(self->ndev->gso_partial_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &self->ndev->gso_partial_features); + self->ndev->gso_partial_features); self->ndev->priv_flags = aq_hw_caps->hw_priv_flags; self->ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 2f79aa6..4451513 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -1099,7 +1099,7 @@ static int alx_init_sw(struct alx_priv *alx)
static void alx_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (netdev->mtu > ALX_MAX_TSO_PKT_SIZE) netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, @@ -1818,12 +1818,12 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } }
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | - NETIF_F_TSO6, &netdev->hw_features); + NETIF_F_TSO6, netdev->hw_features);
if (alx_get_perm_macaddr(hw, hw->perm_addr)) { dev_warn(&pdev->dev, diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 86f8e88..3e32dc0 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -505,7 +505,7 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, }
static void atl1c_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_hw *hw = &adapter->hw; @@ -514,7 +514,7 @@ static void atl1c_fix_features(struct net_device *netdev, * Since there is no support for separate rx/tx vlan accel * enable/disable make sure tx flag is always in same state as rx. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -532,7 +532,7 @@ static int atl1c_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl1c_vlan_mode(netdev, features); @@ -2630,14 +2630,14 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev) atl1c_set_ethtool_ops(netdev);
/* TODO: add when ready */ - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | - NETIF_F_TSO6, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, &netdev->features); + NETIF_F_TSO6, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, netdev->features); return 0; }
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 5502fc9..377bb40 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -383,13 +383,13 @@ static int atl1e_set_mac_addr(struct net_device *netdev, void *p) }
static void atl1e_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -401,7 +401,7 @@ static int atl1e_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl1e_vlan_mode(netdev, features);
@@ -2270,14 +2270,14 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev) (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN); atl1e_set_ethtool_ops(netdev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, netdev->features); /* not enabled by default */ netdev_feature_set_bits(NETIF_F_RXALL | NETIF_F_RXFCS, - &netdev->hw_features); + netdev->hw_features); return 0; }
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index a717cd0..0310f35 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c @@ -2988,18 +2988,18 @@ static int atl1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_common;
- netdev_feature_zero(&netdev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->features); + netdev_feature_zero(netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->hw_features);
/* is this valid? see atl1_setup_mac_ctrl() */ - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features);
/* MTU range: 42 - 10218 */ netdev->min_mtu = ETH_ZLEN - (ETH_HLEN + VLAN_HLEN); diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index 943f2af..0513696 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c @@ -372,13 +372,13 @@ static void atl2_restore_vlan(struct atl2_adapter *adapter) }
static void atl2_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -390,7 +390,7 @@ static int atl2_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atl2_vlan_mode(netdev, features);
@@ -1389,11 +1389,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features);
/* Init PHY as early as possible due to power saving issue */ atl2_phy_init(&adapter->hw); diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index ea5b6d7..0474ae3 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c @@ -238,13 +238,13 @@ static void atlx_restore_vlan(struct atlx_adapter *adapter) }
static void atlx_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -256,7 +256,7 @@ static int atlx_set_features(struct net_device *netdev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) atlx_vlan_mode(netdev, features);
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 80c0998..0b35f6a 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c @@ -2353,7 +2353,7 @@ static int b44_init_one(struct ssb_device *sdev, SET_NETDEV_DEV(dev, sdev->dev);
/* No interesting netdevice features in this card... */ - netdev_feature_set_bits(0, &dev->features); + netdev_feature_set_bits(0, dev->features);
bp = netdev_priv(dev); bp->sdev = sdev; diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index e1df027..630b415 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -2568,9 +2568,9 @@ static int bcm_sysport_probe(struct platform_device *pdev)
netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_HW_VLAN_CTAG_TX, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + NETIF_F_HW_VLAN_CTAG_TX, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features); dev->max_mtu = UMAC_MAX_MTU_SIZE;
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index c99800b..7ff3d3a 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -1535,11 +1535,11 @@ int bgmac_enet_probe(struct bgmac *bgmac) goto err_dma_free; }
- netdev_feature_zero(&net_dev->features); + netdev_feature_zero(net_dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &net_dev->features); - netdev_feature_copy(&net_dev->hw_features, net_dev->features); - netdev_feature_copy(&net_dev->vlan_features, net_dev->features); + NETIF_F_IPV6_CSUM, net_dev->features); + netdev_feature_copy(net_dev->hw_features, net_dev->features); + netdev_feature_copy(net_dev->vlan_features, net_dev->features);
/* Omit FCS from max MTU size */ net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN; diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index c26e418..a60786d 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -7749,19 +7749,18 @@ bnx2_set_features(struct net_device *dev, netdev_features_t features)
/* TSO with VLAN tag won't work with current firmware */ if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features)) { - netdev_feature_copy(&tmp, dev->hw_features); - netdev_feature_and_bits(NETIF_F_ALL_TSO, &tmp); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, - tmp); + netdev_feature_copy(tmp, dev->hw_features); + netdev_feature_and_bits(NETIF_F_ALL_TSO, tmp); + netdev_feature_or(dev->vlan_features, dev->vlan_features, tmp); } else { - netdev_feature_clear_bits(NETIF_F_ALL_TSO, &dev->vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_TSO, dev->vlan_features); }
if ((netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) != !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) && netif_running(dev)) { bnx2_netif_stop(bp, false); - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); bnx2_set_rx_mode(dev); bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); bnx2_netif_start(bp, false); @@ -8233,7 +8232,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
/* Configure DMA attributes. */ if (pci_set_dma_mask(pdev, dma_mask) == 0) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (rc) { dev_err(&pdev->dev, @@ -8601,27 +8600,27 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_RXHASH | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features);
if (BNX2_CHIP(bp) == BNX2_CHIP_5709) netdev_feature_set_bits(NETIF_F_IPV6_CSUM | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features);
- netdev_feature_copy(&dev->vlan_features, dev->hw_features); + netdev_feature_copy(dev->vlan_features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); dev->priv_flags |= IFF_UNICAST_FLT; dev->min_mtu = MIN_ETHERNET_PACKET_SIZE; dev->max_mtu = MAX_ETHERNET_JUMBO_PACKET_SIZE;
if (!(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->hw_features); + dev->hw_features);
if ((rc = register_netdev(dev))) { dev_err(&pdev->dev, "Cannot register net device\n"); diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 30c8ea6..36b5366 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -4893,7 +4893,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) dev->mtu = new_mtu;
if (!bnx2x_mtu_allows_gro(new_mtu)) - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, dev->features);
if (IS_PF(bp) && SHMEM2_HAS(bp, curr_cfg)) SHMEM2_WR(bp, curr_cfg, CURR_CFG_MET_OS); @@ -4901,19 +4901,19 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) return bnx2x_reload_if_running(dev); }
-void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) +void bnx2x_fix_features(struct net_device *dev, netdev_features_t features) { struct bnx2x *bp = netdev_priv(dev);
if (pci_num_vf(bp->pdev)) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, *features); + netdev_feature_xor(changed, dev->features, features);
/* Revert the requested changes in features if they * would require internal reload of PF in bnx2x_set_features(). */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && !bp->disable_tpa) { if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->features)) @@ -4932,13 +4932,13 @@ void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features) }
/* TPA requires Rx CSUM offloading */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
- if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features) || + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, features) || !bnx2x_mtu_allows_gro(dev->mtu)) netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); - if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
@@ -4949,7 +4949,7 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) bool bnx2x_reload = false; int rc;
- netdev_feature_xor(&changes, dev->features, features); + netdev_feature_xor(changes, dev->features, features);
/* VFs or non SRIOV PFs should be able to change loopback feature */ if (!pci_num_vf(bp->pdev)) { @@ -4967,14 +4967,14 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) }
/* Don't care about GRO changes */ - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &changes); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, changes);
if (!netdev_feature_empty(changes)) bnx2x_reload = true;
if (bnx2x_reload) { if (bp->recovery_state == BNX2X_RECOVERY_DONE) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); rc = bnx2x_reload_if_running(dev); return rc ? rc : 1; } diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index 4c66ef3..f4c82b9 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h @@ -606,7 +606,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu); int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type); #endif
-void bnx2x_fix_features(struct net_device *dev, netdev_features_t *features); +void bnx2x_fix_features(struct net_device *dev, netdev_features_t features); int bnx2x_set_features(struct net_device *dev, netdev_features_t features);
/** diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 82cfee2..23ae839 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12384,9 +12384,9 @@ static int bnx2x_init_bp(struct bnx2x *bp) /* Set TPA flags */ if (bp->disable_tpa) { netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->hw_features); + bp->dev->hw_features); netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->features); + bp->dev->features); }
if (CHIP_IS_E1(bp)) @@ -12888,7 +12888,7 @@ static int bnx2x_get_phys_port_id(struct net_device *netdev, }
static void bnx2x_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* * A skb with gso_size + header length > 9700 will cause a @@ -13243,62 +13243,62 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
dev->priv_flags |= IFF_UNICAST_FLT;
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | NETIF_F_GRO_HW | NETIF_F_RXHASH | - NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, dev->hw_features); if (!chip_is_e1x) { netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL, &dev->hw_features); + NETIF_F_GSO_PARTIAL, dev->hw_features);
- netdev_feature_zero(&dev->hw_enc_features); + netdev_feature_zero(dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_GSO_PARTIAL, &dev->hw_enc_features); + NETIF_F_GSO_PARTIAL, dev->hw_enc_features);
- netdev_feature_zero(&dev->gso_partial_features); + netdev_feature_zero(dev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &dev->gso_partial_features); + dev->gso_partial_features);
if (IS_PF(bp)) dev->udp_tunnel_nic_info = &bnx2x_udp_tunnels; }
- netdev_feature_zero(&dev->vlan_features); + netdev_feature_zero(dev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | - NETIF_F_HIGHDMA, &dev->vlan_features); + NETIF_F_HIGHDMA, dev->vlan_features);
if (IS_PF(bp)) { if (chip_is_e1x) bp->accept_any_vlan = true; else netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->hw_features); + dev->hw_features); } /* For VF we'll know whether to enable VLAN filtering after * getting a response to CHANNEL_TLV_ACQUIRE from PF. */
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, dev->features);
/* Add Loopback capability to the device */ - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, dev->features);
#ifdef BCM_DCBNL dev->dcbnl_ops = &bnx2x_dcbnl_ops; @@ -14002,9 +14002,9 @@ static int bnx2x_init_one(struct pci_dev *pdev, /* VF with OLD Hypervisor or old PF do not support filtering */ if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->features); + dev->features); } #endif } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index a43ee06..da1a097 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6502,9 +6502,9 @@ static int __bnxt_reserve_rings(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_AGG_RINGS; bp->flags |= BNXT_FLAG_NO_AGG_RINGS; netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &bp->dev->hw_features); + bp->dev->hw_features); netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &bp->dev->features); + bp->dev->features); bnxt_set_ring_params(bp); } } @@ -10229,7 +10229,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) !(bp->flags & BNXT_FLAG_USING_MSIX)) { /* disable RFS if falling back to INTA */ netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &bp->dev->hw_features); + bp->dev->hw_features); bp->flags &= ~BNXT_FLAG_RFS; }
@@ -10920,13 +10920,13 @@ static bool bnxt_rfs_capable(struct bnxt *bp) }
static void bnxt_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(vlan_features); __DECLARE_NETDEV_FEATURE_MASK(tmp); struct bnxt *bp = netdev_priv(dev);
- if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) && !bnxt_rfs_capable(bp)) netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features);
@@ -10934,26 +10934,26 @@ static void bnxt_fix_features(struct net_device *dev, netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, features);
- if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, features)) netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
/* Both CTAG and STAG VLAN accelaration on the RX side have to be * turned on or off together. */ - netdev_feature_zero(&tmp); - netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, &tmp); - netdev_feature_and(&vlan_features, *features, tmp); + netdev_feature_zero(tmp); + netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, tmp); + netdev_feature_and(vlan_features, features, tmp); if (!netdev_feature_equal(vlan_features, tmp)) { if (netdev_feature_test_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, dev->features)) netdev_feature_clear_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, - &dev->features); + dev->features); else if (!netdev_feature_empty(vlan_features)) netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, - &dev->features); + dev->features); } #ifdef CONFIG_BNXT_SRIOV if (BNXT_VF(bp) && bp->vf.vlan) @@ -11124,7 +11124,7 @@ static bool bnxt_tunl_check(struct bnxt *bp, struct sk_buff *skb, u8 l4_proto) }
static void bnxt_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct bnxt *bp = netdev_priv(dev); u8 *l4_proto; @@ -11984,15 +11984,15 @@ static void bnxt_set_dflt_rfs(struct bnxt *bp) { struct net_device *dev = bp->dev;
- netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); - netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, dev->hw_features); + netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, dev->features); bp->flags &= ~BNXT_FLAG_RFS; if (bnxt_rfs_supported(bp)) { - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, dev->hw_features); if (bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS; netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &dev->features); + dev->features); } } } @@ -12972,9 +12972,9 @@ static int bnxt_get_dflt_rings(struct bnxt *bp, int *max_rx, int *max_tx, } bp->flags |= BNXT_FLAG_NO_AGG_RINGS; netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->hw_features); + bp->dev->hw_features); netdev_feature_clear_bits(NETIF_F_LRO | NETIF_F_GRO_HW, - &bp->dev->features); + bp->dev->features); bnxt_set_ring_params(bp); }
@@ -13089,7 +13089,7 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp) bp->tx_nr_rings_per_tc = bp->tx_nr_rings; if (bnxt_rfs_supported(bp) && bnxt_rfs_capable(bp)) { bp->flags |= BNXT_FLAG_RFS; - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &bp->dev->features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, bp->dev->features); } init_dflt_ring_err: bnxt_ulp_irq_restart(bp, rc); @@ -13310,7 +13310,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) goto init_err_pci_clean; }
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | @@ -13318,38 +13318,38 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_PARTIAL | NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_GRO, - &dev->hw_features); + dev->hw_features);
if (BNXT_SUPPORTS_TPA(bp)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->hw_features);
- netdev_feature_zero(&dev->hw_enc_features); + netdev_feature_zero(dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 | - NETIF_F_GSO_PARTIAL, &dev->hw_enc_features); + NETIF_F_GSO_PARTIAL, dev->hw_enc_features); dev->udp_tunnel_nic_info = &bnxt_udp_tunnels;
- netdev_feature_zero(&dev->gso_partial_features); + netdev_feature_zero(dev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM, - &dev->gso_partial_features); - netdev_feature_copy(&dev->vlan_features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->vlan_features); + dev->gso_partial_features); + netdev_feature_copy(dev->vlan_features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->vlan_features); if (bp->fw_cap & BNXT_FW_CAP_VLAN_RX_STRIP) netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_RX, - &dev->hw_features); + dev->hw_features); if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) netdev_feature_set_bits(BNXT_HW_FEATURE_VLAN_ALL_TX, - &dev->hw_features); + dev->hw_features); if (BNXT_SUPPORTS_TPA(bp)) - netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, dev->features)) - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &dev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, dev->features); dev->priv_flags |= IFF_UNICAST_FLT;
#ifdef CONFIG_BNXT_SRIOV diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 0a3fbb4..902540c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -2041,8 +2041,8 @@ int bnxt_init_tc(struct bnxt *bp) goto destroy_decap_table;
tc_info->enabled = true; - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &bp->dev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, bp->dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, bp->dev->features); bp->tc_info = tc_info;
/* init indirect block notifications */ diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c index b1d4534..b9b1180 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c @@ -464,12 +464,12 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep, /* Just inherit all the featues of the parent PF as the VF-R * uses the RX/TX rings of the parent PF */ - netdev_feature_copy(&dev->hw_features, pf_dev->hw_features); - netdev_feature_copy(&dev->gso_partial_features, + netdev_feature_copy(dev->hw_features, pf_dev->hw_features); + netdev_feature_copy(dev->gso_partial_features, pf_dev->gso_partial_features); - netdev_feature_copy(&dev->vlan_features, pf_dev->vlan_features); - netdev_feature_copy(&dev->hw_enc_features, pf_dev->hw_enc_features); - netdev_feature_copy(&dev->features, pf_dev->features); + netdev_feature_copy(dev->vlan_features, pf_dev->vlan_features); + netdev_feature_copy(dev->hw_enc_features, pf_dev->hw_enc_features); + netdev_feature_copy(dev->features, pf_dev->features); bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx, dev->perm_addr); ether_addr_copy(dev->dev_addr, dev->perm_addr); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 18cc0e3..f97c2b7 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -298,7 +298,7 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog) if (rx > 1) { bp->flags &= ~BNXT_FLAG_NO_AGG_RINGS; netdev_feature_set_bit(NETIF_F_LRO_BIT, - &bp->dev->hw_features); + bp->dev->hw_features); } } bp->tx_nr_rings_xdp = tx_xdp; diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 70cf8be..a2893f2 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3957,9 +3957,9 @@ static int bcmgenet_probe(struct platform_device *pdev)
/* Set default features */ netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | - NETIF_F_RXCSUM, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + NETIF_F_RXCSUM, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features);
/* Request the WOL interrupt and advertise suspend if available */ diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3fcacec..3df551e 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -7883,8 +7883,8 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi, netif_tx_wake_queue(txq); }
- netdev_feature_copy(&tmp, tp->dev->features); - netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, &tmp); + netdev_feature_copy(tmp, tp->dev->features); + netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, tmp); segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs) || !segs) goto tg3_tso_bug_end; @@ -8309,7 +8309,7 @@ static void tg3_set_loopback(struct net_device *dev, netdev_features_t features) }
static void tg3_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct tg3 *tp = netdev_priv(dev);
@@ -8321,7 +8321,7 @@ static int tg3_set_features(struct net_device *dev, netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && netif_running(dev)) tg3_set_loopback(dev, features); @@ -17619,7 +17619,7 @@ static int tg3_init_one(struct pci_dev *pdev, char str[40]; u64 dma_mask, persist_dma_mask;
- netdev_feature_zero(&features); + netdev_feature_zero(features);
err = pci_enable_device(pdev); if (err) { @@ -17762,7 +17762,7 @@ static int tg3_init_one(struct pci_dev *pdev, if (dma_mask > DMA_BIT_MASK(32)) { err = pci_set_dma_mask(pdev, dma_mask); if (!err) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, features); err = pci_set_consistent_dma_mask(pdev, persist_dma_mask); if (err < 0) { @@ -17788,11 +17788,11 @@ static int tg3_init_one(struct pci_dev *pdev, */ if (tg3_chip_rev_id(tp) != CHIPREV_ID_5700_B0) { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM, &features); + NETIF_F_RXCSUM, features);
if (tg3_flag(tp, 5755_PLUS)) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &features); + features); }
/* TSO is on by default on chips that support hardware TSO. @@ -17803,23 +17803,23 @@ static int tg3_init_one(struct pci_dev *pdev, tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) && netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features)) - netdev_feature_set_bit(NETIF_F_TSO_BIT, &features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, features); if (tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) { if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features)) - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, features); if (tg3_flag(tp, HW_TSO_3) || tg3_asic_rev(tp) == ASIC_REV_5761 || (tg3_asic_rev(tp) == ASIC_REV_5784 && tg3_chip_rev(tp) != CHIPREV_5784_AX) || tg3_asic_rev(tp) == ASIC_REV_5785 || tg3_asic_rev(tp) == ASIC_REV_57780) - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, features); }
- netdev_feature_or(&dev->features, dev->features, features); + netdev_feature_or(dev->features, dev->features, features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, features); + NETIF_F_HW_VLAN_CTAG_RX, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, features);
/* * Add loopback capability only for a subset of devices that support @@ -17829,9 +17829,9 @@ static int tg3_init_one(struct pci_dev *pdev, if (tg3_asic_rev(tp) != ASIC_REV_5780 && !tg3_flag(tp, CPMU_PRESENT)) /* Add the loopback capability */ - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, features);
- netdev_feature_or(&dev->hw_features, dev->hw_features, features); + netdev_feature_or(dev->hw_features, dev->hw_features, features); dev->priv_flags |= IFF_UNICAST_FLT;
/* MTU range: 60 - 9000 or 1500, depending on hardware */ diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ed630ce..16262c7 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -3354,7 +3354,7 @@ static int bnad_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); struct bnad *bnad = netdev_priv(dev);
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed) && netif_running(dev)) { unsigned long flags; @@ -3431,27 +3431,27 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac) { struct net_device *netdev = bnad->netdev;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
if (using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
netdev->mem_start = bnad->mmio_start; netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index c7c8fb0..6e91123 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2035,7 +2035,7 @@ static unsigned int macb_tx_map(struct macb *bp, }
static void macb_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int nr_frags, f; unsigned int hdrlen; @@ -3634,7 +3634,7 @@ static int macb_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); struct macb *bp = netdev_priv(netdev);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
/* TX checksum offload */ if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, changed)) @@ -3657,7 +3657,7 @@ static void macb_restore_features(struct macb *bp) struct net_device *netdev = bp->dev; struct ethtool_rx_fs_item *item;
- netdev_feature_copy(&features, netdev->features); + netdev_feature_copy(features, netdev->features);
/* TX checksum offload */ macb_set_txcsum_feature(bp, features); @@ -3943,20 +3943,20 @@ static int macb_init(struct platform_device *pdev) }
/* Set features */ - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->hw_features);
/* Check LSO capability */ if (GEM_BFEXT(PBUF_LSO, gem_readl(bp, DCFG6))) - netdev_feature_set_bits(MACB_NETIF_LSO, &dev->hw_features); + netdev_feature_set_bits(MACB_NETIF_LSO, dev->hw_features);
/* Checksum offload is only available on gem with packet buffer */ if (macb_is_gem(bp) && !(bp->caps & MACB_CAPS_FIFO_MODE)) netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features); if (bp->caps & MACB_CAPS_SG_DISABLED) - netdev_feature_clear_bit(NETIF_F_SG_BIT, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features);
/* Check RX Flow Filters support. * Max Rx flows set by availability of screeners & compare regs: @@ -3975,7 +3975,7 @@ static int macb_init(struct platform_device *pdev) gem_writel_n(bp, ETHT, SCRT2_ETHT, reg); /* Filtering is supported in hw but don't enable it in kernel now */ netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &dev->hw_features); + dev->hw_features); /* init Rx flow definitions */ bp->rx_fs_list.count = 0; spin_lock_init(&bp->rx_fs_lock); diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index 3679fed..6588841a 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c @@ -1493,7 +1493,7 @@ static int xgmac_set_features(struct net_device *dev, netdev_features_t features __DECLARE_NETDEV_FEATURE_MASK(changed); void __iomem *ioaddr = priv->base;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0; @@ -1776,12 +1776,12 @@ static int xgmac_probe(struct platform_device *pdev) priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, - &ndev->hw_features); + ndev->hw_features);
if (readl(priv->base + XGMAC_DMA_HW_FEATURE) & DMA_HW_FEAT_TXCOESEL) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &ndev->hw_features); - netdev_feature_or(&ndev->features, &ndev->features, &ndev->hw_features); + NETIF_F_RXCSUM, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); ndev->priv_flags |= IFF_UNICAST_FLT;
/* MTU range: 46 - 9000 */ diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index a0aa543..a927725 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -2717,38 +2717,38 @@ static const struct udp_tunnel_nic_info liquidio_udp_tunnels = { * Return: updated features list */ static void liquidio_fix_features(struct net_device *netdev, - netdev_features_t *request) + netdev_features_t request) { struct lio *lio = netdev_priv(netdev);
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && !(lio->dev_capability & NETIF_F_RXCSUM)) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, request) && !(lio->dev_capability & NETIF_F_HW_CSUM)) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, request) && !(lio->dev_capability & NETIF_F_TSO)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, request) && !(lio->dev_capability & NETIF_F_TSO6)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, request) && !(lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/*Disable LRO if RXCSUM is off */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - *request) && + request) && !(lio->dev_capability & NETIF_F_HW_VLAN_CTAG_FILTER)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, request); @@ -3587,35 +3587,35 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
lio->dev_capability |= NETIF_F_GSO_UDP_TUNNEL;
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(lio->dev_capability, - &netdev->vlan_features); + netdev->vlan_features); /* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
- netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(lio->dev_capability, - &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(lio->dev_capability, - &netdev->hw_features); + netdev->hw_features); /*HW_VLAN_RX and HW_VLAN_FILTER is always on*/ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE; diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index c0112f9..dfbd484 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -1816,32 +1816,32 @@ static const struct udp_tunnel_nic_info liquidio_udp_tunnels = { * @returns updated features list */ static void liquidio_fix_features(struct net_device *netdev, - netdev_features_t *request) + netdev_features_t request) { struct lio *lio = netdev_priv(netdev);
- if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && !(lio->dev_capability & NETIF_F_RXCSUM)) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, request) && !(lio->dev_capability & NETIF_F_HW_CSUM)) netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, request) && !(lio->dev_capability & NETIF_F_TSO)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, request) && !(lio->dev_capability & NETIF_F_TSO6)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, request);
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *request) && + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, request) && !(lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request);
/* Disable LRO if RXCSUM is off */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *request) && + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, request) && netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) && (lio->dev_capability & NETIF_F_LRO)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, request); @@ -1857,7 +1857,7 @@ static int liquidio_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); struct lio *lio = netdev_priv(netdev);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) return 0;
@@ -2116,33 +2116,33 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_clear_bit(NETIF_F_LRO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &liquidio_udp_tunnels;
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->vlan_features); + netdev->vlan_features);
/* Add any unchangeable hw features */ lio->dev_capability |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
- netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(lio->enc_dev_capability, - &netdev->hw_features); + netdev->hw_features); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
/* MTU range: 68 - 16000 */ netdev->min_mtu = LIO_MIN_MTU_SIZE; diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 87bfd04..d7fb3e0 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1775,11 +1775,11 @@ static int nicvf_config_loopback(struct nicvf *nic, }
static void nicvf_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct nicvf *nic = netdev_priv(netdev);
- if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, features) && netif_running(netdev) && !nic->loopback_supported) netdev_feature_clear_bit(NETIF_F_LOOPBACK_BIT, features); } @@ -1790,7 +1790,7 @@ static int nicvf_set_features(struct net_device *netdev, struct nicvf *nic = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) nicvf_config_vlan_stripping(nic, features); @@ -2215,22 +2215,22 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_unregister_interrupts;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_GRO | NETIF_F_TSO6 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->hw_features);
- netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, netdev->hw_features);
- netdev_feature_zero(&netdev->vlan_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features);
netdev->netdev_ops = &nicvf_netdev_ops; netdev->watchdog_timeo = NICVF_TX_TIMEOUT; diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index e13455e..f1c68ca 100644 --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c @@ -855,13 +855,13 @@ static int t1_set_mac_addr(struct net_device *dev, void *p) return 0; }
-static void t1_fix_features(struct net_device *dev, netdev_features_t *features) +static void t1_fix_features(struct net_device *dev, netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -873,7 +873,7 @@ static int t1_set_features(struct net_device *dev, netdev_features_t features) struct adapter *adapter = dev->ml_priv; __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) t1_vlan_mode(adapter, features);
@@ -1033,27 +1033,27 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->mem_end = mmio_start + mmio_len - 1; netdev->ml_priv = adapter; netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_RXCSUM, &netdev->hw_features); + NETIF_F_RXCSUM, netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_LLTX, - &netdev->features); + netdev->features);
if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->features); + netdev->features); if (vlan_tso_capable(adapter)) { netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
/* T204: disable TSO */ if (!(is_T2(adapter)) || bi->port_number != 4) { netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); } }
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 01b0ff1..7eec868 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -2249,10 +2249,10 @@ static int cxgb_siocdevprivate(struct net_device *dev, if (t.lro >= 0) { if (t.lro) netdev_feature_set_bit(NETIF_F_GRO_BIT, - &dev->wanted_features); + dev->wanted_features); else netdev_feature_clear_bit(NETIF_F_GRO_BIT, - &dev->wanted_features); + dev->wanted_features); netdev_update_features(dev); }
@@ -2596,13 +2596,13 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) }
static void cxgb_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -2613,7 +2613,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) cxgb_vlan_mode(dev, features);
@@ -3321,22 +3321,22 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->irq = pdev->irq; netdev->mem_start = mmio_start; netdev->mem_end = mmio_start + mmio_len - 1; - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->features); - netdev_feature_copy(&tmp, netdev->features); - netdev_feature_and_bits(VLAN_FEAT, &tmp); - netdev_feature_or(&netdev->vlan_features, + netdev->features); + netdev_feature_copy(tmp, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, tmp); + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, tmp); if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->features); + netdev->features);
netdev->netdev_ops = &cxgb_netdev_ops; netdev->ethtool_ops = &cxgb_ethtool_ops; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c index a10ee67..eb1d9bb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c @@ -79,10 +79,10 @@ int cxgb_fcoe_enable(struct net_device *netdev)
dev_info(adap->pdev_dev, "Enabling FCoE offload features\n");
- netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_CRC_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, netdev->vlan_features);
netdev_features_change(netdev);
@@ -110,10 +110,10 @@ int cxgb_fcoe_disable(struct net_device *netdev)
fcoe->flags &= ~CXGB_FCOE_ENABLED;
- netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, &netdev->vlan_features); - netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->vlan_features); + netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_CRC_BIT, netdev->vlan_features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, netdev->vlan_features);
netdev_features_change(netdev);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c80cb72..f566b5e 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1277,7 +1277,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) return 0;
@@ -1286,9 +1286,9 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features) netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features), true); if (unlikely(err)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_change_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
return err; @@ -3843,7 +3843,7 @@ static const struct udp_tunnel_nic_info cxgb_udp_tunnels = { };
static void cxgb_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct port_info *pi = netdev_priv(dev); struct adapter *adapter = pi->adapter; @@ -3861,10 +3861,10 @@ static void cxgb_features_check(struct sk_buff *skb, struct net_device *dev, }
static void cxgb_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* Disable GRO, if RX_CSUM is disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_GRO_BIT, features); }
@@ -6833,12 +6833,12 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) pi->port_id = i; netdev->irq = pdev->irq;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | TSO_FLAGS | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_GRO | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_TC | NETIF_F_NTUPLE, &netdev->hw_features); + NETIF_F_HW_TC | NETIF_F_NTUPLE, netdev->hw_features);
if (chip_ver > CHELSIO_T5) { netdev_feature_set_bits(NETIF_F_IP_CSUM | @@ -6847,11 +6847,11 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_HW_TLS_RECORD, - &netdev->hw_features); + netdev->hw_features);
if (adapter->rawf_cnt) netdev->udp_tunnel_nic_info = &cxgb_udp_tunnels; @@ -6859,15 +6859,15 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (highdma) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_copy(&netdev->vlan_features, netdev->features); - netdev_feature_and_bits(VLAN_FEAT, &netdev->vlan_features); + netdev_feature_copy(netdev->vlan_features, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, netdev->vlan_features); #if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE) if (pi->adapter->params.crypto & FW_CAPS_CONFIG_TLS_HW) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev->tlsdev_ops = &cxgb4_ktls_ops; /* initialize the refcount */ refcount_set(&pi->adapter->chcr_ktls.ktls_refcount, 0); @@ -6876,9 +6876,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) #if IS_ENABLED(CONFIG_CHELSIO_IPSEC_INLINE) if (pi->adapter->params.crypto & FW_CAPS_CONFIG_IPSEC_INLINE) { netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, - &netdev->features); + netdev->features); netdev->xfrmdev_ops = &cxgb4_xfrmdev_ops; } #endif /* CONFIG_CHELSIO_IPSEC_INLINE */ diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index a41f04f..696791c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -1174,13 +1174,13 @@ static int cxgb4vf_change_mtu(struct net_device *dev, int new_mtu) }
static void cxgb4vf_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -1193,7 +1193,7 @@ static int cxgb4vf_set_features(struct net_device *dev, struct port_info *pi = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1, netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -3076,19 +3076,19 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, pi->xact_addr_filt = -1; netdev->irq = pdev->irq;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | TSO_FLAGS | NETIF_F_GRO | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->features); - netdev_feature_copy(&netdev->vlan_features, netdev->features); - netdev_feature_and_bits(VLAN_FEAT, &netdev->vlan_features); + netdev->features); + netdev_feature_copy(netdev->vlan_features, netdev->features); + netdev_feature_and_bits(VLAN_FEAT, netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->min_mtu = 81; diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index e5ddb39..0953577 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -241,7 +241,7 @@ static const struct udp_tunnel_nic_info enic_udp_tunnels = { };
static void enic_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { const struct ethhdr *eth = (struct ethhdr *)skb_inner_mac_header(skb); struct enic *enic = netdev_priv(dev); @@ -2901,27 +2901,27 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) enic_set_ethtool_ops(netdev);
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features); if (ENIC_SETTING(enic, LOOP)) { netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->features); + netdev->features); enic->loop_enable = 1; enic->loop_tag = enic->config.loop_tag; dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag); } if (ENIC_SETTING(enic, TXCSUM)) netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, TSO)) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, RSS)) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, RXCSUM)) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); if (ENIC_SETTING(enic, VXLAN)) { u64 patch_level; u64 a1 = 0; @@ -2933,8 +2933,8 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_HW_CSUM | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->hw_enc_features); + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->hw_enc_features); /* get bit mask from hw about supported offload bit level * BIT(0) = fw supports patch_level 0 @@ -2968,17 +2968,17 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } }
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features);
#ifdef CONFIG_RFS_ACCEL - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features); #endif
if (using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 81b4045..9d97521 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -1977,7 +1977,7 @@ static int gmac_change_mtu(struct net_device *netdev, int new_mtu) }
static void gmac_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (netdev->mtu + ETH_HLEN + VLAN_HLEN > MTU_SIZE_BIT_MASK) netdev_feature_clear_bits(GMAC_OFFLOAD_FEATURES, features); @@ -2450,10 +2450,10 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) spin_lock_init(&port->config_lock); gmac_clear_hw_stats(netdev);
- netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES, netdev->hw_features); netdev_feature_set_bits(GMAC_OFFLOAD_FEATURES | NETIF_F_GRO, - &netdev->features); + netdev->features); /* We can handle jumbo frames up to 10236 bytes so, let's accept * payloads of 10236 bytes minus VLAN and ethernet header */ diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 8e4ca68..16c75f1 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -589,7 +589,7 @@ static int dm9000_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changed); unsigned long flags;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0;
@@ -1648,10 +1648,10 @@ dm9000_probe(struct platform_device *pdev)
/* dm9000a/b are capable of hardware checksum offload */ if (db->type == TYPE_DM9000A || db->type == TYPE_DM9000B) { - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &ndev->hw_features); - netdev_feature_or(&ndev->features, ndev->features, + ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); }
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c index 70bfa91..7fe4bf6 100644 --- a/drivers/net/ethernet/dnet.c +++ b/drivers/net/ethernet/dnet.c @@ -763,7 +763,7 @@ static int dnet_probe(struct platform_device *pdev) return -ENOMEM;
/* TODO: Actually, we have some interesting features... */ - netdev_feature_set_bits(0, &dev->features); + netdev_feature_set_bits(0, dev->features);
bp = netdev_priv(dev); bp->dev = dev; diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index b8faf89..a5ea320 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -4005,7 +4005,7 @@ static int be_vxlan_set_port(struct net_device *netdev, unsigned int table, netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL, - &netdev->hw_enc_features); + netdev->hw_enc_features);
dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n", be16_to_cpu(ti->port)); @@ -4027,7 +4027,7 @@ static int be_vxlan_unset_port(struct net_device *netdev, unsigned int table, adapter->flags &= ~BE_FLAGS_VXLAN_OFFLOADS; adapter->vxlan_port = 0;
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); return 0; }
@@ -5069,7 +5069,7 @@ static struct be_cmd_work *be_alloc_work(struct be_adapter *adapter, }
static void be_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct be_adapter *adapter = netdev_priv(dev); u8 l4_hdr = 0; @@ -5196,19 +5196,19 @@ static void be_netdev_init(struct net_device *netdev) NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->hw_features); + netdev->hw_features); if ((be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS)) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &netdev->features); + netdev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->vlan_features); + netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT;
@@ -5852,7 +5852,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (!status) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); } else { status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (status) { diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c index d2f0f93..40b5850 100644 --- a/drivers/net/ethernet/ethoc.c +++ b/drivers/net/ethernet/ethoc.c @@ -1219,7 +1219,7 @@ static int ethoc_probe(struct platform_device *pdev) /* setup the net_device structure */ netdev->netdev_ops = ðoc_netdev_ops; netdev->watchdog_timeo = ETHOC_TIMEOUT; - netdev_feature_set_bits(0, &netdev->features); + netdev_feature_set_bits(0, netdev->features); netdev->ethtool_ops = ðoc_ethtool_ops;
/* setup NAPI */ diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 8552bba..a740729 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1587,7 +1587,7 @@ static int ftgmac100_set_features(struct net_device *netdev, if (!netif_running(netdev)) return 0;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); /* Update the vlan filtering bit */ if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { u32 maccr; @@ -1905,25 +1905,25 @@ static int ftgmac100_probe(struct platform_device *pdev) priv->tx_q_entries = priv->new_tx_q_entries = DEF_TX_QUEUE_ENTRIES;
/* Base feature set */ - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_GRO | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->hw_features); + netdev->hw_features);
if (priv->use_ncsi) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
/* AST2400 doesn't have working HW checksum generation */ if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac"))) netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); if (np && of_get_property(np, "no-hw-checksum", NULL)) netdev_feature_clear_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
/* register network device */ diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 2087fd4..e967aa4 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -251,23 +251,23 @@ static int dpaa_netdev_init(struct net_device *net_dev,
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_LLTX | NETIF_F_RXHASH, - &net_dev->hw_features); + net_dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, - &net_dev->hw_features); + net_dev->hw_features);
/* The kernels enables GSO automatically, if we declare NETIF_F_SG. * For conformity, we'll still declare GSO explicitly. */ - netdev_feature_set_bit(NETIF_F_GSO_BIT, &net_dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &net_dev->features); + netdev_feature_set_bit(NETIF_F_GSO_BIT, net_dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, net_dev->features);
net_dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; /* we do not want shared skbs on TX */ net_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- netdev_feature_or(&net_dev->features, net_dev->features, + netdev_feature_or(net_dev->features, net_dev->features, net_dev->hw_features); - netdev_feature_copy(&net_dev->vlan_features, net_dev->features); + netdev_feature_copy(net_dev->vlan_features, net_dev->features);
if (is_valid_ether_addr(mac_addr)) { memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len); diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 39f762c..f68417a 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -2146,7 +2146,7 @@ static int dpaa2_eth_set_features(struct net_device *net_dev, bool enable; int err;
- netdev_feature_xor(&changed, features, net_dev->features); + netdev_feature_xor(changed, features, net_dev->features); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { enable = netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features); @@ -4108,17 +4108,17 @@ static int dpaa2_eth_netdev_init(struct net_device *net_dev) net_dev->priv_flags &= ~not_supported;
/* Features */ - netdev_feature_zero(&net_dev->features); + netdev_feature_zero(net_dev->features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_LLTX | NETIF_F_HW_TC, - &net_dev->features); - netdev_feature_copy(&net_dev->hw_features, net_dev->features); + net_dev->features); + netdev_feature_copy(net_dev->hw_features, net_dev->features);
if (priv->dpni_attrs.vlan_filter_entries) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->hw_features); + net_dev->hw_features);
return 0; } diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index aaad94f..23a27db 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -3262,10 +3262,10 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw, /* The DPAA2 switch's ingress path depends on the VLAN table, * thus we are not able to disable VLAN filtering. */ - netdev_feature_zero(&port_netdev->features); + netdev_feature_zero(port_netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER | - NETIF_F_HW_TC, &port_netdev->features); + NETIF_F_HW_TC, port_netdev->features);
err = dpaa2_switch_port_init(port_priv, port_idx); if (err) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index b0b4778..2c7b76d 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2360,7 +2360,7 @@ int enetc_set_features(struct net_device *ndev, __DECLARE_NETDEV_FEATURE_MASK(changed); int err = 0;
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) enetc_set_rss(ndev, netdev_feature_test_bit(NETIF_F_RXHASH_BIT, diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index ce17652..9c16228c 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -707,7 +707,7 @@ static int enetc_pf_set_features(struct net_device *ndev, struct enetc_ndev_priv *priv = netdev_priv(ndev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { @@ -764,19 +764,19 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->watchdog_timeo = 5 * HZ; ndev->max_mtu = ENETC_MAX_MTU;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_LOOPBACK, &ndev->hw_features); - netdev_feature_zero(&ndev->features); + NETIF_F_LOOPBACK, ndev->hw_features); + netdev_feature_zero(ndev->features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
if (si->num_rss) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features);
ndev->priv_flags |= IFF_UNICAST_FLT;
@@ -785,8 +785,8 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { priv->active_offloads |= ENETC_F_QCI; - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, ndev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, ndev->hw_features); }
/* pick up primary MAC address from SI */ diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index 553902f..31c7bb6 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -120,17 +120,17 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev, ndev->watchdog_timeo = 5 * HZ; ndev->max_mtu = ENETC_MAX_MTU;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->hw_features); - netdev_feature_zero(&ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->hw_features); + netdev_feature_zero(ndev->features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
if (si->num_rss) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features);
/* pick up primary MAC address from SI */ enetc_get_primary_mac_addr(&si->hw, ndev->dev_addr); diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 51d30f8..9f10ea2 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3371,8 +3371,8 @@ static inline void fec_enet_set_netdev_features(struct net_device *netdev, struct fec_enet_private *fep = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); - netdev_feature_copy(&netdev->features, features); + netdev_feature_xor(changed, features, netdev->features); + netdev_feature_copy(netdev->features, features);
/* Receive checksum has been changed */ if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { @@ -3389,7 +3389,7 @@ static int fec_set_features(struct net_device *netdev, struct fec_enet_private *fep = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netif_running(netdev) && netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { @@ -3560,7 +3560,7 @@ static int fec_enet_init(struct net_device *ndev) if (fep->quirks & FEC_QUIRK_HAS_VLAN) /* enable hw VLAN support */ netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &ndev->features); + ndev->features);
if (fep->quirks & FEC_QUIRK_HAS_CSUM) { ndev->gso_max_segs = FEC_MAX_TSO_SEGS; @@ -3568,7 +3568,7 @@ static int fec_enet_init(struct net_device *ndev) /* enable hw accelerator */ netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | - NETIF_F_TSO, &ndev->features); + NETIF_F_TSO, ndev->features); fep->csum_flags |= FLAG_RX_CSUM_ENABLED; }
@@ -3577,7 +3577,7 @@ static int fec_enet_init(struct net_device *ndev) fep->rx_align = 0x3f; }
- netdev_feature_copy(&ndev->hw_features, ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features);
fec_restart(ndev);
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 0796556..cd64e4a 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -1026,7 +1026,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
netif_carrier_off(ndev);
- netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features);
ret = register_netdev(ndev); if (ret) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 852b5d5..575a77a 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -3247,20 +3247,20 @@ static int gfar_probe(struct platform_device *ofdev) }
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM) { - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_RXCSUM, &dev->hw_features); + NETIF_F_RXCSUM, dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HIGHDMA, - &dev->features); + dev->features); }
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) { netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index e6395f1..bfdb705 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -503,7 +503,7 @@ int gfar_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); int err = 0;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (!netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | @@ -513,7 +513,7 @@ int gfar_set_features(struct net_device *dev, netdev_features_t features) while (test_and_set_bit_lock(GFAR_RESETTING, &priv->state)) cpu_relax();
- netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features);
if (dev->flags & IFF_UP) { /* Now we take down the rings to rebuild them */ diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c index e63476b..d37717f 100644 --- a/drivers/net/ethernet/google/gve/gve_adminq.c +++ b/drivers/net/ethernet/google/gve/gve_adminq.c @@ -719,7 +719,7 @@ int gve_adminq_describe_device(struct gve_priv *priv) } else { /* DQO supports LRO. */ netdev_feature_set_bit(NETIF_F_LRO_BIT, - &priv->dev->hw_features); + priv->dev->hw_features); err = gve_set_desc_cnt_dqo(priv, descriptor, dev_op_dqo_rda); } if (err) diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 8984a87..12d44d3 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -1117,11 +1117,11 @@ static int gve_set_features(struct net_device *netdev, struct gve_priv *priv = netdev_priv(netdev); int err;
- netdev_feature_copy(&orig_features, netdev->features); + netdev_feature_copy(orig_features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, netdev->features) != netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { - netdev_feature_change_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_change_bit(NETIF_F_LRO_BIT, netdev->features);
if (netif_carrier_ok(netdev)) { /* To make this process as simple as possible we @@ -1144,7 +1144,7 @@ static int gve_set_features(struct net_device *netdev, return 0; err: /* Reverts the change on error. */ - netdev_feature_copy(&netdev->features, orig_features); + netdev_feature_copy(netdev->features, orig_features); netif_err(priv, drv, netdev, "Set features failed! !!! DISABLING ALL QUEUES !!!\n"); return err; @@ -1522,16 +1522,16 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * Features might be set in other locations as well (such as * `gve_adminq_describe_device`). */ - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); dev->watchdog_timeo = 5 * HZ; dev->min_mtu = ETH_MIN_MTU; netif_carrier_off(dev); diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c index f91387e..27c420d 100644 --- a/drivers/net/ethernet/google/gve/gve_rx.c +++ b/drivers/net/ethernet/google/gve/gve_rx.c @@ -591,7 +591,7 @@ bool gve_rx_poll(struct gve_notify_block *block, int budget) struct gve_rx_ring *rx = block->rx; bool repoll = false;
- netdev_feature_copy(&feat, block->napi.dev->features); + netdev_feature_copy(feat, block->napi.dev->features);
/* If budget is 0, do all the work */ if (budget == 0) diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c index 90ac50d..7ceeb64 100644 --- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c +++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c @@ -672,7 +672,7 @@ int gve_rx_poll_dqo(struct gve_notify_block *block, int budget) u64 bytes = 0; int err;
- netdev_feature_copy(&feat, napi->dev->features); + netdev_feature_copy(feat, napi->dev->features);
while (work_done < budget) { struct gve_rx_compl_desc_dqo *compl_desc = diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c index da15dbf..aa5faf1 100644 --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c @@ -1234,11 +1234,11 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) SET_NETDEV_DEV(ndev, dev);
if (HAS_CAP_TSO(priv->hw_cap)) - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->hw_features);
- netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->hw_features); - netdev_feature_or(&ndev->vlan_features, ndev->vlan_features, + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->hw_features); + netdev_feature_or(ndev->vlan_features, ndev->vlan_features, ndev->features);
ret = hix5hd2_init_hw_desc_queue(priv); diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 7567afe..1d03427 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -1792,12 +1792,12 @@ static int hns_nic_set_features(struct net_device *netdev, } break; } - netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); return 0; }
static void hns_nic_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct hns_nic_priv *priv = netdev_priv(netdev);
@@ -2330,25 +2330,25 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO, &ndev->features); + NETIF_F_GRO, ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &ndev->vlan_features); + NETIF_F_RXCSUM, ndev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO, - &ndev->vlan_features); + ndev->vlan_features);
/* MTU range: 68 - 9578 (v1) or 9706 (v2) */ ndev->min_mtu = MAC_MIN_MTU; switch (priv->enet_ver) { case AE_VERSION_2: netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_NTUPLE, &ndev->features); + NETIF_F_NTUPLE, ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6, - &ndev->features); + ndev->features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &ndev->vlan_features); + ndev->vlan_features); ndev->max_mtu = MAC_MAX_MTU_V2 - (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN); break; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 4e74a02..5298900 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2316,7 +2316,7 @@ static int hns3_nic_set_features(struct net_device *netdev, bool enable; int ret;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, changed) && h->ae_algo->ops->set_gro_en) { @@ -2359,12 +2359,12 @@ static int hns3_nic_set_features(struct net_device *netdev, return ret; }
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); return 0; }
static void hns3_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { #define HNS3_MAX_HDR_LEN 480U #define HNS3_MAX_L4_HDR_LEN 60U @@ -3142,55 +3142,55 @@ static void hns3_set_default_feature(struct net_device *netdev) netdev->priv_flags |= IFF_UNICAST_FLT;
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
netdev_feature_set_bit_array(hns3_features_array, ARRAY_SIZE(hns3_features_array), - &netdev->features); + netdev->features);
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { - netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_GRO_HW_BIT, netdev->features);
if (!(h->flags & HNAE3_SUPPORT_VF)) netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &netdev->features); + netdev->features); }
if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps)) netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &netdev->features); + netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps)) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->features); else netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->features); + netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps)) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->features); + netdev->features);
if (test_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps)) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); if (!test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_HW | NETIF_F_NTUPLE | NETIF_F_HW_TC, - &netdev->hw_enc_features); + netdev->hw_enc_features);
- netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
static int hns3_alloc_buffer(struct hns3_enet_ring *ring, diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 196462c..676bcee 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -889,12 +889,12 @@ static int hinic_set_features(struct net_device *netdev, }
static void hinic_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct hinic_dev *nic_dev = netdev_priv(netdev);
/* If Rx checksum is disabled, then LRO should also be disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } @@ -942,24 +942,24 @@ static const struct net_device_ops hinicvf_netdev_ops = { static void netdev_features_init(struct net_device *netdev) {
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, &netdev->features); + netdev_feature_copy(netdev->features, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, netdev->features);
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
static void hinic_refresh_nic_cfg(struct hinic_dev *nic_dev) @@ -1086,11 +1086,11 @@ static int set_features(struct hinic_dev *nic_dev, int err = 0;
if (force_change) - netdev_feature_fill(&changed); + netdev_feature_fill(changed); else - netdev_feature_xor(&changed, pre_features, features); + netdev_feature_xor(changed, pre_features, features);
- netdev_feature_zero(&failed_features); + netdev_feature_zero(failed_features);
if (netdev_feature_test_bit(NETIF_F_TSO_BIT, changed)) { ret = hinic_port_set_tso(nic_dev, @@ -1100,7 +1100,7 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_TSO_BIT, - &failed_features); + failed_features); } }
@@ -1109,7 +1109,7 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &failed_features); + failed_features); } }
@@ -1122,7 +1122,7 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_LRO_BIT, - &failed_features); + failed_features); } }
@@ -1133,12 +1133,12 @@ static int set_features(struct hinic_dev *nic_dev, if (ret) { err = ret; netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &failed_features); + failed_features); } }
if (err) { - netdev_feature_xor(&nic_dev->netdev->features, features, failed_features); + netdev_feature_xor(nic_dev->netdev->features, features, failed_features); return -EIO; }
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index b7ca1c6..e5a9906 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c @@ -2991,20 +2991,20 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, dev->netdev_ops = &ehea_netdev_ops; ehea_set_ethtool_ops(dev);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX, - &dev->hw_features); - netdev_feature_zero(&dev->features); + dev->hw_features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM, - &dev->features); - netdev_feature_zero(&dev->vlan_features); + dev->features); + netdev_feature_zero(dev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | - NETIF_F_IP_CSUM, &dev->hw_features); + NETIF_F_IP_CSUM, dev->hw_features); dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
/* MTU range: 68 - 9022 */ diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index ff175e7..04779a9 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3170,11 +3170,11 @@ static int emac_probe(struct platform_device *ofdev) goto err_detach_tah;
if (dev->tah_dev) { - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &ndev->hw_features); - netdev_feature_copy(&ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); + ndev->hw_features); + netdev_feature_copy(ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features); } ndev->watchdog_timeo = 5 * HZ; if (emac_phy_supports_gige(dev->phy_mode)) { diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 7b9246d..a175d32 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -750,7 +750,7 @@ static void netdev_get_drvinfo(struct net_device *dev, }
static void ibmveth_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* * Since the ibmveth firmware interface does not have the @@ -761,7 +761,7 @@ static void ibmveth_fix_features(struct net_device *dev, * checksummed. */
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features); }
@@ -811,7 +811,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data)
if (data == 1) netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, - &dev->features); + dev->features);
} else { adapter->fw_ipv4_csum_support = data; @@ -830,7 +830,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data)
if (data == 1) netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, - &dev->features); + dev->features);
} else adapter->fw_ipv6_csum_support = data; @@ -892,7 +892,7 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) if (data == 1) netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &dev->features); + dev->features); rc1 = -EIO;
} else { @@ -905,7 +905,7 @@ static int ibmveth_set_tso(struct net_device *dev, u32 data) */ if (data == 1) { netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &dev->features); + dev->features); netdev_info(dev, "TSO feature requires all partitions to have updated driver"); } adapter->large_send = data; @@ -932,20 +932,20 @@ static int ibmveth_set_features(struct net_device *dev, if (rx_csum != adapter->rx_csum) { rc1 = ibmveth_set_csum_offload(dev, rx_csum); if (rc1 && !adapter->rx_csum) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_RXCSUM, - &dev->features); + dev->features); } }
if (large_send != adapter->large_send) { rc2 = ibmveth_set_tso(dev, large_send); if (rc2 && !adapter->large_send) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &dev->features); + dev->features); } }
@@ -1710,13 +1710,13 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) netdev->netdev_ops = &ibmveth_netdev_ops; netdev->ethtool_ops = &netdev_ethtool_ops; SET_NETDEV_DEV(netdev, &dev->dev); - netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); if (vio_get_attribute(dev, "ibm,illan-options", NULL) != NULL) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &netdev->hw_features); + NETIF_F_RXCSUM, netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
ret = h_illan_attributes(adapter->vdev->unit_address, 0, 0, &ret_attr); @@ -1725,19 +1725,19 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_LRG_SND_SUPPORT) && !old_large_send) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); } else { - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); }
adapter->is_active_trunk = false; if (ret == H_SUCCESS && (ret_attr & IBMVETH_ILLAN_ACTIVE_TRUNK)) { adapter->is_active_trunk = true; netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, &netdev->features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_FRAGLIST_BIT, netdev->features); }
netdev->min_mtu = IBMVETH_MIN_MTU; diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 1ced5c7..375b748 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2814,7 +2814,7 @@ static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu) }
static void ibmvnic_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* Some backing hardware adapters can not * handle packets with a MSS less than 224 @@ -4351,55 +4351,55 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter) ctrl_buf->large_rx_ipv6 = 0;
if (adapter->state != VNIC_PROBING) { - netdev_feature_copy(&old_hw_features, + netdev_feature_copy(old_hw_features, adapter->netdev->hw_features); - netdev_feature_zero(&adapter->netdev->hw_features); + netdev_feature_zero(adapter->netdev->hw_features); }
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (buf->tcp_ipv4_chksum || buf->udp_ipv4_chksum) netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (buf->tcp_ipv6_chksum || buf->udp_ipv6_chksum) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, adapter->netdev->features)) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (buf->large_tx_ipv4) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features); if (buf->large_tx_ipv6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &adapter->netdev->hw_features); + adapter->netdev->hw_features);
if (adapter->state == VNIC_PROBING) { - netdev_feature_or(&adapter->netdev->features, + netdev_feature_or(adapter->netdev->features, adapter->netdev->features, adapter->netdev->hw_features); } else if (!netdev_feature_equal(old_hw_features, adapter->netdev->hw_features)) { __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_zero(&tmp); + netdev_feature_zero(tmp);
/* disable features no longer supported */ - netdev_feature_and(&adapter->netdev->features, + netdev_feature_and(adapter->netdev->features, adapter->netdev->features, adapter->netdev->hw_features); /* turn on features now supported if previously enabled */ - netdev_feature_xor(&tmp, old_hw_features, + netdev_feature_xor(tmp, old_hw_features, adapter->netdev->hw_features); - netdev_feature_and(&tmp, tmp, adapter->netdev->hw_features); - netdev_feature_and(&tmp, tmp, + netdev_feature_and(tmp, tmp, adapter->netdev->hw_features); + netdev_feature_and(tmp, tmp, adapter->netdev->wanted_features); - netdev_feature_or(&adapter->netdev->features, + netdev_feature_or(adapter->netdev->features, adapter->netdev->features, tmp); }
@@ -4899,7 +4899,7 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq, be64_to_cpu(crq->query_capability.number); if (adapter->vlan_header_insertion) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &netdev->features); + netdev->features); netdev_dbg(netdev, "vlan_header_insertion = %lld\n", adapter->vlan_header_insertion); break; diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 4208d8f..5263a6a 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c @@ -2797,12 +2797,12 @@ static int e100_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); struct nic *nic = netdev_priv(netdev);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (!netdev_feature_test_bits(NETIF_F_RXFCS | NETIF_F_RXALL, changed)) return 0;
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); e100_exec_cb(nic, NULL, e100_configure); return 1; } @@ -2831,9 +2831,9 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (!(netdev = alloc_etherdev(sizeof(struct nic)))) return -ENOMEM;
- netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS; - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, netdev->hw_features);
netdev->netdev_ops = &e100_netdev_ops; netdev->ethtool_ops = &e100_ethtool_ops; @@ -2891,7 +2891,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* D100 MAC doesn't allow rx of vlan packets with normal MTU */ if (nic->mac < mac_82558_D101_A4) netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, - &netdev->features); + netdev->features);
/* locks must be initialized before calling hw_reset */ spin_lock_init(&nic->cb_lock); diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index c9406d9..c69fd24 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -788,12 +788,12 @@ static int e1000_is_need_ioport(struct pci_dev *pdev) }
static void e1000_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -806,7 +806,7 @@ static int e1000_set_features(struct net_device *netdev, struct e1000_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) e1000_vlan_mode(netdev, features); @@ -814,7 +814,7 @@ static int e1000_set_features(struct net_device *netdev, if (!netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_RXALL, changed)) return 0;
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features); adapter->rx_csum = netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features);
@@ -1037,40 +1037,40 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }
if (hw->mac_type >= e1000_82543) { - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_zero(&netdev->features); + netdev->hw_features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER, - &netdev->features); + netdev->features); }
if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_82547)) - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_RXALL | NETIF_F_RXFCS, - &netdev->hw_features); + netdev->hw_features);
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO | NETIF_F_SG, - &netdev->vlan_features); + netdev->vlan_features);
/* Do not set IFF_UNICAST_FLT for VMWare's 82545EM */ if (hw->device_id != E1000_DEV_ID_82545EM_COPPER || diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 4e36331..241d671 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -5316,15 +5316,15 @@ static void e1000_watchdog_task(struct work_struct *work) case SPEED_100: e_info("10/100 speed: disabling TSO\n"); netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); break; case SPEED_1000: netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); break; default: /* oops */ @@ -5332,9 +5332,9 @@ static void e1000_watchdog_task(struct work_struct *work) } if (hw->mac.type == e1000_pch_spt) { netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); } }
@@ -7305,7 +7305,7 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter) }
static void e1000_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; @@ -7317,7 +7317,7 @@ static void e1000_fix_features(struct net_device *netdev, /* Since there is no support for separate Rx/Tx vlan accel * enable/disable make sure Tx flag is always in same state as Rx. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -7330,7 +7330,7 @@ static int e1000_set_features(struct net_device *netdev, struct e1000_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, changed)) adapter->flags |= FLAG_TSO_FORCE; @@ -7356,7 +7356,7 @@ static int e1000_set_features(struct net_device *netdev, } }
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netif_running(netdev)) e1000e_reinit_locked(adapter); @@ -7546,7 +7546,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) "PHY reset is blocked due to SOL/IDER session.\n");
/* Set initial default active device features */ - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | @@ -7555,30 +7555,30 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_CSUM, - &netdev->features); + netdev->features);
/* Set user-changeable features (subset of all device features) */ - netdev_feature_copy(&netdev->hw_features, netdev->features); - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); + netdev_feature_copy(netdev->hw_features, netdev->features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, netdev->hw_features); netdev->priv_flags |= IFF_SUPP_NOFCS; - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, netdev->hw_features);
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_CSUM, - &netdev->vlan_features); + netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT;
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
/* MTU range: 68 - max_hw_frame_size */ diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c index ed2871d..f66803b 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c @@ -775,7 +775,7 @@ static int fm10k_tso(struct fm10k_ring *tx_ring,
err_vxlan: netdev_feature_clear_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &tx_ring->netdev->features); + tx_ring->netdev->features); if (net_ratelimit()) netdev_err(tx_ring->netdev, "TSO requested for unsupported tunnel, disabling offload\n"); diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c index dbefa24..8525dee 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c @@ -1505,7 +1505,7 @@ static void fm10k_dfwd_del_station(struct net_device *dev, void *priv) }
static void fm10k_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { if (!skb->encapsulation || fm10k_tx_encap_offload(skb)) return; @@ -1565,7 +1565,7 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) NETIF_F_TSO_ECN | NETIF_F_RXHASH | NETIF_F_RXCSUM, - &dev->features); + dev->features);
/* Only the PF can support VXLAN and NVGRE tunnel offloads */ if (info->mac == fm10k_mac_pf) { @@ -1576,22 +1576,22 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_IPV6_CSUM | NETIF_F_SG, - &dev->hw_enc_features); + dev->hw_enc_features);
netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &dev->features); + dev->features);
dev->udp_tunnel_nic_info = &fm10k_udp_tunnels; }
/* all features defined to this point should be changeable */ - netdev_feature_copy(&hw_features, dev->features); + netdev_feature_copy(hw_features, dev->features);
/* allow user to enable L2 forwarding acceleration */ - netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, hw_features);
/* configure VLAN features */ - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features);
/* we want to leave these both on as we cannot disable VLAN tag @@ -1601,12 +1601,11 @@ struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features);
dev->priv_flags |= IFF_UNICAST_FLT;
- netdev_feature_or(&dev->hw_features, dev->hw_features, - hw_features); + netdev_feature_or(dev->hw_features, dev->hw_features, hw_features);
/* MTU range: 68 - 15342 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c index 48c1206..6611cb8 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c @@ -306,10 +306,10 @@ static int fm10k_handle_reset(struct fm10k_intfc *interface)
if (hw->mac.vlan_override) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->features); + netdev->features); else netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->features); + netdev->features); }
err = netif_running(netdev) ? fm10k_open(netdev) : 0; @@ -2012,9 +2012,9 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
/* update netdev with DMA restrictions */ if (dma_get_mask(&pdev->dev) > DMA_BIT_MASK(32)) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
/* reset and initialize the hardware so it is in a known state */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index be4f636..681a5b2 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -12878,7 +12878,7 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, * @features: Offload features that the stack believes apply **/ static void i40e_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { size_t len;
@@ -13329,7 +13329,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) np = netdev_priv(netdev); np->vsi = vsi;
- netdev_feature_zero(&hw_enc_features); + netdev_feature_zero(hw_enc_features); netdev_feature_set_bits(NETIF_F_SG_BIT | NETIF_F_IP_CSUM_BIT | NETIF_F_IPV6_CSUM_BIT | @@ -13350,50 +13350,50 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) NETIF_F_SCTP_CRC_BIT | NETIF_F_RXHASH_BIT | NETIF_F_RXCSUM_BIT, - &hw_enc_features); + hw_enc_features);
if (!(pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE)) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
netdev->udp_tunnel_nic_info = &pf->udp_tunnel_nic;
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
- netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, hw_enc_features);
/* record features VLANs can make use of */ - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); + netdev->vlan_features);
/* enable macvlan offloads */ netdev_feature_set_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&hw_features, hw_enc_features); + netdev_feature_copy(hw_features, hw_enc_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &hw_features); + hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &hw_features); + hw_features);
if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) { - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &hw_features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, hw_features); }
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
if (vsi->type == I40E_VSI_MAIN) { SET_NETDEV_DEV(netdev, &pf->pdev->dev); diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index c4a5924..d36e9b4 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3361,7 +3361,7 @@ static int iavf_set_features(struct net_device *netdev, struct iavf_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); /* Don't allow changing VLAN_RX flag when adapter is not capable * of VLAN offload */ @@ -3390,7 +3390,7 @@ static int iavf_set_features(struct net_device *netdev, * @features: Offload features that the stack believes apply **/ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { size_t len;
@@ -3449,7 +3449,7 @@ static void iavf_features_check(struct sk_buff *skb, struct net_device *dev, * Returns fixed-up features bits **/ static void iavf_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct iavf_adapter *adapter = netdev_priv(netdev);
@@ -3542,7 +3542,7 @@ int iavf_process_config(struct iavf_adapter *adapter) } adapter->num_req_queues = 0;
- netdev_feature_zero(&hw_enc_features); + netdev_feature_zero(hw_enc_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -3554,7 +3554,7 @@ int iavf_process_config(struct iavf_adapter *adapter) NETIF_F_SCTP_CRC | NETIF_F_RXHASH | NETIF_F_RXCSUM, - &hw_enc_features); + hw_enc_features);
/* advertise to stack only if offloads for encapsulated packets is * supported @@ -3567,49 +3567,49 @@ int iavf_process_config(struct iavf_adapter *adapter) NETIF_F_GSO_IPXIP6 | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &hw_enc_features); + hw_enc_features);
if (!(vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM)) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->hw_enc_features); - netdev_feature_or(&netdev->hw_enc_features, + netdev->hw_enc_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, hw_enc_features); } /* record features VLANs can make use of */ - netdev_feature_or(&netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); + netdev->vlan_features);
/* Write features and hw_features separately to avoid polluting * with, or dropping, features that are set when we registered. */ - netdev_feature_copy(&hw_features, hw_enc_features); + netdev_feature_copy(hw_features, hw_enc_features);
/* Enable VLAN features if supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &hw_features); + NETIF_F_HW_VLAN_CTAG_RX, hw_features); /* Enable cloud filter if ADQ is supported */ if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, hw_features); if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_USO) - netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, hw_features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, hw_features);
- netdev_feature_or(&netdev->features, netdev->features, hw_features); + netdev_feature_or(netdev->features, netdev->features, hw_features);
if (vfres->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
@@ -3621,24 +3621,24 @@ int iavf_process_config(struct iavf_adapter *adapter) netdev->wanted_features) || netdev->mtu < 576) netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_TSO6_BIT, netdev->wanted_features) || netdev->mtu < 576) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, netdev->wanted_features)) netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, netdev->wanted_features)) netdev_feature_clear_bit(NETIF_F_GRO_BIT, - &netdev->features); + netdev->features); if (!netdev_feature_test_bit(NETIF_F_GSO_BIT, netdev->wanted_features)) netdev_feature_clear_bit(NETIF_F_GSO_BIT, - &netdev->features); + netdev->features); }
adapter->vsi.id = adapter->vsi_res->vsi_id; diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 32b0613..b1ecc09 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3053,34 +3053,34 @@ static void ice_set_netdev_features(struct net_device *netdev)
if (ice_is_safe_mode(pf)) { /* safe mode */ - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA, - &netdev->features); - netdev_feature_copy(&netdev->hw_features, netdev->features); + netdev->features); + netdev_feature_copy(netdev->hw_features, netdev->features); return; }
- netdev_feature_zero(&dflt_features); + netdev_feature_zero(dflt_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_NTUPLE | NETIF_F_RXHASH, - &dflt_features); + dflt_features);
- netdev_feature_zero(&csumo_features); + netdev_feature_zero(csumo_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SCTP_CRC | NETIF_F_IPV6_CSUM, - &csumo_features); + csumo_features);
- netdev_feature_zero(&vlano_features); + netdev_feature_zero(vlano_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &vlano_features); + vlano_features);
- netdev_feature_zero(&tso_features); + netdev_feature_zero(tso_features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | @@ -3092,34 +3092,34 @@ static void ice_set_netdev_features(struct net_device *netdev) NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6 | NETIF_F_GSO_UDP_L4, - &tso_features); + tso_features);
netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM, - &netdev->gso_partial_features); + netdev->gso_partial_features); /* set features that user can change */ - netdev_feature_or(&netdev->hw_features, dflt_features, + netdev_feature_or(netdev->hw_features, dflt_features, csumo_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, vlano_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, tso_features);
/* add support for HW_CSUM on packets with MPLS header */ - netdev_feature_zero(&netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); + netdev_feature_zero(netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features);
/* enable features */ - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); /* encap and VLAN devices inherit default, csumo and tso features */ - netdev_feature_or(&netdev->hw_enc_features, dflt_features, + netdev_feature_or(netdev->hw_enc_features, dflt_features, csumo_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, tso_features); - netdev_feature_or(&netdev->vlan_features, dflt_features, + netdev_feature_or(netdev->vlan_features, dflt_features, csumo_features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, tso_features); }
@@ -7199,7 +7199,7 @@ int ice_stop(struct net_device *netdev) */ static void ice_features_check(struct sk_buff *skb, struct net_device __always_unused *netdev, - netdev_features_t *features) + netdev_features_t features) { size_t len;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index e4582a4..3d67f5c 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -2434,12 +2434,12 @@ void igb_reset(struct igb_adapter *adapter) }
static void igb_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -2452,7 +2452,7 @@ static int igb_set_features(struct net_device *netdev, struct igb_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igb_vlan_mode(netdev, features); @@ -2475,7 +2475,7 @@ static int igb_set_features(struct net_device *netdev, adapter->nfc_filter_count = 0; }
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netif_running(netdev)) igb_reinit_locked(adapter); @@ -2507,7 +2507,7 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], #define IGB_MAX_NETWORK_HDR_LEN 511
static void igb_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -2539,7 +2539,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
@@ -3278,14 +3278,14 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_CSUM, - &netdev->features); + netdev->features);
if (hw->mac.type >= e1000_82576) netdev_feature_set_bits(NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4, - &netdev->features); + netdev->features);
if (hw->mac.type >= e1000_i350) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
#define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -3294,41 +3294,41 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IGB_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGB_GSO_PARTIAL_FEATURES, - &netdev->features); + netdev->features);
/* copy netdev features into list of user selectable features */ - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXALL, - &netdev->hw_features); + netdev->hw_features);
if (hw->mac.type >= e1000_i350) netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, - &netdev->hw_features); + netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_SUPP_NOFCS;
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 2cad7a2..4b89ee6 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2620,7 +2620,7 @@ static int igbvf_set_features(struct net_device *netdev, #define IGBVF_MAX_NETWORK_HDR_LEN 511
static void igbvf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -2650,7 +2650,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
@@ -2770,14 +2770,14 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
adapter->bd_number = cards_found++;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_SCTP_CRC, - &netdev->hw_features); + netdev->hw_features);
#define IGBVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -2786,31 +2786,31 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IGBVF_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGBVF_GSO_PARTIAL_FEATURES, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
/* MTU range: 68 - 9216 */ netdev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 2bfdc74..e25464a 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4914,12 +4914,12 @@ static void igc_get_stats64(struct net_device *netdev, }
static void igc_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t 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. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, @@ -4932,7 +4932,7 @@ static int igc_set_features(struct net_device *netdev, struct igc_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) igc_vlan_mode(netdev, features); @@ -4944,7 +4944,7 @@ static int igc_set_features(struct net_device *netdev, if (!netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features)) igc_flush_nfc_rules(adapter);
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netif_running(netdev)) igc_reinit_locked(adapter); @@ -4955,7 +4955,7 @@ static int igc_set_features(struct net_device *netdev, }
static void igc_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -4985,7 +4985,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bits(NETIF_F_TSO_BIT, features); }
@@ -6242,14 +6242,14 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* Add supported features to the features list*/ - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_SCTP_CRC_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_SCTP_CRC_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
#define IGC_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -6258,11 +6258,11 @@ static int igc_probe(struct pci_dev *pdev, NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IGC_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IGC_GSO_PARTIAL_FEATURES, - &netdev->features); + netdev->features);
/* setup the private structure */ err = igc_sw_init(adapter); @@ -6270,18 +6270,18 @@ static int igc_probe(struct pci_dev *pdev, goto err_sw_init;
/* copy netdev features into list of user selectable features */ - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev->hw_features); + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features);
/* MTU range: 68 - 9216 */ diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 4357e43..1e75c76 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -294,13 +294,13 @@ ixgb_reset(struct ixgb_adapter *adapter) }
static void ixgb_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { /* * Tx VLAN insertion does not work per HW design when Rx stripping is * disabled. */ - if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); } @@ -311,7 +311,7 @@ ixgb_set_features(struct net_device *netdev, netdev_features_t features) struct ixgb_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (!netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX, @@ -438,22 +438,22 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto err_sw_init;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features); + netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features);
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
/* MTU range: 68 - 16114 */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 57009d1..2c2eaa2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c @@ -859,7 +859,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
/* enable FCoE and notify stack */ adapter->flags |= IXGBE_FLAG_FCOE_ENABLED; - netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_FCOE_MTU_BIT, netdev->features); netdev_features_change(netdev);
/* release existing queues and reallocate them */ @@ -899,7 +899,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
/* disable FCoE and notify stack */ adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; - netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_FCOE_MTU_BIT, netdev->features);
netdev_features_change(netdev);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index fc31773..cae9740 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -4904,7 +4904,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) __DECLARE_NETDEV_FEATURE_MASK(features); int count;
- netdev_feature_copy(&features, netdev->features); + netdev_feature_copy(features, netdev->features);
/* Check for Promiscuous and All Multicast modes */ fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); @@ -4922,7 +4922,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); vmolr |= IXGBE_VMOLR_MPE; netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &features); + features); } else { if (netdev->flags & IFF_ALLMULTI) { fctrl |= IXGBE_FCTRL_MPE; @@ -9692,12 +9692,12 @@ void ixgbe_do_reset(struct net_device *netdev) }
static void ixgbe_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct ixgbe_adapter *adapter = netdev_priv(netdev);
/* If Rx checksum is disabled, then RSC/LRO should also be disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
/* Turn off LRO if not RSC capable */ @@ -9705,7 +9705,7 @@ static void ixgbe_fix_features(struct net_device *netdev, netdev_feature_clear_bit(NETIF_F_LRO_BIT, features);
if (adapter->xdp_prog && - netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { e_dev_err("LRO is not supported with XDP\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } @@ -9734,7 +9734,7 @@ static int ixgbe_set_features(struct net_device *netdev, __DECLARE_NETDEV_FEATURE_MASK(changed); bool need_reset = false;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
/* Make sure RSC matches LRO, reset if change */ if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { @@ -9789,7 +9789,7 @@ static int ixgbe_set_features(struct net_device *netdev, if (netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) need_reset = true;
- netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_L2FW_DOFFLOAD_BIT, changed) && adapter->num_rx_pools > 1) @@ -10082,7 +10082,7 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv) #define IXGBE_MAX_NETWORK_HDR_LEN 511
static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -10116,7 +10116,7 @@ static void ixgbe_features_check(struct sk_buff *skb, struct net_device *dev, * the TSO, so it's the exception. */ if (skb->encapsulation && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) { + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) { #ifdef CONFIG_IXGBE_IPSEC if (!secpath_exists(skb)) #endif @@ -10806,14 +10806,14 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) skip_sriov:
#endif - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_CSUM, - &netdev->features); + netdev->features);
#define IXGBE_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -10822,17 +10822,17 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IXGBE_GSO_PARTIAL_FEATURES, - &netdev->features); + netdev->features);
if (hw->mac.type >= ixgbe_mac_82599EB) netdev_feature_set_bits(NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4, - &netdev->features); + netdev->features);
#ifdef CONFIG_IXGBE_IPSEC #define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \ @@ -10840,45 +10840,45 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_ESP)
if (adapter->ipsec) - netdev_feature_set_bits(IXGBE_ESP_FEATURES, &netdev->features); + netdev_feature_set_bits(IXGBE_ESP_FEATURES, netdev->features); #endif /* copy netdev features into list of user selectable features */ - netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXALL | NETIF_F_HW_L2FW_DOFFLOAD, - &netdev->hw_features); + netdev->hw_features);
if (hw->mac.type >= ixgbe_mac_82599EB) netdev_feature_set_bits(NETIF_F_NTUPLE | NETIF_F_HW_TC, - &netdev->hw_features); + netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->vlan_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_CSUM, - &netdev->mpls_features); + netdev->mpls_features); netdev_feature_set_bits(IXGBE_GSO_PARTIAL_FEATURES, - &netdev->mpls_features); + netdev->mpls_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT; netdev->priv_flags |= IFF_SUPP_NOFCS; @@ -10908,18 +10908,18 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_feature_set_bits(NETIF_F_FSO | NETIF_F_FCOE_CRC, - &netdev->features); + netdev->features);
netdev_feature_set_bits(NETIF_F_FSO | NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU, - &netdev->vlan_features); + netdev->vlan_features); } #endif /* IXGBE_FCOE */ if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->hw_features); if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->features);
if (ixgbe_check_fw_error(adapter)) { err = -EIO; diff --git a/drivers/net/ethernet/intel/ixgbevf/ipsec.c b/drivers/net/ethernet/intel/ixgbevf/ipsec.c index 60288ef..3288a0d5 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ipsec.c +++ b/drivers/net/ethernet/intel/ixgbevf/ipsec.c @@ -656,9 +656,9 @@ void ixgbevf_init_ipsec_offload(struct ixgbevf_adapter *adapter) NETIF_F_GSO_ESP)
netdev_feature_set_bits(IXGBEVF_ESP_FEATURES, - &adapter->netdev->features); + adapter->netdev->features); netdev_feature_set_bits(IXGBEVF_ESP_FEATURES, - &adapter->netdev->hw_enc_features); + adapter->netdev->hw_enc_features);
return;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index f3d7e74..8a85159 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -4385,7 +4385,7 @@ static void ixgbevf_get_stats(struct net_device *netdev, #define IXGBEVF_MAX_NETWORK_HDR_LEN 511
static void ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { unsigned int network_hdr_len, mac_hdr_len;
@@ -4415,7 +4415,7 @@ static void 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 && - !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); }
@@ -4587,14 +4587,14 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_sw_init; }
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_SCTP_CRC, - &netdev->hw_features); + netdev->hw_features);
#define IXGBEVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \ NETIF_F_GSO_GRE_CSUM | \ @@ -4603,37 +4603,37 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
- netdev_feature_zero(&netdev->gso_partial_features); + netdev_feature_zero(netdev->gso_partial_features); netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES, - &netdev->gso_partial_features); + netdev->gso_partial_features); netdev_feature_set_bits(NETIF_F_GSO_PARTIAL | IXGBEVF_GSO_PARTIAL_FEATURES, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &netdev->vlan_features); + netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_CSUM, - &netdev->mpls_features); + netdev->mpls_features); netdev_feature_set_bits(IXGBEVF_GSO_PARTIAL_FEATURES, - &netdev->mpls_features); - netdev_feature_or(&netdev->hw_enc_features, netdev->hw_enc_features, + netdev->mpls_features); + netdev_feature_or(netdev->hw_enc_features, netdev->hw_enc_features, netdev->vlan_features);
/* set this bit last since it cannot be part of vlan_features */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->features); + netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 007e418..1f97b1d 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c @@ -2672,7 +2672,7 @@ jme_set_msglevel(struct net_device *netdev, u32 value) }
static void jme_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (netdev->mtu > 1900) netdev_feature_clear_bits(NETIF_F_ALL_TSO | NETIF_F_CSUM_MASK, @@ -2969,15 +2969,15 @@ jme_init_one(struct pci_dev *pdev, netdev->netdev_ops = &jme_netdev_ops; netdev->ethtool_ops = &jme_ethtool_ops; netdev->watchdog_timeo = TX_TIMEOUT; - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM, - &netdev->hw_features); - netdev_feature_zero(&netdev->features); + netdev->hw_features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | @@ -2985,9 +2985,9 @@ jme_init_one(struct pci_dev *pdev, NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->features); + netdev->features); if (using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
/* MTU range: 1280 - 9202*/ netdev->min_mtu = IPV6_MIN_MTU; @@ -3050,7 +3050,7 @@ jme_init_one(struct pci_dev *pdev, jme->reg_gpreg1 = GPREG1_DEFAULT;
if (jme->reg_rxmcs & RXMCS_CHECKSUM) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features);
/* * Get Max Read Req Size from PCI Config Space diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index dcb77f8..52bffcd 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -3184,13 +3184,13 @@ static int mv643xx_eth_probe(struct platform_device *pdev) dev->watchdog_timeo = 2 * HZ; dev->base_addr = 0;
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO, - &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + dev->features); + netdev_feature_copy(dev->vlan_features, dev->features);
- netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_copy(&dev->hw_features, dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_copy(dev->hw_features, dev->features);
dev->priv_flags |= IFF_UNICAST_FLT; dev->gso_max_segs = MV643XX_MAX_TSO_SEGS; diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index a6a0be2..2e20bfc 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3771,7 +3771,7 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) }
static void mvneta_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct mvneta_port *pp = netdev_priv(dev);
@@ -5334,12 +5334,12 @@ static int mvneta_probe(struct platform_device *pdev) } }
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_RXCSUM, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->vlan_features, dev->vlan_features, + NETIF_F_TSO | NETIF_F_RXCSUM, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, dev->features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; dev->gso_max_segs = MVNETA_MAX_TSO_SEGS; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 295e0d1..8e0c291 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1267,8 +1267,8 @@ static void mvpp2_set_hw_csum(struct mvpp2_port *port, { __DECLARE_NETDEV_FEATURE_MASK(csums);
- netdev_feature_zero(&csums); - netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, &csums); + netdev_feature_zero(csums); + netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, csums);
/* Update L4 checksum when jumbo enable/disable on port. * Only port 0 supports hardware checksum offload due to @@ -1277,14 +1277,14 @@ static void mvpp2_set_hw_csum(struct mvpp2_port *port, * has 7 bits, so the maximum L3 offset is 128. */ if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { - netdev_feature_andnot(&port->dev->features, + netdev_feature_andnot(port->dev->features, port->dev->features, csums); - netdev_feature_andnot(&port->dev->hw_features, + netdev_feature_andnot(port->dev->hw_features, port->dev->hw_features, csums); } else { - netdev_feature_or(&port->dev->features, port->dev->features, + netdev_feature_or(port->dev->features, port->dev->features, csums); - netdev_feature_or(&port->dev->hw_features, + netdev_feature_or(port->dev->hw_features, port->dev->hw_features, csums); } } @@ -1349,23 +1349,23 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu) if (new_long_pool == MVPP2_BM_JUMBO && port->id != 0) { netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->features); + dev->features); netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->hw_features); + dev->hw_features); } else { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->hw_features); + dev->hw_features); } }
out_set: dev->mtu = mtu; - netdev_feature_copy(&dev->wanted_features, dev->features); + netdev_feature_copy(dev->wanted_features, dev->features);
netdev_update_features(dev); return 0; @@ -5291,7 +5291,7 @@ static int mvpp2_set_features(struct net_device *dev, struct mvpp2_port *port = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, @@ -6927,24 +6927,24 @@ static int mvpp2_port_probe(struct platform_device *pdev, } }
- netdev_feature_zero(&features); + netdev_feature_zero(features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM | NETIF_F_TSO, &features); - netdev_feature_copy(&dev->features, features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, features); + NETIF_F_IPV6_CSUM | NETIF_F_TSO, features); + netdev_feature_copy(dev->features, features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_GRO | - NETIF_F_HW_VLAN_CTAG_FILTER, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_FILTER, dev->hw_features);
if (mvpp22_rss_is_supported(port)) { - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, dev->features); }
if (!port->priv->percpu_pools) mvpp2_set_hw_csum(port, port->pool_long->id);
- netdev_feature_or(&dev->vlan_features, dev->vlan_features, features); + netdev_feature_or(dev->vlan_features, dev->vlan_features, features); dev->gso_max_segs = MVPP2_MAX_TSO_SEGS; dev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c index 34f9e9e..307ef95 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -483,7 +483,7 @@ void otx2_setup_segmentation(struct otx2_nic *pfvf) netdev_info(pfvf->netdev, "Failed to get LSO index for UDP GSO offload, disabling\n"); netdev_feature_clear_bit(NETIF_F_GSO_UDP_L4_BIT, - &pfvf->netdev->hw_features); + pfvf->netdev->hw_features); }
void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index de19cb3..baba90f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1785,17 +1785,17 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev) }
static void otx2_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* check if n-tuple filters are ON */ - if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features)) { netdev_info(dev, "Disabling n-tuple filters\n"); netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, features); }
/* check if tc hw offload is ON */ - if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, features) && netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, dev->features)) { netdev_info(dev, "Disabling TC hardware offload\n"); netdev_feature_clear_bit(NETIF_F_HW_TC_BIT, features); @@ -1855,7 +1855,7 @@ static int otx2_set_features(struct net_device *netdev, struct otx2_nic *pf = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && netif_running(netdev)) @@ -2570,43 +2570,43 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id) */ pf->iommu_domain = iommu_get_domain_for_dev(dev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_L4, &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + NETIF_F_GSO_UDP_L4, netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev_feature_set_bits(NETIF_F_LOOPBACK | NETIF_F_RXALL, - &netdev->hw_features); + netdev->hw_features);
err = otx2_mcam_flow_init(pf); if (err) goto err_ptp_destroy;
if (pf->flags & OTX2_FLAG_NTUPLE_SUPPORT) - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features);
if (pf->flags & OTX2_FLAG_UCAST_FLTR_SUPPORT) netdev->priv_flags |= IFF_UNICAST_FLT;
/* Support TSO on tag interface */ - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &netdev->hw_features); + netdev->hw_features); if (pf->flags & OTX2_FLAG_RX_VLAN_SUPPORT) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
/* HW supports tc offload but mutually exclusive with n-tuple filters */ if (pf->flags & OTX2_FLAG_TC_FLOWER_SUPPORT) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features);
netdev->gso_max_segs = OTX2_MAX_GSO_SEGS; netdev->watchdog_timeo = OTX2_TX_TIMEOUT; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c index e23791b..a2a7350 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -616,19 +616,19 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Assign default mac address */ otx2_get_mac_from_af(netdev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GSO_UDP_L4, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + NETIF_F_GSO_UDP_L4, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); /* Support TSO on tag interface */ - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &netdev->hw_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev->hw_features); + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev->gso_max_segs = OTX2_MAX_GSO_SEGS; diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 0867c77..999f21f 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -317,7 +317,7 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id) goto err_dl_port_register;
netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_HW_TC, - &dev->features); + dev->features); dev->netdev_ops = &prestera_netdev_ops; dev->ethtool_ops = &prestera_ethtool_ops;
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 66fda62..75a0a66 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c @@ -3821,7 +3821,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, dev->max_mtu = ETH_JUMBO_MTU;
if (highmem) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
skge = netdev_priv(dev); netif_napi_add(dev, &skge->napi, skge_poll, NAPI_WEIGHT); @@ -3853,8 +3853,8 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, timer_setup(&skge->link_timer, xm_link_timer, 0); else { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | - NETIF_F_RXCSUM, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, + NETIF_F_RXCSUM, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); }
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index e46621c..5446e5a 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -1419,15 +1419,14 @@ static void sky2_vlan_mode(struct net_device *dev, netdev_features_t features) sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_ON);
- netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, - &dev->vlan_features); + netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, dev->vlan_features); } else { sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
/* Can't do transmit offload of vlan without hw vlan */ netdev_feature_clear_bits(SKY2_VLAN_OFFLOADS, - &dev->vlan_features); + dev->vlan_features); } }
@@ -2682,7 +2681,7 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status) * really broken, will get disabled again */ netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &sky2->netdev->features); + sky2->netdev->features); sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), BMU_DIS_RX_CHKSUM); } @@ -4361,7 +4360,7 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom }
static void sky2_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { const struct sky2_port *sky2 = netdev_priv(dev); const struct sky2_hw *hw = sky2->hw; @@ -4376,8 +4375,8 @@ static void sky2_fix_features(struct net_device *dev, }
/* Some hardware requires receive checksum for RSS to work. */ - if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, features) && + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && (sky2->hw->flags & SKY2_HW_RSS_CHKSUM)) { netdev_info(dev, "receive hashing forces receive checksum\n"); netdev_feature_clear_bits(NETIF_F_RXCSUM_BIT, features); @@ -4389,7 +4388,7 @@ static int sky2_set_features(struct net_device *dev, netdev_features_t features) struct sky2_port *sky2 = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed) && !(sky2->hw->flags & SKY2_HW_NEW_LE)) { @@ -4759,7 +4758,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, /* Auto speed and flow control */ sky2->flags = SKY2_FLAG_AUTO_SPEED | SKY2_FLAG_AUTO_PAUSE; if (hw->chip_id != CHIP_ID_YUKON_XL) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features);
sky2->flow_mode = FC_BOTH;
@@ -4779,24 +4778,24 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, sky2->port = port;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO, - &dev->hw_features); + dev->hw_features);
if (highmem) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
/* Enable receive hashing unless hardware is known broken */ if (!(hw->flags & SKY2_HW_RSS_BROKEN)) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, dev->hw_features);
if (!(hw->flags & SKY2_HW_VLAN_BROKEN)) { netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bits(SKY2_VLAN_OFFLOADS, - &dev->vlan_features); + dev->vlan_features); }
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
/* MTU range: 60 - 1500 or 9000 */ dev->min_mtu = ETH_ZLEN; diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index ae314ec..aebd650 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -2023,9 +2023,9 @@ static int mtk_hwlro_get_fdir_all(struct net_device *dev, }
static void mtk_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { - if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { struct mtk_mac *mac = netdev_priv(dev); int ip_cnt = mtk_hwlro_get_ip_cnt(mac);
@@ -3031,21 +3031,21 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) eth->netdev[id]->netdev_ops = &mtk_netdev_ops; eth->netdev[id]->base_addr = (unsigned long)eth->base;
- netdev_feature_zero(ð->netdev[id]->hw_features); + netdev_feature_zero(eth->netdev[id]->hw_features); netdev_feature_set_bits(eth->soc->hw_features, - ð->netdev[id]->hw_features); + eth->netdev[id]->hw_features); if (eth->hwlro) netdev_feature_set_bit(NETIF_F_LRO_BIT, - ð->netdev[id]->hw_features); + eth->netdev[id]->hw_features);
- netdev_feature_zero(ð->netdev[id]->vlan_features); + netdev_feature_zero(eth->netdev[id]->vlan_features); netdev_feature_set_bits(eth->soc->hw_features, - ð->netdev[id]->vlan_features); + eth->netdev[id]->vlan_features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - ð->netdev[id]->vlan_features); + eth->netdev[id]->vlan_features); netdev_feature_set_bits(eth->soc->hw_features, - ð->netdev[id]->features); + eth->netdev[id]->features); eth->netdev[id]->ethtool_ops = &mtk_ethtool_ops;
eth->netdev[id]->irq = eth->irq[0]; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f0bb981..7a4f5fe 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c @@ -2480,7 +2480,7 @@ static int mlx4_en_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) }
static void mlx4_en_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct mlx4_en_priv *en_priv = netdev_priv(netdev); struct mlx4_en_dev *mdev = en_priv->mdev; @@ -2489,7 +2489,7 @@ static void mlx4_en_fix_features(struct net_device *netdev, * enable/disable make sure S-TAG flag is always in same state as * C-TAG. */ - if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features) && !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, features); else @@ -2665,7 +2665,7 @@ static const struct udp_tunnel_nic_info mlx4_udp_tunnels = { };
static void mlx4_en_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); vxlan_features_check(skb, features); @@ -3308,59 +3308,59 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, /* * Set driver features */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &dev->hw_features); + NETIF_F_IPV6_CSUM, dev->hw_features); if (mdev->LSO_support) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features);
if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &dev->hw_features); + dev->hw_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &dev->features); - netdev_feature_zero(&dev->gso_partial_features); + dev->features); + netdev_feature_zero(dev->gso_partial_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &dev->gso_partial_features); - netdev_feature_zero(&dev->hw_enc_features); + dev->gso_partial_features); + netdev_feature_zero(dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_PARTIAL, - &dev->hw_enc_features); + dev->hw_enc_features);
dev->udp_tunnel_nic_info = &mlx4_udp_tunnels; }
- netdev_feature_copy(&dev->vlan_features, dev->hw_features); + netdev_feature_copy(dev->vlan_features, dev->hw_features);
netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_RXHASH, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_LOOPBACK | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->hw_features); + dev->hw_features);
if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) { netdev_feature_set_bits(NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_FILTER, - &dev->features); + dev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_RX_BIT, - &dev->hw_features); + dev->hw_features); }
if (mlx4_is_slave(mdev->dev)) { @@ -3370,7 +3370,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, err = get_phv_bit(mdev->dev, port, &phv); if (!err && phv) { netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &dev->hw_features); + dev->hw_features); priv->pflags |= MLX4_EN_PRIV_FLAGS_PHV; } err = mlx4_get_is_vlan_offload_disabled(mdev->dev, port, @@ -3381,31 +3381,31 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_FILTER, - &dev->hw_features); + dev->hw_features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_STAG_RX, - &dev->features); + dev->features); } } else { if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PHV_EN && !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &dev->hw_features); + dev->hw_features); }
if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP) - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, dev->hw_features);
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_IGNORE_FCS) - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, dev->hw_features);
if (mdev->dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED && mdev->dev->caps.dmfs_high_steer_mode != MLX4_STEERING_DMFS_A0_STATIC) - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, dev->hw_features);
if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) dev->priv_flags |= IFF_UNICAST_FLT; @@ -3544,10 +3544,10 @@ int mlx4_en_reset_config(struct net_device *dev, if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); } else if (ts_config.rx_filter == HWTSTAMP_FILTER_NONE) { /* RX time-stamping is OFF, update the RX vlan offload * to the latest wanted state @@ -3555,19 +3555,19 @@ int mlx4_en_reset_config(struct net_device *dev, if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, dev->wanted_features)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_RXFCS_BIT)) { if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, features)) netdev_feature_set_bit(NETIF_F_RXFCS_BIT, - &dev->features); + dev->features); else netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, - &dev->features); + dev->features); }
/* RX vlan offload and RX time-stamping can't co-exist ! @@ -3579,7 +3579,7 @@ int mlx4_en_reset_config(struct net_device *dev, dev->features)) en_warn(priv, "Turning off RX vlan offload since RX time-stamping is ON\n"); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->features); + dev->features); }
if (port_up) { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 5111c2c..e69ba39 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -1121,7 +1121,7 @@ void mlx5e_rx_dim_work(struct work_struct *work); void mlx5e_tx_dim_work(struct work_struct *work);
void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features); + 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_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c index b703ea3..8195e04 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c @@ -540,17 +540,17 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)
mlx5_core_info(mdev, "mlx5e: IPSec ESP acceleration enabled\n"); netdev->xfrmdev_ops = &mlx5e_ipsec_xfrmdev_ops; - netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_ESP_BIT, netdev->hw_enc_features);
if (!MLX5_CAP_ETH(mdev, swp_csum)) { mlx5_core_dbg(mdev, "mlx5e: SWP checksum not supported\n"); return; }
- netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
if (!(mlx5_accel_ipsec_device_caps(mdev) & MLX5_ACCEL_IPSEC_CAP_LSO) || !MLX5_CAP_ETH(mdev, swp_lso)) { @@ -560,10 +560,10 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)
if (mlx5_is_ipsec_device(mdev)) netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features);
mlx5_core_dbg(mdev, "mlx5e: ESP GSO capability turned on\n"); - netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, &netdev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_ESP_BIT, netdev->hw_enc_features); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h index b0e92a7..05a6c8f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h @@ -94,7 +94,7 @@ void mlx5e_ipsec_tx_build_eseg(struct mlx5e_priv *priv, struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg);
static inline void -mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features) +mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features) { struct xfrm_offload *xo = xfrm_offload(skb); struct sec_path *sp = skb_sec_path(skb); @@ -141,7 +141,7 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg)
static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe) { return false; } static inline void -mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t *features) +mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features) { netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, features); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c index fcac1a2..086c041 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c @@ -64,14 +64,13 @@ void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
if (mlx5e_accel_is_ktls_tx(mdev)) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, netdev->features); }
if (mlx5e_accel_is_ktls_rx(mdev)) netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
netdev->tlsdev_ops = &mlx5e_ktls_ops; } @@ -103,7 +102,7 @@ int mlx5e_ktls_init_rx(struct mlx5e_priv *priv) return -ENOMEM;
if (netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &priv->netdev->features)) { + priv->netdev->features)) { err = mlx5e_accel_fs_tcp_create(priv); if (err) { destroy_workqueue(priv->tls->rx_wq); @@ -120,7 +119,7 @@ void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv) return;
if (netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &priv->netdev->features)) + priv->netdev->features)) mlx5e_accel_fs_tcp_destroy(priv);
destroy_workqueue(priv->tls->rx_wq); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c index bd29987..f8e8d20 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c @@ -204,21 +204,21 @@ void mlx5e_tls_build_netdev(struct mlx5e_priv *priv) caps = mlx5_accel_tls_device_caps(priv->mdev); if (caps & MLX5_ACCEL_TLS_TX) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (caps & MLX5_ACCEL_TLS_RX) { netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->features); + netdev->features); netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (!(caps & MLX5_ACCEL_TLS_LRO)) { - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->hw_features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->hw_features); }
netdev->tlsdev_ops = &mlx5e_tls_ops; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c index 2cdab59..f3a3fd3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -1287,7 +1287,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) netdev_err(priv->netdev, "Failed to create arfs tables, err=%d\n", err); netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &priv->netdev->hw_features); + priv->netdev->hw_features); }
err = mlx5e_create_inner_ttc_table(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 1574f6b..0800d27 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3238,7 +3238,7 @@ static int set_feature_arfs(struct net_device *netdev, bool enable) #endif
static int mlx5e_handle_feature(struct net_device *netdev, - netdev_features_t *features, + netdev_features_t features, netdev_features_t wanted_features, u32 feature_bit, mlx5e_feature_handler feature_handler) @@ -3247,7 +3247,7 @@ static int mlx5e_handle_feature(struct net_device *netdev, bool enable; int err;
- netdev_feature_xor(&changes, wanted_features, netdev->features); + netdev_feature_xor(changes, wanted_features, netdev->features); enable = netdev_feature_test_bit(feature_bit, wanted_features);
if (!netdev_feature_test_bit(feature_bit, changes)) @@ -3269,10 +3269,10 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(oper_features); int err = 0;
- netdev_feature_copy(&oper_features, netdev->features); + netdev_feature_copy(oper_features, netdev->features);
#define MLX5E_HANDLE_FEATURE(feature, handler) \ - mlx5e_handle_feature(netdev, &oper_features, features, feature, handler) + mlx5e_handle_feature(netdev, oper_features, features, feature, handler)
err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO_BIT, set_feature_lro); err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, @@ -3289,7 +3289,7 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) mlx5e_ktls_set_feature_rx);
if (err) { - netdev_feature_copy(&netdev->features, oper_features); + netdev_feature_copy(netdev->features, oper_features); return -EINVAL; }
@@ -3297,7 +3297,7 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) }
static void mlx5e_fix_uplink_rep_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { netdev_feature_clear_bit(NETIF_F_HW_TLS_RX_BIT, features); if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, netdev->features)) @@ -3313,7 +3313,7 @@ static void mlx5e_fix_uplink_rep_features(struct net_device *netdev, }
static void mlx5e_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_params *params; @@ -3331,7 +3331,7 @@ static void mlx5e_fix_features(struct net_device *netdev, }
if (!MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_STRIDING_RQ)) { - if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); } @@ -3764,7 +3764,7 @@ static bool mlx5e_gre_tunnel_inner_proto_offload_supported(struct mlx5_core_dev
static void mlx5e_tunnel_features_check(struct mlx5e_priv *priv, struct sk_buff *skb, - netdev_features_t *features) + netdev_features_t features) { unsigned int offset = 0; struct udphdr *udph; @@ -3819,7 +3819,7 @@ static void mlx5e_tunnel_features_check(struct mlx5e_priv *priv, }
void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -3828,8 +3828,8 @@ void mlx5e_features_check(struct sk_buff *skb, struct net_device *netdev,
/* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation && - (netdev_feature_test_bits(NETIF_F_CSUM_MASK, *features) || - netdev_feature_test_bits(NETIF_F_GSO_MASK, *features))) + (netdev_feature_test_bits(NETIF_F_CSUM_MASK, features) || + netdev_feature_test_bits(NETIF_F_GSO_MASK, features))) mlx5e_tunnel_features_check(priv, skb, features); }
@@ -4237,23 +4237,23 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
netdev->ethtool_ops = &mlx5e_ethtool_ops;
- netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->vlan_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->vlan_features);
- netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->mpls_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->mpls_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->mpls_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
/* Tunneled LRO is not supported in the driver, and the same RQs are * shared between inner and outer TIRs, so the driver can't disable LRO @@ -4264,83 +4264,83 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) !MLX5_CAP_ETH(mdev, tunnel_lro_vxlan) && !MLX5_CAP_ETH(mdev, tunnel_lro_gre) && mlx5e_check_fragmented_striding_rq_cap(mdev)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->vlan_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->vlan_features);
- netdev_feature_copy(&netdev->hw_features, netdev->vlan_features); + netdev_feature_copy(netdev->hw_features, netdev->vlan_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features);
if (mlx5e_tunnel_any_tx_proto_supported(mdev)) { netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) { netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) { netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->gso_partial_features); + netdev->gso_partial_features); }
if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) { netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6, - &netdev->hw_enc_features); + netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6, - &netdev->gso_partial_features); + netdev->gso_partial_features); }
- netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_PARTIAL_BIT, netdev->hw_features); netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &netdev->gso_partial_features); - netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, &netdev->features); + netdev->gso_partial_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, netdev->features);
mlx5_query_port_fcs(mdev, &fcs_supported, &fcs_enabled);
if (fcs_supported) - netdev_feature_set_bit(NETIF_F_RXALL_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, netdev->hw_features);
if (MLX5_CAP_ETH(mdev, scatter_fcs)) - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, netdev->hw_features);
if (mlx5_qos_is_supported(mdev)) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
/* Defaults */ if (fcs_enabled) - netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &netdev->features); - netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_RXALL_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, netdev->features); + netdev_feature_clear_bit(NETIF_F_RXFCS_BIT, netdev->features);
#define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f) if (FT_CAP(flow_modify_en) && @@ -4348,15 +4348,15 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) FT_CAP(identified_miss_table_mode) && FT_CAP(flow_table_modify)) { #if IS_ENABLED(CONFIG_MLX5_CLS_ACT) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features); #endif #ifdef CONFIG_MLX5_EN_ARFS - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, netdev->hw_features); #endif }
- netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index e1bd3b6..15f2af6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -628,20 +628,20 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev, netdev->watchdog_timeo = 15 * HZ;
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features); #endif - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features); - - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features); + + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, netdev->features); }
static int mlx5e_init_rep(struct mlx5_core_dev *mdev, @@ -1005,7 +1005,7 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) mlx5e_rep_neigh_init(rpriv); mlx5e_rep_bridge_init(priv);
- netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->wanted_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->wanted_features);
rtnl_lock(); if (netif_running(netdev)) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index b06c5fa..2e18a68 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -87,14 +87,14 @@ int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev) mlx5e_timestamp_init(priv);
/* netdev init */ - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->hw_features);
netdev->netdev_ops = &mlx5i_netdev_ops; netdev->ethtool_ops = &mlx5i_ethtool_ops; @@ -327,7 +327,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) netdev_err(priv->netdev, "Failed to create arfs tables, err=%d\n", err); netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &priv->netdev->hw_features); + priv->netdev->hw_features); }
err = mlx5e_create_ttc_table(priv); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 533e2a9..77e3dbd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1087,7 +1087,7 @@ static int mlxsw_sp_handle_feature(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changes); int err;
- netdev_feature_xor(&changes, wanted_features, dev->features); + netdev_feature_xor(changes, wanted_features, dev->features);
if (!netdev_feature_test_bit(feature_bit, changes)) return 0; @@ -1100,9 +1100,9 @@ static int mlxsw_sp_handle_feature(struct net_device *dev, }
if (enable) - netdev_feature_set_bit(feature_bit, &dev->features); + netdev_feature_set_bit(feature_bit, dev->features); else - netdev_feature_clear_bit(feature_bit, &dev->features); + netdev_feature_clear_bit(feature_bit, dev->features); return 0; } static int mlxsw_sp_set_features(struct net_device *dev, @@ -1111,14 +1111,14 @@ static int mlxsw_sp_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(oper_features); int err = 0;
- netdev_feature_copy(&oper_features, dev->features); + netdev_feature_copy(oper_features, dev->features); err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_HW_TC_BIT, mlxsw_sp_feature_hw_tc); err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_LOOPBACK_BIT, mlxsw_sp_feature_loopback);
if (err) { - netdev_feature_copy(&dev->features, oper_features); + netdev_feature_copy(dev->features, oper_features); return -EINVAL; }
@@ -1525,9 +1525,9 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_TC, &dev->features); + NETIF_F_HW_TC, dev->features); netdev_feature_set_bits(NETIF_F_HW_TC | NETIF_F_LOOPBACK, - &dev->hw_features); + dev->hw_features);
dev->min_mtu = 0; dev->max_mtu = ETH_MAX_MTU; diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index 18f50360..040abd7 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -6702,17 +6702,17 @@ static int __init netdev_init(struct net_device *dev) /* 500 ms timeout */ dev->watchdog_timeo = HZ / 2;
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features);
/* * Hardware does not really support IPv6 checksum generation, but * driver actually runs faster with this on. */ - netdev_feature_set_bits(NETIF_F_IPV6_CSUM_BIT, &dev->hw_features); + netdev_feature_set_bits(NETIF_F_IPV6_CSUM_BIT, dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
sema_init(&priv->proc_sem, 1);
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index 00f06f6..b392733 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -2807,10 +2807,10 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
adapter->netdev->netdev_ops = &lan743x_netdev_ops; adapter->netdev->ethtool_ops = &lan743x_ethtool_ops; - netdev_feature_zero(&adapter->netdev->features); + netdev_feature_zero(adapter->netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM, - &adapter->netdev->features); - netdev_feature_copy(&adapter->netdev->hw_features, + adapter->netdev->features); + netdev_feature_copy(adapter->netdev->hw_features, adapter->netdev->features);
/* carrier off reporting is important to ethtool even BEFORE open */ diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 9f2d8eb..95998b8 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -1792,14 +1792,14 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
netdev_lockdep_set_classes(ndev);
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->hw_features); - netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, &ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); - netdev_feature_copy(&ndev->features, ndev->hw_features); - netdev_feature_zero(&ndev->vlan_features); + NETIF_F_IPV6_CSUM, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->hw_features); + netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features); + netdev_feature_copy(ndev->features, ndev->hw_features); + netdev_feature_zero(ndev->vlan_features);
err = register_netdev(ndev); if (err) { diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index b73c31b..181857f 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -775,7 +775,7 @@ static int ocelot_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changed); int port = priv->chip_port;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features) && !netdev_feature_test_bit(NETIF_F_HW_TC_BIT, features) && @@ -1556,9 +1556,9 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target, dev->ethtool_ops = &ocelot_ethtool_ops;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS | - NETIF_F_HW_TC, &dev->hw_features); + NETIF_F_HW_TC, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC, - &dev->features); + dev->features);
memcpy(dev->dev_addr, ocelot->base_mac, ETH_ALEN); dev->dev_addr[ETH_ALEN - 1] += port; diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index c7d3f50..c6883b4 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -2887,8 +2887,8 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, __DECLARE_NETDEV_FEATURE_MASK(tmp); netdev_tx_t status;
- netdev_feature_copy(&tmp, dev->features); - netdev_feature_clear_bit(NETIF_F_TSO6_BIT, &tmp); + netdev_feature_copy(tmp, dev->features); + netdev_feature_clear_bit(NETIF_F_TSO6_BIT, tmp); segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs)) goto drop; @@ -3868,27 +3868,27 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev->mtu = myri10ge_initial_mtu;
netdev->netdev_ops = &myri10ge_netdev_ops; - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(mgp->features | NETIF_F_RXCSUM, - &netdev->hw_features); + netdev->hw_features);
/* fake NETIF_F_HW_VLAN_CTAG_RX for good GRO performance */ netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (dac_enabled) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
- netdev_feature_set_bits(mgp->features, &netdev->vlan_features); + netdev_feature_set_bits(mgp->features, netdev->vlan_features);
if (mgp->fw_ver_tiny < 37) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, - &netdev->vlan_features); + netdev->vlan_features); if (mgp->fw_ver_tiny < 32) netdev_feature_clear_bit(NETIF_F_TSO_BIT, - &netdev->vlan_features); + netdev->vlan_features);
/* make sure we can get an irq, and that MSI can be * setup (if available). */ diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c index ed2e9fe..8f1a675 100644 --- a/drivers/net/ethernet/natsemi/ns83820.c +++ b/drivers/net/ethernet/natsemi/ns83820.c @@ -2139,8 +2139,8 @@ static int ns83820_init_one(struct pci_dev *pci_dev, ns83820_getmac(dev, ndev->dev_addr);
/* Yes, we support dumb IP checksum on transmit */ - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, ndev->features);
ndev->min_mtu = 0;
@@ -2148,13 +2148,13 @@ static int ns83820_init_one(struct pci_dev *pci_dev, /* We also support hardware vlan acceleration */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &ndev->features); + ndev->features); #endif
if (using_dac) { printk(KERN_INFO "%s: using 64 bit addressing.\n", ndev->name); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); }
printk(KERN_INFO "%s: ns83820 v" VERSION ": DP83820 v%u.%u: %pM io=0x%08lx irq=%d f=%s\n", diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index 79165cf..81a3c6f 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c @@ -6569,7 +6569,7 @@ static int s2io_set_features(struct net_device *dev, netdev_features_t features) struct s2io_nic *sp = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, changed) && netif_running(dev)) { @@ -6577,7 +6577,7 @@ static int s2io_set_features(struct net_device *dev, netdev_features_t features)
s2io_stop_all_tx_queue(sp); s2io_card_down(sp); - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); rc = s2io_card_up(sp); if (rc) s2io_reset(sp); @@ -7865,17 +7865,17 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) /* Driver entry points */ dev->netdev_ops = &s2io_netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM | NETIF_F_LRO, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &dev->features); + dev->features); if (sp->high_dma_flag == true) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); dev->watchdog_timeo = WATCH_DOG_TIMEOUT; INIT_WORK(&sp->rst_timer_task, s2io_restart_nic); INIT_WORK(&sp->set_link_task, s2io_set_link); diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 6095786..bb260cd 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -2641,11 +2641,11 @@ static void vxge_poll_vp_lockup(struct timer_list *t) }
static void vxge_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, *features); + netdev_feature_xor(changed, dev->features, features);
/* Enabling RTH requires some of the logic in vxge_device_register and a * vpath reset. Due to these restrictions, only allow modification @@ -2661,7 +2661,7 @@ static int vxge_set_features(struct net_device *dev, netdev_features_t features) struct vxgedev *vdev = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (!netdev_feature_test_bit(NETIF_F_RXHASH_BIT, changed)) return 0; @@ -3398,20 +3398,20 @@ static int vxge_device_register(struct __vxge_hw_device *hldev,
SET_NETDEV_DEV(ndev, &vdev->pdev->dev);
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX, - &ndev->hw_features); + ndev->hw_features); if (vdev->config.rth_steering != NO_STEERING) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->hw_features);
- netdev_feature_or(&ndev->features, ndev->features, + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &ndev->hw_features); + ndev->hw_features);
ndev->netdev_ops = &vxge_netdev_ops;
@@ -3435,7 +3435,7 @@ static int vxge_device_register(struct __vxge_hw_device *hldev, "%s : checksumming enabled", __func__);
if (high_dma) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); vxge_debug_init(vxge_hw_device_trace_level_get(hldev), "%s : using High DMA", __func__); } diff --git a/drivers/net/ethernet/netronome/nfp/crypto/tls.c b/drivers/net/ethernet/netronome/nfp/crypto/tls.c index a5bee5d..bdd799f 100644 --- a/drivers/net/ethernet/netronome/nfp/crypto/tls.c +++ b/drivers/net/ethernet/netronome/nfp/crypto/tls.c @@ -588,15 +588,15 @@ int nfp_net_tls_init(struct nfp_net *nn)
if (nn->tlv_caps.crypto_ops & NFP_NET_TLS_OPCODE_MASK_RX) { netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_TLS_RX_BIT, - &netdev->features); + netdev->features); } if (nn->tlv_caps.crypto_ops & NFP_NET_TLS_OPCODE_MASK_TX) { netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_TLS_TX_BIT, - &netdev->features); + netdev->features); }
netdev->tlsdev_ops = &nfp_net_tls_ops; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index f14bdf7..43bcb61 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -3527,7 +3527,7 @@ static int nfp_net_set_features(struct net_device *netdev,
new_ctrl = nn->dp.ctrl;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) @@ -3590,8 +3590,10 @@ static int nfp_net_set_features(struct net_device *netdev, if (err) return err;
- nn_dbg(nn, "Feature change 0x%llx -> 0x%llx (changed=0x%llx)\n", - netdev->features, features, changed); + nn_dbg(nn, "Feature change %*pb -> %*pb (changed=%*pb)\n", + NETDEV_FEATURE_COUNT, netdev->features, + NETDEV_FEATURE_COUNT, features, + NETDEV_FEATURE_COUNT, changed);
if (new_ctrl == nn->dp.ctrl) return 0; @@ -3608,7 +3610,7 @@ static int nfp_net_set_features(struct net_device *netdev, }
static void nfp_net_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { u8 l4_hdr;
@@ -4041,54 +4043,54 @@ static void nfp_net_netdev_init(struct nfp_net *nn) if (nn->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->hw_features);
if (nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY; } if (nn->cap & NFP_NET_CFG_CTRL_TXCSUM) { netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_TXCSUM; } if (nn->cap & NFP_NET_CFG_CTRL_GATHER) { - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_GATHER; } if ((nn->cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) || nn->cap & NFP_NET_CFG_CTRL_LSO2) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_LSO2 ?: NFP_NET_CFG_CTRL_LSO; } if (nn->cap & NFP_NET_CFG_CTRL_RSS_ANY) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (nn->cap & NFP_NET_CFG_CTRL_VXLAN) { if (nn->cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_features); + netdev->hw_features); netdev->udp_tunnel_nic_info = &nfp_udp_tunnels; nn->dp.ctrl |= NFP_NET_CFG_CTRL_VXLAN; } if (nn->cap & NFP_NET_CFG_CTRL_NVGRE) { if (nn->cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_NVGRE; } if (nn->cap & (NFP_NET_CFG_CTRL_VXLAN | NFP_NET_CFG_CTRL_NVGRE)) - netdev_feature_copy(&netdev->hw_enc_features, + netdev_feature_copy(netdev->hw_enc_features, netdev->hw_features);
- netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features);
if (nn->cap & NFP_NET_CFG_CTRL_RXVLAN) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_RXVLAN; } if (nn->cap & NFP_NET_CFG_CTRL_TXVLAN) { @@ -4096,24 +4098,24 @@ static void nfp_net_netdev_init(struct nfp_net *nn) nn_warn(nn, "Device advertises both TSO2 and TXVLAN. Refusing to enable TXVLAN.\n"); } else { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_TXVLAN; } } if (nn->cap & NFP_NET_CFG_CTRL_CTAG_FILTER) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features); nn->dp.ctrl |= NFP_NET_CFG_CTRL_CTAG_FILTER; }
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
if (nfp_app_has_tc(nn->app) && nn->port) - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features);
/* Advertise but disable TSO by default. */ netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->features); + netdev->features); nn->dp.ctrl &= ~NFP_NET_CFG_CTRL_LSO_ANY;
/* Finalise the netdev setup */ diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index 9bbfe47..c22945e 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -233,7 +233,7 @@ static int nfp_repr_open(struct net_device *netdev) }
static void nfp_repr_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(lower_features); __DECLARE_NETDEV_FEATURE_MASK(old_features); @@ -242,16 +242,16 @@ static void nfp_repr_fix_features(struct net_device *netdev,
lower_dev = repr->dst->u.port_info.lower_dev;
- netdev_feature_copy(&old_features, *features); - netdev_feature_copy(&lower_features, lower_dev->features); + netdev_feature_copy(old_features, features); + netdev_feature_copy(lower_features, lower_dev->features); if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, lower_features)) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &lower_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, lower_features);
- netdev_intersect_features(features, *features, lower_features); + netdev_intersect_features(features, features, lower_features); netdev_feature_and_bits(NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC, - &old_features); - netdev_feature_or(features, *features, old_features); + old_features); + netdev_feature_or(features, features, old_features); netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
@@ -343,66 +343,66 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, if (repr_cap & NFP_NET_CFG_CTRL_LIVE_ADDR) netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_RXCSUM_ANY) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_TXCSUM) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_GATHER) - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); if ((repr_cap & NFP_NET_CFG_CTRL_LSO && nn->fw_ver.major > 2) || repr_cap & NFP_NET_CFG_CTRL_LSO2) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_RSS_ANY) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_VXLAN) { if (repr_cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_features); + netdev->hw_features); } if (repr_cap & NFP_NET_CFG_CTRL_NVGRE) { if (repr_cap & NFP_NET_CFG_CTRL_LSO) netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_features); + netdev->hw_features); } if (repr_cap & (NFP_NET_CFG_CTRL_VXLAN | NFP_NET_CFG_CTRL_NVGRE)) - netdev_feature_copy(&netdev->hw_enc_features, + netdev_feature_copy(netdev->hw_enc_features, netdev->hw_features);
- netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features);
if (repr_cap & NFP_NET_CFG_CTRL_RXVLAN) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); if (repr_cap & NFP_NET_CFG_CTRL_TXVLAN) { if (repr_cap & NFP_NET_CFG_CTRL_LSO2) netdev_warn(netdev, "Device advertises both TSO2 and TXVLAN. Refusing to enable TXVLAN.\n"); else netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); } if (repr_cap & NFP_NET_CFG_CTRL_CTAG_FILTER) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features);
/* Advertise but disable TSO by default. */ netdev_feature_clear_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->features); + netdev->features); netdev->gso_max_segs = NFP_NET_LSO_MAX_SEGS;
netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, netdev->features);
if (nfp_app_has_tc(app)) { - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, netdev->hw_features); }
err = nfp_app_repr_init(app, netdev); diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index 2098f3f..4f56fb0 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -1271,8 +1271,8 @@ static int nixge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ndev); SET_NETDEV_DEV(ndev, &pdev->dev);
- netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); ndev->netdev_ops = &nixge_netdev_ops; ndev->ethtool_ops = &nixge_ethtool_ops;
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index d4e89a9..7aed110 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -4922,11 +4922,11 @@ static int nv_set_loopback(struct net_device *dev, netdev_features_t features) }
static void nv_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* vlan is dependent on rx checksum offload */ if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, *features)) + NETIF_F_HW_VLAN_CTAG_RX, features)) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, features); }
@@ -4958,7 +4958,7 @@ static int nv_set_features(struct net_device *dev, netdev_features_t features) u8 __iomem *base = get_hwbase(dev); int retval;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_LOOPBACK_BIT, changed) && netif_running(dev)) { @@ -5791,7 +5791,7 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) "64-bit DMA failed, using 32-bit addressing\n"); else netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &dev->features); + dev->features); if (pci_set_consistent_dma_mask(pci_dev, DMA_BIT_MASK(39))) { dev_info(&pci_dev->dev, "64-bit DMA (consistent) failed, using 32-bit ring buffers\n"); @@ -5815,7 +5815,7 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features); }
np->vlanctl_bits = 0; @@ -5823,13 +5823,13 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX, - &dev->hw_features); + dev->hw_features); }
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
/* Add loopback capability to the device. */ - netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LOOPBACK_BIT, dev->hw_features);
/* MTU range: 64 - 1500 or 9100 */ dev->min_mtu = ETH_ZLEN + ETH_FCS_LEN; diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 350db45..285f99e 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -2218,7 +2218,7 @@ static int pch_gbe_set_features(struct net_device *netdev, struct pch_gbe_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0; @@ -2531,10 +2531,10 @@ static int pch_gbe_probe(struct pci_dev *pdev, netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD; netif_napi_add(netdev, &adapter->napi, pch_gbe_napi_poll, PCH_GBE_RX_WEIGHT); - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &netdev->hw_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + NETIF_F_IPV6_CSUM, netdev->hw_features); + netdev_feature_copy(netdev->features, netdev->hw_features); pch_gbe_set_ethtool_ops(netdev);
/* MTU range: 46 - 10300 */ diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c index 1e3a909..2f714aa 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c @@ -478,7 +478,7 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) pch_gbe_validate_option(&val, &opt, adapter); if (!val) netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &dev->features); + dev->features); } { /* Checksum Offload Enable/Disable */ static const struct pch_gbe_option opt = { @@ -491,7 +491,7 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) pch_gbe_validate_option(&val, &opt, adapter); if (!val) netdev_feature_clear_bits(NETIF_F_CSUM_MASK, - &dev->features); + dev->features); } { /* Flow Control */ static const struct pch_gbe_option opt = { diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index 908ecef..f04814f 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c @@ -1699,10 +1699,10 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64);
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_GSO, - &dev->features); + dev->features);
mac->dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL); if (!mac->dma_pdev) { diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 57f418e..0dcda4b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1597,7 +1597,7 @@ static int ionic_init_nic_features(struct ionic_lif *lif) int err;
/* set up what we expect to support by default */ - netdev_feature_zero(&features); + netdev_feature_zero(features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | @@ -1607,75 +1607,75 @@ static int ionic_init_nic_features(struct ionic_lif *lif) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN, - &features); + features);
if (lif->nxqs > 1) - netdev_feature_set_bits(NETIF_F_RXHASH_BIT, &features); + netdev_feature_set_bits(NETIF_F_RXHASH_BIT, features);
err = ionic_set_nic_features(lif, features); if (err) return err;
/* tell the netdev what we actually can support */ - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features);
if (lif->hw_features & IONIC_ETH_HW_VLAN_TX_TAG) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_VLAN_RX_STRIP) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_VLAN_RX_FILTER) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_RX_HASH) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features); if (lif->hw_features & IONIC_ETH_HW_TX_SG) - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features);
if (lif->hw_features & IONIC_ETH_HW_TX_CSUM) netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_RX_CSUM) netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPV6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_ECN) netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_GRE) netdev_feature_set_bit(NETIF_F_GSO_GRE_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_GRE_CSUM) netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPXIP4) netdev_feature_set_bit(NETIF_F_GSO_IPXIP4_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_IPXIP6) netdev_feature_set_bit(NETIF_F_GSO_IPXIP6_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_UDP) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features); if (lif->hw_features & IONIC_ETH_HW_TSO_UDP_CSUM) netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
- netdev_feature_or(&netdev->hw_features, netdev->hw_features, + netdev_feature_or(netdev->hw_features, netdev->hw_features, netdev->hw_enc_features); - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->features); netdev_feature_clear_bits(NETIF_F_VLAN_FEATURES, - &netdev->vlan_features); + netdev->vlan_features);
netdev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE; diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 487b203..07602ae 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -518,9 +518,9 @@ static void netxen_set_multicast_list(struct net_device *dev) }
static void netxen_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { netdev_info(dev, "disabling LRO as RXCSUM is off\n");
netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); @@ -1345,32 +1345,32 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
netdev->ethtool_ops = &netxen_nic_ethtool_ops;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_RXCSUM, &netdev->hw_features); + NETIF_F_RXCSUM, netdev->hw_features);
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) netdev_feature_set_bits(NETIF_F_IPV6_CSUM | NETIF_F_TSO6, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->hw_features);
if (adapter->pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features);
if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO) netdev_feature_set_bit(NETIF_F_LRO_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev->irq = adapter->msix_entries[0].vector; diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h index ff77e39..5ced59a 100644 --- a/drivers/net/ethernet/qlogic/qede/qede.h +++ b/drivers/net/ethernet/qlogic/qede/qede.h @@ -528,7 +528,7 @@ int qede_xdp_transmit(struct net_device *dev, int n_frames, u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev); void qede_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features); + 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); @@ -545,7 +545,7 @@ int qede_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid); void qede_vlan_mark_nonconfigured(struct qede_dev *edev); int qede_configure_vlan_filters(struct qede_dev *edev);
-void qede_fix_features(struct net_device *dev, netdev_features_t *features); +void qede_fix_features(struct net_device *dev, netdev_features_t features); int qede_set_features(struct net_device *dev, netdev_features_t features); void qede_set_rx_mode(struct net_device *ndev); void qede_config_rx_mode(struct net_device *ndev); diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index 9bfa18c..7f82f7d 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c @@ -1023,7 +1023,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) - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &ndev->features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, ndev->features);
/* Set the mtu field and re-start the interface if needed */ args.u.mtu = new_mtu; diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index 0d02657..f858c1a 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -909,15 +909,15 @@ void qede_vlan_mark_nonconfigured(struct qede_dev *edev) static void qede_set_features_reload(struct qede_dev *edev, struct qede_reload_args *args) { - netdev_feature_copy(&edev->ndev->features, args->u.features); + netdev_feature_copy(edev->ndev->features, args->u.features); }
-void qede_fix_features(struct net_device *dev, netdev_features_t *features) +void qede_fix_features(struct net_device *dev, netdev_features_t features) { struct qede_dev *edev = netdev_priv(dev);
if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE || - !netdev_feature_test_bit(NETIF_F_GRO_BIT, *features)) + !netdev_feature_test_bit(NETIF_F_GRO_BIT, features)) netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); }
@@ -927,7 +927,7 @@ int qede_set_features(struct net_device *dev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changes); bool need_reload = false;
- netdev_feature_xor(&changes, features, dev->features); + netdev_feature_xor(changes, features, dev->features);
if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, changes)) need_reload = true; @@ -935,7 +935,7 @@ int qede_set_features(struct net_device *dev, netdev_features_t features) if (need_reload) { struct qede_reload_args args;
- netdev_feature_copy(&args.u.features, features); + netdev_feature_copy(args.u.features, features); args.func = &qede_set_features_reload;
/* Make sure that we definitely need to reload. diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index 2d49c95..f636d8b 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c @@ -1748,7 +1748,7 @@ u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, #define QEDE_MAX_TUN_HDR_LEN 48
void qede_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { if (skb->encapsulation) { u8 l4_proto = 0; diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index b54235f..394afd0 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c @@ -789,36 +789,36 @@ static void qede_init_ndev(struct qede_dev *edev) ndev->priv_flags |= IFF_UNICAST_FLT;
/* user-changeble features */ - netdev_feature_zero(&hw_features); + netdev_feature_zero(hw_features); netdev_feature_set_bits(NETIF_F_GRO | NETIF_F_GRO_HW | NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC, - &hw_features); + hw_features);
if (edev->dev_info.common.b_arfs_capable) - netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, &hw_features); + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, hw_features);
if (edev->dev_info.common.vxlan_enable || edev->dev_info.common.geneve_enable) udp_tunnel_enable = true;
if (udp_tunnel_enable || edev->dev_info.common.gre_enable) { - netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, &hw_features); - netdev_feature_zero(&ndev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, hw_features); + netdev_feature_zero(ndev->hw_enc_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_RXCSUM, - &ndev->hw_enc_features); + ndev->hw_enc_features); }
if (udp_tunnel_enable) { netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &hw_features); + hw_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &ndev->hw_enc_features); + ndev->hw_enc_features);
qede_set_udp_tunnels(edev); } @@ -826,22 +826,22 @@ static void qede_init_ndev(struct qede_dev *edev) if (edev->dev_info.common.gre_enable) { netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM, - &hw_features); + hw_features); netdev_feature_set_bits(NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM, - &ndev->hw_enc_features); + ndev->hw_enc_features); }
- netdev_feature_copy(&ndev->vlan_features, hw_features); + netdev_feature_copy(ndev->vlan_features, hw_features); netdev_feature_set_bits(NETIF_F_RXHASH | NETIF_F_RXCSUM | - NETIF_F_HIGHDMA, &ndev->vlan_features); - netdev_feature_copy(&ndev->features, hw_features); + NETIF_F_HIGHDMA, ndev->vlan_features); + netdev_feature_copy(ndev->features, hw_features); netdev_feature_set_bits(NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_TX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_TX, ndev->features);
- netdev_feature_copy(&ndev->hw_features, hw_features); + netdev_feature_copy(ndev->hw_features, hw_features);
/* MTU range: 46 - 9600 */ ndev->min_mtu = ETH_ZLEN - ETH_HLEN; @@ -1508,7 +1508,7 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq) } else { rxq->rx_buf_seg_size = PAGE_SIZE; netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, - &edev->ndev->features); + edev->ndev->features); }
/* Allocate the parallel driver ring for Rx buffers */ @@ -2384,7 +2384,7 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
if (qede_alloc_arfs(edev)) { netdev_feature_clear_bit(NETIF_F_NTUPLE_BIT, - &edev->ndev->features); + edev->ndev->features); edev->dev_info.common.b_arfs_capable = false; }
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index c396ee0..51cc821 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c @@ -3797,10 +3797,10 @@ static int ql3xxx_probe(struct pci_dev *pdev, qdev->msg_enable = netif_msg_init(debug, default_msg);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); if (qdev->device_id == QL3032_DEVICE_ID) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG, - &ndev->features); + ndev->features);
qdev->mem_map_registers = pci_ioremap_bar(pdev, 1); if (!qdev->mem_map_registers) { diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 7fbf895..5b012bd 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1622,7 +1622,7 @@ int qlcnic_82xx_read_phys_port_id(struct qlcnic_adapter *); int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu); int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *, u32); int qlcnic_change_mtu(struct net_device *netdev, int new_mtu); -void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features); +void qlcnic_fix_features(struct net_device *netdev, netdev_features_t features); int qlcnic_set_features(struct net_device *netdev, netdev_features_t features); int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable); void qlcnic_update_cmd_producer(struct qlcnic_host_tx_ring *); diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index ee055e9..85edd77 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -1021,7 +1021,7 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu) }
static void qlcnic_process_flags(struct qlcnic_adapter *adapter, - netdev_features_t *features) + netdev_features_t features) { u32 offload_flags = adapter->offload_flags;
@@ -1057,7 +1057,7 @@ static void qlcnic_process_flags(struct qlcnic_adapter *adapter, } }
-void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) +void qlcnic_fix_features(struct net_device *netdev, netdev_features_t features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed); @@ -1067,19 +1067,19 @@ void qlcnic_fix_features(struct net_device *netdev, netdev_features_t *features) if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) { qlcnic_process_flags(adapter, features); } else { - netdev_feature_xor(&changed, *features, + netdev_feature_xor(changed, features, netdev->features); netdev_feature_and_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &changed); - netdev_feature_xor(features, *features, changed); + changed); + netdev_feature_xor(features, features, changed); } }
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
@@ -1090,14 +1090,14 @@ int qlcnic_set_features(struct net_device *netdev, netdev_features_t features) __DECLARE_NETDEV_FEATURE_MASK(changed); int hw_lro;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); hw_lro = netdev_feature_test_bit(NETIF_F_LRO_BIT, features) ? QLCNIC_LRO_ENABLED : 0;
if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, changed)) return 0;
- netdev_feature_change_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_change_bit(NETIF_F_LRO_BIT, netdev->features);
if (qlcnic_config_hw_lro(adapter, hw_lro)) return -EIO; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 37e1ddb..20253b05 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -493,7 +493,7 @@ static const struct udp_tunnel_nic_info qlcnic_udp_tunnels = { };
static void qlcnic_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); vxlan_features_check(skb, features); @@ -2277,54 +2277,54 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_IPV6_CSUM | NETIF_F_GRO | - NETIF_F_HW_VLAN_CTAG_RX, &netdev->features); + NETIF_F_HW_VLAN_CTAG_RX, netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &netdev->vlan_features); + NETIF_F_IPV6_CSUM, netdev->vlan_features);
if (QLCNIC_IS_TSO_CAPABLE(adapter)) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->features); + netdev->features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features); }
if (pci_using_dac) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, netdev->features); netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->vlan_features); + netdev->vlan_features); }
if (qlcnic_vlan_tx_check(adapter)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->features); + netdev->features);
if (qlcnic_sriov_vf_check(adapter)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features);
if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, netdev->features);
if (qlcnic_encap_tx_offload(adapter)) { netdev_feature_set_bit(NETIF_F_GSO_UDP_TUNNEL_BIT, - &netdev->features); + netdev->features);
/* encapsulation Tx offload supported by Adapter */ netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
if (qlcnic_encap_rx_offload(adapter)) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_enc_features); + netdev->hw_enc_features);
netdev->udp_tunnel_nic_info = &qlcnic_udp_tunnels; }
- netdev_feature_copy(&netdev->hw_features, netdev->features); + netdev_feature_copy(netdev->hw_features, netdev->features); netdev->priv_flags |= IFF_UNICAST_FLT; netdev->irq = adapter->msix_entries[0].vector;
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index 53a83c1..c8be875 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c @@ -178,7 +178,7 @@ static int emac_set_features(struct net_device *netdev, struct emac_adapter *adpt = netdev_priv(netdev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, features, netdev->features); + netdev_feature_xor(changed, features, netdev->features);
/* We only need to reprogram the hardware if the VLAN tag features * have changed, and if it's already running. @@ -193,7 +193,7 @@ static int emac_set_features(struct net_device *netdev, /* emac_mac_mode_config() uses netdev->features to configure the EMAC, * so make sure it's set first. */ - netdev_feature_copy(&netdev->features, features); + netdev_feature_copy(netdev->features, features);
return emac_reinit_locked(adpt); } @@ -671,15 +671,15 @@ static int emac_probe(struct platform_device *pdev) }
/* set hw features */ - netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX, &netdev->features); - netdev_feature_copy(&netdev->hw_features, netdev->features); + NETIF_F_HW_VLAN_CTAG_TX, netdev->features); + netdev_feature_copy(netdev->hw_features, netdev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
/* MTU range: 46 - 9194 */ netdev->min_mtu = EMAC_MIN_ETH_FRAME_SIZE - diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c index d6d3dab..4d03846 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c @@ -236,7 +236,7 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev) rmnet_dev->needs_free_netdev = true; rmnet_dev->ethtool_ops = &rmnet_ethtool_ops;
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &rmnet_dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, rmnet_dev->features);
/* This perm addr will be used as interface identifier by IPv6 */ rmnet_dev->addr_assign_type = NET_ADDR_RANDOM; @@ -261,11 +261,11 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, return -EBUSY; }
- netdev_feature_zero(&rmnet_dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &rmnet_dev->hw_features); + netdev_feature_zero(rmnet_dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, rmnet_dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &rmnet_dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &rmnet_dev->hw_features); + rmnet_dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, rmnet_dev->hw_features);
priv->real_dev = real_dev;
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 626b3f2..97913ad 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -1855,7 +1855,7 @@ static void cp_set_d3_state (struct cp_private *cp) }
static void cp_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { if (skb_shinfo(skb)->gso_size > MSSMask) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); @@ -1968,8 +1968,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) cp->cpcmd = (pci_using_dac ? PCIDAC : 0) | PCIMulRW | RxChkSum | CpRxOn | CpTxOn;
- netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features);
regs = ioremap(pciaddr, CP_REGS_SIZE); if (!regs) { @@ -1996,16 +1996,16 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->features); + NETIF_F_HW_VLAN_CTAG_RX, dev->features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_RX, dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HIGHDMA, &dev->vlan_features); + NETIF_F_HIGHDMA, dev->vlan_features);
/* MTU range: 60 - 4096 */ dev->min_mtu = CP_MIN_MTU; diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index bb8ed95..7cd11b6 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c @@ -904,7 +904,7 @@ static int rtl8139_set_features(struct net_device *dev, netdev_features_t featur unsigned long flags; void __iomem *ioaddr = tp->mmio_addr;
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features);
if (!netdev_feature_test_bit(NETIF_F_RXALL_BIT, changed)) return 0; @@ -1011,11 +1011,11 @@ static int rtl8139_init_one(struct pci_dev *pdev, * features */ netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA, - &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + dev->features); + netdev_feature_copy(dev->vlan_features, dev->features);
- netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, dev->hw_features);
/* MTU range: 68 - 1770 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index e1bdc34..849e07a 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -1466,7 +1466,7 @@ static int rtl8169_get_regs_len(struct net_device *dev) }
static void rtl8169_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct rtl8169_private *tp = netdev_priv(dev);
@@ -4334,7 +4334,7 @@ static unsigned int rtl_last_frag_len(struct sk_buff *skb) }
/* Workaround for hw issues with TSO on RTL8168evl */ -static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t *features) +static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t features) { /* IPv4 header has options field */ if (vlan_get_protocol(skb) == htons(ETH_P_IP) && @@ -4351,7 +4351,7 @@ static void rtl8168evl_fix_tso(struct sk_buff *skb, netdev_features_t *features) }
static void rtl8169_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { int transport_offset = skb_transport_offset(skb); struct rtl8169_private *tp = netdev_priv(dev); @@ -5328,7 +5328,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (sizeof(dma_addr_t) > 4 && tp->mac_version >= RTL_GIGA_MAC_VER_18 && !dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
rtl_init_rxcfg(tp);
@@ -5352,13 +5352,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_napi_add(dev, &tp->napi, rtl8169_poll, NAPI_POLL_WEIGHT);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &dev->hw_features); - netdev_feature_zero(&dev->vlan_features); + NETIF_F_HW_VLAN_CTAG_RX, dev->hw_features); + netdev_feature_zero(dev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO, - &dev->vlan_features); + dev->vlan_features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
/* @@ -5368,13 +5368,13 @@ 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 */ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->hw_features); + dev->hw_features);
if (rtl_chip_supports_csum_v2(tp)) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &dev->hw_features); + dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features);
/* There has been a number of reports that using SG/TSO results in * tx timeouts. However for a lot of people SG/TSO works fine. @@ -5383,18 +5383,18 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) */ if (rtl_chip_supports_csum_v2(tp)) { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features); dev->gso_max_size = RTL_GSO_MAX_SIZE_V2; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V2; } else { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_TSO, - &dev->hw_features); + dev->hw_features); dev->gso_max_size = RTL_GSO_MAX_SIZE_V1; dev->gso_max_segs = RTL_GSO_MAX_SEGS_V1; }
- netdev_feature_set_bit(NETIF_F_RXALL_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXFCS_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXALL_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXFCS_BIT, dev->hw_features);
/* configure chip for default features */ rtl8169_set_features(dev, dev->features); diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 3da1b31..e9a417c 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1858,14 +1858,14 @@ static int ravb_set_features(struct net_device *ndev, { __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) ravb_set_rx_csum(ndev, netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features));
- netdev_feature_copy(&ndev->features, features); + netdev_feature_copy(ndev->features, features);
return 0; } @@ -2058,10 +2058,10 @@ static int ravb_probe(struct platform_device *pdev) if (!ndev) return -ENOMEM;
- netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); - netdev_feature_zero(&ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features); + netdev_feature_zero(ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features);
pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 6cffae1..0d5857b 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2935,7 +2935,7 @@ static int sh_eth_set_features(struct net_device *ndev, struct sh_eth_private *mdp = netdev_priv(ndev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed) && mdp->cd->rx_csum) @@ -2943,7 +2943,7 @@ static int sh_eth_set_features(struct net_device *ndev, netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features));
- netdev_feature_copy(&ndev->features, features); + netdev_feature_copy(ndev->features, features);
return 0; } @@ -3297,10 +3297,10 @@ static int sh_eth_drv_probe(struct platform_device *pdev) ndev->min_mtu = ETH_MIN_MTU;
if (mdp->cd->rx_csum) { - netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->features); - netdev_feature_zero(&ndev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &ndev->hw_features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->features); + netdev_feature_zero(ndev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, ndev->hw_features); }
/* set function */ @@ -3353,7 +3353,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) } mdp->port = port; netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &ndev->features); + ndev->features);
/* Need to init only the first port of the two sharing a TSU */ if (port == 0) { diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 631ec69..91766f5 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2590,7 +2590,7 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number) rocker_carrier_init(rocker_port);
netdev_feature_set_bits(NETIF_F_NETNS_LOCAL | NETIF_F_SG, - &dev->features); + dev->features);
/* MTU range: 68 - 9000 */ dev->min_mtu = ROCKER_PORT_MIN_MTU; diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index b8b6e31..8afe255 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -1777,7 +1777,7 @@ static int sxgbe_set_features(struct net_device *dev, struct sxgbe_priv_data *priv = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { @@ -2104,13 +2104,13 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
ndev->netdev_ops = &sxgbe_netdev_ops;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO6 | - NETIF_F_GRO, &ndev->hw_features); - netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + NETIF_F_GRO, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); ndev->watchdog_timeo = msecs_to_jiffies(TX_TIMEO);
/* assign filtering support */ diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 0877282..05c4c7d3 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -628,7 +628,7 @@ static int efx_ef10_probe(struct efx_nic *efx) if (nic_data->datapath_caps & (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_INCLUDE_FCS_LBN)) netdev_feature_set_bit(NETIF_F_RXFCS_BIT, - &efx->net_dev->hw_features); + efx->net_dev->hw_features);
rc = efx_mcdi_port_get_number(efx); if (rc < 0) @@ -1308,7 +1308,7 @@ static int efx_ef10_init_nic(struct efx_nic *efx) __DECLARE_NETDEV_FEATURE_MASK(hw_enc_features); int rc;
- netdev_feature_zero(&hw_enc_features); + netdev_feature_zero(hw_enc_features);
if (nic_data->must_check_datapath_caps) { rc = efx_ef10_init_datapath_caps(efx); @@ -1355,26 +1355,26 @@ static int efx_ef10_init_nic(struct efx_nic *efx) /* add encapsulated checksum offload features */ if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx)) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &hw_enc_features); + hw_enc_features); /* add encapsulated TSO features */ if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) { __DECLARE_NETDEV_FEATURE_MASK(encap_tso_features);
- netdev_feature_zero(&encap_tso_features); + netdev_feature_zero(encap_tso_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM, - &encap_tso_features); + encap_tso_features);
- netdev_feature_or(&hw_enc_features, hw_enc_features, + netdev_feature_or(hw_enc_features, hw_enc_features, encap_tso_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &hw_enc_features); - netdev_feature_or(&efx->net_dev->features, + netdev_feature_set_bit(NETIF_F_TSO_BIT, hw_enc_features); + netdev_feature_or(efx->net_dev->features, efx->net_dev->features, encap_tso_features); } - netdev_feature_copy(&efx->net_dev->hw_enc_features, hw_enc_features); + netdev_feature_copy(efx->net_dev->hw_enc_features, hw_enc_features);
/* don't fail init if RSS setup doesn't work */ rc = efx->type->rx_push_rss_config(efx, false, diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index d509814..88cba7cb 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -186,24 +186,24 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx) struct net_device *net_dev = efx->net_dev; __DECLARE_NETDEV_FEATURE_MASK(tso);
- netdev_feature_zero(&tso); + netdev_feature_zero(tso); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM, - &tso); + tso);
- netdev_feature_or(&net_dev->features, net_dev->features, tso); - netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, + netdev_feature_or(net_dev->features, net_dev->features, tso); + netdev_feature_or(net_dev->hw_features, net_dev->hw_features, tso); - netdev_feature_or(&net_dev->hw_enc_features, + netdev_feature_or(net_dev->hw_enc_features, net_dev->hw_enc_features, tso); /* EF100 HW can only offload outer checksums if they are UDP, * so for GRE_CSUM we have to use GSO_PARTIAL. */ netdev_feature_set_bit(NETIF_F_GSO_GRE_CSUM_BIT, - &net_dev->gso_partial_features); + net_dev->gso_partial_features); } efx->num_mac_stats = MCDI_WORD(outbuf, GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS); @@ -1121,14 +1121,14 @@ static int ef100_probe_main(struct efx_nic *efx) efx->nic_data = nic_data; nic_data->efx = efx; netdev_feature_set_bits(efx->type->offload_features, - &net_dev->features); + net_dev->features); netdev_feature_set_bits(efx->type->offload_features, - &net_dev->hw_features); + net_dev->hw_features); netdev_feature_set_bits(efx->type->offload_features, - &net_dev->hw_enc_features); + net_dev->hw_enc_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_ALL_TSO, - &net_dev->vlan_features); + net_dev->vlan_features);
/* Populate design-parameter defaults */ nic_data->tso_max_hdr_len = ESE_EF100_DP_GZ_TSO_MAX_HDR_LEN_DEFAULT; diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c index 2e449b5..56276ca 100644 --- a/drivers/net/ethernet/sfc/ef10_sriov.c +++ b/drivers/net/ethernet/sfc/ef10_sriov.c @@ -244,10 +244,10 @@ static int efx_ef10_vadaptor_alloc_set_features(struct efx_nic *efx) if (port_flags & (1 << MC_CMD_VPORT_ALLOC_IN_FLAG_VLAN_RESTRICT_LBN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &efx->fixed_features); + efx->fixed_features); else netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &efx->fixed_features); + efx->fixed_features);
return 0;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 71b5748..e871118 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1044,31 +1044,31 @@ static int efx_pci_probe_post_io(struct efx_nic *efx) /* Determine netdevice features */ netdev_feature_set_bits(efx->type->offload_features | NETIF_F_SG | NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL, - &net_dev->features); + net_dev->features);
if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &net_dev->features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, net_dev->features); /* Check whether device supports TSO */ if (!efx->type->tso_versions || !efx->type->tso_versions(efx)) - netdev_feature_clear_bits(NETIF_F_ALL_TSO, &net_dev->features); + netdev_feature_clear_bits(NETIF_F_ALL_TSO, net_dev->features); /* Mask for features that also apply to VLAN devices */ netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_ALL_TSO | - NETIF_F_RXCSUM, &net_dev->vlan_features); + NETIF_F_RXCSUM, net_dev->vlan_features);
- netdev_feature_andnot(&tmp, net_dev->features, efx->fixed_features); - netdev_feature_or(&net_dev->hw_features, net_dev->hw_features, tmp); + netdev_feature_andnot(tmp, net_dev->features, efx->fixed_features); + netdev_feature_or(net_dev->hw_features, net_dev->hw_features, tmp);
/* Disable receiving frames with bad FCS, by default. */ - netdev_feature_clear_bit(NETIF_F_RXALL_BIT, &net_dev->features); + netdev_feature_clear_bit(NETIF_F_RXALL_BIT, net_dev->features);
/* 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). */ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->features); - netdev_feature_or(&net_dev->features, net_dev->features, + net_dev->features); + netdev_feature_or(net_dev->features, net_dev->features, efx->fixed_features);
rc = efx_register_netdev(efx); @@ -1102,7 +1102,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct efx_nic_type *) entry->driver_data; - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev); diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c index 8eac246..ee9af0b 100644 --- a/drivers/net/ethernet/sfc/efx_common.c +++ b/drivers/net/ethernet/sfc/efx_common.c @@ -225,7 +225,7 @@ int efx_set_features(struct net_device *net_dev, netdev_features_t data) /* If Rx VLAN filter is changed, update filters via mac_reconfigure. * If rx-fcs is changed, mac_reconfigure updates that too. */ - netdev_feature_xor(&changed, net_dev->features, data); + netdev_feature_xor(changed, net_dev->features, data); if (netdev_feature_test_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS, changed)) { /* efx_set_rx_mode() will schedule MAC work to update filters @@ -412,12 +412,12 @@ static void efx_start_datapath(struct efx_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */ - netdev_feature_copy(&old_features, efx->net_dev->features); - netdev_feature_or(&efx->net_dev->hw_features, + netdev_feature_copy(old_features, efx->net_dev->features); + netdev_feature_or(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->net_dev->features); - netdev_feature_andnot(&efx->net_dev->hw_features, + netdev_feature_andnot(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->fixed_features); - netdev_feature_or(&efx->net_dev->features, efx->net_dev->features, + netdev_feature_or(efx->net_dev->features, efx->net_dev->features, efx->fixed_features); if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev); @@ -1361,12 +1361,12 @@ static bool efx_can_encap_offloads(struct efx_nic *efx, struct sk_buff *skb) }
void efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct efx_nic *efx = netdev_priv(dev);
if (skb->encapsulation) { - if (netdev_feature_test_bits(NETIF_F_GSO_MASK, *features)) + if (netdev_feature_test_bits(NETIF_F_GSO_MASK, features)) /* Hardware can only do TSO with at most 208 bytes * of headers. */ @@ -1375,7 +1375,7 @@ void efx_features_check(struct sk_buff *skb, struct net_device *dev, netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); if (netdev_feature_test_bits(NETIF_F_GSO_MASK | - NETIF_F_CSUM_MASK, *features)) + NETIF_F_CSUM_MASK, features)) if (!efx_can_encap_offloads(efx, skb)) netdev_feature_clear_bits(NETIF_F_GSO_MASK | NETIF_F_CSUM_MASK, diff --git a/drivers/net/ethernet/sfc/efx_common.h b/drivers/net/ethernet/sfc/efx_common.h index c4fea39..83d632b 100644 --- a/drivers/net/ethernet/sfc/efx_common.h +++ b/drivers/net/ethernet/sfc/efx_common.h @@ -106,7 +106,7 @@ int efx_change_mtu(struct net_device *net_dev, int new_mtu); extern const struct pci_error_handlers efx_err_handlers;
void efx_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features); + 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/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c index c097a25..37fa253 100644 --- a/drivers/net/ethernet/sfc/falcon/efx.c +++ b/drivers/net/ethernet/sfc/falcon/efx.c @@ -640,12 +640,12 @@ static void ef4_start_datapath(struct ef4_nic *efx) /* Restore previously fixed features in hw_features and remove * features which are fixed now */ - netdev_feature_copy(&old_features, efx->net_dev->features); - netdev_feature_or(&efx->net_dev->hw_features, + netdev_feature_copy(old_features, efx->net_dev->features); + netdev_feature_or(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->net_dev->features); - netdev_feature_andnot(&efx->net_dev->hw_features, + netdev_feature_andnot(efx->net_dev->hw_features, efx->net_dev->hw_features, efx->fixed_features); - netdev_feature_or(&efx->net_dev->features, efx->net_dev->features, + netdev_feature_or(efx->net_dev->features, efx->net_dev->features, efx->net_dev->features); if (!netdev_feature_equal(efx->net_dev->features, old_features)) netdev_features_change(efx->net_dev); @@ -2208,7 +2208,7 @@ static int ef4_set_features(struct net_device *net_dev, netdev_features_t data) }
/* If Rx VLAN filter is changed, update filters via mac_reconfigure */ - netdev_feature_xor(&changed, net_dev->features, data); + netdev_feature_xor(changed, net_dev->features, data); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, changed)) { /* ef4_set_rx_mode() will schedule MAC work to update filters @@ -2933,7 +2933,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; efx = netdev_priv(net_dev); efx->type = (const struct ef4_nic_type *) entry->driver_data; - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &efx->fixed_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, efx->fixed_features);
pci_set_drvdata(pci_dev, efx); SET_NETDEV_DEV(net_dev, &pci_dev->dev); @@ -2955,26 +2955,24 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, if (rc) goto fail3;
- netdev_feature_set_bits(efx->type->offload_features, - &net_dev->features); - netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM, - &net_dev->features); + netdev_feature_set_bits(efx->type->offload_features, net_dev->features); + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM, net_dev->features); /* Mask for features that also apply to VLAN devices */ netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_RXCSUM, - &net_dev->vlan_features); + net_dev->vlan_features);
- netdev_feature_copy(&net_dev->hw_features, net_dev->features); + netdev_feature_copy(net_dev->hw_features, net_dev->features); netdev_feature_clear_bits(efx->type->offload_features, - &net_dev->hw_features); + net_dev->hw_features);
/* 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). */ netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->features); - netdev_feature_or(&net_dev->features, net_dev->features, + net_dev->features); + netdev_feature_or(net_dev->features, net_dev->features, efx->fixed_features);
rc = ef4_register_netdev(efx); diff --git a/drivers/net/ethernet/sfc/falcon/net_driver.h b/drivers/net/ethernet/sfc/falcon/net_driver.h index ec50ae2..64edf15 100644 --- a/drivers/net/ethernet/sfc/falcon/net_driver.h +++ b/drivers/net/ethernet/sfc/falcon/net_driver.h @@ -1299,7 +1299,7 @@ static inline struct ef4_rx_buffer *ef4_rx_buffer(struct ef4_rx_queue *rx_queue, * always in features. */ static inline void ef4_supported_features(const struct ef4_nic *efx, - netdev_features_t *supported) + netdev_features_t supported) { const struct net_device *net_dev = efx->net_dev;
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c index c199509..6e8257a 100644 --- a/drivers/net/ethernet/sfc/mcdi_filters.c +++ b/drivers/net/ethernet/sfc/mcdi_filters.c @@ -1321,7 +1321,7 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) if (rc) goto fail;
- efx_supported_features(efx, &supported); + efx_supported_features(efx, supported); if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, supported) && !(efx_mcdi_filter_match_supported(table, false, @@ -1331,11 +1331,11 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining) netif_info(efx, probe, net_dev, "VLAN filters are not supported in this firmware variant\n"); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->features); + net_dev->features); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &efx->fixed_features); + efx->fixed_features); netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &net_dev->hw_features); + net_dev->hw_features); }
table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS, diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 70e41d2..b7c36ea 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -1674,7 +1674,7 @@ efx_channel_tx_old_fill_level(struct efx_channel *channel) * always in features. */ static inline void efx_supported_features(const struct efx_nic *efx, - netdev_features_t *supported) + netdev_features_t supported) { const struct net_device *net_dev = efx->net_dev;
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c index ee72fc5..8c8e17b 100644 --- a/drivers/net/ethernet/sgi/ioc3-eth.c +++ b/drivers/net/ethernet/sgi/ioc3-eth.c @@ -927,12 +927,12 @@ static int ioc3eth_probe(struct platform_device *pdev) dev->watchdog_timeo = 5 * HZ; dev->netdev_ops = &ioc3_netdev_ops; dev->ethtool_ops = &ioc3_ethtool_ops; - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); - netdev_feature_zero(&dev->features); + dev->hw_features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_HIGHDMA, - &dev->features); + dev->features);
sw_physid1 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID1); sw_physid2 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID2); diff --git a/drivers/net/ethernet/silan/sc92031.c b/drivers/net/ethernet/silan/sc92031.c index ad8aa98..758d7f2 100644 --- a/drivers/net/ethernet/silan/sc92031.c +++ b/drivers/net/ethernet/silan/sc92031.c @@ -1436,10 +1436,10 @@ static int sc92031_probe(struct pci_dev *pdev, const struct pci_device_id *id) SET_NETDEV_DEV(dev, &pdev->dev);
/* faked with skb_copy_and_csum_dev */ - netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->features); + dev->features);
dev->netdev_ops = &sc92031_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 2859f4c..da988e5 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -2104,8 +2104,8 @@ static int netsec_probe(struct platform_device *pdev)
netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_RXCSUM | NETIF_F_GSO | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &ndev->features); - netdev_feature_copy(&ndev->hw_features, ndev->features); + ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features);
priv->rx_cksum_offload_flag = true;
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c index efdcb7f..34a4776 100644 --- a/drivers/net/ethernet/socionext/sni_ave.c +++ b/drivers/net/ethernet/socionext/sni_ave.c @@ -1595,9 +1595,9 @@ static int ave_probe(struct platform_device *pdev) SET_NETDEV_DEV(ndev, dev);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &ndev->features); + ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &ndev->hw_features); + ndev->hw_features);
ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f94950f..af6f22a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5453,7 +5453,7 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) }
static void stmmac_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct stmmac_priv *priv = netdev_priv(dev);
@@ -5473,7 +5473,7 @@ static void stmmac_fix_features(struct net_device *dev,
/* Disable tso if asked by ethtool */ if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { - if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, features)) priv->tso = true; else priv->tso = false; @@ -6858,28 +6858,28 @@ int stmmac_dvr_probe(struct device *device,
ndev->netdev_ops = &stmmac_netdev_ops;
- netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM, - &ndev->hw_features); + ndev->hw_features);
ret = stmmac_tc_init(priv, priv); if (!ret) { - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, ndev->hw_features); }
if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6, - &ndev->hw_features); + ndev->hw_features); if (priv->plat->has_gmac4) netdev_feature_set_bit(NETIF_F_GSO_UDP_L4_BIT, - &ndev->hw_features); + ndev->hw_features); priv->tso = true; dev_info(priv->device, "TSO feature enabled\n"); }
if (priv->dma_cap.sphen) { - netdev_feature_set_bit(NETIF_F_GRO_BIT, &ndev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, ndev->hw_features); priv->sph_cap = true; priv->sph = priv->sph_cap; dev_info(priv->device, "SPH feature enabled\n"); @@ -6917,27 +6917,27 @@ int stmmac_dvr_probe(struct device *device, } }
- netdev_feature_or(&ndev->features, ndev->features, + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features); ndev->watchdog_timeo = msecs_to_jiffies(watchdog); #ifdef STMMAC_VLAN_TAG_USED /* Both mac100 and gmac support receive VLAN tag detection */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX, - &ndev->features); + ndev->features); if (priv->dma_cap.vlhash) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &ndev->features); + ndev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, - &ndev->features); + ndev->features); } if (priv->dma_cap.vlins) { netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &ndev->features); + ndev->features); if (priv->dma_cap.dvlan) netdev_feature_set_bit(NETIF_F_HW_VLAN_STAG_TX_BIT, - &ndev->features); + ndev->features); } #endif priv->msg_enable = netif_msg_init(debug, default_msg_level); @@ -6949,7 +6949,7 @@ int stmmac_dvr_probe(struct device *device, priv->rss.table[i] = ethtool_rxfh_indir_default(i, rxq);
if (priv->dma_cap.rssen && priv->plat->rss_en) - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, ndev->features);
/* MTU range: 46 - hw-specific max */ ndev->min_mtu = ETH_ZLEN - ETH_HLEN; diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index 785e11f..6d5bc5b 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c @@ -5085,10 +5085,10 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* Cassini features. */ if ((cp->cas_flags & CAS_FLAG_NO_HW_CSUM) == 0) netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->features); + dev->features);
if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
/* MTU range: 60 - varies or 9000 */ dev->min_mtu = CAS_MIN_MTU; diff --git a/drivers/net/ethernet/sun/ldmvsw.c b/drivers/net/ethernet/sun/ldmvsw.c index 7c32d54..5ef0922 100644 --- a/drivers/net/ethernet/sun/ldmvsw.c +++ b/drivers/net/ethernet/sun/ldmvsw.c @@ -249,9 +249,9 @@ static struct net_device *vsw_alloc_netdev(u8 hwaddr[], dev->ethtool_ops = &vsw_ethtool_ops; dev->watchdog_timeo = VSW_TX_TIMEOUT;
- netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, &dev->features); - netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, dev->features); + netdev_feature_copy(dev->features, dev->hw_features);
/* MTU range: 68 - 65535 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 97f62ec..5c598d1 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -9711,11 +9711,11 @@ static void niu_device_announce(struct niu *np)
static void niu_set_basic_features(struct net_device *dev) { - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXHASH, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); }
static int niu_pci_init_one(struct pci_dev *pdev, @@ -9783,7 +9783,7 @@ static int niu_pci_init_one(struct pci_dev *pdev, dma_mask = DMA_BIT_MASK(44); err = pci_set_dma_mask(pdev, dma_mask); if (!err) { - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features); err = pci_set_consistent_dma_mask(pdev, dma_mask); if (err) { dev_err(&pdev->dev, "Unable to obtain 44 bit DMA for consistent allocations, aborting\n"); diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 79b2435..859ec88 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c @@ -2988,12 +2988,12 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, dev);
/* We can do scatter/gather and HW checksum */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); if (pci_using_dac) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
/* MTU range: 68 - 1500 (Jumbo mode is broken) */ dev->min_mtu = GEM_MIN_MTU; diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 22de1ad..daa55d1 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -2825,11 +2825,11 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe) dev->ethtool_ops = &hme_ethtool_ops;
/* Happy Meal can do it all... */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features);
hp->irq = op->archdata.irqs[0];
@@ -3143,11 +3143,11 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, dev->ethtool_ops = &hme_ethtool_ops;
/* Happy Meal can do it all... */ - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features);
#if defined(CONFIG_SBUS) && defined(CONFIG_PCI) /* Hook up PCI register/descriptor accessors. */ diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 1c5c858..334d501 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c @@ -312,11 +312,11 @@ static struct vnet *vnet_new(const u64 *local_mac, dev->ethtool_ops = &vnet_ethtool_ops; dev->watchdog_timeo = VNET_TX_TIMEOUT;
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_GSO | NETIF_F_ALL_TSO | NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features);
/* MTU range: 68 - 65535 */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c index 534c10e..d637d1c 100644 --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c @@ -1275,8 +1275,8 @@ vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb, skb_shinfo(skb)->gso_size = datalen; skb_shinfo(skb)->gso_segs = gso_segs; } - netdev_feature_copy(&tmp, dev->features); - netdev_feature_clear_bit(NETIF_F_TSO_BIT, &tmp); + netdev_feature_copy(tmp, dev->features); + netdev_feature_clear_bit(NETIF_F_TSO_BIT, tmp); segs = skb_gso_segment(skb, tmp); if (IS_ERR(segs)) goto out_dropped; diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c index 4e61f92c..9594094 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c @@ -179,47 +179,47 @@ static int xlgmac_init(struct xlgmac_pdata *pdata)
/* Set device features */ if (pdata->hw_feat.tso) { - netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_TSO6_BIT, &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_TSO6_BIT, netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); } else if (pdata->hw_feat.tx_coe) { - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (pdata->hw_feat.rx_coe) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &netdev->hw_features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, netdev->hw_features); }
if (pdata->hw_feat.rss) netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->vlan_features, netdev->vlan_features, + netdev_feature_or(netdev->vlan_features, netdev->vlan_features, netdev->hw_features);
netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &netdev->hw_features); + netdev->hw_features); if (pdata->hw_feat.sa_vlan_ins) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, - &netdev->hw_features); + netdev->hw_features); if (pdata->hw_feat.vlhash) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features); - netdev_feature_copy(&pdata->netdev_features, netdev->features); + netdev_feature_copy(pdata->netdev_features, netdev->features);
netdev->priv_flags |= IFF_UNICAST_FLT;
diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c index f4dfef74..f5037cc 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-net.c @@ -921,7 +921,7 @@ static int xlgmac_set_features(struct net_device *netdev, features) && rxvlan_filter) hw_ops->disable_rx_vlan_filtering(pdata);
- netdev_feature_copy(&pdata->netdev_features, features); + netdev_feature_copy(pdata->netdev_features, features);
return 0; } diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index d1df19e..0c50aa2 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c @@ -1980,21 +1980,21 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* these fields are used for info purposes only * so we can have them same for all ports of the board */ ndev->if_port = port; - netdev_feature_zero(&ndev->features); + netdev_feature_zero(ndev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM, - &ndev->features); - netdev_feature_zero(&ndev->hw_features); + ndev->features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX, - &ndev->features); + ndev->features);
if (pci_using_dac) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &ndev->features); + ndev->features);
/************** priv ****************/ priv = nic->priv[port] = netdev_priv(ndev); @@ -2031,7 +2031,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * set multicast list callback has to use priv->tx_lock. */ #ifdef BDX_LLTX - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, ndev->features); #endif /* MTU range: 60 - 16384 */ ndev->min_mtu = ETH_ZLEN; diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 2830691..6e0beff 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1975,23 +1975,23 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
port->ndev->min_mtu = AM65_CPSW_MIN_PACKET_SIZE; port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE; - netdev_feature_zero(&port->ndev->hw_features); + netdev_feature_zero(port->ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_HW_TC, - &port->ndev->hw_features); - netdev_feature_copy(&port->ndev->features, port->ndev->hw_features); + port->ndev->hw_features); + netdev_feature_copy(port->ndev->features, port->ndev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &port->ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &port->ndev->vlan_features); + port->ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, port->ndev->vlan_features); port->ndev->netdev_ops = &am65_cpsw_nuss_netdev_ops; port->ndev->ethtool_ops = &am65_cpsw_ethtool_ops_slave;
/* Disable TX checksum offload by default due to HW bug */ if (common->pdata.quirks & AM65_CPSW_QUIRK_I2027_NO_TX_CSUM) netdev_feature_clear_bit(NETIF_F_HW_CSUM_BIT, - &port->ndev->features); + port->ndev->features);
ndev_priv->stats = netdev_alloc_pcpu_stats(struct am65_cpsw_ndev_stats); if (!ndev_priv->stats) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index c11f2b0..5093572 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1465,7 +1465,7 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv) priv_sl2->emac_port = 1; cpsw->slaves[1].ndev = ndev; netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; @@ -1645,7 +1645,7 @@ static int cpsw_probe(struct platform_device *pdev) cpsw->slaves[0].ndev = ndev;
netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_RX, &ndev->features); + NETIF_F_HW_VLAN_CTAG_RX, ndev->features);
ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index 95af37d..513a025e 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -1408,7 +1408,7 @@ static int cpsw_create_ports(struct cpsw_common *cpsw) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_NETNS_LOCAL, - &ndev->features); + ndev->features); ndev->netdev_ops = &cpsw_netdev_ops; ndev->ethtool_ops = &cpsw_ethtool_ops; SET_NETDEV_DEV(ndev, dev); diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index a0129d4..a6c4dbb 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -1976,11 +1976,11 @@ static int netcp_create_interface(struct netcp_device *netcp_device, return -ENOMEM; }
- netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &ndev->features); - netdev_feature_copy(&ndev->hw_features, ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->vlan_features); + ndev->features); + netdev_feature_copy(ndev->hw_features, ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->vlan_features);
/* MTU range: 68 - 9486 */ ndev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index f502108..4637329 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -1461,14 +1461,14 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) int status; u64 v1, v2;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_zero(&netdev->features); - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &netdev->features); + netdev_feature_zero(netdev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, netdev->features); if (GELIC_CARD_RX_CSUM_DEFAULT) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features);
status = lv1_net_control(bus_id(card), dev_id(card), GELIC_LV1_GET_MAC_ADDRESS, @@ -1489,7 +1489,7 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) * we can not receive vlan packets */ netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, - &netdev->features); + netdev->features); }
/* MTU range: 64 - 1518 */ diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index bbbdbe6d..7b2f67a 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c @@ -2271,13 +2271,13 @@ spider_net_setup_netdev(struct spider_net_card *card)
spider_net_setup_netdev_ops(netdev);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &netdev->hw_features); + netdev->hw_features); if (SPIDER_NET_RX_CSUM_DEFAULT) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, netdev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_LLTX, - &netdev->features); + netdev->features);
/* some time: NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | * NETIF_F_HW_VLAN_CTAG_FILTER diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c index 3ab07ea..e2ae886 100644 --- a/drivers/net/ethernet/tundra/tsi108_eth.c +++ b/drivers/net/ethernet/tundra/tsi108_eth.c @@ -1609,8 +1609,8 @@ tsi108_init_one(struct platform_device *pdev) * a new function skb_csum_dev() in net/core/skbuff.c). */
- netdev_feature_zero(&dev->features); - netdev_feature_set_bits(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bits(NETIF_F_HIGHDMA_BIT, dev->features);
spin_lock_init(&data->txlock); spin_lock_init(&data->misclock); diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 952ce5e..429ccb4 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c @@ -967,13 +967,13 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks,
if (rp->quirks & rqRhineI) netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &dev->features); + dev->features);
if (rp->quirks & rqMgmt) netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->features); + dev->features);
/* dev->name not defined before register_netdev()! */ rc = register_netdev(dev); diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index f8b4af1..c41e48e 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -2847,15 +2847,15 @@ static int velocity_probe(struct device *dev, int irq, netif_napi_add(netdev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT);
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_TX, - &netdev->hw_features); + netdev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_IP_CSUM, - &netdev->features); + netdev->features);
/* MTU range: 64 - 9000 */ netdev->min_mtu = VELOCITY_MIN_MTU; diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c index 54adf51..3e82f74 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c @@ -1134,7 +1134,7 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops, /* This chip doesn't support VLAN packets with normal MTU, * so disable VLAN for this device. */ - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, ndev->features);
err = register_netdev(ndev); if (err < 0) diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c index fe2b05e..54e92fe 100644 --- a/drivers/net/ethernet/wiznet/w5300.c +++ b/drivers/net/ethernet/wiznet/w5300.c @@ -608,7 +608,7 @@ static int w5300_probe(struct platform_device *pdev) /* This chip doesn't support VLAN packets with normal MTU, * so disable VLAN for this device. */ - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, ndev->features);
err = register_netdev(ndev); if (err < 0) diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 74224e1..d00d619 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c @@ -1382,8 +1382,8 @@ static int temac_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ndev); SET_NETDEV_DEV(ndev, &pdev->dev); - netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); ndev->netdev_ops = &temac_netdev_ops; ndev->ethtool_ops = &temac_ethtool_ops; #if 0 @@ -1467,7 +1467,7 @@ static int temac_probe(struct platform_device *pdev) } if (lp->temac_features & TEMAC_FEATURE_TX_CSUM) /* Can checksum TCP/UDP over IPv4. */ - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, ndev->features);
/* Defaults for IRQ delay/coalescing setup. These are * configuration values, so does not belong in device-tree. diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 54aaaa4..f4370343 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -1849,8 +1849,8 @@ static int axienet_probe(struct platform_device *pdev)
SET_NETDEV_DEV(ndev, &pdev->dev); ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ - netdev_feature_zero(&ndev->features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &ndev->features); + netdev_feature_zero(ndev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, ndev->features); ndev->netdev_ops = &axienet_netdev_ops; ndev->ethtool_ops = &axienet_ethtool_ops;
@@ -1914,7 +1914,7 @@ static int axienet_probe(struct platform_device *pdev) lp->features |= XAE_FEATURE_PARTIAL_TX_CSUM; /* Can checksum TCP/UDP over IPv4. */ netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &ndev->features); + ndev->features); break; case 2: lp->csum_offload_on_tx_path = @@ -1922,7 +1922,7 @@ static int axienet_probe(struct platform_device *pdev) lp->features |= XAE_FEATURE_FULL_TX_CSUM; /* Can checksum TCP/UDP over IPv4. */ netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &ndev->features); + ndev->features); break; default: lp->csum_offload_on_tx_path = XAE_NO_CSUM_OFFLOAD; diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 583d21a..a621ad6 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1345,7 +1345,7 @@ static void fjes_netdev_setup(struct net_device *netdev) netdev->min_mtu = fjes_support_mtu[0]; netdev->max_mtu = fjes_support_mtu[3]; netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features); }
static void fjes_irq_watch_task(struct work_struct *work) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index d2179c1..c09d445 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1219,16 +1219,16 @@ static void geneve_setup(struct net_device *dev)
SET_NETDEV_DEVTYPE(dev, &geneve_type);
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features);
netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features);
/* MTU range: 68 - (something less than 65535) */ dev->min_mtu = ETH_MIN_MTU; diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index ddc55d3..f456cc2 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -639,7 +639,7 @@ static void gtp_link_setup(struct net_device *dev) dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->priv_flags |= IFF_NO_QUEUE; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
dev->needed_headroom = LL_MAX_HEADER + max_gtp_header_len; diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 84b3bce..572532e 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1207,8 +1207,8 @@ static void netvsc_init_settings(struct net_device *dev) ndc->speed = SPEED_UNKNOWN; ndc->duplex = DUPLEX_FULL;
- netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->features); }
static int netvsc_get_link_ksettings(struct net_device *dev, @@ -1923,7 +1923,7 @@ static int netvsc_set_ringparam(struct net_device *ndev, }
static void netvsc_fix_features(struct net_device *ndev, - netdev_features_t *features) + netdev_features_t features) { struct net_device_context *ndevctx = netdev_priv(ndev); struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); @@ -1931,7 +1931,7 @@ static void netvsc_fix_features(struct net_device *ndev, if (!nvdev || nvdev->destroy) return;
- if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features) && netvsc_xdp_get(nvdev)) { netdev_feature_change_bit(NETIF_F_LRO_BIT, features); netdev_info(ndev, "Skip LRO - unsupported with XDP\n"); @@ -1951,7 +1951,7 @@ static int netvsc_set_features(struct net_device *ndev, if (!nvdev || nvdev->destroy) return -ENODEV;
- netdev_feature_xor(&change, features, ndev->features); + netdev_feature_xor(change, features, ndev->features);
if (!netdev_feature_test_bit(NETIF_F_LRO_BIT, change)) goto syncvf; @@ -1969,15 +1969,15 @@ static int netvsc_set_features(struct net_device *ndev, ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads);
if (ret) { - netdev_feature_change_bit(NETIF_F_LRO_BIT, &features); - netdev_feature_copy(&ndev->features, features); + netdev_feature_change_bit(NETIF_F_LRO_BIT, features); + netdev_feature_copy(ndev->features, features); }
syncvf: if (!vf_netdev) return ret;
- netdev_feature_copy(&vf_netdev->wanted_features, features); + netdev_feature_copy(vf_netdev->wanted_features, features); netdev_update_features(vf_netdev);
return ret; @@ -2391,7 +2391,7 @@ static int netvsc_register_vf(struct net_device *vf_netdev) if (ndev->needed_headroom < vf_netdev->needed_headroom) ndev->needed_headroom = vf_netdev->needed_headroom;
- netdev_feature_copy(&vf_netdev->wanted_features, ndev->features); + netdev_feature_copy(vf_netdev->wanted_features, ndev->features); netdev_update_features(vf_netdev);
prog = netvsc_xdp_get(netvsc_dev); @@ -2556,10 +2556,10 @@ static int netvsc_probe(struct hv_device *dev, schedule_work(&nvdev->subchan_work);
/* hw_features computed in rndis_netdev_set_hwcaps() */ - netdev_feature_copy(&net->features, net->hw_features); + netdev_feature_copy(net->features, net->hw_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &net->features); - netdev_feature_copy(&net->vlan_features, net->features); + NETIF_F_HW_VLAN_CTAG_RX, net->features); + netdev_feature_copy(net->vlan_features, net->features);
netdev_lockdep_set_classes(net);
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index f0206cd..21d1b4c 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1364,17 +1364,17 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device,
/* Reset previously set hw_features flags */ netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, - &net->hw_features); + net->hw_features); net_device_ctx->tx_checksum_mask = 0;
/* Compute tx offload settings based on hw capabilities */ - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &net->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &net->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, net->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, net->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, net->hw_features);
if ((hwcaps.csum.ip4_txcsum & NDIS_TXCSUM_ALL_TCP4) == NDIS_TXCSUM_ALL_TCP4) { /* Can checksum TCP */ - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, net->hw_features); net_device_ctx->tx_checksum_mask |= TRANSPORT_INFO_IPV4_TCP;
offloads.tcp_ip_v4_csum = NDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; @@ -1382,7 +1382,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, if (hwcaps.lsov2.ip4_encap & NDIS_OFFLOAD_ENCAP_8023) { offloads.lso_v2_ipv4 = NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; netdev_feature_set_bit(NETIF_F_TSO_BIT, - &net->hw_features); + net->hw_features);
if (hwcaps.lsov2.ip4_maxsz < gso_max_size) gso_max_size = hwcaps.lsov2.ip4_maxsz; @@ -1396,7 +1396,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device,
if ((hwcaps.csum.ip6_txcsum & NDIS_TXCSUM_ALL_TCP6) == NDIS_TXCSUM_ALL_TCP6) { netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &net->hw_features); + net->hw_features);
offloads.tcp_ip_v6_csum = NDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; net_device_ctx->tx_checksum_mask |= TRANSPORT_INFO_IPV6_TCP; @@ -1405,7 +1405,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, (hwcaps.lsov2.ip6_opts & NDIS_LSOV2_CAP_IP6) == NDIS_LSOV2_CAP_IP6) { offloads.lso_v2_ipv6 = NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &net->hw_features); + net->hw_features);
if (hwcaps.lsov2.ip6_maxsz < gso_max_size) gso_max_size = hwcaps.lsov2.ip6_maxsz; @@ -1418,7 +1418,7 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, }
if (hwcaps.rsc.ip4 && hwcaps.rsc.ip6) { - netdev_feature_set_bit(NETIF_F_LRO_BIT, &net->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, net->hw_features);
if (netdev_feature_test_bit(NETIF_F_LRO_BIT, net->features)) { offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED; @@ -1432,10 +1432,10 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device, /* In case some hw_features disappeared we need to remove them from * net->features list as they're no longer supported. */ - netdev_feature_fill(&tmp); - netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, &tmp); - netdev_feature_or(&tmp, tmp, net->hw_features); - netdev_feature_and(&net->features, net->features, tmp); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(NETVSC_SUPPORTED_HW_FEATURES, tmp); + netdev_feature_or(tmp, tmp, net->hw_features); + netdev_feature_and(net->features, net->features, tmp);
netif_set_gso_max_size(net, gso_max_size);
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 91add5a..2ba5bae 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -213,13 +213,13 @@ static void ifb_setup(struct net_device *dev) ether_setup(dev); dev->tx_queue_len = TX_Q_LIMIT;
- netdev_feature_set_bits(IFB_FEATURES, &dev->features); - netdev_feature_or(&dev->hw_features, dev->hw_features, dev->features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + netdev_feature_set_bits(IFB_FEATURES, dev->features); + netdev_feature_or(dev->hw_features, dev->hw_features, dev->features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); netdev_feature_set_bits(IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX), - &dev->features); + dev->features);
dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index f0ce8d6..3b75d861 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -165,8 +165,8 @@ static void ipa_modem_netdev_setup(struct net_device *netdev) netdev->needed_headroom = sizeof(struct rmnet_map_header); netdev->needed_tailroom = IPA_NETDEV_TAILROOM; netdev->watchdog_timeo = IPA_NETDEV_TIMEOUT * HZ; - netdev_feature_zero(&netdev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &netdev->hw_features); + netdev_feature_zero(netdev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, netdev->hw_features); }
/** ipa_modem_suspend() - suspend callback diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index e77e4dc..144f21f 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -135,13 +135,13 @@ static int ipvlan_init(struct net_device *dev)
dev->state = (dev->state & ~IPVLAN_STATE_MASK) | (phy_dev->state & IPVLAN_STATE_MASK); - netdev_feature_copy(&dev->features, phy_dev->features); - netdev_feature_and_bits(IPVLAN_FEATURES, &dev->features); - netdev_feature_set_bits(IPVLAN_ALWAYS_ON, &dev->features); - netdev_feature_copy(&dev->vlan_features, phy_dev->vlan_features); - netdev_feature_and_bits(IPVLAN_FEATURES, &dev->vlan_features); - netdev_feature_set_bits(IPVLAN_ALWAYS_ON_OFLOADS, &dev->vlan_features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + netdev_feature_copy(dev->features, phy_dev->features); + netdev_feature_and_bits(IPVLAN_FEATURES, dev->features); + netdev_feature_set_bits(IPVLAN_ALWAYS_ON, dev->features); + netdev_feature_copy(dev->vlan_features, phy_dev->vlan_features); + netdev_feature_and_bits(IPVLAN_FEATURES, dev->vlan_features); + netdev_feature_set_bits(IPVLAN_ALWAYS_ON_OFLOADS, dev->vlan_features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); dev->gso_max_size = phy_dev->gso_max_size; dev->gso_max_segs = phy_dev->gso_max_segs; @@ -239,18 +239,18 @@ static netdev_tx_t ipvlan_start_xmit(struct sk_buff *skb, }
static void ipvlan_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct ipvl_dev *ipvlan = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(tmp);
netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); - netdev_feature_fill(&tmp); - netdev_feature_clear_bits(IPVLAN_FEATURES, &tmp); - netdev_feature_or(&tmp, tmp, ipvlan->sfeatures); - netdev_feature_and(features, *features, tmp); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(IPVLAN_FEATURES, tmp); + netdev_feature_or(tmp, tmp, ipvlan->sfeatures); + netdev_feature_and(features, features, tmp); netdev_increment_features(features, ipvlan->phy_dev->features, - *features, *features); + features, features); netdev_feature_set_bits(IPVLAN_ALWAYS_ON, features); netdev_feature_and_bits(IPVLAN_FEATURES | IPVLAN_ALWAYS_ON, features); } @@ -574,8 +574,8 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
ipvlan->phy_dev = phy_dev; ipvlan->dev = dev; - netdev_feature_zero(&ipvlan->sfeatures); - netdev_feature_set_bits(IPVLAN_FEATURES, &ipvlan->sfeatures); + netdev_feature_zero(ipvlan->sfeatures); + netdev_feature_set_bits(IPVLAN_FEATURES, ipvlan->sfeatures); if (!tb[IFLA_MTU]) ipvlan_adjust_mtu(ipvlan, phy_dev); INIT_LIST_HEAD(&ipvlan->addrs); diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c index e7fb343..4c07ec5 100644 --- a/drivers/net/ipvlan/ipvtap.c +++ b/drivers/net/ipvlan/ipvtap.c @@ -70,7 +70,7 @@ static void ipvtap_update_features(struct tap_dev *tap, struct ipvtap_dev *vlantap = container_of(tap, struct ipvtap_dev, tap); struct ipvl_dev *vlan = &vlantap->vlan;
- netdev_feature_copy(&vlan->sfeatures, features); + netdev_feature_copy(vlan->sfeatures, features); netdev_update_features(vlan->dev); }
@@ -86,7 +86,7 @@ static int ipvtap_newlink(struct net *src_net, struct net_device *dev, /* Since macvlan supports all offloads by default, make * tap support all offloads also. */ - netdev_feature_set_bits(TUN_OFFLOADS, &vlantap->tap.tap_features); + netdev_feature_set_bits(TUN_OFFLOADS, vlantap->tap.tap_features); vlantap->tap.count_tx_dropped = ipvtap_count_tx_dropped; vlantap->tap.update_features = ipvtap_update_features; vlantap->tap.count_rx_dropped = ipvtap_count_rx_dropped; diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 23cad64..a84b49c 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -174,15 +174,15 @@ static void gen_lo_setup(struct net_device *dev, dev->flags = IFF_LOOPBACK; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; netif_keep_dst(dev); - netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); - netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SCTP_CRC | NETIF_F_HIGHDMA | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL | NETIF_F_VLAN_CHALLENGED | - NETIF_F_LOOPBACK, &dev->hw_features); + NETIF_F_LOOPBACK, dev->hw_features); dev->ethtool_ops = eth_ops; dev->header_ops = hdr_ops; dev->netdev_ops = dev_ops; diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 8693dec..e761ebb 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3441,15 +3441,15 @@ static int macsec_dev_init(struct net_device *dev) * VLAN_FEATURES - they require additional ops * HW_MACSEC - no reason to report it */ - netdev_feature_copy(&dev->features, real_dev->features); + netdev_feature_copy(dev->features, real_dev->features); netdev_feature_clear_bits(NETIF_F_VLAN_FEATURES | NETIF_F_HW_MACSEC, - &dev->features); + dev->features); } else { - netdev_feature_copy(&dev->features, real_dev->features); - netdev_feature_and_bits(SW_MACSEC_FEATURES, &dev->features); + netdev_feature_copy(dev->features, real_dev->features); + netdev_feature_and_bits(SW_MACSEC_FEATURES, dev->features); netdev_feature_set_bits(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); }
dev->needed_headroom = real_dev->needed_headroom + @@ -3474,7 +3474,7 @@ static void macsec_dev_uninit(struct net_device *dev) }
static void macsec_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct macsec_dev *macsec = macsec_priv(dev); struct net_device *real_dev = macsec->real_dev; @@ -3487,11 +3487,11 @@ static void macsec_fix_features(struct net_device *dev, return; }
- netdev_feature_copy(&tmp, real_dev->features); - netdev_feature_and_bits(SW_MACSEC_FEATURES, &tmp); + netdev_feature_copy(tmp, real_dev->features); + netdev_feature_and_bits(SW_MACSEC_FEATURES, tmp); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES, - &tmp); - netdev_feature_and(features, *features, tmp); + tmp); + netdev_feature_and(features, features, tmp); netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index d373b45..8502fd55 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -894,14 +894,14 @@ static int macvlan_init(struct net_device *dev)
dev->state = (dev->state & ~MACVLAN_STATE_MASK) | (lowerdev->state & MACVLAN_STATE_MASK); - netdev_feature_copy(&dev->features, lowerdev->features); - netdev_feature_and_bits(MACVLAN_FEATURES, &dev->features); - netdev_feature_set_bits(ALWAYS_ON_FEATURES, &dev->features); - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); - netdev_feature_copy(&dev->vlan_features, lowerdev->vlan_features); - netdev_feature_and_bits(MACVLAN_FEATURES, &dev->vlan_features); - netdev_feature_set_bits(ALWAYS_ON_OFFLOADS, &dev->vlan_features); - netdev_feature_or(&dev->hw_enc_features, dev->hw_enc_features, + netdev_feature_copy(dev->features, lowerdev->features); + netdev_feature_and_bits(MACVLAN_FEATURES, dev->features); + netdev_feature_set_bits(ALWAYS_ON_FEATURES, dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->hw_features); + netdev_feature_copy(dev->vlan_features, lowerdev->vlan_features); + netdev_feature_and_bits(MACVLAN_FEATURES, dev->vlan_features); + netdev_feature_set_bits(ALWAYS_ON_OFFLOADS, dev->vlan_features); + netdev_feature_or(dev->hw_enc_features, dev->hw_enc_features, dev->features); dev->gso_max_size = lowerdev->gso_max_size; dev->gso_max_segs = lowerdev->gso_max_segs; @@ -1072,26 +1072,26 @@ static int macvlan_ethtool_get_ts_info(struct net_device *dev, }
static void macvlan_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(lowerdev_features); struct macvlan_dev *vlan = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(mask); __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_copy(&lowerdev_features, vlan->lowerdev->features); + netdev_feature_copy(lowerdev_features, vlan->lowerdev->features); netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features); - netdev_feature_fill(&tmp); - netdev_feature_clear_bits(MACVLAN_FEATURES, &tmp); - netdev_feature_or(&tmp, tmp, vlan->set_features); - netdev_feature_and(features, *features, tmp); - netdev_feature_copy(&mask, *features); - - netdev_feature_fill(&tmp); - netdev_feature_clear_bit(NETIF_F_LRO_BIT, &tmp); - netdev_feature_or(&tmp, tmp, *features); - netdev_feature_and(&lowerdev_features, lowerdev_features, tmp); - netdev_increment_features(features, lowerdev_features, *features, mask); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(MACVLAN_FEATURES, tmp); + netdev_feature_or(tmp, tmp, vlan->set_features); + netdev_feature_and(features, features, tmp); + netdev_feature_copy(mask, features); + + netdev_feature_fill(tmp); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, tmp); + netdev_feature_or(tmp, tmp, features); + netdev_feature_and(lowerdev_features, lowerdev_features, tmp); + netdev_increment_features(features, lowerdev_features, features, mask); netdev_feature_set_bits(ALWAYS_ON_FEATURES, features); netdev_feature_and_bits(ALWAYS_ON_FEATURES | MACVLAN_FEATURES, features); @@ -1471,8 +1471,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, vlan->lowerdev = lowerdev; vlan->dev = dev; vlan->port = port; - netdev_feature_zero(&vlan->set_features); - netdev_feature_set_bits(MACVLAN_FEATURES, &vlan->set_features); + netdev_feature_zero(vlan->set_features); + netdev_feature_set_bits(MACVLAN_FEATURES, vlan->set_features);
vlan->mode = MACVLAN_MODE_VEPA; if (data && data[IFLA_MACVLAN_MODE]) diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 2162080..8b605fe 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -74,7 +74,7 @@ static void macvtap_update_features(struct tap_dev *tap, struct macvtap_dev *vlantap = container_of(tap, struct macvtap_dev, tap); struct macvlan_dev *vlan = &vlantap->vlan;
- netdev_feature_copy(&vlan->set_features, features); + netdev_feature_copy(vlan->set_features, features); netdev_update_features(vlan->dev); }
@@ -90,8 +90,8 @@ static int macvtap_newlink(struct net *src_net, struct net_device *dev, /* Since macvlan supports all offloads by default, make * tap support all offloads also. */ - netdev_feature_zero(&vlantap->tap.tap_features); - netdev_feature_set_bits(TUN_OFFLOADS, &vlantap->tap.tap_features); + netdev_feature_zero(vlantap->tap.tap_features); + netdev_feature_set_bits(TUN_OFFLOADS, vlantap->tap.tap_features);
/* Register callbacks for rx/tx drops accounting and updating * net_device features diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 16375fb..09cf246 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -389,21 +389,21 @@ static void net_failover_compute_features(struct net_device *dev) __DECLARE_NETDEV_FEATURE_MASK(vlan_mask); __DECLARE_NETDEV_FEATURE_MASK(enc_mask);
- netdev_feature_zero(&vlan_features); + netdev_feature_zero(vlan_features); netdev_feature_set_bits(FAILOVER_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, - &vlan_features); - netdev_feature_zero(&enc_features); - netdev_feature_set_bits(FAILOVER_ENC_FEATURES, &enc_features); - netdev_feature_zero(&vlan_mask); - netdev_feature_set_bits(FAILOVER_VLAN_FEATURES, &vlan_mask); - netdev_feature_copy(&enc_mask, enc_features); + vlan_features); + netdev_feature_zero(enc_features); + netdev_feature_set_bits(FAILOVER_ENC_FEATURES, enc_features); + netdev_feature_zero(vlan_mask); + netdev_feature_set_bits(FAILOVER_VLAN_FEATURES, vlan_mask); + netdev_feature_copy(enc_mask, enc_features);
primary_dev = rcu_dereference(nfo_info->primary_dev); if (primary_dev) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, primary_dev->vlan_features, vlan_mask); - netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, primary_dev->hw_enc_features, enc_features);
@@ -414,10 +414,10 @@ static void net_failover_compute_features(struct net_device *dev)
standby_dev = rcu_dereference(nfo_info->standby_dev); if (standby_dev) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, standby_dev->vlan_features, vlan_mask); - netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, standby_dev->hw_enc_features, enc_features);
@@ -426,9 +426,9 @@ static void net_failover_compute_features(struct net_device *dev) max_hard_header_len = standby_dev->hard_header_len; }
- netdev_feature_copy(&dev->vlan_features, vlan_features); - netdev_feature_copy(&dev->hw_enc_features, enc_features); - netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->hw_enc_features); + netdev_feature_copy(dev->vlan_features, vlan_features); + netdev_feature_copy(dev->hw_enc_features, enc_features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, dev->hw_enc_features); dev->hard_header_len = max_hard_header_len;
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; @@ -743,22 +743,22 @@ struct failover *net_failover_create(struct net_device *standby_dev) IFF_TX_SKB_SHARING);
/* don't acquire failover netdev's netif_tx_lock when transmitting */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &failover_dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, failover_dev->features);
/* Don't allow failover devices to change network namespaces. */ netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &failover_dev->features); + failover_dev->features);
- netdev_feature_zero(&failover_dev->hw_features); + netdev_feature_zero(failover_dev->hw_features); netdev_feature_set_bits(FAILOVER_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &failover_dev->hw_features); + failover_dev->hw_features);
netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, - &failover_dev->hw_features); - netdev_feature_or(&failover_dev->features, failover_dev->features, + failover_dev->hw_features); + netdev_feature_or(failover_dev->features, failover_dev->features, failover_dev->hw_features);
memcpy(failover_dev->dev_addr, standby_dev->dev_addr, diff --git a/drivers/net/netdevsim/ipsec.c b/drivers/net/netdevsim/ipsec.c index 3b77c37..8f30c9d 100644 --- a/drivers/net/netdevsim/ipsec.c +++ b/drivers/net/netdevsim/ipsec.c @@ -280,8 +280,8 @@ void nsim_ipsec_init(struct netdevsim *ns) NETIF_F_HW_ESP_TX_CSUM | \ NETIF_F_GSO_ESP)
- netdev_feature_set_bits(NSIM_ESP_FEATURES, &ns->netdev->features); - netdev_feature_set_bits(NSIM_ESP_FEATURES, &ns->netdev->hw_enc_features); + netdev_feature_set_bits(NSIM_ESP_FEATURES, ns->netdev->features); + netdev_feature_set_bits(NSIM_ESP_FEATURES, ns->netdev->hw_enc_features);
ns->ipsec.pfile = debugfs_create_file("ipsec", 0400, ns->nsim_dev_port->ddir, ns, diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 895b548..3186286 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -293,8 +293,8 @@ static void nsim_setup(struct net_device *dev) NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_CSUM | - NETIF_F_TSO, &dev->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &dev->hw_features); + NETIF_F_TSO, dev->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, dev->hw_features); dev->max_mtu = ETH_MAX_MTU; }
diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c index 66af978..bfacc43 100644 --- a/drivers/net/nlmon.c +++ b/drivers/net/nlmon.c @@ -89,9 +89,9 @@ static void nlmon_setup(struct net_device *dev) dev->ethtool_ops = &nlmon_ethtool_ops; dev->needs_free_netdev = true;
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | - NETIF_F_HIGHDMA | NETIF_F_LLTX, &dev->features); + NETIF_F_HIGHDMA | NETIF_F_LLTX, dev->features); dev->flags = IFF_NOARP;
/* That's rather a softlimit here, which, of course, diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 0c9d0bd..7fc05ed 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -1599,7 +1599,7 @@ static void ppp_setup(struct net_device *dev) dev->netdev_ops = &ppp_netdev_ops; SET_NETDEV_DEVTYPE(dev, &ppp_type);
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features);
dev->hard_header_len = PPP_HDRLEN; dev->mtu = PPP_MRU; diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 49da4d1..80012b7 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -323,8 +323,8 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) struct tap_dev *tap; struct tap_queue *q;
- netdev_feature_zero(&features); - netdev_feature_set_bits(TAP_FEATURES, &features); + netdev_feature_zero(features); + netdev_feature_set_bits(TAP_FEATURES, features);
tap = tap_dev_get_rcu(dev); if (!tap) @@ -341,7 +341,7 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb) * enabled. */ if (q->flags & IFF_VNET_HDR) - netdev_feature_or(&features, features, tap->tap_features); + netdev_feature_or(features, features, tap->tap_features); if (netif_needs_gso(skb, features)) { struct sk_buff *segs = __skb_gso_segment(skb, features, false); struct sk_buff *next; @@ -931,22 +931,22 @@ static int set_offload(struct tap_queue *q, unsigned long arg) if (!tap) return -ENOLINK;
- netdev_feature_zero(&feature_mask); - netdev_feature_copy(&features, tap->dev->features); + netdev_feature_zero(feature_mask); + netdev_feature_copy(features, tap->dev->features);
if (arg & TUN_F_CSUM) { - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &feature_mask); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, feature_mask);
if (arg & (TUN_F_TSO4 | TUN_F_TSO6)) { if (arg & TUN_F_TSO_ECN) netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &feature_mask); + feature_mask); if (arg & TUN_F_TSO4) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &feature_mask); + feature_mask); if (arg & TUN_F_TSO6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &feature_mask); + feature_mask); } }
@@ -959,14 +959,14 @@ static int set_offload(struct tap_queue *q, unsigned long arg) * user-space will not receive TSO frames. */ if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, feature_mask)) - netdev_feature_set_bits(RX_OFFLOADS, &features); + netdev_feature_set_bits(RX_OFFLOADS, features); else - netdev_feature_clear_bits(RX_OFFLOADS, &features); + netdev_feature_clear_bits(RX_OFFLOADS, features);
/* tap_features are the same as features on tun/tap and * reflect user expectations. */ - netdev_feature_copy(&tap->tap_features, feature_mask); + netdev_feature_copy(tap->tap_features, feature_mask); if (tap->update_features) tap->update_features(tap, features);
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 79171c8..79413eb 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -993,21 +993,21 @@ static void __team_compute_features(struct team *team) __DECLARE_NETDEV_FEATURE_MASK(mask_vlan); __DECLARE_NETDEV_FEATURE_MASK(mask_enc);
- netdev_feature_zero(&vlan_features); + netdev_feature_zero(vlan_features); netdev_feature_set_bits(TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL, - &vlan_features); - netdev_feature_zero(&enc_features); - netdev_feature_set_bits(TEAM_ENC_FEATURES, &enc_features); - netdev_feature_zero(&mask_vlan); - netdev_feature_set_bits(TEAM_VLAN_FEATURES, &mask_vlan); - netdev_feature_zero(&mask_enc); - netdev_feature_set_bits(TEAM_ENC_FEATURES, &mask_enc); + vlan_features); + netdev_feature_zero(enc_features); + netdev_feature_set_bits(TEAM_ENC_FEATURES, enc_features); + netdev_feature_zero(mask_vlan); + netdev_feature_set_bits(TEAM_VLAN_FEATURES, mask_vlan); + netdev_feature_zero(mask_enc); + netdev_feature_set_bits(TEAM_ENC_FEATURES, mask_enc);
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { - netdev_increment_features(&vlan_features, vlan_features, + netdev_increment_features(vlan_features, vlan_features, port->dev->vlan_features, mask_vlan); - netdev_increment_features(&enc_features, enc_features, + netdev_increment_features(enc_features, enc_features, port->dev->hw_enc_features, mask_enc);
dst_release_flag &= port->dev->priv_flags; @@ -1016,12 +1016,12 @@ static void __team_compute_features(struct team *team) } rcu_read_unlock();
- netdev_feature_copy(&team->dev->vlan_features, vlan_features); - netdev_feature_copy(&team->dev->hw_enc_features, enc_features); + netdev_feature_copy(team->dev->vlan_features, vlan_features); + netdev_feature_copy(team->dev->hw_enc_features, enc_features); netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &team->dev->hw_enc_features); + team->dev->hw_enc_features); team->dev->hard_header_len = max_hard_header_len;
team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; @@ -2006,19 +2006,19 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev) }
static void team_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct team_port *port; struct team *team = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(mask);
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(mask, features); netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); netdev_feature_set_bits(NETIF_F_ALL_FOR_ALL, features);
rcu_read_lock(); list_for_each_entry_rcu(port, &team->port_list, list) { - netdev_increment_features(features, *features, + netdev_increment_features(features, features, port->dev->features, mask); } rcu_read_unlock(); @@ -2172,22 +2172,22 @@ static void team_setup(struct net_device *dev) */ dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bit(NETIF_F_GRO_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bit(NETIF_F_GRO_BIT, dev->features);
/* Don't allow team devices to change network namespaces. */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features);
netdev_feature_set_bits(TEAM_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->hw_features); + dev->hw_features);
- netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, &dev->hw_features); - netdev_feature_or(&dev->features, dev->features, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_ENCAP_ALL, dev->hw_features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->features); + dev->features); }
static int team_newlink(struct net *src_net, struct net_device *dev, diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a464daf..18efa2f 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1080,14 +1080,14 @@ static void tun_net_mclist(struct net_device *dev) }
static void tun_net_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct tun_struct *tun = netdev_priv(dev); __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_and(&tmp, *features, tun->set_features); + netdev_feature_and(tmp, features, tun->set_features); netdev_feature_clear_bits(TUN_USER_FEATURES, features); - netdev_feature_or(features, *features, tmp); + netdev_feature_or(features, features, tmp); }
static void tun_set_headroom(struct net_device *dev, int new_hr) @@ -2729,18 +2729,18 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) tun_net_init(dev); tun_flow_init(tun);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->vlan_features); + dev->vlan_features);
tun->flags = (tun->flags & ~TUN_FEATURES) | (ifr->ifr_flags & TUN_FEATURES); @@ -2804,24 +2804,24 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) { __DECLARE_NETDEV_FEATURE_MASK(features);
- netdev_feature_zero(&features); + netdev_feature_zero(features);
if (arg & TUN_F_CSUM) { - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features); arg &= ~TUN_F_CSUM;
if (arg & (TUN_F_TSO4|TUN_F_TSO6)) { if (arg & TUN_F_TSO_ECN) { netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &features); + features); arg &= ~TUN_F_TSO_ECN; } if (arg & TUN_F_TSO4) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &features); + features); if (arg & TUN_F_TSO6) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &features); + features); arg &= ~(TUN_F_TSO4|TUN_F_TSO6); }
@@ -2833,10 +2833,10 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) if (arg) return -EINVAL;
- netdev_feature_copy(&tun->set_features, features); + netdev_feature_copy(tun->set_features, features); netdev_feature_clear_bits(TUN_USER_FEATURES, - &tun->dev->wanted_features); - netdev_feature_or(&tun->dev->wanted_features, + tun->dev->wanted_features); + netdev_feature_or(tun->dev->wanted_features, tun->dev->wanted_features, features); netdev_update_features(tun->dev);
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c index 1363f64..3aaa319 100644 --- a/drivers/net/usb/aqc111.c +++ b/drivers/net/usb/aqc111.c @@ -571,7 +571,7 @@ static int aqc111_set_features(struct net_device *net, u16 reg16 = 0; u8 reg8 = 0;
- netdev_feature_xor(&changed, net->features, features); + netdev_feature_xor(changed, net->features, features); if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { aqc111_read_cmd(dev, AQ_ACCESS_MAC, SFR_TXCOE_CTL, 1, 1, ®8); reg8 ^= SFR_TXCOE_TCP | SFR_TXCOE_UDP; @@ -733,10 +733,10 @@ static int aqc111_bind(struct usbnet *dev, struct usb_interface *intf) if (usb_device_no_sg_constraint(dev->udev)) dev->can_dma_sg = 1;
- netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, &dev->net->hw_features); - netdev_feature_set_bits(AQ_SUPPORT_FEATURE, &dev->net->features); + netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, dev->net->hw_features); + netdev_feature_set_bits(AQ_SUPPORT_FEATURE, dev->net->features); netdev_feature_set_bits(AQ_SUPPORT_VLAN_FEATURE, - &dev->net->vlan_features); + dev->net->vlan_features);
netif_set_gso_max_size(dev->net, 65535);
@@ -1000,10 +1000,10 @@ static int aqc111_reset(struct usbnet *dev) if (usb_device_no_sg_constraint(dev->udev)) dev->can_dma_sg = 1;
- netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, &dev->net->hw_features); - netdev_feature_set_bits(AQ_SUPPORT_FEATURE, &dev->net->features); + netdev_feature_set_bits(AQ_SUPPORT_HW_FEATURE, dev->net->hw_features); + netdev_feature_set_bits(AQ_SUPPORT_FEATURE, dev->net->features); netdev_feature_set_bits(AQ_SUPPORT_VLAN_FEATURE, - &dev->net->vlan_features); + dev->net->vlan_features);
/* Power up ethernet PHY */ aqc111_data->phy_cfg = AQ_PHY_POWER_EN; diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index b11b4bb..1dc377d 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -954,7 +954,7 @@ ax88179_set_features(struct net_device *net, netdev_features_t features) struct usbnet *dev = netdev_priv(net); __DECLARE_NETDEV_FEATURE_MASK(changed);
- netdev_feature_xor(&changed, net->features, features); + netdev_feature_xor(changed, net->features, features);
if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); @@ -1380,10 +1380,10 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) dev->mii.supports_gmii = 1;
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->features); + NETIF_F_RXCSUM, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->hw_features); + NETIF_F_RXCSUM, dev->net->hw_features);
/* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | @@ -1667,10 +1667,10 @@ static int ax88179_reset(struct usbnet *dev) 1, 1, tmp);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->features); + NETIF_F_RXCSUM, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_RXCSUM, &dev->net->hw_features); + NETIF_F_RXCSUM, dev->net->hw_features);
/* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index a65be62..7fb5ccb 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -275,7 +275,7 @@ static const struct net_device_ops usbpn_ops = {
static void usbpn_setup(struct net_device *dev) { - netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); dev->netdev_ops = &usbpn_ops; dev->header_ops = &phonet_header_ops; dev->type = ARPHRD_PHONET; diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 100fe6c..3abec87 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c @@ -186,7 +186,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) /* no need to put the VLAN tci in the packet headers */ netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER, - &dev->net->features); + dev->net->features);
/* monitor VLAN additions and removals */ dev->net->netdev_ops = &cdc_mbim_netdev_ops; diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 65a9892..8582d6b 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2879,28 +2879,28 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
INIT_WORK(&pdata->set_vlan, lan78xx_deferred_vlan_write);
- netdev_feature_zero(&dev->net->features); + netdev_feature_zero(dev->net->features);
if (DEFAULT_TX_CSUM_ENABLE) netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &dev->net->features); + dev->net->features);
if (DEFAULT_RX_CSUM_ENABLE) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->net->features);
if (DEFAULT_TSO_CSUM_ENABLE) netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG, - &dev->net->features); + dev->net->features);
if (DEFAULT_VLAN_RX_OFFLOAD) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, - &dev->net->features); + dev->net->features);
if (DEFAULT_VLAN_FILTER_ENABLE) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->net->features); + dev->net->features);
- netdev_feature_copy(&dev->net->hw_features, dev->net->features); + netdev_feature_copy(dev->net->hw_features, dev->net->features);
ret = lan78xx_setup_irq_domain(dev); if (ret < 0) { @@ -3596,7 +3596,7 @@ static void lan78xx_tx_timeout(struct net_device *net, unsigned int txqueue)
static void lan78xx_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE) netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index dbd3889..79adf4e 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2096,9 +2096,9 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb, struct sk_buff *segs, *seg, *next; struct sk_buff_head seg_list;
- netdev_feature_copy(&features, tp->netdev->features); + netdev_feature_copy(features, tp->netdev->features); netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_IPV6_CSUM | - NETIF_F_TSO6, &features); + NETIF_F_TSO6, features); segs = skb_gso_segment(skb, features); if (IS_ERR(segs) || !segs) goto drop; @@ -2744,7 +2744,7 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev) }
static void rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { u32 mss = skb_shinfo(skb)->gso_size; int max_offset = mss ? GTTCPHO_MAX : TCPHO_MAX; @@ -3241,7 +3241,7 @@ static int rtl8152_set_features(struct net_device *dev, if (ret < 0) goto out;
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features);
mutex_lock(&tp->control);
@@ -9562,23 +9562,23 @@ static int rtl8152_probe(struct usb_interface *intf, NETIF_F_TSO | NETIF_F_FRAGLIST | NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX, &netdev->features); - netdev_feature_zero(&netdev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, netdev->features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | NETIF_F_FRAGLIST | NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_HW_VLAN_CTAG_TX, &netdev->hw_features); - netdev_feature_zero(&netdev->vlan_features); + NETIF_F_HW_VLAN_CTAG_TX, netdev->hw_features); + netdev_feature_zero(netdev->vlan_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | NETIF_F_IPV6_CSUM | NETIF_F_TSO6, - &netdev->vlan_features); + netdev->vlan_features);
if (tp->version == RTL_VER_01) { - netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, &netdev->features); + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, netdev->features); netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &netdev->hw_features); + netdev->hw_features); }
if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO) { diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 87ad300..cb4d880 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -1473,14 +1473,14 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
if (DEFAULT_TX_CSUM_ENABLE) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &dev->net->features); + dev->net->features);
if (DEFAULT_RX_CSUM_ENABLE) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM, - &dev->net->hw_features); + dev->net->hw_features);
ret = smsc75xx_wait_ready(dev, 0); if (ret < 0) { diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index d6c5293..a5887a1 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1081,12 +1081,12 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) */ if (DEFAULT_TX_CSUM_ENABLE) netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &dev->net->features); + dev->net->features); if (DEFAULT_RX_CSUM_ENABLE) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->net->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->net->features);
netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &dev->net->hw_features); + dev->net->hw_features); set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
smsc95xx_init_mac_address(dev); diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 6603dca..c85a49c 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1077,7 +1077,7 @@ static int veth_enable_xdp(struct net_device *dev) * is supposed to get GRO working */ netdev_feature_set_bit(NETIF_F_GRO_BIT, - &dev->features); + dev->features); netdev_features_change(dev); } } @@ -1107,7 +1107,7 @@ static void veth_disable_xdp(struct net_device *dev) */ if (!veth_gro_requested(dev) && netif_running(dev)) { netdev_feature_clear_bit(NETIF_F_GRO_BIT, - &dev->features); + dev->features); netdev_features_change(dev); } } @@ -1386,7 +1386,7 @@ static int veth_get_iflink(const struct net_device *dev) }
static void veth_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct veth_priv *priv = netdev_priv(dev); struct net_device *peer; @@ -1410,7 +1410,7 @@ static int veth_set_features(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
- netdev_feature_xor(&changed, features, dev->features); + netdev_feature_xor(changed, features, dev->features);
if (!netdev_feature_test_bit(NETIF_F_GRO_BIT, changed) || !(dev->flags & IFF_UP) || priv->_xdp_prog) @@ -1494,7 +1494,7 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
if (!old_prog) { netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &peer->hw_features); + peer->hw_features); peer->max_mtu = max_mtu; } } @@ -1506,7 +1506,7 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
if (peer) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &peer->hw_features); + peer->hw_features); peer->max_mtu = ETH_MAX_MTU; } } @@ -1571,24 +1571,24 @@ static void veth_setup(struct net_device *dev)
dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(VETH_FEATURES, &dev->features); - netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(VETH_FEATURES, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX, - &dev->vlan_features); + dev->vlan_features); dev->needs_free_netdev = true; dev->priv_destructor = veth_dev_free; dev->max_mtu = ETH_MAX_MTU;
- netdev_feature_zero(&dev->hw_features); - netdev_feature_set_bits(VETH_FEATURES, &dev->hw_features); - netdev_feature_copy(&dev->hw_enc_features, dev->hw_features); - netdev_feature_zero(&dev->mpls_features); + netdev_feature_zero(dev->hw_features); + netdev_feature_set_bits(VETH_FEATURES, dev->hw_features); + netdev_feature_copy(dev->hw_enc_features, dev->hw_features); + netdev_feature_zero(dev->mpls_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE, - &dev->mpls_features); + dev->mpls_features); }
/* @@ -1615,8 +1615,8 @@ static struct rtnl_link_ops veth_link_ops;
static void veth_disable_gro(struct net_device *dev) { - netdev_feature_clear_bit(NETIF_F_GRO_BIT, &dev->features); - netdev_feature_clear_bit(NETIF_F_GRO_BIT, &dev->wanted_features); + netdev_feature_clear_bit(NETIF_F_GRO_BIT, dev->features); + netdev_feature_clear_bit(NETIF_F_GRO_BIT, dev->wanted_features); netdev_update_features(dev); }
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 1aa408f..d43450b 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2880,7 +2880,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi) vi->cvq = vqs[total_vqs - 1]; if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &vi->dev->features); + vi->dev->features); }
for (i = 0; i < vi->max_queue_pairs; i++) { @@ -3091,8 +3091,8 @@ static int virtnet_probe(struct virtio_device *vdev) dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE | IFF_TX_SKB_NO_LINEAR; dev->netdev_ops = &virtnet_netdev; - netdev_feature_zero(&dev->features); - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->features); + netdev_feature_zero(dev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->features);
dev->ethtool_ops = &virtnet_ethtool_ops; SET_NETDEV_DEV(dev, &vdev->dev); @@ -3101,48 +3101,48 @@ static int virtnet_probe(struct virtio_device *vdev) if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { /* This opens up the world of extra features. */ netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->hw_features); + dev->hw_features); if (csum) netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG, - &dev->features); + dev->features);
if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6, - &dev->hw_features); + dev->hw_features); } /* Individual feature bits: what can host handle? */ if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4)) netdev_feature_set_bit(NETIF_F_TSO_BIT, - &dev->hw_features); + dev->hw_features); if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6)) netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &dev->hw_features); + dev->hw_features); if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) netdev_feature_set_bit(NETIF_F_TSO_ECN_BIT, - &dev->hw_features); + dev->hw_features);
- netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, dev->features);
if (gso) { __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_zero(&tmp); - netdev_feature_set_bits(NETIF_F_ALL_TSO, &tmp); - netdev_feature_and(&dev->features, dev->hw_features, + netdev_feature_zero(tmp); + netdev_feature_set_bits(NETIF_F_ALL_TSO, tmp); + netdev_feature_and(dev->features, dev->hw_features, tmp); } /* (!csum && gso) case will be fixed by register_netdev() */ } if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->features); if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) - netdev_feature_set_bit(NETIF_F_LRO_BIT, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LRO_BIT, dev->hw_features);
- netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features);
/* MTU range: 68 - 65535 */ dev->min_mtu = MIN_MTU; diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 5611a10..0bbde30 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -3172,20 +3172,20 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) { struct net_device *netdev = adapter->netdev;
- netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO, - &netdev->hw_features); + netdev->hw_features);
if (VMXNET3_VERSION_GE_4(adapter)) { - netdev_feature_zero(&netdev->hw_features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_features); + netdev->hw_features);
- netdev_feature_zero(&netdev->hw_enc_features); + netdev_feature_zero(netdev->hw_enc_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | @@ -3193,19 +3193,19 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features); }
if (dma64) netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, - &netdev->hw_features); - netdev_feature_copy(&netdev->vlan_features, netdev->hw_features); + netdev->hw_features); + netdev_feature_copy(netdev->vlan_features, netdev->hw_features); netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &netdev->vlan_features); - netdev_feature_copy(&netdev->features, netdev->hw_features); + netdev->vlan_features); + netdev_feature_copy(netdev->features, netdev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &netdev->features); + netdev->features); }
@@ -3658,8 +3658,8 @@ vmxnet3_probe_device(struct pci_dev *pdev, adapter->intr.type == VMXNET3_IT_MSIX) { adapter->rss = true; netdev_feature_set_bit(NETIF_F_RXHASH_BIT, - &netdev->hw_features); - netdev_feature_set_bit(NETIF_F_RXHASH_BIT, &netdev->features); + netdev->hw_features); + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, netdev->features); dev_dbg(&pdev->dev, "RSS is enabled.\n"); } else { adapter->rss = false; diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index f365604..185ebda 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -247,15 +247,15 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) }
void vmxnet3_fix_features(struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { /* If Rx checksum is disabled, then LRO should also be disabled */ - if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
void vmxnet3_features_check(struct sk_buff *skb, struct net_device *netdev, - netdev_features_t *features) + netdev_features_t features) { struct vmxnet3_adapter *adapter = netdev_priv(netdev);
@@ -315,7 +315,7 @@ static void vmxnet3_enable_encap_offloads(struct net_device *netdev) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features); } }
@@ -331,7 +331,7 @@ static void vmxnet3_disable_encap_offloads(struct net_device *netdev) NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM, - &netdev->hw_enc_features); + netdev->hw_enc_features); } }
@@ -344,7 +344,7 @@ int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) unsigned long flags; u8 udp_tun_enabled;
- netdev_feature_xor(&changed, netdev->features, features); + netdev_feature_xor(changed, netdev->features, features); udp_tun_enabled = netdev_feature_test_bits(tun_offload_mask, netdev->features); if (netdev_feature_test_bits(NETIF_F_RXCSUM | NETIF_F_LRO | diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index aed4e1b..a64b049 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h @@ -476,11 +476,11 @@ void vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter);
void -vmxnet3_fix_features(struct net_device *netdev, netdev_features_t *features); +vmxnet3_fix_features(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 net_device *netdev, netdev_features_t features);
int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features); diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index e5f7235..e84dc21 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3294,17 +3294,17 @@ static void vxlan_setup(struct net_device *dev) dev->needs_free_netdev = true; SET_NETDEV_DEVTYPE(dev, &vxlan_type);
- netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->features); + dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->features);
- netdev_feature_copy(&dev->vlan_features, dev->features); + netdev_feature_copy(dev->vlan_features, dev->features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->hw_features); - netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, &dev->hw_features); + dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->hw_features); + netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, dev->hw_features);
netif_keep_dst(dev); dev->priv_flags |= IFF_NO_QUEUE; diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c index 9c58f52..b689592 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -271,10 +271,10 @@ static void wg_setup(struct net_device *dev) dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP; dev->priv_flags |= IFF_NO_QUEUE; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->features); - netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->hw_features); - netdev_feature_set_bits(WG_NETDEV_FEATURES, &dev->hw_enc_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, dev->features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, dev->hw_features); + netdev_feature_set_bits(WG_NETDEV_FEATURES, dev->hw_enc_features); dev->mtu = ETH_DATA_LEN - overhead; dev->max_mtu = round_down(INT_MAX, MESSAGE_PADDING_MULTIPLE) - overhead;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 493d15f..6875cc8 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -10120,9 +10120,9 @@ int ath10k_mac_register(struct ath10k *ar) ar->hw->wiphy->sar_capa = &ath10k_sar_capa;
if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { - netdev_feature_zero(&ar->hw->netdev_features); + netdev_feature_zero(ar->hw->netdev_features); netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &ar->hw->netdev_features); + ar->hw->netdev_features); }
if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index ba892c4..9ed47b7 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6570,9 +6570,9 @@ static int __ath11k_mac_register(struct ath11k *ar) ath11k_reg_init(ar);
if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { - netdev_feature_zero(&ar->hw->netdev_features); + netdev_feature_zero(ar->hw->netdev_features); netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, - &ar->hw->netdev_features); + ar->hw->netdev_features); ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); } diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index 2b15df2..8d2d6dd 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c @@ -1133,9 +1133,9 @@ static int ath6kl_set_features(struct net_device *dev, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, - &dev->features); + dev->features); return err; } } else if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) && @@ -1145,9 +1145,9 @@ static int ath6kl_set_features(struct net_device *dev, vif->fw_vif_idx, ar->rx_meta_ver, 0, 0); if (err) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &dev->features); + dev->features); return err; } } @@ -1310,7 +1310,7 @@ void init_netdev(struct net_device *dev) if (!test_bit(ATH6KL_FW_CAPABILITY_NO_IP_CHECKSUM, ar->fw_capabilities)) netdev_feature_set_bit(NETIF_F_IP_CSUM | NETIF_F_RXCSUM, - &dev->hw_features); + dev->hw_features);
return; } diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c index b29a4d6..15df5809 100644 --- a/drivers/net/wireless/ath/wil6210/netdev.c +++ b/drivers/net/wireless/ath/wil6210/netdev.c @@ -335,13 +335,13 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name, ndev->netdev_ops = &wil_netdev_ops; wil_set_ethtoolops(ndev); ndev->ieee80211_ptr = wdev; - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6, - &ndev->hw_features); + ndev->hw_features);
- netdev_feature_or(&ndev->features, ndev->features, ndev->hw_features); + netdev_feature_or(ndev->features, ndev->features, ndev->hw_features);
SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); wdev->netdev = ndev; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index d04bff1..7a76b73 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -616,9 +616,9 @@ static int brcmf_netdev_open(struct net_device *ndev) /* Get current TOE mode from dongle */ if (brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_ol) >= 0 && (toe_ol & TOE_TX_CSUM_OL) != 0) - netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, ndev->features); else - netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, &ndev->features); + netdev_feature_clear_bit(NETIF_F_IP_CSUM_BIT, ndev->features);
if (brcmf_cfg80211_up(ndev)) { bphy_err(drvr, "failed to bring up cfg80211\n"); diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c index 81df856..421799d 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c @@ -102,9 +102,9 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, ieee80211_hw_set(hw, WANT_MONITOR_VIF);
if (priv->trans->max_skb_frags) { - netdev_feature_zero(&hw->netdev_features); + netdev_feature_zero(hw->netdev_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG, - &hw->netdev_features); + hw->netdev_features); }
hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 65d0125..62994f2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -388,9 +388,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) ieee80211_hw_set(hw, USES_RSS);
if (mvm->trans->max_skb_frags) { - netdev_feature_zero(&hw->netdev_features); + netdev_feature_zero(hw->netdev_features); netdev_feature_set_bits(NETIF_F_HIGHDMA | NETIF_F_SG, - &hw->netdev_features); + hw->netdev_features); }
hw->queues = IEEE80211_MAX_QUEUES; @@ -706,11 +706,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; }
- netdev_feature_copy(&hw->netdev_features, mvm->cfg->features); + netdev_feature_copy(hw->netdev_features, mvm->cfg->features); if (!iwl_mvm_is_csum_supported(mvm)) netdev_feature_clear_bits(IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, - &hw->netdev_features); + hw->netdev_features);
if (mvm->cfg->vht_mu_mimo_supported) wiphy_ext_feature_set(hw->wiphy, @@ -1455,7 +1455,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, goto out_unlock; }
- netdev_feature_or(&mvmvif->features, mvmvif->features, + netdev_feature_or(mvmvif->features, mvmvif->features, hw->netdev_features);
ret = iwl_mvm_mac_ctxt_add(mvm, vif); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index f2070ed..6a53e86 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -840,8 +840,8 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb, u16 snap_ip_tcp, pad; u8 tid;
- netdev_feature_zero(&netdev_flags); - netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_SG, &netdev_flags); + netdev_feature_zero(netdev_flags); + netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_SG, netdev_flags);
snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) + tcp_hdrlen(skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index e690e09..2fcd066 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -363,8 +363,8 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) hw->max_rates = 3; hw->max_report_rates = 7; hw->max_rate_tries = 11; - netdev_feature_zero(&hw->netdev_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features); + netdev_feature_zero(hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index a3ab1a5f..12b9530 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -217,8 +217,8 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; - netdev_feature_zero(&hw->netdev_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features); + netdev_feature_zero(hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 368d6cf..cf1aa49 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -51,8 +51,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) hw->queues = 4; hw->max_rx_aggregation_subframes = 64; hw->max_tx_aggregation_subframes = 128; - netdev_feature_zero(&hw->netdev_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &hw->netdev_features); + netdev_feature_zero(hw->netdev_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, hw->netdev_features);
hw->radiotap_timestamp.units_pos = IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US; diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 8acfc1f..2bfd615 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c @@ -375,7 +375,7 @@ static int xenvif_change_mtu(struct net_device *dev, int mtu) }
static void xenvif_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct xenvif *vif = netdev_priv(dev);
@@ -532,13 +532,13 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, INIT_LIST_HEAD(&vif->fe_mcast_addr);
dev->netdev_ops = &xenvif_netdev_ops; - netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_FRAGLIST, - &dev->hw_features); - netdev_feature_copy(&dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &dev->features); + dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, dev->features); dev->ethtool_ops = &xenvif_ethtool_ops;
dev->tx_queue_len = XENVIF_QUEUE_LENGTH; diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 041efc0..8d1f06c 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -702,7 +702,7 @@ static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev spin_unlock_irqrestore(&queue->tx_lock, flags); goto drop; } - netif_skb_features(skb, &features); + netif_skb_features(skb, features); if (unlikely(netif_needs_gso(skb, features))) { spin_unlock_irqrestore(&queue->tx_lock, flags); goto drop; @@ -1341,24 +1341,24 @@ static void xennet_release_rx_bufs(struct netfront_queue *queue) }
static void xennet_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct netfront_info *np = netdev_priv(dev);
- if (netdev_feature_test_bit(NETIF_F_SG_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_SG_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-sg", 0)) netdev_feature_clear_bit(NETIF_F_SG_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-ipv6-csum-offload", 0)) netdev_feature_clear_bit(NETIF_F_IPV6_CSUM_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv4", 0)) netdev_feature_clear_bit(NETIF_F_TSO_BIT, features);
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, features) && !xenbus_read_unsigned(np->xbdev->otherend, "feature-gso-tcpv6", 0)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features); } @@ -1544,20 +1544,20 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
netdev->netdev_ops = &xennet_netdev_ops;
- netdev_feature_zero(&netdev->features); + netdev_feature_zero(netdev->features); netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | - NETIF_F_GSO_ROBUST, &netdev->features); - netdev_feature_zero(&netdev->hw_features); + NETIF_F_GSO_ROBUST, netdev->features); + netdev_feature_zero(netdev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IPV6_CSUM | - NETIF_F_TSO | NETIF_F_TSO6, &netdev->features); + NETIF_F_TSO | NETIF_F_TSO6, netdev->features); /* * Assume that all hw features are available for now. This set * will be adjusted by the call to netdev_update_features() in * xennet_connect() which is the earliest point where we can * negotiate with the backend regarding supported features. */ - netdev_feature_or(&netdev->features, netdev->features, + netdev_feature_or(netdev->features, netdev->features, netdev->hw_features);
netdev->ethtool_ops = &xennet_ethtool_ops; diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index b8cf8b6..deb7100 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -6394,10 +6394,10 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
dev->ethtool_ops = &qeth_ethtool_ops; dev->priv_flags &= ~IFF_TX_SKB_SHARING; - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->hw_features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->vlan_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->hw_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->vlan_features); if (IS_IQD(card)) - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->features);
return dev; } @@ -6844,18 +6844,18 @@ void qeth_enable_hw_features(struct net_device *dev) struct qeth_card *card = dev->ml_priv; netdev_features_t features;
- netdev_feature_copy(&features, dev->features); + netdev_feature_copy(features, dev->features); /* force-off any feature that might need an IPA sequence. * netdev_update_features() will restart them. */ - netdev_feature_andnot(&dev->features, dev->features, + netdev_feature_andnot(dev->features, dev->features, dev->hw_features); /* toggle VLAN filter, so that VIDs are re-programmed: */ if (IS_LAYER2(card) && IS_VM_NIC(card)) { netdev_feature_clear_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->features); + dev->features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &dev->wanted_features); + dev->wanted_features); } netdev_update_features(dev); if (!netdev_feature_equal(features, dev->features)) @@ -6893,7 +6893,7 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) QETH_CARD_TEXT(card, 2, "setfeat"); QETH_CARD_HEX(card, 2, &features, sizeof(features));
- netdev_feature_xor(&changed, dev->features, features); + netdev_feature_xor(changed, dev->features, features); if (netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, changed)) { rc = qeth_set_ipa_csum(card, netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, @@ -6901,7 +6901,7 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV4, &card->info.has_lp2lp_cso_v4); if (rc) - netdev_feature_change_bit(NETIF_F_IP_CSUM_BIT, &changed); + netdev_feature_change_bit(NETIF_F_IP_CSUM_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, changed)) { rc = qeth_set_ipa_csum(card, @@ -6910,14 +6910,14 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV6, &card->info.has_lp2lp_cso_v6); if (rc) - netdev_feature_change_bit(NETIF_F_IPV6_CSUM_BIT, &changed); + netdev_feature_change_bit(NETIF_F_IPV6_CSUM_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) { rc = qeth_set_ipa_rx_csum(card, netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)); if (rc) - netdev_feature_change_bit(NETIF_F_RXCSUM_BIT, &changed); + netdev_feature_change_bit(NETIF_F_RXCSUM_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_TSO_BIT, changed)) { rc = qeth_set_ipa_tso(card, @@ -6925,7 +6925,7 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) features), QETH_PROT_IPV4); if (rc) - netdev_feature_change_bit(NETIF_F_TSO_BIT, &changed); + netdev_feature_change_bit(NETIF_F_TSO_BIT, changed); } if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, changed)) { rc = qeth_set_ipa_tso(card, @@ -6933,24 +6933,24 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features) features), QETH_PROT_IPV6); if (rc) - netdev_feature_change_bit(NETIF_F_TSO6_BIT, &changed); + netdev_feature_change_bit(NETIF_F_TSO6_BIT, changed); }
- netdev_feature_xor(&tmp1, dev->features, features); - netdev_feature_xor(&tmp2, dev->features, changed); + netdev_feature_xor(tmp1, dev->features, features); + netdev_feature_xor(tmp2, dev->features, changed); qeth_check_restricted_features(card, tmp1, tmp2);
/* everything changed successfully? */ - netdev_feature_xor(&tmp1, dev->features, features); + netdev_feature_xor(tmp1, dev->features, features); if (netdev_feature_equal(tmp1, changed)) return 0; /* something went wrong. save changed features and return error */ - netdev_feature_xor(&dev->features, dev->features, changed); + netdev_feature_xor(dev->features, dev->features, changed); return -EIO; } EXPORT_SYMBOL_GPL(qeth_set_features);
-void qeth_fix_features(struct net_device *dev, netdev_features_t *features) +void qeth_fix_features(struct net_device *dev, netdev_features_t features) { struct qeth_card *card = dev->ml_priv;
@@ -6967,12 +6967,12 @@ void qeth_fix_features(struct net_device *dev, netdev_features_t *features) if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO)) netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features);
- QETH_CARD_HEX(card, 2, features, sizeof(*features)); + QETH_CARD_HEX(card, 2, features, sizeof(features)); } EXPORT_SYMBOL_GPL(qeth_fix_features);
void qeth_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct qeth_card *card = dev->ml_priv;
@@ -6981,27 +6981,27 @@ void qeth_features_check(struct sk_buff *skb, struct net_device *dev, READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) { __DECLARE_NETDEV_FEATURE_MASK(restricted);
- netdev_feature_zero(&restricted); - if (skb_is_gso(skb) && !netif_needs_gso(skb, *features)) - netdev_feature_set_bits(NETIF_F_ALL_TSO, &restricted); + netdev_feature_zero(restricted); + if (skb_is_gso(skb) && !netif_needs_gso(skb, features)) + netdev_feature_set_bits(NETIF_F_ALL_TSO, restricted);
switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): if (!card->info.has_lp2lp_cso_v4) netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &restricted); + restricted);
if (restricted && qeth_next_hop_is_local_v4(card, skb)) netdev_feature_andnot(features, features, - &restricted); + restricted); break; case htons(ETH_P_IPV6): if (!card->info.has_lp2lp_cso_v6) netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &restricted); + restricted);
if (restricted && qeth_next_hop_is_local_v6(card, skb)) - netdev_feature_andnot(features, *features, + netdev_feature_andnot(features, features, restricted); break; default: diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index ecb9b1e..c919dc1 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -1080,49 +1080,49 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
if (IS_OSM(card)) { netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, - &card->dev->features); + card->dev->features); } else { if (!IS_VM_NIC(card)) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &card->dev->features); + card->dev->features); }
if (IS_OSD(card) && !IS_VM_NIC(card)) { - netdev_feature_set_bit(NETIF_F_SG_BIT, &card->dev->features); + netdev_feature_set_bit(NETIF_F_SG_BIT, card->dev->features); /* OSA 3S and earlier has no RX/TX support */ if (qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) { netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_IP_CSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } } if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM) || qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) { netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported(card, IPA_OUTBOUND_TSO)) { netdev_feature_set_bit(NETIF_F_TSO_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_TSO_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); }
if (netdev_feature_test_bits(NETIF_F_TSO | NETIF_F_TSO6, diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 71feb90..ba27df3 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -1880,26 +1880,26 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
if (!IS_VM_NIC(card)) { netdev_feature_set_bit(NETIF_F_SG_BIT, - &card->dev->features); + card->dev->features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bits(NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_IP_CSUM, - &card->dev->vlan_features); + card->dev->vlan_features); }
if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_IPV6_CSUM_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); } if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->hw_features); + card->dev->hw_features); netdev_feature_set_bit(NETIF_F_TSO6_BIT, - &card->dev->vlan_features); + card->dev->vlan_features); }
/* allow for de-acceleration of NETIF_F_HW_VLAN_CTAG_TX: */ @@ -1924,7 +1924,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
card->dev->needed_headroom = headroom; netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_CTAG_RX, &card->dev->features); + NETIF_F_HW_VLAN_CTAG_RX, card->dev->features);
netif_keep_dst(card->dev); if (netdev_feature_test_bit(NETIF_F_TSO | NETIF_F_TSO6, diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index f5205f6..4aec8ff 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -2259,7 +2259,7 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev, }
/* update the features with resent change */ - netdev_feature_copy(&ndev->features, features); + netdev_feature_copy(ndev->features, features);
if (need_restart) { status = qlge_adapter_up(qdev); @@ -2279,7 +2279,7 @@ static int qlge_set_features(struct net_device *ndev, __DECLARE_NETDEV_FEATURE_MASK(changed); int err;
- netdev_feature_xor(&changed, ndev->features, features); + netdev_feature_xor(changed, ndev->features, features);
if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, changed)) { /* Update the behavior of vlan accel in the adapter */ @@ -4577,7 +4577,7 @@ static int qlge_probe(struct pci_dev *pdev, goto netdev_free;
SET_NETDEV_DEV(ndev, &pdev->dev); - netdev_feature_zero(&ndev->hw_features); + netdev_feature_zero(ndev->hw_features); netdev_feature_set_bits(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | @@ -4586,17 +4586,17 @@ static int qlge_probe(struct pci_dev *pdev, NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM, - &ndev->hw_features); - netdev_feature_copy(&ndev->features, ndev->hw_features); - netdev_feature_copy(&ndev->vlan_features, ndev->hw_features); + ndev->hw_features); + netdev_feature_copy(ndev->features, ndev->hw_features); + netdev_feature_copy(ndev->vlan_features, ndev->hw_features); /* vlan gets same features (except vlan filter) */ netdev_feature_clear_bits(NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX, - &ndev->vlan_features); + ndev->vlan_features);
if (test_bit(QL_DMA64, &qdev->flags)) - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &ndev->features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, ndev->features);
/* * Set up net_device structure. diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 9696e7a..d08b831 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -731,7 +731,7 @@ static inline bool skb_vlan_tagged_multi(struct sk_buff *skb) * Returns features without unsafe ones if the skb has multiple tags. */ static inline void vlan_features_check(struct sk_buff *skb, - netdev_features_t *features) + netdev_features_t features) { if (skb_vlan_tagged_multi(skb)) { /* In the case of multi-tagged packets, use a direct mask diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 0bd12e9..6881902 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -9,7 +9,7 @@ #include <linux/bitops.h> #include <asm/byteorder.h>
-typedef u64 netdev_features_t; +typedef unsigned long * netdev_features_t;
enum { NETIF_F_SG_BIT, /* Scatter/gather IO. */ @@ -101,11 +101,12 @@ enum { /**/NETDEV_FEATURE_COUNT };
+/* declare a netdev feature bitmap */ #define __DECLARE_NETDEV_FEATURE_MASK(name) \ - netdev_features_t name + DECLARE_BITMAP(name, NETDEV_FEATURE_COUNT)
/* copy'n'paste compression ;) */ -#define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit)) +#define __NETIF_F_BIT(bit) ((u64)1 << (bit)) #define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT)
#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC) @@ -172,37 +173,17 @@ enum { #define NETIF_F_HW_HSR_FWD __NETIF_F(HW_HSR_FWD) #define NETIF_F_HW_HSR_DUP __NETIF_F(HW_HSR_DUP)
-/* Finds the next feature with the highest number of the range of start till 0. - */ -static inline int find_next_netdev_feature(u64 feature, unsigned long start) -{ - /* like BITMAP_LAST_WORD_MASK() for u64 - * this sets the most significant 64 - start to 0. - */ - feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1)); - - return fls64(feature) - 1; -} - /* This goes for the MSB to the LSB through the set feature bits, * mask_addr should be a u64 and bit an int */ #define for_each_netdev_feature(mask_addr, bit) \ - for ((bit) = find_next_netdev_feature((mask_addr), \ - NETDEV_FEATURE_COUNT); \ - (bit) >= 0; \ - (bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) + for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
/* Features valid for ethtool to change */ /* = all defined minus driver/device-class-related */ #define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \ NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
-/* remember that ((t)1 << t_BITS) is undefined in C99 */ -#define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \ - (__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \ - ~NETIF_F_NEVER_CHANGE) - /* Segmentation offload feature mask */ #define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \ __NETIF_F_BIT(NETIF_F_GSO_SHIFT)) @@ -264,73 +245,72 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) NETIF_F_GSO_UDP_TUNNEL | \ NETIF_F_GSO_UDP_TUNNEL_CSUM)
-static inline void netdev_feature_zero(netdev_features_t *dst) +static inline void netdev_feature_zero(unsigned long *dst) { - *dst = 0; + bitmap_zero(dst, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_fill(netdev_features_t *dst) +static inline void netdev_feature_fill(unsigned long *dst) { - *dst = ~0; + bitmap_fill(dst, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_copy(netdev_features_t *dst, - const netdev_features_t src) +static inline void netdev_feature_copy(unsigned long *dst, + const unsigned long *src) { - *dst = src; + bitmap_copy(dst, src, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_and(netdev_features_t *dst, - const netdev_features_t a, - const netdev_features_t b) +static inline void netdev_feature_and(unsigned long *dst, + const unsigned long *a, + const unsigned long *b) { - *dst = a & b; + bitmap_and(dst, a, b, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_or(netdev_features_t *dst, - const netdev_features_t a, - const netdev_features_t b) +static inline void netdev_feature_or(unsigned long *dst, + const unsigned long *a, + const unsigned long *b) { - *dst = a | b; + bitmap_or(dst, a, b, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_xor(netdev_features_t *dst, - const netdev_features_t a, - const netdev_features_t b) +static inline void netdev_feature_xor(unsigned long *dst, + const unsigned long *a, + const unsigned long *b) { - *dst = a ^ b; + bitmap_xor(dst, a, b, NETDEV_FEATURE_COUNT); }
-static inline bool netdev_feature_empty(netdev_features_t src) +static inline bool netdev_feature_empty(const unsigned long *src) { - return src == 0; + return bitmap_empty(src, NETDEV_FEATURE_COUNT); }
-static inline bool netdev_feature_equal(const netdev_features_t src1, - const netdev_features_t src2) +static inline bool netdev_feature_equal(const unsigned long *src1, + const unsigned long *src2) { - return src1 == src2; + return bitmap_equal(src1, src2, NETDEV_FEATURE_COUNT); }
-static inline int netdev_feature_andnot(netdev_features_t *dst, - const netdev_features_t src1, - const netdev_features_t src2) +static inline int netdev_feature_andnot(netdev_features_t dst, + const unsigned long *src1, + const unsigned long *src2) { - *dst = src1 & ~src2; - return 0; + return bitmap_andnot(dst, src1, src2, NETDEV_FEATURE_COUNT); }
-static inline void netdev_feature_set_bit(int nr, netdev_features_t *addr) +static inline void netdev_feature_set_bit(int nr, unsigned long *addr) { - *addr |= __NETIF_F_BIT(nr); + __set_bit(nr, addr); }
-static inline void netdev_feature_clear_bit(int nr, netdev_features_t *addr) +static inline void netdev_feature_clear_bit(int nr, unsigned long *addr) { - *addr &= ~(__NETIF_F_BIT(nr)); + __clear_bit(nr, addr); }
-static inline void netdev_feature_mod_bit(int nr, netdev_features_t *addr, +static inline void netdev_feature_mod_bit(int nr, unsigned long *addr, int set) { if (set) @@ -339,19 +319,19 @@ static inline void netdev_feature_mod_bit(int nr, netdev_features_t *addr, netdev_feature_clear_bit(nr, addr); }
-static inline void netdev_feature_change_bit(int nr, netdev_features_t *addr) +static inline void netdev_feature_change_bit(int nr, unsigned long *addr) { - *addr ^= __NETIF_F_BIT(nr); + __change_bit(nr, addr); }
-static inline int netdev_feature_test_bit(int nr, const netdev_features_t addr) +static inline int netdev_feature_test_bit(int nr, const unsigned long *addr) { - return (addr & __NETIF_F_BIT(nr)) > 0; + return test_bit(nr, addr); }
static inline void netdev_feature_set_bit_array(const int *array, int array_size, - netdev_features_t *addr) + unsigned long *addr) { int i;
@@ -360,41 +340,58 @@ static inline void netdev_feature_set_bit_array(const int *array, }
/* only be used for the first 64 bits features */ -static inline void netdev_feature_set_bits(u64 bits, netdev_features_t *addr) +static inline void netdev_feature_set_bits(u64 bits, unsigned long *addr) { - *addr |= bits; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_or(addr, addr, tmp); }
/* only be used for the first 64 bits features */ -static inline void netdev_feature_clear_bits(u64 bits, netdev_features_t *addr) +static inline void netdev_feature_clear_bits(u64 bits, unsigned long *addr) { - *addr &= ~bits; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_andnot(addr, addr, tmp); }
/* only be used for the first 64 bits features */ static inline bool netdev_feature_test_bits(u64 bits, - const netdev_features_t addr) + const unsigned long *addr) { - return (addr & bits) > 0; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_and(tmp, tmp, addr); + return netdev_feature_empty(tmp); }
/* only be used for the first 64 bits features */ static inline void netdev_feature_and_bits(u64 bits, - netdev_features_t *addr) + unsigned long *addr) { - *addr &= bits; + __DECLARE_NETDEV_FEATURE_MASK(tmp); + + netdev_feature_zero(tmp); + bitmap_from_u64(tmp, bits); + netdev_feature_and(addr, tmp, addr); }
static inline int netdev_feature_intersects(const netdev_features_t src1, const netdev_features_t src2) { - return (src1 & src2) > 0; + return bitmap_intersects(src1, src2, NETDEV_FEATURE_COUNT); }
-static inline int netdev_feature_subset(const netdev_features_t src1, - const netdev_features_t src2) +static inline int netdev_feature_subset(const unsigned long *src1, + const unsigned long *src2) { - return (src1 & src2) == src2; + return bitmap_subset(src1, src2, NETDEV_FEATURE_COUNT); }
#endif /* _LINUX_NETDEV_FEATURES_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b920249..30f4942 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1349,7 +1349,7 @@ struct net_device_ops { struct net_device *dev); 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); @@ -1477,7 +1477,7 @@ struct net_device_ops { struct net_device* (*ndo_sk_get_lower_dev)(struct net_device *dev, struct sock *sk); void (*ndo_fix_features)(struct net_device *dev, - netdev_features_t *features); + netdev_features_t features); int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); int (*ndo_neigh_construct)(struct net_device *dev, @@ -4994,7 +4994,7 @@ const char *netdev_drivername(const struct net_device *dev);
void linkwatch_run_queue(void);
-static inline void netdev_intersect_features(netdev_features_t *ret, +static inline void netdev_intersect_features(netdev_features_t ret, netdev_features_t f1, netdev_features_t f2) { @@ -5002,37 +5002,37 @@ static inline void netdev_intersect_features(netdev_features_t *ret, netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, f2)) { if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, f1)) netdev_feature_set_bits(NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &f1); + NETIF_F_IPV6_CSUM, f1); else netdev_feature_set_bits(NETIF_F_IP_CSUM | - NETIF_F_IPV6_CSUM, &f2); + NETIF_F_IPV6_CSUM, f2); }
netdev_feature_and(ret, f1, f2); }
static inline void netdev_get_wanted_features(struct net_device *dev, - netdev_features_t *wanted) + netdev_features_t wanted) { netdev_feature_andnot(wanted, dev->features, dev->hw_features); - netdev_feature_or(wanted, *wanted, dev->wanted_features); + netdev_feature_or(wanted, wanted, dev->wanted_features); }
-void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, +void netdev_increment_features(netdev_features_t ret, netdev_features_t all, netdev_features_t one, netdev_features_t mask);
/* Allow TSO being used on stacked device : * Performing the GSO segmentation before last device * is a performance improvement. */ -static inline void netdev_add_tso_features(netdev_features_t *features, +static inline void netdev_add_tso_features(netdev_features_t features, netdev_features_t mask) { __DECLARE_NETDEV_FEATURE_MASK(one);
- netdev_feature_zero(&one); - netdev_feature_set_bits(NETIF_F_ALL_TSO, &one); - netdev_increment_features(features, *features, one, mask); + netdev_feature_zero(one); + netdev_feature_set_bits(NETIF_F_ALL_TSO, one); + netdev_increment_features(features, features, one, mask); }
int __netdev_update_features(struct net_device *dev); @@ -5043,10 +5043,10 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev);
void passthru_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features); -void netif_skb_features(struct sk_buff *skb, netdev_features_t *features); + netdev_features_t features); +void netif_skb_features(struct sk_buff *skb, netdev_features_t features);
-static inline bool net_gso_ok(netdev_features_t features, int gso_type) +static inline bool net_gso_ok(const unsigned long *features, int gso_type) { __DECLARE_NETDEV_FEATURE_MASK(feature);
@@ -5071,8 +5071,8 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type) BUILD_BUG_ON(SKB_GSO_UDP_L4 != (NETIF_F_GSO_UDP_L4 >> NETIF_F_GSO_SHIFT)); BUILD_BUG_ON(SKB_GSO_FRAGLIST != (NETIF_F_GSO_FRAGLIST >> NETIF_F_GSO_SHIFT));
- netdev_feature_zero(&feature); - netdev_feature_set_bit((u64)gso_type << NETIF_F_GSO_SHIFT, &feature); + netdev_feature_zero(feature); + netdev_feature_set_bit((u64)gso_type << NETIF_F_GSO_SHIFT, feature);
return netdev_feature_subset(features, feature);
diff --git a/include/net/sock.h b/include/net/sock.h index 9d0d8e8..64d1ade 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2061,16 +2061,16 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) { - netdev_feature_or(&sk->sk_route_nocaps, sk->sk_route_nocaps, flags); - netdev_feature_andnot(&sk->sk_route_caps, sk->sk_route_caps, flags); + netdev_feature_or(sk->sk_route_nocaps, sk->sk_route_nocaps, flags); + netdev_feature_andnot(sk->sk_route_caps, sk->sk_route_caps, flags); }
static inline void sk_nocaps_add_gso(struct sock *sk) { __DECLARE_NETDEV_FEATURE_MASK(gso_flags);
- netdev_feature_zero(&gso_flags); - netdev_feature_set_bits(NETIF_F_GSO_MASK, &gso_flags); + netdev_feature_zero(gso_flags); + netdev_feature_set_bits(NETIF_F_GSO_MASK, gso_flags); sk_nocaps_add(sk, gso_flags); }
diff --git a/include/net/udp.h b/include/net/udp.h index 42681e7..d09c555 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -484,15 +484,15 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk, __DECLARE_NETDEV_FEATURE_MASK(features); struct sk_buff *segs;
- netdev_feature_zero(&features); - netdev_feature_set_bit(NETIF_F_SG_BIT, &features); + netdev_feature_zero(features); + netdev_feature_set_bit(NETIF_F_SG_BIT, features);
/* Avoid csum recalculation by skb_segment unless userspace explicitly * asks for the final checksum values */ if (!inet_get_convert_csum(sk)) netdev_feature_set_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - &features); + features);
/* UDP segmentation expects packets of type CHECKSUM_PARTIAL or * CHECKSUM_NONE in __udp_gso_segment. UDP GRO indeed builds partial diff --git a/include/net/vxlan.h b/include/net/vxlan.h index dba14ed..2e30dea 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -297,7 +297,7 @@ struct net_device *vxlan_dev_create(struct net *net, const char *name, u8 name_assign_type, struct vxlan_config *conf);
static inline void vxlan_features_check(struct sk_buff *skb, - netdev_features_t *features) + netdev_features_t features) { u8 l4_hdr = 0;
@@ -321,7 +321,7 @@ static inline void vxlan_features_check(struct sk_buff *skb, (skb_inner_mac_header(skb) - skb_transport_header(skb) != sizeof(struct udphdr) + sizeof(struct vxlanhdr)) || (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(*features, inner_eth_hdr(skb)->h_proto)))) + !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto)))) netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, features); } diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 8a50def..d230e08 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -340,7 +340,7 @@ static void vlan_transfer_features(struct net_device *dev,
vlandev->priv_flags &= ~IFF_XMIT_DST_RELEASE; vlandev->priv_flags |= (vlan->real_dev->priv_flags & IFF_XMIT_DST_RELEASE); - vlan_tnl_features(vlan->real_dev, &vlandev->hw_enc_features); + vlan_tnl_features(vlan->real_dev, vlandev->hw_enc_features);
netdev_update_features(vlandev); } diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 10b792e..626255a 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -104,15 +104,15 @@ static inline struct net_device *vlan_find_dev(struct net_device *real_dev, }
static inline void vlan_tnl_features(struct net_device *real_dev, - netdev_features_t *tnl) + netdev_features_t tnl) { netdev_feature_zero(tnl); netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL, tnl); - netdev_feature_and(tnl, *tnl, real_dev->hw_enc_features); + netdev_feature_and(tnl, tnl, real_dev->hw_enc_features);
- if (netdev_feature_test_bits(NETIF_F_GSO_ENCAP_ALL, *tnl) && - netdev_feature_test_bits(NETIF_F_CSUM_MASK, *tnl)) { + if (netdev_feature_test_bits(NETIF_F_GSO_ENCAP_ALL, tnl) && + netdev_feature_test_bits(NETIF_F_CSUM_MASK, tnl)) { netdev_feature_clear_bits(NETIF_F_CSUM_MASK, tnl); netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, tnl); } diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 4062917..008c9fc 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -566,24 +566,24 @@ static int vlan_dev_init(struct net_device *dev) if (vlan->flags & VLAN_FLAG_BRIDGE_BINDING) dev->state |= (1 << __LINK_STATE_NOCARRIER);
- netdev_feature_zero(&dev->hw_features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL | NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC | - NETIF_F_ALL_FCOE, &dev->hw_features); + NETIF_F_ALL_FCOE, dev->hw_features);
- netdev_feature_or(&dev->features, dev->features, dev->hw_features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_or(dev->features, dev->features, dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); dev->gso_max_size = real_dev->gso_max_size; dev->gso_max_segs = real_dev->gso_max_segs; if (netdev_feature_test_bits(NETIF_F_VLAN_FEATURES, dev->features)) netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n");
- netdev_feature_copy(&dev->vlan_features, real_dev->vlan_features); - netdev_feature_clear_bits(NETIF_F_ALL_FCOE, &dev->vlan_features); - vlan_tnl_features(real_dev, &dev->hw_enc_features); - netdev_feature_copy(&dev->mpls_features, real_dev->mpls_features); + netdev_feature_copy(dev->vlan_features, real_dev->vlan_features); + netdev_feature_clear_bits(NETIF_F_ALL_FCOE, dev->vlan_features); + vlan_tnl_features(real_dev, dev->hw_enc_features); + netdev_feature_copy(dev->mpls_features, real_dev->mpls_features);
/* ipv6 shared card related stuff */ dev->dev_id = real_dev->dev_id; @@ -637,29 +637,29 @@ void vlan_dev_uninit(struct net_device *dev) }
static void vlan_dev_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; __DECLARE_NETDEV_FEATURE_MASK(lower_features); __DECLARE_NETDEV_FEATURE_MASK(old_features); __DECLARE_NETDEV_FEATURE_MASK(tmp);
- netdev_feature_copy(&tmp, real_dev->vlan_features); - netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, &tmp); - netdev_feature_copy(&old_features, *features); - netdev_intersect_features(&lower_features, tmp, real_dev->features); + netdev_feature_copy(tmp, real_dev->vlan_features); + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, tmp); + netdev_feature_copy(old_features, features); + netdev_intersect_features(lower_features, tmp, real_dev->features);
/* Add HW_CSUM setting to preserve user ability to control * checksum offload on the vlan device. */ if (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, lower_features)) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &lower_features); - netdev_intersect_features(features, *features, lower_features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, lower_features); + netdev_intersect_features(features, features, lower_features);
netdev_feature_and_bits(NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE, - &old_features); - netdev_feature_or(features, *features, old_features); + old_features); + netdev_feature_or(features, features, old_features); netdev_feature_set_bit(NETIF_F_LLTX_BIT, features); }
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index c9894b9..bb6984a 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -288,7 +288,7 @@ static int br_get_link_ksettings(struct net_device *dev, return 0; }
-static void br_fix_features(struct net_device *dev, netdev_features_t *features) +static void br_fix_features(struct net_device *dev, netdev_features_t features) { struct net_bridge *br = netdev_priv(dev);
@@ -490,17 +490,17 @@ void br_dev_setup(struct net_device *dev) SET_NETDEV_DEVTYPE(dev, &br_type); dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
- netdev_feature_zero(&dev->features); + netdev_feature_zero(dev->features); netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX, - &dev->features); - netdev_feature_zero(&dev->hw_features); + dev->features); + netdev_feature_zero(dev->hw_features); netdev_feature_set_bits(COMMON_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX, &dev->hw_features); - netdev_feature_zero(&dev->vlan_features); - netdev_feature_set_bits(COMMON_FEATURES, &dev->vlan_features); + NETIF_F_HW_VLAN_STAG_TX, dev->hw_features); + netdev_feature_zero(dev->vlan_features); + netdev_feature_set_bits(COMMON_FEATURES, dev->vlan_features);
br->dev = dev; spin_lock_init(&br->lock); diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 5cf6837..8bd2768 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -532,7 +532,7 @@ static void br_set_gso_limits(struct net_bridge *br) /* * Recomputes features using slave's features */ -void br_features_recompute(struct net_bridge *br, netdev_features_t *features) +void br_features_recompute(struct net_bridge *br, netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(mask); struct net_bridge_port *p; @@ -540,11 +540,11 @@ void br_features_recompute(struct net_bridge *br, netdev_features_t *features) if (list_empty(&br->port_list)) return;
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(mask, features); netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features);
list_for_each_entry(p, &br->port_list, list) { - netdev_increment_features(features, *features, p->dev->features, + netdev_increment_features(features, features, p->dev->features, mask); } netdev_add_tso_features(features, mask); diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 241361c..63a00ee 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -809,7 +809,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, struct netlink_ext_ack *extack); int br_del_if(struct net_bridge *br, struct net_device *dev); void br_mtu_auto_adjust(struct net_bridge *br); -void br_features_recompute(struct net_bridge *br, netdev_features_t *features); +void br_features_recompute(struct net_bridge *br, netdev_features_t features); void br_port_flags_change(struct net_bridge_port *port, unsigned long mask); void br_manage_promisc(struct net_bridge *br); int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev); diff --git a/net/core/dev.c b/net/core/dev.c index fcbffe7..a72758a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1636,7 +1636,7 @@ void dev_disable_lro(struct net_device *dev) struct net_device *lower_dev; struct list_head *iter;
- netdev_feature_clear_bit(NETIF_F_LRO_BIT, &dev->wanted_features); + netdev_feature_clear_bit(NETIF_F_LRO_BIT, dev->wanted_features); netdev_update_features(dev);
if (unlikely(netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features))) @@ -1657,7 +1657,7 @@ EXPORT_SYMBOL(dev_disable_lro); */ static void dev_disable_gro_hw(struct net_device *dev) { - netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, &dev->wanted_features); + netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, dev->wanted_features); netdev_update_features(dev);
if (unlikely(netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, @@ -3383,15 +3383,15 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, __DECLARE_NETDEV_FEATURE_MASK(partial_features); struct net_device *dev = skb->dev;
- netdev_feature_and(&partial_features, dev->features, + netdev_feature_and(partial_features, dev->features, dev->gso_partial_features); netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, - &partial_features); - netdev_feature_or(&partial_features, partial_features, + partial_features); + netdev_feature_or(partial_features, partial_features, features); if (!skb_gso_ok(skb, partial_features)) netdev_feature_clear_bit(NETIF_F_GSO_PARTIAL_BIT, - &features); + features); }
BUILD_BUG_ON(SKB_GSO_CB_OFFSET + @@ -3450,21 +3450,21 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb) * instead of standard features for the netdev. */ #if IS_ENABLED(CONFIG_NET_MPLS_GSO) -static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, +static void net_mpls_features(struct sk_buff *skb, netdev_features_t features, __be16 type) { if (eth_p_mpls(type)) - netdev_feature_and(features, *features, + netdev_feature_and(features, features, skb->dev->mpls_features); } #else -static void net_mpls_features(struct sk_buff *skb, netdev_features_t *features, +static void net_mpls_features(struct sk_buff *skb, netdev_features_t features, __be16 type) { } #endif
-static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) +static void harmonize_features(struct sk_buff *skb, netdev_features_t features) { __be16 type;
@@ -3472,7 +3472,7 @@ static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) net_mpls_features(skb, features, type);
if (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(*features, type)) { + !can_checksum_protocol(features, type)) { netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK, features); } @@ -3481,21 +3481,21 @@ static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) }
void passthru_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { } EXPORT_SYMBOL(passthru_features_check);
static void dflt_features_check(struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { vlan_features_check(skb, features); }
static void gso_features_check(const struct sk_buff *skb, struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { u16 gso_segs = skb_shinfo(skb)->gso_segs;
@@ -3517,7 +3517,7 @@ static void gso_features_check(const struct sk_buff *skb, * segmented the frame. */ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL)) - netdev_feature_andnot(features, *features, + netdev_feature_andnot(features, features, dev->gso_partial_features);
/* Make sure to clear the IPv4 ID mangling feature if the @@ -3533,7 +3533,7 @@ static void gso_features_check(const struct sk_buff *skb, } }
-void netif_skb_features(struct sk_buff *skb, netdev_features_t *features) +void netif_skb_features(struct sk_buff *skb, netdev_features_t features) { struct net_device *dev = skb->dev;
@@ -3547,15 +3547,15 @@ void netif_skb_features(struct sk_buff *skb, netdev_features_t *features) * features for the netdev */ if (skb->encapsulation) - netdev_feature_and(features, *features, dev->hw_enc_features); + netdev_feature_and(features, features, dev->hw_enc_features);
if (skb_vlan_tagged(skb)) { netdev_features_t tmp;
- netdev_feature_copy(&tmp, dev->vlan_features); + netdev_feature_copy(tmp, dev->vlan_features); netdev_feature_set_bits(NETIF_F_HW_VLAN_CTAG_TX_BIT | - NETIF_F_HW_VLAN_STAG_TX_BIT, &tmp); - netdev_intersect_features(features, *features, tmp); + NETIF_F_HW_VLAN_STAG_TX_BIT, tmp); + netdev_intersect_features(features, features, tmp); }
if (dev->netdev_ops->ndo_features_check) @@ -3649,7 +3649,7 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device { __DECLARE_NETDEV_FEATURE_MASK(features);
- netif_skb_features(skb, &features); + netif_skb_features(skb, features); skb = validate_xmit_vlan(skb, features); if (unlikely(!skb)) goto out_null; @@ -9789,18 +9789,18 @@ static void net_set_todo(struct net_device *dev)
static void netdev_sync_upper_features(struct net_device *lower, struct net_device *upper, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(upper_disables); int feature_bit;
- netdev_feature_zero(&upper_disables); - netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, &upper_disables); + netdev_feature_zero(upper_disables); + netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, upper_disables);
for_each_netdev_feature(upper_disables, feature_bit) { if (!netdev_feature_test_bit(feature_bit, upper->wanted_features) && - netdev_feature_test_bit(feature_bit, *features)) { + netdev_feature_test_bit(feature_bit, features)) { netdev_dbg(lower, "Dropping feature bit %d, upper dev %s has it off.\n", feature_bit, upper->name); netdev_feature_clear_bit(feature_bit, features); @@ -9814,8 +9814,8 @@ static void netdev_sync_lower_features(struct net_device *upper, __DECLARE_NETDEV_FEATURE_MASK(upper_disables); int feature_bit;
- netdev_feature_zero(&upper_disables); - netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, &upper_disables); + netdev_feature_zero(upper_disables); + netdev_feature_set_bits(NETIF_F_UPPER_DISABLES, upper_disables);
for_each_netdev_feature(upper_disables, feature_bit) { if (!netdev_feature_test_bit(feature_bit, features) && @@ -9823,7 +9823,7 @@ static void netdev_sync_lower_features(struct net_device *upper, netdev_dbg(upper, "Disabling feature bit %d on lower dev %s.\n", feature_bit, lower->name); netdev_feature_clear_bit(feature_bit, - &lower->wanted_features); + lower->wanted_features); __netdev_update_features(lower);
if (unlikely(netdev_feature_test_bit(feature_bit, @@ -9837,103 +9837,103 @@ static void netdev_sync_lower_features(struct net_device *upper, }
static void netdev_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { /* Fix illegal checksum combinations */ - if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features) && (netdev_feature_test_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, - *features))) { + features))) { netdev_warn(dev, "mixed HW and IP checksum settings.\n"); netdev_feature_clear_bits(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, features); }
/* TSO requires that SG is present as well. */ - if (netdev_feature_test_bits(NETIF_F_ALL_TSO, *features) && - !netdev_feature_test_bit(NETIF_F_SG_BIT, *features)) { + if (netdev_feature_test_bits(NETIF_F_ALL_TSO, features) && + !netdev_feature_test_bit(NETIF_F_SG_BIT, features)) { netdev_dbg(dev, "Dropping TSO features since no SG feature.\n"); netdev_feature_clear_bits(NETIF_F_ALL_TSO, features); }
- if (netdev_feature_test_bit(NETIF_F_TSO_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_TSO_BIT, features) && + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features) && + !netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features)) { netdev_dbg(dev, "Dropping TSO features since no CSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_TSO_BIT, features); netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, features); }
- if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_TSO6_BIT, features) && + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features) && + !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features)) { netdev_dbg(dev, "Dropping TSO6 features since no CSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_TSO6_BIT, features); }
/* TSO with IPv4 ID mangling requires IPv4 TSO be enabled */ - if (netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_TSO_BIT, *features)) + if (netdev_feature_test_bit(NETIF_F_TSO_MANGLEID_BIT, features) && + !netdev_feature_test_bit(NETIF_F_TSO_BIT, features)) netdev_feature_clear_bit(NETIF_F_TSO_MANGLEID_BIT, features);
/* TSO ECN requires that TSO is present as well. */ - if (netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, *features) && + if (netdev_feature_test_bit(NETIF_F_TSO_ECN_BIT, features) && !netdev_feature_test_bits(NETIF_F_ALL_TSO & ~NETIF_F_TSO_ECN, - *features)) + features)) netdev_feature_clear_bit(NETIF_F_TSO_ECN_BIT, features);
/* Software GSO depends on SG. */ - if (netdev_feature_test_bit(NETIF_F_GSO_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_SG_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_GSO_BIT, features) && + !netdev_feature_test_bit(NETIF_F_SG_BIT, features)) { netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n"); netdev_feature_clear_bit(NETIF_F_GSO_BIT, features); }
/* GSO partial features require GSO partial be set */ - if (netdev_feature_intersects(*features, dev->gso_partial_features) && - !netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, *features)) { + if (netdev_feature_intersects(features, dev->gso_partial_features) && + !netdev_feature_test_bit(NETIF_F_GSO_PARTIAL_BIT, features)) { netdev_dbg(dev, "Dropping partially supported GSO features since no GSO partial.\n"); - netdev_feature_andnot(features, *features, + netdev_feature_andnot(features, features, dev->gso_partial_features); }
- if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { /* NETIF_F_GRO_HW implies doing RXCSUM since every packet * successfully merged by hardware must also have the * checksum verified by hardware. If the user does not * want to enable RXCSUM, logically, we should disable GRO_HW. */ - if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) { netdev_dbg(dev, "Dropping NETIF_F_GRO_HW since no RXCSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); } }
/* LRO/HW-GRO features cannot be combined with RX-FCS */ - if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, *features)) { - if (netdev_feature_test_bit(NETIF_F_LRO_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_RXFCS_BIT, features)) { + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, features)) { netdev_dbg(dev, "Dropping LRO feature since RX-FCS is requested.\n"); netdev_feature_clear_bit(NETIF_F_LRO_BIT, features); }
- if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_GRO_HW_BIT, features)) { netdev_dbg(dev, "Dropping HW-GRO feature since RX-FCS is requested.\n"); netdev_feature_clear_bit(NETIF_F_GRO_HW_BIT, features); } }
- if (netdev_feature_test_bit(NETIF_F_HW_TLS_TX_BIT, *features)) { - if (!netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, *features) || - !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, *features) || - !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_HW_TLS_TX_BIT, features)) { + if (!netdev_feature_test_bit(NETIF_F_IP_CSUM_BIT, features) || + !netdev_feature_test_bit(NETIF_F_IPV6_CSUM_BIT, features) || + !netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, features)) { netdev_dbg(dev, "Dropping TLS TX HW offload feature since no CSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_HW_TLS_TX_BIT, features); } }
- if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, *features) && - !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, *features)) { + if (netdev_feature_test_bit(NETIF_F_HW_TLS_RX_BIT, features) && + !netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features)) { netdev_dbg(dev, "Dropping TLS RX HW offload feature since no RXCSUM feature.\n"); netdev_feature_clear_bit(NETIF_F_HW_TLS_RX_BIT, features); } @@ -9948,23 +9948,24 @@ int __netdev_update_features(struct net_device *dev)
ASSERT_RTNL();
- netdev_get_wanted_features(dev, &features); + netdev_get_wanted_features(dev, features);
if (dev->netdev_ops->ndo_fix_features) - dev->netdev_ops->ndo_fix_features(dev, &features); + dev->netdev_ops->ndo_fix_features(dev, features);
/* driver might be less strict about feature dependencies */ - netdev_fix_features(dev, &features); + netdev_fix_features(dev, features);
/* some features can't be enabled if they're off on an upper device */ netdev_for_each_upper_dev_rcu(dev, upper, iter) - netdev_sync_upper_features(dev, upper, &features); + netdev_sync_upper_features(dev, upper, features);
if (netdev_feature_equal(dev->features, features)) goto sync_lower;
- netdev_dbg(dev, "Features changed: %pNF -> %pNF\n", - &dev->features, &features); + netdev_dbg(dev, "Features changed: %*pb -> %*pb\n", + NETDEV_FEATURE_COUNT, dev->features, + NETDEV_FEATURE_COUNT, features);
if (dev->netdev_ops->ndo_set_features) err = dev->netdev_ops->ndo_set_features(dev, features); @@ -9973,8 +9974,9 @@ int __netdev_update_features(struct net_device *dev)
if (unlikely(err < 0)) { netdev_err(dev, - "set_features() failed (%d); wanted %pNF, left %pNF\n", - err, &features, &dev->features); + "set_features() failed (%d); wanted %*pb, left %*pb\n", + err, NETDEV_FEATURE_COUNT, features, + NETDEV_FEATURE_COUNT, dev->features); /* return non-0 since some features might have changed and * it's better to fire a spurious notification than miss it */ @@ -9991,7 +9993,7 @@ int __netdev_update_features(struct net_device *dev) if (!err) { __DECLARE_NETDEV_FEATURE_MASK(diff);
- netdev_feature_xor(&diff, features, dev->features); + netdev_feature_xor(diff, features, dev->features);
if (netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, diff)) { /* udp_tunnel_{get,drop}_rx_info both need @@ -10003,7 +10005,7 @@ int __netdev_update_features(struct net_device *dev) */ if (netdev_feature_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, features)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); udp_tunnel_get_rx_info(dev); } else { udp_tunnel_drop_rx_info(dev); @@ -10013,7 +10015,7 @@ int __netdev_update_features(struct net_device *dev) if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, diff)) { if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); err |= vlan_get_rx_ctag_filter_info(dev); } else { vlan_drop_rx_ctag_filter_info(dev); @@ -10023,14 +10025,14 @@ int __netdev_update_features(struct net_device *dev) if (netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, diff)) { if (netdev_feature_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, features)) { - netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); err |= vlan_get_rx_stag_filter_info(dev); } else { vlan_drop_rx_stag_filter_info(dev); } }
- netdev_feature_copy(&dev->features, features); + netdev_feature_copy(dev->features, features); }
return err < 0 ? 0 : 1; @@ -10277,22 +10279,22 @@ int register_netdevice(struct net_device *dev) * software offloads (GSO and GRO). */ netdev_feature_set_bits(NETIF_F_SOFT_FEATURES | NETIF_F_SOFT_FEATURES_OFF, - &dev->hw_features); - netdev_feature_set_bits(NETIF_F_SOFT_FEATURES, &dev->features); + dev->hw_features); + netdev_feature_set_bits(NETIF_F_SOFT_FEATURES, dev->features);
if (dev->udp_tunnel_nic_info) { netdev_feature_set_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, - &dev->features); + dev->features); netdev_feature_set_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, - &dev->hw_features); + dev->hw_features); }
- netdev_feature_and(&dev->wanted_features, dev->features, + netdev_feature_and(dev->wanted_features, dev->features, dev->hw_features);
if (!(dev->flags & IFF_LOOPBACK)) netdev_feature_set_bit(NETIF_F_NOCACHE_COPY_BIT, - &dev->hw_features); + dev->hw_features);
/* If IPv4 TCP segmentation offload is supported we should also * allow the device to enable segmenting the frame with the option @@ -10301,29 +10303,29 @@ int register_netdevice(struct net_device *dev) */ if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->hw_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->hw_features); + dev->hw_features); if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->vlan_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->vlan_features); + dev->vlan_features); if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->mpls_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->mpls_features); + dev->mpls_features); if (netdev_feature_test_bit(NETIF_F_TSO_BIT, dev->hw_enc_features)) netdev_feature_set_bit(NETIF_F_TSO_MANGLEID_BIT, - &dev->hw_enc_features); + dev->hw_enc_features);
/* Make NETIF_F_HIGHDMA inheritable to VLAN devices. */ - netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, &dev->vlan_features); + netdev_feature_set_bit(NETIF_F_HIGHDMA_BIT, dev->vlan_features);
/* Make NETIF_F_SG inheritable to tunnel devices. */ netdev_feature_set_bits(NETIF_F_SG | NETIF_F_GSO_PARTIAL, - &dev->hw_enc_features); + dev->hw_enc_features);
/* Make NETIF_F_SG inheritable to MPLS. */ - netdev_feature_set_bit(NETIF_F_SG_BIT, &dev->mpls_features); + netdev_feature_set_bit(NETIF_F_SG_BIT, dev->mpls_features);
ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev); ret = notifier_to_errno(ret); @@ -11358,29 +11360,29 @@ static int dev_cpu_dead(unsigned int oldcpu) * @one to the master device with current feature set @all. Will not * enable anything that is off in @mask. Returns the new feature set. */ -void netdev_increment_features(netdev_features_t *ret, netdev_features_t all, +void netdev_increment_features(netdev_features_t ret, netdev_features_t all, netdev_features_t one, netdev_features_t mask) { __DECLARE_NETDEV_FEATURE_MASK(tmp);
if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, mask)) - netdev_feature_set_bits(NETIF_F_CSUM_MASK, &mask); - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &mask); + netdev_feature_set_bits(NETIF_F_CSUM_MASK, mask); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, mask);
netdev_feature_copy(ret, all); - netdev_feature_zero(&tmp); - netdev_feature_set_bits(NETIF_F_ONE_FOR_ALL | NETIF_F_CSUM_MASK, &tmp); - netdev_feature_and(&tmp, tmp, one); - netdev_feature_and(&tmp, tmp, mask); - netdev_feature_or(ret, *ret, tmp); + netdev_feature_zero(tmp); + netdev_feature_set_bits(NETIF_F_ONE_FOR_ALL | NETIF_F_CSUM_MASK, tmp); + netdev_feature_and(tmp, tmp, one); + netdev_feature_and(tmp, tmp, mask); + netdev_feature_or(ret, ret, tmp);
- netdev_feature_fill(&tmp); - netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, &tmp); - netdev_feature_or(&tmp, tmp, one); - netdev_feature_and(ret, *ret, tmp); + netdev_feature_fill(tmp); + netdev_feature_clear_bits(NETIF_F_ALL_FOR_ALL, tmp); + netdev_feature_or(tmp, tmp, one); + netdev_feature_and(ret, ret, tmp);
/* If one device supports hw checksumming, set for all. */ - if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, *ret)) + if (netdev_feature_test_bit(NETIF_F_HW_CSUM_BIT, ret)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK & ~NETIF_F_HW_CSUM, ret); } diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 83cfc0c..8764ec8 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -77,7 +77,7 @@ static netdev_tx_t netpoll_start_xmit(struct sk_buff *skb, __DECLARE_NETDEV_FEATURE_MASK(features); netdev_tx_t status = NETDEV_TX_OK;
- netif_skb_features(skb, &features); + netif_skb_features(skb, features);
if (skb_vlan_tag_present(skb) && !vlan_hw_offload_capable(features, skb->vlan_proto)) { diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b41bfd0..d7a4021 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3993,7 +3993,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)) - netdev_feature_clear_bit(NETIF_F_SG_BIT, &features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, features); }
__skb_push(head_skb, doffset); diff --git a/net/core/sock.c b/net/core/sock.c index 11c04a6..6ed7f25 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2146,20 +2146,20 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) u32 max_segs = 1;
sk_dst_set(sk, dst); - netdev_feature_or(&sk->sk_route_caps, dst->dev->features, + netdev_feature_or(sk->sk_route_caps, dst->dev->features, sk->sk_route_forced_caps); if (netdev_feature_test_bit(NETIF_F_GSO_BIT, sk->sk_route_caps)) netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &sk->sk_route_caps); - netdev_feature_andnot(&sk->sk_route_caps, sk->sk_route_caps, + sk->sk_route_caps); + netdev_feature_andnot(sk->sk_route_caps, sk->sk_route_caps, sk->sk_route_nocaps); if (sk_can_gso(sk)) { if (dst->header_len && !xfrm_dst_offload_ok(dst)) { netdev_feature_clear_bits(NETIF_F_GSO_MASK, - &sk->sk_route_caps); + sk->sk_route_caps); } else { netdev_feature_set_bits(NETIF_F_SG | NETIF_F_HW_CSUM, - &sk->sk_route_caps); + sk->sk_route_caps); sk->sk_gso_max_size = dst->dev->gso_max_size; max_segs = max_t(u32, dst->dev->gso_max_segs, 1); } diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 8ddfed4..c665fa4 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1815,16 +1815,16 @@ void dsa_slave_setup_tagger(struct net_device *slave)
p->xmit = cpu_dp->tag_ops->xmit;
- netdev_feature_copy(&slave->features, master->vlan_features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->features); + netdev_feature_copy(slave->features, master->vlan_features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, slave->features); if (ds->ops->port_vlan_add && ds->ops->port_vlan_del) netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, - &slave->features); - netdev_feature_set_bit(NETIF_F_HW_TC_BIT, &slave->hw_features); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &slave->features); + slave->features); + netdev_feature_set_bit(NETIF_F_HW_TC_BIT, slave->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, slave->features); if (slave->needed_tailroom) netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_FRAGLIST, - &slave->features); + slave->features); }
static struct lock_class_key dsa_slave_netdev_xmit_lock_key; @@ -1903,7 +1903,7 @@ int dsa_slave_create(struct dsa_port *port)
SET_NETDEV_DEV(slave_dev, port->ds->dev); slave_dev->dev.of_node = port->dn; - netdev_feature_copy(&slave_dev->features, master->vlan_features); + netdev_feature_copy(slave_dev->features, master->vlan_features);
p = netdev_priv(slave_dev); slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); diff --git a/net/ethtool/features.c b/net/ethtool/features.c index 93c6238..dd231c1 100644 --- a/net/ethtool/features.c +++ b/net/ethtool/features.c @@ -27,10 +27,7 @@ const struct nla_policy ethnl_features_get_policy[] = {
static void ethnl_features_to_bitmap32(u32 *dest, netdev_features_t src) { - unsigned int i; - - for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; i++) - dest[i] = src >> (32 * i); + bitmap_to_arr32(dest, src, NETDEV_FEATURE_COUNT); }
static int features_prepare_data(const struct ethnl_req_info *req_base, @@ -38,14 +35,17 @@ static int features_prepare_data(const struct ethnl_req_info *req_base, struct genl_info *info) { struct features_reply_data *data = FEATURES_REPDATA(reply_base); + __DECLARE_NETDEV_FEATURE_MASK(nochange_features); __DECLARE_NETDEV_FEATURE_MASK(all_features); struct net_device *dev = reply_base->dev;
ethnl_features_to_bitmap32(data->hw, dev->hw_features); ethnl_features_to_bitmap32(data->wanted, dev->wanted_features); ethnl_features_to_bitmap32(data->active, dev->features); - ethnl_features_to_bitmap32(data->nochange, NETIF_F_NEVER_CHANGE); - all_features = GENMASK_ULL(NETDEV_FEATURE_COUNT - 1, 0); + netdev_feature_zero(nochange_features); + netdev_feature_set_bits(NETIF_F_NEVER_CHANGE, nochange_features); + ethnl_features_to_bitmap32(data->nochange, nochange_features); + netdev_feature_fill(all_features); ethnl_features_to_bitmap32(data->all, all_features);
return 0; @@ -131,29 +131,6 @@ const struct nla_policy ethnl_features_set_policy[] = { [ETHTOOL_A_FEATURES_WANTED] = { .type = NLA_NESTED }, };
-static void ethnl_features_to_bitmap(unsigned long *dest, netdev_features_t val) -{ - const unsigned int words = BITS_TO_LONGS(NETDEV_FEATURE_COUNT); - unsigned int i; - - bitmap_zero(dest, NETDEV_FEATURE_COUNT); - for (i = 0; i < words; i++) - dest[i] = (unsigned long)(val >> (i * BITS_PER_LONG)); -} - -static netdev_features_t ethnl_bitmap_to_features(unsigned long *src) -{ - const unsigned int nft_bits = sizeof(netdev_features_t) * BITS_PER_BYTE; - const unsigned int words = BITS_TO_LONGS(NETDEV_FEATURE_COUNT); - netdev_features_t ret = 0; - unsigned int i; - - for (i = 0; i < words; i++) - ret |= (netdev_features_t)(src[i]) << (i * BITS_PER_LONG); - ret &= ~(netdev_features_t)0 >> (nft_bits - NETDEV_FEATURE_COUNT); - return ret; -} - static int features_send_reply(struct net_device *dev, struct genl_info *info, const unsigned long *wanted, const unsigned long *wanted_mask, @@ -210,14 +187,15 @@ static int features_send_reply(struct net_device *dev, struct genl_info *info,
int ethnl_set_features(struct sk_buff *skb, struct genl_info *info) { - DECLARE_BITMAP(wanted_diff_mask, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(active_diff_mask, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(old_active, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(old_wanted, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(new_active, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(new_wanted, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(req_wanted, NETDEV_FEATURE_COUNT); - DECLARE_BITMAP(req_mask, NETDEV_FEATURE_COUNT); + __DECLARE_NETDEV_FEATURE_MASK(wanted_diff_mask); + __DECLARE_NETDEV_FEATURE_MASK(active_diff_mask); + __DECLARE_NETDEV_FEATURE_MASK(old_active); + __DECLARE_NETDEV_FEATURE_MASK(old_wanted); + __DECLARE_NETDEV_FEATURE_MASK(new_active); + __DECLARE_NETDEV_FEATURE_MASK(new_wanted); + __DECLARE_NETDEV_FEATURE_MASK(req_wanted); + __DECLARE_NETDEV_FEATURE_MASK(req_mask); + __DECLARE_NETDEV_FEATURE_MASK(tmp); struct ethnl_req_info req_info = {}; struct nlattr **tb = info->attrs; struct net_device *dev; @@ -235,45 +213,43 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info) dev = req_info.dev;
rtnl_lock(); - ethnl_features_to_bitmap(old_active, dev->features); - ethnl_features_to_bitmap(old_wanted, dev->wanted_features); + netdev_feature_copy(old_active, dev->features); + netdev_feature_copy(old_wanted, dev->wanted_features); ret = ethnl_parse_bitset(req_wanted, req_mask, NETDEV_FEATURE_COUNT, tb[ETHTOOL_A_FEATURES_WANTED], netdev_features_strings, info->extack); if (ret < 0) goto out_rtnl; - if (ethnl_bitmap_to_features(req_mask) & ~NETIF_F_ETHTOOL_BITS) { + if (netdev_feature_test_bits(NETIF_F_NEVER_CHANGE, req_mask)) { GENL_SET_ERR_MSG(info, "attempt to change non-ethtool features"); ret = -EINVAL; goto out_rtnl; }
/* set req_wanted bits not in req_mask from old_wanted */ - bitmap_and(req_wanted, req_wanted, req_mask, NETDEV_FEATURE_COUNT); - bitmap_andnot(new_wanted, old_wanted, req_mask, NETDEV_FEATURE_COUNT); - bitmap_or(req_wanted, new_wanted, req_wanted, NETDEV_FEATURE_COUNT); - if (!bitmap_equal(req_wanted, old_wanted, NETDEV_FEATURE_COUNT)) { - dev->wanted_features &= ~dev->hw_features; - dev->wanted_features |= ethnl_bitmap_to_features(req_wanted) & dev->hw_features; + netdev_feature_and(req_wanted, req_wanted, req_mask); + netdev_feature_andnot(new_wanted, old_wanted, req_mask); + netdev_feature_or(req_wanted, new_wanted, req_wanted); + if (!netdev_feature_equal(req_wanted, old_wanted)) { + netdev_feature_andnot(dev->wanted_features, + dev->wanted_features, dev->hw_features); + netdev_feature_and(tmp, req_wanted, dev->hw_features); + netdev_feature_or(dev->wanted_features, dev->wanted_features, + tmp); __netdev_update_features(dev); } - ethnl_features_to_bitmap(new_active, dev->features); - mod = !bitmap_equal(old_active, new_active, NETDEV_FEATURE_COUNT); + mod = !netdev_feature_equal(old_active, new_active);
ret = 0; if (!(req_info.flags & ETHTOOL_FLAG_OMIT_REPLY)) { bool compact = req_info.flags & ETHTOOL_FLAG_COMPACT_BITSETS;
- bitmap_xor(wanted_diff_mask, req_wanted, new_active, - NETDEV_FEATURE_COUNT); - bitmap_xor(active_diff_mask, old_active, new_active, - NETDEV_FEATURE_COUNT); - bitmap_and(wanted_diff_mask, wanted_diff_mask, req_mask, - NETDEV_FEATURE_COUNT); - bitmap_and(req_wanted, req_wanted, wanted_diff_mask, - NETDEV_FEATURE_COUNT); - bitmap_and(new_active, new_active, active_diff_mask, - NETDEV_FEATURE_COUNT); + netdev_feature_xor(wanted_diff_mask, req_wanted, new_active); + netdev_feature_xor(active_diff_mask, old_active, new_active); + netdev_feature_and(wanted_diff_mask, wanted_diff_mask, + req_mask); + netdev_feature_and(req_wanted, req_wanted, wanted_diff_mask); + netdev_feature_and(new_active, new_active, active_diff_mask);
ret = features_send_reply(dev, info, req_wanted, wanted_diff_mask, new_active, diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index a51cd59..6e6e6d6 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -64,6 +64,11 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) .size = ETHTOOL_DEV_FEATURE_WORDS, }; struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS]; + __DECLARE_NETDEV_FEATURE_MASK(nochange_features); + u32 nochange[ETHTOOL_DEV_FEATURE_WORDS]; + u32 wanted[ETHTOOL_DEV_FEATURE_WORDS]; + u32 active[ETHTOOL_DEV_FEATURE_WORDS]; + u32 hw[ETHTOOL_DEV_FEATURE_WORDS]; u32 __user *sizeaddr; u32 copy_size; int i; @@ -71,12 +76,17 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) /* in case feature bits run out again */ BUILD_BUG_ON(ETHTOOL_DEV_FEATURE_WORDS * sizeof(u32) > sizeof(netdev_features_t));
+ bitmap_to_arr32(hw, dev->hw_features, NETDEV_FEATURE_COUNT); + bitmap_to_arr32(wanted, dev->wanted_features, NETDEV_FEATURE_COUNT); + bitmap_to_arr32(active, dev->features, NETDEV_FEATURE_COUNT); + netdev_feature_zero(nochange_features); + netdev_feature_set_bits(NETIF_F_NEVER_CHANGE, nochange_features); + bitmap_to_arr32(nochange, nochange_features, NETDEV_FEATURE_COUNT); for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) { - features[i].available = (u32)(dev->hw_features >> (32 * i)); - features[i].requested = (u32)(dev->wanted_features >> (32 * i)); - features[i].active = (u32)(dev->features >> (32 * i)); - features[i].never_changed = - (u32)(NETIF_F_NEVER_CHANGE >> (32 * i)); + features[i].available = hw[i]; + features[i].requested = wanted[i]; + features[i].active = active[i]; + features[i].never_changed = nochange[i]; }
sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size); @@ -99,7 +109,12 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr) { struct ethtool_sfeatures cmd; struct ethtool_set_features_block features[ETHTOOL_DEV_FEATURE_WORDS]; - netdev_features_t wanted = 0, valid = 0; + u32 requested_arr[ETHTOOL_DEV_FEATURE_WORDS]; + u32 valid_arr[ETHTOOL_DEV_FEATURE_WORDS]; + __DECLARE_NETDEV_FEATURE_MASK(nochange); + __DECLARE_NETDEV_FEATURE_MASK(wanted); + __DECLARE_NETDEV_FEATURE_MASK(valid); + __DECLARE_NETDEV_FEATURE_MASK(tmp); int i, ret = 0;
if (copy_from_user(&cmd, useraddr, sizeof(cmd))) @@ -112,24 +127,35 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr) if (copy_from_user(features, useraddr, sizeof(features))) return -EFAULT;
+ netdev_feature_zero(wanted); + netdev_feature_zero(valid); for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) { - valid |= (netdev_features_t)features[i].valid << (32 * i); - wanted |= (netdev_features_t)features[i].requested << (32 * i); + requested_arr[i] = features[i].requested; + valid_arr[i] = features[i].valid; } + bitmap_from_arr32(wanted, requested_arr, NETDEV_FEATURE_COUNT); + bitmap_from_arr32(valid, valid_arr, NETDEV_FEATURE_COUNT);
- if (valid & ~NETIF_F_ETHTOOL_BITS) + netdev_feature_zero(nochange); + netdev_feature_set_bits(NETIF_F_NEVER_CHANGE, nochange); + if (netdev_feature_intersects(valid, nochange)) return -EINVAL;
- if (valid & ~dev->hw_features) { - valid &= dev->hw_features; + netdev_feature_andnot(tmp, valid, dev->hw_features); + if (!netdev_feature_empty(tmp)) { + netdev_feature_and(valid, valid, dev->hw_features); ret |= ETHTOOL_F_UNSUPPORTED; }
- dev->wanted_features &= ~valid; - dev->wanted_features |= wanted & valid; + netdev_feature_andnot(dev->wanted_features, dev->wanted_features, + valid); + netdev_feature_and(tmp, wanted, valid); + netdev_feature_or(dev->wanted_features, dev->wanted_features, tmp); __netdev_update_features(dev);
- if ((dev->wanted_features ^ dev->features) & valid) + netdev_feature_xor(tmp, dev->wanted_features, dev->features); + netdev_feature_and(tmp, tmp, valid); + if (!netdev_feature_empty(tmp)) ret |= ETHTOOL_F_WISH;
return ret; @@ -194,34 +220,35 @@ static void __ethtool_get_strings(struct net_device *dev, ops->get_strings(dev, stringset, data); }
-static void ethtool_get_feature_mask(u32 eth_cmd, netdev_features_t *mask) +static void ethtool_get_feature_mask(u32 eth_cmd, netdev_features_t mask) { /* feature masks of legacy discrete ethtool ops */ - + netdev_feature_zero(mask); switch (eth_cmd) { case ETHTOOL_GTXCSUM: case ETHTOOL_STXCSUM: - *mask = NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC | NETIF_F_SCTP_CRC; + netdev_feature_set_bits(NETIF_F_CSUM_MASK | NETIF_F_FCOE_CRC | + NETIF_F_SCTP_CRC, mask); break; case ETHTOOL_GRXCSUM: case ETHTOOL_SRXCSUM: - *mask = NETIF_F_RXCSUM; + netdev_feature_set_bit(NETIF_F_RXCSUM_BIT, mask); break; case ETHTOOL_GSG: case ETHTOOL_SSG: - *mask = NETIF_F_SG | NETIF_F_FRAGLIST; + netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST, mask); break; case ETHTOOL_GTSO: case ETHTOOL_STSO: - *mask = NETIF_F_ALL_TSO; + netdev_feature_set_bits(NETIF_F_ALL_TSO, mask); break; case ETHTOOL_GGSO: case ETHTOOL_SGSO: - *mask = NETIF_F_GSO; + netdev_feature_set_bit(NETIF_F_GSO_BIT, mask); break; case ETHTOOL_GGRO: case ETHTOOL_SGRO: - *mask = NETIF_F_GRO; + netdev_feature_set_bit(NETIF_F_GRO_BIT, mask); break; default: BUG(); @@ -234,9 +261,9 @@ static int ethtool_get_one_feature(struct net_device *dev, __DECLARE_NETDEV_FEATURE_MASK(mask); struct ethtool_value edata;
- ethtool_get_feature_mask(ethcmd, &mask); + ethtool_get_feature_mask(ethcmd, mask); edata.cmd = ethcmd; - edata.data = !!(dev->features & mask); + edata.data = netdev_feature_intersects(dev->features, mask);
if (copy_to_user(useraddr, &edata, sizeof(edata))) return -EFAULT; @@ -252,15 +279,17 @@ static int ethtool_set_one_feature(struct net_device *dev, if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT;
- ethtool_get_feature_mask(ethcmd, &mask); - mask &= dev->hw_features; - if (!mask) + ethtool_get_feature_mask(ethcmd, mask); + netdev_feature_and(mask, mask, dev->hw_features); + if (netdev_feature_empty(mask)) return -EOPNOTSUPP;
if (edata.data) - dev->wanted_features |= mask; + netdev_feature_and(dev->wanted_features, dev->wanted_features, + mask); else - dev->wanted_features &= ~mask; + netdev_feature_andnot(dev->wanted_features, + dev->wanted_features, mask);
__netdev_update_features(dev);
@@ -277,15 +306,17 @@ static u32 __ethtool_get_flags(struct net_device *dev) { u32 flags = 0;
- if (dev->features & NETIF_F_LRO) + if (netdev_feature_test_bit(NETIF_F_LRO_BIT, dev->features)) flags |= ETH_FLAG_LRO; - if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, + dev->features)) flags |= ETH_FLAG_RXVLAN; - if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) + if (netdev_feature_test_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, + dev->features)) flags |= ETH_FLAG_TXVLAN; - if (dev->features & NETIF_F_NTUPLE) + if (netdev_feature_test_bit(NETIF_F_NTUPLE_BIT, dev->features)) flags |= ETH_FLAG_NTUPLE; - if (dev->features & NETIF_F_RXHASH) + if (netdev_feature_test_bit(NETIF_F_RXHASH_BIT, dev->features)) flags |= ETH_FLAG_RXHASH;
return flags; @@ -293,29 +324,38 @@ static u32 __ethtool_get_flags(struct net_device *dev)
static int __ethtool_set_flags(struct net_device *dev, u32 data) { - netdev_features_t features = 0, changed; + __DECLARE_NETDEV_FEATURE_MASK(features); + __DECLARE_NETDEV_FEATURE_MASK(changed); + __DECLARE_NETDEV_FEATURE_MASK(tmp);
if (data & ~ETH_ALL_FLAGS) return -EINVAL;
+ netdev_feature_zero(features); + if (data & ETH_FLAG_LRO) - features |= NETIF_F_LRO; + netdev_feature_set_bit(NETIF_F_LRO_BIT, features); if (data & ETH_FLAG_RXVLAN) - features |= NETIF_F_HW_VLAN_CTAG_RX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_RX_BIT, features); if (data & ETH_FLAG_TXVLAN) - features |= NETIF_F_HW_VLAN_CTAG_TX; + netdev_feature_set_bit(NETIF_F_HW_VLAN_CTAG_TX_BIT, features); if (data & ETH_FLAG_NTUPLE) - features |= NETIF_F_NTUPLE; + netdev_feature_set_bit(NETIF_F_NTUPLE_BIT, features); if (data & ETH_FLAG_RXHASH) - features |= NETIF_F_RXHASH; + netdev_feature_set_bit(NETIF_F_RXHASH_BIT, features);
/* allow changing only bits set in hw_features */ - changed = (features ^ dev->features) & ETH_ALL_FEATURES; - if (changed & ~dev->hw_features) - return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP; - - dev->wanted_features = - (dev->wanted_features & ~changed) | (features & changed); + netdev_feature_xor(changed, features, dev->features); + netdev_feature_and_bits(ETH_ALL_FEATURES, changed); + netdev_feature_andnot(tmp, changed, dev->hw_features); + if (!netdev_feature_empty(tmp)) + return netdev_feature_intersects(changed, dev->hw_features) ? + -EINVAL : -EOPNOTSUPP; + + netdev_feature_andnot(dev->wanted_features, dev->wanted_features, + changed); + netdev_feature_and(tmp, features, changed); + netdev_feature_or(dev->wanted_features, dev->wanted_features, tmp);
__netdev_update_features(dev);
@@ -2768,7 +2808,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr) if (rc < 0) goto out; } - old_features = dev->features; + netdev_feature_copy(old_features, dev->features);
switch (ethcmd) { case ETHTOOL_GSET: @@ -2983,7 +3023,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr) if (dev->ethtool_ops->complete) dev->ethtool_ops->complete(dev);
- if (old_features != dev->features) + if (!netdev_feature_equal(old_features, dev->features)) netdev_features_change(dev); out: if (dev->dev.parent) diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 7a4c5e7..3bbc438 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -178,12 +178,12 @@ static int hsr_dev_close(struct net_device *dev) }
static void hsr_features_recompute(struct hsr_priv *hsr, - netdev_features_t *features) + netdev_features_t features) { __DECLARE_NETDEV_FEATURE_MASK(mask); struct hsr_port *port;
- netdev_feature_copy(&mask, *features); + netdev_feature_copy(&mask, features);
/* Mask out all features that, if supported by one device, should be * enabled for all devices (see NETIF_F_ONE_FOR_ALL). @@ -194,12 +194,12 @@ static void hsr_features_recompute(struct hsr_priv *hsr, */ netdev_feature_clear_bits(NETIF_F_ONE_FOR_ALL, features); hsr_for_each_port(hsr, port) - netdev_increment_features(features, *features, + netdev_increment_features(features, features, port->dev->features, mask); }
static void hsr_fix_features(struct net_device *dev, - netdev_features_t *features) + netdev_features_t features) { struct hsr_priv *hsr = netdev_priv(dev);
@@ -449,21 +449,21 @@ void hsr_dev_setup(struct net_device *dev) netdev_feature_set_bits(NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_CTAG_TX, &dev->hw_features); + NETIF_F_HW_VLAN_CTAG_TX, dev->hw_features);
- netdev_feature_copy(&dev->features, dev->hw_features); + netdev_feature_copy(dev->features, dev->hw_features);
/* Prevent recursive tx locking */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features);
/* VLAN on top of HSR needs testing and probably some work on * hsr_header_create() etc. */ - netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_VLAN_CHALLENGED_BIT, dev->features); /* Not sure about this. Taken from bridge code. netdev_features.h says * it means "Does not change network namespaces". */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features); }
/* Return true if dev is a HSR master; return false otherwise. diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 80c62ed..b6ec8a9 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1299,7 +1299,7 @@ int inet_sk_rebuild_header(struct sock *sk) err = PTR_ERR(rt);
/* Routing failed... */ - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); /* * Other protocols have to map its equivalent state to TCP_SYN_SENT. * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme @@ -1361,7 +1361,7 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap) - netdev_feature_and(&features, features, + netdev_feature_and(features, features, skb->dev->hw_enc_features); SKB_GSO_CB(skb)->encap_level += ihl;
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c index 0fe1af1..c6a7b46 100644 --- a/net/ipv4/esp4_offload.c +++ b/net/ipv4/esp4_offload.c @@ -214,7 +214,7 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
- netdev_feature_copy(&esp_features, features); + netdev_feature_copy(esp_features, features); if ((!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, skb->dev->gso_partial_features) && !netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features)) || @@ -227,7 +227,7 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, !netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, skb->dev->gso_partial_features)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_SCTP_CRC, - &esp_features); + esp_features);
xo->flags |= XFRM_GSO_SEGMENT;
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index 65f22fa..7b14537 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c @@ -43,10 +43,10 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, need_csum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM); skb->encap_hdr_csum = need_csum;
- netdev_feature_and(&features, features, skb->dev->hw_enc_features); + netdev_feature_and(features, features, skb->dev->hw_enc_features);
if (need_csum) - netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, &features); + netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, features);
need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb)); /* Try to offload checksum if possible */ diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 9cf14d3..1045382 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -763,21 +763,21 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || tunnel->encap.type == TUNNEL_ENCAP_NONE) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); } else { netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); } - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); } else { netdev_feature_clear_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); netdev_feature_clear_bits(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); } }
@@ -959,8 +959,8 @@ static void __gre_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph);
- netdev_feature_set_bits(GRE_FEATURES, &dev->features); - netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features); + netdev_feature_set_bits(GRE_FEATURES, dev->features); + netdev_feature_set_bits(GRE_FEATURES, dev->hw_features);
if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { /* TCP offload with GRE SEQ is not supported, nor @@ -970,15 +970,15 @@ static void __gre_tunnel_init(struct net_device *dev) if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || (tunnel->encap.type == TUNNEL_ENCAP_NONE)) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); }
/* Can use a lockless transmit, unless we generate * output sequences */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); } }
@@ -1306,8 +1306,8 @@ static int erspan_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen + erspan_hdr_len(tunnel->erspan_ver);
- netdev_feature_set_bits(GRE_FEATURES, &dev->features); - netdev_feature_set_bits(GRE_FEATURES, &dev->hw_features); + netdev_feature_set_bits(GRE_FEATURES, dev->features); + netdev_feature_set_bits(GRE_FEATURES, dev->hw_features); dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; netif_keep_dst(dev);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index f79509b..70488cc 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -255,9 +255,9 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk, * bridged to a NETIF_F_TSO tunnel stacked over an interface with an * insufficient MTU. */ - netif_skb_features(skb, &features); + netif_skb_features(skb, features); BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_GSO_CB_OFFSET); - netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index ac5671e..1ba68f2 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -1073,7 +1073,7 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id, */ if (!IS_ERR(itn->fb_tunnel_dev)) { netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &itn->fb_tunnel_dev->features); + itn->fb_tunnel_dev->features);
itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev); ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev)); diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index bf94ef6..51ce35a 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -430,7 +430,7 @@ static int vti_tunnel_init(struct net_device *dev)
dev->flags = IFF_NOARP; dev->addr_len = 4; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
return ip_tunnel_init(dev); diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index b587d47..1861492 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -368,11 +368,11 @@ static void ipip_tunnel_setup(struct net_device *dev) dev->type = ARPHRD_TUNNEL; dev->flags = IFF_NOARP; dev->addr_len = 4; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
- netdev_feature_set_bits(IPIP_FEATURES, &dev->features); - netdev_feature_set_bits(IPIP_FEATURES, &dev->hw_features); + netdev_feature_set_bits(IPIP_FEATURES, dev->features); + netdev_feature_set_bits(IPIP_FEATURES, dev->hw_features); ip_tunnel_setup(dev, ipip_net_id); }
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 750a4a1..1f8f8d7 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -532,7 +532,7 @@ static void reg_vif_setup(struct net_device *dev) dev->flags = IFF_NOARP; dev->netdev_ops = ®_vif_netdev_ops; dev->needs_free_netdev = true; - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features); }
static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cdcafd5..d2e35c0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -462,8 +462,8 @@ void tcp_init_sock(struct sock *sk) WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]);
sk_sockets_allocated_inc(sk); - netdev_feature_zero(&sk->sk_route_forced_caps); - netdev_feature_set_bit(NETIF_F_GSO_BIT, &sk->sk_route_forced_caps); + netdev_feature_zero(sk->sk_route_forced_caps); + netdev_feature_set_bit(NETIF_F_GSO_BIT, sk->sk_route_forced_caps); } EXPORT_SYMBOL(tcp_init_sock);
@@ -1184,7 +1184,7 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, if (err) { tcp_set_state(sk, TCP_CLOSE); inet->inet_dport = 0; - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); } } flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0; diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f5a8b66..681433e 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -323,7 +323,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) */ tcp_set_state(sk, TCP_CLOSE); ip_rt_put(rt); - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); inet->inet_dport = 0; return err; } diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index 2f4b748..e602df5 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -82,8 +82,8 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, if (unlikely(skb->len <= mss)) goto out;
- netdev_feature_copy(&tmp, features); - netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, &tmp); + netdev_feature_copy(tmp, features); + netdev_feature_set_bit(NETIF_F_GSO_ROBUST_BIT, tmp); if (skb_gso_ok(skb, tmp)) { /* Packet is from an untrusted source, reset gso_segs. */
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index ad9bfde..6a14cc3 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -71,18 +71,18 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, NETIF_F_IP_CSUM, skb->dev->features));
- netdev_feature_and(&features, features, skb->dev->hw_enc_features); + netdev_feature_and(features, features, skb->dev->hw_enc_features); if (need_csum) - netdev_feature_clear_bit(NETIF_F_SCTP_CRC_BIT, &features); + netdev_feature_clear_bit(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 * instead set the flag based on our outer checksum offload value. */ if (remcsum) { - netdev_feature_clear_bits(NETIF_F_CSUM_MASK, &features); + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, features); if (!need_csum || offload_csum) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features); }
/* segment inner packet. */ @@ -418,7 +418,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, * software prior to segmenting the frame. */ if (!skb->encap_hdr_csum) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features);
/* Fragment the skb. IP headers of the fragments are updated in * inet_gso_segment() diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 7b8eb28..cf2fb45 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -833,7 +833,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p); if (IS_ERR(dst)) { - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); sk->sk_err_soft = -PTR_ERR(dst); return PTR_ERR(dst); } diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c index 3ce9360..6b98681 100644 --- a/net/ipv6/esp6_offload.c +++ b/net/ipv6/esp6_offload.c @@ -253,14 +253,14 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb,
skb->encap_hdr_csum = 1;
- netdev_feature_copy(&esp_features, features); + netdev_feature_copy(esp_features, features); if (!netdev_feature_test_bit(NETIF_F_HW_ESP_BIT, features) || x->xso.dev != skb->dev) netdev_feature_clear_bits(NETIF_F_SG | NETIF_F_CSUM_MASK | - NETIF_F_SCTP_CRC, &esp_features); + NETIF_F_SCTP_CRC, esp_features); else if (!netdev_feature_test_bit(NETIF_F_HW_ESP_TX_CSUM_BIT, features)) netdev_feature_clear_bits(NETIF_F_CSUM_MASK | NETIF_F_SCTP_CRC, - &esp_features); + esp_features);
xo->flags |= XFRM_GSO_SEGMENT;
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 6d83148..7e156bb 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c @@ -121,7 +121,7 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused dst = inet6_csk_route_socket(sk, &fl6); if (IS_ERR(dst)) { sk->sk_err_soft = -PTR_ERR(dst); - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); kfree_skb(skb); return PTR_ERR(dst); } diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 336ddf0..8d053ac 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -385,7 +385,7 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
/* Can use a lockless transmit, unless we generate output sequences */ if (!(nt->parms.o_flags & TUNNEL_SEQ)) - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features);
ip6gre_tunnel_link(ign, nt); return nt; @@ -1439,8 +1439,8 @@ static void ip6gre_tnl_init_features(struct net_device *dev) { struct ip6_tnl *nt = netdev_priv(dev);
- netdev_feature_set_bits(GRE6_FEATURES, &dev->features); - netdev_feature_set_bits(GRE6_FEATURES, &dev->hw_features); + netdev_feature_set_bits(GRE6_FEATURES, dev->features); + netdev_feature_set_bits(GRE6_FEATURES, dev->hw_features);
if (!(nt->parms.o_flags & TUNNEL_SEQ)) { /* TCP offload with GRE SEQ is not supported, nor @@ -1450,15 +1450,15 @@ static void ip6gre_tnl_init_features(struct net_device *dev) if (!(nt->parms.o_flags & TUNNEL_CSUM) || nt->encap.type == TUNNEL_ENCAP_NONE) { netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->features); + dev->features); netdev_feature_set_bits(NETIF_F_GSO_SOFTWARE, - &dev->hw_features); + dev->hw_features); }
/* Can use a lockless transmit, unless we generate * output sequences */ - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); } }
@@ -1601,7 +1601,7 @@ static int __net_init ip6gre_init_net(struct net *net) * Allowing to move it to another netns is clearly unsafe. */ netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &ign->fb_tunnel_dev->features); + ign->fb_tunnel_dev->features);
ip6gre_fb_tunnel_init(ign->fb_tunnel_dev); diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 4c3ba4b..ee37ff8 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -93,7 +93,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap) - netdev_feature_and(&features, features, + netdev_feature_and(features, features, skb->dev->hw_enc_features); SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 72acb06..40705f5 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -146,8 +146,8 @@ ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk, * describing the cases where GSO segment length exceeds the * egress MTU. */ - netif_skb_features(skb, &features); - netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + netif_skb_features(skb, features); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 72add9a..0d03382 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1833,11 +1833,11 @@ static void ip6_tnl_dev_setup(struct net_device *dev) dev->type = ARPHRD_TUNNEL6; dev->flags |= IFF_NOARP; dev->addr_len = sizeof(struct in6_addr); - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); netif_keep_dst(dev);
- netdev_feature_set_bits(IPXIPX_FEATURES, &dev->features); - netdev_feature_set_bits(IPXIPX_FEATURES, &dev->hw_features); + netdev_feature_set_bits(IPXIPX_FEATURES, dev->features); + netdev_feature_set_bits(IPXIPX_FEATURES, dev->hw_features);
/* This perm addr will be used as interface identifier by IPv6 */ dev->addr_assign_type = NET_ADDR_RANDOM; @@ -2280,7 +2280,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) * Allowing to move it to another netns is clearly unsafe. */ netdev_feature_set_bits(NETIF_F_NETNS_LOCAL_BIT, - &ip6n->fb_tnl_dev->features); + ip6n->fb_tnl_dev->features);
err = ip6_fb_tnl_dev_init(ip6n->fb_tnl_dev); if (err < 0) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index daf2a4b..f261d27 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -636,7 +636,7 @@ static void reg_vif_setup(struct net_device *dev) dev->flags = IFF_NOARP; dev->netdev_ops = ®_vif_netdev_ops; dev->needs_free_netdev = true; - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features); }
static struct net_device *ip6mr_reg_vif(struct net *net, struct mr_table *mrt) diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 58aa232..32d105c 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1438,9 +1438,9 @@ static void ipip6_tunnel_setup(struct net_device *dev) dev->flags = IFF_NOARP; netif_keep_dst(dev); dev->addr_len = 4; - netdev_feature_set_bit(NETIF_F_LLTX_BIT, &dev->features); - netdev_feature_set_bits(SIT_FEATURES, &dev->features); - netdev_feature_set_bits(SIT_FEATURES, &dev->hw_features); + netdev_feature_set_bit(NETIF_F_LLTX_BIT, dev->features); + netdev_feature_set_bits(SIT_FEATURES, dev->features); + netdev_feature_set_bits(SIT_FEATURES, dev->hw_features); }
static int ipip6_tunnel_init(struct net_device *dev) @@ -1919,7 +1919,7 @@ static int __net_init sit_init_net(struct net *net) * Allowing to move it to another netns is clearly unsafe. */ netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &sitn->fb_tunnel_dev->features); + sitn->fb_tunnel_dev->features);
err = register_netdev(sitn->fb_tunnel_dev); if (err) diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 642d640..c68a113 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -341,7 +341,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, tcp_set_state(sk, TCP_CLOSE); failure: inet->inet_dport = 0; - netdev_feature_zero(&sk->sk_route_caps); + netdev_feature_zero(sk->sk_route_caps); return err; }
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index 5911c60..9090d43 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -69,7 +69,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, * software prior to segmenting the frame. */ if (!skb->encap_hdr_csum) - netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, &features); + netdev_feature_set_bit(NETIF_F_HW_CSUM_BIT, features);
/* Check if there is enough headroom to insert fragment header. */ tnl_hlen = skb_tnl_header_len(skb); diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index f6dde47..1e85b10 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1997,11 +1997,11 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, if (type == NL80211_IFTYPE_STATION) sdata->u.mgd.use_4addr = params->use_4addr;
- netdev_feature_or(&ndev->features, ndev->features, + netdev_feature_or(ndev->features, ndev->features, local->hw.netdev_features); - netdev_feature_copy(&tmp, ndev->features); - netdev_feature_and_bits(MAC80211_SUPPORTED_FEATURES_TX, &tmp); - netdev_feature_or(&ndev->hw_features, ndev->hw_features, tmp); + netdev_feature_copy(tmp, ndev->features); + netdev_feature_and_bits(MAC80211_SUPPORTED_FEATURES_TX, tmp); + netdev_feature_or(ndev->hw_features, ndev->hw_features, tmp);
netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index eccb0a3..c40b5d5 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -959,8 +959,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) }
/* Only HW csum features are currently compatible with mac80211 */ - netdev_feature_copy(&tmp, hw->netdev_features); - netdev_feature_clear_bits(MAC80211_SUPPORTED_FEATURES, &tmp); + netdev_feature_copy(tmp, hw->netdev_features); + netdev_feature_clear_bits(MAC80211_SUPPORTED_FEATURES, tmp); if (WARN_ON(!netdev_feature_empty(tmp))) return -EINVAL;
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c index a337412..7a6df6d 100644 --- a/net/nsh/nsh.c +++ b/net/nsh/nsh.c @@ -104,7 +104,7 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, skb->mac_len = proto == htons(ETH_P_TEB) ? ETH_HLEN : 0; skb->protocol = proto;
- netdev_feature_clear_bit(NETIF_F_SG_BIT, &features); + netdev_feature_clear_bit(NETIF_F_SG_BIT, features); segs = skb_mac_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) { skb_gso_error_unwind(skb, htons(ETH_P_NSH), nsh_len, diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index f5975d5..2f7c5f0 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -457,8 +457,8 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff *segs, *nskb; int ret;
- netif_skb_features(skb, &features); - netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features); + netif_skb_features(skb, features); + netdev_feature_clear_bits(NETIF_F_GSO_MASK, features); segs = skb_gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free); diff --git a/net/wireless/core.c b/net/wireless/core.c index 5849ebf..5c179a2 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -165,12 +165,12 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, if (!wdev->netdev) continue; netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); if (err) break; netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); }
if (err) { @@ -183,12 +183,12 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, if (!wdev->netdev) continue; netdev_feature_clear_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); WARN_ON(err); netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &wdev->netdev->features); + wdev->netdev->features); }
return err; @@ -1388,8 +1388,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, SET_NETDEV_DEVTYPE(dev, &wiphy_type); wdev->netdev = dev; /* can only change netns with wiphy */ - netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, - &dev->features); + netdev_feature_set_bit(NETIF_F_NETNS_LOCAL_BIT, dev->features);
cfg80211_init_wdev(wdev); break;
repeat with another #143
On 2021/8/11 22:46, Jian Shen wrote:
This patch extend the type of netdev_features_t to bitmap, so it can support more than 64 bits. Changes the typedef of netdev_features_t to unsigned long *, and use the macro __DECLARE_NETDEV_FEATURE_MASK to declare a netdev feature bitmap.
Then rewrite all the netdev_feature_xxx helpers with the new prototype. For the "netdev_features_t" is "unsigned long *" now, it's unnecessary to use "netdev_features_t *" in these helpers. So removes them, and modify the codes which call them. So does the functions prototype mentioned in the first 23 patches. With these changes, we can keep the behaviour consitent with linkmode_xxx helpers, remove the
For the type of netdev_features_t is bitmap now, so use %*pb to print the features, rather than %pNF.
Signed-off-by: Jian Shen shenjian15@huawei.com
arch/um/drivers/vector_kern.c | 10 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 +- drivers/net/bareudp.c | 14 +- drivers/net/bonding/bond_main.c | 74 ++++---- drivers/net/bonding/bond_options.c | 8 +- drivers/net/can/dev/dev.c | 4 +- drivers/net/can/slcan.c | 4 +- drivers/net/dsa/xrs700x/xrs700x.c | 4 +- drivers/net/dummy.c | 12 +- drivers/net/ethernet/3com/3c59x.c | 2 +- drivers/net/ethernet/3com/typhoon.c | 8 +- drivers/net/ethernet/adaptec/starfire.c | 6 +- drivers/net/ethernet/aeroflex/greth.c | 8 +- drivers/net/ethernet/alacritech/slicoss.c | 6 +- drivers/net/ethernet/alteon/acenic.c | 6 +- drivers/net/ethernet/altera/altera_tse_main.c | 8 +- drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 2 +- drivers/net/ethernet/amazon/ena/ena_netdev.c | 30 ++-- drivers/net/ethernet/amd/amd8111e.c | 4 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 24 +-- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 18 +- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 +- drivers/net/ethernet/aquantia/atlantic/aq_macsec.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 16 +- drivers/net/ethernet/atheros/alx/main.c | 6 +- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 14 +- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 16 +- drivers/net/ethernet/atheros/atlx/atl1.c | 14 +- drivers/net/ethernet/atheros/atlx/atl2.c | 12 +- drivers/net/ethernet/atheros/atlx/atlx.c | 6 +- drivers/net/ethernet/broadcom/b44.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 6 +- drivers/net/ethernet/broadcom/bgmac.c | 8 +- drivers/net/ethernet/broadcom/bnx2.c | 27 ++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 20 +-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 40 ++--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 70 ++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 10 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +- drivers/net/ethernet/broadcom/tg3.c | 32 ++-- drivers/net/ethernet/brocade/bna/bnad.c | 16 +- drivers/net/ethernet/cadence/macb_main.c | 20 +-- drivers/net/ethernet/calxeda/xgmac.c | 8 +- drivers/net/ethernet/cavium/liquidio/lio_main.c | 38 ++-- drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 38 ++-- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 20 +-- drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 20 +-- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 26 +-- drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 16 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 34 ++-- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 18 +- drivers/net/ethernet/cisco/enic/enic_main.c | 26 +-- drivers/net/ethernet/cortina/gemini.c | 8 +- drivers/net/ethernet/davicom/dm9000.c | 8 +- drivers/net/ethernet/dnet.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 18 +- drivers/net/ethernet/ethoc.c | 2 +- drivers/net/ethernet/faraday/ftgmac100.c | 14 +- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 10 +- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 +- drivers/net/ethernet/freescale/enetc/enetc.c | 2 +- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 16 +- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 10 +- drivers/net/ethernet/freescale/fec_main.c | 12 +- .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +- drivers/net/ethernet/freescale/gianfar.c | 10 +- drivers/net/ethernet/freescale/gianfar_ethtool.c | 4 +- drivers/net/ethernet/google/gve/gve_adminq.c | 2 +- drivers/net/ethernet/google/gve/gve_main.c | 26 +-- drivers/net/ethernet/google/gve/gve_rx.c | 2 +- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 2 +- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 8 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 16 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 36 ++-- drivers/net/ethernet/huawei/hinic/hinic_main.c | 34 ++-- drivers/net/ethernet/ibm/ehea/ehea_main.c | 12 +- drivers/net/ethernet/ibm/emac/core.c | 8 +- drivers/net/ethernet/ibm/ibmveth.c | 38 ++-- drivers/net/ethernet/ibm/ibmvnic.c | 34 ++-- drivers/net/ethernet/intel/e100.c | 10 +- drivers/net/ethernet/intel/e1000/e1000_main.c | 28 +-- drivers/net/ethernet/intel/e1000e/netdev.c | 38 ++-- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 19 +- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 8 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 36 ++-- drivers/net/ethernet/intel/iavf/iavf_main.c | 48 ++--- drivers/net/ethernet/intel/ice/ice_main.c | 46 ++--- drivers/net/ethernet/intel/igb/igb_main.c | 42 ++--- drivers/net/ethernet/intel/igbvf/netdev.c | 28 +-- drivers/net/ethernet/intel/igc/igc_main.c | 46 ++--- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 20 +-- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 60 +++---- drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 30 ++-- drivers/net/ethernet/jme.c | 14 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 10 +- drivers/net/ethernet/marvell/mvneta.c | 10 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 42 ++--- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 28 +-- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 12 +- .../net/ethernet/marvell/prestera/prestera_main.c | 2 +- drivers/net/ethernet/marvell/skge.c | 6 +- drivers/net/ethernet/marvell/sky2.c | 29 ++- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 66 +++---- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 16 +- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 4 +- .../ethernet/mellanox/mlx5/core/en_accel/ktls.c | 11 +- .../net/ethernet/mellanox/mlx5/core/en_accel/tls.c | 12 +- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 118 ++++++------ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 26 +-- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 18 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 14 +- drivers/net/ethernet/micrel/ksz884x.c | 8 +- drivers/net/ethernet/microchip/lan743x_main.c | 6 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 14 +- drivers/net/ethernet/mscc/ocelot_net.c | 6 +- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 20 +-- drivers/net/ethernet/natsemi/ns83820.c | 8 +- drivers/net/ethernet/neterion/s2io.c | 14 +- drivers/net/ethernet/neterion/vxge/vxge-main.c | 18 +- drivers/net/ethernet/netronome/nfp/crypto/tls.c | 8 +- .../net/ethernet/netronome/nfp/nfp_net_common.c | 42 ++--- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 52 +++--- drivers/net/ethernet/ni/nixge.c | 4 +- drivers/net/ethernet/nvidia/forcedeth.c | 16 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 8 +- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 4 +- drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 48 ++--- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 22 +-- drivers/net/ethernet/qlogic/qede/qede.h | 4 +- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 10 +- drivers/net/ethernet/qlogic/qede/qede_fp.c | 2 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 34 ++-- drivers/net/ethernet/qlogic/qla3xxx.c | 4 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 16 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 28 +-- drivers/net/ethernet/qualcomm/emac/emac.c | 12 +- drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 10 +- drivers/net/ethernet/realtek/8139cp.c | 14 +- drivers/net/ethernet/realtek/8139too.c | 10 +- drivers/net/ethernet/realtek/r8169_main.c | 30 ++-- drivers/net/ethernet/renesas/ravb_main.c | 12 +- drivers/net/ethernet/renesas/sh_eth.c | 14 +- drivers/net/ethernet/rocker/rocker_main.c | 2 +- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 10 +- drivers/net/ethernet/sfc/ef10.c | 18 +- drivers/net/ethernet/sfc/ef100_nic.c | 20 +-- drivers/net/ethernet/sfc/ef10_sriov.c | 4 +- drivers/net/ethernet/sfc/efx.c | 20 +-- drivers/net/ethernet/sfc/efx_common.c | 16 +- drivers/net/ethernet/sfc/efx_common.h | 2 +- drivers/net/ethernet/sfc/falcon/efx.c | 28 ++- drivers/net/ethernet/sfc/falcon/net_driver.h | 2 +- drivers/net/ethernet/sfc/mcdi_filters.c | 8 +- drivers/net/ethernet/sfc/net_driver.h | 2 +- drivers/net/ethernet/sgi/ioc3-eth.c | 8 +- drivers/net/ethernet/silan/sc92031.c | 4 +- drivers/net/ethernet/socionext/netsec.c | 4 +- drivers/net/ethernet/socionext/sni_ave.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 32 ++-- drivers/net/ethernet/sun/cassini.c | 4 +- drivers/net/ethernet/sun/ldmvsw.c | 6 +- drivers/net/ethernet/sun/niu.c | 10 +- drivers/net/ethernet/sun/sungem.c | 8 +- drivers/net/ethernet/sun/sunhme.c | 16 +- drivers/net/ethernet/sun/sunvnet.c | 6 +- drivers/net/ethernet/sun/sunvnet_common.c | 4 +- drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 36 ++-- drivers/net/ethernet/synopsys/dwc-xlgmac-net.c | 2 +- drivers/net/ethernet/tehuti/tehuti.c | 12 +- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 12 +- drivers/net/ethernet/ti/cpsw.c | 4 +- drivers/net/ethernet/ti/cpsw_new.c | 2 +- drivers/net/ethernet/ti/netcp_core.c | 8 +- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 12 +- drivers/net/ethernet/toshiba/spider_net.c | 8 +- drivers/net/ethernet/tundra/tsi108_eth.c | 4 +- drivers/net/ethernet/via/via-rhine.c | 4 +- drivers/net/ethernet/via/via-velocity.c | 6 +- drivers/net/ethernet/wiznet/w5100.c | 2 +- drivers/net/ethernet/wiznet/w5300.c | 2 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 6 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 8 +- drivers/net/fjes/fjes_main.c | 2 +- drivers/net/geneve.c | 14 +- drivers/net/gtp.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 24 +-- drivers/net/hyperv/rndis_filter.c | 26 +-- drivers/net/ifb.c | 8 +- drivers/net/ipa/ipa_modem.c | 4 +- drivers/net/ipvlan/ipvlan_main.c | 30 ++-- drivers/net/ipvlan/ipvtap.c | 4 +- drivers/net/loopback.c | 8 +- drivers/net/macsec.c | 20 +-- drivers/net/macvlan.c | 46 ++--- drivers/net/macvtap.c | 6 +- drivers/net/net_failover.c | 40 ++--- drivers/net/netdevsim/ipsec.c | 4 +- drivers/net/netdevsim/netdev.c | 4 +- drivers/net/nlmon.c | 4 +- drivers/net/ppp/ppp_generic.c | 2 +- drivers/net/tap.c | 24 +-- drivers/net/team/team.c | 46 ++--- drivers/net/tun.c | 34 ++-- drivers/net/usb/aqc111.c | 14 +- drivers/net/usb/ax88179_178a.c | 10 +- drivers/net/usb/cdc-phonet.c | 2 +- drivers/net/usb/cdc_mbim.c | 2 +- drivers/net/usb/lan78xx.c | 16 +- drivers/net/usb/r8152.c | 22 +-- drivers/net/usb/smsc75xx.c | 6 +- drivers/net/usb/smsc95xx.c | 6 +- drivers/net/veth.c | 34 ++-- drivers/net/virtio_net.c | 34 ++-- drivers/net/vmxnet3/vmxnet3_drv.c | 26 +-- drivers/net/vmxnet3/vmxnet3_ethtool.c | 12 +- drivers/net/vmxnet3/vmxnet3_int.h | 4 +- drivers/net/vxlan.c | 16 +- drivers/net/wireguard/device.c | 8 +- drivers/net/wireless/ath/ath10k/mac.c | 4 +- drivers/net/wireless/ath/ath11k/mac.c | 4 +- drivers/net/wireless/ath/ath6kl/main.c | 10 +- drivers/net/wireless/ath/wil6210/netdev.c | 6 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 4 +- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 +- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 +- drivers/net/xen-netback/interface.c | 10 +- drivers/net/xen-netfront.c | 22 +-- drivers/s390/net/qeth_core_main.c | 54 +++--- drivers/s390/net/qeth_l2_main.c | 28 +-- drivers/s390/net/qeth_l3_main.c | 16 +- drivers/staging/qlge/qlge_main.c | 16 +- include/linux/if_vlan.h | 2 +- include/linux/netdev_features.h | 147 ++++++++------- include/linux/netdevice.h | 34 ++-- include/net/sock.h | 8 +- include/net/udp.h | 6 +- include/net/vxlan.h | 4 +- net/8021q/vlan.c | 2 +- net/8021q/vlan.h | 8 +- net/8021q/vlan_dev.c | 34 ++-- net/bridge/br_device.c | 14 +- net/bridge/br_if.c | 6 +- net/bridge/br_private.h | 2 +- net/core/dev.c | 198 +++++++++++---------- net/core/netpoll.c | 2 +- net/core/skbuff.c | 2 +- net/core/sock.c | 10 +- net/dsa/slave.c | 14 +- net/ethtool/features.c | 92 ++++------ net/ethtool/ioctl.c | 136 +++++++++----- net/hsr/hsr_device.c | 18 +- net/ipv4/af_inet.c | 4 +- net/ipv4/esp4_offload.c | 4 +- net/ipv4/gre_offload.c | 4 +- net/ipv4/ip_gre.c | 28 +-- net/ipv4/ip_output.c | 4 +- net/ipv4/ip_tunnel.c | 2 +- net/ipv4/ip_vti.c | 2 +- net/ipv4/ipip.c | 6 +- net/ipv4/ipmr.c | 2 +- net/ipv4/tcp.c | 6 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_offload.c | 4 +- net/ipv4/udp_offload.c | 10 +- net/ipv6/af_inet6.c | 2 +- net/ipv6/esp6_offload.c | 6 +- net/ipv6/inet6_connection_sock.c | 2 +- net/ipv6/ip6_gre.c | 14 +- net/ipv6/ip6_offload.c | 2 +- net/ipv6/ip6_output.c | 4 +- net/ipv6/ip6_tunnel.c | 8 +- net/ipv6/ip6mr.c | 2 +- net/ipv6/sit.c | 8 +- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/udp_offload.c | 2 +- net/mac80211/iface.c | 8 +- net/mac80211/main.c | 4 +- net/nsh/nsh.c | 2 +- net/sched/sch_taprio.c | 4 +- net/wireless/core.c | 11 +- 300 files changed, 2349 insertions(+), 2341 deletions(-)