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 9038242493; Thu, 26 Jan 2023 17:20:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09F4842D97; Thu, 26 Jan 2023 17:19:44 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id C6FCA42DBB for ; Thu, 26 Jan 2023 17:19:42 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nX4zLrqXJYA32PXC/0JJgX9D5QcpTCMuYvgavYFx7y4BJ72B2ElnT0dfXhq7A3bRBkmAKHCpNsoRfwf40zSOmEpq3+z6vh78lkTVPPthK721ofLtE87UJyTh59aI6c1hHizqar8W//UMBlk69e/403KTidhR6OEGLx7LzBvhKuroeil20koxuO2OI9MXEHhVuveltaB9m5jxsthz01Pcti4FJ/woZ5mKm7Nb3e038LXJLpZTZMBWN8k1ySk5Fe/M1Ng4PwZvm0vztj3+zM5uqbbiJrYqeuiEGvDkYJXrfGHa7v+ESV0leaHDTxwpjgBlG62mbfaks6tXJGi7l+xrng== 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=FJFNW4K1sQYY6rBdNxzJ+OPAM0Anb95ERdv1n4LPXCw=; b=nzp4LGVDxGrMOM/Mncp4vMzC6E+mxoXLima1nKVWKRdMh4U/gZ1/kJrRf6xxqNhXrweS6503cVbL13Kj93kMqOwNtudHH7eSdh7xzBLGUIyXUHd2dEzRyxaT4FF24CzEMG1AzF1P5ipulEHvwvvI88DcXKeRw6XJftzq9eQs8JEdgOeWddxaYyDaVpOgMI4kDQ/Ko3eFafLxgMEUkUqyE/5CLmcn8mBO0DbNZldq+ce1rSEK4Ssn7DAVBsX8XznXGUZEAdpRhyVnBkkrQxUFvhn+reQ9JlU9PD/Noq79klaYQDqZUV1P7BmsEHTB6w1jsNt097tvsvxqy/hvZ0OnyQ== 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=FJFNW4K1sQYY6rBdNxzJ+OPAM0Anb95ERdv1n4LPXCw=; b=5f588FdX6cTaHyNuvOJT+3MwwZV3RSLxA/m3E4SbCIzN7trXUwtbNd+xpNFqz4WSUz1iQb7XCfX1ABs8PlUSQtv9qNoMgH4c3WA4oUhAo+Det6VQBQq+nY5BUCEBm1sZBy2GIuqwx6VZKzmWFzw4iBIOSg7JI3Q233SYU9rQOC4= Received: from BN9PR03CA0202.namprd03.prod.outlook.com (2603:10b6:408:f9::27) by MN0PR12MB5833.namprd12.prod.outlook.com (2603:10b6:208:378::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.21; Thu, 26 Jan 2023 16:19:40 +0000 Received: from BN8NAM11FT081.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f9:cafe::10) by BN9PR03CA0202.outlook.office365.com (2603:10b6:408:f9::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Thu, 26 Jan 2023 16:19: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 BN8NAM11FT081.mail.protection.outlook.com (10.13.177.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.17 via Frontend Transport; Thu, 26 Jan 2023 16:19: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, 26 Jan 2023 10:19:39 -0600 From: Ferruh Yigit To: Thomas Monjalon , Ori Kam , Andrew Rybchenko , Olivier Matz CC: David Marchand , Subject: [PATCH v5 8/8] net: mark all big endian types Date: Thu, 26 Jan 2023 16:19:04 +0000 Message-ID: <20230126161904.864517-9-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126161904.864517-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230126161904.864517-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT081:EE_|MN0PR12MB5833:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d8f88d5-10ae-46ec-8f09-08daffb920a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YkpTARhOxAh6ttsbwlGGasU8VsV3dhmDa7N6rgXQ+2Nqpjp7OTkxdFbcwtiDgOkyQFodeejlk9nFIFzwjSx+7BvcWm/LmOk4J7WMCAJ9nbkujLW595Ql+NNRB5ZmmAbb3tlOOM080hzK3SnW9pb3DWgt8PetP9/9pmDOSJTj2gXhXXe1+vRsb1JA563sVZ4h5xEZLBkZa2Gl/lgP+0WmjRx7HKLMbp9ru8U93zNqxbwiPVUQ8qVH4FVF8Vy7eCaZd7Wccug+MtMh06WP4tAU2yDzfuFNKQVsLw8ta0xhZHfQ9MdjwsjfUisnGTnrtePG/G6Dv5FzyhmtS2Ym/S+CwCEU9ctYA9kQwGtjsZMtDdXOR1UDpdfU/9YWvD8ohILbmwrAgjtygxU1/AmX+BDOPhHE0Ru6q08uyeS8rv513/VFozrOnNHk+NePf5jOyigJbLDgMFbwc81AFxEVQDjW7fHd7mOfxlOFJ9Cv9wAw9JDfWdA0KOaw23NLMOkKKXfYzvd1LX4daLMWUUCNP4/B+Fkuai4HFOxpQgnM6YGiqmVjZ4nVLyarW8aPtm+wS7+cDmEubRSO2HEV+fu0mNAhSCrivqTlOcwG++QPs3rHjC7rHf7dP03X52tyAgrygisySDvFEfm4a0tz1F2ttlpnJwIphOhHjNjSFlw7j+Eq1eamXFj8dNLQPRSaYC+qP10dH4tDFFfxBajKYGotMrvX89Il3k0WyJI4WzwxVkOQuOQ= 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)(346002)(376002)(396003)(39860400002)(136003)(451199018)(46966006)(36840700001)(40470700004)(5660300002)(16526019)(2906002)(8676002)(4326008)(70586007)(186003)(8936002)(70206006)(41300700001)(426003)(83380400001)(7696005)(478600001)(336012)(6666004)(1076003)(316002)(26005)(2616005)(44832011)(82310400005)(47076005)(82740400003)(110136005)(54906003)(81166007)(36756003)(356005)(86362001)(40460700003)(40480700001)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2023 16:19:40.7591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d8f88d5-10ae-46ec-8f09-08daffb920a2 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: BN8NAM11FT081.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5833 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 --- 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..151e6c641fc5 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.25.1