Skip to contentSkip to conversation

vdpa/mlx5: fix endian-ness for max vqs

PATCH In review Michael S. Tsirkin 3 participants 3 messages Jan 8, 2022 – Jan 10, 2022

Subsystems (2)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vdpa/mlx5: fix endian-ness for max vqs

sparse warnings: (new ones prefixed by >>)

Quoted 4 lines
Quoted 2 lines

drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast to restricted __le16 drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast from restricted __virtio16

1247 num = le16_to_cpu(ndev->config.max_virtqueue_pairs);

Address this using the appropriate wrapper.

Fixes 7620d51af29a ("vdpa/mlx5: Support configuring max data virtqueue")
Cc "Eli Cohen" <[email protected]>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -1
index 84b1919015ce..d1ff65065fb1 100644
@@ -1242,7 +1242,8 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
 	if (!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ)))
 		num = 1;
 	else
-		num = le16_to_cpu(ndev->config.max_virtqueue_pairs);
+		num = mlx5vdpa16_to_cpu(&ndev->mvdev,
+					ndev->config.max_virtqueue_pairs);
 
 	max_rqt = min_t(int, roundup_pow_of_two(num),
 			1 << MLX5_CAP_GEN(ndev->mvdev.mdev, log_max_rqt_size));
Signature · 1 line
MST
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Michael S. Tsirkin

sparse warnings: (new ones prefixed by >>)

Quoted 2 lines
Quoted 2 lines

drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast to restricted __le16 drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast from restricted __virtio16

Quoted 8 lines
Quoted 1 line

1247 num = le16_to_cpu(ndev->config.max_virtqueue_pairs);

Address this using the appropriate wrapper.

Fixes 7620d51af29a ("vdpa/mlx5: Support configuring max data virtqueue")
Cc "Eli Cohen" <[email protected]>
Quoted 21 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
index 84b1919015ce..d1ff65065fb1 100644
@@ -1242,7 +1242,8 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
        if (!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ)))
                num = 1;
        else
-               num = le16_to_cpu(ndev->config.max_virtqueue_pairs);
+               num = mlx5vdpa16_to_cpu(&ndev->mvdev,
+                                       ndev->config.max_virtqueue_pairs);
 
        max_rqt = min_t(int, roundup_pow_of_two(num),
                        1 << MLX5_CAP_GEN(ndev->mvdev.mdev, log_max_rqt_size));
--

MST

Reviewed-by on v1 1/1
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin

sparse warnings: (new ones prefixed by >>)

Quoted 4 lines
Quoted 2 lines

drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast to restricted __le16 drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast from restricted __virtio16

1247 num = le16_to_cpu(ndev->config.max_virtqueue_pairs);

Quoted 7 lines

Address this using the appropriate wrapper.

Fixes 7620d51af29a ("vdpa/mlx5: Support configuring max data virtqueue")
Cc "Eli Cohen" <[email protected]>

---

Quoted 20 lines
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -1
index 84b1919015ce..d1ff65065fb1 100644
@@ -1242,7 +1242,8 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)
 	if (!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ)))
 		num = 1;
 	else
-		num = le16_to_cpu(ndev->config.max_virtqueue_pairs);
+		num = mlx5vdpa16_to_cpu(&ndev->mvdev,
+					ndev->config.max_virtqueue_pairs);
 
 	max_rqt = min_t(int, roundup_pow_of_two(num),
 			1 << MLX5_CAP_GEN(ndev->mvdev.mdev, log_max_rqt_size));
Signature · 1 line
MST