From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5D36F440F2; Tue, 28 May 2024 10:17:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78EBE40A89; Tue, 28 May 2024 10:17:29 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 43FE040685 for ; Tue, 28 May 2024 10:17:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716884247; x=1748420247; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cMc5bJLJ9cRdXNkC9EixWg2QzKDgbm5Q7DOswugZEY4=; b=HaLqEQ0aCxRCqm9i6AdM6vQzpjoBTV1AwZgW5jX6i7RztuhtL2Qeji7t AFlbKj2vMxHYBwygP3knE9xGIwooLcRcacVb5ZjbpNoriChWH+9IfaW+P bJCwhPpudToSg+qSy2cUOR565/EJarZ17qsZvgupdPE3KY5G54KZcGtzO /yGQp+f8FVq6b1p27b6/DLRjt4gz8Tmyc7DYsOobQ9O7cmPsR76PG7pT4 GGzGZkixE0CYwuk5c6N77/Htn5cVY0E6Ari9wntGF0PZSMhyBrvfk6tm9 cHgz5S15VOMkP14afgr79uLGBD6WWN5cCF/HFQ67oE4VwRaoTiit5Cj8T g==; X-CSE-ConnectionGUID: pBH/8ULTSYOVfToWNncq+g== X-CSE-MsgGUID: PVpEdT3DRBytaxV5HsBh0A== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="35728407" X-IronPort-AV: E=Sophos;i="6.08,194,1712646000"; d="scan'208";a="35728407" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 01:17:26 -0700 X-CSE-ConnectionGUID: /qP6SYylRAKgAjfudc2MnQ== X-CSE-MsgGUID: XzQbnT/4Ro+Cvf2Yt8p97Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,194,1712646000"; d="scan'208";a="34976564" Received: from unknown (HELO npf-hyd-clx-03..) ([10.145.170.182]) by fmviesa008.fm.intel.com with ESMTP; 28 May 2024 01:17:25 -0700 From: Soumyadeep Hore To: jingjing.wu@intel.com Cc: dev@dpdk.org Subject: [PATCH 13/25] common/idpf: update compiler padding Date: Tue, 28 May 2024 07:35:53 +0000 Message-ID: <20240528073559.867121-4-soumyadeep.hore@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240528073559.867121-1-soumyadeep.hore@intel.com> References: <20240528073559.867121-1-soumyadeep.hore@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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