get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/867752/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 867752,
    "url": "http://patchwork.ozlabs.org/api/patches/867752/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180131005122.19264.70254.stgit@localhost6.localdomain6/",
    "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": "<20180131005122.19264.70254.stgit@localhost6.localdomain6>",
    "list_archive_url": null,
    "date": "2018-01-31T00:51:22",
    "name": "[3/9] ixgbevf: add support for using order 1 pages to receive large frames",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "fb168ee60f6d3c3e6a20ec9f559bcbb9be121a30",
    "submitter": {
        "id": 1670,
        "url": "http://patchwork.ozlabs.org/api/people/1670/?format=api",
        "name": "Tantilov, Emil S",
        "email": "emil.s.tantilov@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/20180131005122.19264.70254.stgit@localhost6.localdomain6/mbox/",
    "series": [
        {
            "id": 26180,
            "url": "http://patchwork.ozlabs.org/api/series/26180/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=26180",
            "date": "2018-01-31T00:51:07",
            "name": "ixgbevf: build_skb support and related changes",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/26180/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/867752/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/867752/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>)",
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 3zWPfx3zMcz9ryQ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 31 Jan 2018 11:45:29 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 79C3388E93;\n\tWed, 31 Jan 2018 00:45:27 +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 UQ3qKlLdCAgx; Wed, 31 Jan 2018 00:45:26 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 1C02188E8D;\n\tWed, 31 Jan 2018 00:45:26 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 7401A1C4377\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 31 Jan 2018 00:45:25 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 704F92FC78\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 31 Jan 2018 00:45:25 +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 P0NN7Xvpf2wM for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 31 Jan 2018 00:45:24 +0000 (UTC)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 35D522F9BB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 31 Jan 2018 00:45:24 +0000 (UTC)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 Jan 2018 16:45:23 -0800",
            "from estantil-desk3.jf.intel.com (HELO localhost6.localdomain6)\n\t([134.134.177.100])\n\tby fmsmga002.fm.intel.com with ESMTP; 30 Jan 2018 16:45:23 -0800"
        ],
        "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.46,437,1511856000\"; d=\"scan'208\";a=\"15698947\"",
        "From": "Emil Tantilov <emil.s.tantilov@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 30 Jan 2018 16:51:22 -0800",
        "Message-ID": "<20180131005122.19264.70254.stgit@localhost6.localdomain6>",
        "In-Reply-To": "<20180131005015.19264.44085.stgit@localhost6.localdomain6>",
        "References": "<20180131005015.19264.44085.stgit@localhost6.localdomain6>",
        "User-Agent": "StGit/0.17.1-17-ge4e0",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH 3/9] ixgbevf: add support for using order\n\t1 pages to receive large frames",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.24",
        "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>",
        "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": "Based on commit 8649aaef4044\n(\"igb: Add support for using order 1 pages to receive large frames\")\n\nAdd support for using 3K buffers in order 1 page. We are reserving 1K for\nnow to have space available for future tailroom and headroom when we enable\nbuild_skb support.\n\nSigned-off-by: Emil Tantilov <emil.s.tantilov@intel.com>\n---\n drivers/net/ethernet/intel/ixgbevf/ixgbevf.h      |   52 ++++++++++++++---\n drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   64 ++++++++++++++++-----\n 2 files changed, 92 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h\nindex 62a3669..d691d64 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h\n+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h\n@@ -89,17 +89,11 @@ struct ixgbevf_rx_queue_stats {\n };\n \n enum ixgbevf_ring_state_t {\n+\t__IXGBEVF_RX_3K_BUFFER,\n \t__IXGBEVF_TX_DETECT_HANG,\n \t__IXGBEVF_HANG_CHECK_ARMED,\n };\n \n-#define check_for_tx_hang(ring) \\\n-\ttest_bit(__IXGBEVF_TX_DETECT_HANG, &(ring)->state)\n-#define set_check_for_tx_hang(ring) \\\n-\tset_bit(__IXGBEVF_TX_DETECT_HANG, &(ring)->state)\n-#define clear_check_for_tx_hang(ring) \\\n-\tclear_bit(__IXGBEVF_TX_DETECT_HANG, &(ring)->state)\n-\n struct ixgbevf_ring {\n \tstruct ixgbevf_ring *next;\n \tstruct net_device *netdev;\n@@ -156,12 +150,20 @@ struct ixgbevf_ring {\n /* Supported Rx Buffer Sizes */\n #define IXGBEVF_RXBUFFER_256\t256    /* Used for packet split */\n #define IXGBEVF_RXBUFFER_2048\t2048\n+#define IXGBEVF_RXBUFFER_3072\t3072\n \n #define IXGBEVF_RX_HDR_SIZE\tIXGBEVF_RXBUFFER_256\n-#define IXGBEVF_RX_BUFSZ\tIXGBEVF_RXBUFFER_2048\n \n #define MAXIMUM_ETHERNET_VLAN_SIZE (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)\n \n+#define IXGBEVF_SKB_PAD        (NET_SKB_PAD + NET_IP_ALIGN)\n+#if (PAGE_SIZE < 8192)\n+#define IXGBEVF_MAX_FRAME_BUILD_SKB \\\n+\t(SKB_WITH_OVERHEAD(IXGBEVF_RXBUFFER_2048) - IXGBEVF_SKB_PAD)\n+#else\n+#define IXGBEVF_MAX_FRAME_BUILD_SKB IXGBEVF_RXBUFFER_2048\n+#endif\n+\n #define IXGBE_TX_FLAGS_CSUM\t\tBIT(0)\n #define IXGBE_TX_FLAGS_VLAN\t\tBIT(1)\n #define IXGBE_TX_FLAGS_TSO\t\tBIT(2)\n@@ -170,6 +172,40 @@ struct ixgbevf_ring {\n #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK\t0x0000e000\n #define IXGBE_TX_FLAGS_VLAN_SHIFT\t16\n \n+#define ring_uses_large_buffer(ring) \\\n+\ttest_bit(__IXGBEVF_RX_3K_BUFFER, &(ring)->state)\n+#define set_ring_uses_large_buffer(ring) \\\n+\tset_bit(__IXGBEVF_RX_3K_BUFFER, &(ring)->state)\n+#define clear_ring_uses_large_buffer(ring) \\\n+\tclear_bit(__IXGBEVF_RX_3K_BUFFER, &(ring)->state)\n+\n+static inline unsigned int ixgbevf_rx_bufsz(struct ixgbevf_ring *ring)\n+{\n+#if (PAGE_SIZE < 8192)\n+\tif (ring_uses_large_buffer(ring))\n+\t\treturn IXGBEVF_RXBUFFER_3072;\n+#endif\n+\treturn IXGBEVF_RXBUFFER_2048;\n+}\n+\n+static inline unsigned int ixgbevf_rx_pg_order(struct ixgbevf_ring *ring)\n+{\n+#if (PAGE_SIZE < 8192)\n+\tif (ring_uses_large_buffer(ring))\n+\t\treturn 1;\n+#endif\n+\treturn 0;\n+}\n+\n+#define ixgbevf_rx_pg_size(_ring) (PAGE_SIZE << ixgbevf_rx_pg_order(_ring))\n+\n+#define check_for_tx_hang(ring) \\\n+\ttest_bit(__IXGBEVF_TX_DETECT_HANG, &(ring)->state)\n+#define set_check_for_tx_hang(ring) \\\n+\tset_bit(__IXGBEVF_TX_DETECT_HANG, &(ring)->state)\n+#define clear_check_for_tx_hang(ring) \\\n+\tclear_bit(__IXGBEVF_TX_DETECT_HANG, &(ring)->state)\n+\n struct ixgbevf_ring_container {\n \tstruct ixgbevf_ring *ring;\t/* pointer to linked list of rings */\n \tunsigned int total_bytes;\t/* total bytes processed this int */\ndiff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\nindex 604b026..f8e1b1c 100644\n--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\n+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c\n@@ -565,21 +565,22 @@ static bool ixgbevf_alloc_mapped_page(struct ixgbevf_ring *rx_ring,\n \t\treturn true;\n \n \t/* alloc new page for storage */\n-\tpage = dev_alloc_page();\n+\tpage = dev_alloc_pages(ixgbevf_rx_pg_order(rx_ring));\n \tif (unlikely(!page)) {\n \t\trx_ring->rx_stats.alloc_rx_page_failed++;\n \t\treturn false;\n \t}\n \n \t/* map page for use */\n-\tdma = dma_map_page_attrs(rx_ring->dev, page, 0, PAGE_SIZE,\n+\tdma = dma_map_page_attrs(rx_ring->dev, page, 0,\n+\t\t\t\t ixgbevf_rx_pg_size(rx_ring),\n \t\t\t\t DMA_FROM_DEVICE, IXGBEVF_RX_DMA_ATTR);\n \n \t/* if mapping failed free memory back to system since\n \t * there isn't much point in holding memory we can't use\n \t */\n \tif (dma_mapping_error(rx_ring->dev, dma)) {\n-\t\t__free_page(page);\n+\t\t__free_pages(page, ixgbevf_rx_pg_order(rx_ring));\n \n \t\trx_ring->rx_stats.alloc_rx_page_failed++;\n \t\treturn false;\n@@ -621,7 +622,7 @@ static void ixgbevf_alloc_rx_buffers(struct ixgbevf_ring *rx_ring,\n \t\t/* sync the buffer for use by the device */\n \t\tdma_sync_single_range_for_device(rx_ring->dev, bi->dma,\n \t\t\t\t\t\t bi->page_offset,\n-\t\t\t\t\t\t IXGBEVF_RX_BUFSZ,\n+\t\t\t\t\t\t ixgbevf_rx_bufsz(rx_ring),\n \t\t\t\t\t\t DMA_FROM_DEVICE);\n \n \t\t/* Refresh the desc even if pkt_addr didn't change\n@@ -750,13 +751,16 @@ static bool ixgbevf_can_reuse_rx_page(struct ixgbevf_rx_buffer *rx_buffer,\n \t\treturn false;\n \n \t/* flip page offset to other buffer */\n-\trx_buffer->page_offset ^= IXGBEVF_RX_BUFSZ;\n+\trx_buffer->page_offset ^= truesize;\n \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 > (PAGE_SIZE - IXGBEVF_RX_BUFSZ))\n+#define IXGBEVF_LAST_OFFSET \\\n+\t(SKB_WITH_OVERHEAD(PAGE_SIZE) - IXGBEVF_RXBUFFER_2048)\n+\n+\tif (rx_buffer->page_offset > IXGBEVF_LAST_OFFSET)\n \t\treturn false;\n \n #endif\n@@ -797,7 +801,7 @@ static bool ixgbevf_add_rx_frag(struct ixgbevf_ring *rx_ring,\n \tstruct page *page = rx_buffer->page;\n \tvoid *va = page_address(page) + rx_buffer->page_offset;\n #if (PAGE_SIZE < 8192)\n-\tunsigned int truesize = IXGBEVF_RX_BUFSZ;\n+\tunsigned int truesize = ixgbevf_rx_pg_size(rx_ring) / 2;\n #else\n \tunsigned int truesize = ALIGN(size, L1_CACHE_BYTES);\n #endif\n@@ -888,8 +892,8 @@ static struct sk_buff *ixgbevf_fetch_rx_buffer(struct ixgbevf_ring *rx_ring,\n \t\t * any references we are holding to it\n \t\t */\n \t\tdma_unmap_page_attrs(rx_ring->dev, rx_buffer->dma,\n-\t\t\t\t     PAGE_SIZE, DMA_FROM_DEVICE,\n-\t\t\t\t     IXGBEVF_RX_DMA_ATTR);\n+\t\t\t\t     ixgbevf_rx_pg_size(rx_ring),\n+\t\t\t\t     DMA_FROM_DEVICE, IXGBEVF_RX_DMA_ATTR);\n \t\t__page_frag_cache_drain(page, rx_buffer->pagecnt_bias);\n \t}\n \n@@ -1586,7 +1590,8 @@ static void ixgbevf_configure_tx(struct ixgbevf_adapter *adapter)\n \n #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT\t2\n \n-static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index)\n+static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter,\n+\t\t\t\t     struct ixgbevf_ring *ring, int index)\n {\n \tstruct ixgbe_hw *hw = &adapter->hw;\n \tu32 srrctl;\n@@ -1594,7 +1599,10 @@ static void ixgbevf_configure_srrctl(struct ixgbevf_adapter *adapter, int index)\n \tsrrctl = IXGBE_SRRCTL_DROP_EN;\n \n \tsrrctl |= IXGBEVF_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT;\n-\tsrrctl |= IXGBEVF_RX_BUFSZ >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;\n+\tif (ring_uses_large_buffer(ring))\n+\t\tsrrctl |= IXGBEVF_RXBUFFER_3072 >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;\n+\telse\n+\t\tsrrctl |= IXGBEVF_RXBUFFER_2048 >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;\n \tsrrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;\n \n \tIXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(index), srrctl);\n@@ -1766,7 +1774,7 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter,\n \tring->next_to_use = 0;\n \tring->next_to_alloc = 0;\n \n-\tixgbevf_configure_srrctl(adapter, reg_idx);\n+\tixgbevf_configure_srrctl(adapter, ring, reg_idx);\n \n \t/* allow any size packet since we can handle overflow */\n \trxdctl &= ~IXGBE_RXDCTL_RLPML_EN;\n@@ -1778,6 +1786,26 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter,\n \tixgbevf_alloc_rx_buffers(ring, ixgbevf_desc_unused(ring));\n }\n \n+static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter,\n+\t\t\t\t      struct ixgbevf_ring *rx_ring)\n+{\n+\tstruct net_device *netdev = adapter->netdev;\n+\tunsigned int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;\n+\n+\t/* set build_skb and buffer size flags */\n+\tclear_ring_uses_large_buffer(rx_ring);\n+\n+\tif (adapter->flags & IXGBEVF_FLAGS_LEGACY_RX)\n+\t\treturn;\n+\n+#if (PAGE_SIZE < 8192)\n+\tif (max_frame <= IXGBEVF_MAX_FRAME_BUILD_SKB)\n+\t\treturn;\n+\n+\tset_ring_uses_large_buffer(rx_ring);\n+#endif\n+}\n+\n /**\n  * ixgbevf_configure_rx - Configure 82599 VF Receive Unit after Reset\n  * @adapter: board private structure\n@@ -1805,8 +1833,12 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)\n \t/* Setup the HW Rx Head and Tail Descriptor Pointers and\n \t * the Base and Length of the Rx Descriptor Ring\n \t */\n-\tfor (i = 0; i < adapter->num_rx_queues; i++)\n-\t\tixgbevf_configure_rx_ring(adapter, adapter->rx_ring[i]);\n+\tfor (i = 0; i < adapter->num_rx_queues; i++) {\n+\t\tstruct ixgbevf_ring *rx_ring = adapter->rx_ring[i];\n+\n+\t\tixgbevf_set_rx_buffer_len(adapter, rx_ring);\n+\t\tixgbevf_configure_rx_ring(adapter, rx_ring);\n+\t}\n }\n \n static int ixgbevf_vlan_rx_add_vid(struct net_device *netdev,\n@@ -2135,13 +2167,13 @@ static void ixgbevf_clean_rx_ring(struct ixgbevf_ring *rx_ring)\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      IXGBEVF_RX_BUFSZ,\n+\t\t\t\t\t      ixgbevf_rx_bufsz(rx_ring),\n \t\t\t\t\t      DMA_FROM_DEVICE);\n \n \t\t/* free resources associated with mapping */\n \t\tdma_unmap_page_attrs(rx_ring->dev,\n \t\t\t\t     rx_buffer->dma,\n-\t\t\t\t     PAGE_SIZE,\n+\t\t\t\t     ixgbevf_rx_pg_size(rx_ring),\n \t\t\t\t     DMA_FROM_DEVICE,\n \t\t\t\t     IXGBEVF_RX_DMA_ATTR);\n \n",
    "prefixes": [
        "3/9"
    ]
}