Skip to content

Commit 4d24a18

Browse files
committed
ice: fix PHY timestamp extraction for ETH56G
JIRA: https://issues.redhat.com/browse/RHEL-89579 Upstream commit(s): commit 3214fae Author: Przemyslaw Korba <przemyslaw.korba@intel.com> Date: Fri Nov 15 13:25:37 2024 +0100 ice: fix PHY timestamp extraction for ETH56G Fix incorrect PHY timestamp extraction for ETH56G. It's better to use FIELD_PREP() than manual shift. Fixes: 7cab44f ("ice: Introduce ETH56G PHY model for E825C products") Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com> 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> Signed-off-by: Petr Oros <poros@redhat.com>
1 parent 2a96a5d commit 4d24a18

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,8 @@ static int ice_read_ptp_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx,
15761576
* lower 8 bits in the low register, and the upper 32 bits in the high
15771577
* register.
15781578
*/
1579-
*tstamp = ((u64)hi) << TS_PHY_HIGH_S | ((u64)lo & TS_PHY_LOW_M);
1579+
*tstamp = FIELD_PREP(TS_PHY_HIGH_M, hi) |
1580+
FIELD_PREP(TS_PHY_LOW_M, lo);
15801581

15811582
return 0;
15821583
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,8 @@ static inline bool ice_is_dual(struct ice_hw *hw)
684684
#define TS_HIGH_M 0xFF
685685
#define TS_HIGH_S 32
686686

687-
#define TS_PHY_LOW_M 0xFF
688-
#define TS_PHY_HIGH_M 0xFFFFFFFF
689-
#define TS_PHY_HIGH_S 8
687+
#define TS_PHY_LOW_M GENMASK(7, 0)
688+
#define TS_PHY_HIGH_M GENMASK_ULL(39, 8)
690689

691690
#define BYTES_PER_IDX_ADDR_L_U 8
692691
#define BYTES_PER_IDX_ADDR_L 4

0 commit comments

Comments
 (0)