From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: maheshb@google.com, netdev@vger.kernel.org, therbert@google.com,
mirqus@gmail.com, shemminger@vyatta.com
Subject: Re: [PATCHv3] net: Define enum for the bits used in features.
Date: Mon, 6 Jun 2011 06:58:08 +0300 [thread overview]
Message-ID: <20110606035808.GA28858@redhat.com> (raw)
In-Reply-To: <20110604.133438.1450652272927306428.davem@davemloft.net>
On Sat, Jun 04, 2011 at 01:34:38PM -0700, David Miller wrote:
> From: Mahesh Bandewar <maheshb@google.com>
> Date: Wed, 25 May 2011 15:42:16 -0700
>
> > Little bit cleanup by defining enum for all bits used. Also use those enum
> > values to redefine flags.
> >
> > Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> > ---
> > Changes since v2:
> > (1) Removed the include which was part of the other patch (split mishap).
> > (2) Changed the enums to add NETIF_F_ prefix.
>
> I hate to be a pain after you've put so much work into these patches,
> but I simply don't like this approach.
>
> I think the abstracted interfaces should come first. You don't need to
> change any of the NETIF_F_* defines in order to do that. You should only
> need to add the netdev_{set,clear,test}_*() macros.
>
> If you want you can make the "bit" argument be the flag name after the
> NETIF_F_ prefix, so "netdev_test_active_feature(dev, SG)"
>
> Then you convert every single access.
>
> Then you make the flags type opaque, which should at that point be a
> 6 line change at best.
>
> And then you can implement the flags however you want.
I've been thinking about this as well. It turns out most
things above can be done with the spatch (aka coccinelle) tool.
But I think the largest problem is what to do with multiple-feature
macros such as NETIF_F_GSO_SOFTWARE.
If we keep them an 'or' of bits, we more or less commit to
an implementation that can represent them all in a single
constant.
I played with variadic macros but could not come up with something
that does not generate a lot of code.
Ideas?
--
MST
next prev parent reply other threads:[~2011-06-06 3:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-24 18:52 [PATCH] net: Abstract features usage Mahesh Bandewar
2011-05-24 19:37 ` Michał Mirosław
2011-05-24 20:29 ` Mahesh Bandewar
2011-05-24 21:49 ` Michał Mirosław
2011-05-24 23:11 ` Mahesh Bandewar
2011-05-24 21:29 ` Stephen Hemminger
2011-05-24 23:04 ` Mahesh Bandewar
2011-05-24 23:11 ` Stephen Hemminger
2011-05-24 23:25 ` Mahesh Bandewar
2011-05-25 1:55 ` [PATCHv2] " Mahesh Bandewar
2011-05-25 22:43 ` [PATCHv3] " Mahesh Bandewar
2011-05-25 1:56 ` [PATCHv2] net: Define enum for the bits used in features Mahesh Bandewar
2011-05-25 7:58 ` Hagen Paul Pfeifer
2011-05-25 9:43 ` Michał Mirosław
2011-05-25 9:48 ` Michał Mirosław
2011-05-25 18:05 ` Mahesh Bandewar
2011-05-25 22:42 ` [PATCHv3] " Mahesh Bandewar
2011-05-26 10:40 ` Michał Mirosław
2011-05-27 9:25 ` [RFC PATCH] net: ethtool: use C99 array initialization for feature-names table Michał Mirosław
2011-06-04 20:34 ` [PATCHv3] net: Define enum for the bits used in features David Miller
2011-06-06 3:58 ` Michael S. Tsirkin [this message]
2011-06-06 5:15 ` David Miller
2011-06-06 15:32 ` Michael S. Tsirkin
2011-06-06 19:20 ` David Miller
2011-06-06 20:35 ` Michael S. Tsirkin
2011-06-09 16:46 ` Michael S. Tsirkin
2011-06-09 20:12 ` Michael S. Tsirkin
2011-06-08 6:55 ` Mahesh Bandewar
2011-06-06 15:48 ` Michał Mirosław
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=20110606035808.GA28858@redhat.com \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=maheshb@google.com \
--cc=mirqus@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=therbert@google.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).