All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "shenjian (K)" <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 02/20] net: introduce operation helpers for netdev features
Date: Sat, 16 Apr 2022 09:42:46 +0200	[thread overview]
Message-ID: <20220416094246.43b34dd6@kernel.org> (raw)
In-Reply-To: <752c07fc-2417-1685-5950-8d8770b9f048@huawei.com>

On Sat, 16 Apr 2022 11:33:58 +0800 shenjian (K) wrote:
> 在 2022/3/25 9:09, Jakub Kicinski 写道:
> > On Thu, 24 Mar 2022 23:49:14 +0800 Jian Shen wrote:  
> >> Introduce a set of bitmap operation helpers for netdev features,
> >> then we can use them to replace the logical operation with them.
> >> As the nic driversare not supposed to modify netdev_features
> >> directly, it also introduces wrappers helpers to this.
> >>
> >> The implementation of these helpers are based on the old prototype
> >> of netdev_features_t is still u64. I will rewrite them on the last
> >> patch, when the prototype changes.
> >>
> >> Signed-off-by: Jian Shen <shenjian15@huawei.com>
> >> ---
> >>   include/linux/netdevice.h | 597 ++++++++++++++++++++++++++++++++++++++  
> > Please move these helpers to a new header file which won't be included
> > by netdevice.h and include it at users appropriately.  
> I introduced a new header file "netdev_features_helper",  and moved 
> thses helpers
> to it.  Some helpers need to include struct  net_device which defined in 
> netdevice.h,
> but there are also some inline functions in netdevice.h need to use 
> these netdev_features
> helpers. It's conflicted.
> 
> So far I thought 3 ways to solved it, but all of them are not satisfactory.
> 1) Split netdevice.h, move the definition of struct net_device and its 
> relative definitions to
> a new header file A( haven't got a reasonable name).  Both the 
> netdev_features_helper.h
> and the netdevice include A.
> 
> 2) Split netdevice.h, move the inline functions to a new header file B. 
> The netdev_features_helper.h
> inlucde netdevice.h, and B include netdev_features_helper.h and 
> netdevice.h. All the source files
> which using these ininline functions should include B.
> 
> 3) Split netdevice.h, move the inline functions to to 
> netdev_featurer_helper.h. The netdev_features_helper.h
> inlucde netdevice.h, All the source files which using these ininline 
> functions should include netde_features_helper.h.
> 
> I'd like to get more advice to this.

Larger surgery is probably too much. What does netdevice.h need? Looks
like it mostly needs the type and the helper for testing if feature is
set. So maybe we can put those in netdevice.h and the rest in a new
header?
More advanced helpers like netdev_get_wanted_features() can move to the
new header as well.

  reply	other threads:[~2022-04-16  7:43 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 [this message]
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
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=20220416094246.43b34dd6@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.