From nobody Sat Feb 7 12:29:41 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1712003909504599.345102473762; Mon, 1 Apr 2024 13:38:29 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 703791D6D; Mon, 1 Apr 2024 16:38:28 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BA1EC1B84; Mon, 1 Apr 2024 16:34:49 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2EE9F1AF8; Mon, 1 Apr 2024 16:34:36 -0400 (EDT) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E181C1A67 for ; Mon, 1 Apr 2024 16:34:33 -0400 (EDT) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-34100f4f9a2so3081296f8f.2 for ; Mon, 01 Apr 2024 13:34:33 -0700 (PDT) Received: from localhost.localdomain ([134.0.206.35]) by smtp.gmail.com with ESMTPSA id bp8-20020a5d5a88000000b00343300a4eb8sm12140953wrb.49.2024.04.01.13.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 13:34:32 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712003672; x=1712608472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zptFUMdGZCtUUCp+G0rvnqYjE+8+HN3UaQ1GxxVWA7Y=; b=G4bTxpjEgBCjuLOECy2Ml9mXQ3S70mFIp0GPvrIZ3l2mo08LupG0wSawwOUhYBlGyh usi3K0FMA5Nad23YxFxgVhzhTo9oBz3/PAqhnKlQTV0dPUZlWIucnIyInID55CagBe2s VQLId1xOiMRJpHAcfgmB8LSq7+JaBBPkoMqtJEau3foYoDONkvhnQIjGgPCgQgt1NrYY T4tzgnKj6U1n/esDlJhOPFSlicmL2mrP9gHxy0gQ7Mjde3XuN47CsoQOkgBLcEL8TjBL jnNxDC2qAeualDmJ7wHo1qwOrFo5yORE+rEhJorVr58hyqgPSslU8LTg8UOWsnKFFeHQ 03Uw== X-Gm-Message-State: AOJu0Yx7raRI+UoQYHucv5Q9+8/ppTZfaNYwJgdj5b26mHfIG9QDMDk2 6tsd88rfSAKyLBcR9JZj/1l9QCwkOhrlIlpFF3uE3dtbsM7VmbispNZZYYPN X-Google-Smtp-Source: AGHT+IGgHmavKcyA3scAZxtiZJwil/0dwfh/6xOQw/KtuhnoLCBUAYAH9irRk4OkEqiFQ4uqwJAHjw== X-Received: by 2002:adf:fe87:0:b0:341:b88b:1625 with SMTP id l7-20020adffe87000000b00341b88b1625mr6296966wrr.47.1712003672333; Mon, 01 Apr 2024 13:34:32 -0700 (PDT) From: Rayhan Faizel To: devel@lists.libvirt.org Subject: [PATCH 2/3] conf: Improve parsing of usb-net devices Date: Tue, 2 Apr 2024 02:01:17 +0530 Message-Id: <20240401203118.87850-3-rayhan.faizel@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240401203118.87850-1-rayhan.faizel@gmail.com> References: <20240401203118.87850-1-rayhan.faizel@gmail.com> MIME-Version: 1.0 Message-ID-Hash: AONW5CUZCBBQEMPSPGT5KBEEWDF456BW X-Message-ID-Hash: AONW5CUZCBBQEMPSPGT5KBEEWDF456BW X-MailFrom: rayhan.faizel@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Rayhan Faizel X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1712003910470100001 This patch will allow usb-net devices to be automatically assigned a USB address (and skip any attempt to assign a PCI one). Signed-off-by: Rayhan Faizel Reviewed-by: Peter Krempa --- docs/formatdomain.rst | 2 +- src/conf/domain_conf.c | 9 ++++++++- src/qemu/qemu_domain_address.c | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 2adc2ff968..c58ff6a08c 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -5596,7 +5596,7 @@ supported models with these commands: qemu-kvm -net nic,model=3D? /dev/null =20 Typical values for QEMU and KVM include: ne2k_isa i82551 i82557b i82559er -ne2k_pci pcnet rtl8139 e1000 virtio. :since:`Since 5.2.0`, +ne2k_pci pcnet rtl8139 e1000 virtio usb-net. :since:`Since 5.2.0`, ``virtio-transitional`` and ``virtio-non-transitional`` values are support= ed. See `Virtio transitional devices`_ for more details. :since:`Since 9.3.0` igb is also supported. diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 770b5fbbff..c45484c359 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28677,7 +28677,14 @@ virDomainUSBDeviceDefForeach(virDomainDef *def, } } =20 - /* TODO: add def->nets here when libvirt starts supporting usb-net */ + /* usb-net */ + for (i =3D 0; i < def->nnets; i++) { + virDomainNetDef *net =3D def->nets[i]; + if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_USB_NET) { + if (iter(&net->info, opaque) < 0) + return -1; + } + } =20 /* usb-ccid */ for (i =3D 0; i < def->ncontrollers; i++) { diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index cc3bc76971..83f9654fd8 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2087,6 +2087,11 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def, for (i =3D 0; i < def->nnets; i++) { virDomainNetDef *net =3D def->nets[i]; =20 + /* Skip usb-net device */ + if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_USB_NET) { + continue; + } + /* type=3D'hostdev' network devices might be USB, and are also * in hostdevs list anyway, so handle them with other hostdevs * instead of here. --=20 2.34.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org