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 smtp3.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 smtp.lore.kernel.org (Postfix) with ESMTPS id EE580EE4996 for ; Tue, 22 Aug 2023 12:41:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9C120611B5; Tue, 22 Aug 2023 12:41:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9C120611B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1692708103; bh=xk2lINUJ2xGk6fEzBnbYfgE5iemYk7lhW6gn+H92HTY=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=6EUbbIyWQ2P9PzxUWQwvM6xOEfbZEGKXdadZkZHK59T6EXkigO4cEGh8ObjKWZS+D qoFjadsnh8Rcu1f5FNeCVRMlD6O/+LJxSpJ1MyeZWiEQ4+0WDdigQhbvCOkS3te/uE 0TAg60vWyLT/N8G79+rndUIIbRdNDtwi88+V111CnR+ixXGV3EUWQySlXfGYNpHdR/ bumYudCMpaFvJyZMh2MwjRzonZ2zxix7eH3jTDhw2caydHupv1LxLKTJJBg0FykS+2 jyxgotDjRJLobBAnzjiNcDXUZrBtXuq3ImyDJyUgyoa3e4OzU9HMCHK9JMdEFkjCxi Yl9IXEQXMQ6Kg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eJYaoJ_8SQ5x; Tue, 22 Aug 2023 12:41:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id A2AC9611D2; Tue, 22 Aug 2023 12:41:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A2AC9611D2 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id E87DA1BF296 for ; Tue, 22 Aug 2023 12:41:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C17FE605EC for ; Tue, 22 Aug 2023 12:41:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C17FE605EC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EXFl-JBJNmqH for ; Tue, 22 Aug 2023 12:41:18 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by smtp3.osuosl.org (Postfix) with ESMTPS id 13B9360A91 for ; Tue, 22 Aug 2023 12:41:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 13B9360A91 X-IronPort-AV: E=McAfee;i="6600,9927,10809"; a="376604654" X-IronPort-AV: E=Sophos;i="6.01,193,1684825200"; d="scan'208";a="376604654" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2023 05:41:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10809"; a="771342982" X-IronPort-AV: E=Sophos;i="6.01,193,1684825200"; d="scan'208";a="771342982" Received: from kkolacin-desk1.igk.intel.com ([10.102.102.152]) by orsmga001.jf.intel.com with ESMTP; 22 Aug 2023 05:41:15 -0700 From: Karol Kolacinski To: intel-wired-lan@lists.osuosl.org Date: Tue, 22 Aug 2023 14:40:44 +0200 Message-Id: <20230822124044.301654-10-karol.kolacinski@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230822124044.301654-1-karol.kolacinski@intel.com> References: <20230822124044.301654-1-karol.kolacinski@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 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=1692708078; x=1724244078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nALQDjsAlhoRh/Kh6FVQIIifz0q70NovGLmQUl5KAsI=; b=cA+SqnGJ3mN0NFAysc2RlCaW60T3F1DHaukAjar6eBu0Ujkszb8cuZVY 31L8Thtl67lRiy1mhN2uELz7mzlOTE/LQpJ8QmybyPrxOw8TV+viou6jb /ZrTs+qtvrx4acED1rQZKV1abYBCdiHWG7VOUvpyx5nq71GsGN3FIePPU CEAewdBO9BINamF7b0IgnO6u6fhob+eaANvS7sQgcE3+naLj6qmLvZI3o /e+OlG2YDksYAdcBRg2vp7268ZahmcXPWGROMM5ft1cwWb6JhbiB4x0lI 0Vx4N5ye7lbDzLLdIHlhxtgRzOr6XD0qI5bBW2DCE+sjfAx7ge85vw+oU w==; X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=cA+SqnGJ Subject: [Intel-wired-lan] [PATCH v3 iwl-next 9/9] ice: stop destroying and reinitalizing Tx tracker during reset 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: netdev@vger.kernel.org, Karol Kolacinski , anthony.l.nguyen@intel.com, jesse.brandeburg@intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Jacob Keller The ice driver currently attempts to destroy and re-initialize the Tx timestamp tracker during the reset flow. The release of the Tx tracker only happened during CORE reset or GLOBAL reset. The ice_ptp_rebuild() function always calls the ice_ptp_init_tx function which will allocate a new tracker data structure, resulting in memory leaks during PF reset. Certainly the driver should not be allocating a new tracker without removing the old tracker data, as this results in a memory leak. Additionally, there's no reason to remove the tracker memory during a reset. Remove this logic from the reset and rebuild flow. Instead of releasing the Tx tracker, flush outstanding timestamps just before we reset the PHY timestamp block in ice_ptp_cfg_phy_interrupt(). Signed-off-by: Jacob Keller Signed-off-by: Karol Kolacinski --- drivers/net/ethernet/intel/ice/ice_ptp.c | 33 +++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 8f783004f4a9..5c8f3dda64b9 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -868,6 +868,22 @@ ice_ptp_mark_tx_tracker_stale(struct ice_ptp_tx *tx) spin_unlock(&tx->lock); } +/** + * ice_ptp_flush_all_tx_tracker - Flush all timestamp trackers on this clock + * @pf: Board private structure + * + * Called by the clock owner to flush all the Tx timestamp trackers associated + * with the clock. + */ +static void +ice_ptp_flush_all_tx_tracker(struct ice_pf *pf) +{ + struct ice_ptp_port *port; + + list_for_each_entry(port, &pf->ptp.ports_owner.ports, list_member) + ice_ptp_flush_tx_tracker(ptp_port_to_pf(port), &port->tx); +} + /** * ice_ptp_release_tx_tracker - Release allocated memory for Tx tracker * @pf: Board private structure @@ -2575,6 +2591,11 @@ static int ice_ptp_rebuild_owner(struct ice_pf *pf) /* Release the global hardware lock */ ice_ptp_unlock(hw); + /* Flush software tracking of any outstanding timestamps since we're + * about to flush the PHY timestamp block. + */ + ice_ptp_flush_all_tx_tracker(pf); + if (!ice_is_e810(hw)) { /* Enable quad interrupts */ err = ice_ptp_cfg_phy_interrupt(pf, true, 1); @@ -2610,18 +2631,6 @@ void ice_ptp_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) if (ice_pf_src_tmr_owned(pf) && reset_type != ICE_RESET_PFR) ice_ptp_rebuild_owner(pf); - /* Init Tx structures */ - if (ice_is_e810(&pf->hw)) { - err = ice_ptp_init_tx_e810(pf, &ptp->port.tx); - } else { - kthread_init_delayed_work(&ptp->port.ov_work, - ice_ptp_wait_for_offsets); - err = ice_ptp_init_tx_e822(pf, &ptp->port.tx, - ptp->port.port_num); - } - if (err) - goto err; - ptp->state = ICE_PTP_READY; /* Start periodic work going */ -- 2.39.2 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan