linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vdpa/mlx5: fix endian-ness for max vqs
@ 2022-01-08 18:00 Michael S. Tsirkin
  2022-01-10  2:44 ` Jason Wang
  2022-01-10  5:23 ` Eli Cohen
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2022-01-08 18:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Eli Cohen, kernel test robot, Jason Wang, virtualization

sparse warnings: (new ones prefixed by >>)
>> 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" <elic@nvidia.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 84b1919015ce..d1ff65065fb1 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa/mlx5: fix endian-ness for max vqs
  2022-01-08 18:00 [PATCH] vdpa/mlx5: fix endian-ness for max vqs Michael S. Tsirkin
@ 2022-01-10  2:44 ` Jason Wang
  2022-01-10  5:23 ` Eli Cohen
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2022-01-10  2:44 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, Eli Cohen, kernel test robot, virtualization

On Sun, Jan 9, 2022 at 2:00 AM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> sparse warnings: (new ones prefixed by >>)
> >> 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" <elic@nvidia.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 84b1919015ce..d1ff65065fb1 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -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
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa/mlx5: fix endian-ness for max vqs
  2022-01-08 18:00 [PATCH] vdpa/mlx5: fix endian-ness for max vqs Michael S. Tsirkin
  2022-01-10  2:44 ` Jason Wang
@ 2022-01-10  5:23 ` Eli Cohen
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Cohen @ 2022-01-10  5:23 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: linux-kernel, kernel test robot, Jason Wang, virtualization

On Sat, Jan 08, 2022 at 01:00:43PM -0500, Michael S. Tsirkin wrote:
> sparse warnings: (new ones prefixed by >>)
> >> 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" <elic@nvidia.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---

Reviewed-by: Eli Cohen <elic@nvidia.com>

>  drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 84b1919015ce..d1ff65065fb1 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-10  5:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08 18:00 [PATCH] vdpa/mlx5: fix endian-ness for max vqs Michael S. Tsirkin
2022-01-10  2:44 ` Jason Wang
2022-01-10  5:23 ` Eli Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).