* [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit.
@ 2013-01-15 4:47 Harvey Yang
2013-01-15 4:48 ` David Miller
2013-01-15 4:57 ` Eric Dumazet
0 siblings, 2 replies; 4+ messages in thread
From: Harvey Yang @ 2013-01-15 4:47 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI
Cc: netdev, linux-kernel, Harvey Yang
The destination address daddr is faddr if source route option is set, otherwise it is inet_daddr. So use if-else to assign the value.
Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
---
net/ipv4/ip_output.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 3e98ed2..22b738c 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -349,10 +349,10 @@ int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl)
__be32 daddr;
/* Use correct destination address if we have options. */
- daddr = inet->inet_daddr;
if (inet_opt && inet_opt->opt.srr)
daddr = inet_opt->opt.faddr;
-
+ else
+ daddr = inet->inet_daddr;
/* If this fails, retransmit mechanism of transport layer will
* keep trying until route appears or the connection times
* itself out.
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit.
2013-01-15 4:47 [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit Harvey Yang
@ 2013-01-15 4:48 ` David Miller
2013-01-15 4:57 ` Eric Dumazet
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-01-15 4:48 UTC (permalink / raw)
To: harvey.huawei.yang; +Cc: kuznet, jmorris, yoshfuji, netdev, linux-kernel
From: Harvey Yang <harvey.huawei.yang@gmail.com>
Date: Tue, 15 Jan 2013 12:47:35 +0800
> The destination address daddr is faddr if source route option is set, otherwise it is inet_daddr. So use if-else to assign the value.
>
> Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
You are changing nothing in how this code behaves. And stylistically
I know it was coded this way on purpose, because I'm pretty sure I
wrote it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit.
2013-01-15 4:47 [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit Harvey Yang
2013-01-15 4:48 ` David Miller
@ 2013-01-15 4:57 ` Eric Dumazet
2013-01-15 10:12 ` Cong Ding
1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2013-01-15 4:57 UTC (permalink / raw)
To: Harvey Yang
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, netdev, linux-kernel
On Tue, 2013-01-15 at 12:47 +0800, Harvey Yang wrote:
> The destination address daddr is faddr if source route option is set, otherwise it is inet_daddr. So use if-else to assign the value.
>
> Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
> ---
> net/ipv4/ip_output.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 3e98ed2..22b738c 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -349,10 +349,10 @@ int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl)
> __be32 daddr;
>
> /* Use correct destination address if we have options. */
> - daddr = inet->inet_daddr;
> if (inet_opt && inet_opt->opt.srr)
> daddr = inet_opt->opt.faddr;
> -
> + else
> + daddr = inet->inet_daddr;
> /* If this fails, retransmit mechanism of transport layer will
> * keep trying until route appears or the connection times
> * itself out.
Current code is faster, srr is not often used.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit.
2013-01-15 4:57 ` Eric Dumazet
@ 2013-01-15 10:12 ` Cong Ding
0 siblings, 0 replies; 4+ messages in thread
From: Cong Ding @ 2013-01-15 10:12 UTC (permalink / raw)
To: Eric Dumazet
Cc: Harvey Yang, David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, netdev, linux-kernel
On Mon, Jan 14, 2013 at 08:57:09PM -0800, Eric Dumazet wrote:
> On Tue, 2013-01-15 at 12:47 +0800, Harvey Yang wrote:
> > The destination address daddr is faddr if source route option is set, otherwise it is inet_daddr. So use if-else to assign the value.
> >
> > Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
> > ---
> > net/ipv4/ip_output.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> > index 3e98ed2..22b738c 100644
> > --- a/net/ipv4/ip_output.c
> > +++ b/net/ipv4/ip_output.c
> > @@ -349,10 +349,10 @@ int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl)
> > __be32 daddr;
> >
> > /* Use correct destination address if we have options. */
> > - daddr = inet->inet_daddr;
> > if (inet_opt && inet_opt->opt.srr)
> > daddr = inet_opt->opt.faddr;
> > -
> > + else
> > + daddr = inet->inet_daddr;
> > /* If this fails, retransmit mechanism of transport layer will
> > * keep trying until route appears or the connection times
> > * itself out.
>
> Current code is faster, srr is not often used.
If you turn on O2 option in GCC, both versions behave the same (generate same
binary code). If srr is not often used, why not use unlikely() macro?
- cong
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-15 10:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 4:47 [PATCH 1/1] net: ipv4: refine the logic for determining daddr in ip_queue_xmit Harvey Yang
2013-01-15 4:48 ` David Miller
2013-01-15 4:57 ` Eric Dumazet
2013-01-15 10:12 ` Cong Ding
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).