From: Jeff Garzik <jeff@garzik.org>
To: Brian King <brking@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, rcjenn@linux.vnet.ibm.com,
santil@linux.vnet.ibm.com, netdev@vger.kernel.org
Subject: Re: [PATCH 6/6] ibmveth: Remove use of bitfields
Date: Tue, 07 Aug 2007 17:56:49 -0400 [thread overview]
Message-ID: <46B8EAA1.8070003@garzik.org> (raw)
In-Reply-To: <200708061942.l76JgmxI031698@d03av01.boulder.ibm.com>
Brian King wrote:
> Removes the use of bitfields from the ibmveth driver. This results
> in slightly smaller object code.
>
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> ---
>
> linux-2.6-bjking1/drivers/net/ibmveth.c | 90 ++++++++++++++++----------------
> linux-2.6-bjking1/drivers/net/ibmveth.h | 56 ++++++++-----------
> 2 files changed, 68 insertions(+), 78 deletions(-)
strong ACK :)
Though I also encourage you to avoid #defines for named constants, in
favor of
enum {
IBMVETH_BUF_VALID = (1U << 31),
IBMVETH_BUF_TOGGLE = (1U << 30),
IBMVETH_BUF_NO_CSUM = (1U << 25),
IBMVETH_BUF_CSUM_GOOD = (1U << 24),
IBMVETH_BUF_LEN_MASK = 0x00FFFFFF,
};
This illustrates:
1) The "1 << n" notation is FAR easier to read and compare with data
sheets. You're just adding to the trouble by requiring the reviewer's
brain to convert hex numbers to bits, even if most engineers can do this
in their sleep.
2) The named constants are available to the C compiler, which is more
friendly to debuggers. It also supplies type information to the C compiler.
3) Similar to #2, wading through C pre-processor output is much easier
when the symbols don't disappear.
These are recommendations, not requirements, but I've found these
techniques superior to cpp in many other drivers.
Jeff
next prev parent reply other threads:[~2007-08-07 21:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-06 19:42 [PATCH 1/6] ibmveth: Enable TCP checksum offload Brian King
2007-08-06 19:42 ` [PATCH 2/6] ibmveth: Implement ethtool hooks to enable/disable " Brian King
2007-08-07 21:48 ` Jeff Garzik
2007-08-07 22:07 ` Brian King
2007-08-07 22:16 ` Jeff Garzik
2007-08-06 19:42 ` [PATCH 3/6] ibmveth: Add ethtool TSO handlers Brian King
2007-08-07 21:50 ` Jeff Garzik
2007-08-06 19:42 ` [PATCH 4/6] ibmveth: Add ethtool driver stats hooks Brian King
2007-08-07 21:50 ` Jeff Garzik
2007-08-06 19:42 ` [PATCH 5/6] ibmveth: Remove dead frag processing code Brian King
2007-08-06 19:42 ` [PATCH 6/6] ibmveth: Remove use of bitfields Brian King
2007-08-07 21:56 ` Jeff Garzik [this message]
2007-08-07 21:46 ` [PATCH 1/6] ibmveth: Enable TCP checksum offload Jeff Garzik
-- strict thread matches above, loose matches on Subject: below --
2007-08-10 19:28 Brian King
2007-08-10 19:29 ` [PATCH 6/6] ibmveth: Remove use of bitfields Brian King
2007-08-17 14:16 [PATCH 1/6] ibmveth: Enable TCP checksum offload Brian King
2007-08-17 14:16 ` [PATCH 6/6] ibmveth: Remove use of bitfields Brian King
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=46B8EAA1.8070003@garzik.org \
--to=jeff@garzik.org \
--cc=brking@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=rcjenn@linux.vnet.ibm.com \
--cc=santil@linux.vnet.ibm.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).