diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_sched.c')
| -rw-r--r-- | drivers/net/ethernet/intel/ice/ice_sched.c | 402 | 
1 files changed, 199 insertions, 203 deletions
| diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c index ce3c7bded4cb..7947223536e3 100644 --- a/drivers/net/ethernet/intel/ice/ice_sched.c +++ b/drivers/net/ethernet/intel/ice/ice_sched.c @@ -11,7 +11,7 @@   * This function inserts the root node of the scheduling tree topology   * to the SW DB.   */ -static enum ice_status +static int  ice_sched_add_root_node(struct ice_port_info *pi,  			struct ice_aqc_txsched_elem_data *info)  { @@ -19,20 +19,20 @@ ice_sched_add_root_node(struct ice_port_info *pi,  	struct ice_hw *hw;  	if (!pi) -		return ICE_ERR_PARAM; +		return -EINVAL;  	hw = pi->hw;  	root = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*root), GFP_KERNEL);  	if (!root) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	/* coverity[suspicious_sizeof] */  	root->children = devm_kcalloc(ice_hw_to_dev(hw), hw->max_children[0],  				      sizeof(*root), GFP_KERNEL);  	if (!root->children) {  		devm_kfree(ice_hw_to_dev(hw), root); -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	}  	memcpy(&root->info, info, sizeof(*info)); @@ -96,14 +96,14 @@ ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid)   *   * This function sends a scheduling elements cmd (cmd_opc)   */ -static enum ice_status +static int  ice_aqc_send_sched_elem_cmd(struct ice_hw *hw, enum ice_adminq_opc cmd_opc,  			    u16 elems_req, void *buf, u16 buf_size,  			    u16 *elems_resp, struct ice_sq_cd *cd)  {  	struct ice_aqc_sched_elem_cmd *cmd;  	struct ice_aq_desc desc; -	enum ice_status status; +	int status;  	cmd = &desc.params.sched_elem_cmd;  	ice_fill_dflt_direct_cmd_desc(&desc, cmd_opc); @@ -127,7 +127,7 @@ ice_aqc_send_sched_elem_cmd(struct ice_hw *hw, enum ice_adminq_opc cmd_opc,   *   * Query scheduling elements (0x0404)   */ -enum ice_status +int  ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,  			 struct ice_aqc_txsched_elem_data *buf, u16 buf_size,  			 u16 *elems_ret, struct ice_sq_cd *cd) @@ -145,18 +145,18 @@ ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,   *   * This function inserts a scheduler node to the SW DB.   */ -enum ice_status +int  ice_sched_add_node(struct ice_port_info *pi, u8 layer,  		   struct ice_aqc_txsched_elem_data *info)  {  	struct ice_aqc_txsched_elem_data elem;  	struct ice_sched_node *parent;  	struct ice_sched_node *node; -	enum ice_status status;  	struct ice_hw *hw; +	int status;  	if (!pi) -		return ICE_ERR_PARAM; +		return -EINVAL;  	hw = pi->hw; @@ -166,7 +166,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,  	if (!parent) {  		ice_debug(hw, ICE_DBG_SCHED, "Parent Node not found for parent_teid=0x%x\n",  			  le32_to_cpu(info->parent_teid)); -		return ICE_ERR_PARAM; +		return -EINVAL;  	}  	/* query the current node information from FW before adding it @@ -178,7 +178,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,  	node = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*node), GFP_KERNEL);  	if (!node) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	if (hw->max_children[layer]) {  		/* coverity[suspicious_sizeof] */  		node->children = devm_kcalloc(ice_hw_to_dev(hw), @@ -186,7 +186,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,  					      sizeof(*node), GFP_KERNEL);  		if (!node->children) {  			devm_kfree(ice_hw_to_dev(hw), node); -			return ICE_ERR_NO_MEMORY; +			return -ENOMEM;  		}  	} @@ -209,7 +209,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,   *   * Delete scheduling elements (0x040F)   */ -static enum ice_status +static int  ice_aq_delete_sched_elems(struct ice_hw *hw, u16 grps_req,  			  struct ice_aqc_delete_elem *buf, u16 buf_size,  			  u16 *grps_del, struct ice_sq_cd *cd) @@ -228,19 +228,19 @@ ice_aq_delete_sched_elems(struct ice_hw *hw, u16 grps_req,   *   * This function remove nodes from HW   */ -static enum ice_status +static int  ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent,  		       u16 num_nodes, u32 *node_teids)  {  	struct ice_aqc_delete_elem *buf;  	u16 i, num_groups_removed = 0; -	enum ice_status status;  	u16 buf_size; +	int status;  	buf_size = struct_size(buf, teid, num_nodes);  	buf = devm_kzalloc(ice_hw_to_dev(hw), buf_size, GFP_KERNEL);  	if (!buf) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	buf->hdr.parent_teid = parent->info.node_teid;  	buf->hdr.num_elems = cpu_to_le16(num_nodes); @@ -369,14 +369,14 @@ void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node)   *   * Get default scheduler topology (0x400)   */ -static enum ice_status +static int  ice_aq_get_dflt_topo(struct ice_hw *hw, u8 lport,  		     struct ice_aqc_get_topo_elem *buf, u16 buf_size,  		     u8 *num_branches, struct ice_sq_cd *cd)  {  	struct ice_aqc_get_topo *cmd;  	struct ice_aq_desc desc; -	enum ice_status status; +	int status;  	cmd = &desc.params.get_topo;  	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_dflt_topo); @@ -399,7 +399,7 @@ ice_aq_get_dflt_topo(struct ice_hw *hw, u8 lport,   *   * Add scheduling elements (0x0401)   */ -static enum ice_status +static int  ice_aq_add_sched_elems(struct ice_hw *hw, u16 grps_req,  		       struct ice_aqc_add_elem *buf, u16 buf_size,  		       u16 *grps_added, struct ice_sq_cd *cd) @@ -420,7 +420,7 @@ ice_aq_add_sched_elems(struct ice_hw *hw, u16 grps_req,   *   * Configure scheduling elements (0x0403)   */ -static enum ice_status +static int  ice_aq_cfg_sched_elems(struct ice_hw *hw, u16 elems_req,  		       struct ice_aqc_txsched_elem_data *buf, u16 buf_size,  		       u16 *elems_cfgd, struct ice_sq_cd *cd) @@ -441,7 +441,7 @@ ice_aq_cfg_sched_elems(struct ice_hw *hw, u16 elems_req,   *   * Move scheduling elements (0x0408)   */ -static enum ice_status +static int  ice_aq_move_sched_elems(struct ice_hw *hw, u16 grps_req,  			struct ice_aqc_move_elem *buf, u16 buf_size,  			u16 *grps_movd, struct ice_sq_cd *cd) @@ -462,7 +462,7 @@ ice_aq_move_sched_elems(struct ice_hw *hw, u16 grps_req,   *   * Suspend scheduling elements (0x0409)   */ -static enum ice_status +static int  ice_aq_suspend_sched_elems(struct ice_hw *hw, u16 elems_req, __le32 *buf,  			   u16 buf_size, u16 *elems_ret, struct ice_sq_cd *cd)  { @@ -482,7 +482,7 @@ ice_aq_suspend_sched_elems(struct ice_hw *hw, u16 elems_req, __le32 *buf,   *   * resume scheduling elements (0x040A)   */ -static enum ice_status +static int  ice_aq_resume_sched_elems(struct ice_hw *hw, u16 elems_req, __le32 *buf,  			  u16 buf_size, u16 *elems_ret, struct ice_sq_cd *cd)  { @@ -500,7 +500,7 @@ ice_aq_resume_sched_elems(struct ice_hw *hw, u16 elems_req, __le32 *buf,   *   * Query scheduler resource allocation (0x0412)   */ -static enum ice_status +static int  ice_aq_query_sched_res(struct ice_hw *hw, u16 buf_size,  		       struct ice_aqc_query_txsched_res_resp *buf,  		       struct ice_sq_cd *cd) @@ -520,18 +520,18 @@ ice_aq_query_sched_res(struct ice_hw *hw, u16 buf_size,   *   * This function suspends or resumes HW nodes   */ -static enum ice_status +static int  ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,  			       bool suspend)  {  	u16 i, buf_size, num_elem_ret = 0; -	enum ice_status status;  	__le32 *buf; +	int status;  	buf_size = sizeof(*buf) * num_nodes;  	buf = devm_kzalloc(ice_hw_to_dev(hw), buf_size, GFP_KERNEL);  	if (!buf) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	for (i = 0; i < num_nodes; i++)  		buf[i] = cpu_to_le32(node_teids[i]); @@ -558,7 +558,7 @@ ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,   * @tc: TC number   * @new_numqs: number of queues   */ -static enum ice_status +static int  ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  {  	struct ice_vsi_ctx *vsi_ctx; @@ -566,7 +566,7 @@ ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  	vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);  	if (!vsi_ctx) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* allocate LAN queue contexts */  	if (!vsi_ctx->lan_q_ctx[tc]) {  		vsi_ctx->lan_q_ctx[tc] = devm_kcalloc(ice_hw_to_dev(hw), @@ -574,7 +574,7 @@ ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  						      sizeof(*q_ctx),  						      GFP_KERNEL);  		if (!vsi_ctx->lan_q_ctx[tc]) -			return ICE_ERR_NO_MEMORY; +			return -ENOMEM;  		vsi_ctx->num_lan_q_entries[tc] = new_numqs;  		return 0;  	} @@ -585,7 +585,7 @@ ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  		q_ctx = devm_kcalloc(ice_hw_to_dev(hw), new_numqs,  				     sizeof(*q_ctx), GFP_KERNEL);  		if (!q_ctx) -			return ICE_ERR_NO_MEMORY; +			return -ENOMEM;  		memcpy(q_ctx, vsi_ctx->lan_q_ctx[tc],  		       prev_num * sizeof(*q_ctx));  		devm_kfree(ice_hw_to_dev(hw), vsi_ctx->lan_q_ctx[tc]); @@ -602,7 +602,7 @@ ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)   * @tc: TC number   * @new_numqs: number of queues   */ -static enum ice_status +static int  ice_alloc_rdma_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  {  	struct ice_vsi_ctx *vsi_ctx; @@ -610,7 +610,7 @@ ice_alloc_rdma_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  	vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);  	if (!vsi_ctx) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* allocate RDMA queue contexts */  	if (!vsi_ctx->rdma_q_ctx[tc]) {  		vsi_ctx->rdma_q_ctx[tc] = devm_kcalloc(ice_hw_to_dev(hw), @@ -618,7 +618,7 @@ ice_alloc_rdma_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  						       sizeof(*q_ctx),  						       GFP_KERNEL);  		if (!vsi_ctx->rdma_q_ctx[tc]) -			return ICE_ERR_NO_MEMORY; +			return -ENOMEM;  		vsi_ctx->num_rdma_q_entries[tc] = new_numqs;  		return 0;  	} @@ -629,7 +629,7 @@ ice_alloc_rdma_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)  		q_ctx = devm_kcalloc(ice_hw_to_dev(hw), new_numqs,  				     sizeof(*q_ctx), GFP_KERNEL);  		if (!q_ctx) -			return ICE_ERR_NO_MEMORY; +			return -ENOMEM;  		memcpy(q_ctx, vsi_ctx->rdma_q_ctx[tc],  		       prev_num * sizeof(*q_ctx));  		devm_kfree(ice_hw_to_dev(hw), vsi_ctx->rdma_q_ctx[tc]); @@ -651,14 +651,14 @@ ice_alloc_rdma_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)   *   * RL profile function to add, query, or remove profile(s)   */ -static enum ice_status +static int  ice_aq_rl_profile(struct ice_hw *hw, enum ice_adminq_opc opcode,  		  u16 num_profiles, struct ice_aqc_rl_profile_elem *buf,  		  u16 buf_size, u16 *num_processed, struct ice_sq_cd *cd)  {  	struct ice_aqc_rl_profile *cmd;  	struct ice_aq_desc desc; -	enum ice_status status; +	int status;  	cmd = &desc.params.rl_profile; @@ -682,7 +682,7 @@ ice_aq_rl_profile(struct ice_hw *hw, enum ice_adminq_opc opcode,   *   * Add RL profile (0x0410)   */ -static enum ice_status +static int  ice_aq_add_rl_profile(struct ice_hw *hw, u16 num_profiles,  		      struct ice_aqc_rl_profile_elem *buf, u16 buf_size,  		      u16 *num_profiles_added, struct ice_sq_cd *cd) @@ -702,7 +702,7 @@ ice_aq_add_rl_profile(struct ice_hw *hw, u16 num_profiles,   *   * Remove RL profile (0x0415)   */ -static enum ice_status +static int  ice_aq_remove_rl_profile(struct ice_hw *hw, u16 num_profiles,  			 struct ice_aqc_rl_profile_elem *buf, u16 buf_size,  			 u16 *num_profiles_removed, struct ice_sq_cd *cd) @@ -721,24 +721,24 @@ ice_aq_remove_rl_profile(struct ice_hw *hw, u16 num_profiles,   * its associated parameters from HW DB,and locally. The caller needs to   * hold scheduler lock.   */ -static enum ice_status +static int  ice_sched_del_rl_profile(struct ice_hw *hw,  			 struct ice_aqc_rl_profile_info *rl_info)  {  	struct ice_aqc_rl_profile_elem *buf;  	u16 num_profiles_removed; -	enum ice_status status;  	u16 num_profiles = 1; +	int status;  	if (rl_info->prof_id_ref != 0) -		return ICE_ERR_IN_USE; +		return -EBUSY;  	/* Safe to remove profile ID */  	buf = &rl_info->profile;  	status = ice_aq_remove_rl_profile(hw, num_profiles, buf, sizeof(*buf),  					  &num_profiles_removed, NULL);  	if (status || num_profiles_removed != num_profiles) -		return ICE_ERR_CFG; +		return -EIO;  	/* Delete stale entry now */  	list_del(&rl_info->list_entry); @@ -763,7 +763,7 @@ static void ice_sched_clear_rl_prof(struct ice_port_info *pi)  		list_for_each_entry_safe(rl_prof_elem, rl_prof_tmp,  					 &pi->rl_prof_list[ln], list_entry) {  			struct ice_hw *hw = pi->hw; -			enum ice_status status; +			int status;  			rl_prof_elem->prof_id_ref = 0;  			status = ice_sched_del_rl_profile(hw, rl_prof_elem); @@ -875,7 +875,7 @@ void ice_sched_cleanup_all(struct ice_hw *hw)   *   * This function add nodes to HW as well as to SW DB for a given layer   */ -static enum ice_status +static int  ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,  		    struct ice_sched_node *parent, u8 layer, u16 num_nodes,  		    u16 *num_nodes_added, u32 *first_node_teid) @@ -883,15 +883,15 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,  	struct ice_sched_node *prev, *new_node;  	struct ice_aqc_add_elem *buf;  	u16 i, num_groups_added = 0; -	enum ice_status status = 0;  	struct ice_hw *hw = pi->hw;  	size_t buf_size; +	int status = 0;  	u32 teid;  	buf_size = struct_size(buf, generic, num_nodes);  	buf = devm_kzalloc(ice_hw_to_dev(hw), buf_size, GFP_KERNEL);  	if (!buf) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	buf->hdr.parent_teid = parent->info.node_teid;  	buf->hdr.num_elems = cpu_to_le16(num_nodes); @@ -918,7 +918,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,  		ice_debug(hw, ICE_DBG_SCHED, "add node failed FW Error %d\n",  			  hw->adminq.sq_last_status);  		devm_kfree(ice_hw_to_dev(hw), buf); -		return ICE_ERR_CFG; +		return -EIO;  	}  	*num_nodes_added = num_nodes; @@ -974,7 +974,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,   *   * Add nodes into specific HW layer.   */ -static enum ice_status +static int  ice_sched_add_nodes_to_hw_layer(struct ice_port_info *pi,  				struct ice_sched_node *tc_node,  				struct ice_sched_node *parent, u8 layer, @@ -989,7 +989,7 @@ ice_sched_add_nodes_to_hw_layer(struct ice_port_info *pi,  		return 0;  	if (!parent || layer < pi->hw->sw_entry_point_layer) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* max children per node per layer */  	max_child_nodes = pi->hw->max_children[parent->tx_sched_layer]; @@ -998,8 +998,8 @@ ice_sched_add_nodes_to_hw_layer(struct ice_port_info *pi,  	if ((parent->num_children + num_nodes) > max_child_nodes) {  		/* Fail if the parent is a TC node */  		if (parent == tc_node) -			return ICE_ERR_CFG; -		return ICE_ERR_MAX_LIMIT; +			return -EIO; +		return -ENOSPC;  	}  	return ice_sched_add_elems(pi, tc_node, parent, layer, num_nodes, @@ -1018,7 +1018,7 @@ ice_sched_add_nodes_to_hw_layer(struct ice_port_info *pi,   *   * This function add nodes to a given layer.   */ -static enum ice_status +static int  ice_sched_add_nodes_to_layer(struct ice_port_info *pi,  			     struct ice_sched_node *tc_node,  			     struct ice_sched_node *parent, u8 layer, @@ -1027,7 +1027,7 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi,  {  	u32 *first_teid_ptr = first_node_teid;  	u16 new_num_nodes = num_nodes; -	enum ice_status status = 0; +	int status = 0;  	*num_nodes_added = 0;  	while (*num_nodes_added < num_nodes) { @@ -1045,14 +1045,14 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi,  		if (*num_nodes_added > num_nodes) {  			ice_debug(pi->hw, ICE_DBG_SCHED, "added extra nodes %d %d\n", num_nodes,  				  *num_nodes_added); -			status = ICE_ERR_CFG; +			status = -EIO;  			break;  		}  		/* break if all the nodes are added successfully */  		if (!status && (*num_nodes_added == num_nodes))  			break;  		/* break if the error is not max limit */ -		if (status && status != ICE_ERR_MAX_LIMIT) +		if (status && status != -ENOSPC)  			break;  		/* Exceeded the max children */  		max_child_nodes = pi->hw->max_children[parent->tx_sched_layer]; @@ -1152,7 +1152,7 @@ static void ice_rm_dflt_leaf_node(struct ice_port_info *pi)  	}  	if (node && node->info.data.elem_type == ICE_AQC_ELEM_TYPE_LEAF) {  		u32 teid = le32_to_cpu(node->info.node_teid); -		enum ice_status status; +		int status;  		/* remove the default leaf node */  		status = ice_sched_remove_elems(pi->hw, node->parent, 1, &teid); @@ -1198,23 +1198,23 @@ static void ice_sched_rm_dflt_nodes(struct ice_port_info *pi)   * resources, default topology created by firmware and storing the information   * in SW DB.   */ -enum ice_status ice_sched_init_port(struct ice_port_info *pi) +int ice_sched_init_port(struct ice_port_info *pi)  {  	struct ice_aqc_get_topo_elem *buf; -	enum ice_status status;  	struct ice_hw *hw;  	u8 num_branches;  	u16 num_elems; +	int status;  	u8 i, j;  	if (!pi) -		return ICE_ERR_PARAM; +		return -EINVAL;  	hw = pi->hw;  	/* Query the Default Topology from FW */  	buf = devm_kzalloc(ice_hw_to_dev(hw), ICE_AQ_MAX_BUF_LEN, GFP_KERNEL);  	if (!buf) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	/* Query default scheduling tree topology */  	status = ice_aq_get_dflt_topo(hw, pi->lport, buf, ICE_AQ_MAX_BUF_LEN, @@ -1226,7 +1226,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi)  	if (num_branches < 1 || num_branches > ICE_TXSCHED_MAX_BRANCHES) {  		ice_debug(hw, ICE_DBG_SCHED, "num_branches unexpected %d\n",  			  num_branches); -		status = ICE_ERR_PARAM; +		status = -EINVAL;  		goto err_init_port;  	} @@ -1237,7 +1237,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi)  	if (num_elems < 1 || num_elems > ICE_AQC_TOPO_MAX_LEVEL_NUM) {  		ice_debug(hw, ICE_DBG_SCHED, "num_elems unexpected %d\n",  			  num_elems); -		status = ICE_ERR_PARAM; +		status = -EINVAL;  		goto err_init_port;  	} @@ -1300,11 +1300,11 @@ err_init_port:   *   * query FW for allocated scheduler resources and store in HW struct   */ -enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw) +int ice_sched_query_res_alloc(struct ice_hw *hw)  {  	struct ice_aqc_query_txsched_res_resp *buf; -	enum ice_status status = 0;  	__le16 max_sibl; +	int status = 0;  	u16 i;  	if (hw->layer_info) @@ -1312,7 +1312,7 @@ enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw)  	buf = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*buf), GFP_KERNEL);  	if (!buf) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	status = ice_aq_query_sched_res(hw, sizeof(*buf), buf, NULL);  	if (status) @@ -1341,7 +1341,7 @@ enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw)  				       sizeof(*hw->layer_info)),  				      GFP_KERNEL);  	if (!hw->layer_info) { -		status = ICE_ERR_NO_MEMORY; +		status = -ENOMEM;  		goto sched_query_out;  	} @@ -1614,31 +1614,31 @@ ice_sched_calc_vsi_child_nodes(struct ice_hw *hw, u16 num_qs, u16 *num_nodes)   * This function adds the VSI child nodes to tree. It gets called for   * LAN and RDMA separately.   */ -static enum ice_status +static int  ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,  			      struct ice_sched_node *tc_node, u16 *num_nodes,  			      u8 owner)  {  	struct ice_sched_node *parent, *node;  	struct ice_hw *hw = pi->hw; -	enum ice_status status;  	u32 first_node_teid;  	u16 num_added = 0;  	u8 i, qgl, vsil; +	int status;  	qgl = ice_sched_get_qgrp_layer(hw);  	vsil = ice_sched_get_vsi_layer(hw);  	parent = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);  	for (i = vsil + 1; i <= qgl; i++) {  		if (!parent) -			return ICE_ERR_CFG; +			return -EIO;  		status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,  						      num_nodes[i],  						      &first_node_teid,  						      &num_added);  		if (status || num_nodes[i] != num_added) -			return ICE_ERR_CFG; +			return -EIO;  		/* The newly added node can be a new parent for the next  		 * layer nodes @@ -1717,18 +1717,18 @@ ice_sched_calc_vsi_support_nodes(struct ice_port_info *pi,   * This function adds the VSI supported nodes into Tx tree including the   * VSI, its parent and intermediate nodes in below layers   */ -static enum ice_status +static int  ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,  				struct ice_sched_node *tc_node, u16 *num_nodes)  {  	struct ice_sched_node *parent = tc_node; -	enum ice_status status;  	u32 first_node_teid;  	u16 num_added = 0;  	u8 i, vsil; +	int status;  	if (!pi) -		return ICE_ERR_PARAM; +		return -EINVAL;  	vsil = ice_sched_get_vsi_layer(pi->hw);  	for (i = pi->hw->sw_entry_point_layer; i <= vsil; i++) { @@ -1737,7 +1737,7 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,  						      &first_node_teid,  						      &num_added);  		if (status || num_nodes[i] != num_added) -			return ICE_ERR_CFG; +			return -EIO;  		/* The newly added node can be a new parent for the next  		 * layer nodes @@ -1749,7 +1749,7 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,  			parent = parent->children[0];  		if (!parent) -			return ICE_ERR_CFG; +			return -EIO;  		if (i == vsil)  			parent->vsi_handle = vsi_handle; @@ -1766,7 +1766,7 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,   *   * This function adds a new VSI into scheduler tree   */ -static enum ice_status +static int  ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc)  {  	u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; @@ -1774,7 +1774,7 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc)  	tc_node = ice_sched_get_tc_node(pi, tc);  	if (!tc_node) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* calculate number of supported nodes needed for this VSI */  	ice_sched_calc_vsi_support_nodes(pi, tc_node, num_nodes); @@ -1794,7 +1794,7 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc)   *   * This function updates the VSI child nodes based on the number of queues   */ -static enum ice_status +static int  ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,  				 u8 tc, u16 new_numqs, u8 owner)  { @@ -1802,21 +1802,21 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,  	struct ice_sched_node *vsi_node;  	struct ice_sched_node *tc_node;  	struct ice_vsi_ctx *vsi_ctx; -	enum ice_status status = 0;  	struct ice_hw *hw = pi->hw;  	u16 prev_numqs; +	int status = 0;  	tc_node = ice_sched_get_tc_node(pi, tc);  	if (!tc_node) -		return ICE_ERR_CFG; +		return -EIO;  	vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);  	if (!vsi_node) -		return ICE_ERR_CFG; +		return -EIO;  	vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);  	if (!vsi_ctx) -		return ICE_ERR_PARAM; +		return -EINVAL;  	if (owner == ICE_SCHED_NODE_OWNER_LAN)  		prev_numqs = vsi_ctx->sched.max_lanq[tc]; @@ -1869,22 +1869,22 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,   * enabled and VSI is in suspended state then resume the VSI back. If TC is   * disabled then suspend the VSI if it is not already.   */ -enum ice_status +int  ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,  		  u8 owner, bool enable)  {  	struct ice_sched_node *vsi_node, *tc_node;  	struct ice_vsi_ctx *vsi_ctx; -	enum ice_status status = 0;  	struct ice_hw *hw = pi->hw; +	int status = 0;  	ice_debug(pi->hw, ICE_DBG_SCHED, "add/config VSI %d\n", vsi_handle);  	tc_node = ice_sched_get_tc_node(pi, tc);  	if (!tc_node) -		return ICE_ERR_PARAM; +		return -EINVAL;  	vsi_ctx = ice_get_vsi_ctx(hw, vsi_handle);  	if (!vsi_ctx) -		return ICE_ERR_PARAM; +		return -EINVAL;  	vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);  	/* suspend the VSI if TC is not enabled */ @@ -1908,7 +1908,7 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,  		vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);  		if (!vsi_node) -			return ICE_ERR_CFG; +			return -EIO;  		vsi_ctx->sched.vsi_node[tc] = vsi_node;  		vsi_node->in_use = true; @@ -1993,11 +1993,11 @@ static bool ice_sched_is_leaf_node_present(struct ice_sched_node *node)   * This function removes the VSI and its LAN or RDMA children nodes from the   * scheduler tree.   */ -static enum ice_status +static int  ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)  { -	enum ice_status status = ICE_ERR_PARAM;  	struct ice_vsi_ctx *vsi_ctx; +	int status = -EINVAL;  	u8 i;  	ice_debug(pi->hw, ICE_DBG_SCHED, "removing VSI %d\n", vsi_handle); @@ -2022,7 +2022,7 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)  		if (ice_sched_is_leaf_node_present(vsi_node)) {  			ice_debug(pi->hw, ICE_DBG_SCHED, "VSI has leaf nodes in TC %d\n", i); -			status = ICE_ERR_IN_USE; +			status = -EBUSY;  			goto exit_sched_rm_vsi_cfg;  		}  		while (j < vsi_node->num_children) { @@ -2065,7 +2065,7 @@ exit_sched_rm_vsi_cfg:   * This function clears the VSI and its LAN children nodes from scheduler tree   * for all TCs.   */ -enum ice_status ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle) +int ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle)  {  	return ice_sched_rm_vsi_cfg(pi, vsi_handle, ICE_SCHED_NODE_OWNER_LAN);  } @@ -2078,7 +2078,7 @@ enum ice_status ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle)   * This function clears the VSI and its RDMA children nodes from scheduler tree   * for all TCs.   */ -enum ice_status ice_rm_vsi_rdma_cfg(struct ice_port_info *pi, u16 vsi_handle) +int ice_rm_vsi_rdma_cfg(struct ice_port_info *pi, u16 vsi_handle)  {  	return ice_sched_rm_vsi_cfg(pi, vsi_handle, ICE_SCHED_NODE_OWNER_RDMA);  } @@ -2188,36 +2188,36 @@ ice_sched_update_parent(struct ice_sched_node *new_parent,   *   * This function move the child nodes to a given parent.   */ -static enum ice_status +static int  ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,  		     u16 num_items, u32 *list)  {  	struct ice_aqc_move_elem *buf;  	struct ice_sched_node *node; -	enum ice_status status = 0;  	u16 i, grps_movd = 0;  	struct ice_hw *hw; +	int status = 0;  	u16 buf_len;  	hw = pi->hw;  	if (!parent || !num_items) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* Does parent have enough space */  	if (parent->num_children + num_items >  	    hw->max_children[parent->tx_sched_layer]) -		return ICE_ERR_AQ_FULL; +		return -ENOSPC;  	buf_len = struct_size(buf, teid, 1);  	buf = kzalloc(buf_len, GFP_KERNEL);  	if (!buf) -		return ICE_ERR_NO_MEMORY; +		return -ENOMEM;  	for (i = 0; i < num_items; i++) {  		node = ice_sched_find_node_by_teid(pi->root, list[i]);  		if (!node) { -			status = ICE_ERR_PARAM; +			status = -EINVAL;  			goto move_err_exit;  		} @@ -2228,7 +2228,7 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,  		status = ice_aq_move_sched_elems(hw, 1, buf, buf_len,  						 &grps_movd, NULL);  		if (status && grps_movd != 1) { -			status = ICE_ERR_CFG; +			status = -EIO;  			goto move_err_exit;  		} @@ -2251,28 +2251,28 @@ move_err_exit:   * This function moves a VSI to an aggregator node or its subtree.   * Intermediate nodes may be created if required.   */ -static enum ice_status +static int  ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,  			  u8 tc)  {  	struct ice_sched_node *vsi_node, *agg_node, *tc_node, *parent;  	u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 };  	u32 first_node_teid, vsi_teid; -	enum ice_status status;  	u16 num_nodes_added;  	u8 aggl, vsil, i; +	int status;  	tc_node = ice_sched_get_tc_node(pi, tc);  	if (!tc_node) -		return ICE_ERR_CFG; +		return -EIO;  	agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);  	if (!agg_node) -		return ICE_ERR_DOES_NOT_EXIST; +		return -ENOENT;  	vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);  	if (!vsi_node) -		return ICE_ERR_DOES_NOT_EXIST; +		return -ENOENT;  	/* Is this VSI already part of given aggregator? */  	if (ice_sched_find_node_in_subtree(pi->hw, agg_node, vsi_node)) @@ -2302,7 +2302,7 @@ ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,  						      &first_node_teid,  						      &num_nodes_added);  		if (status || num_nodes[i] != num_nodes_added) -			return ICE_ERR_CFG; +			return -EIO;  		/* The newly added node can be a new parent for the next  		 * layer nodes @@ -2314,7 +2314,7 @@ ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,  			parent = parent->children[0];  		if (!parent) -			return ICE_ERR_CFG; +			return -EIO;  	}  move_nodes: @@ -2333,14 +2333,14 @@ move_nodes:   * aggregator VSI info based on passed in boolean parameter rm_vsi_info. The   * caller holds the scheduler lock.   */ -static enum ice_status +static int  ice_move_all_vsi_to_dflt_agg(struct ice_port_info *pi,  			     struct ice_sched_agg_info *agg_info, u8 tc,  			     bool rm_vsi_info)  {  	struct ice_sched_agg_vsi_info *agg_vsi_info;  	struct ice_sched_agg_vsi_info *tmp; -	enum ice_status status = 0; +	int status = 0;  	list_for_each_entry_safe(agg_vsi_info, tmp, &agg_info->agg_vsi_list,  				 list_entry) { @@ -2397,7 +2397,7 @@ ice_sched_is_agg_inuse(struct ice_port_info *pi, struct ice_sched_node *node)   * This function removes the aggregator node and intermediate nodes if any   * from the given TC   */ -static enum ice_status +static int  ice_sched_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)  {  	struct ice_sched_node *tc_node, *agg_node; @@ -2405,15 +2405,15 @@ ice_sched_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)  	tc_node = ice_sched_get_tc_node(pi, tc);  	if (!tc_node) -		return ICE_ERR_CFG; +		return -EIO;  	agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);  	if (!agg_node) -		return ICE_ERR_DOES_NOT_EXIST; +		return -ENOENT;  	/* Can't remove the aggregator node if it has children */  	if (ice_sched_is_agg_inuse(pi, agg_node)) -		return ICE_ERR_IN_USE; +		return -EBUSY;  	/* need to remove the whole subtree if aggregator node is the  	 * only child. @@ -2422,7 +2422,7 @@ ice_sched_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)  		struct ice_sched_node *parent = agg_node->parent;  		if (!parent) -			return ICE_ERR_CFG; +			return -EIO;  		if (parent->num_children > 1)  			break; @@ -2445,11 +2445,11 @@ ice_sched_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)   * the aggregator configuration completely for requested TC. The caller needs   * to hold the scheduler lock.   */ -static enum ice_status +static int  ice_rm_agg_cfg_tc(struct ice_port_info *pi, struct ice_sched_agg_info *agg_info,  		  u8 tc, bool rm_vsi_info)  { -	enum ice_status status = 0; +	int status = 0;  	/* If nothing to remove - return success */  	if (!ice_is_tc_ena(agg_info->tc_bitmap[0], tc)) @@ -2478,7 +2478,7 @@ exit_rm_agg_cfg_tc:   * Save aggregator TC bitmap. This function needs to be called with scheduler   * lock held.   */ -static enum ice_status +static int  ice_save_agg_tc_bitmap(struct ice_port_info *pi, u32 agg_id,  		       unsigned long *tc_bitmap)  { @@ -2486,7 +2486,7 @@ ice_save_agg_tc_bitmap(struct ice_port_info *pi, u32 agg_id,  	agg_info = ice_get_agg_info(pi->hw, agg_id);  	if (!agg_info) -		return ICE_ERR_PARAM; +		return -EINVAL;  	bitmap_copy(agg_info->replay_tc_bitmap, tc_bitmap,  		    ICE_MAX_TRAFFIC_CLASS);  	return 0; @@ -2501,20 +2501,20 @@ ice_save_agg_tc_bitmap(struct ice_port_info *pi, u32 agg_id,   * This function creates an aggregator node and intermediate nodes if required   * for the given TC   */ -static enum ice_status +static int  ice_sched_add_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)  {  	struct ice_sched_node *parent, *agg_node, *tc_node;  	u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM] = { 0 }; -	enum ice_status status = 0;  	struct ice_hw *hw = pi->hw;  	u32 first_node_teid;  	u16 num_nodes_added; +	int status = 0;  	u8 i, aggl;  	tc_node = ice_sched_get_tc_node(pi, tc);  	if (!tc_node) -		return ICE_ERR_CFG; +		return -EIO;  	agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);  	/* Does Agg node already exist ? */ @@ -2549,14 +2549,14 @@ ice_sched_add_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)  	parent = tc_node;  	for (i = hw->sw_entry_point_layer; i <= aggl; i++) {  		if (!parent) -			return ICE_ERR_CFG; +			return -EIO;  		status = ice_sched_add_nodes_to_layer(pi, tc_node, parent, i,  						      num_nodes[i],  						      &first_node_teid,  						      &num_nodes_added);  		if (status || num_nodes[i] != num_nodes_added) -			return ICE_ERR_CFG; +			return -EIO;  		/* The newly added node can be a new parent for the next  		 * layer nodes @@ -2591,13 +2591,13 @@ ice_sched_add_agg_cfg(struct ice_port_info *pi, u32 agg_id, u8 tc)   * resources and remove aggregator ID.   * This function needs to be called with scheduler lock held.   */ -static enum ice_status +static int  ice_sched_cfg_agg(struct ice_port_info *pi, u32 agg_id,  		  enum ice_agg_type agg_type, unsigned long *tc_bitmap)  {  	struct ice_sched_agg_info *agg_info; -	enum ice_status status = 0;  	struct ice_hw *hw = pi->hw; +	int status = 0;  	u8 tc;  	agg_info = ice_get_agg_info(hw, agg_id); @@ -2606,7 +2606,7 @@ ice_sched_cfg_agg(struct ice_port_info *pi, u32 agg_id,  		agg_info = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*agg_info),  					GFP_KERNEL);  		if (!agg_info) -			return ICE_ERR_NO_MEMORY; +			return -ENOMEM;  		agg_info->agg_id = agg_id;  		agg_info->agg_type = agg_type; @@ -2653,19 +2653,17 @@ ice_sched_cfg_agg(struct ice_port_info *pi, u32 agg_id,   *   * This function configures aggregator node(s).   */ -enum ice_status +int  ice_cfg_agg(struct ice_port_info *pi, u32 agg_id, enum ice_agg_type agg_type,  	    u8 tc_bitmap)  {  	unsigned long bitmap = tc_bitmap; -	enum ice_status status; +	int status;  	mutex_lock(&pi->sched_lock); -	status = ice_sched_cfg_agg(pi, agg_id, agg_type, -				   (unsigned long *)&bitmap); +	status = ice_sched_cfg_agg(pi, agg_id, agg_type, &bitmap);  	if (!status) -		status = ice_save_agg_tc_bitmap(pi, agg_id, -						(unsigned long *)&bitmap); +		status = ice_save_agg_tc_bitmap(pi, agg_id, &bitmap);  	mutex_unlock(&pi->sched_lock);  	return status;  } @@ -2724,7 +2722,7 @@ ice_get_vsi_agg_info(struct ice_hw *hw, u16 vsi_handle)   * Save VSI to aggregator TC bitmap. This function needs to call with scheduler   * lock held.   */ -static enum ice_status +static int  ice_save_agg_vsi_tc_bitmap(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,  			   unsigned long *tc_bitmap)  { @@ -2733,11 +2731,11 @@ ice_save_agg_vsi_tc_bitmap(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,  	agg_info = ice_get_agg_info(pi->hw, agg_id);  	if (!agg_info) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* check if entry already exist */  	agg_vsi_info = ice_get_agg_vsi_info(agg_info, vsi_handle);  	if (!agg_vsi_info) -		return ICE_ERR_PARAM; +		return -EINVAL;  	bitmap_copy(agg_vsi_info->replay_tc_bitmap, tc_bitmap,  		    ICE_MAX_TRAFFIC_CLASS);  	return 0; @@ -2754,21 +2752,21 @@ ice_save_agg_vsi_tc_bitmap(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,   * already associated to the aggregator node then no operation is performed on   * the tree. This function needs to be called with scheduler lock held.   */ -static enum ice_status +static int  ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,  			   u16 vsi_handle, unsigned long *tc_bitmap)  {  	struct ice_sched_agg_vsi_info *agg_vsi_info, *old_agg_vsi_info = NULL;  	struct ice_sched_agg_info *agg_info, *old_agg_info; -	enum ice_status status = 0;  	struct ice_hw *hw = pi->hw; +	int status = 0;  	u8 tc;  	if (!ice_is_vsi_valid(pi->hw, vsi_handle)) -		return ICE_ERR_PARAM; +		return -EINVAL;  	agg_info = ice_get_agg_info(hw, agg_id);  	if (!agg_info) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* If the VSI is already part of another aggregator then update  	 * its VSI info list  	 */ @@ -2790,7 +2788,7 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,  		agg_vsi_info = devm_kzalloc(ice_hw_to_dev(hw),  					    sizeof(*agg_vsi_info), GFP_KERNEL);  		if (!agg_vsi_info) -			return ICE_ERR_PARAM; +			return -EINVAL;  		/* add VSI ID into the aggregator list */  		agg_vsi_info->vsi_handle = vsi_handle; @@ -2851,14 +2849,14 @@ static void ice_sched_rm_unused_rl_prof(struct ice_port_info *pi)   * returns success or error on config sched element failure. The caller   * needs to hold scheduler lock.   */ -static enum ice_status +static int  ice_sched_update_elem(struct ice_hw *hw, struct ice_sched_node *node,  		      struct ice_aqc_txsched_elem_data *info)  {  	struct ice_aqc_txsched_elem_data buf; -	enum ice_status status;  	u16 elem_cfgd = 0;  	u16 num_elems = 1; +	int status;  	buf = *info;  	/* Parent TEID is reserved field in this aq call */ @@ -2874,7 +2872,7 @@ ice_sched_update_elem(struct ice_hw *hw, struct ice_sched_node *node,  					&elem_cfgd, NULL);  	if (status || elem_cfgd != num_elems) {  		ice_debug(hw, ICE_DBG_SCHED, "Config sched elem error\n"); -		return ICE_ERR_CFG; +		return -EIO;  	}  	/* Config success case */ @@ -2893,7 +2891,7 @@ ice_sched_update_elem(struct ice_hw *hw, struct ice_sched_node *node,   *   * This function configures node element's BW allocation.   */ -static enum ice_status +static int  ice_sched_cfg_node_bw_alloc(struct ice_hw *hw, struct ice_sched_node *node,  			    enum ice_rl_type rl_type, u16 bw_alloc)  { @@ -2909,7 +2907,7 @@ ice_sched_cfg_node_bw_alloc(struct ice_hw *hw, struct ice_sched_node *node,  		data->valid_sections |= ICE_AQC_ELEM_VALID_EIR;  		data->eir_bw.bw_alloc = cpu_to_le16(bw_alloc);  	} else { -		return ICE_ERR_PARAM; +		return -EINVAL;  	}  	/* Configure element */ @@ -2925,12 +2923,12 @@ ice_sched_cfg_node_bw_alloc(struct ice_hw *hw, struct ice_sched_node *node,   *   * Move or associate VSI to a new or default aggregator node.   */ -enum ice_status +int  ice_move_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, u16 vsi_handle,  		    u8 tc_bitmap)  {  	unsigned long bitmap = tc_bitmap; -	enum ice_status status; +	int status;  	mutex_lock(&pi->sched_lock);  	status = ice_sched_assoc_vsi_to_agg(pi, agg_id, vsi_handle, @@ -3098,12 +3096,12 @@ static u16 ice_sched_calc_wakeup(struct ice_hw *hw, s32 bw)   *   * This function converts the BW to profile structure format.   */ -static enum ice_status +static int  ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw,  			   struct ice_aqc_rl_profile_elem *profile)  { -	enum ice_status status = ICE_ERR_PARAM;  	s64 bytes_per_sec, ts_rate, mv_tmp; +	int status = -EINVAL;  	bool found = false;  	s32 encode = 0;  	s64 mv = 0; @@ -3150,7 +3148,7 @@ ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw,  		profile->rl_encode = cpu_to_le16(encode);  		status = 0;  	} else { -		status = ICE_ERR_DOES_NOT_EXIST; +		status = -ENOENT;  	}  	return status; @@ -3176,9 +3174,9 @@ ice_sched_add_rl_profile(struct ice_port_info *pi,  	struct ice_aqc_rl_profile_info *rl_prof_elem;  	u16 profiles_added = 0, num_profiles = 1;  	struct ice_aqc_rl_profile_elem *buf; -	enum ice_status status;  	struct ice_hw *hw;  	u8 profile_type; +	int status;  	if (layer_num >= ICE_AQC_TOPO_MAX_LEVEL_NUM)  		return NULL; @@ -3249,7 +3247,7 @@ exit_add_rl_prof:   *   * This function configures node element's BW limit.   */ -static enum ice_status +static int  ice_sched_cfg_node_bw_lmt(struct ice_hw *hw, struct ice_sched_node *node,  			  enum ice_rl_type rl_type, u16 rl_prof_id)  { @@ -3268,7 +3266,7 @@ ice_sched_cfg_node_bw_lmt(struct ice_hw *hw, struct ice_sched_node *node,  		 * hence only one of them may be set for any given element  		 */  		if (data->valid_sections & ICE_AQC_ELEM_VALID_SHARED) -			return ICE_ERR_CFG; +			return -EIO;  		data->valid_sections |= ICE_AQC_ELEM_VALID_EIR;  		data->eir_bw.bw_profile_idx = cpu_to_le16(rl_prof_id);  		break; @@ -3291,7 +3289,7 @@ ice_sched_cfg_node_bw_lmt(struct ice_hw *hw, struct ice_sched_node *node,  		if ((data->valid_sections & ICE_AQC_ELEM_VALID_EIR) &&  		    (le16_to_cpu(data->eir_bw.bw_profile_idx) !=  			    ICE_SCHED_DFLT_RL_PROF_ID)) -			return ICE_ERR_CFG; +			return -EIO;  		/* EIR BW is set to default, disable it */  		data->valid_sections &= ~ICE_AQC_ELEM_VALID_EIR;  		/* Okay to enable shared BW now */ @@ -3300,7 +3298,7 @@ ice_sched_cfg_node_bw_lmt(struct ice_hw *hw, struct ice_sched_node *node,  		break;  	default:  		/* Unknown rate limit type */ -		return ICE_ERR_PARAM; +		return -EINVAL;  	}  	/* Configure element */ @@ -3420,15 +3418,15 @@ ice_sched_get_srl_node(struct ice_sched_node *node, u8 srl_layer)   * 'profile_type' and profile ID as 'profile_id'. The caller needs to hold   * scheduler lock.   */ -static enum ice_status +static int  ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,  			u16 profile_id)  {  	struct ice_aqc_rl_profile_info *rl_prof_elem; -	enum ice_status status = 0; +	int status = 0;  	if (layer_num >= ICE_AQC_TOPO_MAX_LEVEL_NUM) -		return ICE_ERR_PARAM; +		return -EINVAL;  	/* Check the existing list for RL profile */  	list_for_each_entry(rl_prof_elem, &pi->rl_prof_list[layer_num],  			    list_entry) @@ -3441,11 +3439,11 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,  			/* Remove old profile ID from database */  			status = ice_sched_del_rl_profile(pi->hw, rl_prof_elem); -			if (status && status != ICE_ERR_IN_USE) +			if (status && status != -EBUSY)  				ice_debug(pi->hw, ICE_DBG_SCHED, "Remove rl profile failed\n");  			break;  		} -	if (status == ICE_ERR_IN_USE) +	if (status == -EBUSY)  		status = 0;  	return status;  } @@ -3461,16 +3459,16 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,   * type CIR, EIR, or SRL to default. This function needs to be called   * with the scheduler lock held.   */ -static enum ice_status +static int  ice_sched_set_node_bw_dflt(struct ice_port_info *pi,  			   struct ice_sched_node *node,  			   enum ice_rl_type rl_type, u8 layer_num)  { -	enum ice_status status;  	struct ice_hw *hw;  	u8 profile_type;  	u16 rl_prof_id;  	u16 old_id; +	int status;  	hw = pi->hw;  	switch (rl_type) { @@ -3488,7 +3486,7 @@ ice_sched_set_node_bw_dflt(struct ice_port_info *pi,  		rl_prof_id = ICE_SCHED_NO_SHARED_RL_PROF_ID;  		break;  	default: -		return ICE_ERR_PARAM; +		return -EINVAL;  	}  	/* Save existing RL prof ID for later clean up */  	old_id = ice_sched_get_node_rl_prof_id(node, rl_type); @@ -3518,7 +3516,7 @@ ice_sched_set_node_bw_dflt(struct ice_port_info *pi,   * them may be set for any given element. This function needs to be called   * with the scheduler lock held.   */ -static enum ice_status +static int  ice_sched_set_eir_srl_excl(struct ice_port_info *pi,  			   struct ice_sched_node *node,  			   u8 layer_num, enum ice_rl_type rl_type, u32 bw) @@ -3562,14 +3560,14 @@ ice_sched_set_eir_srl_excl(struct ice_port_info *pi,   * node's RL profile ID of type CIR, EIR, or SRL, and removes old profile   * ID from local database. The caller needs to hold scheduler lock.   */ -static enum ice_status +static int  ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node,  		      enum ice_rl_type rl_type, u32 bw, u8 layer_num)  {  	struct ice_aqc_rl_profile_info *rl_prof_info; -	enum ice_status status = ICE_ERR_PARAM;  	struct ice_hw *hw = pi->hw;  	u16 old_id, rl_prof_id; +	int status = -EINVAL;  	rl_prof_info = ice_sched_add_rl_profile(pi, rl_type, bw, layer_num);  	if (!rl_prof_info) @@ -3608,31 +3606,31 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node,   * It updates node's BW limit parameters like BW RL profile ID of type CIR,   * EIR, or SRL. The caller needs to hold scheduler lock.   */ -static enum ice_status +static int  ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,  			  enum ice_rl_type rl_type, u32 bw)  {  	struct ice_sched_node *cfg_node = node; -	enum ice_status status; +	int status;  	struct ice_hw *hw;  	u8 layer_num;  	if (!pi) -		return ICE_ERR_PARAM; +		return -EINVAL;  	hw = pi->hw;  	/* Remove unused RL profile IDs from HW and SW DB */  	ice_sched_rm_unused_rl_prof(pi);  	layer_num = ice_sched_get_rl_prof_layer(pi, rl_type,  						node->tx_sched_layer);  	if (layer_num >= hw->num_tx_sched_layers) -		return ICE_ERR_PARAM; +		return -EINVAL;  	if (rl_type == ICE_SHARED_BW) {  		/* SRL node may be different */  		cfg_node = ice_sched_get_srl_node(node, layer_num);  		if (!cfg_node) -			return ICE_ERR_CFG; +			return -EIO;  	}  	/* EIR BW and Shared BW profiles are mutually exclusive and  	 * hence only one of them may be set for any given element @@ -3657,7 +3655,7 @@ ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,   * type CIR, EIR, or SRL to default. This function needs to be called   * with the scheduler lock held.   */ -static enum ice_status +static int  ice_sched_set_node_bw_dflt_lmt(struct ice_port_info *pi,  			       struct ice_sched_node *node,  			       enum ice_rl_type rl_type) @@ -3675,7 +3673,7 @@ ice_sched_set_node_bw_dflt_lmt(struct ice_port_info *pi,   * behalf of the requested node (first argument). This function needs to be   * called with scheduler lock held.   */ -static enum ice_status +static int  ice_sched_validate_srl_node(struct ice_sched_node *node, u8 sel_layer)  {  	/* SRL profiles are not available on all layers. Check if the @@ -3690,7 +3688,7 @@ ice_sched_validate_srl_node(struct ice_sched_node *node, u8 sel_layer)  	    (node->parent && node->parent->num_children == 1)))  		return 0; -	return ICE_ERR_CFG; +	return -EIO;  }  /** @@ -3701,7 +3699,7 @@ ice_sched_validate_srl_node(struct ice_sched_node *node, u8 sel_layer)   *   * Save BW information of queue type node for post replay use.   */ -static enum ice_status +static int  ice_sched_save_q_bw(struct ice_q_ctx *q_ctx, enum ice_rl_type rl_type, u32 bw)  {  	switch (rl_type) { @@ -3715,7 +3713,7 @@ ice_sched_save_q_bw(struct ice_q_ctx *q_ctx, enum ice_rl_type rl_type, u32 bw)  		ice_set_clear_shared_bw(&q_ctx->bw_t_info, bw);  		break;  	default: -		return ICE_ERR_PARAM; +		return -EINVAL;  	}  	return 0;  } @@ -3731,16 +3729,16 @@ ice_sched_save_q_bw(struct ice_q_ctx *q_ctx, enum ice_rl_type rl_type, u32 bw)   *   * This function sets BW limit of queue scheduling node.   */ -static enum ice_status +static int  ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,  		       u16 q_handle, enum ice_rl_type rl_type, u32 bw)  { -	enum ice_status status = ICE_ERR_PARAM;  	struct ice_sched_node *node;  	struct ice_q_ctx *q_ctx; +	int status = -EINVAL;  	if (!ice_is_vsi_valid(pi->hw, vsi_handle)) -		return ICE_ERR_PARAM; +		return -EINVAL;  	mutex_lock(&pi->sched_lock);  	q_ctx = ice_get_lan_q_ctx(pi->hw, vsi_handle, tc, q_handle);  	if (!q_ctx) @@ -3762,7 +3760,7 @@ ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,  		sel_layer = ice_sched_get_rl_prof_layer(pi, rl_type,  							node->tx_sched_layer);  		if (sel_layer >= pi->hw->num_tx_sched_layers) { -			status = ICE_ERR_PARAM; +			status = -EINVAL;  			goto exit_q_bw_lmt;  		}  		status = ice_sched_validate_srl_node(node, sel_layer); @@ -3794,7 +3792,7 @@ exit_q_bw_lmt:   *   * This function configures BW limit of queue scheduling node.   */ -enum ice_status +int  ice_cfg_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,  		 u16 q_handle, enum ice_rl_type rl_type, u32 bw)  { @@ -3812,7 +3810,7 @@ ice_cfg_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,   *   * This function configures BW default limit of queue scheduling node.   */ -enum ice_status +int  ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,  		      u16 q_handle, enum ice_rl_type rl_type)  { @@ -3880,13 +3878,13 @@ ice_sched_get_node_by_id_type(struct ice_port_info *pi, u32 id,   * This function sets BW limit of VSI or Aggregator scheduling node   * based on TC information from passed in argument BW.   */ -static enum ice_status +int  ice_sched_set_node_bw_lmt_per_tc(struct ice_port_info *pi, u32 id,  				 enum ice_agg_type agg_type, u8 tc,  				 enum ice_rl_type rl_type, u32 bw)  { -	enum ice_status status = ICE_ERR_PARAM;  	struct ice_sched_node *node; +	int status = -EINVAL;  	if (!pi)  		return status; @@ -3921,7 +3919,7 @@ exit_set_node_bw_lmt_per_tc:   * This function configures BW limit of VSI scheduling node based on TC   * information.   */ -enum ice_status +int  ice_cfg_vsi_bw_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,  			  enum ice_rl_type rl_type, u32 bw)  { @@ -3948,7 +3946,7 @@ ice_cfg_vsi_bw_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,   * This function configures default BW limit of VSI scheduling node based on TC   * information.   */ -enum ice_status +int  ice_cfg_vsi_bw_dflt_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,  			       enum ice_rl_type rl_type)  { @@ -3976,13 +3974,13 @@ ice_cfg_vsi_bw_dflt_lmt_per_tc(struct ice_port_info *pi, u16 vsi_handle, u8 tc,   * burst size value is used for future rate limit calls. It doesn't change the   * existing or previously created RL profiles.   */ -enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes) +int ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes)  {  	u16 burst_size_to_prog;  	if (bytes < ICE_MIN_BURST_SIZE_ALLOWED ||  	    bytes > ICE_MAX_BURST_SIZE_ALLOWED) -		return ICE_ERR_PARAM; +		return -EINVAL;  	if (ice_round_to_num(bytes, 64) <=  	    ICE_MAX_BURST_SIZE_64_BYTE_GRANULARITY) {  		/* 64 byte granularity case */ @@ -4017,13 +4015,13 @@ enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes)   * This function configures node element's priority value. It   * needs to be called with scheduler lock held.   */ -static enum ice_status +static int  ice_sched_replay_node_prio(struct ice_hw *hw, struct ice_sched_node *node,  			   u8 priority)  {  	struct ice_aqc_txsched_elem_data buf;  	struct ice_aqc_txsched_elem *data; -	enum ice_status status; +	int status;  	buf = node->info;  	data = &buf.data; @@ -4044,12 +4042,12 @@ ice_sched_replay_node_prio(struct ice_hw *hw, struct ice_sched_node *node,   * This function restores node's BW from bw_t_info. The caller needs   * to hold the scheduler lock.   */ -static enum ice_status +static int  ice_sched_replay_node_bw(struct ice_hw *hw, struct ice_sched_node *node,  			 struct ice_bw_type_info *bw_t_info)  {  	struct ice_port_info *pi = hw->port_info; -	enum ice_status status = ICE_ERR_PARAM; +	int status = -EINVAL;  	u16 bw_alloc;  	if (!node) @@ -4137,7 +4135,7 @@ void ice_sched_replay_agg(struct ice_hw *hw)  		if (!bitmap_equal(agg_info->tc_bitmap, agg_info->replay_tc_bitmap,  				  ICE_MAX_TRAFFIC_CLASS)) {  			DECLARE_BITMAP(replay_bitmap, ICE_MAX_TRAFFIC_CLASS); -			enum ice_status status; +			int status;  			bitmap_zero(replay_bitmap, ICE_MAX_TRAFFIC_CLASS);  			ice_sched_get_ena_tc_bitmap(pi, @@ -4191,18 +4189,17 @@ void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw)   * their node bandwidth information. This function needs to be called with   * scheduler lock held.   */ -static enum ice_status -ice_sched_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle) +static int ice_sched_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle)  {  	DECLARE_BITMAP(replay_bitmap, ICE_MAX_TRAFFIC_CLASS);  	struct ice_sched_agg_vsi_info *agg_vsi_info;  	struct ice_port_info *pi = hw->port_info;  	struct ice_sched_agg_info *agg_info; -	enum ice_status status; +	int status;  	bitmap_zero(replay_bitmap, ICE_MAX_TRAFFIC_CLASS);  	if (!ice_is_vsi_valid(hw, vsi_handle)) -		return ICE_ERR_PARAM; +		return -EINVAL;  	agg_info = ice_get_vsi_agg_info(hw, vsi_handle);  	if (!agg_info)  		return 0; /* Not present in list - default Agg case */ @@ -4233,10 +4230,10 @@ ice_sched_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle)   * This function replays association of VSI to aggregator type nodes, and   * node bandwidth information.   */ -enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle) +int ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle)  {  	struct ice_port_info *pi = hw->port_info; -	enum ice_status status; +	int status;  	mutex_lock(&pi->sched_lock);  	status = ice_sched_replay_vsi_agg(hw, vsi_handle); @@ -4252,14 +4249,13 @@ enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle)   * This function replays queue type node bandwidth. This function needs to be   * called with scheduler lock held.   */ -enum ice_status -ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx) +int ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx)  {  	struct ice_sched_node *q_node;  	/* Following also checks the presence of node in tree */  	q_node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid);  	if (!q_node) -		return ICE_ERR_PARAM; +		return -EINVAL;  	return ice_sched_replay_node_bw(pi->hw, q_node, &q_ctx->bw_t_info);  } |