From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D327FC433EF for ; Tue, 28 Jun 2022 13:43:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 76B9041736; Tue, 28 Jun 2022 13:43:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 76B9041736 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1656423831; bh=Uyp1hxZtSfcmKbSqbYdQd7391GpLuJtSCIPNveWv9SE=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=Sz6zbTQzsNPY4wLM10+ELs+oMWtSDoRPZC4QzWJsDql7AvUKc/eWyj53Df0GStaDn yo9y3tyOJ/EoNiGhBwV+b6MkiKWLATzEajponzTM3zdaXwk5K6k5gZzMreTeQhQ8f6 MOEn5Bz3kljVuggk5z8zHRiSUCKDcPD0qDZRKh9wzToE+ZviuHrhY5Q9rBzn5P/1IP sNrVNp6UqOv8MsN4xlBs7kCxbwugBQamQkL8ATlcs1YmSY96T2aFJamEWxo1L+BImI b19u+Mw392gwgASLSqSv8WK+JUtp9E1W6h1dAn8+S6WgcOOHso7dSMrkTuM75msJ2Q 1AQtBWkJu74rA== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZKAgi2qDdcPY; Tue, 28 Jun 2022 13:43:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 32C7F41739; Tue, 28 Jun 2022 13:43:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 32C7F41739 Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 833181BF28B for ; Tue, 28 Jun 2022 13:43:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 687BA40C33 for ; Tue, 28 Jun 2022 13:43:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 687BA40C33 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Yx_JS0fOkp2 for ; Tue, 28 Jun 2022 13:43:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AD9E840C1A Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by smtp2.osuosl.org (Postfix) with ESMTPS id AD9E840C1A for ; Tue, 28 Jun 2022 13:43:47 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="270502094" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="270502094" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2022 06:43:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="617187232" Received: from amlin-018-068.igk.intel.com (HELO localhost.igk.intel.com) ([10.102.18.68]) by orsmga008.jf.intel.com with ESMTP; 28 Jun 2022 06:43:42 -0700 From: "Palczewski, Mateusz" To: intel-wired-lan@lists.osuosl.org Date: Tue, 28 Jun 2022 15:43:30 +0200 Message-Id: <20220628134330.706304-1-mateusz.palczewski@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656423827; x=1687959827; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cxqAE3O1U/0kh0ZQMgWNrTFDLESaynyFruADGLyqRlQ=; b=ACxzcdSwQ9b595TNoIwH1mwU+MFstkcKzJ+y3sLmErWd7wjNlaJPtCGn rinm6CCSK1Elozr/vJ2Ts0yUlFnxQPsEhqKP+T53RtThZPsyPBAtirOvb Dn0WRY5VXueU4eYHmHuMVuJQQlBQJz8KTb9qISCjPkwRBgAQrL9CDYHFA Ff6m2+9ftblCwXv4fUrLGOk7fv0mjdARZOfLQ5NZuZw5GW2L108H8XShe 5mQwwpI/65p5NwAMzUrDhHIpiK/vUeumCKbOh/VbM79+aoiI3S0OrF9GP CtMETokE1/z/jKwA4+pfFK0XJXtY96AyA8tW0nj98sAtg0swsmObBhU9q w==; X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ACxzcdSw Subject: [Intel-wired-lan] [PATCH net v2 3/3] iavf: Fix adminq error handling 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: , Cc: Przemyslaw Patynowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Przemyslaw Patynowski iavf_alloc_asq_bufs/iavf_alloc_arq_bufs allocates with dma_alloc_coherent memory for VF mailbox. Free DMA regions for both ASQ and ARQ in case error happens during configuration of ASQ/ARQ registers. Without this change it is possible to see when unloading interface: 74626.583369: dma_debug_device_change: device driver has pending DMA allocations while released from device [count=32] One of leaked entries details: [device address=0x0000000b27ff9000] [size=4096 bytes] [mapped with DMA_BIDIRECTIONAL] [mapped as coherent] Fixes: d358aa9a7a2d ("i40evf: init code and hardware support") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Mateusz Palczewski --- v2: Add comment to make code more understandable --- drivers/net/ethernet/intel/iavf/iavf_adminq.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq.c b/drivers/net/ethernet/intel/iavf/iavf_adminq.c index cd4e6a22d0f9..9ffbd24d83cb 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_adminq.c +++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.c @@ -324,6 +324,7 @@ static enum iavf_status iavf_config_arq_regs(struct iavf_hw *hw) static enum iavf_status iavf_init_asq(struct iavf_hw *hw) { enum iavf_status ret_code = 0; + int i; if (hw->aq.asq.count > 0) { /* queue already initialized */ @@ -354,12 +355,17 @@ static enum iavf_status iavf_init_asq(struct iavf_hw *hw) /* initialize base registers */ ret_code = iavf_config_asq_regs(hw); if (ret_code) - goto init_adminq_free_rings; + goto init_free_asq_bufs; /* success! */ hw->aq.asq.count = hw->aq.num_asq_entries; goto init_adminq_exit; +init_free_asq_bufs: + for (i = 0; i < hw->aq.num_asq_entries; i++) + iavf_free_dma_mem(hw, &hw->aq.asq.r.asq_bi[i]); + iavf_free_virt_mem(hw, &hw->aq.asq.dma_head); + init_adminq_free_rings: iavf_free_adminq_asq(hw); @@ -383,6 +389,7 @@ static enum iavf_status iavf_init_asq(struct iavf_hw *hw) static enum iavf_status iavf_init_arq(struct iavf_hw *hw) { enum iavf_status ret_code = 0; + int i; if (hw->aq.arq.count > 0) { /* queue already initialized */ @@ -413,12 +420,16 @@ static enum iavf_status iavf_init_arq(struct iavf_hw *hw) /* initialize base registers */ ret_code = iavf_config_arq_regs(hw); if (ret_code) - goto init_adminq_free_rings; + goto init_free_arq_bufs; /* success! */ hw->aq.arq.count = hw->aq.num_arq_entries; goto init_adminq_exit; +init_free_arq_bufs: + for (i = 0; i < hw->aq.num_arq_entries; i++) + iavf_free_dma_mem(hw, &hw->aq.arq.r.arq_bi[i]); + iavf_free_virt_mem(hw, &hw->aq.arq.dma_head); init_adminq_free_rings: iavf_free_adminq_arq(hw); -- 2.27.0 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan