lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202502070257.jcD8sqxT-lkp@intel.com>
Date: Fri, 7 Feb 2025 02:08:34 +0800
From: kernel test robot <lkp@...el.com>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [gustavoars:testing/wfamnae-next20250203 16/16]
 drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:71:10: error:
 offsetof of incomplete type 'struct
 mlx5_ifc_menu_resource_dump_response_bits'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20250203
head:   c8a61127eedf61fcbf8d3f34301d29a782b9eeb0
commit: c8a61127eedf61fcbf8d3f34301d29a782b9eeb0 [16/16] net/mlx5: Avoid a couple hundred -Wflex-array-member-not-at-end warnings
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250207/202502070257.jcD8sqxT-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250207/202502070257.jcD8sqxT-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502070257.jcD8sqxT-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:4:
   In file included from drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h:7:
   In file included from include/linux/mlx5/rsc_dump.h:4:
   In file included from include/linux/mlx5/driver.h:38:
   In file included from include/linux/pci.h:1660:
   In file included from include/linux/dmapool.h:14:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2224:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:71:10: error: offsetof of incomplete type 'struct mlx5_ifc_menu_resource_dump_response_bits'
      71 |                 menu = MLX5_ADDR_OF(menu_resource_dump_response, data, menu);
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:71:57: note: expanded from macro 'MLX5_ADDR_OF'
      71 | #define MLX5_ADDR_OF(typ, p, fld) ((void *)((u8 *)(p) + MLX5_BYTE_OFF(typ, fld)))
         |                                                         ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:70:34: note: expanded from macro 'MLX5_BYTE_OFF'
      70 | #define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:52:35: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                   ^        ~~~~~~
   include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^                  ~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:71:10: note: forward declaration of 'struct mlx5_ifc_menu_resource_dump_response_bits'
   include/linux/mlx5/device.h:71:57: note: expanded from macro 'MLX5_ADDR_OF'
      71 | #define MLX5_ADDR_OF(typ, p, fld) ((void *)((u8 *)(p) + MLX5_BYTE_OFF(typ, fld)))
         |                                                         ^
   include/linux/mlx5/device.h:70:34: note: expanded from macro 'MLX5_BYTE_OFF'
      70 | #define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
         |                                  ^
   include/linux/mlx5/device.h:52:51: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                                   ^
   <scratch space>:87:1: note: expanded from here
      87 | mlx5_ifc_menu_resource_dump_response_bits
         | ^
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: error: offsetof of incomplete type 'struct mlx5_ifc_resource_dump_menu_segment_bits'
      72 |                 rsc_dump->number_of_menu_items = MLX5_GET(resource_dump_menu_segment, menu,
         |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      73 |                                                           num_of_records);
         |                                                           ~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:96:62: note: expanded from macro 'MLX5_GET'
      96 | #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
         |                                                              ^
      97 | __mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
         | ~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:54:34: note: expanded from macro '\
   __mlx5_dw_off'
      54 | #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:52:35: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                   ^        ~~~~~~
   include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^                  ~~~~
   include/uapi/linux/byteorder/little_endian.h:41:59: note: expanded from macro '__be32_to_cpu'
      41 | #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
         |                                                           ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: note: forward declaration of 'struct mlx5_ifc_resource_dump_menu_segment_bits'
   include/linux/mlx5/device.h:96:62: note: expanded from macro 'MLX5_GET'
      96 | #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
         |                                                              ^
   include/linux/mlx5/device.h:54:34: note: expanded from macro '\
   __mlx5_dw_off'
      54 | #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
         |                                  ^
   include/linux/mlx5/device.h:52:51: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                                   ^
   <scratch space>:89:1: note: expanded from here
      89 | mlx5_ifc_resource_dump_menu_segment_bits
         | ^
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: error: incomplete definition of type 'struct mlx5_ifc_resource_dump_menu_segment_bits'
      72 |                 rsc_dump->number_of_menu_items = MLX5_GET(resource_dump_menu_segment, menu,
         |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      73 |                                                           num_of_records);
         |                                                           ~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:97:30: note: expanded from macro 'MLX5_GET'
      97 | __mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:57:43: note: expanded from macro '__mlx5_dw_bit_off'
      57 | #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
         |                                           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:51:57: note: expanded from macro '__mlx5_bit_sz'
      51 | #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
         |                                        ~~~~~~~~~~~~~~~~~^
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: note: forward declaration of 'struct mlx5_ifc_resource_dump_menu_segment_bits'
   include/linux/mlx5/device.h:96:62: note: expanded from macro 'MLX5_GET'
      96 | #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
         |                                                              ^
   include/linux/mlx5/device.h:54:34: note: expanded from macro '\
   __mlx5_dw_off'
      54 | #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
         |                                  ^
   include/linux/mlx5/device.h:52:51: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                                   ^
   <scratch space>:89:1: note: expanded from here
      89 | mlx5_ifc_resource_dump_menu_segment_bits
         | ^
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: error: offsetof of incomplete type 'struct mlx5_ifc_resource_dump_menu_segment_bits'
      72 |                 rsc_dump->number_of_menu_items = MLX5_GET(resource_dump_menu_segment, menu,
         |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      73 |                                                           num_of_records);
         |                                                           ~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:97:30: note: expanded from macro 'MLX5_GET'
      97 | __mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:57:70: note: expanded from macro '__mlx5_dw_bit_off'
      57 | #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
         |                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:52:35: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                   ^        ~~~~~~
   include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
      16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
         |                                 ^                  ~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: note: forward declaration of 'struct mlx5_ifc_resource_dump_menu_segment_bits'
   include/linux/mlx5/device.h:96:62: note: expanded from macro 'MLX5_GET'
      96 | #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
         |                                                              ^
   include/linux/mlx5/device.h:54:34: note: expanded from macro '\
   __mlx5_dw_off'
      54 | #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
         |                                  ^
   include/linux/mlx5/device.h:52:51: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                                   ^
   <scratch space>:89:1: note: expanded from here
      89 | mlx5_ifc_resource_dump_menu_segment_bits
         | ^
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: error: incomplete definition of type 'struct mlx5_ifc_resource_dump_menu_segment_bits'
      72 |                 rsc_dump->number_of_menu_items = MLX5_GET(resource_dump_menu_segment, menu,
         |                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      73 |                                                           num_of_records);
         |                                                           ~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:97:61: note: expanded from macro 'MLX5_GET'
      97 | __mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
         |                                                             ^
      98 | __mlx5_mask(typ, fld))
         | ~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:58:47: note: expanded from macro '\
   __mlx5_mask'
      58 | #define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
         |                                               ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:51:57: note: expanded from macro '__mlx5_bit_sz'
      51 | #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
         |                                        ~~~~~~~~~~~~~~~~~^
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: note: forward declaration of 'struct mlx5_ifc_resource_dump_menu_segment_bits'
   include/linux/mlx5/device.h:96:62: note: expanded from macro 'MLX5_GET'
      96 | #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
         |                                                              ^
   include/linux/mlx5/device.h:54:34: note: expanded from macro '\
   __mlx5_dw_off'
      54 | #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
         |                                  ^
   include/linux/mlx5/device.h:52:51: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                                   ^
   <scratch space>:89:1: note: expanded from here
      89 | mlx5_ifc_resource_dump_menu_segment_bits
         | ^
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:74:10: error: invalid application of 'sizeof' to an incomplete type 'struct mlx5_ifc_resource_dump_info_segment_bits'
      74 |                 size = MLX5_RSC_DUMP_MENU_HEADER_SIZE;
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:54:41: note: expanded from macro 'MLX5_RSC_DUMP_MENU_HEADER_SIZE'
      54 | #define MLX5_RSC_DUMP_MENU_HEADER_SIZE (MLX5_ST_SZ_BYTES(resource_dump_info_segment) + \
         |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:65:32: note: expanded from macro 'MLX5_ST_SZ_BYTES'
      65 | #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
         |                                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:74:10: note: forward declaration of 'struct mlx5_ifc_resource_dump_info_segment_bits'
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:54:41: note: expanded from macro 'MLX5_RSC_DUMP_MENU_HEADER_SIZE'
      54 | #define MLX5_RSC_DUMP_MENU_HEADER_SIZE (MLX5_ST_SZ_BYTES(resource_dump_info_segment) + \
         |                                         ^
   include/linux/mlx5/device.h:65:46: note: expanded from macro 'MLX5_ST_SZ_BYTES'
      65 | #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
         |                                              ^
   <scratch space>:97:1: note: expanded from here
      97 | mlx5_ifc_resource_dump_info_segment_bits
         | ^
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:74:10: error: invalid application of 'sizeof' to an incomplete type 'struct mlx5_ifc_resource_dump_command_segment_bits'
      74 |                 size = MLX5_RSC_DUMP_MENU_HEADER_SIZE;
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:55:6: note: expanded from macro 'MLX5_RSC_DUMP_MENU_HEADER_SIZE'
      55 |                                         MLX5_ST_SZ_BYTES(resource_dump_command_segment) + \
         |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:65:32: note: expanded from macro 'MLX5_ST_SZ_BYTES'
      65 | #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
         |                                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:74:10: note: forward declaration of 'struct mlx5_ifc_resource_dump_command_segment_bits'
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:55:6: note: expanded from macro 'MLX5_RSC_DUMP_MENU_HEADER_SIZE'
      55 |                                         MLX5_ST_SZ_BYTES(resource_dump_command_segment) + \
         |                                         ^
   include/linux/mlx5/device.h:65:46: note: expanded from macro 'MLX5_ST_SZ_BYTES'
      65 | #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
         |                                              ^
   <scratch space>:99:1: note: expanded from here
      99 | mlx5_ifc_resource_dump_command_segment_bits
         | ^
>> drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:74:10: error: invalid application of 'sizeof' to an incomplete type 'struct mlx5_ifc_resource_dump_menu_segment_bits'
      74 |                 size = MLX5_RSC_DUMP_MENU_HEADER_SIZE;
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:56:6: note: expanded from macro 'MLX5_RSC_DUMP_MENU_HEADER_SIZE'
      56 |                                         MLX5_ST_SZ_BYTES(resource_dump_menu_segment))
         |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mlx5/device.h:65:32: note: expanded from macro 'MLX5_ST_SZ_BYTES'
      65 | #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
         |                                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c:72:36: note: forward declaration of 'struct mlx5_ifc_resource_dump_menu_segment_bits'
      72 |                 rsc_dump->number_of_menu_items = MLX5_GET(resource_dump_menu_segment, menu,
         |                                                  ^
   include/linux/mlx5/device.h:96:62: note: expanded from macro 'MLX5_GET'
      96 | #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
         |                                                              ^
   include/linux/mlx5/device.h:54:34: note: expanded from macro '\
   __mlx5_dw_off'
      54 | #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
         |                                  ^
   include/linux/mlx5/device.h:52:51: note: expanded from macro '__mlx5_bit_off'
      52 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
         |                                                   ^
   <scratch space>:89:1: note: expanded from here
      89 | mlx5_ifc_resource_dump_menu_segment_bits
         | ^
   3 warnings and 8 errors generated.


vim +71 drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c

12206b17235aed Aya Levin 2020-02-11  53  
7ba2d9d8de9669 Aya Levin 2022-03-03  54  #define MLX5_RSC_DUMP_MENU_HEADER_SIZE (MLX5_ST_SZ_BYTES(resource_dump_info_segment) + \
7ba2d9d8de9669 Aya Levin 2022-03-03  55  					MLX5_ST_SZ_BYTES(resource_dump_command_segment) + \
7ba2d9d8de9669 Aya Levin 2022-03-03  56  					MLX5_ST_SZ_BYTES(resource_dump_menu_segment))
7ba2d9d8de9669 Aya Levin 2022-03-03  57  
7ba2d9d8de9669 Aya Levin 2022-03-03  58  static int mlx5_rsc_dump_read_menu_sgmt(struct mlx5_rsc_dump *rsc_dump, struct page *page,
7ba2d9d8de9669 Aya Levin 2022-03-03  59  					int read_size, int start_idx)
12206b17235aed Aya Levin 2020-02-11  60  {
12206b17235aed Aya Levin 2020-02-11  61  	void *data = page_address(page);
12206b17235aed Aya Levin 2020-02-11  62  	enum mlx5_sgmt_type sgmt_idx;
12206b17235aed Aya Levin 2020-02-11  63  	int num_of_items;
12206b17235aed Aya Levin 2020-02-11  64  	char *sgmt_name;
12206b17235aed Aya Levin 2020-02-11  65  	void *member;
7ba2d9d8de9669 Aya Levin 2022-03-03  66  	int size = 0;
12206b17235aed Aya Levin 2020-02-11  67  	void *menu;
12206b17235aed Aya Levin 2020-02-11  68  	int i;
12206b17235aed Aya Levin 2020-02-11  69  
7ba2d9d8de9669 Aya Levin 2022-03-03  70  	if (!start_idx) {
12206b17235aed Aya Levin 2020-02-11 @71  		menu = MLX5_ADDR_OF(menu_resource_dump_response, data, menu);
7ba2d9d8de9669 Aya Levin 2022-03-03 @72  		rsc_dump->number_of_menu_items = MLX5_GET(resource_dump_menu_segment, menu,
7ba2d9d8de9669 Aya Levin 2022-03-03  73  							  num_of_records);
7ba2d9d8de9669 Aya Levin 2022-03-03 @74  		size = MLX5_RSC_DUMP_MENU_HEADER_SIZE;
7ba2d9d8de9669 Aya Levin 2022-03-03  75  		data += size;
7ba2d9d8de9669 Aya Levin 2022-03-03  76  	}
7ba2d9d8de9669 Aya Levin 2022-03-03  77  	num_of_items = rsc_dump->number_of_menu_items;
7ba2d9d8de9669 Aya Levin 2022-03-03  78  
7ba2d9d8de9669 Aya Levin 2022-03-03  79  	for (i = 0; start_idx + i < num_of_items; i++) {
7ba2d9d8de9669 Aya Levin 2022-03-03  80  		size += MLX5_ST_SZ_BYTES(resource_dump_menu_record);
7ba2d9d8de9669 Aya Levin 2022-03-03  81  		if (size >= read_size)
7ba2d9d8de9669 Aya Levin 2022-03-03  82  			return start_idx + i;
12206b17235aed Aya Levin 2020-02-11  83  
7ba2d9d8de9669 Aya Levin 2022-03-03  84  		member = data + MLX5_ST_SZ_BYTES(resource_dump_menu_record) * i;
12206b17235aed Aya Levin 2020-02-11  85  		sgmt_name =  MLX5_ADDR_OF(resource_dump_menu_record, member, segment_name);
12206b17235aed Aya Levin 2020-02-11  86  		sgmt_idx = mlx5_rsc_dump_sgmt_get_by_name(sgmt_name);
12206b17235aed Aya Levin 2020-02-11  87  		if (sgmt_idx == -EINVAL)
12206b17235aed Aya Levin 2020-02-11  88  			continue;
12206b17235aed Aya Levin 2020-02-11  89  		rsc_dump->fw_segment_type[sgmt_idx] = MLX5_GET(resource_dump_menu_record,
12206b17235aed Aya Levin 2020-02-11  90  							       member, segment_type);
12206b17235aed Aya Levin 2020-02-11  91  	}
7ba2d9d8de9669 Aya Levin 2022-03-03  92  	return 0;
12206b17235aed Aya Levin 2020-02-11  93  }
12206b17235aed Aya Levin 2020-02-11  94  

:::::: The code at line 71 was first introduced by commit
:::::: 12206b17235aed1ca6390b3e516825ae276f8345 net/mlx5: Add support for resource dump

:::::: TO: Aya Levin <ayal@...lanox.com>
:::::: CC: Saeed Mahameed <saeedm@...lanox.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ