get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 967281,
    "url": "http://patchwork.ozlabs.org/api/patches/967281/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180907081848.5438-5-bjorn.topel@gmail.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": "<20180907081848.5438-5-bjorn.topel@gmail.com>",
    "list_archive_url": null,
    "date": "2018-09-07T08:18:48",
    "name": "[v2,4/4] i40e: disallow changing the number of descriptors when AF_XDP is on",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9aff2cb8463fa3791b15798152e60e103a3edd73",
    "submitter": {
        "id": 70569,
        "url": "http://patchwork.ozlabs.org/api/people/70569/?format=api",
        "name": "Björn Töpel",
        "email": "bjorn.topel@gmail.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/20180907081848.5438-5-bjorn.topel@gmail.com/mbox/",
    "series": [
        {
            "id": 64562,
            "url": "http://patchwork.ozlabs.org/api/series/64562/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=64562",
            "date": "2018-09-07T08:18:44",
            "name": "i40e AF_XDP zero-copy buffer leak fixes",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/64562/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/967281/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/967281/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.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=gmail.com"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4269b10jNsz9sBJ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  7 Sep 2018 18:29:16 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 0A6AE87F60;\n\tFri,  7 Sep 2018 08:29:15 +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 MyROGP0Actls; Fri,  7 Sep 2018 08:29:13 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id C7BE787F00;\n\tFri,  7 Sep 2018 08:29:13 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 302961C0180\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  7 Sep 2018 08:29:11 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E58FC877E7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  7 Sep 2018 08:29:10 +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 tROtKP66LVoh for <intel-wired-lan@lists.osuosl.org>;\n\tFri,  7 Sep 2018 08:29:06 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 9614F87CB9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  7 Sep 2018 08:29:05 +0000 (UTC)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t07 Sep 2018 01:19:34 -0700",
            "from btopel-mobl1.isw.intel.com ([10.103.211.147])\n\tby orsmga001.jf.intel.com with ESMTP; 07 Sep 2018 01:19:27 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "from 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.53,341,1531810800\"; d=\"scan'208\";a=\"88438117\"",
        "From": "=?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn.topel@gmail.com>",
        "To": "ast@kernel.org, daniel@iogearbox.net, jeffrey.t.kirsher@intel.com,\n\tintel-wired-lan@lists.osuosl.org, jakub.kicinski@netronome.com",
        "Date": "Fri,  7 Sep 2018 10:18:48 +0200",
        "Message-Id": "<20180907081848.5438-5-bjorn.topel@gmail.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180907081848.5438-1-bjorn.topel@gmail.com>",
        "References": "<20180907081848.5438-1-bjorn.topel@gmail.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH v2 4/4] i40e: disallow changing the number\n\tof descriptors when AF_XDP is on",
        "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>",
        "Cc": "netdev@vger.kernel.org, =?utf-8?b?QmrDtnJuIFTDtnBlbA==?=\n\t<bjorn.topel@intel.com>, magnus.karlsson@gmail.com,\n\tmagnus.karlsson@intel.com",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Björn Töpel <bjorn.topel@intel.com>\n\nWhen an AF_XDP UMEM is attached to any of the Rx rings, we disallow a\nuser to change the number of descriptors via e.g. \"ethtool -G IFNAME\".\n\nOtherwise, the size of the stash/reuse queue can grow unbounded, which\nwould result in OOM or leaking userspace buffers.\n\nSigned-off-by: Björn Töpel <bjorn.topel@intel.com>\n---\n .../net/ethernet/intel/i40e/i40e_ethtool.c    |  9 +++++++-\n .../ethernet/intel/i40e/i40e_txrx_common.h    |  1 +\n drivers/net/ethernet/intel/i40e/i40e_xsk.c    | 22 +++++++++++++++++++\n 3 files changed, 31 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex d7d3974beca2..3cd2c88c72f8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -5,7 +5,7 @@\n \n #include \"i40e.h\"\n #include \"i40e_diag.h\"\n-\n+#include \"i40e_txrx_common.h\"\n #include \"i40e_ethtool_stats.h\"\n \n #define I40E_PF_STAT(_name, _stat) \\\n@@ -1493,6 +1493,13 @@ static int i40e_set_ringparam(struct net_device *netdev,\n \t    (new_rx_count == vsi->rx_rings[0]->count))\n \t\treturn 0;\n \n+\t/* If there is a AF_XDP UMEM attached to any of Rx rings,\n+\t * disallow changing the number of descriptors -- regardless\n+\t * if the netdev is running or not.\n+\t */\n+\tif (i40e_xsk_any_rx_ring_enabled(vsi))\n+\t\treturn -EBUSY;\n+\n \twhile (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) {\n \t\ttimeout--;\n \t\tif (!timeout)\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx_common.h b/drivers/net/ethernet/intel/i40e/i40e_txrx_common.h\nindex 8d46acff6f2e..09809dffe399 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx_common.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx_common.h\n@@ -89,5 +89,6 @@ static inline void i40e_arm_wb(struct i40e_ring *tx_ring,\n \n void i40e_xsk_clean_rx_ring(struct i40e_ring *rx_ring);\n void i40e_xsk_clean_tx_ring(struct i40e_ring *tx_ring);\n+bool i40e_xsk_any_rx_ring_enabled(struct i40e_vsi *vsi);\n \n #endif /* I40E_TXRX_COMMON_ */\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c\nindex e4b62e871afc..119f59ec7cc0 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c\n@@ -944,3 +944,25 @@ void i40e_xsk_clean_tx_ring(struct i40e_ring *tx_ring)\n \tif (xsk_frames)\n \t\txsk_umem_complete_tx(umem, xsk_frames);\n }\n+\n+/**\n+ * i40e_xsk_any_rx_ring_enabled - Checks whether any of the Rx rings\n+ * has AF_XDP UMEM attached\n+ * @vsi: vsi\n+ *\n+ * Returns true if any of the Rx rings has an AF_XDP UMEM attached\n+ **/\n+bool i40e_xsk_any_rx_ring_enabled(struct i40e_vsi *vsi)\n+{\n+\tint i;\n+\n+\tif (!vsi->xsk_umems)\n+\t\treturn false;\n+\n+\tfor (i = 0; i < vsi->num_queue_pairs; i++) {\n+\t\tif (vsi->xsk_umems[i])\n+\t\t\treturn true;\n+\t}\n+\n+\treturn false;\n+}\n",
    "prefixes": [
        "v2",
        "4/4"
    ]
}