[PATCH v7 03/10] net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h

Leon Romanovsky leon at kernel.org
Mon Sep 28 12:22:36 PDT 2026


On Mon, Sep 21, 2026 at 07:35:43PM -0300, Jason Gunthorpe wrote:
> Extract the entire MLX5_SET/GET macro family and their internal
> helpers from device.h into a new lightweight header
> (include/linux/mlx5/mlx5_ifc_macros.h).  device.h cannot be
> included by the VFIO selftest because it pulls in rdma/ib_verbs.h;
> the macros themselves depend only on endian helpers, BUILD_BUG_ON,
> and basic C types.
> 
> The moved macros include the internal helpers (__mlx5_nullp through
> __mlx5_st_sz_bits), all size/address macros (MLX5_ST_SZ_BYTES,
> MLX5_BYTE_OFF, MLX5_ADDR_OF, etc.), the 32-bit accessors (MLX5_SET,
> MLX5_GET, MLX5_SET_TO_ONES, MLX5_ARRAY_SET, MLX5_GET_PR), the
> 64-bit accessors (MLX5_SET64, MLX5_GET64, MLX5_ARRAY_SET64,
> MLX5_GET64_PR), the 16-bit accessors (MLX5_GET16, MLX5_SET16), and
> the big-endian getters (MLX5_GET64_BE, MLX5_GET_BE).
> 
> device.h includes the new header so existing kernel code is
> unchanged.
> 
> Assisted-by: Claude:claude-opus-4.6
> Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> ---
>  include/linux/mlx5/device.h          | 117 +----------------------
>  include/linux/mlx5/mlx5_ifc_macros.h | 133 +++++++++++++++++++++++++++
>  2 files changed, 134 insertions(+), 116 deletions(-)
>  create mode 100644 include/linux/mlx5/mlx5_ifc_macros.h
> 

Thanks,
Acked-by: Leon Romanovsky <leonro at nvidia.com>



More information about the linux-arm-kernel mailing list