linux-sg2042/include/linux/mlx5
Tom Herbert b8a4ddb2e8 net/mlx5: Add MLX5_ARRAY_SET64 to fix BUILD_BUG_ON
I am hitting this in mlx5:

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c: In function
reclaim_pages_cmd.clone.0:
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:346: error: call
to __compiletime_assert_346 declared with attribute error:
BUILD_BUG_ON failed: __mlx5_bit_off(manage_pages_out, pas[i]) % 64
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c: In function give_pages:
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:291: error: call
to __compiletime_assert_291 declared with attribute error:
BUILD_BUG_ON failed: __mlx5_bit_off(manage_pages_in, pas[i]) % 64

Problem is that this is doing a BUILD_BUG_ON on a non-constant
expression because of trying to take offset of pas[i] in the
structure.

Fix is to create MLX5_ARRAY_SET64 that takes an additional argument
that is the field index to separate between BUILD_BUG_ON on the array
constant field and the indexed field to assign the value to.
There are two callers of MLX5_SET64 that are trying to get a variable
offset, change those to call MLX5_ARRAY_SET64 passing 'pas' and 'i'
as the arguments to use in the offset check and the indexed value
assignment.

Fixes: a533ed5e17 ("net/mlx5: Pages management commands via mlx5 ifc")
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-13 10:13:24 -04:00
..
cmd.h net/mlx5_core: Fix Mellanox copyright note 2015-04-02 16:33:42 -04:00
cq.h {net,IB}/mlx5: CQ commands via mlx5 ifc 2016-08-14 14:39:15 +03:00
device.h net/mlx5: Add MLX5_ARRAY_SET64 to fix BUILD_BUG_ON 2016-10-13 10:13:24 -04:00
doorbell.h net/mlx5_core: Fix Mellanox copyright note 2015-04-02 16:33:42 -04:00
driver.h net/mlx5: Introduce attach/detach to interface API 2016-09-10 21:21:49 -07:00
fs.h net/mlx5: Add sniffer namespaces 2016-08-18 18:49:59 +03:00
mlx5_ifc.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-09-12 15:52:44 -07:00
port.h net/mlx5: Separate query_port_proto_oper for IB and EN 2016-08-18 18:49:52 +03:00
qp.h {net,IB}/mlx5: Modify QP commands via mlx5 ifc 2016-08-17 17:45:58 +03:00
srq.h {net, IB}/mlx5: Refactor internal SRQ API 2016-06-23 11:20:07 -04:00
transobj.h IB/mlx5: Support setting Ethernet priority for Raw Packet QPs 2016-01-21 12:01:09 -05:00
vport.h net/mlx5: Enable setting minimum inline header mode for VFs 2016-08-17 17:45:59 +03:00