Commit c1484691 authored by Tony Nguyen's avatar Tony Nguyen
Browse files

ice: Propagate error codes



As all functions now return standard error codes, propagate the values
being returned instead of converting them to generic values.

Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: default avatarGurucharan G <gurucharanx.g@intel.com>
parent 2ccc1c1c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -806,7 +806,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,
	if (status) {
		dev_err(ice_pf_to_dev(pf), "Failed to set LAN Tx queue context, error: %d\n",
			status);
		return -ENODEV;
		return status;
	}

	/* Add Tx Queue TEID into the VSI Tx ring from the
@@ -964,7 +964,7 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
	} else if (status) {
		dev_dbg(ice_pf_to_dev(vsi->back), "Failed to disable LAN Tx queues, error: %d\n",
			status);
		return -ENODEV;
		return status;
	}

	return 0;
+3 −4
Original line number Diff line number Diff line
@@ -270,7 +270,6 @@ static int ice_devlink_info_get(struct devlink *devlink,
		dev_dbg(dev, "Failed to discover device capabilities, status %d aq_err %s\n",
			err, ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Unable to discover device capabilities");
		err = -EIO;
		goto out_free_ctx;
	}

@@ -776,7 +775,7 @@ static int ice_devlink_nvm_snapshot(struct devlink *devlink,
			status, hw->adminq.sq_last_status);
		NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore");
		vfree(nvm_data);
		return -EIO;
		return status;
	}

	status = ice_read_flat_nvm(hw, 0, &nvm_size, nvm_data, false);
@@ -786,7 +785,7 @@ static int ice_devlink_nvm_snapshot(struct devlink *devlink,
		NL_SET_ERR_MSG_MOD(extack, "Failed to read NVM contents");
		ice_release_nvm(hw);
		vfree(nvm_data);
		return -EIO;
		return status;
	}

	ice_release_nvm(hw);
@@ -832,7 +831,7 @@ ice_devlink_devcaps_snapshot(struct devlink *devlink,
			status, hw->adminq.sq_last_status);
		NL_SET_ERR_MSG_MOD(extack, "Failed to read device capabilities");
		vfree(devcaps);
		return -EIO;
		return status;
	}

	*data = (u8 *)devcaps;
+12 −25
Original line number Diff line number Diff line
@@ -288,7 +288,6 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
	if (ret) {
		dev_err(dev, "ice_acquire_nvm failed, err %d aq_err %s\n",
			ret, ice_aq_str(hw->adminq.sq_last_status));
		ret = -EIO;
		goto out;
	}

@@ -297,7 +296,6 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
	if (ret) {
		dev_err(dev, "ice_read_flat_nvm failed, err %d aq_err %s\n",
			ret, ice_aq_str(hw->adminq.sq_last_status));
		ret = -EIO;
		goto release;
	}

@@ -1077,10 +1075,8 @@ ice_get_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam)

	err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
				  caps, NULL);
	if (err) {
		err = -EAGAIN;
	if (err)
		goto done;
	}

	/* Set supported/configured FEC modes based on PHY capability */
	if (caps->caps & ICE_AQC_PHY_EN_AUTO_FEC)
@@ -1987,10 +1983,8 @@ ice_get_link_ksettings(struct net_device *netdev,

	err = ice_aq_get_phy_caps(vsi->port_info, false,
				  ICE_AQC_REPORT_ACTIVE_CFG, caps, NULL);
	if (err) {
		err = -EIO;
	if (err)
		goto done;
	}

	/* Set the advertised flow control based on the PHY capability */
	if ((caps->caps & ICE_AQC_PHY_EN_TX_LINK_PAUSE) &&
@@ -2024,10 +2018,8 @@ ice_get_link_ksettings(struct net_device *netdev,

	err = ice_aq_get_phy_caps(vsi->port_info, false,
				  ICE_AQC_REPORT_TOPO_CAP_MEDIA, caps, NULL);
	if (err) {
		err = -EIO;
	if (err)
		goto done;
	}

	/* Set supported FEC modes based on PHY capability */
	ethtool_link_ksettings_add_link_mode(ks, supported, FEC_NONE);
@@ -2233,10 +2225,8 @@ ice_set_link_ksettings(struct net_device *netdev,
	else
		err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
					  phy_caps, NULL);
	if (err) {
		err = -EIO;
	if (err)
		goto done;
	}

	/* save autoneg out of ksettings */
	autoneg = copy_ks.base.autoneg;
@@ -2303,10 +2293,8 @@ ice_set_link_ksettings(struct net_device *netdev,
	/* Call to get the current link speed */
	pi->phy.get_link_info = true;
	err = ice_get_link_status(pi, &linkup);
	if (err) {
		err = -EIO;
	if (err)
		goto done;
	}

	curr_link_speed = pi->phy.link_info.link_speed;
	adv_link_speed = ice_ksettings_find_adv_link_speed(ks);
@@ -2378,7 +2366,6 @@ ice_set_link_ksettings(struct net_device *netdev,
	err = ice_aq_set_phy_cfg(&pf->hw, pi, &config, NULL);
	if (err) {
		netdev_info(netdev, "Set phy config failed,\n");
		err = -EIO;
		goto done;
	}

@@ -2546,7 +2533,7 @@ ice_set_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
	if (status) {
		dev_dbg(dev, "ice_add_rss_cfg failed, vsi num = %d, error = %d\n",
			vsi->vsi_num, status);
		return -EINVAL;
		return status;
	}

	return 0;
@@ -3030,7 +3017,7 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
				  NULL);
	if (err) {
		kfree(pcaps);
		return -EIO;
		return err;
	}

	is_an = ice_is_phy_caps_an_enabled(pcaps) ? AUTONEG_ENABLE :
@@ -3927,7 +3914,7 @@ ice_get_module_info(struct net_device *netdev,
	status = ice_aq_sff_eeprom(hw, 0, ICE_I2C_EEPROM_DEV_ADDR, 0x00, 0x00,
				   0, &value, 1, 0, NULL);
	if (status)
		return -EIO;
		return status;

	switch (value) {
	case ICE_MODULE_TYPE_SFP:
@@ -3935,12 +3922,12 @@ ice_get_module_info(struct net_device *netdev,
					   ICE_MODULE_SFF_8472_COMP, 0x00, 0,
					   &sff8472_comp, 1, 0, NULL);
		if (status)
			return -EIO;
			return status;
		status = ice_aq_sff_eeprom(hw, 0, ICE_I2C_EEPROM_DEV_ADDR,
					   ICE_MODULE_SFF_8472_SWAP, 0x00, 0,
					   &sff8472_swap, 1, 0, NULL);
		if (status)
			return -EIO;
			return status;

		if (sff8472_swap & ICE_MODULE_SFF_ADDR_MODE) {
			modinfo->type = ETH_MODULE_SFF_8079;
@@ -3960,7 +3947,7 @@ ice_get_module_info(struct net_device *netdev,
					   ICE_MODULE_REVISION_ADDR, 0x00, 0,
					   &sff8636_rev, 1, 0, NULL);
		if (status)
			return -EIO;
			return status;
		/* Check revision compliance */
		if (sff8636_rev > 0x02) {
			/* Module is SFF-8636 compliant */
@@ -4007,7 +3994,7 @@ ice_get_module_eeprom(struct net_device *netdev,
	status = ice_aq_sff_eeprom(hw, 0, addr, offset, page, 0, value, 1, 0,
				   NULL);
	if (status)
		return -EIO;
		return status;

	if (value[0] == ICE_MODULE_TYPE_SFP)
		is_sfp = true;
+3 −3
Original line number Diff line number Diff line
@@ -690,7 +690,7 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw,
		dev_err(dev, "Failed to acquire device flash lock, err %d aq_err %s\n",
			err, ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Failed to acquire device flash lock");
		return -EIO;
		return err;
	}

	err = pldmfw_flash_image(&priv.context, fw);
@@ -744,7 +744,7 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
	if (err) {
		NL_SET_ERR_MSG_MOD(extack, "Unable to read device capabilities");
		kfree(dev_caps);
		return -EIO;
		return err;
	}

	if (dev_caps->common_cap.nvm_update_pending_nvm) {
@@ -794,7 +794,7 @@ int ice_check_for_pending_update(struct ice_pf *pf, const char *component,
		dev_err(dev, "Failed to acquire device flash lock, err %d aq_err %s\n",
			err, ice_aq_str(hw->adminq.sq_last_status));
		NL_SET_ERR_MSG_MOD(extack, "Failed to acquire device flash lock");
		return -EIO;
		return err;
	}

	pending |= ICE_AQC_NVM_REVERT_LAST_ACTIV;
+6 −11
Original line number Diff line number Diff line
@@ -1764,7 +1764,6 @@ int ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)
	} else {
		dev_err(dev, "Error removing VLAN %d on vsi %i error: %d\n",
			vid, vsi->vsi_num, err);
		err = -EIO;
	}

	return err;
@@ -2127,7 +2126,6 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi)
	if (ret) {
		dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN insert failed, err %d aq_err %s\n",
			ret, ice_aq_str(hw->adminq.sq_last_status));
		ret = -EIO;
		goto out;
	}

@@ -2178,7 +2176,6 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
	if (ret) {
		dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN strip failed, ena = %d err %d aq_err %s\n",
			ena, ret, ice_aq_str(hw->adminq.sq_last_status));
		ret = -EIO;
		goto out;
	}

@@ -3700,7 +3697,6 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
	ret = ice_update_vsi(&pf->hw, vsi->idx, ctx, NULL);
	if (ret) {
		dev_info(dev, "Failed VSI Update\n");
		ret = -EIO;
		goto out;
	}

@@ -3714,7 +3710,6 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
	if (ret) {
		dev_err(dev, "VSI %d failed TC config, error %d\n",
			vsi->vsi_num, ret);
		ret = -EIO;
		goto out;
	}
	ice_vsi_update_q_map(vsi, ctx);
@@ -3833,7 +3828,7 @@ int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi)
	if (status) {
		dev_err(dev, "Failed to set VSI %d as the default forwarding VSI, error %d\n",
			vsi->vsi_num, status);
		return -EIO;
		return status;
	}

	sw->dflt_vsi = vsi;
@@ -3972,7 +3967,7 @@ int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate)
			dev_err(dev, "failed to set min Tx rate(%llu Kbps) for %s %d\n",
				min_tx_rate, ice_vsi_type_str(vsi->type),
				vsi->idx);
			return -EIO;
			return status;
		}

		dev_dbg(dev, "set min Tx rate(%llu Kbps) for %s\n",
@@ -3984,7 +3979,7 @@ int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate)
		if (status) {
			dev_err(dev, "failed to clear min Tx rate configuration for %s %d\n",
				ice_vsi_type_str(vsi->type), vsi->idx);
			return -EIO;
			return status;
		}

		dev_dbg(dev, "cleared min Tx rate configuration for %s %d\n",
@@ -4033,7 +4028,7 @@ int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate)
			dev_err(dev, "failed setting max Tx rate(%llu Kbps) for %s %d\n",
				max_tx_rate, ice_vsi_type_str(vsi->type),
				vsi->idx);
			return -EIO;
			return status;
		}

		dev_dbg(dev, "set max Tx rate(%llu Kbps) for %s %d\n",
@@ -4045,7 +4040,7 @@ int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate)
		if (status) {
			dev_err(dev, "failed clearing max Tx rate configuration for %s %d\n",
				ice_vsi_type_str(vsi->type), vsi->idx);
			return -EIO;
			return status;
		}

		dev_dbg(dev, "cleared max Tx rate configuration for %s %d\n",
@@ -4086,7 +4081,7 @@ int ice_set_link(struct ice_vsi *vsi, bool ena)
		dev_err(dev, "can't set link to %s, err %d aq_err %s\n",
			(ena ? "ON" : "OFF"), status,
			ice_aq_str(hw->adminq.sq_last_status));
		return -EIO;
		return status;
	}

	return 0;
Loading