get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 902056,
    "url": "http://patchwork.ozlabs.org/api/patches/902056/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180420084140.8081-5-alice.michael@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": "<20180420084140.8081-5-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2018-04-20T08:41:37",
    "name": "[next,S90,5/8] i40e: Fix multiple issues with UDP tunnel offload filter configuration",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "699d01a02a2c179badb9ab489aca9d4f63a7b5ec",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@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/20180420084140.8081-5-alice.michael@intel.com/mbox/",
    "series": [
        {
            "id": 40130,
            "url": "http://patchwork.ozlabs.org/api/series/40130/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=40130",
            "date": "2018-04-20T08:41:38",
            "name": "[next,S90,1/8] i40e/i40evf: cleanup incorrect function doxygen comments",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/40130/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/902056/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/902056/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@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"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 40SML45l27z9s3G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 21 Apr 2018 02:50:36 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 6976188CC4;\n\tFri, 20 Apr 2018 16:50:35 +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 QZGekXb6SdCr; Fri, 20 Apr 2018 16:50:32 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id EECF388DD7;\n\tFri, 20 Apr 2018 16:50:31 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6E9BE1CF121\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Apr 2018 16:50:27 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 6AF0B22609\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Apr 2018 16:50:27 +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 57mtE04TECpw for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Apr 2018 16:50:23 +0000 (UTC)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 872022EEB8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Apr 2018 16:50:23 +0000 (UTC)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Apr 2018 09:50:22 -0700",
            "from alicemic-2.jf.intel.com ([10.166.16.121])\n\tby fmsmga008.fm.intel.com with ESMTP; 20 Apr 2018 09:50:22 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.49,302,1520924400\"; d=\"scan'208\";a=\"34086377\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 20 Apr 2018 01:41:37 -0700",
        "Message-Id": "<20180420084140.8081-5-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20180420084140.8081-1-alice.michael@intel.com>",
        "References": "<20180420084140.8081-1-alice.michael@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S90 5/8] i40e: Fix multiple issues\n\twith UDP tunnel offload filter configuration",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.24",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@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@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Alexander Duyck <alexander.h.duyck@intel.com>\n\nThis fixes at least 2 issues I have found with the UDP tunnel filter\nconfiguration.\n\nThe first issue is the fact that the tunnels didn't have any sort of mutual\nexlcusion in place to prevent an update from racing with a user request to\nadd/remove a port. As such you could request to add and remove a port\nbefore the port update code had a chance to respond which would result in a\nvery confusing result. To address it I have added 2 changes. First I added\nthe RTNL mutex wrapper around our updating of the pending, port, and\nfilter_index bits. Second I added logic so that we cannot use a port that\nhas a pending deletion since we need to free the space in hardware before\nwe can allow software to reuse it.\n\nThe second issue addressed is the fact that we were not recording the\nactual filter index provided to us by the admin queue. As a result we were\ndeleting filters that were not associated with the actual filter we wanted\nto delete. To fix that I added a filter_index member to the UDP port\ntracking structure.\n\nSigned-off-by: Alexander Duyck <alexander.h.duyck@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h      |  2 +\n drivers/net/ethernet/intel/i40e/i40e_main.c | 66 +++++++++++++++++++++++------\n 2 files changed, 56 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex f573108..70d369e 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -310,10 +310,12 @@ struct i40e_tc_configuration {\n \tstruct i40e_tc_info tc_info[I40E_MAX_TRAFFIC_CLASS];\n };\n \n+#define I40E_UDP_PORT_INDEX_UNUSED\t255\n struct i40e_udp_port_config {\n \t/* AdminQ command interface expects port number in Host byte order */\n \tu16 port;\n \tu8 type;\n+\tu8 filter_index;\n };\n \n /* macros related to FLX_PIT */\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex ad01bfc..0babde1 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -9672,9 +9672,9 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)\n \ti40e_flush(hw);\n }\n \n-static const char *i40e_tunnel_name(struct i40e_udp_port_config *port)\n+static const char *i40e_tunnel_name(u8 type)\n {\n-\tswitch (port->type) {\n+\tswitch (type) {\n \tcase UDP_TUNNEL_TYPE_VXLAN:\n \t\treturn \"vxlan\";\n \tcase UDP_TUNNEL_TYPE_GENEVE:\n@@ -9708,37 +9708,68 @@ static void i40e_sync_udp_filters(struct i40e_pf *pf)\n static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)\n {\n \tstruct i40e_hw *hw = &pf->hw;\n-\ti40e_status ret;\n+\tu8 filter_index, type;\n \tu16 port;\n \tint i;\n \n \tif (!test_and_clear_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state))\n \t\treturn;\n \n+\t/* acquire RTNL to maintain state of flags and port requests */\n+\trtnl_lock();\n+\n \tfor (i = 0; i < I40E_MAX_PF_UDP_OFFLOAD_PORTS; i++) {\n \t\tif (pf->pending_udp_bitmap & BIT_ULL(i)) {\n+\t\t\tstruct i40e_udp_port_config *udp_port;\n+\t\t\ti40e_status ret = 0;\n+\n+\t\t\tudp_port = &pf->udp_ports[i];\n \t\t\tpf->pending_udp_bitmap &= ~BIT_ULL(i);\n-\t\t\tport = pf->udp_ports[i].port;\n+\n+\t\t\tport = READ_ONCE(udp_port->port);\n+\t\t\ttype = READ_ONCE(udp_port->type);\n+\t\t\tfilter_index = READ_ONCE(udp_port->filter_index);\n+\n+\t\t\t/* release RTNL while we wait on AQ command */\n+\t\t\trtnl_unlock();\n+\n \t\t\tif (port)\n \t\t\t\tret = i40e_aq_add_udp_tunnel(hw, port,\n-\t\t\t\t\t\t\tpf->udp_ports[i].type,\n-\t\t\t\t\t\t\tNULL, NULL);\n-\t\t\telse\n-\t\t\t\tret = i40e_aq_del_udp_tunnel(hw, i, NULL);\n+\t\t\t\t\t\t\t     type,\n+\t\t\t\t\t\t\t     &filter_index,\n+\t\t\t\t\t\t\t     NULL);\n+\t\t\telse if (filter_index != I40E_UDP_PORT_INDEX_UNUSED)\n+\t\t\t\tret = i40e_aq_del_udp_tunnel(hw, filter_index,\n+\t\t\t\t\t\t\t     NULL);\n+\n+\t\t\t/* reacquire RTNL so we can update filter_index */\n+\t\t\trtnl_lock();\n \n \t\t\tif (ret) {\n \t\t\t\tdev_info(&pf->pdev->dev,\n \t\t\t\t\t \"%s %s port %d, index %d failed, err %s aq_err %s\\n\",\n-\t\t\t\t\t i40e_tunnel_name(&pf->udp_ports[i]),\n+\t\t\t\t\t i40e_tunnel_name(type),\n \t\t\t\t\t port ? \"add\" : \"delete\",\n-\t\t\t\t\t port, i,\n+\t\t\t\t\t port,\n+\t\t\t\t\t filter_index,\n \t\t\t\t\t i40e_stat_str(&pf->hw, ret),\n \t\t\t\t\t i40e_aq_str(&pf->hw,\n \t\t\t\t\t\t     pf->hw.aq.asq_last_status));\n-\t\t\t\tpf->udp_ports[i].port = 0;\n+\t\t\t\tif (port) {\n+\t\t\t\t\t/* failed to add, just reset port,\n+\t\t\t\t\t * drop pending bit for any deletion\n+\t\t\t\t\t */\n+\t\t\t\t\tudp_port->port = 0;\n+\t\t\t\t\tpf->pending_udp_bitmap &= ~BIT_ULL(i);\n+\t\t\t\t}\n+\t\t\t} else if (port) {\n+\t\t\t\t/* record filter index on success */\n+\t\t\t\tudp_port->filter_index = filter_index;\n \t\t\t}\n \t\t}\n \t}\n+\n+\trtnl_unlock();\n }\n \n /**\n@@ -11355,6 +11386,11 @@ static u8 i40e_get_udp_port_idx(struct i40e_pf *pf, u16 port)\n \tu8 i;\n \n \tfor (i = 0; i < I40E_MAX_PF_UDP_OFFLOAD_PORTS; i++) {\n+\t\t/* Do not report ports with pending deletions as\n+\t\t * being available.\n+\t\t */\n+\t\tif (!port && (pf->pending_udp_bitmap & BIT_ULL(i)))\n+\t\t\tcontinue;\n \t\tif (pf->udp_ports[i].port == port)\n \t\t\treturn i;\n \t}\n@@ -11409,6 +11445,7 @@ static void i40e_udp_tunnel_add(struct net_device *netdev,\n \n \t/* New port: add it and mark its index in the bitmap */\n \tpf->udp_ports[next_idx].port = port;\n+\tpf->udp_ports[next_idx].filter_index = I40E_UDP_PORT_INDEX_UNUSED;\n \tpf->pending_udp_bitmap |= BIT_ULL(next_idx);\n \tset_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state);\n }\n@@ -11450,7 +11487,12 @@ static void i40e_udp_tunnel_del(struct net_device *netdev,\n \t * and make it pending\n \t */\n \tpf->udp_ports[idx].port = 0;\n-\tpf->pending_udp_bitmap |= BIT_ULL(idx);\n+\n+\t/* Toggle pending bit instead of setting it. This way if we are\n+\t * deleting a port that has yet to be added we just clear the pending\n+\t * bit and don't have to worry about it.\n+\t */\n+\tpf->pending_udp_bitmap ^= BIT_ULL(idx);\n \tset_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state);\n \n \treturn;\n",
    "prefixes": [
        "next",
        "S90",
        "5/8"
    ]
}