Skip to content

Commit b53e846

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2024-02-12 (ice) This series contains updates to ice driver only. Grzegorz adds support for E825-C devices. Wojciech reworks devlink reload to fulfill expected conditions (remove and readd). ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents e1a0037 + 500d0df commit b53e846

File tree

11 files changed

+200
-136
lines changed

11 files changed

+200
-136
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
896896
}
897897

898898
void ice_debugfs_fwlog_init(struct ice_pf *pf);
899+
void ice_debugfs_pf_deinit(struct ice_pf *pf);
899900
void ice_debugfs_init(void);
900901
void ice_debugfs_exit(void);
901902
void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module);
@@ -983,6 +984,8 @@ void ice_service_task_schedule(struct ice_pf *pf);
983984
int ice_load(struct ice_pf *pf);
984985
void ice_unload(struct ice_pf *pf);
985986
void ice_adv_lnk_speed_maps_init(void);
987+
int ice_init_dev(struct ice_pf *pf);
988+
void ice_deinit_dev(struct ice_pf *pf);
986989

987990
/**
988991
* ice_set_rdma_cap - enable RDMA support

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ static int ice_set_mac_type(struct ice_hw *hw)
154154
case ICE_DEV_ID_E823L_SFP:
155155
hw->mac_type = ICE_MAC_GENERIC;
156156
break;
157+
case ICE_DEV_ID_E825C_BACKPLANE:
158+
case ICE_DEV_ID_E825C_QSFP:
159+
case ICE_DEV_ID_E825C_SFP:
160+
case ICE_DEV_ID_E825C_SGMII:
161+
hw->mac_type = ICE_MAC_GENERIC_3K_E825;
162+
break;
157163
case ICE_DEV_ID_E830_BACKPLANE:
158164
case ICE_DEV_ID_E830_QSFP56:
159165
case ICE_DEV_ID_E830_SFP:
@@ -169,6 +175,18 @@ static int ice_set_mac_type(struct ice_hw *hw)
169175
return 0;
170176
}
171177

178+
/**
179+
* ice_is_generic_mac - check if device's mac_type is generic
180+
* @hw: pointer to the hardware structure
181+
*
182+
* Return: true if mac_type is generic (with SBQ support), false if not
183+
*/
184+
bool ice_is_generic_mac(struct ice_hw *hw)
185+
{
186+
return (hw->mac_type == ICE_MAC_GENERIC ||
187+
hw->mac_type == ICE_MAC_GENERIC_3K_E825);
188+
}
189+
172190
/**
173191
* ice_is_e810
174192
* @hw: pointer to the hardware structure
@@ -240,6 +258,25 @@ bool ice_is_e823(struct ice_hw *hw)
240258
}
241259
}
242260

261+
/**
262+
* ice_is_e825c - Check if a device is E825C family device
263+
* @hw: pointer to the hardware structure
264+
*
265+
* Return: true if the device is E825-C based, false if not.
266+
*/
267+
bool ice_is_e825c(struct ice_hw *hw)
268+
{
269+
switch (hw->device_id) {
270+
case ICE_DEV_ID_E825C_BACKPLANE:
271+
case ICE_DEV_ID_E825C_QSFP:
272+
case ICE_DEV_ID_E825C_SFP:
273+
case ICE_DEV_ID_E825C_SGMII:
274+
return true;
275+
default:
276+
return false;
277+
}
278+
}
279+
243280
/**
244281
* ice_clear_pf_cfg - Clear PF configuration
245282
* @hw: pointer to the hardware structure

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ ice_update_phy_type(u64 *phy_type_low, u64 *phy_type_high,
112112
int
113113
ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags,
114114
struct ice_sq_cd *cd);
115+
bool ice_is_generic_mac(struct ice_hw *hw);
115116
bool ice_is_e810(struct ice_hw *hw);
116117
int ice_clear_pf_cfg(struct ice_hw *hw);
117118
int
@@ -251,6 +252,7 @@ ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
251252
u64 *prev_stat, u64 *cur_stat);
252253
bool ice_is_e810t(struct ice_hw *hw);
253254
bool ice_is_e823(struct ice_hw *hw);
255+
bool ice_is_e825c(struct ice_hw *hw);
254256
int
255257
ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
256258
struct ice_aqc_txsched_elem_data *buf);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ bool ice_is_sbq_supported(struct ice_hw *hw)
666666
/* The device sideband queue is only supported on devices with the
667667
* generic MAC type.
668668
*/
669-
return hw->mac_type == ICE_MAC_GENERIC;
669+
return ice_is_generic_mac(hw);
670670
}
671671

672672
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,7 @@ static u32 ice_get_pkg_segment_id(enum ice_mac_type mac_type)
18251825
seg_id = SEGMENT_TYPE_ICE_E830;
18261826
break;
18271827
case ICE_MAC_GENERIC:
1828+
case ICE_MAC_GENERIC_3K_E825:
18281829
default:
18291830
seg_id = SEGMENT_TYPE_ICE_E810;
18301831
break;
@@ -1845,6 +1846,9 @@ static u32 ice_get_pkg_sign_type(enum ice_mac_type mac_type)
18451846
case ICE_MAC_E830:
18461847
sign_type = SEGMENT_SIGN_TYPE_RSA3K_SBB;
18471848
break;
1849+
case ICE_MAC_GENERIC_3K_E825:
1850+
sign_type = SEGMENT_SIGN_TYPE_RSA3K_E825;
1851+
break;
18481852
case ICE_MAC_GENERIC:
18491853
default:
18501854
sign_type = SEGMENT_SIGN_TYPE_RSA2K;

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,16 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
644644
kfree(fw_modules);
645645
}
646646

647+
/**
648+
* ice_debugfs_pf_deinit - cleanup PF's debugfs
649+
* @pf: pointer to the PF struct
650+
*/
651+
void ice_debugfs_pf_deinit(struct ice_pf *pf)
652+
{
653+
debugfs_remove_recursive(pf->ice_debugfs_pf);
654+
pf->ice_debugfs_pf = NULL;
655+
}
656+
647657
/**
648658
* ice_debugfs_init - create root directory for debugfs entries
649659
*/

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,13 @@
7171
#define ICE_DEV_ID_E822L_10G_BASE_T 0x1899
7272
/* Intel(R) Ethernet Connection E822-L 1GbE */
7373
#define ICE_DEV_ID_E822L_SGMII 0x189A
74+
/* Intel(R) Ethernet Connection E825-C for backplane */
75+
#define ICE_DEV_ID_E825C_BACKPLANE 0x579c
76+
/* Intel(R) Ethernet Connection E825-C for QSFP */
77+
#define ICE_DEV_ID_E825C_QSFP 0x579d
78+
/* Intel(R) Ethernet Connection E825-C for SFP */
79+
#define ICE_DEV_ID_E825C_SFP 0x579e
80+
/* Intel(R) Ethernet Connection E825-C 1GbE */
81+
#define ICE_DEV_ID_E825C_SGMII 0x579f
7482

7583
#endif /* _ICE_DEVIDS_H_ */

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

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,20 @@ ice_devlink_reload_empr_start(struct ice_pf *pf,
444444
return 0;
445445
}
446446

447+
/**
448+
* ice_devlink_reinit_down - unload given PF
449+
* @pf: pointer to the PF struct
450+
*/
451+
static void ice_devlink_reinit_down(struct ice_pf *pf)
452+
{
453+
/* No need to take devl_lock, it's already taken by devlink API */
454+
ice_unload(pf);
455+
rtnl_lock();
456+
ice_vsi_decfg(ice_get_main_vsi(pf));
457+
rtnl_unlock();
458+
ice_deinit_dev(pf);
459+
}
460+
447461
/**
448462
* ice_devlink_reload_down - prepare for reload
449463
* @devlink: pointer to the devlink instance to reload
@@ -477,7 +491,7 @@ ice_devlink_reload_down(struct devlink *devlink, bool netns_change,
477491
"Remove all VFs before doing reinit\n");
478492
return -EOPNOTSUPP;
479493
}
480-
ice_unload(pf);
494+
ice_devlink_reinit_down(pf);
481495
return 0;
482496
case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
483497
return ice_devlink_reload_empr_start(pf, extack);
@@ -1269,6 +1283,45 @@ static int ice_devlink_set_parent(struct devlink_rate *devlink_rate,
12691283
return status;
12701284
}
12711285

1286+
/**
1287+
* ice_devlink_reinit_up - do reinit of the given PF
1288+
* @pf: pointer to the PF struct
1289+
*/
1290+
static int ice_devlink_reinit_up(struct ice_pf *pf)
1291+
{
1292+
struct ice_vsi *vsi = ice_get_main_vsi(pf);
1293+
struct ice_vsi_cfg_params params;
1294+
int err;
1295+
1296+
err = ice_init_dev(pf);
1297+
if (err)
1298+
return err;
1299+
1300+
params = ice_vsi_to_params(vsi);
1301+
params.flags = ICE_VSI_FLAG_INIT;
1302+
1303+
rtnl_lock();
1304+
err = ice_vsi_cfg(vsi, &params);
1305+
rtnl_unlock();
1306+
if (err)
1307+
goto err_vsi_cfg;
1308+
1309+
/* No need to take devl_lock, it's already taken by devlink API */
1310+
err = ice_load(pf);
1311+
if (err)
1312+
goto err_load;
1313+
1314+
return 0;
1315+
1316+
err_load:
1317+
rtnl_lock();
1318+
ice_vsi_decfg(vsi);
1319+
rtnl_unlock();
1320+
err_vsi_cfg:
1321+
ice_deinit_dev(pf);
1322+
return err;
1323+
}
1324+
12721325
/**
12731326
* ice_devlink_reload_up - do reload up after reinit
12741327
* @devlink: pointer to the devlink instance reloading
@@ -1289,7 +1342,7 @@ ice_devlink_reload_up(struct devlink *devlink,
12891342
switch (action) {
12901343
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
12911344
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
1292-
return ice_load(pf);
1345+
return ice_devlink_reinit_up(pf);
12931346
case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
12941347
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
12951348
return ice_devlink_reload_empr_finish(pf, extack);
@@ -1569,6 +1622,7 @@ static const struct devlink_port_ops ice_devlink_port_ops = {
15691622
* @pf: the PF to create a devlink port for
15701623
*
15711624
* Create and register a devlink_port for this PF.
1625+
* This function has to be called under devl_lock.
15721626
*
15731627
* Return: zero on success or an error code on failure.
15741628
*/
@@ -1581,6 +1635,8 @@ int ice_devlink_create_pf_port(struct ice_pf *pf)
15811635
struct device *dev;
15821636
int err;
15831637

1638+
devlink = priv_to_devlink(pf);
1639+
15841640
dev = ice_pf_to_dev(pf);
15851641

15861642
devlink_port = &pf->devlink_port;
@@ -1601,10 +1657,9 @@ int ice_devlink_create_pf_port(struct ice_pf *pf)
16011657
ice_devlink_set_switch_id(pf, &attrs.switch_id);
16021658

16031659
devlink_port_attrs_set(devlink_port, &attrs);
1604-
devlink = priv_to_devlink(pf);
16051660

1606-
err = devlink_port_register_with_ops(devlink, devlink_port, vsi->idx,
1607-
&ice_devlink_port_ops);
1661+
err = devl_port_register_with_ops(devlink, devlink_port, vsi->idx,
1662+
&ice_devlink_port_ops);
16081663
if (err) {
16091664
dev_err(dev, "Failed to create devlink port for PF %d, error %d\n",
16101665
pf->hw.pf_id, err);
@@ -1619,10 +1674,11 @@ int ice_devlink_create_pf_port(struct ice_pf *pf)
16191674
* @pf: the PF to cleanup
16201675
*
16211676
* Unregisters the devlink_port structure associated with this PF.
1677+
* This function has to be called under devl_lock.
16221678
*/
16231679
void ice_devlink_destroy_pf_port(struct ice_pf *pf)
16241680
{
1625-
devlink_port_unregister(&pf->devlink_port);
1681+
devl_port_unregister(&pf->devlink_port);
16261682
}
16271683

16281684
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ void ice_fwlog_deinit(struct ice_hw *hw)
188188
if (hw->bus.func)
189189
return;
190190

191+
ice_debugfs_pf_deinit(hw->back);
192+
191193
/* make sure FW logging is disabled to not put the FW in a weird state
192194
* for the next driver load
193195
*/

0 commit comments

Comments
 (0)