From patchwork Fri Jan 6 16:10:49 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: 711989 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 3tw8fk3z7Mz9t0X for ; Sat, 7 Jan 2017 03:10:54 +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="kYoYCwBQ"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 189638303D; Fri, 6 Jan 2017 16:10:53 +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 hpoD-1T-hgU9; Fri, 6 Jan 2017 16:10:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 4DC5D81E96; Fri, 6 Jan 2017 16:10:52 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 349BE1C21AA for ; Fri, 6 Jan 2017 16:10:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 30F2689423 for ; Fri, 6 Jan 2017 16:10:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7FZMgKJffWkT for ; Fri, 6 Jan 2017 16:10:50 +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 hemlock.osuosl.org (Postfix) with ESMTPS id 98C68893F5 for ; Fri, 6 Jan 2017 16:10:50 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id b1so44405891pgc.1 for ; Fri, 06 Jan 2017 08:10:50 -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=laph1qkNuuG1KcVvxIHBFg2xpfgOHR0UAfjC0cgRh9Y=; b=kYoYCwBQVFCEr8936S/I9+L320anxNQozDZq5ZFspFxosfYuoeQIce/+QVuUADhuCS bTbdTJ1Wf8TT0/S/ATyQ4etopLU0EFtV5NatGdJLj0WQ4Lm7fxv+slZt1r74osL/aYjF cJwnm3XBrVQhjGCqJoQzdncb0TbQm6XE0O8wBNf5BhH4jtxsAFQyaTmq/pX8qHG2UtH7 b1sx2gJApQK4/XdbwLjYFadTANdvfrFrTg3uVL+YmOieCEuuOR8g+fwc2AVkh2NOxhLU hoN/+ultZ5ztooMvGfDXTUKRpjStQDGwd3CKnXWNJ0V4LuFjZMNoioIWyXi8TlxO+cjO Up6Q== 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=laph1qkNuuG1KcVvxIHBFg2xpfgOHR0UAfjC0cgRh9Y=; b=Yt9sMI83msJBAZfZmCLtvy1ucmE1f1/exI2lJTthFFFUPYqBtVVYxuVf80PsX2tane CO5eoypPu0LlibL36atQStWD/MavxylRPkYuKM2wJDtaPiF8IEAhPTZP55DrWZHs8Uzx UYqYa07KoyfzjSoIIbSFRi5/5pLKkU+uOzVNPVqhHkWdr5K190acZ88C4szekCXTwez6 QJ5xwxy7a0VqwHFHybTetsXk3S3AcKi/STsGqUqwkW1mCpKZn7TuW1lyVxSRsxGvOdsY YYLODJFn8A6PPgFad+82WbrzBmzge+Jvme3jgZPyVroK/eFcPTc/RKDgpqi0+d+qQr40 Mfrg== X-Gm-Message-State: AIkVDXLcqVj/52kI/XmVnohKcjXm+LxHl0QWJCp09thn/nexgL4JePrKY9tkJZNuuNji+Q== X-Received: by 10.99.63.74 with SMTP id m71mr139547039pga.16.1483719050110; Fri, 06 Jan 2017 08:10:50 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id o77sm15443700pfk.7.2017.01.06.08.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 08:10:49 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com Date: Fri, 06 Jan 2017 08:10:49 -0800 Message-ID: <20170106161049.2030.71315.stgit@localhost.localdomain> In-Reply-To: <20170106160850.2030.39073.stgit@localhost.localdomain> References: <20170106160850.2030.39073.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [next PATCH 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 --- drivers/net/ethernet/intel/igb/igb_main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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);