Skip to content

Commit

Permalink
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/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 <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Feb 14, 2024
2 parents e1a0037 + 500d0df commit b53e846
Show file tree
Hide file tree
Showing 11 changed files with 200 additions and 136 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/intel/ice/ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
}

void ice_debugfs_fwlog_init(struct ice_pf *pf);
void ice_debugfs_pf_deinit(struct ice_pf *pf);
void ice_debugfs_init(void);
void ice_debugfs_exit(void);
void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module);
Expand Down Expand Up @@ -983,6 +984,8 @@ void ice_service_task_schedule(struct ice_pf *pf);
int ice_load(struct ice_pf *pf);
void ice_unload(struct ice_pf *pf);
void ice_adv_lnk_speed_maps_init(void);
int ice_init_dev(struct ice_pf *pf);
void ice_deinit_dev(struct ice_pf *pf);

/**
* ice_set_rdma_cap - enable RDMA support
Expand Down
37 changes: 37 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ static int ice_set_mac_type(struct ice_hw *hw)
case ICE_DEV_ID_E823L_SFP:
hw->mac_type = ICE_MAC_GENERIC;
break;
case ICE_DEV_ID_E825C_BACKPLANE:
case ICE_DEV_ID_E825C_QSFP:
case ICE_DEV_ID_E825C_SFP:
case ICE_DEV_ID_E825C_SGMII:
hw->mac_type = ICE_MAC_GENERIC_3K_E825;
break;
case ICE_DEV_ID_E830_BACKPLANE:
case ICE_DEV_ID_E830_QSFP56:
case ICE_DEV_ID_E830_SFP:
Expand All @@ -169,6 +175,18 @@ static int ice_set_mac_type(struct ice_hw *hw)
return 0;
}

/**
* ice_is_generic_mac - check if device's mac_type is generic
* @hw: pointer to the hardware structure
*
* Return: true if mac_type is generic (with SBQ support), false if not
*/
bool ice_is_generic_mac(struct ice_hw *hw)
{
return (hw->mac_type == ICE_MAC_GENERIC ||
hw->mac_type == ICE_MAC_GENERIC_3K_E825);
}

/**
* ice_is_e810
* @hw: pointer to the hardware structure
Expand Down Expand Up @@ -240,6 +258,25 @@ bool ice_is_e823(struct ice_hw *hw)
}
}

/**
* ice_is_e825c - Check if a device is E825C family device
* @hw: pointer to the hardware structure
*
* Return: true if the device is E825-C based, false if not.
*/
bool ice_is_e825c(struct ice_hw *hw)
{
switch (hw->device_id) {
case ICE_DEV_ID_E825C_BACKPLANE:
case ICE_DEV_ID_E825C_QSFP:
case ICE_DEV_ID_E825C_SFP:
case ICE_DEV_ID_E825C_SGMII:
return true;
default:
return false;
}
}

/**
* ice_clear_pf_cfg - Clear PF configuration
* @hw: pointer to the hardware structure
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ ice_update_phy_type(u64 *phy_type_low, u64 *phy_type_high,
int
ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags,
struct ice_sq_cd *cd);
bool ice_is_generic_mac(struct ice_hw *hw);
bool ice_is_e810(struct ice_hw *hw);
int ice_clear_pf_cfg(struct ice_hw *hw);
int
Expand Down Expand Up @@ -251,6 +252,7 @@ ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
u64 *prev_stat, u64 *cur_stat);
bool ice_is_e810t(struct ice_hw *hw);
bool ice_is_e823(struct ice_hw *hw);
bool ice_is_e825c(struct ice_hw *hw);
int
ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
struct ice_aqc_txsched_elem_data *buf);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ice/ice_controlq.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ bool ice_is_sbq_supported(struct ice_hw *hw)
/* The device sideband queue is only supported on devices with the
* generic MAC type.
*/
return hw->mac_type == ICE_MAC_GENERIC;
return ice_is_generic_mac(hw);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_ddp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,7 @@ static u32 ice_get_pkg_segment_id(enum ice_mac_type mac_type)
seg_id = SEGMENT_TYPE_ICE_E830;
break;
case ICE_MAC_GENERIC:
case ICE_MAC_GENERIC_3K_E825:
default:
seg_id = SEGMENT_TYPE_ICE_E810;
break;
Expand All @@ -1845,6 +1846,9 @@ static u32 ice_get_pkg_sign_type(enum ice_mac_type mac_type)
case ICE_MAC_E830:
sign_type = SEGMENT_SIGN_TYPE_RSA3K_SBB;
break;
case ICE_MAC_GENERIC_3K_E825:
sign_type = SEGMENT_SIGN_TYPE_RSA3K_E825;
break;
case ICE_MAC_GENERIC:
default:
sign_type = SEGMENT_SIGN_TYPE_RSA2K;
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,16 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
kfree(fw_modules);
}

/**
* ice_debugfs_pf_deinit - cleanup PF's debugfs
* @pf: pointer to the PF struct
*/
void ice_debugfs_pf_deinit(struct ice_pf *pf)
{
debugfs_remove_recursive(pf->ice_debugfs_pf);
pf->ice_debugfs_pf = NULL;
}

/**
* ice_debugfs_init - create root directory for debugfs entries
*/
Expand Down
8 changes: 8 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_devids.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,13 @@
#define ICE_DEV_ID_E822L_10G_BASE_T 0x1899
/* Intel(R) Ethernet Connection E822-L 1GbE */
#define ICE_DEV_ID_E822L_SGMII 0x189A
/* Intel(R) Ethernet Connection E825-C for backplane */
#define ICE_DEV_ID_E825C_BACKPLANE 0x579c
/* Intel(R) Ethernet Connection E825-C for QSFP */
#define ICE_DEV_ID_E825C_QSFP 0x579d
/* Intel(R) Ethernet Connection E825-C for SFP */
#define ICE_DEV_ID_E825C_SFP 0x579e
/* Intel(R) Ethernet Connection E825-C 1GbE */
#define ICE_DEV_ID_E825C_SGMII 0x579f

#endif /* _ICE_DEVIDS_H_ */
68 changes: 62 additions & 6 deletions drivers/net/ethernet/intel/ice/ice_devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,20 @@ ice_devlink_reload_empr_start(struct ice_pf *pf,
return 0;
}

/**
* ice_devlink_reinit_down - unload given PF
* @pf: pointer to the PF struct
*/
static void ice_devlink_reinit_down(struct ice_pf *pf)
{
/* No need to take devl_lock, it's already taken by devlink API */
ice_unload(pf);
rtnl_lock();
ice_vsi_decfg(ice_get_main_vsi(pf));
rtnl_unlock();
ice_deinit_dev(pf);
}

/**
* ice_devlink_reload_down - prepare for reload
* @devlink: pointer to the devlink instance to reload
Expand Down Expand Up @@ -477,7 +491,7 @@ ice_devlink_reload_down(struct devlink *devlink, bool netns_change,
"Remove all VFs before doing reinit\n");
return -EOPNOTSUPP;
}
ice_unload(pf);
ice_devlink_reinit_down(pf);
return 0;
case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
return ice_devlink_reload_empr_start(pf, extack);
Expand Down Expand Up @@ -1269,6 +1283,45 @@ static int ice_devlink_set_parent(struct devlink_rate *devlink_rate,
return status;
}

/**
* ice_devlink_reinit_up - do reinit of the given PF
* @pf: pointer to the PF struct
*/
static int ice_devlink_reinit_up(struct ice_pf *pf)
{
struct ice_vsi *vsi = ice_get_main_vsi(pf);
struct ice_vsi_cfg_params params;
int err;

err = ice_init_dev(pf);
if (err)
return err;

params = ice_vsi_to_params(vsi);
params.flags = ICE_VSI_FLAG_INIT;

rtnl_lock();
err = ice_vsi_cfg(vsi, &params);
rtnl_unlock();
if (err)
goto err_vsi_cfg;

/* No need to take devl_lock, it's already taken by devlink API */
err = ice_load(pf);
if (err)
goto err_load;

return 0;

err_load:
rtnl_lock();
ice_vsi_decfg(vsi);
rtnl_unlock();
err_vsi_cfg:
ice_deinit_dev(pf);
return err;
}

/**
* ice_devlink_reload_up - do reload up after reinit
* @devlink: pointer to the devlink instance reloading
Expand All @@ -1289,7 +1342,7 @@ ice_devlink_reload_up(struct devlink *devlink,
switch (action) {
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
return ice_load(pf);
return ice_devlink_reinit_up(pf);
case DEVLINK_RELOAD_ACTION_FW_ACTIVATE:
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
return ice_devlink_reload_empr_finish(pf, extack);
Expand Down Expand Up @@ -1569,6 +1622,7 @@ static const struct devlink_port_ops ice_devlink_port_ops = {
* @pf: the PF to create a devlink port for
*
* Create and register a devlink_port for this PF.
* This function has to be called under devl_lock.
*
* Return: zero on success or an error code on failure.
*/
Expand All @@ -1581,6 +1635,8 @@ int ice_devlink_create_pf_port(struct ice_pf *pf)
struct device *dev;
int err;

devlink = priv_to_devlink(pf);

dev = ice_pf_to_dev(pf);

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

devlink_port_attrs_set(devlink_port, &attrs);
devlink = priv_to_devlink(pf);

err = devlink_port_register_with_ops(devlink, devlink_port, vsi->idx,
&ice_devlink_port_ops);
err = devl_port_register_with_ops(devlink, devlink_port, vsi->idx,
&ice_devlink_port_ops);
if (err) {
dev_err(dev, "Failed to create devlink port for PF %d, error %d\n",
pf->hw.pf_id, err);
Expand All @@ -1619,10 +1674,11 @@ int ice_devlink_create_pf_port(struct ice_pf *pf)
* @pf: the PF to cleanup
*
* Unregisters the devlink_port structure associated with this PF.
* This function has to be called under devl_lock.
*/
void ice_devlink_destroy_pf_port(struct ice_pf *pf)
{
devlink_port_unregister(&pf->devlink_port);
devl_port_unregister(&pf->devlink_port);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_fwlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ void ice_fwlog_deinit(struct ice_hw *hw)
if (hw->bus.func)
return;

ice_debugfs_pf_deinit(hw->back);

/* make sure FW logging is disabled to not put the FW in a weird state
* for the next driver load
*/
Expand Down
Loading

0 comments on commit b53e846

Please sign in to comment.