Thread (7 messages) flat view 7 messages, 5 authors, 2016-10-12

Re: [PATCH net-next] mlx5: Add MLX5_SET64_VCHK to fix BUILD_BUG_ON

From: Saeed Mahameed <hidden>
Date: 2016-10-11 11:59:25

On Tue, Oct 11, 2016 at 7:50 PM, David Laight [off-list ref] wrote:
From: Tom Herbert
quoted
Sent: 11 October 2016 05:22
...
quoted
Fix is to create MLX5_SET64_VCHK that takes an additional argument
that is a constant. There are two callers of MLX5_SET64 that are
trying to get a variable offset, change those to call MLX5_SET64_VCHK
passing pas[0] as the argument to use in the offset check.
I think I'd separate the array index instead.
Something like:

#define MLX5_SET64_INDEXED(typ, p, fld, ndx, v) do { \
        BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
        __MLX5_SET64(typ, p, fld[ndx], v); \
} while (0)

        David
Yes, I think this looks more natural, but instead MLX5_SET64_INDEXED,
I prefer to have 2 macros
MLX5_SET64(typ, p, fld, v) and MLX5_ARRAY_SET64(typ, p, fld, idx, v).

Tom, do you want me to fix it ?

Thanks,
Saeed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help