RDMA/mlx5: Zero out ODP related items in the mlx5_ib_mr
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 4 Mar 2021 12:07:42 +0000 (14:07 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 12 Mar 2021 00:03:25 +0000 (20:03 -0400)
commita639e66703ee45745dc4057c7c2013ed9e1963a7
treedeb04f4b12f64a39cd1c4812491e5be73a7cc0ae
parent32548870d438aba3c4a13f07efb73a8b86de507d
RDMA/mlx5: Zero out ODP related items in the mlx5_ib_mr

All of the ODP code assumes when it calls mlx5_mr_cache_alloc() the ODP
related fields are zero'd. This is true if the MR was just allocated, but
if the MR is recycled through the cache then the values are never zero'd.

This causes a bug in the odp_stats, they don't reset when the MR is
reallocated, also is_odp_implicit is never 0'd.

So we can use memset on a block of the mlx5_ib_mr reorganize the structure
to put all the data that can be zero'd by the cache at the end.

It is organized as an anonymous struct because the next patch will make
this a union.

Delete the unused smr_info. Don't set the kernel only desc_size on the
user path. No longer any need to zero mr->parent before freeing it, the
memset() will get it now.

Fixes: a3de94e3d61e ("IB/mlx5: Introduce ODP diagnostic counters")
Link: https://lore.kernel.org/r/20210304120745.1090751-2-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/mr.c
drivers/infiniband/hw/mlx5/odp.c