get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 542186,
    "url": "http://patchwork.ozlabs.org/api/patches/542186/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1447136740-77107-5-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-5-git-send-email-anjali.singhai@intel.com>",
    "list_archive_url": null,
    "date": "2015-11-10T06:25:39",
    "name": "[v3,5/6] i40e:Add geneve tunnel offload support",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "0419fa2ab43cba6391d69981fe940379ed265645",
    "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-5-git-send-email-anjali.singhai@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/542186/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/542186/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 B578A1402B0\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 E726086E2E;\n\tTue, 10 Nov 2015 06:08:59 +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 9-0bv-SFnHGw; 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 C881786E15;\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 963391C105D\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 89F0C26F8E\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 iT5X-gKAitKQ 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 055AB2729E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 10 Nov 2015 06:08:53 +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=\"846712975\"",
        "From": "Anjali Singhai Jain <anjali.singhai@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon,  9 Nov 2015 22:25:39 -0800",
        "Message-Id": "<1447136740-77107-5-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 5/6] i40e:Add geneve tunnel offload\n\tsupport",
        "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": "This patch adds driver hooks to implement ndo_ops to add/del udp\nport in the HW to identify GENEVE tunnels.\n\nAlso cleans up the features_check path now that we support\nmultiple udp based tunnels.\n\nAdd a spin_lock to guard the common data structure for the\nudp based tunnels.\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/intel/i40e/i40e.h      |  2 +\n drivers/net/ethernet/intel/i40e/i40e_main.c | 61 ++++++++++++++++++++++-------\n drivers/net/ethernet/intel/i40e/i40e_txrx.c |  2 +-\n 3 files changed, 50 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 10ffc17b..13f2b25 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -337,6 +337,7 @@ struct i40e_pf {\n #define I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE\tBIT_ULL(38)\n #define I40E_FLAG_LINK_POLLING_ENABLED\t\tBIT_ULL(39)\n #define I40E_FLAG_VEB_MODE_ENABLED\t\tBIT_ULL(40)\n+#define I40E_FLAG_GENEVE_OFFLOAD_CAPABLE\tBIT_ULL(41)\n #define I40E_FLAG_NO_PCI_LINK_CHECK\t\tBIT_ULL(42)\n \n \t/* tracks features that get auto disabled by errors */\n@@ -421,6 +422,7 @@ struct i40e_pf {\n \n \tu32 ioremap_len;\n \tu32 fd_inv;\n+\tspinlock_t udp_tunnel_lock;\n };\n \n struct i40e_mac_filter {\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 0dd308a..df7ca33 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -31,6 +31,9 @@\n #include <net/udp_tunnel.h>\n #include <net/vxlan.h>\n #endif\n+#if IS_ENABLED(CONFIG_GENEVE)\n+#include <net/geneve.h>\n+#endif\n \n const char i40e_driver_name[] = \"i40e\";\n static const char i40e_driver_string[] =\n@@ -7037,7 +7040,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)\n  **/\n static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)\n {\n-#if IS_ENABLED(CONFIG_VXLAN)\n+#if IS_ENABLED(CONFIG_VXLAN) || IS_ENABLED(CONFIG_GENEVE)\n \tstruct i40e_hw *hw = &pf->hw;\n \ti40e_status ret;\n \t__be16 port;\n@@ -7046,6 +7049,8 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)\n \tif (!(pf->flags & I40E_FLAG_UDP_FILTER_SYNC))\n \t\treturn;\n \n+\tspin_lock(&pf->udp_tunnel_lock);\n+\n \tpf->flags &= ~I40E_FLAG_UDP_FILTER_SYNC;\n \n \tfor (i = 0; i < I40E_MAX_PF_UDP_OFFLOAD_PORTS; i++) {\n@@ -7071,6 +7076,7 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)\n \t\t\t}\n \t\t}\n \t}\n+\tspin_unlock(&pf->udp_tunnel_lock);\n #endif\n }\n \n@@ -8373,7 +8379,8 @@ static int i40e_sw_init(struct i40e_pf *pf)\n \t\t\t     I40E_FLAG_HW_ATR_EVICT_CAPABLE |\n \t\t\t     I40E_FLAG_OUTER_UDP_CSUM_CAPABLE |\n \t\t\t     I40E_FLAG_WB_ON_ITR_CAPABLE |\n-\t\t\t     I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE;\n+\t\t\t     I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE |\n+\t\t\t     I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;\n \t}\n \tpf->eeprom_version = 0xDEAD;\n \tpf->lan_veb = I40E_NO_VEB;\n@@ -8471,8 +8478,8 @@ static int i40e_set_features(struct net_device *netdev,\n \n \treturn 0;\n }\n-#if IS_ENABLED(CONFIG_VXLAN)\n \n+#if IS_ENABLED(CONFIG_VXLAN) || IS_ENABLED(CONFIG_GENEVE)\n /**\n  * i40e_get_udp_port_idx - Lookup a possibly offloaded for Rx UDP port\n  * @pf: board private structure\n@@ -8491,39 +8498,47 @@ static u8 i40e_get_udp_port_idx(struct i40e_pf *pf, __be16 port)\n \n \treturn i;\n }\n-#endif\n \n+#endif\n /**\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 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_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-#if IS_ENABLED(CONFIG_VXLAN)\n+#if IS_ENABLED(CONFIG_VXLAN) || IS_ENABLED(CONFIG_GENEVE)\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 next_idx;\n \tu8 idx;\n \n-\tif (type != UDP_TUNNEL_VXLAN)\n-\t\treturn;\n+\tif (!(type == UDP_TUNNEL_VXLAN || type == UDP_TUNNEL_GENEVE))\n+\t\tgoto out;\n+\n+\tif ((type == UDP_TUNNEL_GENEVE) &&\n+\t    (!(pf->flags & I40E_FLAG_GENEVE_OFFLOAD_CAPABLE)))\n+\t\tgoto out;\n \n \tif (sa_family == AF_INET6)\n-\t\treturn;\n+\t\tgoto out;\n \n+\tspin_lock(&pf->udp_tunnel_lock);\n \tidx = i40e_get_udp_port_idx(pf, port);\n \n \t/* Check if port already exists */\n \tif (idx < I40E_MAX_PF_UDP_OFFLOAD_PORTS) {\n \t\tnetdev_info(netdev, \"UDP port %d already offloaded\\n\",\n \t\t\t    ntohs(port));\n-\t\treturn;\n+\t\tgoto err;\n \t}\n \n \t/* Now check if there is space to add the new port */\n@@ -8532,16 +8547,24 @@ static void i40e_add_tunnel_port(struct net_device *netdev,\n \tif (next_idx == I40E_MAX_PF_UDP_OFFLOAD_PORTS) {\n \t\tnetdev_info(netdev, \"maximum number of UDP ports reached, not adding port %d\\n\",\n \t\t\t    ntohs(port));\n-\t\treturn;\n+\t\tgoto err;\n \t}\n \n \t/* New port: add it and mark its index in the bitmap */\n \tpf->udp_ports[next_idx].index = port;\n \tif (type == UDP_TUNNEL_VXLAN)\n \t\tpf->udp_ports[next_idx].type = I40E_AQC_TUNNEL_TYPE_VXLAN;\n+\telse if (type == UDP_TUNNEL_GENEVE)\n+\t\tpf->udp_ports[next_idx].type = I40E_AQC_TUNNEL_TYPE_NGE;\n \n \tpf->pending_udp_bitmap |= BIT_ULL(next_idx);\n \tpf->flags |= I40E_FLAG_UDP_FILTER_SYNC;\n+\n+err:\n+\tspin_unlock(&pf->udp_tunnel_lock);\n+out:\n+\treturn;\n+\n #endif\n }\n \n@@ -8551,23 +8574,28 @@ static void i40e_add_tunnel_port(struct net_device *netdev,\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_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-#if IS_ENABLED(CONFIG_VXLAN)\n+#if IS_ENABLED(CONFIG_VXLAN) || IS_ENABLED(CONFIG_GENEVE)\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+\tif (!(type == UDP_TUNNEL_VXLAN || type == UDP_TUNNEL_GENEVE))\n \t\treturn;\n \n \tif (sa_family == AF_INET6)\n \t\treturn;\n \n+\tspin_lock(&pf->udp_tunnel_lock);\n+\n \tidx = i40e_get_udp_port_idx(pf, port);\n \n \t/* Check if port already exists */\n@@ -8582,6 +8610,7 @@ static void i40e_del_tunnel_port(struct net_device *netdev,\n \t\tnetdev_warn(netdev, \"udp tunnel port %d was not found, not deleting\\n\",\n \t\t\t    ntohs(port));\n \t}\n+\tspin_unlock(&pf->udp_tunnel_lock);\n #endif\n }\n \n@@ -8762,7 +8791,10 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,\n \t\t\t\t       nlflags, 0, 0, filter_mask, NULL);\n }\n \n-#define I40E_MAX_TUNNEL_HDR_LEN 80\n+/* Hardware supports L4 tunnel length of 128B (=2^7) which includes\n+ * inner mac plus all inner ethertypes.\n+ */\n+#define I40E_MAX_TUNNEL_HDR_LEN 128\n /**\n  * i40e_features_check - Validate encapsulated packet conforms to limits\n  * @skb: skb buff\n@@ -8774,7 +8806,7 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,\n \t\t\t\t\t     netdev_features_t features)\n {\n \tif (skb->encapsulation &&\n-\t    (skb_inner_mac_header(skb) - skb_transport_header(skb) >\n+\t    ((skb_inner_network_header(skb) - skb_transport_header(skb)) >\n \t     I40E_MAX_TUNNEL_HDR_LEN))\n \t\treturn features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);\n \n@@ -10781,6 +10813,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t/* tell the firmware that we're starting */\n \ti40e_send_version(pf);\n \n+\tspin_lock_init(&pf->udp_tunnel_lock);\n \t/* since everything's happy, start the service_task timer */\n \tmod_timer(&pf->service_timer,\n \t\t  round_jiffies(jiffies + pf->service_timer_period));\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex e5fe04a..e7c68ad 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -1383,7 +1383,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,\n \tif (rx_error & BIT(I40E_RX_DESC_ERROR_PPRS_SHIFT))\n \t\treturn;\n \n-\t/* If VXLAN traffic has an outer UDPv4 checksum we need to check\n+\t/* If VXLAN/GENEVE traffic has an outer UDPv4 checksum we need to check\n \t * it in the driver, hardware does not do it for us.\n \t * Since L3L4P bit was set we assume a valid IHL value (>=5)\n \t * so the total length of IPv4 header is IHL*4 bytes\n",
    "prefixes": [
        "v3",
        "5/6"
    ]
}