public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Ling Ma <ling.ma.program@gmail.com>
Subject: Re: [PATCH net-next] net: move inet_dport/inet_num in sock_common
Date: Tue, 27 Nov 2012 19:13:31 -0800	[thread overview]
Message-ID: <1354072411.14302.46.camel@edumazet-glaptop> (raw)
In-Reply-To: <1354051401.14302.40.camel@edumazet-glaptop>

On Tue, 2012-11-27 at 13:23 -0800, Eric Dumazet wrote:
> On Tue, 2012-11-27 at 19:05 +0000, Ben Hutchings wrote:
> > On Tue, 2012-11-27 at 07:06 -0800, Eric Dumazet wrote:
> 
> > >  struct sock_common {
> > > -	/* skc_daddr and skc_rcv_saddr must be grouped :
> > > -	 * cf INET_MATCH() and INET_TW_MATCH()
> > > +	/* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned
> > > +	 * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH()
> > 
> > __aligned(8)?
> 
> Nope, only on 64 bit this requirement exists (since a long time)
> 
> I am not sure we want complexity on this.
> 
> And we dont want holes to be automatically added here neither.

Hmm, maybe the following could be the right way, as we did
for skc_hash/skc_u16hashes


 struct sock_common {
-       /* skc_daddr and skc_rcv_saddr must be grouped :
-        * cf INET_MATCH() and INET_TW_MATCH()
+       /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned
+        * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH()
         */
-       __be32                  skc_daddr;
-       __be32                  skc_rcv_saddr;
-
+       union {
+               unsigned long   skc_laddr;
+               struct {
+                       __be32  skc_daddr;
+                       __be32  skc_rcv_saddr;
+               };
+       };
        union  {
                unsigned int    skc_hash;
                __u16           skc_u16hashes[2];
        };
+       /* skc_dport && skc_num must be grouped as well */
+       union {
+               unsigned int    skc_ports;
+               struct {
+                       __be16  skc_dport;
+                       __u16   skc_num;
+               };
+       };
+
        unsigned short          skc_family;
        volatile unsigned char  skc_state;
        unsigned char           skc_reuse;

      reply	other threads:[~2012-11-28  3:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 15:06 [PATCH net-next] net: move inet_dport/inet_num in sock_common Eric Dumazet
2012-11-27 17:23 ` Joe Perches
2012-11-27 21:24   ` Eric Dumazet
2012-11-28  2:23     ` Joe Perches
2012-11-28  3:12       ` Ben Hutchings
2012-11-28  3:31         ` Joe Perches
2012-11-28  3:55           ` Ben Hutchings
2012-11-28  4:11       ` Eric Dumazet
2012-11-28 11:27         ` Eric Dumazet
2012-11-28 12:56           ` [PATCH v2 " Eric Dumazet
2012-11-28 16:48             ` David Miller
2012-11-28 17:02               ` David Miller
2012-11-28 17:18                 ` Eric Dumazet
2012-11-28 18:20             ` Eric Dumazet
2012-11-27 19:05 ` [PATCH " Ben Hutchings
2012-11-27 21:23   ` Eric Dumazet
2012-11-28  3:13     ` Eric Dumazet [this message]

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=1354072411.14302.46.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=ling.ma.program@gmail.com \
    --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