Si-Wei Liu
2022-Jan-11 09:31 UTC
[PATCH 2/4] vdpa/mlx5: Fix is_index_valid() to refer to features
On 1/10/2022 11:22 PM, Eli Cohen wrote:> Make sure the decision whether an index received trough a callback is > valid or not consults the negotiated features. > > Signed-off-by: Eli Cohen <elic at nvidia.com>Reviewed-by: Si-Wei Liu<si-wei.liu at oracle.com> Is there more for this series? Subject says there're 4 patches in total?> --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index d1ff65065fb1..9eacfdb48434 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -133,10 +133,14 @@ struct mlx5_vdpa_virtqueue { > > static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) > { > - if (unlikely(idx > mvdev->max_idx)) > - return false; > + if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_MQ))) { > + if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ))) > + return idx < 2; > + else > + return idx < 3; > + } > > - return true; > + return idx <= mvdev->max_idx; > } > > struct mlx5_vdpa_net {
Michael S. Tsirkin
2022-Jan-11 12:10 UTC
[PATCH 2/4] vdpa/mlx5: Fix is_index_valid() to refer to features
On Tue, Jan 11, 2022 at 01:31:28AM -0800, Si-Wei Liu wrote:> > > On 1/10/2022 11:22 PM, Eli Cohen wrote: > > Make sure the decision whether an index received trough a callback is > > valid or not consults the negotiated features. > > > > Signed-off-by: Eli Cohen <elic at nvidia.com> > Reviewed-by: Si-Wei Liu<si-wei.liu at oracle.com> > > Is there more for this series? Subject says there're 4 patches in total?OK so with this + 1/4 are we OK with v7 of the big patchset now? I'm kind of beginning to worry it's rushed ... Jason?> > --- > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > index d1ff65065fb1..9eacfdb48434 100644 > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > @@ -133,10 +133,14 @@ struct mlx5_vdpa_virtqueue { > > static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) > > { > > - if (unlikely(idx > mvdev->max_idx)) > > - return false; > > + if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_MQ))) { > > + if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ))) > > + return idx < 2; > > + else > > + return idx < 3; > > + } > > - return true; > > + return idx <= mvdev->max_idx; > > } > > struct mlx5_vdpa_net {