From patchwork Wed Dec 23 20:36:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Guedes X-Patchwork-Id: 1420292 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D1Q4r2X98z9sWP for ; Thu, 24 Dec 2020 07:37:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2C5DA2E100; Wed, 23 Dec 2020 20:37:46 +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 lxbssrG4AMl6; Wed, 23 Dec 2020 20:37:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 6FEB72E102; Wed, 23 Dec 2020 20:37:44 +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 AC9FB1BF86B for ; Wed, 23 Dec 2020 20:37:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A949D87370 for ; Wed, 23 Dec 2020 20:37:40 +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 o-78x-NV-0dW for ; Wed, 23 Dec 2020 20:37:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by hemlock.osuosl.org (Postfix) with ESMTPS id BDF4587346 for ; Wed, 23 Dec 2020 20:37:36 +0000 (UTC) IronPort-SDR: oWjJ+iYYzaPCgCnIu2f9Ufa7zl72yfbFKA61Jxavnb52gfJiuD2WDWIn4GxgUeYHn4vSUfa9Ua n/R+xqLMLlJw== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="155861769" X-IronPort-AV: E=Sophos;i="5.78,442,1599548400"; d="scan'208";a="155861769" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 12:37:35 -0800 IronPort-SDR: VfJqpjHyNsd+PcViD4D+ShLeEzUfnsbNgD/6ThSVZLyUrReBCIlmbet1Mb0orTFO4eJy5vRFm9 yKEvobIh2c2g== X-IronPort-AV: E=Sophos;i="5.78,442,1599548400"; d="scan'208";a="345202988" Received: from eburton-mobl.amr.corp.intel.com ([10.209.148.11]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 12:37:34 -0800 From: Andre Guedes To: intel-wired-lan@lists.osuosl.org Date: Wed, 23 Dec 2020 12:36:59 -0800 Message-Id: <20201223203705.78705-4-andre.guedes@intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223203705.78705-1-andre.guedes@intel.com> References: <20201223203705.78705-1-andre.guedes@intel.com> MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH v2 3/9] igc: Refactor igc_clean_rx_ring() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 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@osuosl.org Sender: "Intel-wired-lan" Refactor igc_clean_rx_ring() helper, preparing the code for AF_XDP zero-copy support which is added by upcoming patches. The refactor consists of encapsulating page-shared specific code into its own helper, leaving common code that will be shared by both page-shared and xsk pool in igc_clean_rx_ring(). Signed-off-by: Andre Guedes --- drivers/net/ethernet/intel/igc/igc_main.c | 25 ++++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 56b791b356dc..d591c1e0581f 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -346,16 +346,10 @@ static int igc_setup_all_tx_resources(struct igc_adapter *adapter) return err; } -/** - * igc_clean_rx_ring - Free Rx Buffers per Queue - * @rx_ring: ring to free buffers from - */ -static void igc_clean_rx_ring(struct igc_ring *rx_ring) +static void igc_clean_rx_ring_page_shared(struct igc_ring *rx_ring) { u16 i = rx_ring->next_to_clean; - clear_ring_uses_large_buffer(rx_ring); - dev_kfree_skb(rx_ring->skb); rx_ring->skb = NULL; @@ -385,10 +379,21 @@ static void igc_clean_rx_ring(struct igc_ring *rx_ring) if (i == rx_ring->count) i = 0; } +} - rx_ring->next_to_alloc = 0; - rx_ring->next_to_clean = 0; - rx_ring->next_to_use = 0; +/** + * igc_clean_rx_ring - Free Rx Buffers per Queue + * @ring: ring to free buffers from + */ +static void igc_clean_rx_ring(struct igc_ring *ring) +{ + clear_ring_uses_large_buffer(ring); + + igc_clean_rx_ring_page_shared(ring); + + ring->next_to_alloc = 0; + ring->next_to_clean = 0; + ring->next_to_use = 0; } /**