* [PATCH next-next 5/6] net: Call skb_checksum_init in IPv6
@ 2014-04-05 0:28 Tom Herbert
2014-04-07 17:15 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Tom Herbert @ 2014-04-05 0:28 UTC (permalink / raw)
To: davem, netdev
Tested by running 20 netperf TCP_STREAMs with combinations of
LRO on/off, rx-csum-offload on/off, device provide checksum-complete
(emulated) with occasional incorrect value.
Signed-off-by: Tom Herbert <therbert@google.com>
---
include/net/ip6_checksum.h | 2 ++
net/core/checksum.c | 1 +
net/ipv6/ip6_checksum.c | 19 +++++++++----------
net/ipv6/tcp_ipv6.c | 21 +--------------------
4 files changed, 13 insertions(+), 30 deletions(-)
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 9e3c540..2df805b 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -41,6 +41,8 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
__wsum csum);
#endif
+__wsum ip6_pseudo_compute(struct sk_buff *skb, int proto);
+
static __inline__ __sum16 tcp_v6_check(int len,
const struct in6_addr *saddr,
const struct in6_addr *daddr,
diff --git a/net/core/checksum.c b/net/core/checksum.c
index b0df8c7..33249c3 100644
--- a/net/core/checksum.c
+++ b/net/core/checksum.c
@@ -56,3 +56,4 @@ __sum16 __skb_checksum_validate(struct sk_buff *skb, int proto, bool complete,
return 0;
}
+EXPORT_SYMBOL(__skb_checksum_validate);
diff --git a/net/ipv6/ip6_checksum.c b/net/ipv6/ip6_checksum.c
index ee7a97f..6105b8f 100644
--- a/net/ipv6/ip6_checksum.c
+++ b/net/ipv6/ip6_checksum.c
@@ -62,6 +62,14 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
EXPORT_SYMBOL(csum_ipv6_magic);
#endif
+__wsum ip6_pseudo_compute(struct sk_buff *skb, int proto)
+{
+ return ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+ &ipv6_hdr(skb)->daddr,
+ skb->len, proto, 0));
+}
+EXPORT_SYMBOL(ip6_pseudo_compute);
+
int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto)
{
int err;
@@ -84,16 +92,7 @@ int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto)
&ipv6_hdr(skb)->daddr, ntohs(uh->dest));
return 1;
}
- if (skb->ip_summed == CHECKSUM_COMPLETE &&
- !csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
- skb->len, proto, skb->csum))
- skb->ip_summed = CHECKSUM_UNNECESSARY;
-
- if (!skb_csum_unnecessary(skb))
- skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
- &ipv6_hdr(skb)->daddr,
- skb->len, proto, 0));
- return 0;
+ return skb_checksum_init(skb, IPPROTO_UDP, ip6_pseudo_compute);
}
EXPORT_SYMBOL(udp6_csum_init);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 5ca56ce..ee873e1 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1294,25 +1294,6 @@ out:
return NULL;
}
-static __sum16 tcp_v6_checksum_init(struct sk_buff *skb)
-{
- if (skb->ip_summed == CHECKSUM_COMPLETE) {
- if (!tcp_v6_check(skb->len, &ipv6_hdr(skb)->saddr,
- &ipv6_hdr(skb)->daddr, skb->csum)) {
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- return 0;
- }
- }
-
- skb->csum = ~csum_unfold(tcp_v6_check(skb->len,
- &ipv6_hdr(skb)->saddr,
- &ipv6_hdr(skb)->daddr, 0));
-
- if (skb->len <= 76)
- return __skb_checksum_complete(skb);
- return 0;
-}
-
/* The socket must have it's spinlock held when we get
* here.
*
@@ -1486,7 +1467,7 @@ static int tcp_v6_rcv(struct sk_buff *skb)
if (!pskb_may_pull(skb, th->doff*4))
goto discard_it;
- if (!skb_csum_unnecessary(skb) && tcp_v6_checksum_init(skb))
+ if (skb_checksum_init(skb, IPPROTO_TCP, ip6_pseudo_compute))
goto csum_error;
th = tcp_hdr(skb);
--
1.9.1.423.g4596e3a
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH next-next 5/6] net: Call skb_checksum_init in IPv6
2014-04-05 0:28 [PATCH next-next 5/6] net: Call skb_checksum_init in IPv6 Tom Herbert
@ 2014-04-07 17:15 ` David Miller
2014-04-07 20:46 ` Tom Herbert
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2014-04-07 17:15 UTC (permalink / raw)
To: therbert; +Cc: netdev
From: Tom Herbert <therbert@google.com>
Date: Fri, 4 Apr 2014 17:28:09 -0700 (PDT)
> @@ -62,6 +62,14 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
> EXPORT_SYMBOL(csum_ipv6_magic);
> #endif
>
> +__wsum ip6_pseudo_compute(struct sk_buff *skb, int proto)
> +{
> + return ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
> + &ipv6_hdr(skb)->daddr,
> + skb->len, proto, 0));
> +}
> +EXPORT_SYMBOL(ip6_pseudo_compute);
Similarly to the ipv4 case this should really be inline.
I see what the problem is, you've made this now a callback so now it
can't be really inlined any more.
That's really a terrible negative to this set of changes, please see
if you can avoid that and inline all of this exactly how it is done
now in the input paths.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH next-next 5/6] net: Call skb_checksum_init in IPv6
2014-04-07 17:15 ` David Miller
@ 2014-04-07 20:46 ` Tom Herbert
0 siblings, 0 replies; 3+ messages in thread
From: Tom Herbert @ 2014-04-07 20:46 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List
On Mon, Apr 7, 2014 at 10:15 AM, David Miller <davem@davemloft.net> wrote:
> From: Tom Herbert <therbert@google.com>
> Date: Fri, 4 Apr 2014 17:28:09 -0700 (PDT)
>
>> @@ -62,6 +62,14 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
>> EXPORT_SYMBOL(csum_ipv6_magic);
>> #endif
>>
>> +__wsum ip6_pseudo_compute(struct sk_buff *skb, int proto)
>> +{
>> + return ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
>> + &ipv6_hdr(skb)->daddr,
>> + skb->len, proto, 0));
>> +}
>> +EXPORT_SYMBOL(ip6_pseudo_compute);
>
> Similarly to the ipv4 case this should really be inline.
>
> I see what the problem is, you've made this now a callback so now it
> can't be really inlined any more.
>
> That's really a terrible negative to this set of changes, please see
> if you can avoid that and inline all of this exactly how it is done
> now in the input paths.
>
Okay, but it's going to be hard to do without resorting to macro's I think...
> Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-07 20:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-05 0:28 [PATCH next-next 5/6] net: Call skb_checksum_init in IPv6 Tom Herbert
2014-04-07 17:15 ` David Miller
2014-04-07 20:46 ` Tom Herbert
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).