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

[email protected]
Newsgroups org.kernel.vger.kvm
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The newly extracted `mlx5_ifc_macros.h` header lacks necessary include directives for the types and macros it uses, violating the kernel's self-contained header rule.
--

--- Patch [3]: [PATCH v4 03/10] net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h ---
commit 76e6552b0716c94811acb9f5971adc7809d4dee0
Author: Jason Gunthorpe <[email protected]>

net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h

This commit extracts the MLX5_SET/GET macro family from device.h into a new
standalone header, mlx5_ifc_macros.h. The extraction allows VFIO selftests
to use these macros without pulling in the dependencies of device.h.

[ ... ]
> diff --git a/include/linux/mlx5/mlx5_ifc_macros.h b/include/linux/mlx5/mlx5_ifc_macros.h
> new file mode 100644
> index 0000000000000..d357acfd351de
> --- /dev/null
> +++ b/include/linux/mlx5/mlx5_ifc_macros.h
> @@ -0,0 +1,133 @@
> +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
> +/*
> + * Copyright (c) 2013-2026, Mellanox Technologies. All rights reserved.
> + *
> + * Accessor macros for mlx5 IFC structures.
> + *
> + * Extracted from device.h so that code which cannot include device.h
> + * (e.g. selftests) can still use the MLX5_SET/GET family directly.
> + */
> +
> +#ifndef MLX5_IFC_MACROS_H
> +#define MLX5_IFC_MACROS_H

[Severity: Low]
Does this new header need to include its dependencies such as <linux/types.h>,
<linux/stddef.h>, <linux/build_bug.h>, and <asm/byteorder.h>?

Since the commit message mentions this header is intended for independent use
by VFIO selftests, without these includes, files that include this header
directly might fail to compile due to missing definitions for u32, offsetof,
BUILD_BUG_ON, and cpu_to_be32.

> +
> +/* Internal helpers -- 32-bit */
> +#define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
> +#define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.