From patchwork Tue Nov 10 17:56:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Singhai, Anjali" X-Patchwork-Id: 542539 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 C5B3A1413F7 for ; Wed, 11 Nov 2015 04:40:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D6068869E9; Tue, 10 Nov 2015 17:40:07 +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 QO3dDf_cNsuR; Tue, 10 Nov 2015 17:40:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 44A33869A7; Tue, 10 Nov 2015 17:40:07 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 459341C1F88 for ; Tue, 10 Nov 2015 17:40:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C616A86992 for ; Tue, 10 Nov 2015 17:40:04 +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 1i4cbHNQIE9q for ; Tue, 10 Nov 2015 17:40:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6CEF186990 for ; Tue, 10 Nov 2015 17:40:04 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 10 Nov 2015 09:40:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,271,1444719600"; d="scan'208";a="833076988" Received: from asinghai-cp.jf.intel.com ([134.134.3.84]) by fmsmga001.fm.intel.com with ESMTP; 10 Nov 2015 09:40:03 -0800 From: Anjali Singhai Jain To: intel-wired-lan@lists.osuosl.org Date: Tue, 10 Nov 2015 09:56:43 -0800 Message-Id: <1447178205-99510-4-git-send-email-anjali.singhai@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1447178205-99510-1-git-send-email-anjali.singhai@intel.com> References: <1447178205-99510-1-git-send-email-anjali.singhai@intel.com> Subject: [Intel-wired-lan] [PATCH v4 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);