Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1132635/?format=api
{ "id": 1132635, "url": "http://patchwork.ozlabs.org/api/patches/1132635/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190716030637.5634-9-kevin.laatz@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": "<20190716030637.5634-9-kevin.laatz@intel.com>", "list_archive_url": null, "date": "2019-07-16T03:06:35", "name": "[v2,08/10] samples/bpf: add buffer recycling for unaligned chunks to xdpsock", "commit_ref": null, "pull_url": null, "state": "awaiting-upstream", "archived": false, "hash": "5f817e8bd806cce344ccc323780aa479302c5078", "submitter": { "id": 76901, "url": "http://patchwork.ozlabs.org/api/people/76901/?format=api", "name": "Laatz, Kevin", "email": "kevin.laatz@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/20190716030637.5634-9-kevin.laatz@intel.com/mbox/", "series": [ { "id": 119750, "url": "http://patchwork.ozlabs.org/api/series/119750/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=119750", "date": "2019-07-16T03:06:28", "name": "[v2,01/10] i40e: simplify Rx buffer recycle", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/119750/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1132635/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1132635/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.133; helo=hemlock.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=intel.com" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 45nyfb5rz6z9sNT\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 16 Jul 2019 21:22:15 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 28DBF87DCE;\n\tTue, 16 Jul 2019 11:22:14 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id jcsRPIOkPSRo; Tue, 16 Jul 2019 11:22:11 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 1BB5B87DDB;\n\tTue, 16 Jul 2019 11:22:11 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5B72C1BF97A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Jul 2019 11:22:09 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 565CC86044\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Jul 2019 11:22:09 +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 gGrkBCdDqRmr for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Jul 2019 11:22:08 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id B70E48600D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Jul 2019 11:22:08 +0000 (UTC)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t16 Jul 2019 04:22:08 -0700", "from silpixa00399838.ir.intel.com (HELO\n\tsilpixa00399838.ger.corp.intel.com) ([10.237.223.10])\n\tby fmsmga006.fm.intel.com with ESMTP; 16 Jul 2019 04:22:05 -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.63,498,1557212400\"; d=\"scan'208\";a=\"366631616\"", "From": "Kevin Laatz <kevin.laatz@intel.com>", "To": "netdev@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,\n\tbjorn.topel@intel.com, magnus.karlsson@intel.com,\n\tjakub.kicinski@netronome.com, jonathan.lemon@gmail.com", "Date": "Tue, 16 Jul 2019 03:06:35 +0000", "Message-Id": "<20190716030637.5634-9-kevin.laatz@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190716030637.5634-1-kevin.laatz@intel.com>", "References": "<20190620090958.2135-1-kevin.laatz@intel.com>\n\t<20190716030637.5634-1-kevin.laatz@intel.com>", "Subject": "[Intel-wired-lan] [PATCH v2 08/10] samples/bpf: add buffer\n\trecycling for unaligned chunks to xdpsock", "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\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": "bruce.richardson@intel.com, ciara.loftus@intel.com,\n\tintel-wired-lan@lists.osuosl.org, bpf@vger.kernel.org,\n\tKevin Laatz <kevin.laatz@intel.com>", "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": "This patch adds buffer recycling support for unaligned buffers. Since we\ndon't mask the addr to 2k at umem_reg in unaligned mode, we need to make\nsure we give back the correct (original) addr to the fill queue. We achieve\nthis using the new descriptor format and associated masks. The new format\nuses the upper 16-bits for the offset and the lower 48-bits for the addr.\nSince we have a field for the offset, we no longer need to modify the\nactual address. As such, all we have to do to get back the original address\nis mask for the lower 48 bits (i.e. strip the offset and we get the address\non it's own).\n\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n\n---\nv2:\n - Removed unused defines\n - Fix buffer recycling for unaligned case\n - Remove --buf-size (--frame-size merged before this)\n - Modifications to use the new descriptor format for buffer recycling\n---\n samples/bpf/xdpsock_user.c | 29 +++++++++++++++++++----------\n 1 file changed, 19 insertions(+), 10 deletions(-)", "diff": "diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c\nindex 26ba1a1fd582..8f220afd549a 100644\n--- a/samples/bpf/xdpsock_user.c\n+++ b/samples/bpf/xdpsock_user.c\n@@ -474,6 +474,7 @@ static void kick_tx(struct xsk_socket_info *xsk)\n \n static inline void complete_tx_l2fwd(struct xsk_socket_info *xsk)\n {\n+\tstruct xsk_umem_info *umem = xsk->umem;\n \tu32 idx_cq = 0, idx_fq = 0;\n \tunsigned int rcvd;\n \tsize_t ndescs;\n@@ -486,22 +487,24 @@ static inline void complete_tx_l2fwd(struct xsk_socket_info *xsk)\n \t\txsk->outstanding_tx;\n \n \t/* re-add completed Tx buffers */\n-\trcvd = xsk_ring_cons__peek(&xsk->umem->cq, ndescs, &idx_cq);\n+\trcvd = xsk_ring_cons__peek(&umem->cq, ndescs, &idx_cq);\n \tif (rcvd > 0) {\n \t\tunsigned int i;\n \t\tint ret;\n \n-\t\tret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd, &idx_fq);\n+\t\tret = xsk_ring_prod__reserve(&umem->fq, rcvd, &idx_fq);\n \t\twhile (ret != rcvd) {\n \t\t\tif (ret < 0)\n \t\t\t\texit_with_error(-ret);\n-\t\t\tret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd,\n-\t\t\t\t\t\t &idx_fq);\n+\t\t\tret = xsk_ring_prod__reserve(&umem->fq, rcvd, &idx_fq);\n+\t\t}\n+\n+\t\tfor (i = 0; i < rcvd; i++) {\n+\t\t\tu64 comp_addr =\n+\t\t\t\t*xsk_ring_cons__comp_addr(&umem->cq, idx_cq++);\n+\t\t\t*xsk_ring_prod__fill_addr(&umem->fq, idx_fq++) =\n+\t\t\t\tcomp_addr & XSK_UNALIGNED_BUF_ADDR_MASK;\n \t\t}\n-\t\tfor (i = 0; i < rcvd; i++)\n-\t\t\t*xsk_ring_prod__fill_addr(&xsk->umem->fq, idx_fq++) =\n-\t\t\t\t*xsk_ring_cons__comp_addr(&xsk->umem->cq,\n-\t\t\t\t\t\t\t idx_cq++);\n \n \t\txsk_ring_prod__submit(&xsk->umem->fq, rcvd);\n \t\txsk_ring_cons__release(&xsk->umem->cq, rcvd);\n@@ -548,7 +551,11 @@ static void rx_drop(struct xsk_socket_info *xsk)\n \tfor (i = 0; i < rcvd; i++) {\n \t\tu64 addr = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx)->addr;\n \t\tu32 len = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx++)->len;\n-\t\tchar *pkt = xsk_umem__get_data(xsk->umem->buffer, addr);\n+\t\tu64 offset = addr >> XSK_UNALIGNED_BUF_OFFSET_SHIFT;\n+\n+\t\taddr &= XSK_UNALIGNED_BUF_ADDR_MASK;\n+\t\tchar *pkt = xsk_umem__get_data(xsk->umem->buffer,\n+\t\t\t\taddr + offset);\n \n \t\thex_dump(pkt, len, addr);\n \t\t*xsk_ring_prod__fill_addr(&xsk->umem->fq, idx_fq++) = addr;\n@@ -654,7 +661,9 @@ static void l2fwd(struct xsk_socket_info *xsk)\n \t\t\t\t\t\t\t idx_rx)->addr;\n \t\t\tu32 len = xsk_ring_cons__rx_desc(&xsk->rx,\n \t\t\t\t\t\t\t idx_rx++)->len;\n-\t\t\tchar *pkt = xsk_umem__get_data(xsk->umem->buffer, addr);\n+\t\t\tu64 offset = addr >> XSK_UNALIGNED_BUF_OFFSET_SHIFT;\n+\t\t\tchar *pkt = xsk_umem__get_data(xsk->umem->buffer,\n+\t\t\t\t(addr & XSK_UNALIGNED_BUF_ADDR_MASK) + offset);\n \n \t\t\tswap_mac_addresses(pkt);\n \n", "prefixes": [ "v2", "08/10" ] }