ice: add support for Auto FEC with FEC disabled
Subsystems (2)
PATCH 1/1 ice: add support for Auto FEC with FEC disabled
The default Link Establishment State Machine (LESM) behavior does not allow the use of FEC disabled if the media does not support FEC disabled. However users may want to override this behavior.
Add ethtool private flag allow-no-fec-modules-in-auto to allow Auto FEC with no-FEC mode.
ethtool --set-priv-flags ethX allow-no-fec-modules-in-auto
on|off
--- drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 80 ++++++++++++------- drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 40 +++++++++- drivers/net/ethernet/intel/ice/ice_main.c | 8 +- drivers/net/ethernet/intel/ice/ice_type.h | 8 +- 7 files changed, 105 insertions(+), 34 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -487,6 +487,7 @@ enum ice_pf_flags {ICE_FLAG_PLUG_AUX_DEV ,ICE_FLAG_MTU_CHANGED ,ICE_FLAG_GNSS ,/* GNSS successfully initialized */ +ICE_FLAG_ALLOW_FEC_DIS_AUTO , ICE_PF_FLAGS_NBITS /* must be last */ };
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -1129,6 +1129,7 @@ struct ice_aqc_get_phy_caps_data {#define ICE_AQC_PHY_FEC_25G_RS_528_REQ BIT(2)#define ICE_AQC_PHY_FEC_25G_KR_REQ BIT(3)#define ICE_AQC_PHY_FEC_25G_RS_544_REQ BIT(4) +#define ICE_AQC_PHY_FEC_DIS BIT(5)#define ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN BIT(6)#define ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN BIT(7)#define ICE_AQC_PHY_FEC_MASK ICE_M(0xdf, 0)
drivers/net/ethernet/intel/ice/ice_common.c +51 -29
121 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +1 -0
@@ -110,6 +110,7 @@ int ice_aq_set_phy_cfg(struct ice_hw *hw, struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, struct ice_sq_cd *cd);bool ice_fw_supports_link_override (struct ice_hw *hw); +bool ice_fw_supports_fec_dis_auto (struct ice_hw *hw);int ice_get_link_default_override (struct ice_link_default_override_tlv *ldo,struct ice_port_info *pi);
drivers/net/ethernet/intel/ice/ice_ethtool.c +38 -2
@@ -166,6 +166,8 @@ static const struct ice_priv_flag ice_gstrings_priv_flags[] = {ICE_PRIV_FLAG ("mdd-auto-reset-vf" ,ICE_FLAG_MDD_AUTO_RESET_VF ),ICE_PRIV_FLAG ("vf-vlan-pruning" ,ICE_FLAG_VF_VLAN_PRUNING ),ICE_PRIV_FLAG ("legacy-rx" ,ICE_FLAG_LEGACY_RX ), +ICE_PRIV_FLAG ("allow-no-fec-modules-in-auto" , + ICE_FLAG_ALLOW_FEC_DIS_AUTO), };#define ICE_PRIV_FLAG_ARRAY_SIZE ARRAY_SIZE(ice_gstrings_priv_flags)
@@ -1012,11 +1014,16 @@ ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam) {struct ice_netdev_priv *np =netdev_priv (netdev);struct ice_vsi *vsi = np->vsi; +struct ice_pf *pf = vsi->back;enum ice_fec_mode fec;switch (fecparam->fec) {case ETHTOOL_FEC_AUTO : - fec =ICE_FEC_AUTO ; +if (ice_fw_supports_fec_dis_auto (&pf->hw) && +test_bit (ICE_FLAG_ALLOW_FEC_DIS_AUTO , pf->flags)) + fec =ICE_FEC_DIS_AUTO ; +else + fec =ICE_FEC_AUTO ;break ;case ETHTOOL_FEC_RS : fec =ICE_FEC_RS ;
@@ -1029,7 +1036,7 @@ ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam) fec =ICE_FEC_NONE ;break ;default : -dev_warn (ice_pf_to_dev (vsi->back),"Unsupported FEC mode: %d\n" , +dev_warn (ice_pf_to_dev (pf),"Unsupported FEC mode: %d\n" , fecparam->fec);return -EINVAL ; }
@@ -1306,6 +1313,35 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)change_bit (ICE_FLAG_VF_VLAN_PRUNING , pf->flags); ret = -EOPNOTSUPP ; } + +if (test_bit (ICE_FLAG_ALLOW_FEC_DIS_AUTO , change_flags)) { +enum ice_fec_mode fec =ICE_FEC_AUTO ; + +if (!ice_fw_supports_fec_dis_auto (&pf->hw)) { +netdev_info (vsi->netdev,"Unsupported Firmware to Enable/Disable auto configuration of No FEC modules\n" ); +change_bit (ICE_FLAG_ALLOW_FEC_DIS_AUTO , pf->flags); + ret = -EOPNOTSUPP ; + goto ethtool_exit; + } + +/* Set FEC configuration */ +if (test_bit (ICE_FLAG_ALLOW_FEC_DIS_AUTO , pf->flags)) + fec =ICE_FEC_DIS_AUTO ; + + ret =ice_set_fec_cfg (netdev, fec); + +/* If FEC configuration fails, restore original FEC flags */ +if (ret) { +netdev_warn (vsi->netdev,"Failed to Enable/Disable auto configuration of No FEC modules\n" ); +change_bit (ICE_FLAG_ALLOW_FEC_DIS_AUTO , pf->flags); + goto ethtool_exit; + } + +if (test_bit (ICE_FLAG_ALLOW_FEC_DIS_AUTO , pf->flags)) +netdev_info (vsi->netdev,"Enabled auto configuration of No FEC modules\n" ); +else +netdev_info (vsi->netdev,"Auto configuration of No FEC modules reset to NVM defaults\n" ); + } ethtool_exit:clear_bit (ICE_FLAG_ETHTOOL_CTXT , pf->flags);return ret;
drivers/net/ethernet/intel/ice/ice_main.c +6 -2
@@ -2187,8 +2187,12 @@ static int ice_configure_phy(struct ice_vsi *vsi)/* FEC */ ice_cfg_phy_fec (pi, cfg, phy->curr_user_fec_req); -/* Can't provide what was requested; use PHY capabilities */ -if (cfg->link_fec_opt != +/* Can't provide what was requested; use PHY capabilities. +* The user can force FEC disabled Auto mode via ethtool private +* flag allow-no-fec-modules-in-auto, so allow ICE_FEC_DIS_AUTO. +*/ +if (phy->curr_user_fec_req !=ICE_FEC_DIS_AUTO && + cfg->link_fec_opt != (cfg->link_fec_opt & pcaps->link_fec_options)) { cfg->caps |= pcaps->caps &ICE_AQC_PHY_EN_AUTO_FEC ; cfg->link_fec_opt = pcaps->link_fec_options;
drivers/net/ethernet/intel/ice/ice_type.h +7 -1
@@ -107,7 +107,8 @@ enum ice_fec_mode {ICE_FEC_NONE =0 ,ICE_FEC_RS ,ICE_FEC_BASER , -ICE_FEC_AUTO +ICE_FEC_AUTO , +ICE_FEC_DIS_AUTO }; struct ice_phy_cache_mode_data {
@@ -1147,4 +1148,9 @@ struct ice_aq_get_set_rss_lut_params {#define ICE_FW_API_REPORT_DFLT_CFG_MIN 7#define ICE_FW_API_REPORT_DFLT_CFG_PATCH 3 +/* AQ API version for FEC disable in Auto FEC mode */ +#define ICE_FW_API_FEC_DIS_AUTO_MAJ 1 +#define ICE_FW_API_FEC_DIS_AUTO_MIN 7 +#define ICE_FW_API_FEC_DIS_AUTO_PATCH 5 +#endif /* _ICE_TYPE_H_ */
base-commit: 74ba827d265743795b31669bc4917a260cf5d76a
Signature · 6 lines
2.31.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Paul Greenwalt
Sent: Thursday, June 2, 2022 11:08 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH net] ice: add support for Auto FEC with FEC disabledThe default Link Establishment State Machine (LESM) behavior does not allow the use of FEC disabled if the media does not support FEC disabled. However users may want to override this behavior.
Add ethtool private flag allow-no-fec-modules-in-auto to allow Auto FEC with no-FEC mode.
ethtool --set-priv-flags ethX allow-no-fec-modules-in-autoon|off
Signed-off-by Paul Greenwalt <[email protected]>
Quoted 10 lines
--- drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 80 ++++++++++++------- drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 40 +++++++++- drivers/net/ethernet/intel/ice/ice_main.c | 8 +- drivers/net/ethernet/intel/ice/ice_type.h | 8 +- 7 files changed, 105 insertions(+), 34 deletions(-)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan