lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220810105831.1307150-1-alexandr.lobakin@intel.com>
Date:   Wed, 10 Aug 2022 12:58:31 +0200
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     Jian Shen <shenjian15@...wei.com>
Cc:     Alexander Lobakin <alexandr.lobakin@...el.com>,
        davem@...emloft.net, kuba@...nel.org, andrew@...n.ch,
        ecree.xilinx@...il.com, hkallweit1@...il.com, saeed@...nel.org,
        leon@...nel.org, netdev@...r.kernel.org, linuxarm@...neuler.org
Subject: [RFCv7 PATCH net-next 17/36] treewide: adjust features initialization

From: Jian Shen <shenjian15@...wei.com>
Date: Wed, 10 Aug 2022 11:06:05 +0800

> There are many direclty single bit assignment to netdev features.
> Adjust these expressions, so can use netdev features helpers later.
> 
> Signed-off-by: Jian Shen <shenjian15@...wei.com>
> ---
>  arch/um/drivers/vector_kern.c                       | 5 ++++-
>  drivers/firewire/net.c                              | 4 +++-
>  drivers/infiniband/hw/hfi1/vnic_main.c              | 4 +++-
>  drivers/misc/sgi-xp/xpnet.c                         | 3 ++-
>  drivers/net/can/dev/dev.c                           | 4 +++-
>  drivers/net/ethernet/alacritech/slicoss.c           | 4 +++-
>  drivers/net/ethernet/amd/xgbe/xgbe-drv.c            | 4 +++-
>  drivers/net/ethernet/aquantia/atlantic/aq_nic.c     | 3 ++-
>  drivers/net/ethernet/atheros/atlx/atl2.c            | 4 +++-
>  drivers/net/ethernet/cadence/macb_main.c            | 4 +++-
>  drivers/net/ethernet/davicom/dm9000.c               | 4 +++-
>  drivers/net/ethernet/engleder/tsnep_main.c          | 4 +++-
>  drivers/net/ethernet/ibm/ibmveth.c                  | 3 ++-
>  drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 4 +++-
>  drivers/net/ethernet/mellanox/mlx4/en_netdev.c      | 3 ++-
>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c   | 4 +++-
>  drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 7 +++++--
>  drivers/net/ethernet/netronome/nfp/nfp_net_repr.c   | 3 ++-
>  drivers/net/ethernet/ni/nixge.c                     | 4 +++-
>  drivers/net/ethernet/renesas/sh_eth.c               | 6 ++++--
>  drivers/net/ethernet/sun/sunhme.c                   | 7 +++++--
>  drivers/net/ethernet/toshiba/ps3_gelic_net.c        | 6 ++++--
>  drivers/net/ethernet/toshiba/spider_net.c           | 3 ++-
>  drivers/net/ethernet/tundra/tsi108_eth.c            | 3 ++-
>  drivers/net/ethernet/xilinx/ll_temac_main.c         | 4 +++-
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c   | 4 +++-
>  drivers/net/hamradio/bpqether.c                     | 4 +++-
>  drivers/net/hyperv/netvsc_drv.c                     | 3 ++-
>  drivers/net/ipa/ipa_modem.c                         | 4 +++-
>  drivers/net/ntb_netdev.c                            | 4 +++-
>  drivers/net/rionet.c                                | 4 +++-
>  drivers/net/tap.c                                   | 2 +-
>  drivers/net/thunderbolt.c                           | 3 ++-
>  drivers/net/usb/smsc95xx.c                          | 4 +++-
>  drivers/net/virtio_net.c                            | 4 +++-
>  drivers/net/wireless/ath/ath10k/mac.c               | 7 +++++--
>  drivers/net/wireless/ath/ath11k/mac.c               | 4 +++-
>  drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c   | 4 +++-
>  drivers/net/wireless/intel/iwlwifi/mvm/mac80211.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/wwan/t7xx/t7xx_netdev.c                 | 4 +++-
>  drivers/s390/net/qeth_core_main.c                   | 7 +++++--
>  include/net/udp.h                                   | 4 +++-
>  net/phonet/pep-gprs.c                               | 4 +++-
>  46 files changed, 138 insertions(+), 52 deletions(-)
> 
> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index 1d59522a50d8..d797758850e1 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c
> @@ -1628,7 +1628,10 @@ static void vector_eth_configure(
>  		.bpf			= NULL
>  	});
>  
> -	dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST);
> +	netdev_active_features_zero(dev);
> +	dev->features |= NETIF_F_SG;
> +	dev->features |= NETIF_F_FRAGLIST;
> +	dev->features = dev->hw_features;

I think a new helper can be useful there and in a couple other
places, which would set or clear an array of bits taking them as
varargs:

#define __netdev_features_set_set(feat, uniq, ...) ({	\
	DECLARE_NETDEV_FEATURE_SET(uniq, __VA_ARGS__);	\
	netdev_features_set_array(feat, &(uniq));	\
})
#define netdev_features_set_set(feat, ...)		\
	__smth(feat, __UNIQUE_ID(feat_set), __VA_ARGS__)

(name is a placeholder)

so that you can do

	netdev_active_features_zero(dev);
	netdev_features_set_set(dev->features, NETIF_F_SG, NETIF_F_FRAGLIST);

in one take. I think it looks elegant, doesn't it?

>  	INIT_WORK(&vp->reset_tx, vector_reset_tx);
>  
>  	timer_setup(&vp->tl, vector_timer_expire, 0);

[...]

> -- 
> 2.33.0

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ