Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/738796/?format=api
{ "id": 738796, "url": "http://patchwork.ozlabs.org/api/patches/738796/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1489511727-10959-2-git-send-email-bimmy.pujari@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": "<1489511727-10959-2-git-send-email-bimmy.pujari@intel.com>", "list_archive_url": null, "date": "2017-03-14T17:15:23", "name": "[next,S63,2/6] i40e/i40evf: Pull code for grabbing and syncing rx_buffer from fetch_buffer", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f93b20a9d494247bba58e9ff9433f95f12ad7881", "submitter": { "id": 68919, "url": "http://patchwork.ozlabs.org/api/people/68919/?format=api", "name": "Pujari, Bimmy", "email": "bimmy.pujari@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/1489511727-10959-2-git-send-email-bimmy.pujari@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/738796/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/738796/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.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" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3vjKdk5W3Cz9rxm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 15 Mar 2017 03:17:46 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 406778968B;\n\tTue, 14 Mar 2017 16:17:45 +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 kJKNcxIctQbq; Tue, 14 Mar 2017 16:17:41 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id B8F7F8976F;\n\tTue, 14 Mar 2017 16:17:40 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 4241C1BFEBB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Mar 2017 16:17:39 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3A1DD8959C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Mar 2017 16:17:39 +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 6I3NLKeppopo for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Mar 2017 16:17:36 +0000 (UTC)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 5F4D88960C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Mar 2017 16:17:36 +0000 (UTC)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 Mar 2017 09:17:35 -0700", "from bimmy.jf.intel.com (HELO bimmy.linux1.jf.intel.com)\n\t([10.166.35.87])\n\tby orsmga001.jf.intel.com with ESMTP; 14 Mar 2017 09:17:34 -0700" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" (0-bit key;\n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"qXOCeneO\"; dkim-atps=neutral", "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=intel;\n\tt=1489508256; x=1521044256;\n\th=from:to:cc:subject:date:message-id:in-reply-to: references;\n\tbh=4wD5Bz926WkUaBoK/sn1b62nx90EVnZdES60Zl67gu4=;\n\tb=qXOCeneOqHqihqdlg2JzdfyT+AU1yz8ZSeVQVUHN2pL2nzHHMRkztR/B\n\tc5jrLdT6ip8EfyZ4Qo7IxFDn44Tikw==;", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.36,164,1486454400\"; d=\"scan'208\";\n\ta=\"1108362395\"", "From": "Bimmy Pujari <bimmy.pujari@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 14 Mar 2017 10:15:23 -0700", "Message-Id": "<1489511727-10959-2-git-send-email-bimmy.pujari@intel.com>", "X-Mailer": "git-send-email 2.4.11", "In-Reply-To": "<1489511727-10959-1-git-send-email-bimmy.pujari@intel.com>", "References": "<1489511727-10959-1-git-send-email-bimmy.pujari@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S63 2/6] i40e/i40evf: Pull code for\n\tgrabbing and syncing rx_buffer from fetch_buffer", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "From: Alexander Duyck <alexander.h.duyck@intel.com>\n\nThis patch pulls the code responsible for fetching the Rx buffer and\nsynchronizing DMA into a function, specifically called i40e_get_rx_buffer.\n\nThe general idea is to allow for better code reuse by pulling this out of\ni40e_fetch_rx_buffer. We dropped a couple of prefetches since the time\nbetween the prefetch being called and the data being accessed was too small\nto be useful.\n\nSigned-off-by: Alexander Duyck <alexander.h.duyck@intel.com>\nChange-ID: I4885fce4b2637dbedc8e16431169d23d3d7e79b9\n---\nTesting Hints:\n Basic Rx testing should be enough to verify this is working\n correctly.\n\n drivers/net/ethernet/intel/i40e/i40e_txrx.c | 58 ++++++++++++++++-----------\n drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 58 ++++++++++++++++-----------\n 2 files changed, 68 insertions(+), 48 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex 68936b6..d1fc0f0 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -1754,9 +1754,35 @@ static bool i40e_add_rx_frag(struct i40e_ring *rx_ring,\n }\n \n /**\n+ * i40e_get_rx_buffer - Fetch Rx buffer and synchronize data for use\n+ * @rx_ring: rx descriptor ring to transact packets on\n+ * @size: size of buffer to add to skb\n+ *\n+ * This function will pull an Rx buffer from the ring and synchronize it\n+ * for use by the CPU.\n+ */\n+static struct i40e_rx_buffer *i40e_get_rx_buffer(struct i40e_ring *rx_ring,\n+\t\t\t\t\t\t const unsigned int size)\n+{\n+\tstruct i40e_rx_buffer *rx_buffer;\n+\n+\trx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];\n+\tprefetchw(rx_buffer->page);\n+\n+\t/* we are reusing so sync this buffer for CPU use */\n+\tdma_sync_single_range_for_cpu(rx_ring->dev,\n+\t\t\t\t rx_buffer->dma,\n+\t\t\t\t rx_buffer->page_offset,\n+\t\t\t\t size,\n+\t\t\t\t DMA_FROM_DEVICE);\n+\n+\treturn rx_buffer;\n+}\n+\n+/**\n * i40e_fetch_rx_buffer - Allocate skb and populate it\n * @rx_ring: rx descriptor ring to transact packets on\n- * @rx_desc: descriptor containing info written by hardware\n+ * @rx_buffer: rx buffer to pull data from\n * @size: size of buffer to add to skb\n *\n * This function allocates an skb on the fly, and populates it with the page\n@@ -1766,19 +1792,13 @@ static bool i40e_add_rx_frag(struct i40e_ring *rx_ring,\n */\n static inline\n struct sk_buff *i40e_fetch_rx_buffer(struct i40e_ring *rx_ring,\n-\t\t\t\t union i40e_rx_desc *rx_desc,\n+\t\t\t\t struct i40e_rx_buffer *rx_buffer,\n \t\t\t\t struct sk_buff *skb,\n \t\t\t\t unsigned int size)\n {\n-\tstruct i40e_rx_buffer *rx_buffer;\n-\tstruct page *page;\n-\n-\trx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];\n-\tpage = rx_buffer->page;\n-\tprefetchw(page);\n-\n \tif (likely(!skb)) {\n-\t\tvoid *page_addr = page_address(page) + rx_buffer->page_offset;\n+\t\tvoid *page_addr = page_address(rx_buffer->page) +\n+\t\t\t\t rx_buffer->page_offset;\n \n \t\t/* prefetch first cache line of first page */\n \t\tprefetch(page_addr);\n@@ -1794,21 +1814,8 @@ struct sk_buff *i40e_fetch_rx_buffer(struct i40e_ring *rx_ring,\n \t\t\trx_ring->rx_stats.alloc_buff_failed++;\n \t\t\treturn NULL;\n \t\t}\n-\n-\t\t/* we will be copying header into skb->data in\n-\t\t * pskb_may_pull so it is in our interest to prefetch\n-\t\t * it now to avoid a possible cache miss\n-\t\t */\n-\t\tprefetchw(skb->data);\n \t}\n \n-\t/* we are reusing so sync this buffer for CPU use */\n-\tdma_sync_single_range_for_cpu(rx_ring->dev,\n-\t\t\t\t rx_buffer->dma,\n-\t\t\t\t rx_buffer->page_offset,\n-\t\t\t\t size,\n-\t\t\t\t DMA_FROM_DEVICE);\n-\n \t/* pull page into skb */\n \tif (i40e_add_rx_frag(rx_ring, rx_buffer, size, skb)) {\n \t\t/* hand second half of page back to the ring */\n@@ -1886,6 +1893,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)\n \tbool failure = false;\n \n \twhile (likely(total_rx_packets < budget)) {\n+\t\tstruct i40e_rx_buffer *rx_buffer;\n \t\tunion i40e_rx_desc *rx_desc;\n \t\tunsigned int size;\n \t\tu16 vlan_tag;\n@@ -1918,7 +1926,9 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)\n \t\t */\n \t\tdma_rmb();\n \n-\t\tskb = i40e_fetch_rx_buffer(rx_ring, rx_desc, skb, size);\n+\t\trx_buffer = i40e_get_rx_buffer(rx_ring, size);\n+\n+\t\tskb = i40e_fetch_rx_buffer(rx_ring, rx_buffer, skb, size);\n \t\tif (!skb)\n \t\t\tbreak;\n \ndiff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\nindex e41eb46..2320ec4 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\n@@ -1113,9 +1113,35 @@ static bool i40e_add_rx_frag(struct i40e_ring *rx_ring,\n }\n \n /**\n+ * i40e_get_rx_buffer - Fetch Rx buffer and synchronize data for use\n+ * @rx_ring: rx descriptor ring to transact packets on\n+ * @size: size of buffer to add to skb\n+ *\n+ * This function will pull an Rx buffer from the ring and synchronize it\n+ * for use by the CPU.\n+ */\n+static struct i40e_rx_buffer *i40e_get_rx_buffer(struct i40e_ring *rx_ring,\n+\t\t\t\t\t\t const unsigned int size)\n+{\n+\tstruct i40e_rx_buffer *rx_buffer;\n+\n+\trx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];\n+\tprefetchw(rx_buffer->page);\n+\n+\t/* we are reusing so sync this buffer for CPU use */\n+\tdma_sync_single_range_for_cpu(rx_ring->dev,\n+\t\t\t\t rx_buffer->dma,\n+\t\t\t\t rx_buffer->page_offset,\n+\t\t\t\t size,\n+\t\t\t\t DMA_FROM_DEVICE);\n+\n+\treturn rx_buffer;\n+}\n+\n+/**\n * i40evf_fetch_rx_buffer - Allocate skb and populate it\n * @rx_ring: rx descriptor ring to transact packets on\n- * @rx_desc: descriptor containing info written by hardware\n+ * @rx_buffer: rx buffer to pull data from\n * @size: size of buffer to add to skb\n *\n * This function allocates an skb on the fly, and populates it with the page\n@@ -1125,19 +1151,13 @@ static bool i40e_add_rx_frag(struct i40e_ring *rx_ring,\n */\n static inline\n struct sk_buff *i40evf_fetch_rx_buffer(struct i40e_ring *rx_ring,\n-\t\t\t\t union i40e_rx_desc *rx_desc,\n+\t\t\t\t struct i40e_rx_buffer *rx_buffer,\n \t\t\t\t struct sk_buff *skb,\n \t\t\t\t unsigned int size)\n {\n-\tstruct i40e_rx_buffer *rx_buffer;\n-\tstruct page *page;\n-\n-\trx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];\n-\tpage = rx_buffer->page;\n-\tprefetchw(page);\n-\n \tif (likely(!skb)) {\n-\t\tvoid *page_addr = page_address(page) + rx_buffer->page_offset;\n+\t\tvoid *page_addr = page_address(rx_buffer->page) +\n+\t\t\t\t rx_buffer->page_offset;\n \n \t\t/* prefetch first cache line of first page */\n \t\tprefetch(page_addr);\n@@ -1153,21 +1173,8 @@ struct sk_buff *i40evf_fetch_rx_buffer(struct i40e_ring *rx_ring,\n \t\t\trx_ring->rx_stats.alloc_buff_failed++;\n \t\t\treturn NULL;\n \t\t}\n-\n-\t\t/* we will be copying header into skb->data in\n-\t\t * pskb_may_pull so it is in our interest to prefetch\n-\t\t * it now to avoid a possible cache miss\n-\t\t */\n-\t\tprefetchw(skb->data);\n \t}\n \n-\t/* we are reusing so sync this buffer for CPU use */\n-\tdma_sync_single_range_for_cpu(rx_ring->dev,\n-\t\t\t\t rx_buffer->dma,\n-\t\t\t\t rx_buffer->page_offset,\n-\t\t\t\t size,\n-\t\t\t\t DMA_FROM_DEVICE);\n-\n \t/* pull page into skb */\n \tif (i40e_add_rx_frag(rx_ring, rx_buffer, size, skb)) {\n \t\t/* hand second half of page back to the ring */\n@@ -1240,6 +1247,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)\n \tbool failure = false;\n \n \twhile (likely(total_rx_packets < budget)) {\n+\t\tstruct i40e_rx_buffer *rx_buffer;\n \t\tunion i40e_rx_desc *rx_desc;\n \t\tunsigned int size;\n \t\tu16 vlan_tag;\n@@ -1272,7 +1280,9 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)\n \t\t */\n \t\tdma_rmb();\n \n-\t\tskb = i40evf_fetch_rx_buffer(rx_ring, rx_desc, skb, size);\n+\t\trx_buffer = i40e_get_rx_buffer(rx_ring, size);\n+\n+\t\tskb = i40evf_fetch_rx_buffer(rx_ring, rx_buffer, skb, size);\n \t\tif (!skb)\n \t\t\tbreak;\n \n", "prefixes": [ "next", "S63", "2/6" ] }