[PATCH] Add page_per_vq flag to the 'driver' element of virtio devices
Jonathon Jongsma
jjongsma at redhat.com
Thu Apr 29 14:43:57 UTC 2021
On Thu, 2021-04-29 at 14:12 +0300, Gavi Teitz wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1925363
>
> Add support for setting the page-per-vq flag, which is important for
> vdpa with vhost-user performance.
>
> Signed-off-by: Gavi Teitz <gavi at nvidia.com>
>
[snip]
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 9d98f48..0350fde 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -10446,6 +10446,7 @@ virDomainNetDefParseXML(virDomainXMLOption
> *xmlopt,
> g_autofree char *queues = NULL;
> g_autofree char *rx_queue_size = NULL;
> g_autofree char *tx_queue_size = NULL;
> + g_autofree char *page_per_vq = NULL;
> g_autofree char *filter = NULL;
> g_autofree char *internal = NULL;
> g_autofree char *mode = NULL;
> @@ -10615,6 +10616,7 @@ virDomainNetDefParseXML(virDomainXMLOption
> *xmlopt,
> queues = virXMLPropString(cur, "queues");
> rx_queue_size = virXMLPropString(cur,
> "rx_queue_size");
> tx_queue_size = virXMLPropString(cur,
> "tx_queue_size");
> + page_per_vq = virXMLPropString(cur, "page_per_vq");
>
> if (virDomainVirtioOptionsParseXML(cur, &def-
> >virtio) < 0)
> goto error;
> @@ -11041,6 +11043,15 @@ virDomainNetDefParseXML(virDomainXMLOption
> *xmlopt,
> }
> def->driver.virtio.tx_queue_size = q;
> }
> + if (page_per_vq) {
> + if ((val = virTristateSwitchTypeFromString(page_per_vq))
> <= 0) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("unknown page_per_vq mode '%s'"),
> + page_per_vq);
> + goto error;
> + }
> + def->driver.virtio.page_per_vq = val;
> + }
Tim Wiederhake has been doing a bunch of refactoring work in this area
changing code like this to use the newish virXMLProp* functions.
So I think this whole chunk could instead be something like:
if (virXMLPropTristateSwitch(cur, "page_per_vq", VIR_XML_PROP_NONE,
&def->driver.virtio.page_per_vq) < 0)
return -1;
(untested)
Jonathon
More information about the libvir-list
mailing list