Skip to content

Commit 9973ac9

Browse files
kolacinskikarolanguy11
authored andcommitted
ice: Remove unnecessary ice_is_e8xx() functions
Remove unnecessary ice_is_e8xx() functions and PHY model. Instead, use MAC type where applicable. Don't check device type in ice_ptp_maybe_trigger_tx_interrupt(), because in reality it depends on the ready bitmap, which only E810 does not have. Call ice_ptp_cfg_phy_interrupt() unconditionally, because all further function calls check the MAC type anyway and this allows simpler code in the future with addition of the new MAC types. Reorder ICE_MAC_* cases in switches in ice_ptp* as in enum ice_mac_type. Signed-off-by: Karol Kolacinski <karol.kolacinski@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>
1 parent e2c6737 commit 9973ac9

File tree

8 files changed

+147
-279
lines changed

8 files changed

+147
-279
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,10 +1046,5 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf)
10461046
clear_bit(ICE_FLAG_RDMA_ENA, pf->flags);
10471047
}
10481048

1049-
static inline enum ice_phy_model ice_get_phy_model(const struct ice_hw *hw)
1050-
{
1051-
return hw->ptp.phy_model;
1052-
}
1053-
10541049
extern const struct xdp_metadata_ops ice_xdp_md_ops;
10551050
#endif /* _ICE_H_ */

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

Lines changed: 2 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -186,128 +186,14 @@ static int ice_set_mac_type(struct ice_hw *hw)
186186
* ice_is_generic_mac - check if device's mac_type is generic
187187
* @hw: pointer to the hardware structure
188188
*
189-
* Return: true if mac_type is generic (with SBQ support), false if not
189+
* Return: true if mac_type is ICE_MAC_GENERIC*, false otherwise.
190190
*/
191191
bool ice_is_generic_mac(struct ice_hw *hw)
192192
{
193193
return (hw->mac_type == ICE_MAC_GENERIC ||
194194
hw->mac_type == ICE_MAC_GENERIC_3K_E825);
195195
}
196196

197-
/**
198-
* ice_is_e810
199-
* @hw: pointer to the hardware structure
200-
*
201-
* returns true if the device is E810 based, false if not.
202-
*/
203-
bool ice_is_e810(struct ice_hw *hw)
204-
{
205-
return hw->mac_type == ICE_MAC_E810;
206-
}
207-
208-
/**
209-
* ice_is_e810t
210-
* @hw: pointer to the hardware structure
211-
*
212-
* returns true if the device is E810T based, false if not.
213-
*/
214-
bool ice_is_e810t(struct ice_hw *hw)
215-
{
216-
switch (hw->device_id) {
217-
case ICE_DEV_ID_E810C_SFP:
218-
switch (hw->subsystem_device_id) {
219-
case ICE_SUBDEV_ID_E810T:
220-
case ICE_SUBDEV_ID_E810T2:
221-
case ICE_SUBDEV_ID_E810T3:
222-
case ICE_SUBDEV_ID_E810T4:
223-
case ICE_SUBDEV_ID_E810T6:
224-
case ICE_SUBDEV_ID_E810T7:
225-
return true;
226-
}
227-
break;
228-
case ICE_DEV_ID_E810C_QSFP:
229-
switch (hw->subsystem_device_id) {
230-
case ICE_SUBDEV_ID_E810T2:
231-
case ICE_SUBDEV_ID_E810T3:
232-
case ICE_SUBDEV_ID_E810T5:
233-
return true;
234-
}
235-
break;
236-
default:
237-
break;
238-
}
239-
240-
return false;
241-
}
242-
243-
/**
244-
* ice_is_e822 - Check if a device is E822 family device
245-
* @hw: pointer to the hardware structure
246-
*
247-
* Return: true if the device is E822 based, false if not.
248-
*/
249-
bool ice_is_e822(struct ice_hw *hw)
250-
{
251-
switch (hw->device_id) {
252-
case ICE_DEV_ID_E822C_BACKPLANE:
253-
case ICE_DEV_ID_E822C_QSFP:
254-
case ICE_DEV_ID_E822C_SFP:
255-
case ICE_DEV_ID_E822C_10G_BASE_T:
256-
case ICE_DEV_ID_E822C_SGMII:
257-
case ICE_DEV_ID_E822L_BACKPLANE:
258-
case ICE_DEV_ID_E822L_SFP:
259-
case ICE_DEV_ID_E822L_10G_BASE_T:
260-
case ICE_DEV_ID_E822L_SGMII:
261-
return true;
262-
default:
263-
return false;
264-
}
265-
}
266-
267-
/**
268-
* ice_is_e823
269-
* @hw: pointer to the hardware structure
270-
*
271-
* returns true if the device is E823-L or E823-C based, false if not.
272-
*/
273-
bool ice_is_e823(struct ice_hw *hw)
274-
{
275-
switch (hw->device_id) {
276-
case ICE_DEV_ID_E823L_BACKPLANE:
277-
case ICE_DEV_ID_E823L_SFP:
278-
case ICE_DEV_ID_E823L_10G_BASE_T:
279-
case ICE_DEV_ID_E823L_1GBE:
280-
case ICE_DEV_ID_E823L_QSFP:
281-
case ICE_DEV_ID_E823C_BACKPLANE:
282-
case ICE_DEV_ID_E823C_QSFP:
283-
case ICE_DEV_ID_E823C_SFP:
284-
case ICE_DEV_ID_E823C_10G_BASE_T:
285-
case ICE_DEV_ID_E823C_SGMII:
286-
return true;
287-
default:
288-
return false;
289-
}
290-
}
291-
292-
/**
293-
* ice_is_e825c - Check if a device is E825C family device
294-
* @hw: pointer to the hardware structure
295-
*
296-
* Return: true if the device is E825-C based, false if not.
297-
*/
298-
bool ice_is_e825c(struct ice_hw *hw)
299-
{
300-
switch (hw->device_id) {
301-
case ICE_DEV_ID_E825C_BACKPLANE:
302-
case ICE_DEV_ID_E825C_QSFP:
303-
case ICE_DEV_ID_E825C_SFP:
304-
case ICE_DEV_ID_E825C_SGMII:
305-
return true;
306-
default:
307-
return false;
308-
}
309-
}
310-
311197
/**
312198
* ice_is_pf_c827 - check if pf contains c827 phy
313199
* @hw: pointer to the hw struct
@@ -2408,7 +2294,7 @@ ice_parse_1588_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
24082294
info->tmr_index_owned = ((number & ICE_TS_TMR_IDX_OWND_M) != 0);
24092295
info->tmr_index_assoc = ((number & ICE_TS_TMR_IDX_ASSOC_M) != 0);
24102296

2411-
if (!ice_is_e825c(hw)) {
2297+
if (hw->mac_type != ICE_MAC_GENERIC_3K_E825) {
24122298
info->clk_freq = FIELD_GET(ICE_TS_CLK_FREQ_M, number);
24132299
info->clk_src = ((number & ICE_TS_CLK_SRC_M) != 0);
24142300
} else {

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int
131131
ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags,
132132
struct ice_sq_cd *cd);
133133
bool ice_is_generic_mac(struct ice_hw *hw);
134-
bool ice_is_e810(struct ice_hw *hw);
135134
int ice_clear_pf_cfg(struct ice_hw *hw);
136135
int
137136
ice_aq_set_phy_cfg(struct ice_hw *hw, struct ice_port_info *pi,
@@ -276,10 +275,6 @@ ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
276275
void
277276
ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
278277
u64 *prev_stat, u64 *cur_stat);
279-
bool ice_is_e810t(struct ice_hw *hw);
280-
bool ice_is_e822(struct ice_hw *hw);
281-
bool ice_is_e823(struct ice_hw *hw);
282-
bool ice_is_e825c(struct ice_hw *hw);
283278
int
284279
ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
285280
struct ice_aqc_txsched_elem_data *buf);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,14 +2345,14 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size,
23452345
cmd->set_flags |= ICE_AQC_TX_TOPO_FLAGS_SRC_RAM |
23462346
ICE_AQC_TX_TOPO_FLAGS_LOAD_NEW;
23472347

2348-
if (ice_is_e825c(hw))
2348+
if (hw->mac_type == ICE_MAC_GENERIC_3K_E825)
23492349
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
23502350
} else {
23512351
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_tx_topo);
23522352
cmd->get_flags = ICE_AQC_TX_TOPO_GET_RAM;
23532353
}
23542354

2355-
if (!ice_is_e825c(hw))
2355+
if (hw->mac_type != ICE_MAC_GENERIC_3K_E825)
23562356
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
23572357

23582358
status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);

0 commit comments

Comments
 (0)