MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ice_phy_conf_link

Function ice_phy_conf_link

dpdk/drivers/net/ice/ice_ethdev.c:4169–4229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4167}
4168
4169static int
4170ice_phy_conf_link(struct ice_hw *hw,
4171 u16 link_speeds_bitmap,
4172 bool link_up)
4173{
4174 struct ice_aqc_set_phy_cfg_data cfg = { 0 };
4175 struct ice_port_info *pi = hw->port_info;
4176 struct ice_aqc_get_phy_caps_data *phy_caps;
4177 int err;
4178 u64 phy_type_low = 0;
4179 u64 phy_type_high = 0;
4180
4181 phy_caps = (struct ice_aqc_get_phy_caps_data *)
4182 ice_malloc(hw, sizeof(*phy_caps));
4183 if (!phy_caps)
4184 return ICE_ERR_NO_MEMORY;
4185
4186 if (!pi)
4187 return -EIO;
4188
4189
4190 if (ice_fw_supports_report_dflt_cfg(pi->hw))
4191 err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_DFLT_CFG,
4192 phy_caps, NULL);
4193 else
4194 err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
4195 phy_caps, NULL);
4196 if (err)
4197 goto done;
4198
4199 ice_update_phy_type(&phy_type_low, &phy_type_high, link_speeds_bitmap);
4200
4201 if (link_speeds_bitmap == ICE_LINK_SPEED_UNKNOWN) {
4202 cfg.phy_type_low = phy_caps->phy_type_low;
4203 cfg.phy_type_high = phy_caps->phy_type_high;
4204 } else if (phy_type_low & phy_caps->phy_type_low ||
4205 phy_type_high & phy_caps->phy_type_high) {
4206 cfg.phy_type_low = phy_type_low & phy_caps->phy_type_low;
4207 cfg.phy_type_high = phy_type_high & phy_caps->phy_type_high;
4208 } else {
4209 PMD_DRV_LOG(WARNING, "Invalid speed setting, set to default!");
4210 cfg.phy_type_low = phy_caps->phy_type_low;
4211 cfg.phy_type_high = phy_caps->phy_type_high;
4212 }
4213
4214 cfg.caps = phy_caps->caps | ICE_AQ_PHY_ENA_AUTO_LINK_UPDT;
4215 cfg.low_power_ctrl_an = phy_caps->low_power_ctrl_an;
4216 cfg.eee_cap = phy_caps->eee_cap;
4217 cfg.eeer_value = phy_caps->eeer_value;
4218 cfg.link_fec_opt = phy_caps->link_fec_options;
4219 if (link_up)
4220 cfg.caps |= ICE_AQ_PHY_ENA_LINK;
4221 else
4222 cfg.caps &= ~ICE_AQ_PHY_ENA_LINK;
4223
4224 err = ice_aq_set_phy_cfg(hw, pi, &cfg, NULL);
4225
4226done:

Callers 2

ice_apply_link_speedFunction · 0.85
ice_dev_set_link_downFunction · 0.85

Calls 4

ice_aq_get_phy_capsFunction · 0.85
ice_update_phy_typeFunction · 0.85
ice_aq_set_phy_cfgFunction · 0.85

Tested by

no test coverage detected