From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22C601F666B; Tue, 21 Jan 2025 17:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737482248; cv=none; b=kLMak4mY1ksLvoXv7Er00CcZ3DbT013rqcuFD3Q4/cWTYVnM6TUzcJgiidZRRUlK+kNFSJv/p4EI2VmxvAPC6evQ72EDdpBpBxiyGXAOKBjKjzWdLV0rywyrJUecd7N2m4mw3JTO+KeD6Vynk5lnL9MEbI7Cs0dV/iCQK4lPP4c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737482248; c=relaxed/simple; bh=TC0fb7OAbnt3gdBwCHoRfPGlNfaCwQaOxldTzFROWr0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jPn5VpstFyh4HFSWBJhnt1ImHPyR41CvTappU5w9BNkC0D0bt5ZtLT1TFnlZVguiQOONBf/4paXDLj0B8+kDgEDUrMZd8cROz08z5RVehEyxLZBSEdhPZHk810t2NI3XHXMTUeNq9CJO2vmTnI4HfIGjzgqDws+PR0FT2GSM4S0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UrtIUBqM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UrtIUBqM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D8D9C4CEDF; Tue, 21 Jan 2025 17:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1737482248; bh=TC0fb7OAbnt3gdBwCHoRfPGlNfaCwQaOxldTzFROWr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrtIUBqMo6aoruXb7GgUeGij77L45bkitoh0PYo60dZS77D5Pi5eOoVaYn8d0yU7b RGTqw6YTQxcT9h9RAL/ITWzwRCi2wfZD2dtxViNP4VR0R7z5obb5JJ6DI35I7Ezw4T rVH5r6nrFYTNyhVY4yjs7oEiepaeZZa46F8qJJxQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sergey Temerkhanov , Przemek Kitszel , Simon Horman , Tony Nguyen , Sasha Levin , Pucha Himasekhar Reddy Subject: [PATCH 6.12 012/122] ice: Add ice_get_ctrl_ptp() wrapper to simplify the code Date: Tue, 21 Jan 2025 18:51:00 +0100 Message-ID: <20250121174533.471827072@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250121174532.991109301@linuxfoundation.org> References: <20250121174532.991109301@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergey Temerkhanov [ Upstream commit 97ed20a01f5b96e8738b53f56ae84b06953a2853 ] Add ice_get_ctrl_ptp() wrapper to simplify the PTP support code in the functions that do not use ctrl_pf directly. Add the control PF pointer to struct ice_adapter Rearrange fields in struct ice_adapter Signed-off-by: Sergey Temerkhanov Reviewed-by: Przemek Kitszel Reviewed-by: Simon Horman Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Stable-dep-of: 258f5f905815 ("ice: Add correct PHY lane assignment") Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_adapter.h | 5 ++++- drivers/net/ethernet/intel/ice/ice_ptp.c | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.h b/drivers/net/ethernet/intel/ice/ice_adapter.h index 9d11014ec02ff..eb7cac01c2427 100644 --- a/drivers/net/ethernet/intel/ice/ice_adapter.h +++ b/drivers/net/ethernet/intel/ice/ice_adapter.h @@ -8,18 +8,21 @@ #include struct pci_dev; +struct ice_pf; /** * struct ice_adapter - PCI adapter resources shared across PFs * @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME * register of the PTP clock. * @refcount: Reference count. struct ice_pf objects hold the references. + * @ctrl_pf: Control PF of the adapter */ struct ice_adapter { + refcount_t refcount; /* For access to the GLTSYN_TIME register */ spinlock_t ptp_gltsyn_time_lock; - refcount_t refcount; + struct ice_pf *ctrl_pf; }; struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev); diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index d534c8e571cee..2fb73ab41bc20 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -16,6 +16,18 @@ static const struct ptp_pin_desc ice_pin_desc_e810t[] = { { "U.FL2", UFL2, PTP_PF_NONE, 2, { 0, } }, }; +static struct ice_pf *ice_get_ctrl_pf(struct ice_pf *pf) +{ + return !pf->adapter ? NULL : pf->adapter->ctrl_pf; +} + +static __maybe_unused struct ice_ptp *ice_get_ctrl_ptp(struct ice_pf *pf) +{ + struct ice_pf *ctrl_pf = ice_get_ctrl_pf(pf); + + return !ctrl_pf ? NULL : &ctrl_pf->ptp; +} + /** * ice_get_sma_config_e810t * @hw: pointer to the hw struct -- 2.39.5