From patchwork Fri Jun 30 20:27:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Garver X-Patchwork-Id: 782990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wzp4T46DJz9s7m for ; Sat, 1 Jul 2017 06:27:53 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A77738A5; Fri, 30 Jun 2017 20:27:49 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 2DD7F899 for ; Fri, 30 Jun 2017 20:27:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9687AA3 for ; Fri, 30 Jun 2017 20:27:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A6D78046E; Fri, 30 Jun 2017 20:27:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3A6D78046E Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=erig.me Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=e@erig.me DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3A6D78046E Received: from dev-rhel7.localdomain (wsfd-netdev-vmhost.ntdv.lab.eng.bos.redhat.com [10.19.17.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADBF560BEA; Fri, 30 Jun 2017 20:27:45 +0000 (UTC) From: Eric Garver To: Ben Pfaff , dev@openvswitch.org Date: Fri, 30 Jun 2017 16:27:45 -0400 Message-Id: <20170630202745.2441-1-e@erig.me> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 30 Jun 2017 20:27:46 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] netdev: fix missing shifts of VXLAN_EXT_GPE X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Contrary to the comment by the enum value, these are actually regular enum values that need shifted. VXLAN_EXT_GBP for example is used as a netlink value for vports. Fixes: 875ab13020b1 ("userspace: Handling of versatile tunnel ports") Signed-off-by: Eric Garver --- datapath/linux/compat/include/linux/openvswitch.h | 5 +++-- lib/netdev-vport.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 91d31401ae71..9d08dacae5cc 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -290,8 +290,9 @@ enum ovs_vport_attr { enum { OVS_VXLAN_EXT_UNSPEC, - OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ - OVS_VXLAN_EXT_GPE = 8, /* Flag or __u32 */ + OVS_VXLAN_EXT_GBP, + /* place new values here to fill gap. */ + OVS_VXLAN_EXT_GPE = 8, __OVS_VXLAN_EXT_MAX, }; diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 7de58b8a313e..64a3ba3c46ff 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -407,7 +407,8 @@ tunnel_supported_layers(const char *type, return TNL_L3; } else if (!strcmp(type, "gre")) { return TNL_L2 | TNL_L3; - } else if (!strcmp(type, "vxlan") && tnl_cfg->exts & OVS_VXLAN_EXT_GPE) { + } else if (!strcmp(type, "vxlan") + && tnl_cfg->exts & (1 << OVS_VXLAN_EXT_GPE)) { return TNL_L2 | TNL_L3; } else { return TNL_L2; @@ -545,8 +546,8 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args, char **errp) enum tunnel_layers layers = tunnel_supported_layers(type, &tnl_cfg); const char *full_type = (strcmp(type, "vxlan") ? type - : tnl_cfg.exts & OVS_VXLAN_EXT_GPE ? "VXLAN-GPE" - : "VXLAN (without GPE"); + : (tnl_cfg.exts & (1 << OVS_VXLAN_EXT_GPE) + ? "VXLAN-GPE" : "VXLAN (without GPE")); const char *packet_type = smap_get(args, "packet_type"); if (!packet_type) { tnl_cfg.pt_mode = default_pt_mode(layers);