From patchwork Tue Jan 17 16:35:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 716293 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v2whg6jGRz9ssP for ; Wed, 18 Jan 2017 03:35:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="buC7+q5c"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 19D4588FC2; Tue, 17 Jan 2017 16:35:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9F5BCbUNy3ls; Tue, 17 Jan 2017 16:35:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 63D7988ED4; Tue, 17 Jan 2017 16:35:56 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id F3A311C0306 for ; Tue, 17 Jan 2017 16:35:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id EC74A1FCFE for ; Tue, 17 Jan 2017 16:35:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mRqTlswgpfce for ; Tue, 17 Jan 2017 16:35:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by silver.osuosl.org (Postfix) with ESMTPS id D3FC22546F for ; Tue, 17 Jan 2017 16:35:46 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id y143so16587628pfb.1 for ; Tue, 17 Jan 2017 08:35:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=MTwG/7VJa7/jWmWbOUoT33r60HolBcio0/a/+mS5Zac=; b=buC7+q5cmOpfyk/nDofPkXuew054jIMZIxRUL6FHB0yUrUzQXJ5h+/w8EEuBvahV9p jnXEu0gEM3IXx9LvJ3BnCuu7WHwgY+qNGxZA/JtKpdkQJtFCWQ9WhDfPJr946dodB8ij +Ose8RJEo7N1tHBT5hziHs4BT3bQpWWlxsyvAWSaQ22mYUN/0Zv+1XiS5XhGl58FOJWp SRVieTmy0VWdTnqPlqKe29vBO/t/ZlOAsjIjjgoQecDvJ72PurKN0vHcGqJLwrHsNvlP 8u+4VuY3bcfgSxmIb/WKSkJQ4kIdSyy/JtPrQ0pg2nhG00RgJX3XnZa/yV4Rv9paievs uFMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=MTwG/7VJa7/jWmWbOUoT33r60HolBcio0/a/+mS5Zac=; b=t7JhEUBGcrxn87XR++qhcxl228s/Qge2Hxftqe9760QiyTpd6whiKCKsxeROMFHQJa h+zHNTIxWAA0sYhB5sFPfqIRf3hdMfZ2gGjj5CmJuM41Y/9O0nRb4YsQUNEd85gehhek Hrt1kRQy44yMu6EUeNtsL4cdmLuOtkdksGL2gfHEL6BpIDGnRH+DW4wYluljUW5rF3vv zRkTvtxd8pFiyB2mhXIDmpAGTGUDx+NoZd29Tf8ixHKDqCWxx190naylhcg/xUZW9et6 nf5/XF2llDY0AeVStmK4a2ljBzFkkajwLrhfnmQIa/oMNk063l860kk2REeNNFsqvYNH lrYg== X-Gm-Message-State: AIkVDXIuwgzkpi8KZhNLERx3mX7aeMoOFn0wJKUniliR5cEsBDmtP489J+eVvF2eABW5YQ== X-Received: by 10.84.128.34 with SMTP id 31mr46021346pla.17.1484670945951; Tue, 17 Jan 2017 08:35:45 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id b69sm47822954pfd.90.2017.01.17.08.35.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 08:35:45 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com Date: Tue, 17 Jan 2017 08:35:44 -0800 Message-ID: <20170117163540.5423.43007.stgit@localhost.localdomain> In-Reply-To: <20170117163401.5423.37993.stgit@localhost.localdomain> References: <20170117163401.5423.37993.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [next PATCH v2 02/11] ixgbe: Only DMA sync frame length 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" From: Alexander Duyck On some platforms, syncing a buffer for DMA is expensive. Rather than sync the whole 2K receive buffer, only synchronise the length of the frame, which will typically be the MTU, or a much smaller TCP ACK. Signed-off-by: Alexander Duyck Tested-by: Andrew Bowers --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 452a407013ef..cfc097d07661 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1858,7 +1858,7 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring, dma_sync_single_range_for_cpu(rx_ring->dev, IXGBE_CB(skb)->dma, frag->page_offset, - ixgbe_rx_bufsz(rx_ring), + skb_frag_size(frag), DMA_FROM_DEVICE); } IXGBE_CB(skb)->dma = 0; @@ -2000,12 +2000,11 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_ring *rx_ring, **/ static bool ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring, struct ixgbe_rx_buffer *rx_buffer, - union ixgbe_adv_rx_desc *rx_desc, + unsigned int size, struct sk_buff *skb) { struct page *page = rx_buffer->page; unsigned char *va = page_address(page) + rx_buffer->page_offset; - unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); #if (PAGE_SIZE < 8192) unsigned int truesize = ixgbe_rx_bufsz(rx_ring); #else @@ -2037,6 +2036,7 @@ static bool ixgbe_add_rx_frag(struct ixgbe_ring *rx_ring, static struct sk_buff *ixgbe_fetch_rx_buffer(struct ixgbe_ring *rx_ring, union ixgbe_adv_rx_desc *rx_desc) { + unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); struct ixgbe_rx_buffer *rx_buffer; struct sk_buff *skb; struct page *page; @@ -2091,14 +2091,14 @@ static struct sk_buff *ixgbe_fetch_rx_buffer(struct ixgbe_ring *rx_ring, dma_sync_single_range_for_cpu(rx_ring->dev, rx_buffer->dma, rx_buffer->page_offset, - ixgbe_rx_bufsz(rx_ring), + size, DMA_FROM_DEVICE); rx_buffer->skb = NULL; } /* pull page into skb */ - if (ixgbe_add_rx_frag(rx_ring, rx_buffer, rx_desc, skb)) { + if (ixgbe_add_rx_frag(rx_ring, rx_buffer, size, skb)) { /* hand second half of page back to the ring */ ixgbe_reuse_rx_page(rx_ring, rx_buffer); } else if (IXGBE_CB(skb)->dma == rx_buffer->dma) {