[PATCH v3 4/6] nvme-rdma: use rdma connection reject helper functions

Bart Van Assche bart.vanassche at sandisk.com
Tue Oct 25 11:05:58 PDT 2016


On 10/24/2016 12:09 PM, Steve Wise wrote:
> +static const char *const nvme_rdma_cm_status_strs[] = {
> +	[NVME_RDMA_CM_INVALID_LEN]	= "invalid length",
> +	[NVME_RDMA_CM_INVALID_RECFMT]	= "invalid record format",
> +	[NVME_RDMA_CM_INVALID_QID]	= "invalid queue id",
> +	[NVME_RDMA_CM_INVALID_HSQSIZE]	= "invalid host sq size",
> +	[NVME_RDMA_CM_INVALID_HRQSIZE]	= "invalid host rq size",
> +	[NVME_RDMA_CM_NO_RSC]		= "resource not found",
> +	[NVME_RDMA_CM_INVALID_IRD]	= "invalid ird",
> +	[NVME_RDMA_CM_INVALID_ORD]	= "Invalid ord",
> +};

Please capitalize abbreviations (SQ, RQ, ID, IRD and ORD).

> +static const char *nvme_rdma_cm_msg(enum nvme_rdma_cm_status status)
> +{
> +	size_t index = status;
> +
> +	if (index >= ARRAY_SIZE(nvme_rdma_cm_status_strs) ||
> +	    !nvme_rdma_cm_status_strs[index])
> +		return "unrecognized reason";
> +	else
> +		return nvme_rdma_cm_status_strs[index];
> +};

Please consider rewriting this if-statement such that the recognized 
reason scenario occurs first.

> +	rej_msg = rdma_reject_msg(cm_id, status);
> +	rej_data = (struct nvme_rdma_cm_rej *)
> +		   rdma_consumer_reject_data(cm_id, ev, &rej_data_len);

Please reorder the patches in this patch series such that it doesn't 
break a bisect. rdma_consumer_reject_data() should be introduced before 
it is used.

Thanks,

Bart.



More information about the Linux-nvme mailing list