get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 977667,
    "url": "http://patchwork.ozlabs.org/api/patches/977667/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20181002080034.11754-2-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": "<20181002080034.11754-2-bjorn.topel@gmail.com>",
    "list_archive_url": null,
    "date": "2018-10-02T08:00:30",
    "name": "[v2,1/5] ixgbe: added Rx/Tx ring disable/enable functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ebab408cfa7990e3dc2276c583a52df052e2d4dd",
    "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/20181002080034.11754-2-bjorn.topel@gmail.com/mbox/",
    "series": [
        {
            "id": 68583,
            "url": "http://patchwork.ozlabs.org/api/series/68583/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=68583",
            "date": "2018-10-02T08:00:30",
            "name": "Introducing ixgbe AF_XDP ZC support",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/68583/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/977667/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/977667/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 42PWnC5sHyz9sj6\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  2 Oct 2018 18:01:19 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id BE8E086D9E;\n\tTue,  2 Oct 2018 08:01:17 +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 iJGtZi6l9gs0; Tue,  2 Oct 2018 08:01:16 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9118D86D78;\n\tTue,  2 Oct 2018 08:01:16 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id D8BD61BF479\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue,  2 Oct 2018 08:01:15 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D4B2D87DCC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue,  2 Oct 2018 08:01:15 +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 6T6sMiIYKgWs for <intel-wired-lan@lists.osuosl.org>;\n\tTue,  2 Oct 2018 08:01:13 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id D7DFE87E9B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue,  2 Oct 2018 08:01:12 +0000 (UTC)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Oct 2018 01:01:12 -0700",
            "from pvenkata-mobl.amr.corp.intel.com (HELO\n\tbtopel-mobl1.ger.corp.intel.com) ([10.252.35.165])\n\tby orsmga003.jf.intel.com with ESMTP; 02 Oct 2018 01:01:08 -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.54,331,1534834800\"; d=\"scan'208\";a=\"88439254\"",
        "From": "=?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn.topel@gmail.com>",
        "To": "jeffrey.t.kirsher@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Tue,  2 Oct 2018 10:00:30 +0200",
        "Message-Id": "<20181002080034.11754-2-bjorn.topel@gmail.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20181002080034.11754-1-bjorn.topel@gmail.com>",
        "References": "<20181002080034.11754-1-bjorn.topel@gmail.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH v2 1/5] ixgbe: added Rx/Tx ring\n\tdisable/enable functions",
        "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": "jakub.kicinski@netronome.com, daniel@iogearbox.net,\n\tnetdev@vger.kernel.org, ast@kernel.org, tuc@vmware.com,\n\tu9012063@gmail.com, brouer@redhat.com, =?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\nAdd functions for Rx/Tx ring enable/disable. Instead of resetting the\nwhole device, only the affected ring is disabled or enabled.\n\nThis plumbing is used in later commits, when zero-copy AF_XDP support\nis introduced.\n\nSigned-off-by: Björn Töpel <bjorn.topel@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe.h      |   1 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 158 ++++++++++++++++++\n 2 files changed, 159 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h\nindex 5c6fd42e90ed..265db172042a 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h\n@@ -271,6 +271,7 @@ enum ixgbe_ring_state_t {\n \t__IXGBE_TX_DETECT_HANG,\n \t__IXGBE_HANG_CHECK_ARMED,\n \t__IXGBE_TX_XDP_RING,\n+\t__IXGBE_TX_DISABLED,\n };\n \n #define ring_uses_build_skb(ring) \\\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex 187b78f950b5..6ff886498882 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -8694,6 +8694,8 @@ static netdev_tx_t __ixgbe_xmit_frame(struct sk_buff *skb,\n \t\treturn NETDEV_TX_OK;\n \n \ttx_ring = ring ? ring : adapter->tx_ring[skb->queue_mapping];\n+\tif (unlikely(test_bit(__IXGBE_TX_DISABLED, &tx_ring->state)))\n+\t\treturn NETDEV_TX_BUSY;\n \n \treturn ixgbe_xmit_frame_ring(skb, adapter, tx_ring);\n }\n@@ -10240,6 +10242,9 @@ static int ixgbe_xdp_xmit(struct net_device *dev, int n,\n \tif (unlikely(!ring))\n \t\treturn -ENXIO;\n \n+\tif (unlikely(test_bit(__IXGBE_TX_DISABLED, &ring->state)))\n+\t\treturn -ENXIO;\n+\n \tfor (i = 0; i < n; i++) {\n \t\tstruct xdp_frame *xdpf = frames[i];\n \t\tint err;\n@@ -10303,6 +10308,159 @@ static const struct net_device_ops ixgbe_netdev_ops = {\n \t.ndo_xdp_xmit\t\t= ixgbe_xdp_xmit,\n };\n \n+static void ixgbe_disable_txr_hw(struct ixgbe_adapter *adapter,\n+\t\t\t\t struct ixgbe_ring *tx_ring)\n+{\n+\tunsigned long wait_delay, delay_interval;\n+\tstruct ixgbe_hw *hw = &adapter->hw;\n+\tu8 reg_idx = tx_ring->reg_idx;\n+\tint wait_loop;\n+\tu32 txdctl;\n+\n+\tIXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), IXGBE_TXDCTL_SWFLSH);\n+\n+\t/* delay mechanism from ixgbe_disable_tx */\n+\tdelay_interval = ixgbe_get_completion_timeout(adapter) / 100;\n+\n+\twait_loop = IXGBE_MAX_RX_DESC_POLL;\n+\twait_delay = delay_interval;\n+\n+\twhile (wait_loop--) {\n+\t\tusleep_range(wait_delay, wait_delay + 10);\n+\t\twait_delay += delay_interval * 2;\n+\t\ttxdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(reg_idx));\n+\n+\t\tif (!(txdctl & IXGBE_TXDCTL_ENABLE))\n+\t\t\treturn;\n+\t}\n+\n+\te_err(drv, \"TXDCTL.ENABLE not cleared within the polling period\\n\");\n+}\n+\n+static void ixgbe_disable_txr(struct ixgbe_adapter *adapter,\n+\t\t\t      struct ixgbe_ring *tx_ring)\n+{\n+\tset_bit(__IXGBE_TX_DISABLED, &tx_ring->state);\n+\tixgbe_disable_txr_hw(adapter, tx_ring);\n+}\n+\n+static void ixgbe_disable_rxr_hw(struct ixgbe_adapter *adapter,\n+\t\t\t\t struct ixgbe_ring *rx_ring)\n+{\n+\tunsigned long wait_delay, delay_interval;\n+\tstruct ixgbe_hw *hw = &adapter->hw;\n+\tu8 reg_idx = rx_ring->reg_idx;\n+\tint wait_loop;\n+\tu32 rxdctl;\n+\n+\trxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(reg_idx));\n+\trxdctl &= ~IXGBE_RXDCTL_ENABLE;\n+\trxdctl |= IXGBE_RXDCTL_SWFLSH;\n+\n+\t/* write value back with RXDCTL.ENABLE bit cleared */\n+\tIXGBE_WRITE_REG(hw, IXGBE_RXDCTL(reg_idx), rxdctl);\n+\n+\t/* RXDCTL.EN may not change on 82598 if link is down, so skip it */\n+\tif (hw->mac.type == ixgbe_mac_82598EB &&\n+\t    !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP))\n+\t\treturn;\n+\n+\t/* delay mechanism from ixgbe_disable_rx */\n+\tdelay_interval = ixgbe_get_completion_timeout(adapter) / 100;\n+\n+\twait_loop = IXGBE_MAX_RX_DESC_POLL;\n+\twait_delay = delay_interval;\n+\n+\twhile (wait_loop--) {\n+\t\tusleep_range(wait_delay, wait_delay + 10);\n+\t\twait_delay += delay_interval * 2;\n+\t\trxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(reg_idx));\n+\n+\t\tif (!(rxdctl & IXGBE_RXDCTL_ENABLE))\n+\t\t\treturn;\n+\t}\n+\n+\te_err(drv, \"RXDCTL.ENABLE not cleared within the polling period\\n\");\n+}\n+\n+static void ixgbe_reset_txr_stats(struct ixgbe_ring *tx_ring)\n+{\n+\tmemset(&tx_ring->stats, 0, sizeof(tx_ring->stats));\n+\tmemset(&tx_ring->tx_stats, 0, sizeof(tx_ring->tx_stats));\n+}\n+\n+static void ixgbe_reset_rxr_stats(struct ixgbe_ring *rx_ring)\n+{\n+\tmemset(&rx_ring->stats, 0, sizeof(rx_ring->stats));\n+\tmemset(&rx_ring->rx_stats, 0, sizeof(rx_ring->rx_stats));\n+}\n+\n+/**\n+ * ixgbe_txrx_ring_disable - Disable Rx/Tx/XDP Tx rings\n+ * @adapter: adapter structure\n+ * @ring: ring index\n+ *\n+ * This function disables a certain Rx/Tx/XDP Tx ring. The function\n+ * assumes that the netdev is running.\n+ **/\n+void ixgbe_txrx_ring_disable(struct ixgbe_adapter *adapter, int ring)\n+{\n+\tstruct ixgbe_ring *rx_ring, *tx_ring, *xdp_ring;\n+\n+\trx_ring = adapter->rx_ring[ring];\n+\ttx_ring = adapter->tx_ring[ring];\n+\txdp_ring = adapter->xdp_ring[ring];\n+\n+\tixgbe_disable_txr(adapter, tx_ring);\n+\tif (xdp_ring)\n+\t\tixgbe_disable_txr(adapter, xdp_ring);\n+\tixgbe_disable_rxr_hw(adapter, rx_ring);\n+\n+\tif (xdp_ring)\n+\t\tsynchronize_sched();\n+\n+\t/* Rx/Tx/XDP Tx share the same napi context. */\n+\tnapi_disable(&rx_ring->q_vector->napi);\n+\n+\tixgbe_clean_tx_ring(tx_ring);\n+\tif (xdp_ring)\n+\t\tixgbe_clean_tx_ring(xdp_ring);\n+\tixgbe_clean_rx_ring(rx_ring);\n+\n+\tixgbe_reset_txr_stats(tx_ring);\n+\tif (xdp_ring)\n+\t\tixgbe_reset_txr_stats(xdp_ring);\n+\tixgbe_reset_rxr_stats(rx_ring);\n+}\n+\n+/**\n+ * ixgbe_txrx_ring_enable - Enable Rx/Tx/XDP Tx rings\n+ * @adapter: adapter structure\n+ * @ring: ring index\n+ *\n+ * This function enables a certain Rx/Tx/XDP Tx ring. The function\n+ * assumes that the netdev is running.\n+ **/\n+void ixgbe_txrx_ring_enable(struct ixgbe_adapter *adapter, int ring)\n+{\n+\tstruct ixgbe_ring *rx_ring, *tx_ring, *xdp_ring;\n+\n+\trx_ring = adapter->rx_ring[ring];\n+\ttx_ring = adapter->tx_ring[ring];\n+\txdp_ring = adapter->xdp_ring[ring];\n+\n+\t/* Rx/Tx/XDP Tx share the same napi context. */\n+\tnapi_enable(&rx_ring->q_vector->napi);\n+\n+\tixgbe_configure_tx_ring(adapter, tx_ring);\n+\tif (xdp_ring)\n+\t\tixgbe_configure_tx_ring(adapter, xdp_ring);\n+\tixgbe_configure_rx_ring(adapter, rx_ring);\n+\n+\tclear_bit(__IXGBE_TX_DISABLED, &tx_ring->state);\n+\tclear_bit(__IXGBE_TX_DISABLED, &xdp_ring->state);\n+}\n+\n /**\n  * ixgbe_enumerate_functions - Get the number of ports this device has\n  * @adapter: adapter structure\n",
    "prefixes": [
        "v2",
        "1/5"
    ]
}