From patchwork Mon Jul 10 19:39:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Garver X-Patchwork-Id: 786341 X-Patchwork-Delegate: joestringer@nicira.com 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 3x5wbT31Rlz9s7m for ; Tue, 11 Jul 2017 05:42:29 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D3B3FBAC; Mon, 10 Jul 2017 19:40:07 +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 9E106B09 for ; Mon, 10 Jul 2017 19:40:03 +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 555E5201 for ; Mon, 10 Jul 2017 19:40:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C46864E4CB; Mon, 10 Jul 2017 19:40:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C46864E4CB Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=erig.me Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=e@erig.me DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C46864E4CB 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 4634317276; Mon, 10 Jul 2017 19:40:02 +0000 (UTC) From: Eric Garver To: dev@openvswitch.org Date: Mon, 10 Jul 2017 15:39:54 -0400 Message-Id: <20170710194000.21627-5-e@erig.me> In-Reply-To: <20170710194000.21627-1-e@erig.me> References: <20170710194000.21627-1-e@erig.me> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 10 Jul 2017 19:40:02 +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 04/10] dpif-netlink-rtnl: Support layer3 GRE 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 Add support for creating layer3 GRE. Signed-off-by: Eric Garver --- lib/dpif-netlink-rtnl.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c index f02fe37e9a6a..32e220fc135c 100644 --- a/lib/dpif-netlink-rtnl.c +++ b/lib/dpif-netlink-rtnl.c @@ -82,13 +82,20 @@ static const struct nl_policy geneve_policy[] = { }; static const char * -vport_type_to_kind(enum ovs_vport_type type) +vport_type_to_kind(enum ovs_vport_type type, + const struct netdev_tunnel_config *tnl_cfg) { switch (type) { case OVS_VPORT_TYPE_VXLAN: return "vxlan"; case OVS_VPORT_TYPE_GRE: - return "gretap"; + if (tnl_cfg->pt_mode == NETDEV_PT_LEGACY_L3) { + return "gre"; + } else if (tnl_cfg->pt_mode == NETDEV_PT_LEGACY_L2) { + return "gretap"; + } else { + return NULL; + } case OVS_VPORT_TYPE_GENEVE: return "geneve"; case OVS_VPORT_TYPE_NETDEV: @@ -232,7 +239,7 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg, const char *kind; int err; - kind = vport_type_to_kind(type); + kind = vport_type_to_kind(type, tnl_cfg); if (!kind) { return EOPNOTSUPP; } @@ -342,16 +349,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev) int err; type = netdev_to_ovs_vport_type(netdev_get_type(netdev)); - kind = vport_type_to_kind(type); - if (!kind) { - return EOPNOTSUPP; - } - tnl_cfg = netdev_get_tunnel_config(netdev); if (!tnl_cfg) { return EINVAL; } + kind = vport_type_to_kind(type, tnl_cfg); + if (!kind) { + return EOPNOTSUPP; + } + name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf); flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_EXCL;