Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <David.Laight@ACULAB.COM>, <amwang@redhat.com>,
	<netdev@vger.kernel.org>, <horms@verge.net.au>
Subject: Re: [Patch net-next v3] net: clean up skb headers code
Date: Thu, 30 May 2013 22:05:18 +0100	[thread overview]
Message-ID: <1369947918.2414.28.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <20130530.131603.1155012584617016387.davem@davemloft.net>

On Thu, 2013-05-30 at 13:16 -0700, David Miller wrote:
> From: "David Laight" <David.Laight@ACULAB.COM>
> Date: Thu, 30 May 2013 12:18:13 +0100
> 
> >> commit 1a37e412a0225fcba5587 (net: Use 16bits for *_headers
> >> fields of struct skbuff) converts skb->*_header to u16,
> >> some #if NET_SKBUFF_DATA_USES_OFFSET are now useless,
> >> and to be safe, we could just use "X = ~(typeof(X))0;"
> >> as suggested by David and Ben.
> > 
> > IIRC ~(unsigned short)0 is the same as ~0 and will be -1.
> > define an actual constant with value 0xffff
> 
> The problem with doing that is that if this type is changed again,
> we'lll go through this same circus changing the constant everywhere
> and missing some cases.
> 
> I absolutely want to see a version of this fix that makes sure that if
> the type changes, either the constantly automatically change (that's
> the "typeof(X)" approach) or the build breaks spectacularly until the
> value is fixed up.

Let's just give the 'invalid' value a name and define it right next to
those fields.  It might be worth reintroducing sk_buff_data_t too, since
there was at least one place which wanted to save and restore offsets in
local variables.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  reply	other threads:[~2013-05-30 21:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30  2:06 [Patch net-next v3] net: clean up skb headers code Cong Wang
2013-05-30 11:18 ` David Laight
2013-05-30 20:16   ` David Miller
2013-05-30 21:05     ` Ben Hutchings [this message]
2013-05-31  0:18       ` Simon Horman
2013-05-31  0:25 ` Simon Horman

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=1369947918.2414.28.camel@bwh-desktop.uk.level5networks.com \
    --to=bhutchings@solarflare.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=netdev@vger.kernel.org \
    /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