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 1BD6C45D51; Wed, 20 Nov 2024 11:40:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C016E42F63; Wed, 20 Nov 2024 11:40:16 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by mails.dpdk.org (Postfix) with ESMTP id D88F940E36 for ; Wed, 20 Nov 2024 11:40:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732099215; x=1763635215; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=uL2clFWgT/Jmh8hLoJWIbY5ySPjHqoCRa/qYGZN3uC8=; b=Hb+latcKTNlYHFcOWEPkX7oyWYSf4JQR0GuoQnjx/ihYLZPuUkP9T12U 8HpPndTCmBqymakwVDbGNSyRqFzH3fEPiwz9FqVhdc+HaXNiJShckfPf8 zAcRmEygsX9wHfL1xhMpAoUiHwLxkkyI1FCpjrhwBxem3gDqMCExEXtvi QchsLiLmkkgzyK13XFetMl8PyQWElFbLmRM3eXxApjTEqzJlBRdsYOZ0D it+zutzIYqyR3FcdNKTELA2Mi8kZpGVoZ2XtSFJwapnIT5WVa1YWB2e7o VVFbzM/eMxhpWFuhSlZFW+vltlis3C9lswUDpkjHeBlJ9Gx894FMHZXhU w==; X-CSE-ConnectionGUID: Xa7jJ1kMQz2UcGWnTHyNow== X-CSE-MsgGUID: 3A8G23TGSQS74cBt8Slziw== X-IronPort-AV: E=McAfee;i="6700,10204,11261"; a="36056942" X-IronPort-AV: E=Sophos;i="6.12,169,1728975600"; d="scan'208,217";a="36056942" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2024 02:40:14 -0800 X-CSE-ConnectionGUID: R43isd2ARq+z0O9iHzxNIA== X-CSE-MsgGUID: mfbnBnTxThyErciv8YN/Rw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,169,1728975600"; d="scan'208,217";a="127414205" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 20 Nov 2024 02:40:14 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 20 Nov 2024 02:40:13 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 20 Nov 2024 02:40:13 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.46) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 20 Nov 2024 02:40:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vYvtD00P0aMBgdn4QyeKruhij0K0h1CM6Y+Q+LvdyWnKBXuFm/e8Daa72NIhT7n5fijz3/PTCIKrZU+QroWYM3wXzIrzyAV3VSS1N0KDpexchyf1nYGYYnZAMS3WR7zZuVvu0ku7fgf/xsu7pf44oBkOr9gZ6lLsHqtGAGgAu9i9ZYlPwgzINeT0ZZ7nFKcIIpzF9pTTXoN93lLP4Jg4nJohVEPPhZKUf3VUkzRtzvhYOJ+6lmDLKUwu0Cruc7nKam7u7/a5RYhGpgAAENsJl/fyss3noOvAiR8xlwupXthZ+ePJARSyCP4309d23Dde6Rv1BA9+5+ay7O7W9WMLQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i7t6aMKkmCqSFdOG5doRH00aSVJDAoJ7WKZZdfeRjRs=; b=pMv3n/Rhhz2ko5F05ZraaBQkgwOeAOdD++6JfLl/A3nQLYlQOkCJA8fC+dKqAQ2Bq9lqZi1uA0UOfiAhsn7fO8YnkOjsdeTUytQOF40H1I24EMAwc9ecHYTKBxTPChcCCd3jrhu76+zIRqZNeMWeKGCQSnsgesLe/K/lE3gXi6TCb+nR6twx+qUtNJGd2ys+34GMr3loMBlUP8mzmgjW3UVAodcCcqfEdlCplRnvX6jLyUgsy/XeVx8GXByQUY/ipgutAtdflXWLNuBbjHMQ6UF4PklgycImZIAnB5ZxpgPcTn1hvsk8tqKry1gbdiBaj4ZcHJL6o97CZtv6XfrlhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by MW4PR11MB7162.namprd11.prod.outlook.com (2603:10b6:303:212::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.15; Wed, 20 Nov 2024 10:40:11 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b%3]) with mapi id 15.20.8158.023; Wed, 20 Nov 2024 10:40:10 +0000 Content-Type: multipart/alternative; boundary="------------DmL40Qn3D5X60j35O5YbxryY" Message-ID: <4280ad2f-b589-458b-962b-01e193210643@intel.com> Date: Wed, 20 Nov 2024 10:40:07 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 06/21] hash/thash: remove use of VLAs for Windows built To: Andre Muezerie , CC: Konstantin Ananyev References: <1713397319-26135-1-git-send-email-roretzla@linux.microsoft.com> <1732072401-15962-1-git-send-email-andremue@linux.microsoft.com> <1732072401-15962-7-git-send-email-andremue@linux.microsoft.com> Content-Language: en-US From: "Medvedkin, Vladimir" In-Reply-To: <1732072401-15962-7-git-send-email-andremue@linux.microsoft.com> X-ClientProxiedBy: DUZPR01CA0115.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bc::27) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5772:EE_|MW4PR11MB7162:EE_ X-MS-Office365-Filtering-Correlation-Id: e529c258-f014-41ad-76f0-08dd094fb56f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|8096899003; X-Microsoft-Antispam-Message-Info: =?utf-8?B?UFdqMmVyR1ZWMEFFYWVaNmdsUmVwOElWWDNYL1AxNnUxTTVVaVBzS0RhWHd4?= =?utf-8?B?UWp0N29rclhkVVcxMHFOZWRZUzRFZ3c4R2pRNFJHQWdSK3lyV0pNZkNxdFJZ?= =?utf-8?B?anUycXl6MVJtbCtkcnA0R0NSZ3BxdDhiVG14SURLN0xoTlFxaVJmeUdualdP?= =?utf-8?B?MkxkYnBHN2h6TUw2T2NKMGxNRGtJYks1dDA0dVBPemhPbEZhbkM0dTZYZDc5?= =?utf-8?B?S1YyQ2NLQ3hCV011Q3M3S0p4dDlYLzBKcm5FRnhXa3M4cDJJSEptRGU1NUI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lUUXFYajdFdnY4ZzVSZHor?= =?utf-8?B?Z3htY2poZk5NTDhxTWdIVXBUZklLVU9xdTR2NXZKVXM1WmY0QVF1LzgrREVa?= =?utf-8?B?UFZNZERJaFh5OWhOR1h5dVpHUUk5YldmWUNhbUtZQnVteno3M0VnTEpWUGpG?= =?utf-8?B?TmJUOExNc1c3MitJN1F2TXFkczdDSk1VSENvQWlpR0UxWGVOanBXYlowK1l3?= =?utf-8?B?MGROQVdXME1HYk1HQkNsTWZ1U3dOQm4zL0xldDdOY3hGRWlIdnRjNmRlbWJR?= =?utf-8?B?TUpxNHdtWUQ2K0RTY1JjQWtCNWhJVkU3OHJSc3hqU0hnRnpwcGFCQUdRODdR?= =?utf-8?B?cHB6QWpxTDg0SFRIbGJ5alBuMk02em80dkdSbXYwM214ZDFXTEJqU1VaK3Rk?= =?utf-8?B?SFFlRUlJU0xjR0hMakU1Z1M2WHlYWEtJeGtpbVFTWlZWUWVmUzFaanQzY0M0?= =?utf-8?B?cnhDVzE0Sk8xUkg3VXlHMkFYR0JXbk1TU0VnT0ZrTjhvUUlJRXNobDA5dWpU?= =?utf-8?B?QVViSWpyVmc2aVNnQ3Z3YUthTDlvQlRnTG0xUEJ2SlZQODhaa055SGZndTlZ?= =?utf-8?Q?NzuNsQKsD4bIqyummAnDb7QGJdq09/J6aSMQtpF?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(8096899003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MC9zTGU0MG9mbnRlbWJkVXFOUUo1S2IyNDN4L1lJL0ZXMkw5cEFUbWtITHpx?= =?utf-8?B?WWFWVjI2U1VjV1FmeGVkMEdWK3FtaVU5SmRIYm1jTlFIemQ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kxCQ0pEQmVqZExaVDR4TlBnbGhUV1RHazh0MGlLMG9GQnpIaUNjRWNhQ0xO?= =?utf-8?B?RFpndlVnbU1tSUF2OHNocHBpUHZvYjdsYWI0ajV5bHk0dnNFUjZYRlcxcVlH?= =?utf-8?B?R3J3R2ZZRXRrR0srMTlwOGNvaWlCdnNxTitDb3FnZW1pUlo0SkVidHp0aDhY?= =?utf-8?B?SFJXcTgzQ3p1SDYwRGJZQmFMYWozUDI5bExjZFd6TGQyZVNKb1lNU3h5ZEpB?= =?utf-8?B?bUFTOG9BVFJocExpMEE3WmtBSWlrZVY1UDlqd3owMDJ0dUVHRU9UQVBFOXM3?= =?utf-8?B?Ync9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: e529c258-f014-41ad-76f0-08dd094fb56f X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2024 10:40:10.8403 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eZsr5AXLtu+2UdE4z1pE1FS/2XNcJ0IBkaBBHd9yu5vHZIGSvRmz4jxf7MW8cGWtFbPUSuxYJuDDptb1lVPEjB3WoEAi7gp8E9rWSZYU59E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB7162 X-OriginatorOrg: intel.com 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 --------------DmL40Qn3D5X60j35O5YbxryY Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Hi Andre, On 20/11/2024 03:13, Andre Muezerie wrote: > From: Konstantin Ananyev > > 1) ./lib/hash/rte_thash.c:774:9 > : warning: ISO C90 forbids variable length array ‘tmp_tuple’ > > From my understanding, tuple size here should never exceed > sizeof(union rte_thash_tuple), so it should be safe to replace VLA with > fixed size array. The tuple can exceed this size, for example if you use any tunneling header in RSS hash calculation. HereIsuggestusingasa limitthe sizeof thelongestRSShashkeycurrentlysupported,whichis52bytes. Technically, the longest tuple with such a key should be (52 - sizeof(uint32_t)), so you can use this as a size of the tmp_tuple array > > Signed-off-by: Konstantin Ananyev > --- > lib/hash/rte_thash.c | 2 +- > lib/hash/rte_thash.h | 8 ++++++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c > index 336c228e64..842e3ad85d 100644 > --- a/lib/hash/rte_thash.c > +++ b/lib/hash/rte_thash.c > @@ -761,7 +761,7 @@ rte_thash_adjust_tuple(struct rte_thash_ctx *ctx, > uint32_t desired_value, unsigned int attempts, > rte_thash_check_tuple_t fn, void *userdata) > { > - uint32_t tmp_tuple[tuple_len / sizeof(uint32_t)]; > + uint32_t tmp_tuple[RTE_THASH_MAX_L4_LEN]; > unsigned int i, j, ret = 0; > uint32_t hash, adj_bits; > const uint8_t *hash_key; > diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h > index c0af5968df..427246ad2e 100644 > --- a/lib/hash/rte_thash.h > +++ b/lib/hash/rte_thash.h > @@ -121,6 +121,14 @@ __rte_internal > uint32_t > thash_get_rand_poly(uint32_t poly_degree); > > +/** > + * maximum length in dwords of input tuple to > + * calculate hash of ipv(4|6) header + > + * transport header > + */ > +#define RTE_THASH_MAX_L4_LEN \ > + ((sizeof(union rte_thash_tuple)) / sizeof(uint32_t)) > + > /** > * Prepare special converted key to use with rte_softrss_be() > * @param orig -- Regards, Vladimir --------------DmL40Qn3D5X60j35O5YbxryY Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Andre,

On 20/11/2024 03:13, Andre Muezerie wrote:
From: Konstantin Ananyev <konstantin.ananyev@huawei.com>

1) ./lib/hash/rte_thash.c:774:9
    : warning: ISO C90 forbids variable length array =E2=80=98tmp_tuple=E2=
=80=99

>From my understanding, tuple size here should never exceed
sizeof(union rte_thash_tuple), so it should be safe to replace VLA with
fixed size array.

The tuple can exceed this size, for example if you use any tunneling header in RSS hash calculation.

Here= I= suggest using as a limit the size of the longest RSS hash key currently= s= upported, which is 52 bytes. Technically, the longest tuple with such a key should be (52 - sizeof(uint32_t)), so you can use this as a size of the tmp_tuple array


Signed-off-by: Konstantin Ananyev <konstantin.ananyev@huawei.com=
>
---
 lib/hash/rte_thash.c | 2 +-
 lib/hash/rte_thash.h | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 336c228e64..842e3ad85d 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -761,7 +761,7 @@ rte_thash_adjust_tuple(struct rte_thash_ctx *ctx,
 	uint32_t desired_value,	unsigned int attempts,
 	rte_thash_check_tuple_t fn, void *userdata)
 {
-	uint32_t tmp_tuple[tuple_len / sizeof(uint32_t)];
+	uint32_t tmp_tuple[RTE_THASH_MAX_L4_LEN];
 	unsigned int i, j, ret =3D 0;
 	uint32_t hash, adj_bits;
 	const uint8_t *hash_key;
diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h
index c0af5968df..427246ad2e 100644
--- a/lib/hash/rte_thash.h
+++ b/lib/hash/rte_thash.h
@@ -121,6 +121,14 @@ __rte_internal
 uint32_t
 thash_get_rand_poly(uint32_t poly_degree);
=20
+/**
+ * maximum length in dwords of input tuple to
+ * calculate hash of ipv(4|6) header +
+ * transport header
+ */
+#define RTE_THASH_MAX_L4_LEN	\
+	((sizeof(union rte_thash_tuple)) / sizeof(uint32_t))
+
 /**
  * Prepare special converted key to use with rte_softrss_be()
  * @param orig
--=20
Regards,
Vladimir
--------------DmL40Qn3D5X60j35O5YbxryY--