Skip to content

Commit 8f80a5c

Browse files
stemerkjfvogel
authored andcommitted
ice: Add ice_get_ctrl_ptp() wrapper to simplify the code
[ Upstream commit 97ed20a ] 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 <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Stable-dep-of: 258f5f9 ("ice: Add correct PHY lane assignment") Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 499db66f690b3b7baace76a88984f27893be8348) Signed-off-by: Jack Vogel <[email protected]>
1 parent 42f571e commit 8f80a5c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

drivers/net/ethernet/intel/ice/ice_adapter.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@
88
#include <linux/refcount_types.h>
99

1010
struct pci_dev;
11+
struct ice_pf;
1112

1213
/**
1314
* struct ice_adapter - PCI adapter resources shared across PFs
1415
* @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME
1516
* register of the PTP clock.
1617
* @refcount: Reference count. struct ice_pf objects hold the references.
18+
* @ctrl_pf: Control PF of the adapter
1719
*/
1820
struct ice_adapter {
21+
refcount_t refcount;
1922
/* For access to the GLTSYN_TIME register */
2023
spinlock_t ptp_gltsyn_time_lock;
2124

22-
refcount_t refcount;
25+
struct ice_pf *ctrl_pf;
2326
};
2427

2528
struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev);

drivers/net/ethernet/intel/ice/ice_ptp.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ static const struct ptp_pin_desc ice_pin_desc_e810t[] = {
1616
{ "U.FL2", UFL2, PTP_PF_NONE, 2, { 0, } },
1717
};
1818

19+
static struct ice_pf *ice_get_ctrl_pf(struct ice_pf *pf)
20+
{
21+
return !pf->adapter ? NULL : pf->adapter->ctrl_pf;
22+
}
23+
24+
static __maybe_unused struct ice_ptp *ice_get_ctrl_ptp(struct ice_pf *pf)
25+
{
26+
struct ice_pf *ctrl_pf = ice_get_ctrl_pf(pf);
27+
28+
return !ctrl_pf ? NULL : &ctrl_pf->ptp;
29+
}
30+
1931
/**
2032
* ice_get_sma_config_e810t
2133
* @hw: pointer to the hw struct

0 commit comments

Comments
 (0)