Skip to content

Commit 42d40bb

Browse files
jacob-kelleranguy11
authored andcommitted
ice: introduce ice_pf_src_tmr_owned
Add ice_pf_src_tmr_owned() macro to check the function capability bit indicating if the current function owns the PTP hardware clock. This is slightly shorter than the more verbose access via hw.func_caps.ts_func_info.src_tmr_owned. Use this where possible rather than open coding its equivalent. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 5a7cee1 commit 42d40bb

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@
196196

197197
#define ice_pf_to_dev(pf) (&((pf)->pdev->dev))
198198

199+
#define ice_pf_src_tmr_owned(pf) ((pf)->hw.func_caps.ts_func_info.src_tmr_owned)
200+
199201
enum ice_feature {
200202
ICE_F_DSCP,
201203
ICE_F_PHY_RCLK,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3992,7 +3992,7 @@ void ice_init_feature_support(struct ice_pf *pf)
39923992
if (ice_is_phy_rclk_present(&pf->hw))
39933993
ice_set_feature_support(pf, ICE_F_PHY_RCLK);
39943994
/* If we don't own the timer - don't enable other caps */
3995-
if (!pf->hw.func_caps.ts_func_info.src_tmr_owned)
3995+
if (!ice_pf_src_tmr_owned(pf))
39963996
break;
39973997
if (ice_is_cgu_present(&pf->hw))
39983998
ice_set_feature_support(pf, ICE_F_CGU);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3159,7 +3159,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
31593159

31603160
ena_mask &= ~PFINT_OICR_TSYN_EVNT_M;
31613161

3162-
if (hw->func_caps.ts_func_info.src_tmr_owned) {
3162+
if (ice_pf_src_tmr_owned(pf)) {
31633163
/* Save EVENTs from GLTSYN register */
31643164
pf->ptp.ext_ts_irq |= gltsyn_stat &
31653165
(GLTSYN_STAT_EVENT0_M |

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ static void ice_clear_ptp_clock_index(struct ice_pf *pf)
436436
int err;
437437

438438
/* Do not clear the index if we don't own the timer */
439-
if (!hw->func_caps.ts_func_info.src_tmr_owned)
439+
if (!ice_pf_src_tmr_owned(pf))
440440
return;
441441

442442
tmr_idx = hw->func_caps.ts_func_info.tmr_index_assoc;
@@ -2499,7 +2499,7 @@ void ice_ptp_reset(struct ice_pf *pf)
24992499
if (test_bit(ICE_PFR_REQ, pf->state))
25002500
goto pfr;
25012501

2502-
if (!hw->func_caps.ts_func_info.src_tmr_owned)
2502+
if (!ice_pf_src_tmr_owned(pf))
25032503
goto reset_ts;
25042504

25052505
err = ice_ptp_init_phc(hw);
@@ -2751,7 +2751,7 @@ void ice_ptp_init(struct ice_pf *pf)
27512751
/* If this function owns the clock hardware, it must allocate and
27522752
* configure the PTP clock device to represent it.
27532753
*/
2754-
if (hw->func_caps.ts_func_info.src_tmr_owned) {
2754+
if (ice_pf_src_tmr_owned(pf)) {
27552755
err = ice_ptp_init_owner(pf);
27562756
if (err)
27572757
goto err;

0 commit comments

Comments
 (0)