Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/712000/?format=api
{ "id": 712000, "url": "http://patchwork.ozlabs.org/api/patches/712000/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170106160719.1501.5439.stgit@localhost.localdomain/", "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": "<20170106160719.1501.5439.stgit@localhost.localdomain>", "list_archive_url": null, "date": "2017-01-06T16:07:20", "name": "[next,07/11] ixgbe: Break out Rx buffer page management", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b0b54187b224fffde8d49bc2ba22d25408edf899", "submitter": { "id": 252, "url": "http://patchwork.ozlabs.org/api/people/252/?format=api", "name": "Alexander Duyck", "email": "alexander.duyck@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/20170106160719.1501.5439.stgit@localhost.localdomain/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/712000/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/712000/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 3tw8l84CWVz9ryZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 7 Jan 2017 03:14:44 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E262187075;\n\tFri, 6 Jan 2017 16:14:42 +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 0v2chVKJFMDP; Fri, 6 Jan 2017 16:14:41 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 41C9D820CE;\n\tFri, 6 Jan 2017 16:14:41 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 66F691BFA57\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 6 Jan 2017 16:14:40 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 62837895A3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 6 Jan 2017 16:14:40 +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 VjOoL7CSD-nS for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 6 Jan 2017 16:14:39 +0000 (UTC)", "from mail-pg0-f66.google.com (mail-pg0-f66.google.com\n\t[74.125.83.66])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 704F5820D7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 6 Jan 2017 16:14:39 +0000 (UTC)", "by mail-pg0-f66.google.com with SMTP id 75so6206868pgf.3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 06 Jan 2017 08:14:39 -0800 (PST)", "from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0])\n\tby smtp.gmail.com with ESMTPSA id\n\ts4sm160732009pfb.55.2017.01.06.08.07.21\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 06 Jan 2017 08:07:21 -0800 (PST)" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"NAXSIZul\"; 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=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-transfer-encoding;\n\tbh=7iF3oei3Bip6yWsTWgCzPZDw13mNcdIcLNR+Xn8EM6A=;\n\tb=NAXSIZulosI2SvU8d5rbSas+MNQa0fe0oxZLnya6tIZyyZbXRMDwzjmJsxLiVZIGoP\n\tYA9n13o6u1CYhKo47cTOF16l2Lz39jBeaine7IwZbeBA8U0HE6ACHq2ecZTZuq9unHD3\n\tbdEDBa8mN82OMWMcyGFfxMhtSJ9X1/y+UsoKvR7PyVnCBswenABGbKTQc0KFkLPiRC86\n\t9DrKqooZokUvUACcjg/kGbD9x9NGoVPyCbdSGBfQOQskUN1QFXKqwYmgXK1jt0iG0/g8\n\tcLc+U9gAW/CbopJZjnKHqe7VeTFb0w9wmrUqofxm2tt/AASUWIVh5aDSSkCy6K0TGNxe\n\tD6SQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-transfer-encoding;\n\tbh=7iF3oei3Bip6yWsTWgCzPZDw13mNcdIcLNR+Xn8EM6A=;\n\tb=hsr/JIa5agD7ANe9dAOsgWv3TxaFND15Gq3ftpaS4uTPUjLUxHCbpIrFBDACrZ6NQk\n\tQZPR+Ip8FMn53M/u/Vp86jeZqExd0RDQPX0IjhCnjepDry5kL5Z00OZRV7FVKkHCv6jq\n\tSPhPIfkD1zbCU3hYX2pOLh8YhknZiC46HeQcHRSK8h2xZ1Bh4/m3A0RYTeCuwzZIroDK\n\tStZdm9cdmouUuk4edQMBUUTrWgwd8so1mWjvUzbD1Y/ju1ctv4bepz2pJX1DT+zvK3Xz\n\tVwT3t+30jUysSEOql+DxRwGqYb/PDMPCuZYZ41m9uH0e215+5X7lBDYPHMICrv117ZUb\n\tBdMQ==", "X-Gm-Message-State": "AIkVDXJyQL2JBNYmmPHIrxK4VLGZAp3OzlwXSt6sxWsM1QeYRgShyyE27QuHfY/S2lCFfw==", "X-Received": "by 10.98.68.140 with SMTP id m12mr72622873pfi.19.1483718841722; \n\tFri, 06 Jan 2017 08:07:21 -0800 (PST)", "From": "Alexander Duyck <alexander.duyck@gmail.com>", "To": "intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com", "Date": "Fri, 06 Jan 2017 08:07:20 -0800", "Message-ID": "<20170106160719.1501.5439.stgit@localhost.localdomain>", "In-Reply-To": "<20170106155448.1501.31298.stgit@localhost.localdomain>", "References": "<20170106155448.1501.31298.stgit@localhost.localdomain>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Cc": "netdev@vger.kernel.org", "Subject": "[Intel-wired-lan] [next PATCH 07/11] ixgbe: Break out Rx buffer\n\tpage management", "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>", "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\nWe are going to be expanding the number of Rx paths in the driver. Instead\nof duplicating all that code I am pulling it apart into separate functions\nso that we don't have so much code duplication.\n\nSigned-off-by: Alexander Duyck <alexander.h.duyck@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 230 +++++++++++++------------\n 1 file changed, 122 insertions(+), 108 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex 6ce596816954..79495cc990c2 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -1864,7 +1864,6 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring,\n \t\t\t\t ixgbe_rx_pg_size(rx_ring),\n \t\t\t\t DMA_FROM_DEVICE,\n \t\t\t\t IXGBE_RX_DMA_ATTR);\n-\t\tIXGBE_CB(skb)->page_released = false;\n \t} else {\n \t\tstruct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];\n \n@@ -1874,7 +1873,6 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring,\n \t\t\t\t\t skb_frag_size(frag),\n \t\t\t\t\t DMA_FROM_DEVICE);\n \t}\n-\tIXGBE_CB(skb)->dma = 0;\n }\n \n /**\n@@ -1945,8 +1943,14 @@ static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring,\n \tnta++;\n \trx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;\n \n-\t/* transfer page from old buffer to new buffer */\n-\t*new_buff = *old_buff;\n+\t/* Transfer page from old buffer to new buffer.\n+\t * Move each member individually to avoid possible store\n+\t * forwarding stalls and unnecessary copy of skb.\n+\t */\n+\tnew_buff->dma\t\t= old_buff->dma;\n+\tnew_buff->page\t\t= old_buff->page;\n+\tnew_buff->page_offset\t= old_buff->page_offset;\n+\tnew_buff->pagecnt_bias\t= old_buff->pagecnt_bias;\n }\n \n static inline bool ixgbe_page_is_reserved(struct page *page)\n@@ -1954,15 +1958,10 @@ static inline bool ixgbe_page_is_reserved(struct page *page)\n \treturn (page_to_nid(page) != numa_mem_id()) || page_is_pfmemalloc(page);\n }\n \n-static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer,\n-\t\t\t\t struct page *page,\n-\t\t\t\t const unsigned int truesize)\n+static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer)\n {\n-#if (PAGE_SIZE >= 8192)\n-\tunsigned int last_offset = ixgbe_rx_pg_size(rx_ring) -\n-\t\t\t\t ixgbe_rx_bufsz(rx_ring);\n-#endif\n-\tunsigned int pagecnt_bias = rx_buffer->pagecnt_bias--;\n+\tunsigned int pagecnt_bias = rx_buffer->pagecnt_bias;\n+\tstruct page *page = rx_buffer->page;\n \n \t/* avoid re-using remote pages */\n \tif (unlikely(ixgbe_page_is_reserved(page)))\n@@ -1970,16 +1969,17 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer,\n \n #if (PAGE_SIZE < 8192)\n \t/* if we are only owner of page we can reuse it */\n-\tif (unlikely(page_count(page) != pagecnt_bias))\n+\tif (unlikely((page_ref_count(page) - pagecnt_bias) > 1))\n \t\treturn false;\n-\n-\t/* flip page offset to other buffer */\n-\trx_buffer->page_offset ^= truesize;\n #else\n-\t/* move offset up to the next cache line */\n-\trx_buffer->page_offset += truesize;\n-\n-\tif (rx_buffer->page_offset > last_offset)\n+\t/* The last offset is a bit aggressive in that we assume the\n+\t * worst case of FCoE being enabled and using a 3K buffer.\n+\t * However this should have minimal impact as the 1K extra is\n+\t * still less than one buffer in size.\n+\t */\n+#define IXGBE_LAST_OFFSET \\\n+\t(SKB_WITH_OVERHEAD(PAGE_SIZE) - IXGBE_RXBUFFER_3K)\n+\tif (rx_buffer->page_offset > IXGBE_LAST_OFFSET)\n \t\treturn false;\n #endif\n \n@@ -1987,7 +1987,7 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer,\n \t * the pagecnt_bias and page count so that we fully restock the\n \t * number of references the driver holds.\n \t */\n-\tif (unlikely(pagecnt_bias == 1)) {\n+\tif (unlikely(!pagecnt_bias)) {\n \t\tpage_ref_add(page, USHRT_MAX);\n \t\trx_buffer->pagecnt_bias = USHRT_MAX;\n \t}\n@@ -2010,106 +2010,65 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer,\n * The function will then update the page offset if necessary and return\n * true if the buffer can be reused by the adapter.\n **/\n-static bool ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring,\n+static void ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring,\n \t\t\t struct ixgbe_rx_buffer *rx_buffer,\n-\t\t\t unsigned int size,\n-\t\t\t struct sk_buff *skb)\n+\t\t\t struct sk_buff *skb,\n+\t\t\t unsigned int size)\n {\n-\tstruct page *page = rx_buffer->page;\n-\tunsigned char *va = page_address(page) + rx_buffer->page_offset;\n #if (PAGE_SIZE < 8192)\n \tunsigned int truesize = ixgbe_rx_pg_size(rx_ring) / 2;\n #else\n \tunsigned int truesize = SKB_DATA_ALIGN(size);\n #endif\n-\n-\tif (unlikely(skb_is_nonlinear(skb)))\n-\t\tgoto add_tail_frag;\n-\n-\tif (size <= IXGBE_RX_HDR_SIZE) {\n-\t\tmemcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long)));\n-\n-\t\t/* page is not reserved, we can reuse buffer as-is */\n-\t\tif (likely(!ixgbe_page_is_reserved(page)))\n-\t\t\treturn true;\n-\n-\t\t/* this page cannot be reused so discard it */\n-\t\treturn false;\n-\t}\n-\n-add_tail_frag:\n-\tskb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,\n+\tskb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rx_buffer->page,\n \t\t\trx_buffer->page_offset, size, truesize);\n-\n-\treturn ixgbe_can_reuse_rx_page(rx_buffer, page, truesize);\n+#if (PAGE_SIZE < 8192)\n+\trx_buffer->page_offset ^= truesize;\n+#else\n+\trx_buffer->page_offset += truesize;\n+#endif\n }\n \n-static struct sk_buff *ixgbe_fetch_rx_buffer(struct ixgbe_ring *rx_ring,\n-\t\t\t\t\t union ixgbe_adv_rx_desc *rx_desc)\n+static struct ixgbe_rx_buffer *ixgbe_get_rx_buffer(struct ixgbe_ring *rx_ring,\n+\t\t\t\t\t\t union ixgbe_adv_rx_desc *rx_desc,\n+\t\t\t\t\t\t struct sk_buff **skb,\n+\t\t\t\t\t\t const unsigned int size)\n {\n-\tunsigned int size = le16_to_cpu(rx_desc->wb.upper.length);\n \tstruct ixgbe_rx_buffer *rx_buffer;\n-\tstruct sk_buff *skb;\n-\tstruct page *page;\n \n \trx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean];\n-\tpage = rx_buffer->page;\n-\tprefetchw(page);\n-\n-\tskb = rx_buffer->skb;\n-\n-\tif (likely(!skb)) {\n-\t\tvoid *page_addr = page_address(page) +\n-\t\t\t\t rx_buffer->page_offset;\n+\tprefetchw(rx_buffer->page);\n+\t*skb = rx_buffer->skb;\n \n-\t\t/* prefetch first cache line of first page */\n-\t\tprefetch(page_addr);\n-#if L1_CACHE_BYTES < 128\n-\t\tprefetch(page_addr + L1_CACHE_BYTES);\n-#endif\n-\n-\t\t/* allocate a skb to store the frags */\n-\t\tskb = napi_alloc_skb(&rx_ring->q_vector->napi,\n-\t\t\t\t IXGBE_RX_HDR_SIZE);\n-\t\tif (unlikely(!skb)) {\n-\t\t\trx_ring->rx_stats.alloc_rx_buff_failed++;\n-\t\t\treturn NULL;\n-\t\t}\n-\n-\t\t/*\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-\n-\t\t/*\n-\t\t * Delay unmapping of the first packet. It carries the\n-\t\t * header information, HW may still access the header\n-\t\t * after the writeback. Only unmap it when EOP is\n-\t\t * reached\n-\t\t */\n-\t\tif (likely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP)))\n-\t\t\tgoto dma_sync;\n-\n-\t\tIXGBE_CB(skb)->dma = rx_buffer->dma;\n+\t/* Delay unmapping of the first packet. It carries the header\n+\t * information, HW may still access the header after the writeback.\n+\t * Only unmap it when EOP is reached\n+\t */\n+\tif (!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP)) {\n+\t\tif (!*skb)\n+\t\t\tgoto skip_sync;\n \t} else {\n-\t\tif (ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP))\n-\t\t\tixgbe_dma_sync_frag(rx_ring, skb);\n+\t\tif (*skb)\n+\t\t\tixgbe_dma_sync_frag(rx_ring, *skb);\n+\t}\n \n-dma_sync:\n-\t\t/* we are reusing so sync this buffer for CPU use */\n-\t\tdma_sync_single_range_for_cpu(rx_ring->dev,\n-\t\t\t\t\t rx_buffer->dma,\n-\t\t\t\t\t rx_buffer->page_offset,\n-\t\t\t\t\t size,\n-\t\t\t\t\t DMA_FROM_DEVICE);\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+skip_sync:\n+\trx_buffer->pagecnt_bias--;\n \n-\t\trx_buffer->skb = NULL;\n-\t}\n+\treturn rx_buffer;\n+}\n \n-\t/* pull page into skb */\n-\tif (ixgbe_add_rx_frag(rx_ring, rx_buffer, size, skb)) {\n+static void ixgbe_put_rx_buffer(struct ixgbe_ring *rx_ring,\n+\t\t\t\tstruct ixgbe_rx_buffer *rx_buffer,\n+\t\t\t\tstruct sk_buff *skb)\n+{\n+\tif (ixgbe_can_reuse_rx_page(rx_buffer)) {\n \t\t/* hand second half of page back to the ring */\n \t\tixgbe_reuse_rx_page(rx_ring, rx_buffer);\n \t} else {\n@@ -2123,12 +2082,55 @@ static struct sk_buff *ixgbe_fetch_rx_buffer(struct ixgbe_ring *rx_ring,\n \t\t\t\t\t DMA_FROM_DEVICE,\n \t\t\t\t\t IXGBE_RX_DMA_ATTR);\n \t\t}\n-\t\t__page_frag_cache_drain(page,\n+\t\t__page_frag_cache_drain(rx_buffer->page,\n \t\t\t\t\trx_buffer->pagecnt_bias);\n \t}\n \n-\t/* clear contents of buffer_info */\n+\t/* clear contents of rx_buffer */\n \trx_buffer->page = NULL;\n+\trx_buffer->skb = NULL;\n+}\n+\n+static struct sk_buff *ixgbe_construct_skb(struct ixgbe_ring *rx_ring,\n+\t\t\t\t\t struct ixgbe_rx_buffer *rx_buffer,\n+\t\t\t\t\t union ixgbe_adv_rx_desc *rx_desc,\n+\t\t\t\t\t unsigned int size)\n+{\n+\tvoid *va = page_address(rx_buffer->page) + rx_buffer->page_offset;\n+#if (PAGE_SIZE < 8192)\n+\tunsigned int truesize = ixgbe_rx_pg_size(rx_ring) / 2;\n+#else\n+\tunsigned int truesize = ALIGN(size, L1_CACHE_BYTES);\n+#endif\n+\tstruct sk_buff *skb;\n+\n+\t/* prefetch first cache line of first page */\n+\tprefetch(va);\n+#if L1_CACHE_BYTES < 128\n+\tprefetch(va + L1_CACHE_BYTES);\n+#endif\n+\n+\t/* allocate a skb to store the frags */\n+\tskb = napi_alloc_skb(&rx_ring->q_vector->napi, IXGBE_RX_HDR_SIZE);\n+\tif (unlikely(!skb))\n+\t\treturn NULL;\n+\n+\tif (size > IXGBE_RX_HDR_SIZE) {\n+\t\tif (!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP))\n+\t\t\tIXGBE_CB(skb)->dma = rx_buffer->dma;\n+\n+\t\tskb_add_rx_frag(skb, 0, rx_buffer->page,\n+\t\t\t\trx_buffer->page_offset,\n+\t\t\t\tsize, truesize);\n+#if (PAGE_SIZE < 8192)\n+\t\trx_buffer->page_offset ^= truesize;\n+#else\n+\t\trx_buffer->page_offset += truesize;\n+#endif\n+\t} else {\n+\t\tmemcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long)));\n+\t\trx_buffer->pagecnt_bias++;\n+\t}\n \n \treturn skb;\n }\n@@ -2160,7 +2162,9 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,\n \n \twhile (likely(total_rx_packets < budget)) {\n \t\tunion ixgbe_adv_rx_desc *rx_desc;\n+\t\tstruct ixgbe_rx_buffer *rx_buffer;\n \t\tstruct sk_buff *skb;\n+\t\tunsigned int size;\n \n \t\t/* return some buffers to hardware, one at a time is too slow */\n \t\tif (cleaned_count >= IXGBE_RX_BUFFER_WRITE) {\n@@ -2169,8 +2173,8 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,\n \t\t}\n \n \t\trx_desc = IXGBE_RX_DESC(rx_ring, rx_ring->next_to_clean);\n-\n-\t\tif (!rx_desc->wb.upper.length)\n+\t\tsize = le16_to_cpu(rx_desc->wb.upper.length);\n+\t\tif (!size)\n \t\t\tbreak;\n \n \t\t/* This memory barrier is needed to keep us from reading\n@@ -2179,13 +2183,23 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,\n \t\t */\n \t\tdma_rmb();\n \n+\t\trx_buffer = ixgbe_get_rx_buffer(rx_ring, rx_desc, &skb, size);\n+\n \t\t/* retrieve a buffer from the ring */\n-\t\tskb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc);\n+\t\tif (skb)\n+\t\t\tixgbe_add_rx_frag(rx_ring, rx_buffer, skb, size);\n+\t\telse\n+\t\t\tskb = ixgbe_construct_skb(rx_ring, rx_buffer,\n+\t\t\t\t\t\t rx_desc, size);\n \n \t\t/* exit if we failed to retrieve a buffer */\n-\t\tif (!skb)\n+\t\tif (!skb) {\n+\t\t\trx_ring->rx_stats.alloc_rx_buff_failed++;\n+\t\t\trx_buffer->pagecnt_bias++;\n \t\t\tbreak;\n+\t\t}\n \n+\t\tixgbe_put_rx_buffer(rx_ring, rx_buffer, skb);\n \t\tcleaned_count++;\n \n \t\t/* place incomplete frames back on ring for completion */\n", "prefixes": [ "next", "07/11" ] }