Skip to content

Commit 07e6191

Browse files
author
CKI KWF Bot
committed
Merge: ice: TSPLL patches
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1261 JIRA: https://issues.redhat.com/browse/RHEL-104246 This patch series refactors and improves TSPLL (Timestamp PLL) handling for E825 and E825-C devices in the ice driver. It includes code cleanups, better separation of functionality, register definition fixes, and improved reliability during TSPLL initialization and fallback. Additionally, it removes outdated workarounds and enhances timesync support for 2xNAC E825 configurations. Signed-off-by: Petr Oros <poros@redhat.com> Approved-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 47c9b1d + 81c6243 commit 07e6191

File tree

13 files changed

+952
-1044
lines changed

13 files changed

+952
-1044
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ice-$(CONFIG_PCI_IOV) += \
5353
ice_vf_mbx.o \
5454
ice_vf_vsi_vlan_ops.o \
5555
ice_vf_lib.o
56-
ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o
56+
ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice_tspll.o
5757
ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
5858
ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o
5959
ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o

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

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include "ice_sriov.h"
6868
#include "ice_vf_mbx.h"
6969
#include "ice_ptp.h"
70+
#include "ice_tspll.h"
7071
#include "ice_fdir.h"
7172
#include "ice_xsk.h"
7273
#include "ice_arfs.h"
@@ -193,8 +194,6 @@
193194

194195
#define ice_pf_to_dev(pf) (&((pf)->pdev->dev))
195196

196-
#define ice_pf_src_tmr_owned(pf) ((pf)->hw.func_caps.ts_func_info.src_tmr_owned)
197-
198197
enum ice_feature {
199198
ICE_F_DSCP,
200199
ICE_F_PHY_RCLK,
@@ -1048,4 +1047,62 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf)
10481047
}
10491048

10501049
extern const struct xdp_metadata_ops ice_xdp_md_ops;
1050+
1051+
/**
1052+
* ice_is_dual - Check if given config is multi-NAC
1053+
* @hw: pointer to HW structure
1054+
*
1055+
* Return: true if the device is running in mutli-NAC (Network
1056+
* Acceleration Complex) configuration variant, false otherwise
1057+
* (always false for non-E825 devices).
1058+
*/
1059+
static inline bool ice_is_dual(struct ice_hw *hw)
1060+
{
1061+
return hw->mac_type == ICE_MAC_GENERIC_3K_E825 &&
1062+
(hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_DUAL_M);
1063+
}
1064+
1065+
/**
1066+
* ice_is_primary - Check if given device belongs to the primary complex
1067+
* @hw: pointer to HW structure
1068+
*
1069+
* Check if given PF/HW is running on primary complex in multi-NAC
1070+
* configuration.
1071+
*
1072+
* Return: true if the device is dual, false otherwise (always true
1073+
* for non-E825 devices).
1074+
*/
1075+
static inline bool ice_is_primary(struct ice_hw *hw)
1076+
{
1077+
return hw->mac_type != ICE_MAC_GENERIC_3K_E825 ||
1078+
!ice_is_dual(hw) ||
1079+
(hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M);
1080+
}
1081+
1082+
/**
1083+
* ice_pf_src_tmr_owned - Check if a primary timer is owned by PF
1084+
* @pf: pointer to PF structure
1085+
*
1086+
* Return: true if PF owns primary timer, false otherwise.
1087+
*/
1088+
static inline bool ice_pf_src_tmr_owned(struct ice_pf *pf)
1089+
{
1090+
return pf->hw.func_caps.ts_func_info.src_tmr_owned &&
1091+
ice_is_primary(&pf->hw);
1092+
}
1093+
1094+
/**
1095+
* ice_get_primary_hw - Get pointer to primary ice_hw structure
1096+
* @pf: pointer to PF structure
1097+
*
1098+
* Return: A pointer to ice_hw structure with access to timesync
1099+
* register space.
1100+
*/
1101+
static inline struct ice_hw *ice_get_primary_hw(struct ice_pf *pf)
1102+
{
1103+
if (!pf->adapter->ctrl_pf)
1104+
return &pf->hw;
1105+
else
1106+
return &pf->adapter->ctrl_pf->hw;
1107+
}
10511108
#endif /* _ICE_H_ */

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

Lines changed: 0 additions & 181 deletions
This file was deleted.

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

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,8 @@ int ice_init_hw(struct ice_hw *hw)
11351135
}
11361136
}
11371137

1138+
hw->lane_num = ice_get_phy_lane_number(hw);
1139+
11381140
return 0;
11391141
err_unroll_fltr_mgmt_struct:
11401142
ice_cleanup_fltr_mgmt_struct(hw);
@@ -2299,20 +2301,20 @@ ice_parse_1588_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
22992301
info->clk_freq = FIELD_GET(ICE_TS_CLK_FREQ_M, number);
23002302
info->clk_src = ((number & ICE_TS_CLK_SRC_M) != 0);
23012303
} else {
2302-
info->clk_freq = ICE_TIME_REF_FREQ_156_250;
2303-
info->clk_src = ICE_CLK_SRC_TCXO;
2304+
info->clk_freq = ICE_TSPLL_FREQ_156_250;
2305+
info->clk_src = ICE_CLK_SRC_TIME_REF;
23042306
}
23052307

2306-
if (info->clk_freq < NUM_ICE_TIME_REF_FREQ) {
2307-
info->time_ref = (enum ice_time_ref_freq)info->clk_freq;
2308+
if (info->clk_freq < NUM_ICE_TSPLL_FREQ) {
2309+
info->time_ref = (enum ice_tspll_freq)info->clk_freq;
23082310
} else {
23092311
/* Unknown clock frequency, so assume a (probably incorrect)
23102312
* default to avoid out-of-bounds look ups of frequency
23112313
* related information.
23122314
*/
23132315
ice_debug(hw, ICE_DBG_INIT, "1588 func caps: unknown clock frequency %u\n",
23142316
info->clk_freq);
2315-
info->time_ref = ICE_TIME_REF_FREQ_25_000;
2317+
info->time_ref = ICE_TSPLL_FREQ_25_000;
23162318
}
23172319

23182320
ice_debug(hw, ICE_DBG_INIT, "func caps: ieee_1588 = %u\n",
@@ -3434,7 +3436,7 @@ int ice_aq_get_fec_stats(struct ice_hw *hw, u16 pcs_quad, u16 pcs_port,
34343436
msg.msg_addr_low = lower_16_bits(reg_offset);
34353437
msg.msg_addr_high = receiver_id;
34363438
msg.opcode = ice_sbq_msg_rd;
3437-
msg.dest_dev = rmn_0;
3439+
msg.dest_dev = ice_sbq_dev_phy_0;
34383440

34393441
err = ice_sbq_rw_reg(hw, &msg, flag);
34403442
if (err)
@@ -4082,10 +4084,12 @@ int ice_get_phy_lane_number(struct ice_hw *hw)
40824084
continue;
40834085

40844086
if (hw->pf_id == lport) {
4087+
if (hw->mac_type == ICE_MAC_GENERIC_3K_E825 &&
4088+
ice_is_dual(hw) && !ice_is_primary(hw))
4089+
lane += ICE_PORTS_PER_QUAD;
40854090
kfree(options);
40864091
return lane;
40874092
}
4088-
40894093
lport++;
40904094
}
40914095

@@ -6096,3 +6100,64 @@ u32 ice_get_link_speed(u16 index)
60966100

60976101
return ice_aq_to_link_speed[index];
60986102
}
6103+
6104+
/**
6105+
* ice_read_cgu_reg - Read a CGU register
6106+
* @hw: Pointer to the HW struct
6107+
* @addr: Register address to read
6108+
* @val: Storage for register value read
6109+
*
6110+
* Read the contents of a register of the Clock Generation Unit. Only
6111+
* applicable to E82X devices.
6112+
*
6113+
* Return: 0 on success, other error codes when failed to read from CGU.
6114+
*/
6115+
int ice_read_cgu_reg(struct ice_hw *hw, u32 addr, u32 *val)
6116+
{
6117+
struct ice_sbq_msg_input cgu_msg = {
6118+
.opcode = ice_sbq_msg_rd,
6119+
.dest_dev = ice_sbq_dev_cgu,
6120+
.msg_addr_low = addr
6121+
};
6122+
int err;
6123+
6124+
err = ice_sbq_rw_reg(hw, &cgu_msg, ICE_AQ_FLAG_RD);
6125+
if (err) {
6126+
ice_debug(hw, ICE_DBG_PTP, "Failed to read CGU register 0x%04x, err %d\n",
6127+
addr, err);
6128+
return err;
6129+
}
6130+
6131+
*val = cgu_msg.data;
6132+
6133+
return 0;
6134+
}
6135+
6136+
/**
6137+
* ice_write_cgu_reg - Write a CGU register
6138+
* @hw: Pointer to the HW struct
6139+
* @addr: Register address to write
6140+
* @val: Value to write into the register
6141+
*
6142+
* Write the specified value to a register of the Clock Generation Unit. Only
6143+
* applicable to E82X devices.
6144+
*
6145+
* Return: 0 on success, other error codes when failed to write to CGU.
6146+
*/
6147+
int ice_write_cgu_reg(struct ice_hw *hw, u32 addr, u32 val)
6148+
{
6149+
struct ice_sbq_msg_input cgu_msg = {
6150+
.opcode = ice_sbq_msg_wr,
6151+
.dest_dev = ice_sbq_dev_cgu,
6152+
.msg_addr_low = addr,
6153+
.data = val
6154+
};
6155+
int err;
6156+
6157+
err = ice_sbq_rw_reg(hw, &cgu_msg, ICE_AQ_FLAG_RD);
6158+
if (err)
6159+
ice_debug(hw, ICE_DBG_PTP, "Failed to write CGU register 0x%04x, err %d\n",
6160+
addr, err);
6161+
6162+
return err;
6163+
}

0 commit comments

Comments
 (0)