Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] ipv4: use a 64bit load/store in output path
Date: Thu, 01 Dec 2011 08:28:41 +0100	[thread overview]
Message-ID: <1322724521.2577.29.camel@edumazet-laptop> (raw)
In-Reply-To: <20111201.014813.1241057161065435427.davem@davemloft.net>

Le jeudi 01 décembre 2011 à 01:48 -0500, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 01 Dec 2011 06:00:53 +0100
> 
> > gcc compiler is smart enough to use a single load/store if we
> > memcpy(dptr, sptr, 8) on x86_64, regardless of
> > CONFIG_CC_OPTIMIZE_FOR_SIZE
> >     
> > In IP header, daddr immediately follows saddr, this wont change in the
> > future. We only need to make sure our flowi4 (saddr,daddr) fields wont
> > break the rule.
> > 
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Hmmm, this triggers a strange new build warning:
> 
> net/dccp/ipv4.c: In function ‘dccp_v4_route_skb’:
> net/dccp/ipv4.c:481:3: warning: initialized field with side-effects overwritten [enabled by default]
> net/dccp/ipv4.c:481:3: warning: (near initialization for ‘fl4’) [enabled by default]

Hmm, seems a compiler bug, since following fixes the warning ?

[PATCH net-next] dccp: fix a compiler warning

net/dccp/ipv4.c: In function ‘dccp_v4_route_skb’:
net/dccp/ipv4.c:481:3: warning: initialized field with
	side-effects overwritten [enabled by default]
net/dccp/ipv4.c:481:3: warning: (near initialization
	for ‘fl4’) [enabled by default]


Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/dccp/ipv4.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 3f4e541..1c67fe8 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -474,10 +474,11 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
 					   struct sk_buff *skb)
 {
 	struct rtable *rt;
+	const struct iphdr *iph = ip_hdr(skb);
 	struct flowi4 fl4 = {
 		.flowi4_oif = skb_rtable(skb)->rt_iif,
-		.daddr = ip_hdr(skb)->saddr,
-		.saddr = ip_hdr(skb)->daddr,
+		.daddr = iph->saddr,
+		.saddr = iph->daddr,
 		.flowi4_tos = RT_CONN_FLAGS(sk),
 		.flowi4_proto = sk->sk_protocol,
 		.fl4_sport = dccp_hdr(skb)->dccph_dport,

  reply	other threads:[~2011-12-01  7:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01  5:00 [PATCH net-next] ipv4: use a 64bit load/store in output path Eric Dumazet
2011-12-01  6:48 ` David Miller
2011-12-01  7:28   ` Eric Dumazet [this message]
2011-12-01 18:32     ` David Miller

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=1322724521.2577.29.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --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