Re: [PATCH net-next v2 4/7] ice: Implement iidc operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 27 May 2021 10:30:11 -0700 Tony Nguyen wrote:
> +static enum ice_status
> +ice_aq_add_rdma_qsets(struct ice_hw *hw, u8 num_qset_grps,
> +		      struct ice_aqc_add_rdma_qset_data *qset_list,
> +		      u16 buf_size, struct ice_sq_cd *cd)
> +{
> +	struct ice_aqc_add_rdma_qset_data *list;
> +	struct ice_aqc_add_rdma_qset *cmd;
> +	struct ice_aq_desc desc;
> +	u16 i, sum_size = 0;
> +
> +	cmd = &desc.params.add_rdma_qset;
> +
> +	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_add_rdma_qset);
> +
> +	if (!qset_list)

defensive programming

> +		return ICE_ERR_PARAM;

RDMA folks, are you okay with drivers inventing their own error codes?
Having had to make tree-wide changes and deal with this cruft in 
the past I've developed a strong dislike for it. But if you're okay
I guess it can stay, these are RDMA functions after all.

> +	if (num_qset_grps > ICE_LAN_TXQ_MAX_QGRPS)
> +		return ICE_ERR_PARAM;
> +
> +	for (i = 0, list = qset_list; i < num_qset_grps; i++) {
> +		u16 num_qsets = le16_to_cpu(list->num_qsets);
> +
> +		sum_size += struct_size(list, rdma_qsets, num_qsets);
> +		list = (struct ice_aqc_add_rdma_qset_data *)(list->rdma_qsets +
> +							     num_qsets);
> +	}
> +
> +	if (buf_size != sum_size)
> +		return ICE_ERR_PARAM;
> +
> +	desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
> +
> +	cmd->num_qset_grps = num_qset_grps;
> +
> +	return ice_aq_send_cmd(hw, &desc, qset_list, buf_size, cd);
> +}




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux