From patchwork Tue Nov 10 06:25:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Singhai, Anjali" X-Patchwork-Id: 542184 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 868B41402B0 for ; Tue, 10 Nov 2015 17:08:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D8E7B86E23; Tue, 10 Nov 2015 06:08:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SwkhVxflEZlq; Tue, 10 Nov 2015 06:08:55 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 608E486E10; Tue, 10 Nov 2015 06:08:55 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 555D91C105D for ; Tue, 10 Nov 2015 06:08:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4A327272BF for ; Tue, 10 Nov 2015 06:08:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kV6tyStx7CAO for ; Tue, 10 Nov 2015 06:08:53 +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 silver.osuosl.org (Postfix) with ESMTP id B01CF2723A for ; Tue, 10 Nov 2015 06:08:53 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 09 Nov 2015 22:08:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,269,1444719600"; d="scan'208";a="846712973" Received: from asinghai-cp.jf.intel.com ([134.134.3.84]) by orsmga002.jf.intel.com with ESMTP; 09 Nov 2015 22:08:54 -0800 From: Anjali Singhai Jain To: intel-wired-lan@lists.osuosl.org Date: Mon, 9 Nov 2015 22:25:38 -0800 Message-Id: <1447136740-77107-4-git-send-email-anjali.singhai@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1447136740-77107-1-git-send-email-anjali.singhai@intel.com> References: <1447136740-77107-1-git-send-email-anjali.singhai@intel.com> Subject: [Intel-wired-lan] [PATCH v3 4/6] geneve: Add geneve udp port offload for ethernet X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" Call ndo_ops to add/del UDP ports to a device that supports geneve offload. Signed-off-by: Kiran Patil Signed-off-by: Anjali Singhai Jain --- drivers/net/geneve.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index de5c30c..f77db6ab 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -371,8 +371,11 @@ static struct socket *geneve_create_sock(struct net *net, bool ipv6, static void geneve_notify_add_rx_port(struct geneve_sock *gs) { + struct net_device *dev; struct sock *sk = gs->sock->sk; + struct net *net = sock_net(sk); sa_family_t sa_family = sk->sk_family; + __be16 port = inet_sk(sk)->inet_sport; int err; if (sa_family == AF_INET) { @@ -381,6 +384,14 @@ static void geneve_notify_add_rx_port(struct geneve_sock *gs) pr_warn("geneve: udp_add_offload failed with status %d\n", err); } + rcu_read_lock(); + for_each_netdev_rcu(net, dev) { + if (dev->netdev_ops->ndo_add_udp_tunnel_port) + dev->netdev_ops->ndo_add_udp_tunnel_port(dev, + sa_family, + port, UDP_TUNNEL_GENEVE); + } + rcu_read_unlock(); } static int geneve_hlen(struct genevehdr *gh) @@ -521,8 +532,20 @@ static struct geneve_sock *geneve_socket_create(struct net *net, __be16 port, static void geneve_notify_del_rx_port(struct geneve_sock *gs) { + struct net_device *dev; struct sock *sk = gs->sock->sk; + struct net *net = sock_net(sk); sa_family_t sa_family = sk->sk_family; + __be16 port = inet_sk(sk)->inet_sport; + + rcu_read_lock(); + for_each_netdev_rcu(net, dev) { + if (dev->netdev_ops->ndo_del_udp_tunnel_port) + dev->netdev_ops->ndo_del_udp_tunnel_port(dev, + sa_family, + port, UDP_TUNNEL_GENEVE); + } + rcu_read_unlock(); if (sa_family == AF_INET) udp_del_offload(&gs->udp_offloads);