From nobody Fri Nov 22 23:58:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=solinno.co.uk ARC-Seal: i=1; a=rsa-sha256; t=1715857024; cv=none; d=zohomail.com; s=zohoarc; b=jTJ0K4klxl6UaTI2dohjPSxKc3XhI2t+6kshGUd7hHuXq+1jB+NIHTvJgROjd2bZxbHLcEAlmYGMHigun+LUXu0sGn7hMNosz/6x6aeVIzUzzc9jn4Q+mh2EKn7jj7pT+5tKXo/j+JGYGmDkEys8HbV2XGihkxEkBmiFNQp5Tdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715857024; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2UQTSsP739Ir3dZeWWcr1saAiR6B3ydAhAue8TkfeYQ=; b=InLYH5A5J+9YPdzQ7XXux/lz6Rkjt6DFcEkmJJtC6Rop8XGgsxNCQ6aIPEn6lrL06R8XZELK5hWOGyWxB8sYeipyus0eF6bNyVFBxn0c7fcFbbHfAVz7Sbik7Q3B3doatqSLPo658CEXeRDq81fxiE80TKfRimRZCsI7DIMStN0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715857024564354.47448969981826; Thu, 16 May 2024 03:57:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.723124.1127687 (Exim 4.92) (envelope-from ) id 1s7Yn4-0007vy-9F; Thu, 16 May 2024 10:56:50 +0000 Received: by outflank-mailman (output) from mailman id 723124.1127687; Thu, 16 May 2024 10:56:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7Yn4-0007vn-6c; Thu, 16 May 2024 10:56:50 +0000 Received: by outflank-mailman (input) for mailman id 723124; Thu, 16 May 2024 10:56:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7Yn2-0007M7-8e for xen-devel@lists.xenproject.org; Thu, 16 May 2024 10:56:48 +0000 Received: from doppler.solinno.uk (doppler.solinno.uk [81.2.106.178]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fcf3a761-1372-11ef-b4bb-af5377834399; Thu, 16 May 2024 12:56:46 +0200 (CEST) Received: from folly.solinno.co.uk (folly.dyn.solinno.co.uk [192.168.2.135]) by doppler.solinno.uk (Postfix) with ESMTPSA id 2997080079; Thu, 16 May 2024 11:56:46 +0100 (BST) Received: by folly.solinno.co.uk (Postfix, from userid 1000) id 03ED920189; Thu, 16 May 2024 11:56:46 +0100 (BST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fcf3a761-1372-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1715857006; bh=IqQbHL4zd6sroMW8oqRG7fEFGbUFht56fidjDQZye10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhpBQQ3x4Lb7jWtkqMmnz4tg6Gmc8b+edVc4M0iWm8UQ11z8en4i2Mj7HQdjuYoD7 oGVrLAf1XEiTy5TMWzh7IEMqAJBsgjXrsVySQPmeHw9G9VFB6OT2WKF85/unQxZLuv rUeolKYwZtQsKcQM3xneLSPrmP+dv1nrx3jANIrY= From: Leigh Brown To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Anthony Perard , Jason Andryuk , Leigh Brown Subject: [PATCH v3 1/4] tools/libs/light: Add vlan field to libxl_device_nic Date: Thu, 16 May 2024 11:56:09 +0100 Message-Id: <20240516105612.15306-2-leigh@solinno.co.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240516105612.15306-1-leigh@solinno.co.uk> References: <20240516105612.15306-1-leigh@solinno.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @solinno.co.uk) X-ZM-MESSAGEID: 1715857026866100001 Content-Type: text/plain; charset="utf-8" Add `vlan' string field to libxl_device_nic, to allow a VLAN configuration to be specified for the VIF when adding it to the bridge device. Update libxl_nic.c to read and write the vlan field from the xenstore. This provides the capability for supported operating systems (e.g. Linux) to perform VLAN filtering on bridge ports. The Xen hotplug scripts need to be updated to read this information from the xenstore and perform the required configuration. Signed-off-by: Leigh Brown Reviewed-by: Jason Andryuk --- tools/libs/light/libxl_nic.c | 10 ++++++++++ tools/libs/light/libxl_types.idl | 1 + 2 files changed, 11 insertions(+) diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c index d6bf06fc34..d861e3726d 100644 --- a/tools/libs/light/libxl_nic.c +++ b/tools/libs/light/libxl_nic.c @@ -233,6 +233,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint= 32_t domid, flexarray_append(back, GCSPRINTF("%u", nic->mtu)); } =20 + if (nic->vlan) { + flexarray_append(back, "vlan"); + flexarray_append(back, libxl__strdup(gc, nic->vlan)); + } + flexarray_append(back, "bridge"); flexarray_append(back, libxl__strdup(gc, nic->bridge)); flexarray_append(back, "handle"); @@ -313,6 +318,11 @@ static int libxl__nic_from_xenstore(libxl__gc *gc, con= st char *libxl_path, nic->mtu =3D LIBXL_DEVICE_NIC_MTU_DEFAULT; } =20 + rc =3D libxl__xs_read_checked(gc, XBT_NULL, + GCSPRINTF("%s/vlan", libxl_path), + (const char **)(&nic->vlan)); + if (rc) goto out; + rc =3D libxl__xs_read_checked(gc, XBT_NULL, GCSPRINTF("%s/mac", libxl_path), &tmp); if (rc) goto out; diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index 7d8bd5d216..5c510dc272 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -809,6 +809,7 @@ libxl_device_nic =3D Struct("device_nic", [ ("backend_domname", string), ("devid", libxl_devid), ("mtu", integer), + ("vlan", string), ("model", string), ("mac", libxl_mac), ("ip", string), --=20 2.39.2