Skip to content

Commit 4409ea1

Browse files
gnitkakuba-moo
authored andcommitted
ice: Adjust PTP init for 2x50G E825C devices
>From FW/HW perspective, 2 port topology in E825C devices requires merging of 2 port mapping internally and breakout mapping externally. As a consequence, it requires different port numbering from PTP code perspective. For that topology, pf_id can not be used to index PTP ports. Even if the 2nd port is identified as port with pf_id = 1, all PHY operations need to be performed as it was port 2. Thus, special mapping is needed for the 2nd port. This change adds detection of 2x50G topology and applies 'custom' mapping on the 2nd port. Signed-off-by: Grzegorz Nitka <[email protected]> Reviewed-by: Arkadiusz Kubalewski <[email protected]> Signed-off-by: Karol Kolacinski <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/20240528-next-2024-05-28-ptp-refactors-v1-11-c082739bb6f6@intel.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5f847ee commit 4409ea1

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@
157157
#define GLGEN_RTRIG_CORER_M BIT(0)
158158
#define GLGEN_RTRIG_GLOBR_M BIT(1)
159159
#define GLGEN_STAT 0x000B612C
160+
#define GLGEN_SWITCH_MODE_CONFIG 0x000B81E0
161+
#define GLGEN_SWITCH_MODE_CONFIG_25X4_QUAD_M BIT(2)
160162
#define GLGEN_VFLRSTAT(_i) (0x00093A04 + ((_i) * 4))
161163
#define PFGEN_CTRL 0x00091000
162164
#define PFGEN_CTRL_PFSWR_M BIT(0)
@@ -177,6 +179,8 @@
177179
#define GLINT_CTL_ITR_GRAN_50_M ICE_M(0xF, 24)
178180
#define GLINT_CTL_ITR_GRAN_25_S 28
179181
#define GLINT_CTL_ITR_GRAN_25_M ICE_M(0xF, 28)
182+
#define GLGEN_MAC_LINK_TOPO 0x000B81DC
183+
#define GLGEN_MAC_LINK_TOPO_LINK_TOPO_M GENMASK(1, 0)
180184
#define GLINT_DYN_CTL(_INT) (0x00160000 + ((_INT) * 4))
181185
#define GLINT_DYN_CTL_INTENA_M BIT(0)
182186
#define GLINT_DYN_CTL_CLEARPBA_M BIT(1)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,8 @@ void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
14691469
return;
14701470

14711471
ptp_port = &pf->ptp.port;
1472+
if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo)
1473+
port *= 2;
14721474
if (WARN_ON_ONCE(ptp_port->port_num != port))
14731475
return;
14741476

@@ -3282,6 +3284,9 @@ void ice_ptp_init(struct ice_pf *pf)
32823284
}
32833285

32843286
ptp->port.port_num = hw->pf_id;
3287+
if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo)
3288+
ptp->port.port_num = hw->pf_id * 2;
3289+
32853290
err = ice_ptp_init_port(pf, &ptp->port);
32863291
if (err)
32873292
goto err;

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,6 +2644,26 @@ static int ice_get_phy_tx_tstamp_ready_eth56g(struct ice_hw *hw, u8 port,
26442644
return 0;
26452645
}
26462646

2647+
/**
2648+
* ice_is_muxed_topo - detect breakout 2x50G topology for E825C
2649+
* @hw: pointer to the HW struct
2650+
*
2651+
* Return: true if it's 2x50 breakout topology, false otherwise
2652+
*/
2653+
static bool ice_is_muxed_topo(struct ice_hw *hw)
2654+
{
2655+
u8 link_topo;
2656+
bool mux;
2657+
u32 val;
2658+
2659+
val = rd32(hw, GLGEN_SWITCH_MODE_CONFIG);
2660+
mux = FIELD_GET(GLGEN_SWITCH_MODE_CONFIG_25X4_QUAD_M, val);
2661+
val = rd32(hw, GLGEN_MAC_LINK_TOPO);
2662+
link_topo = FIELD_GET(GLGEN_MAC_LINK_TOPO_LINK_TOPO_M, val);
2663+
2664+
return (mux && link_topo == ICE_LINK_TOPO_UP_TO_2_LINKS);
2665+
}
2666+
26472667
/**
26482668
* ice_ptp_init_phy_e825c - initialize PHY parameters
26492669
* @hw: pointer to the HW struct
@@ -2676,6 +2696,8 @@ static void ice_ptp_init_phy_e825c(struct ice_hw *hw)
26762696
return;
26772697
}
26782698
}
2699+
2700+
ptp->is_2x50g_muxed_topo = ice_is_muxed_topo(hw);
26792701
}
26802702

26812703
/* E822 family functions

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,11 +853,20 @@ enum ice_phy_model {
853853
ICE_PHY_ETH56G,
854854
};
855855

856+
/* Global Link Topology */
857+
enum ice_global_link_topo {
858+
ICE_LINK_TOPO_UP_TO_2_LINKS,
859+
ICE_LINK_TOPO_UP_TO_4_LINKS,
860+
ICE_LINK_TOPO_UP_TO_8_LINKS,
861+
ICE_LINK_TOPO_RESERVED,
862+
};
863+
856864
struct ice_ptp_hw {
857865
enum ice_phy_model phy_model;
858866
union ice_phy_params phy;
859867
u8 num_lports;
860868
u8 ports_per_phy;
869+
bool is_2x50g_muxed_topo;
861870
};
862871

863872
/* Port hardware description */

0 commit comments

Comments
 (0)