[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] chardev: add nodelay option
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2] chardev: add nodelay option |
Date: |
Wed, 03 Mar 2021 14:24:13 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Paolo Bonzini <pbonzini@redhat.com> writes:
> The "delay" option was introduced as a way to enable Nagle's algorithm
> with ",nodelay". Since the short form for boolean options has now been
> deprecated, introduce a more properly named "nodelay" option. The "delay"
> option remains as an undocumented option.
>
> "delay" and "nodelay" are mutually exclusive. Because the check is
> done at consumption time, the code also rejects them if one of the
> two is specified via -set.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> chardev/char-socket.c | 13 +++++++++++--
> gdbstub.c | 2 +-
> qemu-options.hx | 14 +++++++-------
> 3 files changed, 19 insertions(+), 10 deletions(-)
I believe this is
Based-on: <20210226080526.651705-1-pbonzini@redhat.com>
>
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index 06a37c0cc8..c8bced76b7 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -1472,8 +1472,17 @@ static void qemu_chr_parse_socket(QemuOpts *opts,
> ChardevBackend *backend,
> sock = backend->u.socket.data = g_new0(ChardevSocket, 1);
> qemu_chr_parse_common(opts, qapi_ChardevSocket_base(sock));
>
> - sock->has_nodelay = qemu_opt_get(opts, "delay");
> - sock->nodelay = !qemu_opt_get_bool(opts, "delay", true);
> + if (qemu_opt_get(opts, "delay") && qemu_opt_get(opts, "nodelay")) {
> + error_setg(errp, "'delay' and 'nodelay' are mutually exclusive");
> + return;
> + }
> + sock->has_nodelay =
> + qemu_opt_get(opts, "delay") ||
> + qemu_opt_get(opts, "nodelay");
> + sock->nodelay =
> + !qemu_opt_get_bool(opts, "delay", true) ||
> + qemu_opt_get_bool(opts, "nodelay", false);
> +
> /*
> * We have different default to QMP for 'server', hence
> * we can't just check for existence of 'server'
$ qemu-system-x86_64 -chardev socket,id=chr0,path=sock,nodelay=on
qemu-system-x86_64: -chardev socket,id=chr0,path=sock,nodelay=on: Invalid
parameter 'nodelay'
You forgot to update qemu_chardev_opts:
diff --git a/chardev/char.c b/chardev/char.c
index 288efebd12..e6128c046f 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -864,6 +864,9 @@ QemuOptsList qemu_chardev_opts = {
},{
.name = "server",
.type = QEMU_OPT_BOOL,
+ },{
+ .name = "nodelay",
+ .type = QEMU_OPT_BOOL,
},{
.name = "delay",
.type = QEMU_OPT_BOOL,
[...]