From nobody Tue Feb 10 15:45:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615028185; cv=none; d=zohomail.com; s=zohoarc; b=ICNPuvHOreRZCS33pLUpqCulKjkB7mT702WYE9UCDbqccKtyOSBbmu/DS4Yi0BM4Ragl78eDrca57J2pc1D9vWaxLhAb5ejXIGW4QvAvPnJVKpO4HS3aZ5wO/4BE/FsNlgh3sVqkTeE+/dh5c0y71tkwkgb3fnaBWANSD9VnMIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615028185; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ePf5Xm+2mM3AJyOz4KRHQebWqCb/bWbpeRmVlQcH6Aw=; b=Vw1fcFYqQMJtfVoA8bSdFsqr4n6FqIpK0kdSi+uu2blhihp7+LduBfnI1twaRsU5Nk3sTctu9q8ra2qBuLL8PT5Nkqgb0jdIS6Hp//vpHuhOY3BPtOA3CCdJV482bojFM/TP+/EPI2ZvXDjxtYqY+CdVTpipzh4mGXxxvrGVogk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615028185172875.3951280197834; Sat, 6 Mar 2021 02:56:25 -0800 (PST) Received: from localhost ([::1]:38974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIUbf-0007fU-MB for importer@patchew.org; Sat, 06 Mar 2021 05:56:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIUZn-0005ld-OP for qemu-devel@nongnu.org; Sat, 06 Mar 2021 05:54:27 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:52344) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIUZl-00084w-W2 for qemu-devel@nongnu.org; Sat, 06 Mar 2021 05:54:27 -0500 Received: by mail-wm1-x334.google.com with SMTP id n22so3213051wmc.2 for ; Sat, 06 Mar 2021 02:54:25 -0800 (PST) Received: from avogadro.redhat.com ([93.56.170.5]) by smtp.gmail.com with ESMTPSA id i26sm9326472wmb.18.2021.03.06.02.54.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 02:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ePf5Xm+2mM3AJyOz4KRHQebWqCb/bWbpeRmVlQcH6Aw=; b=BKijLWP3IHPzshvo5GfozjrLYU1UyWO7KREtzVMCfLBMkfQPLrqj6CmXbJHk/I+utj /C20RUx21Ir3JV3nOyFOoL5XF87D6EQl6KalSRwuIKt0SOnk6E9+g/+I+sUwKMBQ/tI8 o1JIqNrpTchaZH+H8UyiHqw3HlcfH98eX2EPg/IyDumg49KjXyF+M1jnoWJjR6fDZr89 zzN6TQ0WxwunSU+l6f/0GMGk/fJ6xRgKzrqmh7vz2FXma1mtBoah+nh5hd3wwwL4l7v6 wzj1OtTebXP9jsDFtvAu9Q+JMTHofZ9ij1kUGIHz73SsOVizhEtbq7DYrYBPC6OVKeG2 1Dbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ePf5Xm+2mM3AJyOz4KRHQebWqCb/bWbpeRmVlQcH6Aw=; b=nC0ebRqdOC9LVJ5Llk2I0wYvlylIivZ59NMOBE3sbAVxaH++fHJo19EHTee+tbhBDH ikozgJMFnYKCYztHngNtwQK+HE28XWjJkiYXUKFKftbgawIdG1qOD87QjCR+A+VKv2Ow YDUfSjKcUV5ge/Mzt04bodPBQKzLRkmhQqV4tYr1SniGZdTk0EPaTqNXoyaO0+Bxj1Kr 8Xkwodn28pBxaW5+jZgvAujn0VkM0XgqgYoEHw+78dfMVKdzwU9xJ148lS6R+jrWbFcD 2rBSbarH/o2TnKVL84d8nIrg0KSTo4A73RPNiiTNeu++UFhF+esotvzkHXUL0LoHHW1B 0/aw== X-Gm-Message-State: AOAM532b4yNpPAAxGj5xC+L580gjKkcesYbwNvpWZHB8O1MRrC14ZGeL QwAvEK2CgvkdWmpbK2jZKpAaKiPa8SQ= X-Google-Smtp-Source: ABdhPJyPWaoboog5bRVotj3PFzpbA5wYC4864AYy2AQyxVtcFm2UThuSlfbBOqv5u8mJwqfd6N4aoA== X-Received: by 2002:a1c:9d85:: with SMTP id g127mr13058264wme.161.1615028064816; Sat, 06 Mar 2021 02:54:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/23] chardev: add nodelay option Date: Sat, 6 Mar 2021 11:54:00 +0100 Message-Id: <20210306105419.110503-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210306105419.110503-1-pbonzini@redhat.com> References: <20210306105419.110503-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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. Based-on: <20210226080526.651705-1-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 13 +++++++++++-- chardev/char.c | 3 +++ gdbstub.c | 2 +- qemu-options.hx | 14 +++++++------- 4 files changed, 22 insertions(+), 10 deletions(-) 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, Ch= ardevBackend *backend, sock =3D backend->u.socket.data =3D g_new0(ChardevSocket, 1); qemu_chr_parse_common(opts, qapi_ChardevSocket_base(sock)); =20 - sock->has_nodelay =3D qemu_opt_get(opts, "delay"); - sock->nodelay =3D !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 =3D + qemu_opt_get(opts, "delay") || + qemu_opt_get(opts, "nodelay"); + sock->nodelay =3D + !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' diff --git a/chardev/char.c b/chardev/char.c index 288efebd12..97cafd6849 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -867,6 +867,9 @@ QemuOptsList qemu_chardev_opts =3D { },{ .name =3D "delay", .type =3D QEMU_OPT_BOOL, + },{ + .name =3D "nodelay", + .type =3D QEMU_OPT_BOOL, },{ .name =3D "reconnect", .type =3D QEMU_OPT_NUMBER, diff --git a/gdbstub.c b/gdbstub.c index 3ee40479b6..16d7c8f534 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -3505,7 +3505,7 @@ int gdbserver_start(const char *device) if (strstart(device, "tcp:", NULL)) { /* enforce required TCP attributes */ snprintf(gdbstub_device_name, sizeof(gdbstub_device_name), - "%s,wait=3Doff,delay=3Doff,server=3Don", device); + "%s,wait=3Doff,nodelay=3Don,server=3Don", device); device =3D gdbstub_device_name; } #ifndef _WIN32 diff --git a/qemu-options.hx b/qemu-options.hx index 252db9357c..90801286c6 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3033,7 +3033,7 @@ DEFHEADING(Character device options:) DEF("chardev", HAS_ARG, QEMU_OPTION_chardev, "-chardev help\n" "-chardev null,id=3Did[,mux=3Don|off][,logfile=3DPATH][,logappend=3Don= |off]\n" - "-chardev socket,id=3Did[,host=3Dhost],port=3Dport[,to=3Dto][,ipv4=3Do= n|off][,ipv6=3Don|off][,delay=3Don|off][,reconnect=3Dseconds]\n" + "-chardev socket,id=3Did[,host=3Dhost],port=3Dport[,to=3Dto][,ipv4=3Do= n|off][,ipv6=3Don|off][,nodelay=3Don|off][,reconnect=3Dseconds]\n" " [,server=3Don|off][,wait=3Don|off][,telnet=3Don|off][,websoc= ket=3Don|off][,reconnect=3Dseconds][,mux=3Don|off]\n" " [,logfile=3DPATH][,logappend=3Don|off][,tls-creds=3DID][,tls= -authz=3DID] (tcp)\n" "-chardev socket,id=3Did,path=3Dpath[,server=3Don|off][,wait=3Don|off]= [,telnet=3Don|off][,websocket=3Don|off][,reconnect=3Dseconds]\n" @@ -3184,7 +3184,7 @@ The available backends are: =20 TCP and unix socket options are given below: =20 - ``TCP options: port=3Dport[,host=3Dhost][,to=3Dto][,ipv4=3Don|off][,ip= v6=3Don|off][,delay=3Don|off]`` + ``TCP options: port=3Dport[,host=3Dhost][,to=3Dto][,ipv4=3Don|off][,ip= v6=3Don|off][,nodelay=3Don|off]`` ``host`` for a listening socket specifies the local address to be bound. For a connecting socket species the remote host to connect to. ``host`` is optional for listening sockets. If not @@ -3204,7 +3204,7 @@ The available backends are: or IPv6 must be used. If neither is specified the socket may use either protocol. =20 - ``delay=3Don|off`` disables the Nagle algorithm. + ``nodelay=3Don|off`` disables the Nagle algorithm. =20 ``unix options: path=3Dpath[,abstract=3Don|off][,tight=3Don|off]`` ``path`` specifies the local path of the unix socket. ``path`` @@ -3593,13 +3593,13 @@ SRST ``telnet options:`` localhost 5555 =20 - ``tcp:[host]:port[,server=3Don|off][,wait=3Don|off][,delay=3Don|off][,= reconnect=3Dseconds]`` + ``tcp:[host]:port[,server=3Don|off][,wait=3Don|off][,nodelay=3Don|off]= [,reconnect=3Dseconds]`` The TCP Net Console has two modes of operation. It can send the serial I/O to a location or wait for a connection from a location. By default the TCP Net Console is sent to host at the port. If you use the ``server=3Don`` option QEMU will wait for a c= lient socket application to connect to the port before continuing, - unless the ``wait=3Don|off`` option was specified. The ``delay=3Do= n|off`` + unless the ``wait=3Don|off`` option was specified. The ``nodelay= =3Don|off`` option disables the Nagle buffering algorithm. The ``reconnect=3Do= n`` option only applies if ``server=3Dno`` is set, if the connection g= oes down it will attempt to reconnect at the given interval. If host @@ -3616,7 +3616,7 @@ SRST ``Example to not wait and listen on ip 192.168.0.100 port 4444`` -serial tcp:192.168.0.100:4444,server=3Don,wait=3Doff =20 - ``telnet:host:port[,server=3Don|off][,wait=3Don|off][,delay=3Don|off]`` + ``telnet:host:port[,server=3Don|off][,wait=3Don|off][,nodelay=3Don|off= ]`` The telnet protocol is used instead of raw tcp sockets. The options work the same as if you had specified ``-serial tcp``. The difference is that the port acts like a telnet server or @@ -3626,7 +3626,7 @@ SRST you do it with Control-] and then type "send break" followed by pressing the enter key. =20 - ``websocket:host:port,server=3Don[,wait=3Don|off][,delay=3Don|off]`` + ``websocket:host:port,server=3Don[,wait=3Don|off][,nodelay=3Don|off]`` The WebSocket protocol is used instead of raw tcp socket. The port acts as a WebSocket server. Client mode is not supported. =20 --=20 2.29.2