在 2022/3/25 9:22, Jakub Kicinski 写道:
On Thu, 24 Mar 2022 23:49:16 +0800 Jian Shen wrote:
There are many netdev_features bits group used in drivers, replace them with netdev features array.
Maybe we can avoid the ARRAY_SIZE calls by doing something like:
struct netdev_feature_set { unsigned int cnt; unsigned short feature_bits[]; };
#define DECLARE_NETDEV_FEATURE_SET(name, features...) \ static unsigned short __ ## name ## _s [] = {features}; \ struct netdev_feature_set name = { \ .cnt = ARRAY_SIZE(__ ## name ## _s), \ .feature_bits = {features}, \ }
Then:
DECLARE_NETDEV_FEATURE_SET(siena_offload_features, NETIF_F_IP_CSUM_BIT, NETIF_F_IPV6_CSUM_BIT, NETIF_F_RXHASH_BIT, NETIF_F_NTUPLE_BIT);
etc.? .
Thanks, it looks good to me.