Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/463876/?format=api
{ "id": 463876, "url": "http://patchwork.ozlabs.org/api/patches/463876/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20150423044917.18903.76134.stgit@ahduyck-vm-fedora22/", "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": "<20150423044917.18903.76134.stgit@ahduyck-vm-fedora22>", "list_archive_url": null, "date": "2015-04-23T04:49:17", "name": "[1/3] igb: Pull timestamp from fragment before adding it to skb", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "79712fffa98f305a501cbbcb03dc98f386f772d8", "submitter": { "id": 64958, "url": "http://patchwork.ozlabs.org/api/people/64958/?format=api", "name": "Alexander Duyck", "email": "alexander.h.duyck@redhat.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/20150423044917.18903.76134.stgit@ahduyck-vm-fedora22/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/463876/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/463876/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 hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id AEBD51400B7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 23 Apr 2015 14:49:23 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id E6EA4956CE;\n\tThu, 23 Apr 2015 04:49:22 +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 KIVK+csxoI-h; Thu, 23 Apr 2015 04:49:22 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 730EF95394;\n\tThu, 23 Apr 2015 04:49:22 +0000 (UTC)", "from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 373E71BF863\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Apr 2015 04:49:21 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 3087195394\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Apr 2015 04:49:21 +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 qK3+Bfy+MufE for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Apr 2015 04:49:20 +0000 (UTC)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 5B8E5953B4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Apr 2015 04:49:20 +0000 (UTC)", "from int-mx11.intmail.prod.int.phx2.redhat.com\n\t(int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])\n\tby mx1.redhat.com (Postfix) with ESMTPS id B5AC68E3C1;\n\tThu, 23 Apr 2015 04:49:19 +0000 (UTC)", "from [192.168.122.149] (ovpn-112-80.phx2.redhat.com [10.3.112.80])\n\tby int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with\n\tESMTP id t3N4nHtT022880; Thu, 23 Apr 2015 00:49:18 -0400" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "From": "Alexander Duyck <alexander.h.duyck@redhat.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 22 Apr 2015 21:49:17 -0700", "Message-ID": "<20150423044917.18903.76134.stgit@ahduyck-vm-fedora22>", "In-Reply-To": "<20150423040941.18903.3545.stgit@ahduyck-vm-fedora22>", "References": "<20150423040941.18903.3545.stgit@ahduyck-vm-fedora22>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.68 on 10.5.11.24", "Cc": "Cong Wang <xiyou.wangcong@gmail.com>", "Subject": "[Intel-wired-lan] [PATCH 1/3] igb: Pull timestamp from fragment\n\tbefore adding it to skb", "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": "This change makes it so that we pull the timestamp from the fragment before\nwe add it to the skb. By doing this we can avoid a possible issue in which\nthe fragment can possibly be less than IGB_RX_HDR_LEN due to the timestamp\nbeing pulled after the copybreak check.\n\nWhile making this change I realized we could also pull the rest of the\nigb_pull_tail function into igb_add_rx_frag since in the case of igb,\nunlike ixgbe, we are able to unmap the entire buffer before calling\nadd_rx_frag so merging the two allows for sharing of code between the two\nmerged functions.\n\nReported-by: Cong Wang <xiyou.wangcong@gmail.com>\nSigned-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>\n---\n drivers/net/ethernet/intel/igb/igb_main.c | 94 ++++++++---------------------\n 1 file changed, 25 insertions(+), 69 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c\nindex 8457d0306e3a..cab50593c315 100644\n--- a/drivers/net/ethernet/intel/igb/igb_main.c\n+++ b/drivers/net/ethernet/intel/igb/igb_main.c\n@@ -6637,22 +6637,25 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,\n \t\t\t struct sk_buff *skb)\n {\n \tstruct page *page = rx_buffer->page;\n+\tunsigned char *va = page_address(page) + rx_buffer->page_offset;\n \tunsigned int size = le16_to_cpu(rx_desc->wb.upper.length);\n #if (PAGE_SIZE < 8192)\n \tunsigned int truesize = IGB_RX_BUFSZ;\n #else\n-\tunsigned int truesize = ALIGN(size, L1_CACHE_BYTES);\n+\tunsigned int truesize = SKB_DATA_ALIGN(size);\n #endif\n+\tunsigned int pull_len;\n \n-\tif ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) {\n-\t\tunsigned char *va = page_address(page) + rx_buffer->page_offset;\n+\tif (unlikely(skb_is_nonlinear(skb)))\n+\t\tgoto add_tail_frag;\n \n-\t\tif (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {\n-\t\t\tigb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);\n-\t\t\tva += IGB_TS_HDR_LEN;\n-\t\t\tsize -= IGB_TS_HDR_LEN;\n-\t\t}\n+\tif (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) {\n+\t\tigb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);\n+\t\tva += IGB_TS_HDR_LEN;\n+\t\tsize -= IGB_TS_HDR_LEN;\n+\t}\n \n+\tif (likely(size <= IGB_RX_HDR_LEN)) {\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@@ -6664,8 +6667,21 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,\n \t\treturn false;\n \t}\n \n+\t/* we need the header to contain the greater of either ETH_HLEN or\n+\t * 60 bytes if the skb->len is less than 60 for skb_pad.\n+\t */\n+\tpull_len = eth_get_headlen(va, IGB_RX_HDR_LEN);\n+\n+\t/* align pull length to size of long to optimize memcpy performance */\n+\tmemcpy(__skb_put(skb, pull_len), va, ALIGN(pull_len, sizeof(long)));\n+\n+\t/* update all of the pointers */\n+\tva += pull_len;\n+\tsize -= pull_len;\n+\n+add_tail_frag:\n \tskb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,\n-\t\t\trx_buffer->page_offset, size, truesize);\n+\t\t\t(unsigned long)va & ~PAGE_MASK, size, truesize);\n \n \treturn igb_can_reuse_rx_page(rx_buffer, page, truesize);\n }\n@@ -6807,62 +6823,6 @@ static bool igb_is_non_eop(struct igb_ring *rx_ring,\n }\n \n /**\n- * igb_pull_tail - igb specific version of skb_pull_tail\n- * @rx_ring: rx descriptor ring packet is being transacted on\n- * @rx_desc: pointer to the EOP Rx descriptor\n- * @skb: pointer to current skb being adjusted\n- *\n- * This function is an igb specific version of __pskb_pull_tail. The\n- * main difference between this version and the original function is that\n- * this function can make several assumptions about the state of things\n- * that allow for significant optimizations versus the standard function.\n- * As a result we can do things like drop a frag and maintain an accurate\n- * truesize for the skb.\n- */\n-static void igb_pull_tail(struct igb_ring *rx_ring,\n-\t\t\t union e1000_adv_rx_desc *rx_desc,\n-\t\t\t struct sk_buff *skb)\n-{\n-\tstruct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];\n-\tunsigned char *va;\n-\tunsigned int pull_len;\n-\n-\t/* it is valid to use page_address instead of kmap since we are\n-\t * working with pages allocated out of the lomem pool per\n-\t * alloc_page(GFP_ATOMIC)\n-\t */\n-\tva = skb_frag_address(frag);\n-\n-\tif (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {\n-\t\t/* retrieve timestamp from buffer */\n-\t\tigb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);\n-\n-\t\t/* update pointers to remove timestamp header */\n-\t\tskb_frag_size_sub(frag, IGB_TS_HDR_LEN);\n-\t\tfrag->page_offset += IGB_TS_HDR_LEN;\n-\t\tskb->data_len -= IGB_TS_HDR_LEN;\n-\t\tskb->len -= IGB_TS_HDR_LEN;\n-\n-\t\t/* move va to start of packet data */\n-\t\tva += IGB_TS_HDR_LEN;\n-\t}\n-\n-\t/* we need the header to contain the greater of either ETH_HLEN or\n-\t * 60 bytes if the skb->len is less than 60 for skb_pad.\n-\t */\n-\tpull_len = eth_get_headlen(va, IGB_RX_HDR_LEN);\n-\n-\t/* align pull length to size of long to optimize memcpy performance */\n-\tskb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));\n-\n-\t/* update all of the pointers */\n-\tskb_frag_size_sub(frag, pull_len);\n-\tfrag->page_offset += pull_len;\n-\tskb->data_len -= pull_len;\n-\tskb->tail += pull_len;\n-}\n-\n-/**\n * igb_cleanup_headers - Correct corrupted or empty headers\n * @rx_ring: rx descriptor ring packet is being transacted on\n * @rx_desc: pointer to the EOP Rx descriptor\n@@ -6889,10 +6849,6 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,\n \t\t}\n \t}\n \n-\t/* place header in linear portion of buffer */\n-\tif (skb_is_nonlinear(skb))\n-\t\tigb_pull_tail(rx_ring, rx_desc, skb);\n-\n \t/* if eth_skb_pad returns an error the skb was freed */\n \tif (eth_skb_pad(skb))\n \t\treturn true;\n", "prefixes": [ "1/3" ] }