Skip to content

Commit 71a579f

Browse files
mmichaliINTCanguy11
authored andcommitted
ice: Fix PTP TX timestamp offset calculation
The offset was being incorrectly calculated for E822 - that led to collisions in choosing TX timestamp register location when more than one port was trying to use timestamping mechanism. In E822 one quad is being logically split between ports, so quad 0 is having trackers for ports 0-3, quad 1 ports 4-7 etc. Each port should have separate memory location for tracking timestamps. Due to error for example ports 1 and 2 had been assigned to quad 0 with same offset (0), while port 1 should have offset 0 and 1 offset 16. Fix it by correctly calculating quad offset. Fixes: 3a74962 ("ice: implement basic E822 PTP support") Signed-off-by: Michal Michalik <michal.michalik@intel.com> Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 4b7a632 commit 71a579f

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ static int
22712271
ice_ptp_init_tx_e822(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port)
22722272
{
22732273
tx->quad = port / ICE_PORTS_PER_QUAD;
2274-
tx->quad_offset = tx->quad * INDEX_PER_PORT;
2274+
tx->quad_offset = (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT;
22752275
tx->len = INDEX_PER_PORT;
22762276

22772277
return ice_ptp_alloc_tx_tracker(tx);

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,37 @@ struct ice_perout_channel {
4949
* To allow multiple ports to access the shared register block independently,
5050
* the blocks are split up so that indexes are assigned to each port based on
5151
* hardware logical port number.
52+
*
53+
* The timestamp blocks are handled differently for E810- and E822-based
54+
* devices. In E810 devices, each port has its own block of timestamps, while in
55+
* E822 there is a need to logically break the block of registers into smaller
56+
* chunks based on the port number to avoid collisions.
57+
*
58+
* Example for port 5 in E810:
59+
* +--------+--------+--------+--------+--------+--------+--------+--------+
60+
* |register|register|register|register|register|register|register|register|
61+
* | block | block | block | block | block | block | block | block |
62+
* | for | for | for | for | for | for | for | for |
63+
* | port 0 | port 1 | port 2 | port 3 | port 4 | port 5 | port 6 | port 7 |
64+
* +--------+--------+--------+--------+--------+--------+--------+--------+
65+
* ^^
66+
* ||
67+
* |--- quad offset is always 0
68+
* ---- quad number
69+
*
70+
* Example for port 5 in E822:
71+
* +-----------------------------+-----------------------------+
72+
* | register block for quad 0 | register block for quad 1 |
73+
* |+------+------+------+------+|+------+------+------+------+|
74+
* ||port 0|port 1|port 2|port 3|||port 0|port 1|port 2|port 3||
75+
* |+------+------+------+------+|+------+------+------+------+|
76+
* +-----------------------------+-------^---------------------+
77+
* ^ |
78+
* | --- quad offset*
79+
* ---- quad number
80+
*
81+
* * PHY port 5 is port 1 in quad 1
82+
*
5283
*/
5384

5485
/**

0 commit comments

Comments
 (0)