Skip to contentSkip to conversation

vdpa/mlx5: Fix MQ to support non power of two num queues

PATCH In review Eli Cohen 3 participants 4 messages Sep 12, 2022 – Sep 14, 2022

Subsystems (2)
lore
Share & tools
lore

Eli Cohen

author
#0 lore raw

PATCH 1/1 vdpa/mlx5: Fix MQ to support non power of two num queues

RQT objects require that a power of two value be configured for both rqt_max_size and rqt_actual size.

For create_rqt, make sure to round up to the power of two the value of given by the user who created the vdpa device and given by ndev->rqt_size. The actual size is also rounded up to the power of two using the current number of VQs given by ndev->cur_num_vqs.

Same goes with modify_rqt where we need to make sure act size is power of two based on the new number of QPs.

Without this patch, attempt to create a device with non power of two QPs would result in error from firmware.

Fixes 52893733f2c5 ("vdpa/mlx5: Add multiqueue support")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +10 -7
index ed100a35e596..90913365def4 100644
@@ -1320,6 +1320,8 @@ static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *
 
 static int create_rqt(struct mlx5_vdpa_net *ndev)
 {
+	int rqt_table_size = roundup_pow_of_two(ndev->rqt_size);
+	int act_sz = roundup_pow_of_two(ndev->cur_num_vqs / 2);
 	__be32 *list;
 	void *rqtc;
 	int inlen;
@@ -1327,7 +1329,7 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
 	int i, j;
 	int err;
 
-	inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num);
+	inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + rqt_table_size * MLX5_ST_SZ_BYTES(rq_num);
 	in = kzalloc(inlen, GFP_KERNEL);
 	if (!in)
 		return -ENOMEM;
@@ -1336,12 +1338,12 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
 	rqtc = MLX5_ADDR_OF(create_rqt_in, in, rqt_context);
 
 	MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);
-	MLX5_SET(rqtc, rqtc, rqt_max_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_max_size, rqt_table_size);
 	list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-	for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+	for (i = 0, j = 0; i < act_sz; i++, j += 2)
 		list[i] = cpu_to_be32(ndev->vqs[j % ndev->cur_num_vqs].virtq_id);
 
-	MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
 	err = mlx5_vdpa_create_rqt(&ndev->mvdev, in, inlen, &ndev->res.rqtn);
 	kfree(in);
 	if (err)
@@ -1354,6 +1356,7 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
 
 static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
 {
+	int act_sz = roundup_pow_of_two(num / 2);
 	__be32 *list;
 	void *rqtc;
 	int inlen;
@@ -1361,7 +1364,7 @@ static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
 	int i, j;
 	int err;
 
-	inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num);
+	inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + act_sz * MLX5_ST_SZ_BYTES(rq_num);
 	in = kzalloc(inlen, GFP_KERNEL);
 	if (!in)
 		return -ENOMEM;
@@ -1372,10 +1375,10 @@ static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
 	MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);
 
 	list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-	for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+	for (i = 0, j = 0; i < act_sz; i++, j = j + 2)
 		list[i] = cpu_to_be32(ndev->vqs[j % num].virtq_id);
 
-	MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
 	err = mlx5_vdpa_modify_rqt(&ndev->mvdev, in, inlen, ndev->res.rqtn);
 	kfree(in);
 	if (err)
Signature · 1 line
2.35.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eli Cohen

RQT objects require that a power of two value be configured for both rqt_max_size and rqt_actual size.

For create_rqt, make sure to round up to the power of two the value of given by the user who created the vdpa device and given by ndev->rqt_size. The actual size is also rounded up to the power of two using the current number of VQs given by ndev->cur_num_vqs.

Quoted 8 lines

Same goes with modify_rqt where we need to make sure act size is power of two based on the new number of QPs.

Without this patch, attempt to create a device with non power of two QPs would result in error from firmware.

Fixes 52893733f2c5 ("vdpa/mlx5: Add multiqueue support")
Quoted 73 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +10 -8
index ed100a35e596..90913365def4 100644
@@ -1320,6 +1320,8 @@ static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *
 
 static int create_rqt(struct mlx5_vdpa_net *ndev)
 {
+       int rqt_table_size = roundup_pow_of_two(ndev->rqt_size);
+       int act_sz = roundup_pow_of_two(ndev->cur_num_vqs / 2);
        __be32 *list;
        void *rqtc;
        int inlen;
@@ -1327,7 +1329,7 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
        int i, j;
        int err;
 
-       inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num);
+       inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + rqt_table_size * MLX5_ST_SZ_BYTES(rq_num);
        in = kzalloc(inlen, GFP_KERNEL);
        if (!in)
                return -ENOMEM;
@@ -1336,12 +1338,12 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
        rqtc = MLX5_ADDR_OF(create_rqt_in, in, rqt_context);
 
        MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);
-       MLX5_SET(rqtc, rqtc, rqt_max_size, ndev->rqt_size);
+       MLX5_SET(rqtc, rqtc, rqt_max_size, rqt_table_size);
        list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-       for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+       for (i = 0, j = 0; i < act_sz; i++, j += 2)
                list[i] = cpu_to_be32(ndev->vqs[j % ndev->cur_num_vqs].virtq_id);
 
-       MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+       MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
        err = mlx5_vdpa_create_rqt(&ndev->mvdev, in, inlen, &ndev->res.rqtn);
        kfree(in);
        if (err)
@@ -1354,6 +1356,7 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
 
 static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
 {
+       int act_sz = roundup_pow_of_two(num / 2);
        __be32 *list;
        void *rqtc;
        int inlen;
@@ -1361,7 +1364,7 @@ static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
        int i, j;
        int err;
 
-       inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num);
+       inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + act_sz * MLX5_ST_SZ_BYTES(rq_num);
        in = kzalloc(inlen, GFP_KERNEL);
        if (!in)
                return -ENOMEM;
@@ -1372,10 +1375,10 @@ static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
        MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);
 
        list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-       for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+       for (i = 0, j = 0; i < act_sz; i++, j = j + 2)
                list[i] = cpu_to_be32(ndev->vqs[j % num].virtq_id);
 
-       MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+       MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
        err = mlx5_vdpa_modify_rqt(&ndev->mvdev, in, inlen, ndev->res.rqtn);
        kfree(in);
        if (err)
--
Quoted 2 lines

2.35.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Acked-by on v1 1/1
#2 lore raw
In reply to Eli Cohen
Quoted 8 lines · Eli Cohen

RQT objects require that a power of two value be configured for both rqt_max_size and rqt_actual size.

For create_rqt, make sure to round up to the power of two the value of given by the user who created the vdpa device and given by ndev->rqt_size. The actual size is also rounded up to the power of two using the current number of VQs given by ndev->cur_num_vqs.

Quoted 5 lines

Same goes with modify_rqt where we need to make sure act size is power of two based on the new number of QPs.

Without this patch, attempt to create a device with non power of two QPs would result in error from firmware.

What kind of error would it end up with, is there explicit warning in dmesg or it's just implicit? And is there performance impact? It'd be nice to add such description that we can easily match the symptom just in case.

Quoted 3 lines
Fixes 52893733f2c5 ("vdpa/mlx5: Add multiqueue support")

Thanks,
-Siwei

Quoted 62 lines
---
  drivers/vdpa/mlx5/net/mlx5_vnet.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +8 -5
index ed100a35e596..90913365def4 100644
@@ -1320,6 +1320,8 @@ static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *
 
  static int create_rqt(struct mlx5_vdpa_net *ndev)
  {
+	int rqt_table_size = roundup_pow_of_two(ndev->rqt_size);
+	int act_sz = roundup_pow_of_two(ndev->cur_num_vqs / 2);
  	__be32 *list;
  	void *rqtc;
  	int inlen;
@@ -1327,7 +1329,7 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
  	int i, j;
  	int err;
 
-	inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num);
+	inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + rqt_table_size * MLX5_ST_SZ_BYTES(rq_num);
  	in = kzalloc(inlen, GFP_KERNEL);
  	if (!in)
  		return -ENOMEM;
@@ -1336,12 +1338,12 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
  	rqtc = MLX5_ADDR_OF(create_rqt_in, in, rqt_context);
 
  	MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);
-	MLX5_SET(rqtc, rqtc, rqt_max_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_max_size, rqt_table_size);
  	list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-	for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+	for (i = 0, j = 0; i < act_sz; i++, j += 2)
  		list[i] = cpu_to_be32(ndev->vqs[j % ndev->cur_num_vqs].virtq_id);
 
-	MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
  	err = mlx5_vdpa_create_rqt(&ndev->mvdev, in, inlen, &ndev->res.rqtn);
  	kfree(in);
  	if (err)
@@ -1354,6 +1356,7 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
 
  static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
  {
+	int act_sz = roundup_pow_of_two(num / 2);
  	__be32 *list;
  	void *rqtc;
  	int inlen;
@@ -1361,7 +1364,7 @@ static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
  	int i, j;
  	int err;
 
-	inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + ndev->rqt_size * MLX5_ST_SZ_BYTES(rq_num);
+	inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + act_sz * MLX5_ST_SZ_BYTES(rq_num);
  	in = kzalloc(inlen, GFP_KERNEL);
  	if (!in)
  		return -ENOMEM;
@@ -1372,10 +1375,10 @@ static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
  	MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);
 

drivers/vdpa/mlx5/net/mlx5_vnet.c static int modify_rqt(struct mlx5_vdpa_net *ndev, int num) · line 1384

Quoted 10 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
  	list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-	for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+	for (i = 0, j = 0; i < act_sz; i++, j = j + 2)
  		list[i] = cpu_to_be32(ndev->vqs[j % num].virtq_id);
 
-	MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
  	err = mlx5_vdpa_modify_rqt(&ndev->mvdev, in, inlen, ndev->res.rqtn);
  	kfree(in);
  	if (err)

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

author
#3 lore raw
Quoted 19 lines

From: Si-Wei Liu <[email protected]>
Sent: Wednesday, 14 September 2022 14:15
To: Eli Cohen <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] vdpa/mlx5: Fix MQ to support non power of two num queues

Quoted 8 lines · Eli Cohen

RQT objects require that a power of two value be configured for both rqt_max_size and rqt_actual size.

For create_rqt, make sure to round up to the power of two the value of given by the user who created the vdpa device and given by ndev->rqt_size. The actual size is also rounded up to the power of two using the current number of VQs given by ndev->cur_num_vqs.

Quoted 8 lines
Quoted 5 lines

Same goes with modify_rqt where we need to make sure act size is power of two based on the new number of QPs.

Without this patch, attempt to create a device with non power of two QPs would result in error from firmware.

What kind of error would it end up with, is there explicit warning in dmesg or it's just implicit?

The error would look something like this:
[Sep14 15:20] mlx5_core.sf mlx5_core.sf.6: mlx5_cmd_out_err:778:(pid 3466): CREATE_RQT(0x916) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0x538fab), err(-22)

Quoted 4 lines

And is there performance impact? It'd be
nice to add such description that we can easily match the symptom just in case.

I don't think there would be performance impact but I haven't checked performance with this fix.

Quoted 95 lines
Quoted 3 lines
Fixes 52893733f2c5 ("vdpa/mlx5: Add multiqueue support")

Thanks,
-Siwei

Review

Quoted 5 lines
---
  drivers/vdpa/mlx5/net/mlx5_vnet.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/vdpa/mlx5/net/mlx5_vnet.c

drivers/vdpa/mlx5/net/mlx5_vnet.c static void teardown_vq(struct mlx5_vdpa_net

Quoted 4 lines

index ed100a35e596..90913365def4 100644

drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
@@ -1320,6 +1320,8 @@ static void teardown_vq(struct mlx5_vdpa_net

*ndev, struct mlx5_vdpa_virtqueue *

drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net

Quoted 9 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -0
  static int create_rqt(struct mlx5_vdpa_net *ndev)
  {
+	int rqt_table_size = roundup_pow_of_two(ndev->rqt_size);
+	int act_sz = roundup_pow_of_two(ndev->cur_num_vqs / 2);
  	__be32 *list;
  	void *rqtc;
  	int inlen;
@@ -1327,7 +1329,7 @@ static int create_rqt(struct mlx5_vdpa_net

*ndev)

drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net *ndev)

Quoted 4 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -1
  	int i, j;
  	int err;
 
-	inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + ndev->rqt_size *

MLX5_ST_SZ_BYTES(rq_num);

drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net · line 1332

Quoted 1 line
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -0
+	inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + rqt_table_size *

MLX5_ST_SZ_BYTES(rq_num);

drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net

Quoted 4 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
  	in = kzalloc(inlen, GFP_KERNEL);
  	if (!in)
  		return -ENOMEM;
@@ -1336,12 +1338,12 @@ static int create_rqt(struct mlx5_vdpa_net

*ndev)

drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net *ndev)

Quoted 3 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
  	rqtc = MLX5_ADDR_OF(create_rqt_in, in, rqt_context);
 
  	MLX5_SET(rqtc, rqtc, list_q_type,

MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);

drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net

Quoted 15 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +3 -3
-	MLX5_SET(rqtc, rqtc, rqt_max_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_max_size, rqt_table_size);
  	list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-	for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+	for (i = 0, j = 0; i < act_sz; i++, j += 2)
  		list[i] = cpu_to_be32(ndev->vqs[j % ndev-
 cur_num_vqs].virtq_id);
 
-	MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
  	err = mlx5_vdpa_create_rqt(&ndev->mvdev, in, inlen, &ndev-
 res.rqtn);
  	kfree(in);
  	if (err)
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
@@ -1354,6 +1356,7 @@ static int create_rqt(struct mlx5_vdpa_net

*ndev)

drivers/vdpa/mlx5/net/mlx5_vnet.c static int modify_rqt(struct mlx5_vdpa_net

Quoted 8 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -0
  static int modify_rqt(struct mlx5_vdpa_net *ndev, int num)
  {
+	int act_sz = roundup_pow_of_two(num / 2);
  	__be32 *list;
  	void *rqtc;
  	int inlen;
@@ -1361,7 +1364,7 @@ static int modify_rqt(struct mlx5_vdpa_net

*ndev, int num)

drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net *ndev)

Quoted 4 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -1
  	int i, j;
  	int err;
 
-	inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + ndev->rqt_size *

MLX5_ST_SZ_BYTES(rq_num);

drivers/vdpa/mlx5/net/mlx5_vnet.c static int modify_rqt(struct mlx5_vdpa_net · line 1367

Quoted 1 line
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -0
+	inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + act_sz *

MLX5_ST_SZ_BYTES(rq_num);

drivers/vdpa/mlx5/net/mlx5_vnet.c static int modify_rqt(struct mlx5_vdpa_net

Quoted 4 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
  	in = kzalloc(inlen, GFP_KERNEL);
  	if (!in)
  		return -ENOMEM;
@@ -1372,10 +1375,10 @@ static int modify_rqt(struct mlx5_vdpa_net

*ndev, int num)

drivers/vdpa/mlx5/net/mlx5_vnet.c static int modify_rqt(struct mlx5_vdpa_net · line 1375

Quoted 1 line
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
  	MLX5_SET(rqtc, rqtc, list_q_type,

MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);

Quoted 12 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
  	list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
-	for (i = 0, j = 0; i < ndev->rqt_size; i++, j += 2)
+	for (i = 0, j = 0; i < act_sz; i++, j = j + 2)
  		list[i] = cpu_to_be32(ndev->vqs[j % num].virtq_id);
 
-	MLX5_SET(rqtc, rqtc, rqt_actual_size, ndev->rqt_size);
+	MLX5_SET(rqtc, rqtc, rqt_actual_size, act_sz);
  	err = mlx5_vdpa_modify_rqt(&ndev->mvdev, in, inlen, ndev-
 res.rqtn);
  	kfree(in);
  	if (err)