From owner-svn-src-head@FreeBSD.ORG Mon Jun 16 04:29:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E9ABB4F1; Mon, 16 Jun 2014 04:29:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD1712289; Mon, 16 Jun 2014 04:29:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5G4TScm056432; Mon, 16 Jun 2014 04:29:28 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5G4TSJj056431; Mon, 16 Jun 2014 04:29:28 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201406160429.s5G4TSJj056431@svn.freebsd.org> From: Bryan Venteicher Date: Mon, 16 Jun 2014 04:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267523 - head/sys/dev/virtio/network X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jun 2014 04:29:29 -0000 Author: bryanv Date: Mon Jun 16 04:29:28 2014 New Revision: 267523 URL: http://svnweb.freebsd.org/changeset/base/267523 Log: Make the feature negotiation code easier to follow MFC after: 1 week Modified: head/sys/dev/virtio/network/if_vtnet.c Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Mon Jun 16 04:25:04 2014 (r267522) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Jun 16 04:29:28 2014 (r267523) @@ -552,37 +552,38 @@ vtnet_negotiate_features(struct vtnet_so mask |= VTNET_TSO_FEATURES; if (vtnet_tunable_int(sc, "lro_disable", vtnet_lro_disable)) mask |= VTNET_LRO_FEATURES; +#ifndef VTNET_LEGACY_TX if (vtnet_tunable_int(sc, "mq_disable", vtnet_mq_disable)) mask |= VIRTIO_NET_F_MQ; -#ifdef VTNET_LEGACY_TX +#else mask |= VIRTIO_NET_F_MQ; #endif features = VTNET_FEATURES & ~mask; sc->vtnet_features = virtio_negotiate_features(dev, features); - if (virtio_with_feature(dev, VTNET_LRO_FEATURES) == 0) - return; - if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) - return; - - /* - * LRO without mergeable buffers requires special care. This is not - * ideal because every receive buffer must be large enough to hold - * the maximum TCP packet, the Ethernet header, and the header. This - * requires up to 34 descriptors with MCLBYTES clusters. If we do - * not have indirect descriptors, LRO is disabled since the virtqueue - * will not contain very many receive buffers. - */ - if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC) == 0) { - device_printf(dev, - "LRO disabled due to both mergeable buffers and indirect " - "descriptors not negotiated\n"); + if (virtio_with_feature(dev, VTNET_LRO_FEATURES) && + virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) == 0) { + /* + * LRO without mergeable buffers requires special care. This + * is not ideal because every receive buffer must be large + * enough to hold the maximum TCP packet, the Ethernet header, + * and the header. This requires up to 34 descriptors with + * MCLBYTES clusters. If we do not have indirect descriptors, + * LRO is disabled since the virtqueue will not contain very + * many receive buffers. + */ + if (!virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) { + device_printf(dev, + "LRO disabled due to both mergeable buffers and " + "indirect descriptors not negotiated\n"); - features &= ~VTNET_LRO_FEATURES; - sc->vtnet_features = virtio_negotiate_features(dev, features); - } else - sc->vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + features &= ~VTNET_LRO_FEATURES; + sc->vtnet_features = + virtio_negotiate_features(dev, features); + } else + sc->vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + } } static void