With the introduction of the flex array support, DECLARE_FLEX_ARRAY macro was used in virtchnl2_rss_key struct with the wrong assumption that it adds the required padding byte (8 byte structure alignment), to avoid the compiler added padding. But the actual padding byte was added by the compiler (found using pahole tool).
Everything worked with the current structure format because it didn't change the virtchnl message format on the wire except for the extra padding byte which was added at the end of the message. With DPCP (doesn't yet support flex arrays) using the virtchnl message size checks, it fails the SET RSS key message because the driver (supports flex arrays) sends an extra byte of memory than the expected size. To fix this issue and also not break the backward compatibility, use "packed" structure attribute which tells the compiler not to introduce any padding. Also drop the DECLARE_FLEX_ARRAY macro as it is not needed. Signed-off-by: Soumyadeep Hore <soumyadeep.h...@intel.com> --- drivers/common/idpf/base/virtchnl2.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 97e3454df9..95fca647b1 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -1669,13 +1669,13 @@ struct virtchnl2_rss_key { __le16 key_len; u8 pad; + u8 key[STRUCT_VAR_LEN]; #ifdef FLEX_ARRAY_SUPPORT - DECLARE_FLEX_ARRAY(u8, key); +} __packed; #else - u8 key[1]; -#endif /* FLEX_ARRAY_SUPPORT */ }; -VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_rss_key); +#endif /* FLEX_ARRAY_SUPPORT */ +VIRTCHNL2_CHECK_STRUCT_VAR_LEN(8, virtchnl2_rss_key, key); /** * struct virtchnl2_queue_chunk - Chunk of contiguous queues -- 2.43.0