From patchwork Tue Feb 7 02:25:50 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: 724864 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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vHSr36RYyz9s2P for ; Tue, 7 Feb 2017 13:25:55 +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="gxuq8QlU"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6BB4630353; Tue, 7 Feb 2017 02:25:54 +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 i8aIGGaeuaPW; Tue, 7 Feb 2017 02:25:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5924830A47; Tue, 7 Feb 2017 02:25:53 +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 6851D1BFEC6 for ; Tue, 7 Feb 2017 02:25:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 628B08A401 for ; Tue, 7 Feb 2017 02:25:52 +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 yy8J-lBXt9pd for ; Tue, 7 Feb 2017 02:25:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by hemlock.osuosl.org (Postfix) with ESMTPS id CC22F8A3FA for ; Tue, 7 Feb 2017 02:25:51 +0000 (UTC) Received: by mail-pg0-f67.google.com with SMTP id 194so10628206pgd.0 for ; Mon, 06 Feb 2017 18:25:51 -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=kETiHkleDHXW3zGctwYe5tEim4H1XXzFv9I37SEWTKs=; b=gxuq8QlUnzrU/VkBZxrGFbcGMynEtKBwdlBg4wIFcHq8R9/2Y3PtX/nMZDnFg6NApI 7pcoi9tIprKnrv481LyaHIeweHqK1zk7TuAOrbN2jSBxxxh5j2cjhHZ761cAD8rF6cpW n/N38r+ybRsQ7TMxSQ/HQTrd3Ev8HTsrcU6p9YSVNF8Wg/p+abXioAz0IGWx4fQCeRYt u39T+zHqCPXkAsKC//FTj2nY72KeYfeEnYF0GIP8ZG9neeU5GXgowbXCGfCI2zxR/SXz KsvlhC67tz4rimObEG1IDD7ojD9MQfrgtonne4jiOpwRM8UI/ZERmCuvbGRt/gCzpQmn c+sw== 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=kETiHkleDHXW3zGctwYe5tEim4H1XXzFv9I37SEWTKs=; b=MIp2RSsmlRUe8hWd0WrC095bgNhPwiV9FaiowPWN0OJIi7g5KfVfHYoLl/Lu17KrBJ CHC+dLKg3a28xo1wrVbqrBdrLp/lPHTjhu4EkxWu6WVsmc9cZHNGgq723KZ+Tvr5Zn32 kgCZmXzFAJGP80BCbgdGhdI3xRuqo1xjsyqWRKYMKn6HtDjm06tvbpjlIU7RLjYcmGS1 F1RPGQDc/zQA/tHttNGmR8qEiS8TdMyk0WI4kI4FiqOoh/OuFvulZzm712PckBQcfiAK t/FJ6gw7HcsBLr+VxABIOthHj3NvzUWWBxL+6l6rsurijN4NCckMZNFyS8Q300zm3gOt WeZw== X-Gm-Message-State: AIkVDXIx25/dpzckaiWZeNDBueOhiGS7jTWBt0RdlZWTiAufPOSqdkgY6LjA1NKdjIJ+qQ== X-Received: by 10.84.139.195 with SMTP id 61mr22119331plr.116.1486434351464; Mon, 06 Feb 2017 18:25:51 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id z70sm5809937pff.26.2017.02.06.18.25.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 18:25:51 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com Date: Mon, 06 Feb 2017 18:25:50 -0800 Message-ID: <20170207022547.9864.60500.stgit@localhost.localdomain> In-Reply-To: <20170207022339.9864.87863.stgit@localhost.localdomain> References: <20170207022339.9864.87863.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [next PATCH v5 03/12] igb: Clear Rx buffer_info in configure instead of clean 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 instead of going through the entire ring on Rx cleanup we only go through the region that was designated to be cleaned up and stop when we reach the region where new allocations should start. In addition we can avoid having to perform a memset on the Rx buffer_info structures until we are about to start using the ring again. By deferring this we can avoid dirtying the cache any more than we have to which can help to improve the time needed to bring the interface down and then back up again in a reset or suspend/resume cycle. Signed-off-by: Alexander Duyck Tested-by: Aaron Brown --- drivers/net/ethernet/intel/igb/igb_main.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 91a524b155ce..79a8f3a3356e 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3435,7 +3435,7 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) size = sizeof(struct igb_rx_buffer) * rx_ring->count; - rx_ring->rx_buffer_info = vzalloc(size); + rx_ring->rx_buffer_info = vmalloc(size); if (!rx_ring->rx_buffer_info) goto err; @@ -3759,6 +3759,10 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, rxdctl |= IGB_RX_HTHRESH << 8; rxdctl |= IGB_RX_WTHRESH << 16; + /* initialize rx_buffer_info */ + memset(ring->rx_buffer_info, 0, + sizeof(struct igb_rx_buffer) * ring->count); + /* initialize Rx descriptor 0 */ rx_desc = IGB_RX_DESC(ring, 0); rx_desc->wb.upper.length = 0; @@ -3937,23 +3941,16 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter) **/ static void igb_clean_rx_ring(struct igb_ring *rx_ring) { - unsigned long size; - u16 i; + u16 i = rx_ring->next_to_clean; if (rx_ring->skb) dev_kfree_skb(rx_ring->skb); rx_ring->skb = NULL; - if (!rx_ring->rx_buffer_info) - return; - /* Free all the Rx ring sk_buffs */ - for (i = 0; i < rx_ring->count; i++) { + while (i != rx_ring->next_to_alloc) { struct igb_rx_buffer *buffer_info = &rx_ring->rx_buffer_info[i]; - if (!buffer_info->page) - continue; - /* Invalidate cache lines that may have been written to by * device so that we avoid corrupting memory. */ @@ -3972,12 +3969,11 @@ static void igb_clean_rx_ring(struct igb_ring *rx_ring) __page_frag_cache_drain(buffer_info->page, buffer_info->pagecnt_bias); - buffer_info->page = NULL; + i++; + if (i == rx_ring->count) + i = 0; } - size = sizeof(struct igb_rx_buffer) * rx_ring->count; - memset(rx_ring->rx_buffer_info, 0, size); - rx_ring->next_to_alloc = 0; rx_ring->next_to_clean = 0; rx_ring->next_to_use = 0;