diff mbox

tun: virtio net is not compatible with LRO

Message ID 20090603052335.GA20823@sequoia.sous-sol.org
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Chris Wright June 3, 2009, 5:23 a.m. UTC
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.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
 drivers/net/tun.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

--
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

Comments

Rusty Russell June 3, 2009, 7:22 a.m. UTC | #1
On Wed, 3 Jun 2009 02:53:35 pm Chris Wright wrote:
> 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.
--
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
Herbert Xu June 3, 2009, 7:59 a.m. UTC | #2
On Wed, Jun 03, 2009 at 04:52:55PM +0930, Rusty Russell wrote:
>
> 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,
diff mbox

Patch

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 735bf41..17c4516 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -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