[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v3] Add support for virtio-net.tx_queue_size



On Wed, Aug 02, 2017 at 12:44:37PM +0200, Michal Privoznik wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1462653

Just like I've added support for setting rx_queue_size (in
c56cdf259 and friends), qemu just gained support for setting tx
ring size.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
---

diff to v2:
- rebase to current HEAD

There's no fundamental change since v1. It's just discussion on this patch that
makes me send newer versions because the older ones do not apply cleanly
anymore.

docs/formatdomain.html.in                                | 16 +++++++++++++++-
docs/schemas/domaincommon.rng                            |  5 +++++
src/conf/domain_conf.c                                   | 16 ++++++++++++++++
src/conf/domain_conf.h                                   |  1 +
src/qemu/qemu_capabilities.c                             |  4 +++-
src/qemu/qemu_capabilities.h                             |  1 +
src/qemu/qemu_command.c                                  |  8 ++++++++
src/qemu/qemu_domain.c                                   | 16 +++++++++++-----
...e.args => qemuxml2argv-net-virtio-rxtxqueuesize.args} |  4 ++--
...ize.xml => qemuxml2argv-net-virtio-rxtxqueuesize.xml} |  2 +-
tests/qemuxml2argvtest.c                                 |  5 +++--
...e.xml => qemuxml2xmlout-net-virtio-rxtxqueuesize.xml} |  2 +-
tests/qemuxml2xmltest.c                                  |  2 +-
13 files changed, 68 insertions(+), 14 deletions(-)
rename tests/qemuxml2argvdata/{qemuxml2argv-net-virtio-rxqueuesize.args => qemuxml2argv-net-virtio-rxtxqueuesize.args} (85%)
rename tests/qemuxml2argvdata/{qemuxml2argv-net-virtio-rxqueuesize.xml => qemuxml2argv-net-virtio-rxtxqueuesize.xml} (93%)
rename tests/qemuxml2xmloutdata/{qemuxml2xmlout-net-virtio-rxqueuesize.xml => qemuxml2xmlout-net-virtio-rxtxqueuesize.xml} (96%)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 91195be0b..47e21c10d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5074,7 +5074,7 @@ qemu-kvm -net nic,model=? /dev/null
    &lt;source network='default'/&gt;
    &lt;target dev='vnet1'/&gt;
    &lt;model type='virtio'/&gt;
-    <b>&lt;driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256'&gt;
+    <b>&lt;driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256' tx_queue_size='256'&gt;
      &lt;host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off' mrg_rxbuf='off'/&gt;
      &lt;guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/&gt;
    &lt;/driver&gt;
@@ -5204,6 +5204,20 @@ qemu-kvm -net nic,model=? /dev/null
        <b>In general you should leave this option alone, unless you
        are very certain you know what you are doing.</b>
      </dd>
+      <dt><code>tx_queue_size</code></dt>
+      <dd>
+        The optional <code>tx_queue_size</code> attribute controls
+        the size of virtio ring for each queue as described above.
+        The default value is hypervisor dependent and may change
+        across its releases. Moreover, some hypervisors may pose
+        some restrictions on actual value. For instance, latest
+        QEMU (as of 2017-07-13) requires value to be a power of two
+        from [256, 1024] range.
+        <span class="since">Since 3.6.0 (QEMU and KVM only)</span><br/><br/>
+

3.7.0


[...]

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d1f5c3642..da6ddff6c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3725,6 +3725,14 @@ qemuBuildNicDevStr(virDomainDefPtr def,
        }
        virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
    }
+    if (usingVirtio && net->driver.virtio.tx_queue_size) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("virtio tx_queue_size option is not supported with this QEMU binary"));
+            goto error;
+        }
+        virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size);
+    }


I thought that we have a separate function for error checking already
(like we have with qemuProcessPrepareDomain for all stuff that changes
live XML) and wanted to tell you it should be part of that.  Well, we
don't, I guess that's another idea for BiteSizedTasks, isn't it? :)

ACK with the version change.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]