The branch main has been updated by khng:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=25ef056f74e40429df6bcbc31d52888b57ff3e2c

commit 25ef056f74e40429df6bcbc31d52888b57ff3e2c
Author:     Ka Ho Ng <[email protected]>
AuthorDate: 2024-07-03 17:32:06 +0000
Commit:     Ka Ho Ng <[email protected]>
CommitDate: 2024-07-03 17:32:44 +0000

    ofed: fix rwq buffer allocation
    
    Fixes a wrong rwq->buf_size assignment. The field was assigned 0 upon a
    successful call to ibv_init_wq.
    
    Fixes:          a687910fc435
    Sponsored by:   Juniper Networks, Inc.
    MFC after:      1 week
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D45833
---
 contrib/ofed/libmlx5/verbs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/ofed/libmlx5/verbs.c b/contrib/ofed/libmlx5/verbs.c
index 766751041050..6c296bb69f6f 100644
--- a/contrib/ofed/libmlx5/verbs.c
+++ b/contrib/ofed/libmlx5/verbs.c
@@ -2077,6 +2077,10 @@ struct ibv_wq *mlx5_create_wq(struct ibv_context 
*context,
        if (!rwq)
                return NULL;
 
+       ret = ibv_init_wq(&rwq->wq);
+       if (ret < 0)
+               goto err;
+
        rwq->wq_sig = rwq_sig_enabled(context);
        if (rwq->wq_sig)
                cmd.drv.flags = MLX5_RWQ_FLAG_SIGNATURE;
@@ -2084,13 +2088,9 @@ struct ibv_wq *mlx5_create_wq(struct ibv_context 
*context,
        ret = mlx5_calc_rwq_size(ctx, rwq, attr);
        if (ret < 0) {
                errno = -ret;
-               goto err;
+               goto err_cleanup_wq;
        }
 
-       ret = ibv_init_wq(&rwq->wq);
-       if (ret < 0)
-               goto err;
-
        rwq->buf_size = ret;
        if (mlx5_alloc_rwq_buf(context, rwq, ret))
                goto err_cleanup_wq;

Reply via email to