From patchwork Thu Aug 1 09:27:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 142813 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DBF14570F; Thu, 1 Aug 2024 11:27:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FA7F42EB4; Thu, 1 Aug 2024 11:27:49 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2051.outbound.protection.outlook.com [40.107.236.51]) by mails.dpdk.org (Postfix) with ESMTP id BE8CB402C8 for ; Thu, 1 Aug 2024 11:27:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rh5yZ6mXH+9obADI6s/wQcHDUC0O51d7BYfH0q+BtEAevkHDIFZCVSdhQGJUwI/6cIn6orRZmQJfNeN/+haBDGKbu4QOmsH3NDtEeCpXXgUWY9T93mPk0klYjc4Sj2qWxlseqm12sI096qTkMotTxot6mpKcpcp/7C0HFEF6VcP1Ize95Oy+PHlbY2qNuIlAb17EodavwsG8tVbFigfv0lMtdS+LefMHRaTVU04vgAsLzX3ZLLX1L92Ra00vyu201fViZu+qH8e+aja6jzQM1VQMBQ9Y7HEB+K6O8hegavzEUdXtFViOuLy6JCM8Vl2RbaB7jiDcd3tzAq471l8YXg== 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=uGZOikY4gDbkGiHGNTyQzyPwpfzV7kHndC1HIfSve40=; b=awsYOhVIAtkwtbqVYpHX2FvFWPgkanjAiYtrmgBZ6Rzl1tWlnyEKrqZj53Q64EcM9aJ1hvhLhMksn2rtjTZluTO4qoBPrUuUBuRWXjAoj9Uuh8uKacKlFqnhwBgOB8GJmk+uuSVu/paqnOW9L7FrlFQMf4yysoLv//1SDb3KL+PIjkHtKoCNeP3K2c2yDJ4sNXF4HUn5zax//Klj/II49ehnaQxcWd08UyEsY89tdOfvLns05jld+GZo/TQtdNGpX4OiZRyXEMsmPSy8lSp+2brlcbqVYuR9NP60xLJ84TU5ImSCsi1f9cz0pkpnYrLgAG74x18I+JL8B2sHiX917g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=monjalon.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uGZOikY4gDbkGiHGNTyQzyPwpfzV7kHndC1HIfSve40=; b=Wwyej2V3FTFpKXrsJ3J6kEC11Tz4ZPbEtStgW4pU1iUCAL1t7ktqAINnSfE0vyhVIJFAiXYYAJAgThMnSEpBg7FnpeTjtHBlLTptB/C1ZC2FDexTDeze321KhYSABRE7z4L6S/DejveIwNcWRYmS8eCPfEQoEHrYgioHPnAsSsY= Received: from MW4PR04CA0084.namprd04.prod.outlook.com (2603:10b6:303:6b::29) by SJ0PR12MB7475.namprd12.prod.outlook.com (2603:10b6:a03:48d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.21; Thu, 1 Aug 2024 09:27:44 +0000 Received: from SJ1PEPF00001CE8.namprd03.prod.outlook.com (2603:10b6:303:6b:cafe::5e) by MW4PR04CA0084.outlook.office365.com (2603:10b6:303:6b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.35 via Frontend Transport; Thu, 1 Aug 2024 09:27:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE8.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Thu, 1 Aug 2024 09:27:43 +0000 Received: from dpdk-rc.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 1 Aug 2024 04:27:41 -0500 From: Ferruh Yigit To: Thomas Monjalon , Ori Kam , Andrew Rybchenko CC: Subject: [RFC] ethdev: convert string initialization Date: Thu, 1 Aug 2024 02:27:22 -0700 Message-ID: <20240801092722.3732917-1-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE8:EE_|SJ0PR12MB7475:EE_ X-MS-Office365-Filtering-Correlation-Id: cf2a254a-e14d-45cb-07aa-08dcb20c325e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?eCZiyDsrGB77XJ8c9QNDTOusuIk1iig?= =?utf-8?q?6S8tQMZ2C1B/j03xA7JI6KhMLewwCXNkonv58r+LaVWUBaJPB4Dk+ZVvtowksCWc+?= =?utf-8?q?QncE/Kg6GMk/Xb+QINttkzyhWk57QOJ98tnlkt0JrNH+E5s/OVSZD+bkwLI8Rendi?= =?utf-8?q?dTSebq+8m2Mk9jvoffQP6vN7ScuVrQYDQUGrUS8Np40y2KXKHgjASfHqEH3dzFtV4?= =?utf-8?q?fAccoqrQ11TU81p2mkmCAcOfF7vfXAKP4urSU4gWDvGFyt/1x0C+hZCg8dpKAt9vG?= =?utf-8?q?LCVLx+IyQvxyBG7qSU5xeh1WXlDakqnyj8gQQfeJZQPNSHWlwL2nxuu5Y6nFF+J7n?= =?utf-8?q?GkIUQ6Qd9Yqnjpla2/6Pa8xc6sIshzRaiMeWm5BY708PuG7J5nLTyXSyyWP/klaAH?= =?utf-8?q?cQuhSpK2Yhpkl/y6Y+mayqrddU6chM2Iqbx8678qG94tidu1ci9ZweWWLZeL9smMM?= =?utf-8?q?X/4mYKwEd6DAJEIgvAnMrPc1PfBne+Yqi5istD03d3EhHkQT4/HPKKBPQEssqk5RY?= =?utf-8?q?bQTn2Crk61+1q1rZjBbiYDoGA9RhBdpu497fNKKRU9UmUkzGlN0YYI/FCa/Vvd8pG?= =?utf-8?q?RV+8Y2tUidBxRkmK9SA7nEmkqGCMGUUYcbbcjwuIJ5v1+Ec3Db6x1UEcNqRu2ZGdI?= =?utf-8?q?2tONYDB9rSVh17k4RmUE+2gXggL+/3eXuALi5HjpVIiTEiyZsKqpcFwvGakNP4grg?= =?utf-8?q?tfP9NxWo0F7B7Fb4rt+z3YCCbAg8oDyhn0Sc2yJaFyKejp0wpIEIRST1bSEpEdABn?= =?utf-8?q?bbsRCXgTYNzvlnYr/ragP33v9stv4IHAq8SDa4S6DS9q/doTedT+VunOYH4htxroS?= =?utf-8?q?jpu8D8SXBktgxhE3L6DvB9hBErZv7mgM43YQG4qkjkAhQ2aXVpsYd8IQT82pROMJt?= =?utf-8?q?/RGcRxoyR8m2NNFuBG4yMY1Hz///TDIvzL37XTCgJgWbxrkoZ9KfXrmXs9OeGsOlJ?= =?utf-8?q?JqvLRPeMHvCZoyPfKQRtJoGFGFGrXBA9hcEDfTkYv6AknQt+8bkRBARWPFN07ABuN?= =?utf-8?q?PFm4UJs2DLlpD9mrOx8A0PbyYqufcRtTA4Xy3btMTEicsC1gUBBekoiRoQ2lDcrx/?= =?utf-8?q?V2qDrHXDmF1b7j/NaFVkljN4yvdDtsHG26Pp6mQ9Liej9LdETnWRmmMgiIjqBz0NK?= =?utf-8?q?7Gh6SFkosHs58C23oIXKSumjaj6g5py5Vq4YXLKjXw/3XWxw+DdWcq12zJw6XRYVH?= =?utf-8?q?XOXafpWcvr3rcaUArUTjksuIIHeHqyE+S5GtCtL611QobS2Fengaj8Wb7AbIYOh9W?= =?utf-8?q?Fp8enggeisAmfZfUZfq9tY+3EXgmoUzuCGd59aO6kxPMHBYmK76IyjyafGFDo8v2w?= =?utf-8?q?A8uGOdFLPFAMV90/wV1ZvQ28zm1Hsf5MUAh8EKG5WIfqLXkQjrOLg69bDIAgDN0Yz?= =?utf-8?q?gYXci2zwrJQ?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 09:27:43.2736 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf2a254a-e14d-45cb-07aa-08dcb20c325e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7475 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 gcc 15 experimental [1], with -Wextra flag, gives warning in variable initialization as string [2]. The warning has a point when initialized variable is intended to use as string, since assignment is missing the required null terminator for this case. But warning is useless for our usecase. I don't know if this behaviour will change in gcc15, as it is still under development. But if not we may need to update our initialization. In this patch only updated a few instance to show the issue, there are many instances to fix, if we prefer to go this way. Other option is to disable warning but it can be useful for actual string usecases, so I prefer to keep it. [1] gcc (GCC) 15.0.0 20240801 (experimental) [2] ../lib/ethdev/rte_flow.h:906:36: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 906 | .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:907:36: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 907 | .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:1009:25: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 1009 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:1012:25: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 1012 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/ethdev/rte_flow.h:1135:20: error: initializer-string for array of ‘unsigned char’ is too long [-Werror=unterminated-string-initialization] 1135 | .hdr.vni = "\xff\xff\xff", | ^~~~~~~~~~~~~~ Signed-off-by: Ferruh Yigit Acked-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Morten Brørup --- lib/ethdev/rte_flow.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index f864578f806b..8b623974cd44 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -903,8 +903,8 @@ struct rte_flow_item_eth { /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */ #ifndef __cplusplus static const struct rte_flow_item_eth rte_flow_item_eth_mask = { - .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", - .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", + .hdr.dst_addr.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .hdr.src_addr.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, .hdr.ether_type = RTE_BE16(0x0000), }; #endif @@ -1005,12 +1005,10 @@ struct rte_flow_item_ipv6 { #ifndef __cplusplus static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { .hdr = { - .src_addr = - "\xff\xff\xff\xff\xff\xff\xff\xff" - "\xff\xff\xff\xff\xff\xff\xff\xff", - .dst_addr = - "\xff\xff\xff\xff\xff\xff\xff\xff" - "\xff\xff\xff\xff\xff\xff\xff\xff", + .src_addr = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .dst_addr = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, }, }; #endif @@ -1132,7 +1130,7 @@ struct rte_flow_item_vxlan { /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */ #ifndef __cplusplus static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { - .hdr.vni = "\xff\xff\xff", + .hdr.vni = { 0xff, 0xff, 0xff }, }; #endif