Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/542187/?format=api
{ "id": 542187, "url": "http://patchwork.ozlabs.org/api/patches/542187/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1447136740-77107-6-git-send-email-anjali.singhai@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1447136740-77107-6-git-send-email-anjali.singhai@intel.com>", "list_archive_url": null, "date": "2015-11-10T06:25:40", "name": "[v3,6/6] net: Add a generic udp_offload_get_port function", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "492a2607258bb256936529b4517ced39edc37d52", "submitter": { "id": 65487, "url": "http://patchwork.ozlabs.org/api/people/65487/?format=api", "name": "Singhai, Anjali", "email": "anjali.singhai@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1447136740-77107-6-git-send-email-anjali.singhai@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/542187/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/542187/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ozlabs.org (Postfix) with ESMTP id E02F31402B4\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 10 Nov 2015 17:09:00 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 4016686E10;\n\tTue, 10 Nov 2015 06:09:00 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id r54zW8tjaDtz; Tue, 10 Nov 2015 06:08:58 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id EEDA586E49;\n\tTue, 10 Nov 2015 06:08:58 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id EA5C61C105D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 10 Nov 2015 06:08:55 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id E30A826F8E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 10 Nov 2015 06:08:55 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id drKxvMGjtuZZ for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 10 Nov 2015 06:08:54 +0000 (UTC)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby silver.osuosl.org (Postfix) with ESMTP id 24336272A2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 10 Nov 2015 06:08:54 +0000 (UTC)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga101.jf.intel.com with ESMTP; 09 Nov 2015 22:08:53 -0800", "from asinghai-cp.jf.intel.com ([134.134.3.84])\n\tby orsmga002.jf.intel.com with ESMTP; 09 Nov 2015 22:08:54 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.20,269,1444719600\"; d=\"scan'208\";a=\"846712979\"", "From": "Anjali Singhai Jain <anjali.singhai@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 9 Nov 2015 22:25:40 -0800", "Message-Id": "<1447136740-77107-6-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 6/6] net: Add a generic\n\tudp_offload_get_port function", "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\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "The new function udp_offload_get_port replaces vxlan_get_rx_port().\nThis is a generic function that will help replay all udp tunnel ports irrespective of tunnel type.\nThis way when new udp tunnels get added this function need not change.\n\nNote: Drivers besides i40e are compile tested with this change.\n\nv2: fix a compile issue with redefinition of the function.\n\nSigned-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>\nSigned-off-by: Kiran Patil <kiran.patil@intel.com>\n---\n drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 5 +++--\n drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-\n drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-\n drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 3 ++-\n drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++---\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++--\n drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 3 ++-\n drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 3 ++-\n drivers/net/vxlan.c | 28 ++----------------------\n include/linux/netdevice.h | 2 ++\n include/net/protocol.h | 2 ++\n include/net/vxlan.h | 8 -------\n net/ipv4/udp_offload.c | 25 +++++++++++++++++++++\n 13 files changed, 49 insertions(+), 46 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c\nindex 3a863dc..299dca7 100644\n--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c\n+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c\n@@ -60,6 +60,7 @@\n #include <linux/semaphore.h>\n #include <linux/stringify.h>\n #include <linux/vmalloc.h>\n+#include <net/protocol.h>\n \n #include \"bnx2x.h\"\n #include \"bnx2x_init.h\"\n@@ -10293,7 +10294,7 @@ sp_rtnl_not_reset:\n \t\t\tnetdev_info(bp->dev,\n \t\t\t\t \"Deleted vxlan dest port %d\", port);\n \t\t\tbp->vxlan_dst_port = 0;\n-\t\t\tvxlan_get_rx_port(bp->dev);\n+\t\t\tudp_offload_get_port(bp->dev);\n \t\t}\n \t}\n #endif\n@@ -12499,7 +12500,7 @@ static int bnx2x_open(struct net_device *dev)\n \n #ifdef CONFIG_BNX2X_VXLAN\n \tif (IS_PF(bp))\n-\t\tvxlan_get_rx_port(dev);\n+\t\tudp_offload_get_port(dev);\n #endif\n \n \treturn 0;\ndiff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c\nindex af68428..47184d0 100644\n--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c\n+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c\n@@ -39,6 +39,7 @@\n #include <net/ip6_checksum.h>\n #if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE)\n #include <net/vxlan.h>\n+#include <net/protocol.h>\n #include <net/udp_tunnel.h>\n #endif\n #ifdef CONFIG_NET_RX_BUSY_POLL\n@@ -4579,7 +4580,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)\n \n \tif (irq_re_init) {\n #if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE)\n-\t\tvxlan_get_rx_port(bp->dev);\n+\t\tudp_offload_get_port(bp->dev);\n #endif\n \t\tif (!bnxt_hwrm_tunnel_dst_port_alloc(\n \t\t\t\tbp, htons(0x17c1),\ndiff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c\nindex 6af9f27..5d579eb 100644\n--- a/drivers/net/ethernet/emulex/benet/be_main.c\n+++ b/drivers/net/ethernet/emulex/benet/be_main.c\n@@ -25,6 +25,7 @@\n #include <net/busy_poll.h>\n #include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n+#include <net/protocol.h>\n \n MODULE_VERSION(DRV_VER);\n MODULE_DESCRIPTION(DRV_DESC \" \" DRV_VER);\n@@ -3606,7 +3607,7 @@ static int be_open(struct net_device *netdev)\n \n #ifdef CONFIG_BE2NET_VXLAN\n \tif (skyhawk_chip(adapter))\n-\t\tvxlan_get_rx_port(netdev);\n+\t\tudp_offload_get_port(netdev);\n #endif\n \n \treturn 0;\ndiff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\nindex bf7af95..cefa5ab 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\n@@ -23,6 +23,7 @@\n #if IS_ENABLED(CONFIG_FM10K_VXLAN)\n #include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n+#include <net/protocol.h>\n #endif /* CONFIG_FM10K_VXLAN */\n \n /**\n@@ -573,7 +574,7 @@ int fm10k_open(struct net_device *netdev)\n \n #if IS_ENABLED(CONFIG_FM10K_VXLAN)\n \t/* update VXLAN port configuration */\n-\tvxlan_get_rx_port(netdev);\n+\tudp_offload_get_port(netdev);\n \n #endif\n \tfm10k_up(interface);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex df7ca33..c04eda1 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -34,6 +34,7 @@\n #if IS_ENABLED(CONFIG_GENEVE)\n #include <net/geneve.h>\n #endif\n+#include <net/protocol.h>\n \n const char i40e_driver_name[] = \"i40e\";\n static const char i40e_driver_string[] =\n@@ -5338,9 +5339,7 @@ int i40e_open(struct net_device *netdev)\n \t\t\t\t\t\t TCP_FLAG_CWR) >> 16);\n \twr32(&pf->hw, I40E_GLLAN_TSOMSK_L, be32_to_cpu(TCP_FLAG_CWR) >> 16);\n \n-#if IS_ENABLED(CONFIG_VXLAN)\n-\tvxlan_get_rx_port(netdev);\n-#endif\n+\tudp_offload_get_port(netdev);\n \n \treturn 0;\n }\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex d7ad9d9..137a637 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -52,6 +52,7 @@\n #include <scsi/fc/fc_fcoe.h>\n #include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n+#include <net/protocol.h>\n \n #ifdef CONFIG_OF\n #include <linux/of_net.h>\n@@ -6039,7 +6040,7 @@ static int ixgbe_open(struct net_device *netdev)\n \n \tixgbe_clear_vxlan_port(adapter);\n #ifdef CONFIG_IXGBE_VXLAN\n-\tvxlan_get_rx_port(netdev);\n+\tudp_offload_get_port(netdev);\n #endif\n \n \treturn 0;\n@@ -7118,7 +7119,7 @@ static void ixgbe_service_task(struct work_struct *work)\n #ifdef CONFIG_IXGBE_VXLAN\n \tif (adapter->flags2 & IXGBE_FLAG2_VXLAN_REREG_NEEDED) {\n \t\tadapter->flags2 &= ~IXGBE_FLAG2_VXLAN_REREG_NEEDED;\n-\t\tvxlan_get_rx_port(adapter->netdev);\n+\t\tudp_offload_get_port(adapter->netdev);\n \t}\n #endif /* CONFIG_IXGBE_VXLAN */\n \tixgbe_reset_subtask(adapter);\ndiff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c\nindex bd8f240..ffc43bb 100644\n--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c\n+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c\n@@ -41,6 +41,7 @@\n #include <net/busy_poll.h>\n #include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n+#include <net/protocol.h>\n \n #include <linux/mlx4/driver.h>\n #include <linux/mlx4/device.h>\n@@ -1714,7 +1715,7 @@ int mlx4_en_start_port(struct net_device *dev)\n \n #ifdef CONFIG_MLX4_EN_VXLAN\n \tif (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)\n-\t\tvxlan_get_rx_port(dev);\n+\t\tudp_offload_get_port(dev);\n #endif\n \tpriv->port_up = true;\n \tnetif_tx_start_all_queues(dev);\ndiff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c\nindex 18d384f..203b328 100644\n--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c\n+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c\n@@ -19,6 +19,7 @@\n #ifdef CONFIG_QLCNIC_VXLAN\n #include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n+#include <net/protocol.h>\n #endif\n \n #include \"qlcnic.h\"\n@@ -2025,7 +2026,7 @@ qlcnic_attach(struct qlcnic_adapter *adapter)\n \n #ifdef CONFIG_QLCNIC_VXLAN\n \tif (qlcnic_encap_rx_offload(adapter))\n-\t\tvxlan_get_rx_port(netdev);\n+\t\tudp_offload_get_port(netdev);\n #endif\n \n \tadapter->is_up = QLCNIC_ADAPTER_UP_MAGIC;\ndiff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c\nindex 463f41a..2ccb15f 100644\n--- a/drivers/net/vxlan.c\n+++ b/drivers/net/vxlan.c\n@@ -2422,32 +2422,6 @@ static struct device_type vxlan_type = {\n \t.name = \"vxlan\",\n };\n \n-/* Calls the ndo_add_udp_tunnel_port of the caller in order to\n- * supply the listening VXLAN udp ports. Callers are expected\n- * to implement the ndo_add_udp_tunnel_port.\n- */\n-void vxlan_get_rx_port(struct net_device *dev)\n-{\n-\tstruct vxlan_sock *vs;\n-\tstruct net *net = dev_net(dev);\n-\tstruct vxlan_net *vn = net_generic(net, vxlan_net_id);\n-\tsa_family_t sa_family;\n-\t__be16 port;\n-\tunsigned int i;\n-\n-\tspin_lock(&vn->sock_lock);\n-\tfor (i = 0; i < PORT_HASH_SIZE; ++i) {\n-\t\thlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) {\n-\t\t\tport = inet_sk(vs->sock->sk)->inet_sport;\n-\t\t\tsa_family = vxlan_get_sk_family(vs);\n-\t\t\tdev->netdev_ops->ndo_add_udp_tunnel_port(dev, sa_family,\n-\t\t\t\t\t\t\tport, UDP_TUNNEL_VXLAN);\n-\t\t}\n-\t}\n-\tspin_unlock(&vn->sock_lock);\n-}\n-EXPORT_SYMBOL_GPL(vxlan_get_rx_port);\n-\n /* Initialize the device structure. */\n static void vxlan_setup(struct net_device *dev)\n {\n@@ -2636,6 +2610,8 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,\n \n \t/* Initialize the vxlan udp offloads structure */\n \tvs->udp_offloads.port = port;\n+\tvs->udp_offloads.tunnel_type = UDP_TUNNEL_VXLAN;\n+\tvs->udp_offloads.family = ipv6 ? AF_INET6 : AF_INET;\n \tvs->udp_offloads.callbacks.gro_receive = vxlan_gro_receive;\n \tvs->udp_offloads.callbacks.gro_complete = vxlan_gro_complete;\n \ndiff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex dbbab3b..cfe6201 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -2059,6 +2059,8 @@ struct udp_offload_callbacks {\n \n struct udp_offload {\n \t__be16\t\t\t port;\n+\tu8\t\t\t tunnel_type;\n+\tu8\t\t\t family;\n \tu8\t\t\t ipproto;\n \tstruct udp_offload_callbacks callbacks;\n };\ndiff --git a/include/net/protocol.h b/include/net/protocol.h\nindex d6fcc1f..738bfc6 100644\n--- a/include/net/protocol.h\n+++ b/include/net/protocol.h\n@@ -110,6 +110,8 @@ void inet_unregister_protosw(struct inet_protosw *p);\n int udp_add_offload(struct udp_offload *prot);\n void udp_del_offload(struct udp_offload *prot);\n \n+void udp_offload_get_port(struct net_device *dev);\n+\n #if IS_ENABLED(CONFIG_IPV6)\n int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);\n int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);\ndiff --git a/include/net/vxlan.h b/include/net/vxlan.h\nindex c1c899c..926455e 100644\n--- a/include/net/vxlan.h\n+++ b/include/net/vxlan.h\n@@ -242,14 +242,6 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,\n /* IPv6 header + UDP + VXLAN + Ethernet header */\n #define VXLAN6_HEADROOM (40 + 8 + 8 + 14)\n \n-#if IS_ENABLED(CONFIG_VXLAN)\n-void vxlan_get_rx_port(struct net_device *netdev);\n-#else\n-static inline void vxlan_get_rx_port(struct net_device *netdev)\n-{\n-}\n-#endif\n-\n static inline unsigned short vxlan_get_sk_family(struct vxlan_sock *vs)\n {\n \treturn vs->sock->sk->sk_family;\ndiff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c\nindex f938616..30aa84c 100644\n--- a/net/ipv4/udp_offload.c\n+++ b/net/ipv4/udp_offload.c\n@@ -290,6 +290,31 @@ unlock:\n }\n EXPORT_SYMBOL(udp_del_offload);\n \n+void udp_offload_get_port(struct net_device *dev)\n+{\n+#if IS_ENABLED(CONFIG_VXLAN) || IS_ENABLED(CONFIG_GENEVE)\n+\tstruct udp_offload_priv __rcu **head = &udp_offload_base;\n+\tstruct udp_offload_priv *uo_priv;\n+\tstruct udp_offload *uo;\n+\n+\trcu_read_lock();\n+\tuo_priv = rcu_dereference(udp_offload_base);\n+\tfor (; uo_priv != NULL; uo_priv = rcu_dereference(uo_priv->next)) {\n+\t\t/* call the right add port */\n+\t\tuo = uo_priv->offload;\n+\t\tif (uo && dev->netdev_ops->ndo_add_udp_tunnel_port)\n+\t\t\tdev->netdev_ops->ndo_add_udp_tunnel_port(dev,\n+\t\t\t\t\t\t\tuo->family,\n+\t\t\t\t\t\t\tuo->port,\n+\t\t\t\t\t\t\tuo->tunnel_type);\n+\n+\t\thead = &uo_priv->next;\n+\t}\n+\trcu_read_unlock();\n+#endif\n+}\n+EXPORT_SYMBOL(udp_offload_get_port);\n+\n struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb,\n \t\t\t\t struct udphdr *uh)\n {\n", "prefixes": [ "v3", "6/6" ] }