Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/603708/?format=api
{ "id": 603708, "url": "http://patchwork.ozlabs.org/api/patches/603708/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160330231116.12643.59554.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": "<20160330231116.12643.59554.stgit@localhost.localdomain>", "list_archive_url": null, "date": "2016-03-30T23:15:37", "name": "[net,v2] i40e/i40evf: Limit TSO to 7 descriptors for payload instead of 8 per packet", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "645a6d8e8a70b93c45d6ff08fb8c18e777d25137", "submitter": { "id": 67293, "url": "http://patchwork.ozlabs.org/api/people/67293/?format=api", "name": "Alexander Duyck", "email": "aduyck@mirantis.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/20160330231116.12643.59554.stgit@localhost.localdomain/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/603708/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/603708/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ozlabs.org (Postfix) with ESMTP id 3qb3R50RWDz9sf6\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Mar 2016 10:15:45 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 3A69432F52;\n\tWed, 30 Mar 2016 23:15:44 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id TaMpAzEIQHjj; Wed, 30 Mar 2016 23:15:42 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 4717D259A3;\n\tWed, 30 Mar 2016 23:15:42 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 3395D1C0BC2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Mar 2016 23:15:41 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 2BB8F274F7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Mar 2016 23:15:41 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id RGpDf690AJrF for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Mar 2016 23:15:39 +0000 (UTC)", "from mail-pf0-f178.google.com (mail-pf0-f178.google.com\n\t[209.85.192.178])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 61FE9259A3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Mar 2016 23:15:39 +0000 (UTC)", "by mail-pf0-f178.google.com with SMTP id x3so54022350pfb.1\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 30 Mar 2016 16:15:39 -0700 (PDT)", "from localhost.localdomain\n\t(static-50-53-29-36.bvtn.or.frontiernet.net. [50.53.29.36])\n\tby smtp.gmail.com with ESMTPSA id\n\t82sm8329028pfi.78.2016.03.30.16.15.38\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 30 Mar 2016 16:15:38 -0700 (PDT)" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mirantis.com header.i=@mirantis.com\n\theader.b=QXo9roR9; dkim-atps=neutral", "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com;\n\ts=google; \n\th=subject:from:to:date:message-id:user-agent:mime-version\n\t:content-transfer-encoding;\n\tbh=neChG2OuffzikpaMRGo5ui1nN5vzB1PJIggzfY3jEIo=;\n\tb=QXo9roR95P1zM32SWGl/MJWUBGsTwQqs3/778V2dvsVof57x1/In+cA9EWdEylYkX9\n\tnRSPMtol30Fy+nHrZJb72CRYW5OVzBSk0V3ECHSWVX5BMNk0Xw3ZzjIWOhwP9ghOJySz\n\t2Skvut3TBSW2hs3LJYmYz47Ap4ShAZSqlWME4=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:subject:from:to:date:message-id:user-agent\n\t:mime-version:content-transfer-encoding;\n\tbh=neChG2OuffzikpaMRGo5ui1nN5vzB1PJIggzfY3jEIo=;\n\tb=ar74ghOMi+3ZEo3f7QjrAwuwpLWMVB6WfnDhwheyeIbneECWIiTuHN8fwOGSfDedwu\n\t0JVoxWUiVO00WX3bJ668vOxPoN8/oW+WXCEckMgZZonSkRDZTCiXbzAyVogH5ZPZZRJ2\n\tg471UN1oMkezMiQ1So21n+j8WXJRirQTuPJEVKfVW1jvPe3L1Op1lmaaDx5qzp4b2Fp+\n\tWq5O8uZkQr8Bas93SSth7vdaPzJqxnNbcC0D/+EAmViSlJX1rVl8uC/v8iHfhysPOLCY\n\tEFITHAqK0JKvh/qzndmb69SwO3K3VbbPM9atQ5zsIA4qYazaFxsXW6ZJQb8nTwscBkeE\n\t9hdg==", "X-Gm-Message-State": "AD7BkJJNQus4g9nk6W4MEclAXNf52zwB7oY61JXRcKwKKEyMzrVo9e7nLMdbN5buWI85EbvF", "X-Received": "by 10.98.74.200 with SMTP id c69mr17079827pfj.129.1459379738963; \n\tWed, 30 Mar 2016 16:15:38 -0700 (PDT)", "From": "Alexander Duyck <aduyck@mirantis.com>", "To": "netdev@vger.kernel.org, jesse.brandeburg@intel.com,\n\talexander.duyck@gmail.com, intel-wired-lan@lists.osuosl.org,\n\tjeffrey.t.kirsher@intel.com, sowmini.varadhan@oracle.com", "Date": "Wed, 30 Mar 2016 16:15:37 -0700", "Message-ID": "<20160330231116.12643.59554.stgit@localhost.localdomain>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [net PATCH v2] i40e/i40evf: Limit TSO to 7\n\tdescriptors for payload instead of 8 per packet", "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 patch addresses a bug introduced based on my interpretation of the\nXL710 datasheet. Specifically section 8.4.1 states that \"A single transmit\npacket may span up to 8 buffers (up to 8 data descriptors per packet\nincluding both the header and payload buffers).\" It then later goes on to\nsay that each segment for a TSO obeys the previous rule, however it then\nrefers to TSO header and the segment payload buffers.\n\nI believe the actual limit for fragments with TSO and a skbuff that has\npayload data in the header portion of the buffer is actually only 7\nfragments as the skb->data portion counts as 2 buffers, one for the TSO\nheader, and one for a segment payload buffer.\n\nFixes: 2d37490b82af (\"i40e/i40evf: Rewrite logic for 8 descriptor per packet check\")\nSigned-off-by: Alexander Duyck <aduyck@mirantis.com>\n---\n\nv2: I realized that I overlooked the check in the inline function and as a\n result we were still allowing for cases where 8 descriptors were being\n used per packet and this would result in 9 DMA buffers. I updated the\n code so that we only allow 8 in the case of a single send, otherwise we\n go into the function that walks the frags to verify each block.\n\nI have tested this using rds-stress and it seems to run traffic without\nthrowing any errors.\n\n drivers/net/ethernet/intel/i40e/i40e_txrx.c | 49 ++++++++++++-------------\n drivers/net/ethernet/intel/i40e/i40e_txrx.h | 10 ++++-\n drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 49 ++++++++++++-------------\n drivers/net/ethernet/intel/i40evf/i40e_txrx.h | 10 ++++-\n 4 files changed, 62 insertions(+), 56 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex 5d5fa5359a1d..6bf705add321 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -2597,35 +2597,34 @@ int __i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)\n }\n \n /**\n- * __i40e_chk_linearize - Check if there are more than 8 fragments per packet\n+ * __i40e_chk_linearize - Check if there are more than 8 buffers per packet\n * @skb: send buffer\n *\n- * Note: Our HW can't scatter-gather more than 8 fragments to build\n- * a packet on the wire and so we need to figure out the cases where we\n- * need to linearize the skb.\n+ * Note: Our HW can't DMA more than 8 buffers to build a packet on the wire\n+ * and so we need to figure out the cases where we need to linearize the skb.\n+ *\n+ * For TSO we need to count the TSO header and segment payload separately.\n+ * As such we need to check cases where we have 7 fragments or more as we\n+ * can potentially require 9 DMA transactions, 1 for the TSO header, 1 for\n+ * the segment payload in the first descriptor, and another 7 for the\n+ * fragments.\n **/\n bool __i40e_chk_linearize(struct sk_buff *skb)\n {\n \tconst struct skb_frag_struct *frag, *stale;\n-\tint gso_size, nr_frags, sum;\n-\n-\t/* check to see if TSO is enabled, if so we may get a repreive */\n-\tgso_size = skb_shinfo(skb)->gso_size;\n-\tif (unlikely(!gso_size))\n-\t\treturn true;\n+\tint nr_frags, sum;\n \n-\t/* no need to check if number of frags is less than 8 */\n+\t/* no need to check if number of frags is less than 7 */\n \tnr_frags = skb_shinfo(skb)->nr_frags;\n-\tif (nr_frags < I40E_MAX_BUFFER_TXD)\n+\tif (nr_frags < (I40E_MAX_BUFFER_TXD - 1))\n \t\treturn false;\n \n \t/* We need to walk through the list and validate that each group\n \t * of 6 fragments totals at least gso_size. However we don't need\n-\t * to perform such validation on the first or last 6 since the first\n-\t * 6 cannot inherit any data from a descriptor before them, and the\n-\t * last 6 cannot inherit any data from a descriptor after them.\n+\t * to perform such validation on the last 6 since the last 6 cannot\n+\t * inherit any data from a descriptor after them.\n \t */\n-\tnr_frags -= I40E_MAX_BUFFER_TXD - 1;\n+\tnr_frags -= I40E_MAX_BUFFER_TXD - 2;\n \tfrag = &skb_shinfo(skb)->frags[0];\n \n \t/* Initialize size to the negative value of gso_size minus 1. We\n@@ -2634,21 +2633,21 @@ bool __i40e_chk_linearize(struct sk_buff *skb)\n \t * descriptors for a single transmit as the header and previous\n \t * fragment are already consuming 2 descriptors.\n \t */\n-\tsum = 1 - gso_size;\n+\tsum = 1 - skb_shinfo(skb)->gso_size;\n \n-\t/* Add size of frags 1 through 5 to create our initial sum */\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n+\t/* Add size of frags 0 through 4 to create our initial sum */\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n \n \t/* Walk through fragments adding latest fragment, testing it, and\n \t * then removing stale fragments from the sum.\n \t */\n \tstale = &skb_shinfo(skb)->frags[0];\n \tfor (;;) {\n-\t\tsum += skb_frag_size(++frag);\n+\t\tsum += skb_frag_size(frag++);\n \n \t\t/* if sum is negative we failed to make sufficient progress */\n \t\tif (sum < 0)\n@@ -2658,7 +2657,7 @@ bool __i40e_chk_linearize(struct sk_buff *skb)\n \t\tif (!--nr_frags)\n \t\t\tbreak;\n \n-\t\tsum -= skb_frag_size(++stale);\n+\t\tsum -= skb_frag_size(stale++);\n \t}\n \n \treturn false;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\nindex 681e9bca37db..c864932bd844 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -442,10 +442,14 @@ static inline int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)\n **/\n static inline bool i40e_chk_linearize(struct sk_buff *skb, int count)\n {\n-\t/* we can only support up to 8 data buffers for a single send */\n-\tif (likely(count <= I40E_MAX_BUFFER_TXD))\n+\t/* Both TSO and single send will work if count is less than 8 */\n+\tif (likely(count < I40E_MAX_BUFFER_TXD))\n \t\treturn false;\n \n-\treturn __i40e_chk_linearize(skb);\n+\tif (skb_is_gso(skb))\n+\t\treturn __i40e_chk_linearize(skb);\n+\n+\t/* we can support up to 8 data buffers for a single send */\n+\treturn count != I40E_MAX_BUFFER_TXD;\n }\n #endif /* _I40E_TXRX_H_ */\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\nindex 04aabc52ba0d..519256bb63e8 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\n@@ -1799,35 +1799,34 @@ static void i40e_create_tx_ctx(struct i40e_ring *tx_ring,\n }\n \n /**\n- * __i40evf_chk_linearize - Check if there are more than 8 fragments per packet\n+ * __i40evf_chk_linearize - Check if there are more than 8 buffers per packet\n * @skb: send buffer\n *\n- * Note: Our HW can't scatter-gather more than 8 fragments to build\n- * a packet on the wire and so we need to figure out the cases where we\n- * need to linearize the skb.\n+ * Note: Our HW can't DMA more than 8 buffers to build a packet on the wire\n+ * and so we need to figure out the cases where we need to linearize the skb.\n+ *\n+ * For TSO we need to count the TSO header and segment payload separately.\n+ * As such we need to check cases where we have 7 fragments or more as we\n+ * can potentially require 9 DMA transactions, 1 for the TSO header, 1 for\n+ * the segment payload in the first descriptor, and another 7 for the\n+ * fragments.\n **/\n bool __i40evf_chk_linearize(struct sk_buff *skb)\n {\n \tconst struct skb_frag_struct *frag, *stale;\n-\tint gso_size, nr_frags, sum;\n-\n-\t/* check to see if TSO is enabled, if so we may get a repreive */\n-\tgso_size = skb_shinfo(skb)->gso_size;\n-\tif (unlikely(!gso_size))\n-\t\treturn true;\n+\tint nr_frags, sum;\n \n-\t/* no need to check if number of frags is less than 8 */\n+\t/* no need to check if number of frags is less than 7 */\n \tnr_frags = skb_shinfo(skb)->nr_frags;\n-\tif (nr_frags < I40E_MAX_BUFFER_TXD)\n+\tif (nr_frags < (I40E_MAX_BUFFER_TXD - 1))\n \t\treturn false;\n \n \t/* We need to walk through the list and validate that each group\n \t * of 6 fragments totals at least gso_size. However we don't need\n-\t * to perform such validation on the first or last 6 since the first\n-\t * 6 cannot inherit any data from a descriptor before them, and the\n-\t * last 6 cannot inherit any data from a descriptor after them.\n+\t * to perform such validation on the last 6 since the last 6 cannot\n+\t * inherit any data from a descriptor after them.\n \t */\n-\tnr_frags -= I40E_MAX_BUFFER_TXD - 1;\n+\tnr_frags -= I40E_MAX_BUFFER_TXD - 2;\n \tfrag = &skb_shinfo(skb)->frags[0];\n \n \t/* Initialize size to the negative value of gso_size minus 1. We\n@@ -1836,21 +1835,21 @@ bool __i40evf_chk_linearize(struct sk_buff *skb)\n \t * descriptors for a single transmit as the header and previous\n \t * fragment are already consuming 2 descriptors.\n \t */\n-\tsum = 1 - gso_size;\n+\tsum = 1 - skb_shinfo(skb)->gso_size;\n \n-\t/* Add size of frags 1 through 5 to create our initial sum */\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n-\tsum += skb_frag_size(++frag);\n+\t/* Add size of frags 0 through 4 to create our initial sum */\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n+\tsum += skb_frag_size(frag++);\n \n \t/* Walk through fragments adding latest fragment, testing it, and\n \t * then removing stale fragments from the sum.\n \t */\n \tstale = &skb_shinfo(skb)->frags[0];\n \tfor (;;) {\n-\t\tsum += skb_frag_size(++frag);\n+\t\tsum += skb_frag_size(frag++);\n \n \t\t/* if sum is negative we failed to make sufficient progress */\n \t\tif (sum < 0)\n@@ -1860,7 +1859,7 @@ bool __i40evf_chk_linearize(struct sk_buff *skb)\n \t\tif (!--nr_frags)\n \t\t\tbreak;\n \n-\t\tsum -= skb_frag_size(++stale);\n+\t\tsum -= skb_frag_size(stale++);\n \t}\n \n \treturn false;\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h\nindex 6cf116972f62..396c3893ce8a 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h\n@@ -424,10 +424,14 @@ static inline int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)\n **/\n static inline bool i40e_chk_linearize(struct sk_buff *skb, int count)\n {\n-\t/* we can only support up to 8 data buffers for a single send */\n-\tif (likely(count <= I40E_MAX_BUFFER_TXD))\n+\t/* Both TSO and single send will work if count is less than 8 */\n+\tif (likely(count < I40E_MAX_BUFFER_TXD))\n \t\treturn false;\n \n-\treturn __i40evf_chk_linearize(skb);\n+\tif (skb_is_gso(skb))\n+\t\treturn __i40evf_chk_linearize(skb);\n+\n+\t/* we can support up to 8 data buffers for a single send */\n+\treturn count != I40E_MAX_BUFFER_TXD;\n }\n #endif /* _I40E_TXRX_H_ */\n", "prefixes": [ "net", "v2" ] }