From patchwork Fri May 3 14:41:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leigh Brown X-Patchwork-Id: 13652966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52033C25B10 for ; Fri, 3 May 2024 14:42:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.716522.1118708 (Exim 4.92) (envelope-from ) id 1s2u6e-0003Dw-8X; Fri, 03 May 2024 14:41:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 716522.1118708; Fri, 03 May 2024 14:41:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6e-0003Cc-1D; Fri, 03 May 2024 14:41:48 +0000 Received: by outflank-mailman (input) for mailman id 716522; Fri, 03 May 2024 14:41:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6d-0002U8-80 for xen-devel@lists.xenproject.org; Fri, 03 May 2024 14:41:47 +0000 Received: from doppler.solinno.uk (doppler.solinno.uk [81.2.106.178]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 41cc7177-095b-11ef-909c-e314d9c70b13; Fri, 03 May 2024 16:41:44 +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 D40B88009E; Fri, 3 May 2024 15:41:41 +0100 (BST) Received: by folly.solinno.co.uk (Postfix, from userid 1000) id A86C020171; Fri, 3 May 2024 15:41:41 +0100 (BST) 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: 41cc7177-095b-11ef-909c-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1714747301; bh=QhPCF+Da6a6rJ80ZqmX2rlEn+1VBdptYD+Uv3wW6YvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vf4ivSKnOtFHHamPhhsa9RrmD62thFAMLYjCSsHRbp37Nr7lydHqxJ+RpEYMfFpkp jQPt019Su7UiiRVXWTHIGlmJcNxnYXK7v95BKn3Wa2c6sQsnyZoVg5LTWFeq1i3K7H 7eGqRtT/4a2rfc9rBj1h+D619duHqGPviuoy0Oto= From: Leigh Brown To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, anthony.perard@citrix.com, Leigh Brown Subject: [RFC PATCH 1/5] tools/libs/light: Add vid field to libxl_device_nic Date: Fri, 3 May 2024 15:41:20 +0100 Message-Id: <20240503144124.12931-2-leigh@solinno.co.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240503144124.12931-1-leigh@solinno.co.uk> References: <20240503144124.12931-1-leigh@solinno.co.uk> MIME-Version: 1.0 Add integer member `vid' to libxl_device_nic, to represent the VLAN ID to assign to the VIF when adding it to the bridge device. Update libxl_nic.c to read and write the vid 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 then xenstore and perform the required configuration. Signed-off-by: Leigh Brown --- tools/libs/light/libxl_nic.c | 20 ++++++++++++++++++++ tools/libs/light/libxl_types.idl | 1 + 2 files changed, 21 insertions(+) diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c index d6bf06fc34..e28b9101ee 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, uint32_t domid, flexarray_append(back, GCSPRINTF("%u", nic->mtu)); } + if (nic->vid) { + flexarray_append(back, "vid"); + flexarray_append(back, GCSPRINTF("%u", nic->vid)); + } + flexarray_append(back, "bridge"); flexarray_append(back, libxl__strdup(gc, nic->bridge)); flexarray_append(back, "handle"); @@ -313,6 +318,21 @@ static int libxl__nic_from_xenstore(libxl__gc *gc, const char *libxl_path, nic->mtu = LIBXL_DEVICE_NIC_MTU_DEFAULT; } + rc = libxl__xs_read_checked(gc, XBT_NULL, + GCSPRINTF("%s/vid", libxl_path), &tmp); + if (rc) goto out; + if (tmp) { + char *endptr; + + nic->vid = strtol(tmp, &endptr, 10); + if (*endptr != '\0') { + rc = ERROR_INVAL; + goto out; + } + } else { + nic->vid = 0; + } + rc = 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_types.idl index 7d8bd5d216..df5185128c 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -809,6 +809,7 @@ libxl_device_nic = Struct("device_nic", [ ("backend_domname", string), ("devid", libxl_devid), ("mtu", integer), + ("vid", integer), ("model", string), ("mac", libxl_mac), ("ip", string), From patchwork Fri May 3 14:41:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leigh Brown X-Patchwork-Id: 13652964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 168CEC25B74 for ; Fri, 3 May 2024 14:42:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.716519.1118677 (Exim 4.92) (envelope-from ) id 1s2u6c-0002X3-Ey; Fri, 03 May 2024 14:41:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 716519.1118677; Fri, 03 May 2024 14:41:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6c-0002Vy-A4; Fri, 03 May 2024 14:41:46 +0000 Received: by outflank-mailman (input) for mailman id 716519; Fri, 03 May 2024 14:41:45 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6b-0002U8-JE for xen-devel@lists.xenproject.org; Fri, 03 May 2024 14:41:45 +0000 Received: from doppler.solinno.uk (doppler.solinno.uk [81.2.106.178]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 41cc7167-095b-11ef-909c-e314d9c70b13; Fri, 03 May 2024 16:41:44 +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 E26C1800A4; Fri, 3 May 2024 15:41:41 +0100 (BST) Received: by folly.solinno.co.uk (Postfix, from userid 1000) id AAA762018A; Fri, 3 May 2024 15:41:41 +0100 (BST) 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: 41cc7167-095b-11ef-909c-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1714747301; bh=y7+Cz3k/mrxS1xulR9+YhBk7BokYkEDmmQsPxFpElbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJi3qh4AzWO5q9AsQrDONF2oTzG3702q0mdtoTkVL8nMrWVE6FiAi5RKy16DYKvLI K8bF5MLkVpKkLkM9SnoC824e6fhd1b5xwbdhbvlV+2a1Lu5XPpyDsfUh/5IuhUhWdI ETt2YJGJYe/y20Ea6kvV+GDzEpRR8zBKyTxf7GNI= From: Leigh Brown To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, anthony.perard@citrix.com, Leigh Brown Subject: [RFC PATCH 2/5] tools/xl: add vid keyword vif option Date: Fri, 3 May 2024 15:41:21 +0100 Message-Id: <20240503144124.12931-3-leigh@solinno.co.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240503144124.12931-1-leigh@solinno.co.uk> References: <20240503144124.12931-1-leigh@solinno.co.uk> MIME-Version: 1.0 Update parse_nic_config() to support a new `vid' keyword. This keyword specifies the numeric VLAN ID to assign to the VIF when attaching it to the bridge port, on operating systems that support the capability (e.g. Linux). Signed-off-by: Leigh Brown --- tools/xl/xl_parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index ed983200c3..5d5dd4ec04 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -565,6 +565,8 @@ int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token) nic->devid = parse_ulong(oparg); } else if (MATCH_OPTION("mtu", token, oparg)) { nic->mtu = parse_ulong(oparg); + } else if (MATCH_OPTION("vid", token, oparg)) { + nic->vid = parse_ulong(oparg); } else if (!strcmp("trusted", token)) { libxl_defbool_set(&nic->trusted, true); } else if (!strcmp("untrusted", token)) { From patchwork Fri May 3 14:41:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leigh Brown X-Patchwork-Id: 13652962 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D89D2C4345F for ; Fri, 3 May 2024 14:42:00 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.716523.1118723 (Exim 4.92) (envelope-from ) id 1s2u6f-0003fN-CG; Fri, 03 May 2024 14:41:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 716523.1118723; Fri, 03 May 2024 14:41:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6f-0003ej-9Z; Fri, 03 May 2024 14:41:49 +0000 Received: by outflank-mailman (input) for mailman id 716523; Fri, 03 May 2024 14:41:48 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6e-0002U8-84 for xen-devel@lists.xenproject.org; Fri, 03 May 2024 14:41:48 +0000 Received: from doppler.solinno.uk (doppler.solinno.uk [81.2.106.178]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 41cc7170-095b-11ef-909c-e314d9c70b13; Fri, 03 May 2024 16:41:44 +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 DF4528009F; Fri, 3 May 2024 15:41:41 +0100 (BST) Received: by folly.solinno.co.uk (Postfix, from userid 1000) id ACED82018B; Fri, 3 May 2024 15:41:41 +0100 (BST) 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: 41cc7170-095b-11ef-909c-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1714747301; bh=t0vnuYLk59oT/1dlHfshijBhS9X5czFtKDiWa/l8Kes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ooJVneUZTiXWaJZJAdl794ELI5sa5+myNhpJEMY/4OrE4hQ2pYvW+sgx/FuPRdLJJ ILZLQRguSOz6HlG5PubvaGkKXAazeNqAnkOJOiiABst7mFGZ8kWMxsnwu/oLLxjlbp xfdffJrTef0+bl/YRyKs2yCjvo4k5QfRs6KuM1NM= From: Leigh Brown To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, anthony.perard@citrix.com, Leigh Brown Subject: [RFC PATCH 3/5] tools/hotplug/Linux: Add bridge VLAN support Date: Fri, 3 May 2024 15:41:22 +0100 Message-Id: <20240503144124.12931-4-leigh@solinno.co.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240503144124.12931-1-leigh@solinno.co.uk> References: <20240503144124.12931-1-leigh@solinno.co.uk> MIME-Version: 1.0 Update add_to_bridge shell function to read the vid parameter from xenstore and set the bridge LAN for the VID to the given value. This only works when using the iproute2 bridge command, so a warning is issued if using the legacy brctl command and a vid is set. Signed-off-by: Leigh Brown --- tools/hotplug/Linux/xen-network-common.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh index 42fa704e8d..19a8b3c7e5 100644 --- a/tools/hotplug/Linux/xen-network-common.sh +++ b/tools/hotplug/Linux/xen-network-common.sh @@ -125,14 +125,23 @@ create_bridge () { add_to_bridge () { local bridge=$1 local dev=$2 + local vid=$(xenstore_read_default "$XENBUS_PATH/vid" "") # Don't add $dev to $bridge if it's already on the bridge. if [ ! -e "/sys/class/net/${bridge}/brif/${dev}" ]; then log debug "adding $dev to bridge $bridge" if which brctl >&/dev/null; then brctl addif ${bridge} ${dev} + if [ -n "${vid}" ] ;then + log warning "bridge command not available, ignoring vid" + fi else ip link set ${dev} master ${bridge} + if [ -n "${vid}" ] ;then + log debug "Assigning $dev to vid $vid" + bridge vlan del dev ${dev} vid 1 + bridge vlan add dev ${dev} vid ${vid} pvid untagged + fi fi else log debug "$dev already on bridge $bridge" From patchwork Fri May 3 14:41:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leigh Brown X-Patchwork-Id: 13652965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20F70C25B5C for ; Fri, 3 May 2024 14:42:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.716518.1118673 (Exim 4.92) (envelope-from ) id 1s2u6c-0002UV-73; Fri, 03 May 2024 14:41:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 716518.1118673; Fri, 03 May 2024 14:41:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6c-0002UO-47; Fri, 03 May 2024 14:41:46 +0000 Received: by outflank-mailman (input) for mailman id 716518; Fri, 03 May 2024 14:41:45 +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 1s2u6a-0002U7-VG for xen-devel@lists.xenproject.org; Fri, 03 May 2024 14:41:45 +0000 Received: from doppler.solinno.uk (doppler.solinno.uk [81.2.106.178]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 41cbcce7-095b-11ef-b4bb-af5377834399; Fri, 03 May 2024 16:41:42 +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 E5FE8800A5; Fri, 3 May 2024 15:41:41 +0100 (BST) Received: by folly.solinno.co.uk (Postfix, from userid 1000) id AF1072018C; Fri, 3 May 2024 15:41:41 +0100 (BST) 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: 41cbcce7-095b-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1714747301; bh=KhHuubhLIPBWRZvjJf4xnGUWWnqkkuWA6mNwGxiVRt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yIHTe500zhFyoQtaZ4zkjaCkZJa6Q5BneUmw1Ijkt/ZikST7LrcEkv+oFVFan5vzS bbMcZAeKEttsSMKI8zH3AbBoJ6rOaM6Xi1a6B5i74cX3NDlGLuXllCTrOGuinevZu4 xNX6FFJ4xgcgNuBu++xFPPYyBBdXoVW7Saa/25jc= From: Leigh Brown To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, anthony.perard@citrix.com, Leigh Brown Subject: [RFC PATCH 4/5] docs/man: document VIF vid keyword Date: Fri, 3 May 2024 15:41:23 +0100 Message-Id: <20240503144124.12931-5-leigh@solinno.co.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240503144124.12931-1-leigh@solinno.co.uk> References: <20240503144124.12931-1-leigh@solinno.co.uk> MIME-Version: 1.0 Document the new `vid' keyword in xl-network-configuration(5). Signed-off-by: Leigh Brown --- docs/man/xl-network-configuration.5.pod.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/man/xl-network-configuration.5.pod.in b/docs/man/xl-network-configuration.5.pod.in index f3e379bcf8..fe2615ae30 100644 --- a/docs/man/xl-network-configuration.5.pod.in +++ b/docs/man/xl-network-configuration.5.pod.in @@ -259,6 +259,12 @@ Specifies the MTU (i.e. the maximum size of an IP payload, exclusing headers). T default value is 1500 but, if the VIF is attached to a bridge, it will be set to match unless overridden by this parameter. +=head2 vid + +Specifies the VLAN ID. If this is set to a non-zero value, it will be specified +when attaching the VIF to a bridge. This can be used on operating systems that +support bridge VLANs (e.g. Linux using iproute2). + =head2 trusted / untrusted An advisory setting for the frontend driver on whether the backend should be From patchwork Fri May 3 14:41:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leigh Brown X-Patchwork-Id: 13652967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E604C25B76 for ; Fri, 3 May 2024 14:42:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.716521.1118703 (Exim 4.92) (envelope-from ) id 1s2u6d-0003BK-UR; Fri, 03 May 2024 14:41:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 716521.1118703; Fri, 03 May 2024 14:41:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6d-0003B2-RI; Fri, 03 May 2024 14:41:47 +0000 Received: by outflank-mailman (input) for mailman id 716521; Fri, 03 May 2024 14:41:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s2u6c-0002U8-7x for xen-devel@lists.xenproject.org; Fri, 03 May 2024 14:41:46 +0000 Received: from doppler.solinno.uk (doppler.solinno.uk [81.2.106.178]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 43139d67-095b-11ef-909c-e314d9c70b13; Fri, 03 May 2024 16:41:44 +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 0A049800AB; Fri, 3 May 2024 15:41:42 +0100 (BST) Received: by folly.solinno.co.uk (Postfix, from userid 1000) id B133E2018D; Fri, 3 May 2024 15:41:41 +0100 (BST) 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: 43139d67-095b-11ef-909c-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=solinno.co.uk; s=mail; t=1714747302; bh=a0ZpqrsC8JFCevX5tRnZgArUyWq4u2VycjvhQNh9u1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEfqaY478oIg2vS+Gun7DbFYJ1k3n+O0upYaUFHKMuyVbnqsCJJum8fmDve9LmCMr znkAJm/f0g+aq7YPKGvmflVdOm76LdBA1nLHCQz15e24Uln2nrAQStclLwh0Afr/b9 c0T0QShXykumfgqFhAdJL7Mf+X0g7+cCxQ9kVQHw= From: Leigh Brown To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, anthony.perard@citrix.com, Leigh Brown Subject: [RFC PATCH 5/5] tools/examples: Examples Linux bridge VLAN config Date: Fri, 3 May 2024 15:41:24 +0100 Message-Id: <20240503144124.12931-6-leigh@solinno.co.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240503144124.12931-1-leigh@solinno.co.uk> References: <20240503144124.12931-1-leigh@solinno.co.uk> MIME-Version: 1.0 Add a new directory linux-bridge-vlan showing how to configure systemd-networkd to support a bridge VLAN configuration. Signed-off-by: Leigh Brown --- tools/examples/linux-bridge-vlan/README | 52 +++++++++++++++++++ tools/examples/linux-bridge-vlan/br0.netdev | 7 +++ tools/examples/linux-bridge-vlan/br0.network | 8 +++ .../examples/linux-bridge-vlan/enp0s0.network | 16 ++++++ 4 files changed, 83 insertions(+) create mode 100644 tools/examples/linux-bridge-vlan/README create mode 100644 tools/examples/linux-bridge-vlan/br0.netdev create mode 100644 tools/examples/linux-bridge-vlan/br0.network create mode 100644 tools/examples/linux-bridge-vlan/enp0s0.network diff --git a/tools/examples/linux-bridge-vlan/README b/tools/examples/linux-bridge-vlan/README new file mode 100644 index 0000000000..b287710e0f --- /dev/null +++ b/tools/examples/linux-bridge-vlan/README @@ -0,0 +1,52 @@ +Linux Xen Dom0 single bridge multiple VLAN configuration with systemd +===================================================================== + +Introduction +------------ + +This directory contains example files to be placed in /etc/systemd/network +to enable a single bridge with multiple VLAN support. + +The example is to support the scenario where the Xen host network interface +is connected to an Ethernet switch configured as a trunk port. Each domain +VIF can then be configured with the VLAN id (vid) of the required VLAN. + +The example files create a bridge device called br0, with a physical interface +called enp0s0. You will need to update this with your system's device name. + +Key points of the configuration are: + +1. In br0.netdev, VLANFiltering=on is set. This is required to ensure the + VLAN tags are handled correctly. If it is not set then the packets + from the vif interfaces will not have the correct VLAN tags set. I + observed them with the pvid in the switch MAC address table. + +2. In br0.network, a system IPv4 address is configured that can be updated + according to your local network settings. + +3. In enp0s0.network, Bridge=br0 sets the bridge device to connect to and + there is a [BridgeVLAN] section for each VLAN you want to give access + to the switch. Note, if you want to create an internal VLAN private to + the host, do not include that VLAN id in this file. + + +Domain configuration +-------------------- + +Add the vid= keyword to the vif definition in the domain. For example: + +vif = [ 'mac=xx:xx:xx:xx:xx:xx, bridge=br0, vid=10' ] + + +Hints and tips +-------------- + +1. To check if vlan_filtering is enabled, run: + # cat /sys/devices/virtual/net//bridge/vlan_filtering + +2. To check the bridge port VLAN assignments, run: + # bridge vlan + +3. To check the vid setting in the xenstore, run: + # xenstore-ls -f | grep 'vid =' + diff --git a/tools/examples/linux-bridge-vlan/br0.netdev b/tools/examples/linux-bridge-vlan/br0.netdev new file mode 100644 index 0000000000..ae1fe487c3 --- /dev/null +++ b/tools/examples/linux-bridge-vlan/br0.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=br0 +Kind=bridge +MACAddress=xx:xx:xx:xx:xx:xx + +[Bridge] +VLANFiltering=on diff --git a/tools/examples/linux-bridge-vlan/br0.network b/tools/examples/linux-bridge-vlan/br0.network new file mode 100644 index 0000000000..b56203b66a --- /dev/null +++ b/tools/examples/linux-bridge-vlan/br0.network @@ -0,0 +1,8 @@ +[Match] +Name=br0 + +[Network] +DNS=8.8.8.8 +#Domains=example.com +Address=10.1.1.10/24 +Gateway=10.1.1.1 diff --git a/tools/examples/linux-bridge-vlan/enp0s0.network b/tools/examples/linux-bridge-vlan/enp0s0.network new file mode 100644 index 0000000000..6ee3154dfc --- /dev/null +++ b/tools/examples/linux-bridge-vlan/enp0s0.network @@ -0,0 +1,16 @@ +[Match] +Name=enp0s0 + +[Network] +Bridge=br0 + +# If Jumbo frames are required +#[Link] +#MTUBytes=9000 + +[BridgeVLAN] +VLAN=10 + +[BridgeVLAN] +VLAN=20 +