diff mbox

[1/2] virtio: don't set VIRTIO_NET_HDR_F_DATA_VALID on xmit

Message ID 1493042985-20491-2-git-send-email-stefan.bader@canonical.com
State New
Headers show

Commit Message

Stefan Bader April 24, 2017, 2:09 p.m. UTC
From: Rolf Neugebauer <rolf.neugebauer@docker.com>

BugLink: http://bugs.launchpad.net/bugs/1685416

[ Upstream commit 501db511397fd6efff3aa5b4e8de415b55559550 ]

This patch part reverts fd2a0437dc33 and e858fae2b0b8 which introduced a
subtle change in how the virtio_net flags are derived from the SKBs
ip_summed field.

With the above commits, the flags are set to VIRTIO_NET_HDR_F_DATA_VALID
when ip_summed == CHECKSUM_UNNECESSARY, thus treating it differently to
ip_summed == CHECKSUM_NONE, which should be the same.

Further, the virtio spec 1.0 / CS04 explicitly says that
VIRTIO_NET_HDR_F_DATA_VALID must not be set by the driver.

Fixes: fd2a0437dc33 ("virtio_net: introduce virtio_net_hdr_{from,to}_skb")
Fixes: e858fae2b0b8 (" virtio_net: use common code for virtio_net_hdr and skb GSO conversion")
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry-picked from 3eab5dd0eb19b6ebed8ef7e7477d9f3048cc78fa linux-4.9.y)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 include/linux/virtio_net.h | 2 --
 1 file changed, 2 deletions(-)

Comments

Colin Ian King April 24, 2017, 3:26 p.m. UTC | #1
On 24/04/17 15:09, Stefan Bader wrote:
> From: Rolf Neugebauer <rolf.neugebauer@docker.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1685416
> 
> [ Upstream commit 501db511397fd6efff3aa5b4e8de415b55559550 ]
> 
> This patch part reverts fd2a0437dc33 and e858fae2b0b8 which introduced a
> subtle change in how the virtio_net flags are derived from the SKBs
> ip_summed field.
> 
> With the above commits, the flags are set to VIRTIO_NET_HDR_F_DATA_VALID
> when ip_summed == CHECKSUM_UNNECESSARY, thus treating it differently to
> ip_summed == CHECKSUM_NONE, which should be the same.
> 
> Further, the virtio spec 1.0 / CS04 explicitly says that
> VIRTIO_NET_HDR_F_DATA_VALID must not be set by the driver.
> 
> Fixes: fd2a0437dc33 ("virtio_net: introduce virtio_net_hdr_{from,to}_skb")
> Fixes: e858fae2b0b8 (" virtio_net: use common code for virtio_net_hdr and skb GSO conversion")
> Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> (cherry-picked from 3eab5dd0eb19b6ebed8ef7e7477d9f3048cc78fa linux-4.9.y)
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  include/linux/virtio_net.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> index 1c912f8..40914bb 100644
> --- a/include/linux/virtio_net.h
> +++ b/include/linux/virtio_net.h
> @@ -91,8 +91,6 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
>  				skb_checksum_start_offset(skb));
>  		hdr->csum_offset = __cpu_to_virtio16(little_endian,
>  				skb->csum_offset);
> -	} else if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
> -		hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
>  	} /* else everything is zero */
>  
>  	return 0;
> 

As long as the testing shows this works fine (as I see no testcase in
the bug report), then I'm happy with this.

Upstream cherry pick, known to fix issues on other kernels, looks sane
to me.

Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox

Patch

diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 1c912f8..40914bb 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -91,8 +91,6 @@  static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
 				skb_checksum_start_offset(skb));
 		hdr->csum_offset = __cpu_to_virtio16(little_endian,
 				skb->csum_offset);
-	} else if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
-		hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
 	} /* else everything is zero */
 
 	return 0;