From patchwork Tue Jan 17 16:31:48 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: 716299 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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v2wk24GF1z9ryk for ; Wed, 18 Jan 2017 03:37:14 +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="RXyFMpiw"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0E5A688B02; Tue, 17 Jan 2017 16:37:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e5M2Q15RF1Bv; Tue, 17 Jan 2017 16:37:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 890B788BB3; Tue, 17 Jan 2017 16:37:09 +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 E1FBD1C0306 for ; Tue, 17 Jan 2017 16:37:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id DFD0F30234 for ; Tue, 17 Jan 2017 16:37:08 +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 sgiNGu6oUcO3 for ; Tue, 17 Jan 2017 16:37:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by silver.osuosl.org (Postfix) with ESMTPS id 36798302AC for ; Tue, 17 Jan 2017 16:37:08 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id 75so8414601pgf.3 for ; Tue, 17 Jan 2017 08:37:08 -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=YF8QNKy9QKui0AYvdEvDeD3NA2GpuXbgcnkOjW46jVI=; b=RXyFMpiw6gWOXn9K7ET/H8JwAvfvZ3BjEYWXQsYM1tSH5Wy28EVCsH4P2Ktb8X5y4C 2LfI0KcdZzGePZVIDRK4jJG/W84G+Kz8sVCcBq0m+UchKVdT5VjNDKdLgKjbEyqnW6PK kbwP7Lx/CkjbhG/C98Q2dyjQAQWelP/B06k41ZK4VupM0Sn7moFVMEdbDs68Ub11s03o sPILdUPHtG1VAbFhShW0Cm5Bv/ZWXRVCQ+2XVQNQ8EadvSnWOsMnatNWk/9BXbMR+A19 fz8qX7G+5qiDChyt0YGiQuFiGME5E8kGDgvGTQzdpgghn5NIpWkm/EopzzQao4fIshXl kVuA== 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=YF8QNKy9QKui0AYvdEvDeD3NA2GpuXbgcnkOjW46jVI=; b=sJ1qSROZQKVKXjuf8SMgKMjAKiB4c4v7NtKpQbk5dYHKh6mrZueOfhcE7u0aTKZ0/h 3K3kqHlh1PXcln76WOHY9c9O3YxXkGPH1xHKE9wt4xd3T+NGyDGRgni5YM34JoW+gtov fBJ3ou7Df5IyrDQRSCWwkhh5HYBGTW8813Z/XnffWU1Wcg3CXgkx4QEPXdeu5leL2SWI 7EmVmCIdSpabhZWNIJJWZYjKRdKqu5kIAjfhE7W5lV7oAIfUdLH1LFgWUZmPKyCFP6kO a6zWUNTPyUjoqtUjI6ULYBMxgQ4bM4raWW1YDyd6OvgeygPDICck3SR9cp2U/rxP8vsf LC/Q== X-Gm-Message-State: AIkVDXIphJHLDsePL8Ib7mNkfLNHhN4T9RyN0jpMjMolx+MPs2MGOnjHZeZ81+zPQZmrZA== X-Received: by 10.98.12.77 with SMTP id u74mr44419848pfi.116.1484670709597; Tue, 17 Jan 2017 08:31:49 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id p64sm56965436pfi.88.2017.01.17.08.31.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 08:31:49 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com Date: Tue, 17 Jan 2017 08:31:48 -0800 Message-ID: <20170117163137.5184.23469.stgit@localhost.localdomain> In-Reply-To: <20170117163010.5184.65449.stgit@localhost.localdomain> References: <20170117163010.5184.65449.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [next PATCH v2 2/9] igb: Use length to determine if descriptor is done 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 This change makes it so that we use the length of the packet instead of the DD status bit to determine if a new descriptor is ready to be processed. The obvious advantage is that it cuts down on reads as we don't really even need the DD bit if going from a 0 to a non-zero value on size is enough to inform us that the packet has been completed. In addition I have updated the code so that we only reset the Rx descriptor length for descriptor zero when resetting a ring instead of having to do a memset with 0 over the entire ring. By doing this we can save some time on initialization. Signed-off-by: Alexander Duyck --- v2: Update ethtool loopback test to use length check instead of DD check drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- drivers/net/ethernet/intel/igb/igb_main.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 737b664d004c..3f5f7744c90f 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -1811,7 +1811,7 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring, tx_ntc = tx_ring->next_to_clean; rx_desc = IGB_RX_DESC(rx_ring, rx_ntc); - while (igb_test_staterr(rx_desc, E1000_RXD_STAT_DD)) { + while (rx_desc->wb.upper.length) { /* check Rx buffer */ rx_buffer_info = &rx_ring->rx_buffer_info[rx_ntc]; diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index eede6db6037c..91a524b155ce 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3720,6 +3720,7 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, struct igb_ring *ring) { struct e1000_hw *hw = &adapter->hw; + union e1000_adv_rx_desc *rx_desc; u64 rdba = ring->dma; int reg_idx = ring->reg_idx; u32 srrctl = 0, rxdctl = 0; @@ -3758,6 +3759,10 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, rxdctl |= IGB_RX_HTHRESH << 8; rxdctl |= IGB_RX_WTHRESH << 16; + /* initialize Rx descriptor 0 */ + rx_desc = IGB_RX_DESC(ring, 0); + rx_desc->wb.upper.length = 0; + /* enable receive descriptor fetching */ rxdctl |= E1000_RXDCTL_QUEUE_ENABLE; wr32(E1000_RXDCTL(reg_idx), rxdctl); @@ -3973,9 +3978,6 @@ static void igb_clean_rx_ring(struct igb_ring *rx_ring) size = sizeof(struct igb_rx_buffer) * rx_ring->count; memset(rx_ring->rx_buffer_info, 0, size); - /* Zero out the descriptor ring */ - memset(rx_ring->desc, 0, rx_ring->size); - rx_ring->next_to_alloc = 0; rx_ring->next_to_clean = 0; rx_ring->next_to_use = 0; @@ -7174,7 +7176,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) rx_desc = IGB_RX_DESC(rx_ring, rx_ring->next_to_clean); - if (!rx_desc->wb.upper.status_error) + if (!rx_desc->wb.upper.length) break; /* This memory barrier is needed to keep us from reading @@ -7314,8 +7316,8 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count) i -= rx_ring->count; } - /* clear the status bits for the next_to_use descriptor */ - rx_desc->wb.upper.status_error = 0; + /* clear the length for the next_to_use descriptor */ + rx_desc->wb.upper.length = 0; cleaned_count--; } while (cleaned_count);