From patchwork Wed Jun 3 05:23:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wright X-Patchwork-Id: 28036 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 5B5CAB7069 for ; Wed, 3 Jun 2009 15:24:35 +1000 (EST) Received: by ozlabs.org (Postfix) id 4C45BDDDFF; Wed, 3 Jun 2009 15:24:35 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 2E964DDDFD for ; Wed, 3 Jun 2009 15:24:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752238AbZFCFYY (ORCPT ); Wed, 3 Jun 2009 01:24:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752822AbZFCFYX (ORCPT ); Wed, 3 Jun 2009 01:24:23 -0400 Received: from sous-sol.org ([216.99.217.87]:52472 "EHLO sequoia.sous-sol.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752107AbZFCFYX (ORCPT ); Wed, 3 Jun 2009 01:24:23 -0400 Received: from sequoia.sous-sol.org (sequoia.sous-sol.org [127.0.0.1]) by sequoia.sous-sol.org (8.14.2/8.14.2) with ESMTP id n535NaC1026844; Tue, 2 Jun 2009 22:23:36 -0700 Received: (from chrisw@localhost) by sequoia.sous-sol.org (8.14.2/8.14.2/Submit) id n535NZVI026843; Tue, 2 Jun 2009 22:23:35 -0700 Date: Tue, 2 Jun 2009 22:23:35 -0700 From: Chris Wright To: David Miller Cc: netdev@vger.kernel.org, Herbert Xu , Rusty Russell Subject: [PATCH] tun: virtio net is not compatible with LRO Message-ID: <20090603052335.GA20823@sequoia.sous-sol.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on sequoia.sous-sol.org X-Virus-Status: Clean Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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 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