* [PATCH net-next] IP_GRE: Fix IP-Identification.
@ 2013-02-22 2:18 Pravin B Shelar
2013-02-22 2:35 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Pravin B Shelar @ 2013-02-22 2:18 UTC (permalink / raw)
To: netdev; +Cc: edumazet, jesse, Pravin B Shelar
Use ip_select_ident_more() to generate and account ids for all
segments that can be used for segments of a gso packet.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
net/ipv4/af_inet.c | 6 ++++--
net/ipv4/ip_gre.c | 4 +++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index e225a4e..2992f37 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1327,8 +1327,10 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
if (skb->next != NULL)
iph->frag_off |= htons(IP_MF);
offset += (skb->len - skb->mac_len - iph->ihl * 4);
- } else
- iph->id = htons(id++);
+ } else {
+ if (!(iph->frag_off & htons(IP_DF)))
+ iph->id = htons(id++);
+ }
iph->tot_len = htons(skb->len - skb->mac_len);
iph->check = 0;
iph->check = ip_fast_csum(skb_network_header(skb), iph->ihl);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 5ef4da7..3c6f2e2 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -970,7 +970,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
iph->daddr = fl4.daddr;
iph->saddr = fl4.saddr;
iph->ttl = ttl;
- iph->id = 0;
+
+ ip_select_ident_more(iph, &rt->dst, NULL,
+ (skb_shinfo(skb)->gso_segs ?: 1) - 1);
if (ttl == 0) {
if (skb->protocol == htons(ETH_P_IP))
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next] IP_GRE: Fix IP-Identification.
2013-02-22 2:18 [PATCH net-next] IP_GRE: Fix IP-Identification Pravin B Shelar
@ 2013-02-22 2:35 ` Eric Dumazet
2013-02-22 3:42 ` Pravin Shelar
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2013-02-22 2:35 UTC (permalink / raw)
To: Pravin B Shelar; +Cc: netdev, edumazet, jesse
On Thu, 2013-02-21 at 18:18 -0800, Pravin B Shelar wrote:
> Use ip_select_ident_more() to generate and account ids for all
> segments that can be used for segments of a gso packet.
>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
I am not sure it makes any sense to do that.
Why is it needed ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] IP_GRE: Fix IP-Identification.
2013-02-22 2:35 ` Eric Dumazet
@ 2013-02-22 3:42 ` Pravin Shelar
2013-02-22 6:06 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Pravin Shelar @ 2013-02-22 3:42 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, edumazet, jesse
On Thu, Feb 21, 2013 at 6:35 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2013-02-21 at 18:18 -0800, Pravin B Shelar wrote:
>> Use ip_select_ident_more() to generate and account ids for all
>> segments that can be used for segments of a gso packet.
>>
>> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
>
> I am not sure it makes any sense to do that.
>
> Why is it needed ?
>
Without this patch GRE-GSO generates ip fragments with id 0,2,3,4...
for every GSO packet, which is not correct. This patch fixes it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] IP_GRE: Fix IP-Identification.
2013-02-22 3:42 ` Pravin Shelar
@ 2013-02-22 6:06 ` Eric Dumazet
2013-02-22 7:17 ` pravin
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2013-02-22 6:06 UTC (permalink / raw)
To: Pravin Shelar; +Cc: netdev, edumazet, jesse
On Thu, 2013-02-21 at 19:42 -0800, Pravin Shelar wrote:
> Without this patch GRE-GSO generates ip fragments with id 0,2,3,4...
> for every GSO packet, which is not correct. This patch fixes it.
> --
I guess my question was more : Why dont we inherit ID from the inner
packet ?
ip_select_ident_more() is a performance killer, as all cpus are going to
access a shared counter in the dst.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] IP_GRE: Fix IP-Identification.
2013-02-22 6:06 ` Eric Dumazet
@ 2013-02-22 7:17 ` pravin
0 siblings, 0 replies; 5+ messages in thread
From: pravin @ 2013-02-22 7:17 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Pravin Shelar, netdev, edumazet, jesse
On Thu, Feb 21, 2013 at 10:06 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2013-02-21 at 19:42 -0800, Pravin Shelar wrote:
>
>> Without this patch GRE-GSO generates ip fragments with id 0,2,3,4...
>> for every GSO packet, which is not correct. This patch fixes it.
>> --
>
> I guess my question was more : Why dont we inherit ID from the inner
> packet ?
>
Its good idea. But we still need to get counter from dst if inner
packet is not ipv4.
> ip_select_ident_more() is a performance killer, as all cpus are going to
> access a shared counter in the dst.
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-02-22 7:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22 2:18 [PATCH net-next] IP_GRE: Fix IP-Identification Pravin B Shelar
2013-02-22 2:35 ` Eric Dumazet
2013-02-22 3:42 ` Pravin Shelar
2013-02-22 6:06 ` Eric Dumazet
2013-02-22 7:17 ` pravin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox