Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/974008/?format=api
{ "id": 974008, "url": "http://patchwork.ozlabs.org/api/patches/974008/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180924163557.1187-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": "<20180924163557.1187-2-bjorn.topel@gmail.com>", "list_archive_url": null, "date": "2018-09-24T16:35:53", "name": "[1/5] ixgbe: added Rx/Tx ring disable/enable functions", "commit_ref": null, "pull_url": null, "state": "superseded", "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/20180924163557.1187-2-bjorn.topel@gmail.com/mbox/", "series": [ { "id": 67233, "url": "http://patchwork.ozlabs.org/api/series/67233/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=67233", "date": "2018-09-24T16:35:52", "name": "Introducing ixgbe AF_XDP ZC support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/67233/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/974008/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/974008/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 42Jqd116Sdz9s8T\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 25 Sep 2018 02:37:56 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 1ED658506E;\n\tMon, 24 Sep 2018 16:37:55 +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 nuF9-cSPdFnQ; Mon, 24 Sep 2018 16:37:54 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 670578502B;\n\tMon, 24 Sep 2018 16:37:54 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 7356C1BFB70\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 24 Sep 2018 16:37:52 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 6E4DB8502E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 24 Sep 2018 16:37:52 +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 CbB87BuMCcZO for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 24 Sep 2018 16:37:51 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id C74048502B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 24 Sep 2018 16:37:51 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Sep 2018 09:37:51 -0700", "from dandretz-mobl2.ger.corp.intel.com (HELO\n\tbtopel-mobl1.isw.intel.com) ([10.252.37.237])\n\tby FMSMGA003.fm.intel.com with ESMTP; 24 Sep 2018 09:36:22 -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,298,1534834800\"; d=\"scan'208\";a=\"82877925\"", "From": "=?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn.topel@gmail.com>", "To": "jeffrey.t.kirsher@intel.com,\n\tintel-wired-lan@lists.osuosl.org", "Date": "Mon, 24 Sep 2018 18:35:53 +0200", "Message-Id": "<20180924163557.1187-2-bjorn.topel@gmail.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20180924163557.1187-1-bjorn.topel@gmail.com>", "References": "<20180924163557.1187-1-bjorn.topel@gmail.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH 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": "daniel@iogearbox.net, netdev@vger.kernel.org, ast@kernel.org,\n\ttuc@vmware.com, u9012063@gmail.com, brouer@redhat.com, =?utf-8?q?Bj?=\n\t=?utf-8?b?w7ZybiBUw7ZwZWw=?= <bjorn.topel@intel.com>,\n\tmagnus.karlsson@gmail.com, magnus.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 d4d47707662f..3b68e20c067d 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -8688,6 +8688,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@@ -10256,6 +10258,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@@ -10322,6 +10327,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": [ "1/5" ] }