diff mbox

[PATCH/libmlx4] Return failure if asked to resize CQ to fewer than outstanding entries

Message ID 87wpirxyqs.fsf@digitalvampire.org (mailing list archive)
State Accepted
Headers show

Commit Message

Roland Dreier Sept. 4, 2016, 7:15 p.m. UTC
From: Roland Dreier <roland@purestorage.com>

Don't silently return 0 (success) but not resize the CQ when the number of
outstanding entries is smaller than the size requested.  Instead return
EINVAL so the consumer knows the CQ wasn't resized.

This is one of the fixes in kernel commit 8ab9406a41c8 ("IB/mlx4: Bug fixes
in mlx4_ib_resize_cq") from Majd Dibbiny <majd@mellanox.com>.

Signed-off-by: Roland Dreier <roland@purestorage.com>
---
 src/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yishai Hadas Sept. 6, 2016, 2 p.m. UTC | #1
On 9/4/2016 10:15 PM, Roland Dreier wrote:
> From: Roland Dreier <roland@purestorage.com>
>
> Don't silently return 0 (success) but not resize the CQ when the number of
> outstanding entries is smaller than the size requested.  Instead return
> EINVAL so the consumer knows the CQ wasn't resized.
>
> This is one of the fixes in kernel commit 8ab9406a41c8 ("IB/mlx4: Bug fixes
> in mlx4_ib_resize_cq") from Majd Dibbiny <majd@mellanox.com>.
>
> Signed-off-by: Roland Dreier <roland@purestorage.com>
> ---
>  src/verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/verbs.c b/src/verbs.c
> index 43853c0c6532..5cc82cf38763 100644
> --- a/src/verbs.c
> +++ b/src/verbs.c
> @@ -392,7 +392,7 @@ int mlx4_resize_cq(struct ibv_cq *ibcq, int cqe)
>  	/* Can't be smaller then the number of outstanding CQEs */
>  	outst_cqe = mlx4_get_outstanding_cqes(cq);
>  	if (cqe < outst_cqe + 1) {
> -		ret = 0;
> +		ret = EINVAL;
>  		goto out;
>  	}
>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/verbs.c b/src/verbs.c
index 43853c0c6532..5cc82cf38763 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -392,7 +392,7 @@  int mlx4_resize_cq(struct ibv_cq *ibcq, int cqe)
 	/* Can't be smaller then the number of outstanding CQEs */
 	outst_cqe = mlx4_get_outstanding_cqes(cq);
 	if (cqe < outst_cqe + 1) {
-		ret = 0;
+		ret = EINVAL;
 		goto out;
 	}