提交 450f10e7 编写于 作者: A Anirudh Venkataramanan 提交者: Tony Nguyen

ice: Fix error return codes in ice_set_link_ksettings

Return more appropriate error codes so that the right error
message is communicated to the user by ethtool.
Signed-off-by: NAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
上级 0be39bb4
...@@ -2212,7 +2212,7 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -2212,7 +2212,7 @@ ice_set_link_ksettings(struct net_device *netdev,
pi = np->vsi->port_info; pi = np->vsi->port_info;
if (!pi) if (!pi)
return -EOPNOTSUPP; return -EIO;
if (pi->phy.media_type != ICE_MEDIA_BASET && if (pi->phy.media_type != ICE_MEDIA_BASET &&
pi->phy.media_type != ICE_MEDIA_FIBER && pi->phy.media_type != ICE_MEDIA_FIBER &&
...@@ -2229,7 +2229,7 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -2229,7 +2229,7 @@ ice_set_link_ksettings(struct net_device *netdev,
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA, status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
phy_caps, NULL); phy_caps, NULL);
if (status) { if (status) {
err = -EAGAIN; err = -EIO;
goto done; goto done;
} }
...@@ -2252,7 +2252,7 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -2252,7 +2252,7 @@ ice_set_link_ksettings(struct net_device *netdev,
__ETHTOOL_LINK_MODE_MASK_NBITS)) { __ETHTOOL_LINK_MODE_MASK_NBITS)) {
if (!test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags)) if (!test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags))
netdev_info(netdev, "The selected speed is not supported by the current media. Please select a link speed that is supported by the current media.\n"); netdev_info(netdev, "The selected speed is not supported by the current media. Please select a link speed that is supported by the current media.\n");
err = -EINVAL; err = -EOPNOTSUPP;
goto done; goto done;
} }
...@@ -2304,7 +2304,7 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -2304,7 +2304,7 @@ ice_set_link_ksettings(struct net_device *netdev,
pi->phy.get_link_info = true; pi->phy.get_link_info = true;
status = ice_get_link_status(pi, &linkup); status = ice_get_link_status(pi, &linkup);
if (status) { if (status) {
err = -EAGAIN; err = -EIO;
goto done; goto done;
} }
...@@ -2335,7 +2335,7 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -2335,7 +2335,7 @@ ice_set_link_ksettings(struct net_device *netdev,
/* check if there is a PHY type for the requested advertised speed */ /* check if there is a PHY type for the requested advertised speed */
if (!(phy_type_low || phy_type_high)) { if (!(phy_type_low || phy_type_high)) {
netdev_info(netdev, "The selected speed is not supported by the current media. Please select a link speed that is supported by the current media.\n"); netdev_info(netdev, "The selected speed is not supported by the current media. Please select a link speed that is supported by the current media.\n");
err = -EAGAIN; err = -EOPNOTSUPP;
goto done; goto done;
} }
...@@ -2359,7 +2359,7 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -2359,7 +2359,7 @@ ice_set_link_ksettings(struct net_device *netdev,
pf->nvm_phy_type_lo; pf->nvm_phy_type_lo;
} else { } else {
netdev_info(netdev, "The selected speed is not supported by the current media. Please select a link speed that is supported by the current media.\n"); netdev_info(netdev, "The selected speed is not supported by the current media. Please select a link speed that is supported by the current media.\n");
err = -EAGAIN; err = -EOPNOTSUPP;
goto done; goto done;
} }
} }
...@@ -2378,7 +2378,7 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -2378,7 +2378,7 @@ ice_set_link_ksettings(struct net_device *netdev,
status = ice_aq_set_phy_cfg(&pf->hw, pi, &config, NULL); status = ice_aq_set_phy_cfg(&pf->hw, pi, &config, NULL);
if (status) { if (status) {
netdev_info(netdev, "Set phy config failed,\n"); netdev_info(netdev, "Set phy config failed,\n");
err = -EAGAIN; err = -EIO;
goto done; goto done;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册