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 003AB41BAE; Thu, 2 Feb 2023 13:46:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7350D42FD8; Thu, 2 Feb 2023 13:45:45 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2053.outbound.protection.outlook.com [40.107.220.53]) by mails.dpdk.org (Postfix) with ESMTP id 52E1442FD8 for ; Thu, 2 Feb 2023 13:45:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W5rPy8CQUDughqSnaZE7T4U48vXEzG3Prv0mI4wrDFCdc6vjrPr8wZYW4rJEiS6oKspaqrqJfs7D7Fzq2/th+50KuvLgByH2iTda02Qdcju+solevxrrCcJolQL2gA9Ux5GyrKk+W3UQFAYNv62J8PXZpYzEQ8U53DkJbiOwvohPvvBMK4EEUpoyf5LC2QBpnwxuYc6EoVQf2XKNIU/CHfwrUp73mkEzOg6o8PzGN789iL1f3AQTbCx9/XwmQP4A6y7a8+1FlB/RvoDRbX/jZFYYxbVY2WIIpZYNKB7ROA9wohedngpvxEJ6PyAxLv8kF7ewYEGcwIpnEkKjjbTN1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=1WUAGuqt5AOm5Qwvd1UJuCySTaUS8fuB/zX774laJ94=; b=Z/B2T04KRVddt/ZJMjdRJXeFGMWWqrCs5DPvoRiyQbpm6pDpqea3s4OsfVi66J6Hf0FrhbRxr0ZKRTn5ltCPSeQpvW0bCcQCAGZS9CfsuehdwEispa2LgpSWdXsX5qL/fqz/q9roR/Bz6rJ4kmRftpJ8cAGhBBZJ3+T2aPJy8tfrfMn+UtNUbk4QT1GNDKhKbf+Y2DDGokCJbLHqRI0yZwKyfc0+SH5M4DHNLcE8ArYm91Qz/YauSeyrOElvTkQxtx5wgPRUr6AirlLf2EUJxQ8scaanWf8xlmxgo3IfJ7G6wveEc03k0IQOEYwT64MZWLxJh4ANu29yskdoF0t3JA== 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 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=1WUAGuqt5AOm5Qwvd1UJuCySTaUS8fuB/zX774laJ94=; b=CJpAWDJiicCyioS7ZfjkEDbiUoWZmi0YY+cB/2xwQCwGw1A4SCeAsugK2di2zbuDlGO2a/ejeP32VuFYLayGkN6ZdRYjn6bb/DP58WMdrA7eGIvqRAIu5hcOyXUjy+QEU00YzyOiQbNwvGa7xgTU25ds9XL3PbrZmqUD7TFL+Vw= Received: from MW4PR03CA0024.namprd03.prod.outlook.com (2603:10b6:303:8f::29) by SJ0PR12MB8139.namprd12.prod.outlook.com (2603:10b6:a03:4e8::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25; Thu, 2 Feb 2023 12:45:40 +0000 Received: from CO1NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::20) by MW4PR03CA0024.outlook.office365.com (2603:10b6:303:8f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 12:45:40 +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 CO1NAM11FT037.mail.protection.outlook.com (10.13.174.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 12:45:40 +0000 Received: from telcodpdk.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.2375.34; Thu, 2 Feb 2023 06:45:39 -0600 From: Ferruh Yigit To: Thomas Monjalon , Ori Kam , Andrew Rybchenko , Olivier Matz CC: David Marchand , Subject: [PATCH v6 8/8] net: mark all big endian types Date: Thu, 2 Feb 2023 12:45:00 +0000 Message-ID: <20230202124500.2578857-9-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202124500.2578857-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230202124500.2578857-1-ferruh.yigit@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: CO1NAM11FT037:EE_|SJ0PR12MB8139:EE_ X-MS-Office365-Filtering-Correlation-Id: a18512dd-fba1-4fd7-a4e6-08db051b6410 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HI0NUpW6atYXq5ZPLDqCfUshROmwvxfPAdl6m3a02buosTtmNiM7kUBfUiGvFlXZXr4Ol0iqpklDA7AXHY0Vryz4xwAL0UgsAkq3T1lVMYEyjr6UOk1dZH0dXpnGvOvrGVtD/tx6FSsNSiP0WAzepBVofJrjoRuHXbcOsJquSB/wyh8/P+1hHYDAVTf7UFi+2bJu0q6m+FEYLlurAOl5XddX6KtX0sWZJJCuGJX7pEEPtxI2GaxSXeKcedJDZoSTWcIxQFiN4GE3p0PemGmO5TIt8gAWaR5q8EPtYeVg1yChEBtc/tyN4RWDazxvXxoDdDa4WV7hkhYuz4dsVg9VdvLyS37IhlxUF05AkkHbgSCyAgN9t3++ajZU5ctpoh3MfHCTCMyevRoDTxWzQAPiYHpSNNOTrtbl4DF++i4oi9ZYdFzUHSNnz9vPFoU8vx1L/chP32ogFVt/j2OxT/avQAp2LhX0sneBnU2Ie9rWCfra8Y0FTqF7YiTx6xFRd4RoID6/ISi4LEyg2v00cIKaV5wTxBm9vvFcQ1G0is2lKZKey465UFHokaoHVI7cblEW3H4Gm8xV8phM8utRZhCOnjFOijJnY4XYn5+YCM5dphpk9g8ZTdB6Pyz9lqTDWEdlX+2NWAM06diV7aU4EFTd8chWM+ylOdb/DZIPqcnb0WyjIekYLAsAN3U1cHdluiHXiVKRe/6pAvBFvVVBUfNezeEy5WLFYPjD+8cg9Ev2SEw= 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:(13230025)(4636009)(39860400002)(376002)(346002)(136003)(396003)(451199018)(36840700001)(40470700004)(46966006)(36860700001)(8936002)(41300700001)(5660300002)(336012)(47076005)(83380400001)(426003)(82740400003)(316002)(110136005)(16526019)(2906002)(54906003)(186003)(44832011)(2616005)(8676002)(26005)(70206006)(81166007)(1076003)(6666004)(40480700001)(356005)(4326008)(86362001)(70586007)(7696005)(40460700003)(36756003)(82310400005)(478600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2023 12:45:40.2563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a18512dd-fba1-4fd7-a4e6-08db051b6410 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: CO1NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8139 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 From: Thomas Monjalon Some protocols (ARP, MPLS and HIGIG2) were using uint16_t and uint32_t types for their 16 and 32-bit fields. It was correct but not conveying the big endian nature of these fields. As for other protocols defined in this directory, all types are explicitly marked as big endian fields. Signed-off-by: Thomas Monjalon Acked-by: Ferruh Yigit Acked-by: Andrew Rybchenko --- lib/ethdev/rte_flow.h | 4 ++-- lib/net/rte_arp.h | 28 ++++++++++++++-------------- lib/net/rte_gre.h | 2 +- lib/net/rte_higig.h | 6 +++--- lib/net/rte_mpls.h | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index a215daa83640..99f8340f8274 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -642,8 +642,8 @@ struct rte_flow_item_higig2_hdr { static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = { .hdr = { .ppt1 = { - .classification = 0xffff, - .vid = 0xfff, + .classification = RTE_BE16(0xffff), + .vid = RTE_BE16(0xfff), }, }, }; diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h index 076c8ab314ee..c3cd0afb5ca8 100644 --- a/lib/net/rte_arp.h +++ b/lib/net/rte_arp.h @@ -23,28 +23,28 @@ extern "C" { */ struct rte_arp_ipv4 { struct rte_ether_addr arp_sha; /**< sender hardware address */ - uint32_t arp_sip; /**< sender IP address */ + rte_be32_t arp_sip; /**< sender IP address */ struct rte_ether_addr arp_tha; /**< target hardware address */ - uint32_t arp_tip; /**< target IP address */ + rte_be32_t arp_tip; /**< target IP address */ } __rte_packed __rte_aligned(2); /** * ARP header. */ struct rte_arp_hdr { - uint16_t arp_hardware; /* format of hardware address */ -#define RTE_ARP_HRD_ETHER 1 /* ARP Ethernet address format */ + rte_be16_t arp_hardware; /**< format of hardware address */ +#define RTE_ARP_HRD_ETHER 1 /**< ARP Ethernet address format */ - uint16_t arp_protocol; /* format of protocol address */ - uint8_t arp_hlen; /* length of hardware address */ - uint8_t arp_plen; /* length of protocol address */ - uint16_t arp_opcode; /* ARP opcode (command) */ -#define RTE_ARP_OP_REQUEST 1 /* request to resolve address */ -#define RTE_ARP_OP_REPLY 2 /* response to previous request */ -#define RTE_ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ -#define RTE_ARP_OP_REVREPLY 4 /* response giving protocol address */ -#define RTE_ARP_OP_INVREQUEST 8 /* request to identify peer */ -#define RTE_ARP_OP_INVREPLY 9 /* response identifying peer */ + rte_be16_t arp_protocol; /**< format of protocol address */ + uint8_t arp_hlen; /**< length of hardware address */ + uint8_t arp_plen; /**< length of protocol address */ + rte_be16_t arp_opcode; /**< ARP opcode (command) */ +#define RTE_ARP_OP_REQUEST 1 /**< request to resolve address */ +#define RTE_ARP_OP_REPLY 2 /**< response to previous request */ +#define RTE_ARP_OP_REVREQUEST 3 /**< request proto addr given hardware */ +#define RTE_ARP_OP_REVREPLY 4 /**< response giving protocol address */ +#define RTE_ARP_OP_INVREQUEST 8 /**< request to identify peer */ +#define RTE_ARP_OP_INVREPLY 9 /**< response identifying peer */ struct rte_arp_ipv4 arp_data; } __rte_packed __rte_aligned(2); diff --git a/lib/net/rte_gre.h b/lib/net/rte_gre.h index 210b81c99018..6b1169c8b0c1 100644 --- a/lib/net/rte_gre.h +++ b/lib/net/rte_gre.h @@ -50,7 +50,7 @@ struct rte_gre_hdr { }; rte_be16_t c_rsvd0_ver; }; - uint16_t proto; /**< Protocol Type */ + rte_be16_t proto; /**< Protocol Type */ } __rte_packed; /** diff --git a/lib/net/rte_higig.h b/lib/net/rte_higig.h index b55fb1a7db44..bba3898a883f 100644 --- a/lib/net/rte_higig.h +++ b/lib/net/rte_higig.h @@ -112,9 +112,9 @@ struct rte_higig2_ppt_type0 { */ __extension__ struct rte_higig2_ppt_type1 { - uint16_t classification; - uint16_t resv; - uint16_t vid; + rte_be16_t classification; + rte_be16_t resv; + rte_be16_t vid; #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint16_t opcode:3; uint16_t resv1:2; diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h index 3e8cb90ec383..51523e7a1188 100644 --- a/lib/net/rte_mpls.h +++ b/lib/net/rte_mpls.h @@ -23,7 +23,7 @@ extern "C" { */ __extension__ struct rte_mpls_hdr { - uint16_t tag_msb; /**< Label(msb). */ + rte_be16_t tag_msb; /**< Label(msb). */ #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN uint8_t tag_lsb:4; /**< Label(lsb). */ uint8_t tc:3; /**< Traffic class. */ -- 2.34.1