netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jian Shen <shenjian15@huawei.com>
Cc: <davem@davemloft.net>, <andrew@lunn.ch>, <ecree.xilinx@gmail.com>,
	<hkallweit1@gmail.com>, <alexandr.lobakin@intel.com>,
	<saeed@kernel.org>, <leon@kernel.org>, <netdev@vger.kernel.org>,
	<linuxarm@openeuler.org>, <lipeng321@huawei.com>
Subject: Re: [RFCv5 PATCH net-next 04/20] net: replace multiple feature bits with netdev features array
Date: Thu, 24 Mar 2022 18:22:35 -0700	[thread overview]
Message-ID: <20220324182235.05dd0f53@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20220324154932.17557-5-shenjian15@huawei.com>

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.?

  reply	other threads:[~2022-03-25  1:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 15:49 [RFCv5 PATCH net-next 00/20] net: extend the type of netdev_features_t to bitmap Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 01/20] net: rename net_device->features to net_device->active_features Jian Shen
2022-03-25  0:58   ` Jakub Kicinski
2022-03-25  1:03     ` Jakub Kicinski
     [not found]       ` <2c493855-4084-8b5d-fed8-6faf8255faae@huawei.com>
2022-03-25  1:35         ` Jakub Kicinski
2022-03-25  3:13           ` shenjian (K)
2022-03-25 15:52           ` Andrew Lunn
2022-03-25 15:58             ` Jakub Kicinski
2022-03-25 16:51               ` Andrew Lunn
2022-03-24 15:49 ` [RFCv5 PATCH net-next 02/20] net: introduce operation helpers for netdev features Jian Shen
2022-03-25  1:09   ` Jakub Kicinski
2022-04-16  3:33     ` shenjian (K)
2022-04-16  7:42       ` Jakub Kicinski
2022-04-16  9:09         ` shenjian (K)
2022-03-24 15:49 ` [RFCv5 PATCH net-next 03/20] net: replace general features macroes with global netdev_features variables Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 04/20] net: replace multiple feature bits with netdev features array Jian Shen
2022-03-25  1:22   ` Jakub Kicinski [this message]
2022-03-25  3:32     ` shenjian (K)
2022-03-24 15:49 ` [RFCv5 PATCH net-next 05/20] net: sfc: replace const features initialization " Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 06/20] net: simplify the netdev features expression Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 07/20] net: adjust variables definition for netdev_features_t Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 08/20] net: use netdev_features_set_bit helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 09/20] net: use netdev_features_or helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 10/20] net: use netdev_features_xor helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 11/20] net: use netdev_features_clear_bit helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 12/20] net: use netdev_features_andnot helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 13/20] net: use netdev_features_test_bit helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 14/20] net: use netdev_features_intersects helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 15/20] net: use netdev_features_and helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 16/20] net: use netdev_features_subset helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 17/20] net: use netdev_features_equal helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 18/20] net: use netdev_set_xxx_features helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 19/20] net: use netdev_xxx_features helpers Jian Shen
2022-03-24 15:49 ` [RFCv5 PATCH net-next 20/20] net: redefine the prototype of netdev_features_t Jian Shen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220324182235.05dd0f53@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=alexandr.lobakin@intel.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=leon@kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=lipeng321@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@kernel.org \
    --cc=shenjian15@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).