All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-netfront: reset skb transport header before checksum
@ 2015-05-12  1:34 Venkat Venkatsubra
  2015-05-12  1:51 ` Eric Dumazet
  2015-05-12  1:51 ` Eric Dumazet
  0 siblings, 2 replies; 6+ messages in thread
From: Venkat Venkatsubra @ 2015-05-12  1:34 UTC (permalink / raw)
  To: netdev, xen-devel
  Cc: davem, david.vrabel, konrad.wilk, boris.ostrovsky, wei.liu2,
	paul.durrant

In ed1f50c3a ("net: add skb_checksum_setup") some checksum functions
were introduced in core. Subsequent change b5cf66cd1 ("xen-netfront:
use new skb_checksum_setup function") made use of those functions to
replace its own implementation. With that change ip_hdr() and tcp_hdr()
were not pointing at the right place. d554f73df ("xen-netfront: reset
skb network header before checksum") fixed the ip_hdr().

This patch fixes tcp_hdr().

We saw this problem when LRO was enabled on the host and it results in
netfront setting skb->ip_summed to CHECKSUM_UNNECESSARY.

Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
---
 drivers/net/xen-netfront.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 3f45afd..ed5c242 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -889,6 +889,7 @@ static int handle_incoming_queue(struct netfront_queue *queue,
 		/* Ethernet work: Delayed to here as it peeks the header. */
 		skb->protocol = eth_type_trans(skb, queue->info->netdev);
 		skb_reset_network_header(skb);
+		skb_set_transport_header(skb, ip_hdrlen(skb));
 
 		if (checksum_setup(queue->info->netdev, skb)) {
 			kfree_skb(skb);
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen-netfront: reset skb transport header before checksum
  2015-05-12  1:34 [PATCH] xen-netfront: reset skb transport header before checksum Venkat Venkatsubra
@ 2015-05-12  1:51 ` Eric Dumazet
  2015-05-12 14:00   ` Venkat Venkatsubra
  2015-05-12 14:00   ` Venkat Venkatsubra
  2015-05-12  1:51 ` Eric Dumazet
  1 sibling, 2 replies; 6+ messages in thread
From: Eric Dumazet @ 2015-05-12  1:51 UTC (permalink / raw)
  To: Venkat Venkatsubra
  Cc: netdev, xen-devel, davem, david.vrabel, konrad.wilk,
	boris.ostrovsky, wei.liu2, paul.durrant

On Mon, 2015-05-11 at 18:34 -0700, Venkat Venkatsubra wrote:
> In ed1f50c3a ("net: add skb_checksum_setup") some checksum functions
> were introduced in core. Subsequent change b5cf66cd1 ("xen-netfront:
> use new skb_checksum_setup function") made use of those functions to
> replace its own implementation. With that change ip_hdr() and tcp_hdr()
> were not pointing at the right place. d554f73df ("xen-netfront: reset
> skb network header before checksum") fixed the ip_hdr().
> 
> This patch fixes tcp_hdr().
> 
> We saw this problem when LRO was enabled on the host and it results in
> netfront setting skb->ip_summed to CHECKSUM_UNNECESSARY.
> 
> Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
> ---
>  drivers/net/xen-netfront.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index 3f45afd..ed5c242 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -889,6 +889,7 @@ static int handle_incoming_queue(struct netfront_queue *queue,
>  		/* Ethernet work: Delayed to here as it peeks the header. */
>  		skb->protocol = eth_type_trans(skb, queue->info->netdev);
>  		skb_reset_network_header(skb);
> +		skb_set_transport_header(skb, ip_hdrlen(skb));
>  
>  		if (checksum_setup(queue->info->netdev, skb)) {
>  			kfree_skb(skb);

This looks bogus for IPv6.

I would rather fix skb_checksum_setup_ip() and
skb_checksum_setup_ipv6(), since you already use correctly
skb_maybe_pull_tail() there.

In general, setting network and transport header at this point seems
extra work.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen-netfront: reset skb transport header before checksum
  2015-05-12  1:34 [PATCH] xen-netfront: reset skb transport header before checksum Venkat Venkatsubra
  2015-05-12  1:51 ` Eric Dumazet
@ 2015-05-12  1:51 ` Eric Dumazet
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2015-05-12  1:51 UTC (permalink / raw)
  To: Venkat Venkatsubra
  Cc: wei.liu2, netdev, paul.durrant, david.vrabel, xen-devel,
	boris.ostrovsky, davem

On Mon, 2015-05-11 at 18:34 -0700, Venkat Venkatsubra wrote:
> In ed1f50c3a ("net: add skb_checksum_setup") some checksum functions
> were introduced in core. Subsequent change b5cf66cd1 ("xen-netfront:
> use new skb_checksum_setup function") made use of those functions to
> replace its own implementation. With that change ip_hdr() and tcp_hdr()
> were not pointing at the right place. d554f73df ("xen-netfront: reset
> skb network header before checksum") fixed the ip_hdr().
> 
> This patch fixes tcp_hdr().
> 
> We saw this problem when LRO was enabled on the host and it results in
> netfront setting skb->ip_summed to CHECKSUM_UNNECESSARY.
> 
> Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
> ---
>  drivers/net/xen-netfront.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index 3f45afd..ed5c242 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -889,6 +889,7 @@ static int handle_incoming_queue(struct netfront_queue *queue,
>  		/* Ethernet work: Delayed to here as it peeks the header. */
>  		skb->protocol = eth_type_trans(skb, queue->info->netdev);
>  		skb_reset_network_header(skb);
> +		skb_set_transport_header(skb, ip_hdrlen(skb));
>  
>  		if (checksum_setup(queue->info->netdev, skb)) {
>  			kfree_skb(skb);

This looks bogus for IPv6.

I would rather fix skb_checksum_setup_ip() and
skb_checksum_setup_ipv6(), since you already use correctly
skb_maybe_pull_tail() there.

In general, setting network and transport header at this point seems
extra work.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] xen-netfront: reset skb transport header before checksum
  2015-05-12  1:51 ` Eric Dumazet
@ 2015-05-12 14:00   ` Venkat Venkatsubra
  2015-05-12 14:00   ` Venkat Venkatsubra
  1 sibling, 0 replies; 6+ messages in thread
From: Venkat Venkatsubra @ 2015-05-12 14:00 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, xen-devel, davem, david.vrabel, Konrad Wilk,
	Boris Ostrovsky, wei.liu2, paul.durrant

> 
> This looks bogus for IPv6.
> 
> I would rather fix skb_checksum_setup_ip() and
> skb_checksum_setup_ipv6(), since you already use correctly
> skb_maybe_pull_tail() there.
> 
> In general, setting network and transport header at this point seems
> extra work.
> 

Yes, I missed the IPv6 case. ;-) Thanks Eric for pointing that out.
Looking further the below commit might have already resolved the issue.

commit e5d5decaedf41f5b03e6819789cc3ba8744d9f54
Author: Jason Wang <jasowang@redhat.com>
Date:   Tue Mar 26 23:11:20 2013 +0000

    net: core: let skb_partial_csum_set() set transport header

    For untrusted packets with partial checksum, we need to set the transport he
    for precise packet length estimation. We can just let skb_pratial_csum_set()
    do this to avoid extra call to skb_flow_dissect() and simplify the caller.

    Cc: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Acked-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

The guest we were running was older to this and didn't have the above commit.

Thanks.

Venkat

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen-netfront: reset skb transport header before checksum
  2015-05-12  1:51 ` Eric Dumazet
  2015-05-12 14:00   ` Venkat Venkatsubra
@ 2015-05-12 14:00   ` Venkat Venkatsubra
  1 sibling, 0 replies; 6+ messages in thread
From: Venkat Venkatsubra @ 2015-05-12 14:00 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: wei.liu2, netdev, paul.durrant, david.vrabel, xen-devel,
	Boris Ostrovsky, davem

> 
> This looks bogus for IPv6.
> 
> I would rather fix skb_checksum_setup_ip() and
> skb_checksum_setup_ipv6(), since you already use correctly
> skb_maybe_pull_tail() there.
> 
> In general, setting network and transport header at this point seems
> extra work.
> 

Yes, I missed the IPv6 case. ;-) Thanks Eric for pointing that out.
Looking further the below commit might have already resolved the issue.

commit e5d5decaedf41f5b03e6819789cc3ba8744d9f54
Author: Jason Wang <jasowang@redhat.com>
Date:   Tue Mar 26 23:11:20 2013 +0000

    net: core: let skb_partial_csum_set() set transport header

    For untrusted packets with partial checksum, we need to set the transport he
    for precise packet length estimation. We can just let skb_pratial_csum_set()
    do this to avoid extra call to skb_flow_dissect() and simplify the caller.

    Cc: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Acked-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

The guest we were running was older to this and didn't have the above commit.

Thanks.

Venkat

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] xen-netfront: reset skb transport header before checksum
@ 2015-05-12  1:34 Venkat Venkatsubra
  0 siblings, 0 replies; 6+ messages in thread
From: Venkat Venkatsubra @ 2015-05-12  1:34 UTC (permalink / raw)
  To: netdev, xen-devel
  Cc: wei.liu2, paul.durrant, david.vrabel, boris.ostrovsky, davem

In ed1f50c3a ("net: add skb_checksum_setup") some checksum functions
were introduced in core. Subsequent change b5cf66cd1 ("xen-netfront:
use new skb_checksum_setup function") made use of those functions to
replace its own implementation. With that change ip_hdr() and tcp_hdr()
were not pointing at the right place. d554f73df ("xen-netfront: reset
skb network header before checksum") fixed the ip_hdr().

This patch fixes tcp_hdr().

We saw this problem when LRO was enabled on the host and it results in
netfront setting skb->ip_summed to CHECKSUM_UNNECESSARY.

Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
---
 drivers/net/xen-netfront.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 3f45afd..ed5c242 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -889,6 +889,7 @@ static int handle_incoming_queue(struct netfront_queue *queue,
 		/* Ethernet work: Delayed to here as it peeks the header. */
 		skb->protocol = eth_type_trans(skb, queue->info->netdev);
 		skb_reset_network_header(skb);
+		skb_set_transport_header(skb, ip_hdrlen(skb));
 
 		if (checksum_setup(queue->info->netdev, skb)) {
 			kfree_skb(skb);
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-12 14:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12  1:34 [PATCH] xen-netfront: reset skb transport header before checksum Venkat Venkatsubra
2015-05-12  1:51 ` Eric Dumazet
2015-05-12 14:00   ` Venkat Venkatsubra
2015-05-12 14:00   ` Venkat Venkatsubra
2015-05-12  1:51 ` Eric Dumazet
2015-05-12  1:34 Venkat Venkatsubra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.