From nobody Tue May 7 03:06:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=uniudc.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551017763682788.9309455348525; Sun, 24 Feb 2019 06:16:03 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4920F8535D; Sun, 24 Feb 2019 14:16:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C6AB19C4F; Sun, 24 Feb 2019 14:16:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 53BF61819AFB; Sun, 24 Feb 2019 14:15:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1OEFucx008587 for ; Sun, 24 Feb 2019 09:15:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 46B2E6012C; Sun, 24 Feb 2019 14:15:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 407EE60123 for ; Sun, 24 Feb 2019 14:15:54 +0000 (UTC) Received: from m21397.mail.qiye.163.com (m21397.mail.qiye.163.com [223.252.213.97]) by mx1.redhat.com (Postfix) with ESMTP id CE5B3C01A693 for ; Sun, 24 Feb 2019 14:15:49 +0000 (UTC) Received: from cd-ziguang.novalocal (unknown [103.36.30.159]) by m21397.mail.qiye.163.com (Hmail) with ESMTPA id 41FB4141458; Sun, 24 Feb 2019 22:15:34 +0800 (CST) From: ZhiPeng LU To: libvir-list@redhat.com Date: Sun, 24 Feb 2019 22:15:22 +0800 Message-Id: <1551017722-128973-1-git-send-email-luzhipeng@uniudc.com> X-HM-Spam-Status: e1kIGBQJHllBS1VLV1koWUFITzdXWS1ZQUlXWQkOFx4IWUFZMjUtOjcyP0 FLVUtZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OS46GQw6VjlLKi4THUI3PBEr TjEwChlVSlVKTk5KS0pMTEhMQk9NVTMWGhIXVRcOARMSCx4VHDsOFRIOHxhVGBQWRVlXWRILWUFZ SktIVUhNVUhLVUpOQllXWQgBWUFKSUhISzcG X-HM-Tid: 0a691fdc70bf7f6bkuuk41fb4141458 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 24 Feb 2019 14:15:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 24 Feb 2019 14:15:51 +0000 (UTC) for IP:'223.252.213.97' DOMAIN:'m21397.mail.qiye.163.com' HELO:'m21397.mail.qiye.163.com' FROM:'luzhipeng@uniudc.com' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 223.252.213.97 m21397.mail.qiye.163.com 223.252.213.97 m21397.mail.qiye.163.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: ZhiPeng LU Subject: [libvirt] [PATCH v5] openvswitch: Add new port VLAN mode "802.1ad" X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 24 Feb 2019 14:16:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This patch adds functionality to allow libvirt to configure the '802.1ad' modes(802.1ad double-tagged) on openvswitch networks. For example: Signed-off-by: ZhiPeng Lu Reviewed-by: John Ferlan --- v1->v2: 1. Fix "make syntax-check" failure v2->v3: 1. remove other_config when updating vlan v3->v4: 1. add commit message that has a brief description of the new feature 2. add tests for 'dot1q-tunnel' vlan mode v4->v5: 1. modify some description and format v4-resend: https://www.redhat.com/archives/libvir-list/2019-February/msg00988.html docs/formatdomain.html.in | 33 +++++++++++++++---= ---- docs/formatnetwork.html.in | 26 ++++++++++------- docs/schemas/networkcommon.rng | 1 + src/conf/netdev_vlan_conf.c | 2 +- src/util/virnetdevopenvswitch.c | 7 +++++ src/util/virnetdevvlan.h | 1 + tests/networkxml2xmlin/openvswitch-net.xml | 9 ++++++ tests/networkxml2xmlout/openvswitch-net.xml | 9 ++++++ .../openvswitch-net-modified.xml | 9 ++++++ .../openvswitch-net-more-portgroups.xml | 9 ++++++ .../openvswitch-net-without-alice.xml | 9 ++++++ 11 files changed, 94 insertions(+), 21 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b848e53..253f329 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6097,6 +6097,13 @@ qemu-kvm -net nic,model=3D? /dev/null </vlan> ... </interface> + <interface type=3D'bridge'> + <vlan trunk=3D'yes'> + <tag id=3D'42'/> + <tag id=3D'555' nativeMode=3D'802.1ad'/> + </vlan> + ... + </interface> </devices> ... =20 @@ -6132,16 +6139,22 @@ qemu-kvm -net nic,model=3D? /dev/null

For network connections using Open vSwitch it is also possible - to configure 'native-tagged' and 'native-untagged' VLAN modes - Since 1.1.0. This is done with the - optional nativeMode attribute on - the <tag> subelement: nativeMode - may be set to 'tagged' or 'untagged'. The id - attribute of the <tag> subelement - containing nativeMode sets which VLAN is considered - to be the "native" VLAN for this interface, and - the nativeMode attribute determines whether or not - traffic for that VLAN will be tagged. + to configure the following VLAN modes: +

+
    +
  • 'tagged' Since 1.1.0.
  • +
  • 'untagged' Since 1.1.0.
  • +
  • '802.1ad' Since 5.1.0.
  • +
+

+ This is done with the optional nativeMode attribute + on the <tag> subelement. The attribute may be + set to a string from the above list. The id attribute + of the <tag> subelement containing + nativeMode sets which VLAN is considered to be the + "native" VLAN for this interface and the nativeMode + attribute determines whether or not traffic for that VLAN will be + tagged or 802.1ad double tagged.

=20
Modifying virtual link state
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 509cca9..eea86f4 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -705,16 +705,22 @@

For network connections using Open vSwitch it is also possible - to configure 'native-tagged' and 'native-untagged' VLAN modes - Since 1.1.0. This is done with the - optional nativeMode attribute on - the <tag> subelement: nativeMode - may be set to 'tagged' or 'untagged'. The id - attribute of the <tag> subelement - containing nativeMode sets which VLAN is considered - to be the "native" VLAN for this interface, and - the nativeMode attribute determines whether or not - traffic for that VLAN will be tagged. + to configure the following VLAN modes: +

+
    +
  • 'tagged' Since 1.1.0.
  • +
  • 'untagged' Since 1.1.0.
  • +
  • '802.1ad' Since 5.1.0.
  • +
+

+ This is done with the optional nativeMode attribute + on the <tag> subelement. The attribute may be + set to a string from the above list. The id attribute + of the <tag> subelement containing + nativeMode sets which VLAN is considered to be the + "native" VLAN for this interface and the nativeMode + attribute determines whether or not traffic for that VLAN will be + tagged or 802.1ad double tagged.

<vlan> elements can also be specified in diff --git a/docs/schemas/networkcommon.rng b/docs/schemas/networkcommon.rng index 2699555..7262783 100644 --- a/docs/schemas/networkcommon.rng +++ b/docs/schemas/networkcommon.rng @@ -223,6 +223,7 @@ tagged untagged + 802.1ad diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c index 57d73ed..54e2b02 100644 --- a/src/conf/netdev_vlan_conf.c +++ b/src/conf/netdev_vlan_conf.c @@ -25,7 +25,7 @@ #define VIR_FROM_THIS VIR_FROM_NONE =20 VIR_ENUM_IMPL(virNativeVlanMode, VIR_NATIVE_VLAN_MODE_LAST, - "default", "tagged", "untagged", + "default", "tagged", "untagged", "802.1ad", ); =20 int diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index 4fa3a57..d8268bc 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -85,6 +85,11 @@ virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, vi= rNetDevVlanPtr virtVlan) virCommandAddArg(cmd, "vlan_mode=3Dnative-untagged"); virCommandAddArgFormat(cmd, "tag=3D%d", virtVlan->nativeTag); break; + case VIR_NATIVE_VLAN_MODE_8021AD: + virCommandAddArg(cmd, "vlan_mode=3Ddot1q-tunnel"); + virCommandAddArg(cmd, "other_config:qinq-ethtype=3D802.1q"); + virCommandAddArgFormat(cmd, "tag=3D%d", virtVlan->nativeTag); + break; case VIR_NATIVE_VLAN_MODE_DEFAULT: default: break; @@ -498,6 +503,8 @@ int virNetDevOpenvswitchUpdateVlan(const char *ifname, "--", "--if-exists", "clear", "Port", ifname, "ta= g", "--", "--if-exists", "clear", "Port", ifname, "tr= unk", "--", "--if-exists", "clear", "Port", ifname, "vl= an_mode", + "--", "--if-exists", "remove", "Port", ifname, + "other_config", "qinq-ethtype", "--", "--if-exists", "set", "Port", ifname, NULL); =20 if (virNetDevOpenvswitchConstructVlans(cmd, virtVlan) < 0) diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h index 2a13759..54109c6 100644 --- a/src/util/virnetdevvlan.h +++ b/src/util/virnetdevvlan.h @@ -27,6 +27,7 @@ typedef enum { VIR_NATIVE_VLAN_MODE_DEFAULT =3D 0, VIR_NATIVE_VLAN_MODE_TAGGED, VIR_NATIVE_VLAN_MODE_UNTAGGED, + VIR_NATIVE_VLAN_MODE_8021AD, =20 VIR_NATIVE_VLAN_MODE_LAST } virNativeVlanMode; diff --git a/tests/networkxml2xmlin/openvswitch-net.xml b/tests/networkxml2= xmlin/openvswitch-net.xml index 2f6084d..5734d36 100644 --- a/tests/networkxml2xmlin/openvswitch-net.xml +++ b/tests/networkxml2xmlin/openvswitch-net.xml @@ -30,4 +30,13 @@ + + + + + + + + + diff --git a/tests/networkxml2xmlout/openvswitch-net.xml b/tests/networkxml= 2xmlout/openvswitch-net.xml index 2f6084d..5734d36 100644 --- a/tests/networkxml2xmlout/openvswitch-net.xml +++ b/tests/networkxml2xmlout/openvswitch-net.xml @@ -30,4 +30,13 @@ + + + + + + + + + diff --git a/tests/networkxml2xmlupdateout/openvswitch-net-modified.xml b/t= ests/networkxml2xmlupdateout/openvswitch-net-modified.xml index cc0c344..ed605bf 100644 --- a/tests/networkxml2xmlupdateout/openvswitch-net-modified.xml +++ b/tests/networkxml2xmlupdateout/openvswitch-net-modified.xml @@ -30,4 +30,13 @@ + + + + + + + + + diff --git a/tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.= xml b/tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml index 7c19ad9..0237e42 100644 --- a/tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml +++ b/tests/networkxml2xmlupdateout/openvswitch-net-more-portgroups.xml @@ -41,4 +41,13 @@ + + + + + + + + + diff --git a/tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xm= l b/tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml index 4104424..cb9d12d 100644 --- a/tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml +++ b/tests/networkxml2xmlupdateout/openvswitch-net-without-alice.xml @@ -20,4 +20,13 @@ + + + + + + + + + --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list