[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220324182235.05dd0f53@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Thu, 24 Mar 2022 18:22:35 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jian Shen <shenjian15@...wei.com>
Cc: <davem@...emloft.net>, <andrew@...n.ch>, <ecree.xilinx@...il.com>,
<hkallweit1@...il.com>, <alexandr.lobakin@...el.com>,
<saeed@...nel.org>, <leon@...nel.org>, <netdev@...r.kernel.org>,
<linuxarm@...neuler.org>, <lipeng321@...wei.com>
Subject: Re: [RFCv5 PATCH net-next 04/20] net: replace multiple feature bits
with netdev features array
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.?
Powered by blists - more mailing lists