[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210527171241.3b886692@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Date: Thu, 27 May 2021 17:12:41 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>, dledford@...hat.com,
jgg@...dia.com, linux-rdma@...r.kernel.org, leonro@...dia.com
Cc: davem@...emloft.net, Dave Ertman <david.m.ertman@...el.com>,
netdev@...r.kernel.org, shiraz.saleem@...el.com
Subject: Re: [PATCH net-next v2 4/7] ice: Implement iidc operations
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);
> +}
Powered by blists - more mailing lists