@@ -971,28 +971,6 @@ ice_ptp_release_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
971971 tx -> len = 0 ;
972972}
973973
974- /**
975- * ice_ptp_init_tx_eth56g - Initialize tracking for Tx timestamps
976- * @pf: Board private structure
977- * @tx: the Tx tracking structure to initialize
978- * @port: the port this structure tracks
979- *
980- * Initialize the Tx timestamp tracker for this port. ETH56G PHYs
981- * have independent memory blocks for all ports.
982- *
983- * Return: 0 for success, -ENOMEM when failed to allocate Tx tracker
984- */
985- static int ice_ptp_init_tx_eth56g (struct ice_pf * pf , struct ice_ptp_tx * tx ,
986- u8 port )
987- {
988- tx -> block = port ;
989- tx -> offset = 0 ;
990- tx -> len = INDEX_PER_PORT_ETH56G ;
991- tx -> has_ready_bitmap = 1 ;
992-
993- return ice_ptp_alloc_tx_tracker (tx );
994- }
995-
996974/**
997975 * ice_ptp_init_tx_e82x - Initialize tracking for Tx timestamps
998976 * @pf: Board private structure
@@ -1003,9 +981,11 @@ static int ice_ptp_init_tx_eth56g(struct ice_pf *pf, struct ice_ptp_tx *tx,
1003981 * the timestamp block is shared for all ports in the same quad. To avoid
1004982 * ports using the same timestamp index, logically break the block of
1005983 * registers into chunks based on the port number.
984+ *
985+ * Return: 0 on success, -ENOMEM when out of memory
1006986 */
1007- static int
1008- ice_ptp_init_tx_e82x ( struct ice_pf * pf , struct ice_ptp_tx * tx , u8 port )
987+ static int ice_ptp_init_tx_e82x ( struct ice_pf * pf , struct ice_ptp_tx * tx ,
988+ u8 port )
1009989{
1010990 tx -> block = ICE_GET_QUAD_NUM (port );
1011991 tx -> offset = (port % ICE_PORTS_PER_QUAD ) * INDEX_PER_PORT_E82X ;
@@ -1016,24 +996,27 @@ ice_ptp_init_tx_e82x(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port)
1016996}
1017997
1018998/**
1019- * ice_ptp_init_tx_e810 - Initialize tracking for Tx timestamps
999+ * ice_ptp_init_tx - Initialize tracking for Tx timestamps
10201000 * @pf: Board private structure
10211001 * @tx: the Tx tracking structure to initialize
1002+ * @port: the port this structure tracks
1003+ *
1004+ * Initialize the Tx timestamp tracker for this PF. For all PHYs except E82X,
1005+ * each port has its own block of timestamps, independent of the other ports.
10221006 *
1023- * Initialize the Tx timestamp tracker for this PF. For E810 devices, each
1024- * port has its own block of timestamps, independent of the other ports.
1007+ * Return: 0 on success, -ENOMEM when out of memory
10251008 */
1026- static int
1027- ice_ptp_init_tx_e810 (struct ice_pf * pf , struct ice_ptp_tx * tx )
1009+ static int ice_ptp_init_tx (struct ice_pf * pf , struct ice_ptp_tx * tx , u8 port )
10281010{
1029- tx -> block = pf -> hw . port_info -> lport ;
1011+ tx -> block = port ;
10301012 tx -> offset = 0 ;
1031- tx -> len = INDEX_PER_PORT_E810 ;
1013+ tx -> len = INDEX_PER_PORT ;
1014+
10321015 /* The E810 PHY does not provide a timestamp ready bitmap. Instead,
10331016 * verify new timestamps against cached copy of the last read
10341017 * timestamp.
10351018 */
1036- tx -> has_ready_bitmap = 0 ;
1019+ tx -> has_ready_bitmap = pf -> hw . mac_type != ICE_MAC_E810 ;
10371020
10381021 return ice_ptp_alloc_tx_tracker (tx );
10391022}
@@ -3237,6 +3220,8 @@ static int ice_ptp_init_work(struct ice_pf *pf, struct ice_ptp *ptp)
32373220 * ice_ptp_init_port - Initialize PTP port structure
32383221 * @pf: Board private structure
32393222 * @ptp_port: PTP port structure
3223+ *
3224+ * Return: 0 on success, -ENODEV on invalid MAC type, -ENOMEM on failed alloc.
32403225 */
32413226static int ice_ptp_init_port (struct ice_pf * pf , struct ice_ptp_port * ptp_port )
32423227{
@@ -3246,16 +3231,13 @@ static int ice_ptp_init_port(struct ice_pf *pf, struct ice_ptp_port *ptp_port)
32463231
32473232 switch (hw -> mac_type ) {
32483233 case ICE_MAC_E810 :
3249- return ice_ptp_init_tx_e810 (pf , & ptp_port -> tx );
3234+ case ICE_MAC_GENERIC_3K_E825 :
3235+ return ice_ptp_init_tx (pf , & ptp_port -> tx , ptp_port -> port_num );
32503236 case ICE_MAC_GENERIC :
32513237 kthread_init_delayed_work (& ptp_port -> ov_work ,
32523238 ice_ptp_wait_for_offsets );
3253-
32543239 return ice_ptp_init_tx_e82x (pf , & ptp_port -> tx ,
32553240 ptp_port -> port_num );
3256- case ICE_MAC_GENERIC_3K_E825 :
3257- return ice_ptp_init_tx_eth56g (pf , & ptp_port -> tx ,
3258- ptp_port -> port_num );
32593241 default :
32603242 return - ENODEV ;
32613243 }
0 commit comments