From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568837; cv=none; d=zohomail.com; s=zohoarc; b=FV1mejygCnuejDqw/b+/ST2ICyLW+bEMqyGOkv5b/gR7MZknXfmV7b33jgM7UYjXneaMxa1y6XBEl2LmgnWtTZ85TdKp+mEoPw70mSpWJT6zOtYkT0fBUMi5I63yNu30LCYOrq/ezIeCOjucE84j/nmq3dDHHlKQtKf75zlvBZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568837; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gej3BZW1jRRnjEGiS9Y5Dm5DmUSoq/CdSCr11ScQosI=; b=FfA8xHH5vc9W0k4IsiFAwnnsaNJ/PqdzTkGY2l3Cee8YI/gq0gNFbzFBEjYtK3EPMDlQoumoapTrbpdAbPmVCN8jfMPbQI0Qz9wM15FFjgglcRpneL5UZHWRvFN7xoLGCOad73Hxvi4QmGX9ovhc83Ep3z9DXz4NDUdcLFvJyPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568837868738.8726729395614; Thu, 1 Aug 2024 20:20:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZipf-0003LW-PH; Thu, 01 Aug 2024 23:19:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipe-0003EX-0P for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:19:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipa-0008Pm-2c for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:19:53 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-272-zXoQgsJiP6Kws90ETsBcKQ-1; Thu, 01 Aug 2024 23:19:42 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 30B121955D4B; Fri, 2 Aug 2024 03:19:39 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 02E9C300019E; Fri, 2 Aug 2024 03:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gej3BZW1jRRnjEGiS9Y5Dm5DmUSoq/CdSCr11ScQosI=; b=CnvLqYZSkBF1Dzp64ZFnHPtM6/9tYB5vvY5JWdAt4nF54Q0ScFAM//hwzOyrRXY5ZmgirJ JEOyfcCsp/HgJQgHzJ89xntOwEbj8RUXusvJMxlxuPvOREJYduvGh7MqXUBXFWs2ykpudQ l/6bh3+Id5pDsY9tQusD0gb+czRrIZ0= X-MC-Unique: zXoQgsJiP6Kws90ETsBcKQ-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: Hans , Jason Wang Subject: [PULL 1/8] rtl8139: Fix behaviour for old kernels. Date: Fri, 2 Aug 2024 11:19:22 +0800 Message-ID: <20240802031929.44060-2-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568838753116600 Content-Type: text/plain; charset="utf-8" From: Hans Old linux kernel rtl8139 drivers (ex. debian 2.1) uses outb to set the rx mode for RxConfig. Unfortunatelly qemu does not support outb for RxConfig. Signed-off-by: Hans Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- hw/net/rtl8139.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 897c86ec41..03a204ef8a 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -2738,7 +2738,11 @@ static void rtl8139_io_writeb(void *opaque, uint8_t = addr, uint32_t val) } =20 break; - + case RxConfig: + DPRINTF("RxConfig write(b) val=3D0x%02x\n", val); + rtl8139_RxConfig_write(s, + (rtl8139_RxConfig_read(s) & 0xFFFFFF00) | val); + break; default: DPRINTF("not implemented write(b) addr=3D0x%x val=3D0x%02x\n",= addr, val); --=20 2.42.0 From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568868; cv=none; d=zohomail.com; s=zohoarc; b=EFrH4Fg19gJqFAst+z31JGmMJnYcpce6433q2Yp/YeBBhhvt9CES5ZnVA43IbQUsdJkMP1cmNMgEghyl1adhyZTKiirDFNLTWlyWU0VOOnlrwOcWK8UJSkl/okgyqKONb7b5ixc+QvLGP3lLOOQmkmbXdNox1s5URKKgFP9Ux9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568868; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hlVS0wk+yi4XQ7gjjjnTC+8gcRLIF1sX0foWefqDJ+g=; b=kRasmNWP/Z2Qszl6GvYPygy5gakGaUOSJAYgtSNVNiDYC0xV8oPWRwngn5TEIln6vHh0dKe5Tthwh0kfGpQQkBoDCLWZOK1onMAtWrsVX6809BYzBPn594z90zVrxkUDn4FaBir71NRnKbLsPt3hWkR4R4ShY5VYKA/UCFHs9iY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568868162925.3270642492097; Thu, 1 Aug 2024 20:21:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZipj-0003ZJ-1a; Thu, 01 Aug 2024 23:19:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipg-0003Nk-8M for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:19:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipe-0008QM-MF for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:19:56 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-221-t5QoyAuBMwSnMNwKUVjwbg-1; Thu, 01 Aug 2024 23:19:49 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 290801956064; Fri, 2 Aug 2024 03:19:46 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 087EE3000198; Fri, 2 Aug 2024 03:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlVS0wk+yi4XQ7gjjjnTC+8gcRLIF1sX0foWefqDJ+g=; b=IOivPY/7VsbkMpVOpCEX7TZxH+h2G4CucUg7Kdru5VyiNd48soo9CAfWx2RXEbzp7jduIC DGllwzrPmQuy9AVpTbULhApkta+ruCgtL+47POjkpHv61rD4ta4dAhxcnTM/eiCon3jK8f FGFmxW8Vij7KWzSu3ooSXl0G9RGIf3s= X-MC-Unique: t5QoyAuBMwSnMNwKUVjwbg-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Zhibin Hu , qemu-stable@nongnu.org, "Michael S . Tsirkin" , Jason Wang Subject: [PULL 2/8] virtio-net: Ensure queue index fits with RSS Date: Fri, 2 Aug 2024 11:19:23 +0800 Message-ID: <20240802031929.44060-3-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568868888116600 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki Ensure the queue index points to a valid queue when software RSS enabled. The new calculation matches with the behavior of Linux's TAP device with the RSS eBPF program. Fixes: 4474e37a5b3a ("virtio-net: implement RX RSS processing") Reported-by: Zhibin Hu Cc: qemu-stable@nongnu.org Signed-off-by: Akihiko Odaki Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- hw/net/virtio-net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 8f30972708..5635620a31 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1905,7 +1905,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState = *nc, const uint8_t *buf, if (!no_rss && n->rss_data.enabled && n->rss_data.enabled_software_rss= ) { int index =3D virtio_net_process_rss(nc, buf, size, &extra_hdr); if (index >=3D 0) { - NetClientState *nc2 =3D qemu_get_subqueue(n->nic, index); + NetClientState *nc2 =3D + qemu_get_subqueue(n->nic, index % n->curr_queue_pairs); return virtio_net_receive_rcu(nc2, buf, size, true); } } --=20 2.42.0 From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568832; cv=none; d=zohomail.com; s=zohoarc; b=YS3SJehuzKRt+nD5gTucwpC56X8njELZn2D93GOzSgefiGdyqkdcV3g+pFZhhIPIPNnrOuCqp0F14mf2enRK1jqR7bOqZ9ygxo1zWBwoykOXNAnrwbtvf2IUnC/2bl1kO4KiFdHCqPKtlryAvN5DRiShj0J1X5hk0dtMRKyJFaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568832; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+e/f3N/cVvvaxPSwMQ5IefHh/4m0XF1vehCSZAYlYMk=; b=Xmgp9EzAIrX5Uxth4x/44k7BCgjfhiRAu+MTgwSQrMO3neR9xEVzGY4mpY2HOR8DPwIN96E8stBwXWpn37q/DBySTT3t3NirEKv1JS4Zu/z/HUzNWwJ/tEgQuJ+R1c4RY0XCdymtbY8h0h1Irtet8ZdWvx/gt23PaBwwEIoRJSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568832875406.4094671156482; Thu, 1 Aug 2024 20:20:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZipo-0003ta-2W; Thu, 01 Aug 2024 23:20:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipl-0003jf-HQ for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipj-0008RS-Ez for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:01 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-52-FVBuxm4YM06s-3ijMfYNLw-1; Thu, 01 Aug 2024 23:19:55 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5F80A1955D48; Fri, 2 Aug 2024 03:19:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F3941300018D; Fri, 2 Aug 2024 03:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+e/f3N/cVvvaxPSwMQ5IefHh/4m0XF1vehCSZAYlYMk=; b=BhSX3cNPIzl1njMJWe1sgdmcdC5xBUJbM1TeY1ZyazcvGEBVJKhBuhYjhge/nVcdCWA3OD 4/MGsApACHCbV+d82H71vle64Btxgqtxag/7TQsSRVRu3kT0T3n5IUJ17saqmLqQcHbffm oklOi+5++zrhQzJ89hGuPFGl/Tn9Qwg= X-MC-Unique: FVBuxm4YM06s-3ijMfYNLw-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: thomas , qemu-stable@nongnu.org, "Michael S . Tsirkin" , Jason Wang Subject: [PULL 3/8] virtio-net: Fix network stall at the host side waiting for kick Date: Fri, 2 Aug 2024 11:19:24 +0800 Message-ID: <20240802031929.44060-4-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568834993116600 Content-Type: text/plain; charset="utf-8" From: thomas Patch 06b12970174 ("virtio-net: fix network stall under load") added double-check to test whether the available buffer size can satisfy the request or not, in case the guest has added some buffers to the avail ring simultaneously after the first check. It will be lucky if the available buffer size becomes okay after the double-check, then the host can send the packet to the guest. If the buffer size still can't satisfy the request, even if the guest has added some buffers, viritio-net would stall at the host side forever. The patch enables notification and checks whether the guest has added some buffers since last check of available buffers when the available buffers are insufficient. If no buffer is added, return false, else recheck the available buffers in the loop. If the available buffers are sufficient, disable notification and return true. Changes: 1. Change the return type of virtqueue_get_avail_bytes() from void to int, it returns an opaque that represents the shadow_avail_idx of the virtqueue on success, else -1 on error. 2. Add a new API: virtio_queue_enable_notification_and_check(), it takes an opaque as input arg which is returned from virtqueue_get_avail_bytes(). It enables notification firstly, then checks whether the guest has added some buffers since last check of available buffers or not by virtio_queue_poll(), return ture if yes. The patch also reverts patch "06b12970174". The case below can reproduce the stall. Guest 0 +--------+ | iperf | ---------------> | server | Host | +--------+ +--------+ | ... | iperf |---- | client |---- Guest n +--------+ | +--------+ | | iperf | ---------------> | server | +--------+ Boot many guests from qemu with virtio network: qemu ... -netdev tap,id=3Dnet_x \ -device virtio-net-pci-non-transitional,\ iommu_platform=3Don,mac=3Dxx:xx:xx:xx:xx:xx,netdev=3Dnet_x Each guest acts as iperf server with commands below: iperf3 -s -D -i 10 -p 8001 iperf3 -s -D -i 10 -p 8002 The host as iperf client: iperf3 -c guest_IP -p 8001 -i 30 -w 256k -P 20 -t 40000 iperf3 -c guest_IP -p 8002 -i 30 -w 256k -P 20 -t 40000 After some time, the host loses connection to the guest, the guest can send packet to the host, but can't receive packet from the host. It's more likely to happen if SWIOTLB is enabled in the guest, allocating and freeing bounce buffer takes some CPU ticks, copying from/to bounce buffer takes more CPU ticks, compared with that there is no bounce buffer in the guest. Once the rate of producing packets from the host approximates the rate of receiveing packets in the guest, the guest would loop in NAPI. receive packets --- | | v | free buf virtnet_poll | | v | add buf to avail ring --- | | need kick the host? | NAPI continues v receive packets --- | | v | free buf virtnet_poll | | v | add buf to avail ring --- | v ... ... On the other hand, the host fetches free buf from avail ring, if the buf in the avail ring is not enough, the host notifies the guest the event by writing the avail idx read from avail ring to the event idx of used ring, then the host goes to sleep, waiting for the kick signal from the guest. Once the guest finds the host is waiting for kick singal (in virtqueue_kick_prepare_split()), it kicks the host. The host may stall forever at the sequences below: Host Guest ------------ ----------- fetch buf, send packet receive packet --- ... ... | fetch buf, send packet add buf | ... add buf virtnet_poll buf not enough avail idx-> add buf | read avail idx add buf | add buf --- receive packet --- write event idx ... | wait for kick add buf virtnet_poll ... | --- no more packet, exit NAPI In the first loop of NAPI above, indicated in the range of virtnet_poll above, the host is sending packets while the guest is receiving packets and adding buffers. step 1: The buf is not enough, for example, a big packet needs 5 buf, but the available buf count is 3. The host read current avail idx. step 2: The guest adds some buf, then checks whether the host is waiting for kick signal, not at this time. The used ring is not empty, the guest continues the second loop of NAPI. step 3: The host writes the avail idx read from avail ring to used ring as event idx via virtio_queue_set_notification(q->rx_vq, 1). step 4: At the end of the second loop of NAPI, recheck whether kick is needed, as the event idx in the used ring written by the host is beyound the range of kick condition, the guest will not send kick signal to the host. Fixes: 06b12970174 ("virtio-net: fix network stall under load") Cc: qemu-stable@nongnu.org Signed-off-by: Wencheng Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- hw/net/virtio-net.c | 28 ++++++++++------- hw/virtio/virtio.c | 64 +++++++++++++++++++++++++++++++++++--- include/hw/virtio/virtio.h | 19 +++++++++-- 3 files changed, 92 insertions(+), 19 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5635620a31..08aa0b65e3 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1641,24 +1641,28 @@ static bool virtio_net_can_receive(NetClientState *= nc) =20 static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize) { + int opaque; + unsigned int in_bytes; VirtIONet *n =3D q->n; - if (virtio_queue_empty(q->rx_vq) || - (n->mergeable_rx_bufs && - !virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) { - virtio_queue_set_notification(q->rx_vq, 1); - - /* To avoid a race condition where the guest has made some buffers - * available after the above check but before notification was - * enabled, check for available buffers again. - */ - if (virtio_queue_empty(q->rx_vq) || - (n->mergeable_rx_bufs && - !virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) { + + while (virtio_queue_empty(q->rx_vq) || n->mergeable_rx_bufs) { + opaque =3D virtqueue_get_avail_bytes(q->rx_vq, &in_bytes, NULL, + bufsize, 0); + /* Buffer is enough, disable notifiaction */ + if (bufsize <=3D in_bytes) { + break; + } + + if (virtio_queue_enable_notification_and_check(q->rx_vq, opaque)) { + /* Guest has added some buffers, try again */ + continue; + } else { return 0; } } =20 virtio_queue_set_notification(q->rx_vq, 0); + return 1; } =20 diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 397c261c3c..9e10cbc058 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -744,6 +744,60 @@ int virtio_queue_empty(VirtQueue *vq) } } =20 +static bool virtio_queue_split_poll(VirtQueue *vq, unsigned shadow_idx) +{ + if (unlikely(!vq->vring.avail)) { + return false; + } + + return (uint16_t)shadow_idx !=3D vring_avail_idx(vq); +} + +static bool virtio_queue_packed_poll(VirtQueue *vq, unsigned shadow_idx) +{ + VRingPackedDesc desc; + VRingMemoryRegionCaches *caches; + + if (unlikely(!vq->vring.desc)) { + return false; + } + + caches =3D vring_get_region_caches(vq); + if (!caches) { + return false; + } + + vring_packed_desc_read(vq->vdev, &desc, &caches->desc, + shadow_idx, true); + + return is_desc_avail(desc.flags, vq->shadow_avail_wrap_counter); +} + +static bool virtio_queue_poll(VirtQueue *vq, unsigned shadow_idx) +{ + if (virtio_device_disabled(vq->vdev)) { + return false; + } + + if (virtio_vdev_has_feature(vq->vdev, VIRTIO_F_RING_PACKED)) { + return virtio_queue_packed_poll(vq, shadow_idx); + } else { + return virtio_queue_split_poll(vq, shadow_idx); + } +} + +bool virtio_queue_enable_notification_and_check(VirtQueue *vq, + int opaque) +{ + virtio_queue_set_notification(vq, 1); + + if (opaque >=3D 0) { + return virtio_queue_poll(vq, (unsigned)opaque); + } else { + return false; + } +} + static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len) { @@ -1442,9 +1496,9 @@ err: goto done; } =20 -void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, - unsigned int *out_bytes, - unsigned max_in_bytes, unsigned max_out_byt= es) +int virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, + unsigned int *out_bytes, unsigned max_in_byt= es, + unsigned max_out_bytes) { uint16_t desc_size; VRingMemoryRegionCaches *caches; @@ -1477,7 +1531,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigne= d int *in_bytes, caches); } =20 - return; + return (int)vq->shadow_avail_idx; err: if (in_bytes) { *in_bytes =3D 0; @@ -1485,6 +1539,8 @@ err: if (out_bytes) { *out_bytes =3D 0; } + + return -1; } =20 int virtqueue_avail_bytes(VirtQueue *vq, unsigned int in_bytes, diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index d2a1938757..0fcbc5c0c6 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -273,9 +273,13 @@ void qemu_put_virtqueue_element(VirtIODevice *vdev, QE= MUFile *f, VirtQueueElement *elem); int virtqueue_avail_bytes(VirtQueue *vq, unsigned int in_bytes, unsigned int out_bytes); -void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, - unsigned int *out_bytes, - unsigned max_in_bytes, unsigned max_out_byt= es); +/** + * Return <0 on error or an opaque >=3D0 to pass to + * virtio_queue_enable_notification_and_check on success. + */ +int virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, + unsigned int *out_bytes, unsigned max_in_byt= es, + unsigned max_out_bytes); =20 void virtio_notify_irqfd(VirtIODevice *vdev, VirtQueue *vq); void virtio_notify(VirtIODevice *vdev, VirtQueue *vq); @@ -309,6 +313,15 @@ int virtio_queue_ready(VirtQueue *vq); =20 int virtio_queue_empty(VirtQueue *vq); =20 +/** + * Enable notification and check whether guest has added some + * buffers since last call to virtqueue_get_avail_bytes. + * + * @opaque: value returned from virtqueue_get_avail_bytes + */ +bool virtio_queue_enable_notification_and_check(VirtQueue *vq, + int opaque); + void virtio_queue_set_shadow_avail_idx(VirtQueue *vq, uint16_t idx); =20 /* Host binding interface. */ --=20 2.42.0 From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568906; cv=none; d=zohomail.com; s=zohoarc; b=YmWBI1vLChBbisjEi0OmAmROrEYHD2FJsFsOXzzSTFUjUn2wa9nehFeRJBV70jYhwd0DQMjdyOFjljnGoir02yLhwZHLh0CTNZ2a1oS1OyGxBXu4YqxCIPyOsIZJfdhZoOOMPlJfm85jrJYfJGsxkAOwSd3XhfFvuGFucxMMIdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568906; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yH7Hhnxy+JZeYhNTYJSvoZ9X0We0m2TGS1abbdMhA+w=; b=FJu3u0hlbAfJYRUwti1YkLQZ5635yyYaH8NoPZ6mjtpsZSqSVrjotGJlPDrycYLCbLL2/U/BET7qoK+I6+5JaOy8YpyqhScVDeS7uuZxwgH7cU+lQF7wBuY4m+WZvkbVGdaLhCblawb9ZBXBLueXw9TkWz6W6H+Pf+dYbel9WHo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568906896332.1314259261743; Thu, 1 Aug 2024 20:21:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZipr-00047G-Hn; Thu, 01 Aug 2024 23:20:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipo-0003rq-KO for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipk-0008Rg-FE for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:03 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-BUoW7K4zMr6vrT31lF51mg-1; Thu, 01 Aug 2024 23:19:58 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AE39A1955D4F for ; Fri, 2 Aug 2024 03:19:56 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 36B6B300019D; Fri, 2 Aug 2024 03:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yH7Hhnxy+JZeYhNTYJSvoZ9X0We0m2TGS1abbdMhA+w=; b=BZOJvwrfMIROmagTuBGH0rGHWGOBfdH4ByMb8bYWWfFoqmbMCnQN+YE4cWzxHf+Hy9oJqL XFEbzednmpSPnfCGtAs7cTjY3ya1RSVtce15prhoYSb+LopmZqHP4Uq08j0UoDpPDssJc1 tT5ZMnLVwnAOSWgBxdhnZaRkrMUo6OQ= X-MC-Unique: BUoW7K4zMr6vrT31lF51mg-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jason Wang Subject: [PULL 4/8] net: update netdev stream/dgram man page Date: Fri, 2 Aug 2024 11:19:25 +0800 Message-ID: <20240802031929.44060-5-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568907122116600 From: Laurent Vivier Add the description of "-netdev stream" and "-netdev dgram" in the QEMU manpage. Add some examples on how to use them. Fixes: 5166fe0ae46d ("qapi: net: add stream and dgram netdevs") Signed-off-by: Laurent Vivier Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- qemu-options.hx | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 369ae81d7c..52143cfb8f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3353,6 +3353,120 @@ SRST -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56= \\ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102= ,localaddr=3D1.2.3.4 =20 +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don|off= ][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off]`` + Configure a network backend to connect to another QEMU virtual machine= or a proxy using a TCP/IP socket. + + ``server=3Don|off`` + if ``on`` create a server socket + + ``addr.host=3Dhost,addr.port=3Dport`` + socket address to listen on (server=3Don) or connect to (server=3D= off) + + ``to=3Dmaxport`` + if present, this is range of possible addresses, with port between= ``port`` and ``maxport``. + + ``numeric=3Don|off`` + if ``on`` ``host`` and ``port`` are guaranteed to be numeric, othe= rwise a name resolution should be attempted (default: ``off``) + + ``keep-alive=3Don|off`` + enable keep-alive when connecting to this socket. Not supported f= or passive sockets. + + ``mptcp=3Don|off`` + enable multipath TCP + + ``ipv4=3Don|off`` + whether to accept IPv4 addresses, default to try both IPv4 and IPv6 + + ``ipv6=3Don|off`` + whether to accept IPv6 addresses, default to try both IPv4 and IPv6 + + Example (two guests connected using a TCP/IP socket): + + .. parsed-literal:: + + # first VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:56 \\ + -netdev stream,id=3Dnet0,server=3Don,addr.type=3Dine= t,addr.host=3Dlocalhost,addr.port=3D1234 + # second VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ + -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Din= et,addr.host=3Dlocalhost,addr.port=3D1234 + +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Dfile= -descriptor`` + Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented socket file descriptor. + + ``server=3Don|off`` + if ``on`` create a server socket + + ``addr.str=3Dfile-descriptor`` + file descriptor number to use as a socket + +``-netdev dgram,id=3Dstr,remote.type=3Dinet,remote.host=3Dmaddr,remote.por= t=3Dport[,local.type=3Dinet,local.host=3Daddr]`` + Configure a network backend to connect to a multicast address. + + ``remote.host=3Dmaddr,remote.port=3Dport`` + multicast address + + ``local.host=3Daddr`` + specify the host address to send packets from + + Example: + + .. parsed-literal:: + + # launch one QEMU instance + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:56 \\ + -netdev dgram,id=3Dnet0,remote.type=3Dinet,remote.ho= st=3D224.0.0.1,remote.port=3D1234 + # launch another QEMU instance on same "bus" + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ + -netdev dgram,id=3Dnet0,remote.type=3Dinet,remote.ho= st=3D224.0.0.1,remote.port=3D1234 + # launch yet another QEMU instance on same "bus" + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:58 \\ + -netdev dgram,id=3Dnet0,remote.type=3Dinet,remote.ho= st=3D224.0.0.1,remote.port=3D1234 + +``-netdev dgram,id=3Dstr,remote.type=3Dinet,remote.host=3Dmaddr,remote.por= t=3Dport[,local.type=3Dfd,local.str=3Dfile-descriptor]`` + Configure a network backend to connect to a multicast address using a = UDP socket file descriptor. + + ``remote.host=3Dmaddr,remote.port=3Dport`` + multicast address + + ``local.str=3Dfile-descriptor`` + File descriptor to use to send packets + +``-netdev dgram,id=3Dstr,local.type=3Dinet,local.host=3Daddr,local.port=3D= port[,remote.type=3Dinet,remote.host=3Daddr,remote.port=3Dport]`` + Configure a network backend to connect to another QEMU virtual + machine or a proxy using a datagram oriented unix domain socket. + + ``local.host=3Daddr,local.port=3Dport`` + IP address to use to send the packets from + + ``remote.host=3Daddr,remote.port=3Dport`` + Destination IP address + + Example (two guests connected using an UDP/IP socket): + + .. parsed-literal:: + + # first VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:56 \\ + -netdev dgram,id=3Dnet0,local.type=3Dinet,local.host= =3Dlocalhost,local.port=3D1234,remote.type=3Dinet,remote.host=3Dlocalhost,r= emote.port=3D1235 + # second VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:56 \\ + -netdev dgram,id=3Dnet0,local.type=3Dinet,local.host= =3Dlocalhost,local.port=3D1235,remote.type=3Dinet,remote.host=3Dlocalhost,r= emote.port=3D1234 + +``-netdev dgram,id=3Dstr,local.type=3Dfd,local.str=3Dfile-descriptor`` + Configure a network backend to connect to another QEMU virtual + machine or a proxy using a datagram oriented socket file descriptor. + + ``local.str=3Dfile-descriptor`` + File descriptor to use to send packets + ``-netdev l2tpv3,id=3Did,src=3Dsrcaddr,dst=3Ddstaddr[,srcport=3Dsrcport][,= dstport=3Ddstport],txsession=3Dtxsession[,rxsession=3Drxsession][,ipv6=3Don= |off][,udp=3Don|off][,cookie64=3Don|off][,counter=3Don|off][,pincounter=3Do= n|off][,txcookie=3Dtxcookie][,rxcookie=3Drxcookie][,offset=3Doffset]`` Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931) is a popular protocol to transport Ethernet (and other Layer 2) data --=20 2.42.0 From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568906; cv=none; d=zohomail.com; s=zohoarc; b=De2+BaHQjfNi+BbDGAQpbcQvPIw88gakk65d2iWJkq2IpGfwmWatY43VSgn5TWb0YsQo0NrbH+ZrbNWu83RElwpjKCkOpoUg5ybwARREIQFFd2/H41cqP2RjBYhHjdJgQardx9RNt9I6i94RwqY+6emFHAEyixS/x6W1DMGhrys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568906; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aK96+5ULR6GSNMwOgGIzwBEppzhtkiyT1tBMWklxk+A=; b=dQj6IBz+VI2AlA2inLWFM7XNUDPYYkXDz2fubyjlmizobNr90+VexQxFxUBPLBRmoATSAXchUdXLiriRqvubL/J7Ihi3uAjp7XUrAo1lOffRAAvNOKHXWNx2S07bWdOYwaJH0taCF0H+WXRZDFHD+ddXkfFJ+YlFroVnqtvC8Lk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568906842542.3869770213771; Thu, 1 Aug 2024 20:21:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZipt-0004DQ-83; Thu, 01 Aug 2024 23:20:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipq-000423-61 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipo-00009Y-B3 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:05 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-178-x1A6Z_j8MSGMzFVlKUy6eg-1; Thu, 01 Aug 2024 23:20:02 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2C0C51955D48 for ; Fri, 2 Aug 2024 03:20:01 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 890733000198; Fri, 2 Aug 2024 03:19:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aK96+5ULR6GSNMwOgGIzwBEppzhtkiyT1tBMWklxk+A=; b=OgOSdGHm4FEQ15fwLU1vVc53HB47Ju7GIg/jqjMxIrm7NVPEI/97DVs7GH1mTLwenMTMqh qG6uZ2g1pFdZIVaLtL29kFtINuhqq5DDf3KeTHArZvBNBM6zfws4vfmyMJ8VUILWmQFGze e/3tINTCSzA8b9fkzWaV/2BTA15rhjw= X-MC-Unique: x1A6Z_j8MSGMzFVlKUy6eg-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jason Wang Subject: [PULL 5/8] net: update netdev stream man page with unix socket Date: Fri, 2 Aug 2024 11:19:26 +0800 Message-ID: <20240802031929.44060-6-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568907100116600 From: Laurent Vivier Add the description of "-netdev stream" with a unix domain socket. The code has been added but the man page has not been updated. Include an example how to use "-netdev stream" and "passt" in place of "-netdev user". ("passt" is a non privileged translation proxy between layer-2, like "-netdev stream", and layer-4 on host, like TCP, UDP, ICMP/ICMPv6 echo) Fixes: 13c6be96618c ("net: stream: add unix socket") Signed-off-by: Laurent Vivier Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- qemu-options.hx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 52143cfb8f..2614eea4d7 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3393,6 +3393,46 @@ SRST -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Din= et,addr.host=3Dlocalhost,addr.port=3D1234 =20 +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path=3Dp= ath[,abstract=3Don|off][,tight=3Don|off]`` + Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented unix domain socket. + + ``server=3Don|off`` + if ``on`` create a server socket + + ``addr.path=3Dpath`` + filesystem path to use + + ``abstract=3Don|off`` + if ``on``, this is a Linux abstract socket address. + + ``tight=3Don|off`` + if false, pad an abstract socket address with enough null bytes to= make it fill struct sockaddr_un member sun_path. + + Example (using passt as a replacement of -netdev user): + + .. parsed-literal:: + + # start passt server as a non privileged user + passt + UNIX domain socket bound at /tmp/passt_1.socket + # start QEMU to connect to passt + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0 \\ + -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Dun= ix,addr.path=3D/tmp/passt_1.socket + + Example (two guests connected using a stream oriented unix domain sock= et): + + .. parsed-literal:: + + # first VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:56 \\ + netdev stream,id=3Dnet0,server=3Don,addr.type=3Dunix= ,addr.path=3D/tmp/qemu0 + # second VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ + -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Dun= ix,addr.path=3D/tmp/qemu0 + ``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Dfile= -descriptor`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented socket file descriptor. =20 --=20 2.42.0 From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568869; cv=none; d=zohomail.com; s=zohoarc; b=Gn3qoYZjkMMsp7eNi9EkAo8K0zNrIE5bSPjPvActmF8xKptLy9t1cwOk9lvJw27QCBaYWIEhlII0ex7c1cvI5Iw8fHK8Ka7SVO37oQ77yQjW97UgC5HA1oa2mCzlDrlwCyuajjs9tt7GTHvB/LqFPpJGQl6egUBJv6bYay3SOPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568869; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nBs8OkMFEZs07p/oPIadTvaQSehAUqrlPLPwQHfg1nI=; b=Roby88/9QW68BqvFkvpRP043nbQXp0iRcSSjpA9++uYaV7/Z1vHVeI/z1IAeV0Lr6ISGhHzjz8fL5JMOpg0jtKX1q57pA8XL8lDN/evXDbOJ6BCBg0kRTGx5od5Ib3i/C6sPwcxqWgQtOWam/XiknJTOSVqAdI48EuIrDOB/0cg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568869696143.7043760645388; Thu, 1 Aug 2024 20:21:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZipy-0004ZA-0M; Thu, 01 Aug 2024 23:20:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipv-0004QL-RF for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZipu-0000E5-5z for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:11 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-egbLY2t0MRe-gg2drYDrMQ-1; Thu, 01 Aug 2024 23:20:08 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 94FC41955D54 for ; Fri, 2 Aug 2024 03:20:05 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 022A8300018D; Fri, 2 Aug 2024 03:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568809; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nBs8OkMFEZs07p/oPIadTvaQSehAUqrlPLPwQHfg1nI=; b=F8FNBELLOQeJZsijwf89/n26hFzpjOWfp//fQ6PO7wUXWBjEKNeHiz7StLLw5WxynM8T5C 4nx76wLxd0C2ZaJEd7ap7/vXkQu0rUha1ITM6BERNKCWyNDWxwzdUiS76oMP7OBcvbv9xE 8n9413OG3M+AKd3C8Mac/zpHjDadhLw= X-MC-Unique: egbLY2t0MRe-gg2drYDrMQ-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jason Wang Subject: [PULL 6/8] net: update netdev dgram man page with unix socket Date: Fri, 2 Aug 2024 11:19:27 +0800 Message-ID: <20240802031929.44060-7-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568870849116600 From: Laurent Vivier Add the description of "-netdev dgram" with a unix domain socket. The code has been added but the man page has not been updated. Fixes: 784e7a253104 ("net: dgram: add unix socket") Signed-off-by: Laurent Vivier Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- qemu-options.hx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 2614eea4d7..23a53a7190 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3500,6 +3500,29 @@ SRST -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:56 \\ -netdev dgram,id=3Dnet0,local.type=3Dinet,local.host= =3Dlocalhost,local.port=3D1235,remote.type=3Dinet,remote.host=3Dlocalhost,r= emote.port=3D1234 =20 +``-netdev dgram,id=3Dstr,local.type=3Dunix,local.path=3Dpath[,remote.type= =3Dunix,remote.path=3Dpath]`` + Configure a network backend to connect to another QEMU virtual + machine or a proxy using a datagram oriented unix socket. + + ``local.path=3Dpath`` + filesystem path to use to bind the socket + + ``remote.path=3Dpath`` + filesystem path to use as a destination (see sendto(2)) + + Example (two guests connected using an UDP/UNIX socket): + + .. parsed-literal:: + + # first VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:56 \\ + -netdev dgram,id=3Dnet0,local.type=3Dunix,local.path= =3D/tmp/qemu0,remote.type=3Dunix,remote.path=3D/tmp/qemu1 + # second VM + |qemu_system| linux.img \\ + -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ + -netdev dgram,id=3Dnet0,local.type=3Dunix,local.path= =3D/tmp/qemu1,remote.type=3Dunix,remote.path=3D/tmp/qemu0 + ``-netdev dgram,id=3Dstr,local.type=3Dfd,local.str=3Dfile-descriptor`` Configure a network backend to connect to another QEMU virtual machine or a proxy using a datagram oriented socket file descriptor. --=20 2.42.0 From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568856; cv=none; d=zohomail.com; s=zohoarc; b=g4z5J5AXcINX2bt7x9y40WuAOv6bGEojTTaqeytMq1DIKtEYskhnWa6MGLaN9sHywZnT0X3krCrVJas8XVD+EPbffk8XrhKYe6c2Vph0WdqFT2LLL0xYzeQXIAxFbSFUQ9+nCNB4ULxndpAt0dF6RdAxVqzs36Py4OqJbE5/vsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568856; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kH91dpfOq90fqHB6xmeludhTenxbeE0OM39M3ee/QGM=; b=R4rUL+Dd1svO0InZKXBZRl5cr011c1xI2Wuw9XXqsOzLQ1mWuFX70I2KqubV84ax2xWwe16avpKxUOQlMffOUxaTnyv6d87LgzcD3ZTLJSbHdfYLfFrSQvZYVkCQAlKNjraUFl30ecVqsaCw8KVM86n/BxPc7e81TeDY5aqMs6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568856723203.63310149320182; Thu, 1 Aug 2024 20:20:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZiq5-00055V-1r; Thu, 01 Aug 2024 23:20:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZiq2-0004wD-Iv for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZiq0-0000FA-Kw for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:18 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-269-jbSE6dOEP72hKY1bPCfdVA-1; Thu, 01 Aug 2024 23:20:11 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 021F61955D4B for ; Fri, 2 Aug 2024 03:20:10 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6B336300018D; Fri, 2 Aug 2024 03:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kH91dpfOq90fqHB6xmeludhTenxbeE0OM39M3ee/QGM=; b=gn6gRgRRrl/fRtX1Bj8MU5D9wHpuPPNHNNWyLMW1JLqBxLC5gL82Xl/W89j6Wovtb+jEqM 5tcGsjDOYmBmUNcxL1Z/TtwdVW6NyK0azAdGz2oaPuT30rAGHitMmoqDLfptcME0e7p0+W NT2s/QMeqMNrolymej/0VsIFzXDyo7M= X-MC-Unique: jbSE6dOEP72hKY1bPCfdVA-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jason Wang Subject: [PULL 7/8] net: update netdev stream man page with the reconnect parameter Date: Fri, 2 Aug 2024 11:19:28 +0800 Message-ID: <20240802031929.44060-8-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568858855116600 From: Laurent Vivier "-netdev stream" supports a reconnect parameter that attempts to reconnect automatically the socket if it is disconnected. The code has been added but the man page has not been updated. Fixes: 148fbf0d58a6 ("net: stream: add a new option to automatically reconn= ect" Signed-off-by: Laurent Vivier Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- qemu-options.hx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 23a53a7190..cee0da2014 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3353,7 +3353,7 @@ SRST -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56= \\ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102= ,localaddr=3D1.2.3.4 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don|off= ][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don|off= ][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect=3Ds= econds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a TCP/IP socket. =20 ``server=3Don|off`` @@ -3380,6 +3380,10 @@ SRST ``ipv6=3Don|off`` whether to accept IPv6 addresses, default to try both IPv4 and IPv6 =20 + ``reconnect=3Dseconds`` + for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of seconds. + Setting this to zero disables this function. (default: 0) + Example (two guests connected using a TCP/IP socket): =20 .. parsed-literal:: @@ -3391,9 +3395,9 @@ SRST # second VM |qemu_system| linux.img \\ -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ - -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Din= et,addr.host=3Dlocalhost,addr.port=3D1234 + -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Din= et,addr.host=3Dlocalhost,addr.port=3D1234,reconnect=3D5 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path=3Dp= ath[,abstract=3Don|off][,tight=3Don|off]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path=3Dp= ath[,abstract=3Don|off][,tight=3Don|off][,reconnect=3Dseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented unix domain socket. =20 ``server=3Don|off`` @@ -3408,6 +3412,10 @@ SRST ``tight=3Don|off`` if false, pad an abstract socket address with enough null bytes to= make it fill struct sockaddr_un member sun_path. =20 + ``reconnect=3Dseconds`` + for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of seconds. + Setting this to zero disables this function. (default: 0) + Example (using passt as a replacement of -netdev user): =20 .. parsed-literal:: @@ -3431,9 +3439,9 @@ SRST # second VM |qemu_system| linux.img \\ -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ - -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Dun= ix,addr.path=3D/tmp/qemu0 + -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Dun= ix,addr.path=3D/tmp/qemu0,reconnect=3D5 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Dfile= -descriptor`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Dfile= -descriptor[,reconnect=3Dseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented socket file descriptor. =20 ``server=3Don|off`` @@ -3442,6 +3450,10 @@ SRST ``addr.str=3Dfile-descriptor`` file descriptor number to use as a socket =20 + ``reconnect=3Dseconds`` + for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of seconds. + Setting this to zero disables this function. (default: 0) + ``-netdev dgram,id=3Dstr,remote.type=3Dinet,remote.host=3Dmaddr,remote.por= t=3Dport[,local.type=3Dinet,local.host=3Daddr]`` Configure a network backend to connect to a multicast address. =20 --=20 2.42.0 From nobody Sun Nov 24 14:52:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722568868; cv=none; d=zohomail.com; s=zohoarc; b=jYoMuiQQfUAicsQJphaf+l1QhIaAqcQzgk2PX/vDMVD+cjyPAs/thjBeiLwCfSF06XOHKstQf4Rt9X+JBOk01ZWup//eSkdWLpZE0jgAF44m7k2PxGjVKjLvQXKC/6SkJuBDuapFhpgTVi3mv6bcAZhlMEzeoTyolkDizrov9jI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722568868; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AnZaL0zp9IvvGokEEaSQs7FqBYwJkhZko8nE8QpANLI=; b=edTbEu2eqVHGs77KXveluaDTB7e5QgzTR6gJbKvAGukTWrlthgpzZ2soY/n21x6Sk1Waz/T0NQi8nisJqnec7WQCiWvXbwI8/A98vnqw0atdzewtmJvjpy/gizJr0SzqnbdmlsmDqW6ADXGbX8t297t5n+vFC0Lbv/AZPdzbv9M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722568868161347.40728194659596; Thu, 1 Aug 2024 20:21:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZiqI-0006b8-RZ; Thu, 01 Aug 2024 23:20:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZiqG-0006E5-9d for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZiq8-0000GQ-P0 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 23:20:27 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-Cndk9v5KPiKDXFAjIHywfw-1; Thu, 01 Aug 2024 23:20:20 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EF6641955D52; Fri, 2 Aug 2024 03:20:15 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.229]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CEE54300018D; Fri, 2 Aug 2024 03:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722568824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AnZaL0zp9IvvGokEEaSQs7FqBYwJkhZko8nE8QpANLI=; b=UvCWsrAR7mcqOWcwi4n0iXyYGG7EzxJJAnoOGhgHeHAofPrHVfjReUXpbFx5ZALDWDfBRv lyV0i/PPcu3zbGZ8mCfg2f4xYZ8gLVLn3qwDaKpq8bTxPZpfR6FrJCjM0iFwqreG4K770j gkJ2GQ1FHjeUABcTD7NKboYPp5YKwsc= X-MC-Unique: Cndk9v5KPiKDXFAjIHywfw-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: David Woodhouse , qemu-stable@nongnu.org, Michael Tokarev , Jason Wang Subject: [PULL 8/8] net: Reinstate '-net nic, model=help' output as documented in man page Date: Fri, 2 Aug 2024 11:19:29 +0800 Message-ID: <20240802031929.44060-9-jasowang@redhat.com> In-Reply-To: <20240802031929.44060-1-jasowang@redhat.com> References: <20240802031929.44060-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722568868888116601 Content-Type: text/plain; charset="utf-8" From: David Woodhouse While refactoring the NIC initialization code, I broke '-net nic,model=3Dhe= lp' which no longer outputs a list of available NIC models. Fixes: 2cdeca04adab ("net: report list of available models according to pla= tform") Cc: qemu-stable@nongnu.org Signed-off-by: David Woodhouse Reviewed-by: Michael Tokarev Signed-off-by: Jason Wang Reviewed-by: Richard Henderson --- net/net.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/net/net.c b/net/net.c index 6938da05e0..2eb8bc9c0b 100644 --- a/net/net.c +++ b/net/net.c @@ -1139,6 +1139,21 @@ NICInfo *qemu_find_nic_info(const char *typename, bo= ol match_default, return NULL; } =20 +static bool is_nic_model_help_option(const char *model) +{ + if (model && is_help_option(model)) { + /* + * Trigger the help output by instantiating the hash table which + * will gather tha available models as they get registered. + */ + if (!nic_model_help) { + nic_model_help =3D g_hash_table_new_full(g_str_hash, g_str_equ= al, + g_free, NULL); + } + return true; + } + return false; +} =20 /* "I have created a device. Please configure it if you can" */ bool qemu_configure_nic_device(DeviceState *dev, bool match_default, @@ -1722,6 +1737,12 @@ void net_check_clients(void) =20 static int net_init_client(void *dummy, QemuOpts *opts, Error **errp) { + const char *model =3D qemu_opt_get_del(opts, "model"); + + if (is_nic_model_help_option(model)) { + return 0; + } + return net_client_init(opts, false, errp); } =20 @@ -1778,9 +1799,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts,= Error **errp) memset(ni, 0, sizeof(*ni)); ni->model =3D qemu_opt_get_del(opts, "model"); =20 - if (!nic_model_help && !g_strcmp0(ni->model, "help")) { - nic_model_help =3D g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); + if (is_nic_model_help_option(ni->model)) { return 0; } =20 --=20 2.42.0