From patchwork Thu Dec 15 13:28:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang, Yi" X-Patchwork-Id: 706100 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 3tfZRM3Xd7z9sDG for ; Fri, 16 Dec 2016 00:43:59 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E2BF7BE1; Thu, 15 Dec 2016 13:38:28 +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 2C9E3BCD for ; Thu, 15 Dec 2016 13:38:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A1D5D1AE for ; Thu, 15 Dec 2016 13:38:25 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 15 Dec 2016 05:38:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,352,1477983600"; d="scan'208,223";a="912519359" Received: from unknown (HELO cran64.bj.intel.com) ([10.240.224.181]) by orsmga003.jf.intel.com with ESMTP; 15 Dec 2016 05:38:23 -0800 From: Yi Yang To: dev@openvswitch.org Date: Thu, 15 Dec 2016 21:28:05 +0800 Message-Id: <1481808485-49362-9-git-send-email-yi.y.yang@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1481808485-49362-1-git-send-email-yi.y.yang@intel.com> References: <1481808485-49362-1-git-send-email-yi.y.yang@intel.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Simon Horman , Jiri Benc , "David S. Miller" Subject: [ovs-dev] [PATCH 8/8] datapath: allow L3 netdev ports 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 From net-next commit 217ac77a3c2524d999730b2a80b61fcc2d0f734a. Allow ARPHRD_NONE interfaces to be added to ovs bridge. Based on previous versions by Lorand Jakab and Simon Horman. Signed-off-by: Lorand Jakab Signed-off-by: Simon Horman Signed-off-by: Jiri Benc Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Signed-off-by: Yi Yang --- datapath/vport-netdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index 970f7d3..5486489 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -58,8 +58,10 @@ void netdev_port_receive(struct sk_buff *skb, struct ip_tunnel_info *tun_info) if (unlikely(!skb)) return; - skb_push(skb, ETH_HLEN); - skb_postpush_rcsum(skb, skb->data, ETH_HLEN); + if (skb->dev->type == ARPHRD_ETHER) { + skb_push(skb, ETH_HLEN); + skb_postpush_rcsum(skb, skb->data, ETH_HLEN); + } ovs_vport_receive(vport, skb, tun_info); return; error: @@ -102,7 +104,8 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name) } if (vport->dev->flags & IFF_LOOPBACK || - vport->dev->type != ARPHRD_ETHER || + (vport->dev->type != ARPHRD_ETHER && + vport->dev->type != ARPHRD_NONE) || ovs_is_internal_dev(vport->dev)) { err = -EINVAL; goto error_put;