get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1314372,
    "url": "http://patchwork.ozlabs.org/api/patches/1314372/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1592832083-23249-2-git-send-email-magnus.karlsson@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": "<1592832083-23249-2-git-send-email-magnus.karlsson@intel.com>",
    "list_archive_url": null,
    "date": "2020-06-22T13:21:22",
    "name": "[net-next,1/2] i40e: optimize AF_XDP Tx completion path",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1694d9e0d85f0fa79a821aa7286c50baf322721f",
    "submitter": {
        "id": 72726,
        "url": "http://patchwork.ozlabs.org/api/people/72726/?format=api",
        "name": "Magnus Karlsson",
        "email": "magnus.karlsson@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/1592832083-23249-2-git-send-email-magnus.karlsson@intel.com/mbox/",
    "series": [
        {
            "id": 184987,
            "url": "http://patchwork.ozlabs.org/api/series/184987/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=184987",
            "date": "2020-06-22T13:21:21",
            "name": "i40e: improve AF_XDP performance",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/184987/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1314372/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1314372/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 spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)",
            "ozlabs.org;\n dmarc=fail (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 ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49r96W2Ctyz9sRW\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 22 Jun 2020 23:21:39 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D5BA8886EC;\n\tMon, 22 Jun 2020 13:21:37 +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 scghZGtWlqKx; Mon, 22 Jun 2020 13:21:36 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 830D7886DF;\n\tMon, 22 Jun 2020 13:21:36 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by ash.osuosl.org (Postfix) with ESMTP id E8E061BF390\n for <intel-wired-lan@lists.osuosl.org>; Mon, 22 Jun 2020 13:21:34 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by fraxinus.osuosl.org (Postfix) with ESMTP id E5A1086D9A\n for <intel-wired-lan@lists.osuosl.org>; Mon, 22 Jun 2020 13:21:34 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id 1xDi16Xa49Gu for <intel-wired-lan@lists.osuosl.org>;\n Mon, 22 Jun 2020 13:21:34 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by fraxinus.osuosl.org (Postfix) with ESMTPS id 1116686D3C\n for <intel-wired-lan@lists.osuosl.org>; Mon, 22 Jun 2020 13:21:34 +0000 (UTC)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Jun 2020 06:21:33 -0700",
            "from juergenr-mobl.ger.corp.intel.com (HELO localhost.localdomain)\n ([10.252.33.83])\n by orsmga004.jf.intel.com with ESMTP; 22 Jun 2020 06:21:31 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "IronPort-SDR": [
            "\n sz6TNd2w4YVZjytqi4c61LTJrOYZkiFLgWObNpWt6byiAP996mfG/HygojdjE1JFwJuZ2Lwfwf\n uVk6ehwq+J+A==",
            "\n Towga6pB5gGTR+KNwoS6ciU9sUqE0Zy8sEnUcBBJCOLnVMflaCFKRBUTbx5sRWJyLpVICQdtDr\n Q0HgQjqn/3Wg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9659\"; a=\"143714861\"",
            "E=Sophos;i=\"5.75,266,1589266800\"; d=\"scan'208\";a=\"143714861\"",
            "E=Sophos;i=\"5.75,266,1589266800\"; d=\"scan'208\";a=\"422628516\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Magnus Karlsson <magnus.karlsson@intel.com>",
        "To": "magnus.karlsson@intel.com, bjorn.topel@intel.com,\n intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com",
        "Date": "Mon, 22 Jun 2020 15:21:22 +0200",
        "Message-Id": "<1592832083-23249-2-git-send-email-magnus.karlsson@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1592832083-23249-1-git-send-email-magnus.karlsson@intel.com>",
        "References": "<1592832083-23249-1-git-send-email-magnus.karlsson@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH net-next 1/2] i40e: optimize AF_XDP Tx\n completion path",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <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 <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "maciejromanfijalkowski@gmail.com, maciej.fijalkowski@intel.com,\n netdev@vger.kernel.org",
        "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": "Improve the performance of the AF_XDP zero-copy Tx completion\npath. When there are no XDP buffers being sent using XDP_TX or\nXDP_REDIRECT, we do not have go through the SW ring to clean up any\nentries since the AF_XDP path does not use these. In these cases, just\nfast forward the next-to-use counter and skip going through the SW\nring. The limit on the maximum number of entries to complete is also\nremoved since the algorithm is now O(1). To simplify the code path, the\nmaximum number of entries to complete for the XDP path is therefore\nalso increased from 256 to 512 (the default number of Tx HW\ndescriptors). This should be fine since the completion in the XDP path\nis faster than in the SKB path that has 256 as the maximum number.\n\nThis patch provides around 4% throughput improvement for the l2fwd\napplication in xdpsock on my machine.\n\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_txrx.c |  1 +\n drivers/net/ethernet/intel/i40e/i40e_txrx.h |  1 +\n drivers/net/ethernet/intel/i40e/i40e_xsk.c  | 34 ++++++++++++++++-------------\n 3 files changed, 21 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex f9555c8..0ce9d1e 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -3538,6 +3538,7 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,\n \t */\n \tsmp_wmb();\n \n+\txdp_ring->xdp_tx_active++;\n \ti++;\n \tif (i == xdp_ring->count)\n \t\ti = 0;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\nindex 5c25597..c16fcd9 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -371,6 +371,7 @@ struct i40e_ring {\n \t/* used in interrupt processing */\n \tu16 next_to_use;\n \tu16 next_to_clean;\n+\tu16 xdp_tx_active;\n \n \tu8 atr_sample_rate;\n \tu8 atr_count;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c\nindex 7276580..c8cd6a6 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c\n@@ -378,6 +378,7 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)\n  **/\n static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget)\n {\n+\tunsigned int sent_frames = 0, total_bytes = 0;\n \tstruct i40e_tx_desc *tx_desc = NULL;\n \tstruct i40e_tx_buffer *tx_bi;\n \tbool work_done = true;\n@@ -408,6 +409,9 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget)\n \t\t\t\t   | I40E_TX_DESC_CMD_EOP,\n \t\t\t\t   0, desc.len, 0);\n \n+\t\tsent_frames++;\n+\t\ttotal_bytes += tx_bi->bytecount;\n+\n \t\txdp_ring->next_to_use++;\n \t\tif (xdp_ring->next_to_use == xdp_ring->count)\n \t\t\txdp_ring->next_to_use = 0;\n@@ -420,6 +424,7 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget)\n \t\ti40e_xdp_ring_update_tail(xdp_ring);\n \n \t\txsk_umem_consume_tx_done(xdp_ring->xsk_umem);\n+\t\ti40e_update_tx_stats(xdp_ring, sent_frames, total_bytes);\n \t}\n \n \treturn !!budget && work_done;\n@@ -434,6 +439,7 @@ static void i40e_clean_xdp_tx_buffer(struct i40e_ring *tx_ring,\n \t\t\t\t     struct i40e_tx_buffer *tx_bi)\n {\n \txdp_return_frame(tx_bi->xdpf);\n+\ttx_ring->xdp_tx_active--;\n \tdma_unmap_single(tx_ring->dev,\n \t\t\t dma_unmap_addr(tx_bi, dma),\n \t\t\t dma_unmap_len(tx_bi, len), DMA_TO_DEVICE);\n@@ -450,24 +456,23 @@ static void i40e_clean_xdp_tx_buffer(struct i40e_ring *tx_ring,\n bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi,\n \t\t\t   struct i40e_ring *tx_ring, int napi_budget)\n {\n-\tunsigned int ntc, total_bytes = 0, budget = vsi->work_limit;\n-\tu32 i, completed_frames, frames_ready, xsk_frames = 0;\n+\tunsigned int ntc, budget = vsi->work_limit;\n \tstruct xdp_umem *umem = tx_ring->xsk_umem;\n+\tu32 i, completed_frames, xsk_frames = 0;\n \tu32 head_idx = i40e_get_head(tx_ring);\n \tbool work_done = true, xmit_done;\n \tstruct i40e_tx_buffer *tx_bi;\n \n \tif (head_idx < tx_ring->next_to_clean)\n \t\thead_idx += tx_ring->count;\n-\tframes_ready = head_idx - tx_ring->next_to_clean;\n+\tcompleted_frames = head_idx - tx_ring->next_to_clean;\n \n-\tif (frames_ready == 0) {\n+\tif (completed_frames == 0)\n \t\tgoto out_xmit;\n-\t} else if (frames_ready > budget) {\n-\t\tcompleted_frames = budget;\n-\t\twork_done = false;\n-\t} else {\n-\t\tcompleted_frames = frames_ready;\n+\n+\tif (likely(!tx_ring->xdp_tx_active)) {\n+\t\txsk_frames = completed_frames;\n+\t\tgoto skip;\n \t}\n \n \tntc = tx_ring->next_to_clean;\n@@ -475,18 +480,18 @@ bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi,\n \tfor (i = 0; i < completed_frames; i++) {\n \t\ttx_bi = &tx_ring->tx_bi[ntc];\n \n-\t\tif (tx_bi->xdpf)\n+\t\tif (tx_bi->xdpf) {\n \t\t\ti40e_clean_xdp_tx_buffer(tx_ring, tx_bi);\n-\t\telse\n+\t\t\ttx_bi->xdpf = NULL;\n+\t\t} else {\n \t\t\txsk_frames++;\n-\n-\t\ttx_bi->xdpf = NULL;\n-\t\ttotal_bytes += tx_bi->bytecount;\n+\t\t}\n \n \t\tif (++ntc >= tx_ring->count)\n \t\t\tntc = 0;\n \t}\n \n+skip:\n \ttx_ring->next_to_clean += completed_frames;\n \tif (unlikely(tx_ring->next_to_clean >= tx_ring->count))\n \t\ttx_ring->next_to_clean -= tx_ring->count;\n@@ -495,7 +500,6 @@ bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi,\n \t\txsk_umem_complete_tx(umem, xsk_frames);\n \n \ti40e_arm_wb(tx_ring, vsi, budget);\n-\ti40e_update_tx_stats(tx_ring, completed_frames, total_bytes);\n \n out_xmit:\n \tif (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem))\n",
    "prefixes": [
        "net-next",
        "1/2"
    ]
}