svn commit: r267523 - head/sys/dev/virtio/network
Bryan Venteicher
bryanv at FreeBSD.org
Mon Jun 16 04:29:29 UTC 2014
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
More information about the svn-src-head
mailing list