get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/547388/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 547388,
    "url": "http://patchwork.ozlabs.org/api/patches/547388/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1448262224-71480-2-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": "<1448262224-71480-2-git-send-email-anjali.singhai@intel.com>",
    "list_archive_url": null,
    "date": "2015-11-23T07:03:39",
    "name": "[v6,1/6] net: Generalize udp based tunnel offload",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "caff46c4f4a62f2280f914144720daa6cde48c0f",
    "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/1448262224-71480-2-git-send-email-anjali.singhai@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/547388/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/547388/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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ozlabs.org (Postfix) with ESMTP id C071A1402B2\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 23 Nov 2015 17:47:02 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 14692926F9;\n\tMon, 23 Nov 2015 06:47:02 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 36jWoJNbSQDI; Mon, 23 Nov 2015 06:46:54 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id B1090926E9;\n\tMon, 23 Nov 2015 06:46:53 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id DDE911C0ED0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Nov 2015 06:46:50 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D7F3C925D4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Nov 2015 06:46:50 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rnR3adXRNNeX for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Nov 2015 06:46:48 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 59511925DA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Nov 2015 06:46:48 +0000 (UTC)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga101.fm.intel.com with ESMTP; 22 Nov 2015 22:46:47 -0800",
            "from asinghai-cp.jf.intel.com ([134.134.3.84])\n\tby orsmga001.jf.intel.com with ESMTP; 22 Nov 2015 22:46:47 -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,336,1444719600\"; d=\"scan'208\";a=\"826891636\"",
        "From": "Anjali Singhai Jain <anjali.singhai@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Sun, 22 Nov 2015 23:03:39 -0800",
        "Message-Id": "<1448262224-71480-2-git-send-email-anjali.singhai@intel.com>",
        "X-Mailer": "git-send-email 1.8.1.4",
        "In-Reply-To": "<1448262224-71480-1-git-send-email-anjali.singhai@intel.com>",
        "References": "<anjali.singhai@intel.com>\n\t<1448262224-71480-1-git-send-email-anjali.singhai@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH v6 1/6] net: Generalize udp based tunnel\n\toffload",
        "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": "Replace add/del ndo ops for vxlan_port with tunnel_port so that all UDP\nbased tunnels can use the same ndo op. Add a parameter to pass tunnel\ntype to the ndo_op.\n\nChange all drivers to use the generalized udp tunnel offload\n\nPatch was compile tested with x86_64_defconfig.\n\nSigned-off-by: Kiran Patil <kiran.patil@intel.com>\nSigned-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>\n---\n drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 15 ++++++---\n drivers/net/ethernet/broadcom/bnxt/bnxt.c        | 13 +++++---\n drivers/net/ethernet/emulex/benet/be_main.c      | 14 +++++---\n drivers/net/ethernet/intel/fm10k/fm10k_netdev.c  | 27 ++++++++++++----\n drivers/net/ethernet/intel/i40e/i40e_main.c      | 41 +++++++++++++++++-------\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    | 17 +++++++---\n drivers/net/ethernet/mellanox/mlx4/en_netdev.c   | 21 ++++++++----\n drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 17 +++++++---\n drivers/net/vxlan.c                              | 23 +++++++------\n include/linux/netdevice.h                        | 34 ++++++++++----------\n include/net/udp_tunnel.h                         |  6 ++++\n 11 files changed, 157 insertions(+), 71 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c\nindex f1d62d5..3a863dc 100644\n--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c\n+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c\n@@ -47,6 +47,7 @@\n #include <net/ip.h>\n #include <net/ipv6.h>\n #include <net/tcp.h>\n+#include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n #include <net/checksum.h>\n #include <net/ip6_checksum.h>\n@@ -10124,11 +10125,14 @@ static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port)\n }\n \n static void bnx2x_add_vxlan_port(struct net_device *netdev,\n-\t\t\t\t sa_family_t sa_family, __be16 port)\n+\t\t\t\t sa_family_t sa_family, __be16 port,\n+\t\t\t\t u32 type)\n {\n \tstruct bnx2x *bp = netdev_priv(netdev);\n \tu16 t_port = ntohs(port);\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n \t__bnx2x_add_vxlan_port(bp, t_port);\n }\n \n@@ -10152,11 +10156,14 @@ static void __bnx2x_del_vxlan_port(struct bnx2x *bp, u16 port)\n }\n \n static void bnx2x_del_vxlan_port(struct net_device *netdev,\n-\t\t\t\t sa_family_t sa_family, __be16 port)\n+\t\t\t\t sa_family_t sa_family, __be16 port,\n+\t\t\t\t u32 type)\n {\n \tstruct bnx2x *bp = netdev_priv(netdev);\n \tu16 t_port = ntohs(port);\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n \t__bnx2x_del_vxlan_port(bp, t_port);\n }\n #endif\n@@ -13011,8 +13018,8 @@ static const struct net_device_ops bnx2x_netdev_ops = {\n \t.ndo_set_vf_link_state\t= bnx2x_set_vf_link_state,\n \t.ndo_features_check\t= bnx2x_features_check,\n #ifdef CONFIG_BNX2X_VXLAN\n-\t.ndo_add_vxlan_port\t= bnx2x_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= bnx2x_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= bnx2x_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= bnx2x_del_vxlan_port,\n #endif\n };\n \ndiff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c\nindex db15c5e..94584fa 100644\n--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c\n+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c\n@@ -5423,7 +5423,7 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp)\n #endif /* CONFIG_RFS_ACCEL */\n \n static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n-\t\t\t\t__be16 port)\n+\t\t\t\t__be16 port, u32 type)\n {\n \tstruct bnxt *bp = netdev_priv(dev);\n \n@@ -5433,6 +5433,9 @@ static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n \tif (sa_family != AF_INET6 && sa_family != AF_INET)\n \t\treturn;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (bp->vxlan_port_cnt && bp->vxlan_port != port)\n \t\treturn;\n \n@@ -5445,7 +5448,7 @@ static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n }\n \n static void bnxt_del_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n-\t\t\t\t__be16 port)\n+\t\t\t\t__be16 port, u32 type)\n {\n \tstruct bnxt *bp = netdev_priv(dev);\n \n@@ -5455,6 +5458,8 @@ static void bnxt_del_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n \tif (sa_family != AF_INET6 && sa_family != AF_INET)\n \t\treturn;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n \tif (bp->vxlan_port_cnt && bp->vxlan_port == port) {\n \t\tbp->vxlan_port_cnt--;\n \n@@ -5493,8 +5498,8 @@ static const struct net_device_ops bnxt_netdev_ops = {\n #ifdef CONFIG_RFS_ACCEL\n \t.ndo_rx_flow_steer\t= bnxt_rx_flow_steer,\n #endif\n-\t.ndo_add_vxlan_port\t= bnxt_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= bnxt_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= bnxt_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= bnxt_del_vxlan_port,\n #ifdef CONFIG_NET_RX_BUSY_POLL\n \t.ndo_busy_poll\t\t= bnxt_busy_poll,\n #endif\ndiff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c\nindex eb48a97..c43f2de 100644\n--- a/drivers/net/ethernet/emulex/benet/be_main.c\n+++ b/drivers/net/ethernet/emulex/benet/be_main.c\n@@ -23,6 +23,7 @@\n #include <linux/aer.h>\n #include <linux/if_bridge.h>\n #include <net/busy_poll.h>\n+#include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n \n MODULE_VERSION(DRV_VER);\n@@ -5177,12 +5178,15 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,\n  * until after all the tunnels are removed.\n  */\n static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family,\n-\t\t\t      __be16 port)\n+\t\t\t      __be16 port, u32 type)\n {\n \tstruct be_adapter *adapter = netdev_priv(netdev);\n \tstruct device *dev = &adapter->pdev->dev;\n \tint status;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter))\n \t\treturn;\n \n@@ -5231,10 +5235,12 @@ err:\n }\n \n static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family,\n-\t\t\t      __be16 port)\n+\t\t\t      __be16 port, u32 type)\n {\n \tstruct be_adapter *adapter = netdev_priv(netdev);\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n \tif (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter))\n \t\treturn;\n \n@@ -5344,8 +5350,8 @@ static const struct net_device_ops be_netdev_ops = {\n \t.ndo_busy_poll\t\t= be_busy_poll,\n #endif\n #ifdef CONFIG_BE2NET_VXLAN\n-\t.ndo_add_vxlan_port\t= be_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= be_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= be_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= be_del_vxlan_port,\n \t.ndo_features_check\t= be_features_check,\n #endif\n \t.ndo_get_phys_port_id   = be_get_phys_port_id,\ndiff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\nindex 722ac52..bf7af95 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\n@@ -21,6 +21,7 @@\n #include \"fm10k.h\"\n #include <linux/vmalloc.h>\n #if IS_ENABLED(CONFIG_FM10K_VXLAN)\n+#include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n #endif /* CONFIG_FM10K_VXLAN */\n \n@@ -439,18 +440,24 @@ static void fm10k_restore_vxlan_port(struct fm10k_intfc *interface)\n  * @netdev: network interface device structure\n  * @sa_family: Address family of new port\n  * @port: port number used for VXLAN\n+ * @type: Tunnel type\n  *\n- * This funciton is called when a new VXLAN interface has added a new port\n+ * This function is called when a new VXLAN interface has added a new port\n  * number to the range that is currently in use for VXLAN.  The new port\n  * number is always added to the tail so that the port number list should\n  * match the order in which the ports were allocated.  The head of the list\n  * is always used as the VXLAN port number for offloads.\n  **/\n static void fm10k_add_vxlan_port(struct net_device *dev,\n-\t\t\t\t sa_family_t sa_family, __be16 port) {\n+\t\t\t\t sa_family_t sa_family, __be16 port,\n+\t\t\t\t u32 type) {\n+#if IS_ENABLED(CONFIG_FM10K_VXLAN)\n \tstruct fm10k_intfc *interface = netdev_priv(dev);\n \tstruct fm10k_vxlan_port *vxlan_port;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \t/* only the PF supports configuring tunnels */\n \tif (interface->hw.mac.type != fm10k_mac_pf)\n \t\treturn;\n@@ -476,6 +483,7 @@ insert_tail:\n \tlist_add_tail(&vxlan_port->list, &interface->vxlan_port);\n \n \tfm10k_restore_vxlan_port(interface);\n+#endif\n }\n \n /**\n@@ -483,17 +491,23 @@ insert_tail:\n  * @netdev: network interface device structure\n  * @sa_family: Address family of freed port\n  * @port: port number used for VXLAN\n+ * @type: Tunnel type\n  *\n- * This funciton is called when a new VXLAN interface has freed a port\n+ * This function is called when a new VXLAN interface has freed a port\n  * number from the range that is currently in use for VXLAN.  The freed\n  * port is removed from the list and the new head is used to determine\n  * the port number for offloads.\n  **/\n static void fm10k_del_vxlan_port(struct net_device *dev,\n-\t\t\t\t sa_family_t sa_family, __be16 port) {\n+\t\t\t\t sa_family_t sa_family, __be16 port,\n+\t\t\t\t u32 type) {\n+#if IS_ENABLED(CONFIG_FM10K_VXLAN)\n \tstruct fm10k_intfc *interface = netdev_priv(dev);\n \tstruct fm10k_vxlan_port *vxlan_port;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (interface->hw.mac.type != fm10k_mac_pf)\n \t\treturn;\n \n@@ -508,6 +522,7 @@ static void fm10k_del_vxlan_port(struct net_device *dev,\n \t}\n \n \tfm10k_restore_vxlan_port(interface);\n+#endif\n }\n \n /**\n@@ -1389,8 +1404,8 @@ static const struct net_device_ops fm10k_netdev_ops = {\n \t.ndo_set_vf_vlan\t= fm10k_ndo_set_vf_vlan,\n \t.ndo_set_vf_rate\t= fm10k_ndo_set_vf_bw,\n \t.ndo_get_vf_config\t= fm10k_ndo_get_vf_config,\n-\t.ndo_add_vxlan_port\t= fm10k_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= fm10k_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= fm10k_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= fm10k_del_vxlan_port,\n \t.ndo_do_ioctl\t\t= fm10k_ioctl,\n \t.ndo_dfwd_add_station\t= fm10k_dfwd_add_station,\n \t.ndo_dfwd_del_station\t= fm10k_dfwd_del_station,\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 36645828..314139b 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -30,6 +30,7 @@\n #ifdef CONFIG_I40E_VXLAN\n #include <net/vxlan.h>\n #endif\n+#include <net/udp_tunnel.h>\n \n const char i40e_driver_name[] = \"i40e\";\n static const char i40e_driver_string[] =\n@@ -8454,13 +8455,18 @@ static u8 i40e_get_vxlan_port_idx(struct i40e_pf *pf, __be16 port)\n }\n \n /**\n- * i40e_add_vxlan_port - Get notifications about VXLAN ports that come up\n+ * i40e_add_tunnel_port - Get notifications about UDP tunnel ports that come up\n  * @netdev: This physical port's netdev\n- * @sa_family: Socket Family that VXLAN is notifying us about\n- * @port: New UDP port number that VXLAN started listening to\n+ * @sa_family: Socket Family that tunnel netdev is  associated with\n+ * @port: New UDP port number that tunnel started listening to\n+ * @type: Tunnel Type\n+ *\n+ * This function modifies a common data structure for all udp_tunnels\n+ * hence it is expected that it is called under a common lock.\n  **/\n-static void i40e_add_vxlan_port(struct net_device *netdev,\n-\t\t\t\tsa_family_t sa_family, __be16 port)\n+static void i40e_add_tunnel_port(struct net_device *netdev,\n+\t\t\t\t sa_family_t sa_family, __be16 port,\n+\t\t\t\t u32 type)\n {\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n \tstruct i40e_vsi *vsi = np->vsi;\n@@ -8468,6 +8474,9 @@ static void i40e_add_vxlan_port(struct net_device *netdev,\n \tu8 next_idx;\n \tu8 idx;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (sa_family == AF_INET6)\n \t\treturn;\n \n@@ -8496,19 +8505,27 @@ static void i40e_add_vxlan_port(struct net_device *netdev,\n }\n \n /**\n- * i40e_del_vxlan_port - Get notifications about VXLAN ports that go away\n+ * i40e_del_tunnel_port - Get notifications about UDP tunnel ports that go away\n  * @netdev: This physical port's netdev\n- * @sa_family: Socket Family that VXLAN is notifying us about\n- * @port: UDP port number that VXLAN stopped listening to\n+ * @sa_family: Socket Family that tunnel netdev is associated with\n+ * @port: UDP port number that tunnel stopped listening to\n+ * @type: Tunnel Type\n+ *\n+ * This function modifies a common data structure for all udp_tunnels\n+ * hence it is expected that it is called under common lock.\n  **/\n-static void i40e_del_vxlan_port(struct net_device *netdev,\n-\t\t\t\tsa_family_t sa_family, __be16 port)\n+static void i40e_del_tunnel_port(struct net_device *netdev,\n+\t\t\t\t sa_family_t sa_family, __be16 port,\n+\t\t\t\t u32 type)\n {\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n \tstruct i40e_vsi *vsi = np->vsi;\n \tstruct i40e_pf *pf = vsi->back;\n \tu8 idx;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (sa_family == AF_INET6)\n \t\treturn;\n \n@@ -8754,8 +8771,8 @@ static const struct net_device_ops i40e_netdev_ops = {\n \t.ndo_set_vf_link_state\t= i40e_ndo_set_vf_link_state,\n \t.ndo_set_vf_spoofchk\t= i40e_ndo_set_vf_spoofchk,\n #ifdef CONFIG_I40E_VXLAN\n-\t.ndo_add_vxlan_port\t= i40e_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= i40e_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= i40e_add_tunnel_port,\n+\t.ndo_del_udp_tunnel_port\t= i40e_del_tunnel_port,\n #endif\n \t.ndo_get_phys_port_id\t= i40e_get_phys_port_id,\n \t.ndo_fdb_add\t\t= i40e_ndo_fdb_add,\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex f5730dd..d7ad9d9 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -50,6 +50,7 @@\n #include <linux/if_bridge.h>\n #include <linux/prefetch.h>\n #include <scsi/fc/fc_fcoe.h>\n+#include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n \n #ifdef CONFIG_OF\n@@ -8312,14 +8313,18 @@ static int ixgbe_set_features(struct net_device *netdev,\n  * @dev: The port's netdev\n  * @sa_family: Socket Family that VXLAN is notifiying us about\n  * @port: New UDP port number that VXLAN started listening to\n+ * @type: Tunnel type\n  **/\n static void ixgbe_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n-\t\t\t\t __be16 port)\n+\t\t\t\t __be16 port, u32 type)\n {\n \tstruct ixgbe_adapter *adapter = netdev_priv(dev);\n \tstruct ixgbe_hw *hw = &adapter->hw;\n \tu16 new_port = ntohs(port);\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (!(adapter->flags & IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE))\n \t\treturn;\n \n@@ -8345,13 +8350,17 @@ static void ixgbe_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n  * @dev: The port's netdev\n  * @sa_family: Socket Family that VXLAN is notifying us about\n  * @port: UDP port number that VXLAN stopped listening to\n+ * @type: Tunnel type\n  **/\n static void ixgbe_del_vxlan_port(struct net_device *dev, sa_family_t sa_family,\n-\t\t\t\t __be16 port)\n+\t\t\t\t __be16 port, u32 type)\n {\n \tstruct ixgbe_adapter *adapter = netdev_priv(dev);\n \tu16 new_port = ntohs(port);\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (!(adapter->flags & IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE))\n \t\treturn;\n \n@@ -8663,8 +8672,8 @@ static const struct net_device_ops ixgbe_netdev_ops = {\n \t.ndo_dfwd_add_station\t= ixgbe_fwd_add,\n \t.ndo_dfwd_del_station\t= ixgbe_fwd_del,\n #ifdef CONFIG_IXGBE_VXLAN\n-\t.ndo_add_vxlan_port\t= ixgbe_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= ixgbe_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= ixgbe_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= ixgbe_del_vxlan_port,\n #endif /* CONFIG_IXGBE_VXLAN */\n \t.ndo_features_check\t= ixgbe_features_check,\n };\ndiff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c\nindex 886e1bc..bd8f240 100644\n--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c\n+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c\n@@ -39,6 +39,7 @@\n #include <linux/hash.h>\n #include <net/ip.h>\n #include <net/busy_poll.h>\n+#include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n \n #include <linux/mlx4/driver.h>\n@@ -2402,11 +2403,15 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work)\n }\n \n static void mlx4_en_add_vxlan_port(struct  net_device *dev,\n-\t\t\t\t   sa_family_t sa_family, __be16 port)\n+\t\t\t\t   sa_family_t sa_family, __be16 port,\n+\t\t\t\t   u32 type)\n {\n \tstruct mlx4_en_priv *priv = netdev_priv(dev);\n \t__be16 current_port;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)\n \t\treturn;\n \n@@ -2425,11 +2430,15 @@ static void mlx4_en_add_vxlan_port(struct  net_device *dev,\n }\n \n static void mlx4_en_del_vxlan_port(struct  net_device *dev,\n-\t\t\t\t   sa_family_t sa_family, __be16 port)\n+\t\t\t\t   sa_family_t sa_family, __be16 port,\n+\t\t\t\t   u32 type)\n {\n \tstruct mlx4_en_priv *priv = netdev_priv(dev);\n \t__be16 current_port;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)\n \t\treturn;\n \n@@ -2509,8 +2518,8 @@ static const struct net_device_ops mlx4_netdev_ops = {\n #endif\n \t.ndo_get_phys_port_id\t= mlx4_en_get_phys_port_id,\n #ifdef CONFIG_MLX4_EN_VXLAN\n-\t.ndo_add_vxlan_port\t= mlx4_en_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= mlx4_en_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= mlx4_en_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= mlx4_en_del_vxlan_port,\n \t.ndo_features_check\t= mlx4_en_features_check,\n #endif\n \t.ndo_set_tx_maxrate\t= mlx4_en_set_tx_maxrate,\n@@ -2547,8 +2556,8 @@ static const struct net_device_ops mlx4_netdev_ops_master = {\n #endif\n \t.ndo_get_phys_port_id\t= mlx4_en_get_phys_port_id,\n #ifdef CONFIG_MLX4_EN_VXLAN\n-\t.ndo_add_vxlan_port\t= mlx4_en_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= mlx4_en_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= mlx4_en_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= mlx4_en_del_vxlan_port,\n \t.ndo_features_check\t= mlx4_en_features_check,\n #endif\n \t.ndo_set_tx_maxrate\t= mlx4_en_set_tx_maxrate,\ndiff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c\nindex 1205f6f..aa38dbb 100644\n--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c\n+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c\n@@ -17,6 +17,7 @@\n #include <linux/log2.h>\n #include <linux/pci.h>\n #ifdef CONFIG_QLCNIC_VXLAN\n+#include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n #endif\n \n@@ -476,11 +477,15 @@ static int qlcnic_get_phys_port_id(struct net_device *netdev,\n \n #ifdef CONFIG_QLCNIC_VXLAN\n static void qlcnic_add_vxlan_port(struct net_device *netdev,\n-\t\t\t\t  sa_family_t sa_family, __be16 port)\n+\t\t\t\t  sa_family_t sa_family, __be16 port,\n+\t\t\t\t  u32 type)\n {\n \tstruct qlcnic_adapter *adapter = netdev_priv(netdev);\n \tstruct qlcnic_hardware_context *ahw = adapter->ahw;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \t/* Adapter supports only one VXLAN port. Use very first port\n \t * for enabling offload\n \t */\n@@ -498,11 +503,15 @@ static void qlcnic_add_vxlan_port(struct net_device *netdev,\n }\n \n static void qlcnic_del_vxlan_port(struct net_device *netdev,\n-\t\t\t\t  sa_family_t sa_family, __be16 port)\n+\t\t\t\t  sa_family_t sa_family, __be16 port,\n+\t\t\t\t  u32 type)\n {\n \tstruct qlcnic_adapter *adapter = netdev_priv(netdev);\n \tstruct qlcnic_hardware_context *ahw = adapter->ahw;\n \n+\tif (type != UDP_TUNNEL_VXLAN)\n+\t\treturn;\n+\n \tif (!qlcnic_encap_rx_offload(adapter) || !ahw->vxlan_port_count ||\n \t    (ahw->vxlan_port != ntohs(port)))\n \t\treturn;\n@@ -540,8 +549,8 @@ static const struct net_device_ops qlcnic_netdev_ops = {\n \t.ndo_fdb_dump\t\t= qlcnic_fdb_dump,\n \t.ndo_get_phys_port_id\t= qlcnic_get_phys_port_id,\n #ifdef CONFIG_QLCNIC_VXLAN\n-\t.ndo_add_vxlan_port\t= qlcnic_add_vxlan_port,\n-\t.ndo_del_vxlan_port\t= qlcnic_del_vxlan_port,\n+\t.ndo_add_udp_tunnel_port\t= qlcnic_add_vxlan_port,\n+\t.ndo_del_udp_tunnel_port\t= qlcnic_del_vxlan_port,\n \t.ndo_features_check\t= qlcnic_features_check,\n #endif\n #ifdef CONFIG_NET_POLL_CONTROLLER\ndiff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c\nindex 6369a57..5490629 100644\n--- a/drivers/net/vxlan.c\n+++ b/drivers/net/vxlan.c\n@@ -628,9 +628,10 @@ static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)\n \n \trcu_read_lock();\n \tfor_each_netdev_rcu(net, dev) {\n-\t\tif (dev->netdev_ops->ndo_add_vxlan_port)\n-\t\t\tdev->netdev_ops->ndo_add_vxlan_port(dev, sa_family,\n-\t\t\t\t\t\t\t    port);\n+\t\tif (dev->netdev_ops->ndo_add_udp_tunnel_port)\n+\t\t\tdev->netdev_ops->ndo_add_udp_tunnel_port(dev, sa_family,\n+\t\t\t\t\t\t\t      port,\n+\t\t\t\t\t\t\t      UDP_TUNNEL_VXLAN);\n \t}\n \trcu_read_unlock();\n }\n@@ -646,9 +647,10 @@ static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)\n \n \trcu_read_lock();\n \tfor_each_netdev_rcu(net, dev) {\n-\t\tif (dev->netdev_ops->ndo_del_vxlan_port)\n-\t\t\tdev->netdev_ops->ndo_del_vxlan_port(dev, sa_family,\n-\t\t\t\t\t\t\t    port);\n+\t\tif (dev->netdev_ops->ndo_del_udp_tunnel_port)\n+\t\t\tdev->netdev_ops->ndo_del_udp_tunnel_port(dev, sa_family,\n+\t\t\t\t\t\t\t      port,\n+\t\t\t\t\t\t\t      UDP_TUNNEL_VXLAN);\n \t}\n \trcu_read_unlock();\n \n@@ -2422,9 +2424,9 @@ static struct device_type vxlan_type = {\n \t.name = \"vxlan\",\n };\n \n-/* Calls the ndo_add_vxlan_port of the caller in order to\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_vxlan_port.\n+ * to implement the ndo_add_tunnel_port.\n  */\n void vxlan_get_rx_port(struct net_device *dev)\n {\n@@ -2440,8 +2442,9 @@ void vxlan_get_rx_port(struct net_device *dev)\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_vxlan_port(dev, sa_family,\n-\t\t\t\t\t\t\t    port);\n+\t\t\tdev->netdev_ops->ndo_add_udp_tunnel_port(dev, sa_family,\n+\t\t\t\t\t\t\t      port,\n+\t\t\t\t\t\t\t      UDP_TUNNEL_VXLAN);\n \t\t}\n \t}\n \tspin_unlock(&vn->sock_lock);\ndiff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex d208914..90bd26b 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -1004,18 +1004,19 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,\n  *\tnot implement this, it is assumed that the hw is not able to have\n  *\tmultiple net devices on single physical port.\n  *\n- * void (*ndo_add_vxlan_port)(struct  net_device *dev,\n- *\t\t\t      sa_family_t sa_family, __be16 port);\n- *\tCalled by vxlan to notiy a driver about the UDP port and socket\n- *\taddress family that vxlan is listnening to. It is called only when\n- *\ta new port starts listening. The operation is protected by the\n- *\tvxlan_net->sock_lock.\n- *\n- * void (*ndo_del_vxlan_port)(struct  net_device *dev,\n- *\t\t\t      sa_family_t sa_family, __be16 port);\n- *\tCalled by vxlan to notify the driver about a UDP port and socket\n- *\taddress family that vxlan is not listening to anymore. The operation\n- *\tis protected by the vxlan_net->sock_lock.\n+ * void (*ndo_add_udp_tunnel_port)(struct  net_device *dev,\n+ *\t\t\t      sa_family_t sa_family, __be16 port, u32 type);\n+ *\tCalled by UDP based tunnel modules to notify a driver about a UDP\n+ *\tport and socket address family that the tunnel is listening to. It is\n+ *\tcalled only when a new port starts listening. The operation is\n+ *\tprotected by udp_offload_lock across all udp based tunnels.\n+ *\n+ * void (*ndo_del_udp_tunnel_port)(struct  net_device *dev,\n+ *\t\t\t      sa_family_t sa_family, __be16 port, u32 type);\n+ *\tCalled by UDP based tunnel modules to notify the driver about a UDP port\n+ *\tand socket address family that tunnel is not listening to anymore.\n+ *\tThe operation is protected by udp_offload_lock across all udp based\n+ *\ttunnels.\n  *\n  * void* (*ndo_dfwd_add_station)(struct net_device *pdev,\n  *\t\t\t\t struct net_device *dev)\n@@ -1209,13 +1210,12 @@ struct net_device_ops {\n \t\t\t\t\t\t\tstruct netdev_phys_item_id *ppid);\n \tint\t\t\t(*ndo_get_phys_port_name)(struct net_device *dev,\n \t\t\t\t\t\t\t  char *name, size_t len);\n-\tvoid\t\t\t(*ndo_add_vxlan_port)(struct  net_device *dev,\n+\tvoid\t\t\t(*ndo_add_udp_tunnel_port)(struct  net_device *dev,\n \t\t\t\t\t\t      sa_family_t sa_family,\n-\t\t\t\t\t\t      __be16 port);\n-\tvoid\t\t\t(*ndo_del_vxlan_port)(struct  net_device *dev,\n+\t\t\t\t\t\t      __be16 port, u32 type);\n+\tvoid\t\t\t(*ndo_del_udp_tunnel_port)(struct  net_device *dev,\n \t\t\t\t\t\t      sa_family_t sa_family,\n-\t\t\t\t\t\t      __be16 port);\n-\n+\t\t\t\t\t\t      __be16 port, u32 type);\n \tvoid*\t\t\t(*ndo_dfwd_add_station)(struct net_device *pdev,\n \t\t\t\t\t\t\tstruct net_device *dev);\n \tvoid\t\t\t(*ndo_dfwd_del_station)(struct net_device *pdev,\ndiff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h\nindex cb2f89f..72415aa 100644\n--- a/include/net/udp_tunnel.h\n+++ b/include/net/udp_tunnel.h\n@@ -9,6 +9,12 @@\n #include <net/addrconf.h>\n #endif\n \n+enum udp_tunnel_type {\n+\tUDP_TUNNEL_UNSPEC,\n+\tUDP_TUNNEL_VXLAN,\n+\tUDP_TUNNEL_GENEVE,\n+};\n+\n struct udp_port_cfg {\n \tu8\t\t\tfamily;\n \n",
    "prefixes": [
        "v6",
        "1/6"
    ]
}