[PATCH 16/19] nvmet-rdma: reject queues larger than max_cqe

Christoph Hellwig hch at lst.de
Mon Nov 2 22:14:27 PST 2026


On Thu, Oct 29, 2026 at 08:52:49AM -0700, Keith Busch wrote:
>  	 */
>  	nr_cqe = queue->recv_queue_size + 2 * queue->send_queue_size;
>  
> -	queue->cq = ib_cq_pool_get(ndev->device, nr_cqe + 1,
> -				   queue->comp_vector, IB_POLL_WORKQUEUE);
> +	/*
> +	 * The host picks both sizes. Never ask ib_cq_pool_get() for more
> +	 * entries than one CQ of the device can have: no CQ would ever fit,
> +	 * and it would allocate new CQs until an allocation fails.
> +	 */

"The host picks both sizes" read really weird, but doesn't actually
add any information.  In fact none of this comment seems overly
useful.

> +	if (nr_cqe + 1 > ndev->device->attrs.max_cqe)
> +		queue->cq = ERR_PTR(-EINVAL);
> +	else
> +		queue->cq = ib_cq_pool_get(ndev->device, nr_cqe + 1,
> +					   queue->comp_vector,
> +					   IB_POLL_WORKQUEUE);
>  	if (IS_ERR(queue->cq)) {
>  		ret = PTR_ERR(queue->cq);
>  		pr_err("failed to create CQ cqe= %d ret= %d\n",

The out of bounds case should have it's own error message instead of
falling through to this miseading error.




More information about the Linux-nvme mailing list