Skip to contentSkip to conversation

tun: virtio net is not compatible with LRO

PATCH In review Chris Wright 3 participants 3 messages Jun 3, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tun: virtio net is not compatible with LRO

The current failure mode for an LRO device bridged to a virtio device (common for KVM) is BUG(). Rather than crashing the host, we can at least limp along and give a warning. lro_flush() will set gso_size, but no corresponding gso_type, unlike gro which will eventually call ->gro_complete and set up proper gso_type.

---
 drivers/net/tun.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/tun.c +9 -2
index 735bf41..17c4516 100644
@@ -717,8 +717,15 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
 				gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
 			else if (sinfo->gso_type & SKB_GSO_TCPV6)
 				gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
-			else
-				BUG();
+			else {
+				WARN_ONCE(1, "%s: hdr_len %d gso_size %d "
+					   "gso_type %x.  virtio is not "
+					   "compatible with LRO, verify NIC "
+					    "isn't using LRO", __func__,
+					    gso.hdr_len, gso.gso_size,
+					    sinfo->gso_type);
+				return -EINVAL;
+			}
 			if (sinfo->gso_type & SKB_GSO_TCP_ECN)
 				gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN;
 		} else
#1 lore raw
Quoted 5 lines · Chris Wright

The current failure mode for an LRO device bridged to a virtio device (common for KVM) is BUG(). Rather than crashing the host, we can at least limp along and give a warning. lro_flush() will set gso_size, but no corresponding gso_type, unlike gro which will eventually call ->gro_complete and set up proper gso_type.

So, skb_is_gso() is true, but it's not actually a gso frame?

I know nothing about LRO, but that seems wrong. If you bridge any other GSO device with an LRO device, does that do random things as well?

Thanks,
Rusty.

#2 lore raw
Quoted 5 lines · Rusty Russell

So, skb_is_gso() is true, but it's not actually a gso frame?

I know nothing about LRO, but that seems wrong. If you bridge any other GSO device with an LRO device, does that do random things as well?

Yeah you don't want to know about LRO. The good news is that LRO is going away so this is temporary.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt