ice: Add ice_get_ctrl_ptp() wrapper to simplify the code

[ 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 <sergey.temerkhanov@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Stable-dep-of: 258f5f905815 ("ice: Add correct PHY lane assignment")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Sergey Temerkhanov
2024-08-21 15:09:54 +02:00
committed by Greg Kroah-Hartman
parent 922af90ffb
commit 499db66f69
2 changed files with 16 additions and 1 deletions
+4 -1
View File
@@ -8,18 +8,21 @@
#include <linux/refcount_types.h>
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);
+12
View File
@@ -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