• Jason Gunthorpe's avatar
    RDMA/mlx5: Zero out ODP related items in the mlx5_ib_mr · a639e667
    Jason Gunthorpe authored
    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: a3de94e3 ("IB/mlx5: Introduce ODP diagnostic counters")
    Link: https://lore.kernel.org/r/20210304120745.1090751-2-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
    a639e667
mlx5_ib.h 45.4 KB