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 4CD4642477; Tue, 24 Jan 2023 10:06:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4333C42D57; Tue, 24 Jan 2023 10:06:09 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2075.outbound.protection.outlook.com [40.107.244.75]) by mails.dpdk.org (Postfix) with ESMTP id A775E42D36 for ; Tue, 24 Jan 2023 10:06:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zq7dbEULA15KdwBN0u6P7+CTzfgI1dcbiDVJEsWRG4woURCqz+GdMvjMGpaVMXpqRsprOjCIC2Pu58pI+V52BbvH+dK2PkDjKkAIwLUSd1RVZaxN0j9wW/lowTss6ryQRNcfKAYZQ8QT5+6S2AoyWdzRTwnKz3ZcmiehEuZo5JutLWNV7I4QS9rhxlRyuBFPOPwKR1bBFx6pZ9qMxCzcHPQojysAB80w6Xq6wujJOByYtZdfrROSbx6EbAriOntRd0qoSkGiXfK1nhUFUtNgnZgey7IhhHb0cZLu+y0mzKqtMW9nP7vBHaQZz/+cvY0gRU/H64BqGtAkNKxeGMngaw== 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=A6nZC6M5PgaF9pr7GaPeWsXFDxeFNJIdUFgDN48izAVXQl0h8HVPJWEZOK6wPwC4+eJ8yhxZlYbE3Mcf4m00GTup9hXjwamT+LFdUGVzrJN85wyHV+403N5ggfJwmjFmm7dkiviqQZDUhw3I4vJCH659XXxvsif4fzfgubAw9DYtVtzIADehOjUS/iBPlIBWN+68LLhWO5HXrWhR9Q641AyKT/EFu/tSNcpNqJxQ6XVYYk91XQxX9R9+DGAhjxqOp8ioMCcyvUtP76iD4PyXesUIT7BR8Dl1/amBvaYND+HDnSr9MONZiwxoEmibOVFsaxpvmBiEFUTxJejeXzup2Q== 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=2ut21LxC7ZO0zBJYiheP0ZGnN2p5JgT9J6z/jZivwCsSF/6/wcgAU/oI1MiPSfuIduSGlAUreZK/ZuzVr3fwFw895KBk8t6Lzz+kIDwA+zswhjfTkIGqYGPG637tzI9qVbo2IX/mqf219FONqUaxvcj32JmEIx/oPoX6t2kRkJY= Received: from BN9PR03CA0733.namprd03.prod.outlook.com (2603:10b6:408:110::18) by PH7PR12MB5925.namprd12.prod.outlook.com (2603:10b6:510:1d8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 09:06:03 +0000 Received: from BL02EPF000108EA.namprd05.prod.outlook.com (2603:10b6:408:110:cafe::b1) by BN9PR03CA0733.outlook.office365.com (2603:10b6:408:110::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Tue, 24 Jan 2023 09:06:03 +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 BL02EPF000108EA.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.13 via Frontend Transport; Tue, 24 Jan 2023 09:06:03 +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; Tue, 24 Jan 2023 03:06:01 -0600 From: Ferruh Yigit To: Thomas Monjalon , Ori Kam , Andrew Rybchenko , Olivier Matz CC: David Marchand , Subject: [PATCH v3 8/8] net: mark all big endian types Date: Tue, 24 Jan 2023 09:03:00 +0000 Message-ID: <20230124090300.247915-9-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230124090300.247915-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230124090300.247915-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: BL02EPF000108EA:EE_|PH7PR12MB5925:EE_ X-MS-Office365-Filtering-Correlation-Id: 33c775b7-536b-4b03-5fe0-08dafdea384a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6wWR3Ypq6iGndTrD2QV99A+YVt6bJAkv8jo9whztN9l5kJ20B64QOMcL1YEp5rFC9/T89rTl9Hf2VSLQEmXYYSeJ/FxrGmY4K7XlzrX1M/aXKuMlEY8/oTlTwIKeAIN2Ur62lowToeR03jXsxnPGRFz1b0LwmClat73U4t0ekEeX5b9gjNQ+/ALEFurLOpxqE2JTUz9ufTBCrtsEoZV8S6lZHZVJvKx5dU1dLYPNj4lzghZgFwpzQSbmIUaGhduNl8XWeiXPuZ7pg5N6AqP5DOf4sGAQSxhRQYfl9c1Y2nflKUGs0u6WAydPj0hz9iMzJ6WPgX/u2+C6LvKkQlAtworCiN7ggqzd6qMogrvY+qnxkT9vJcC1qjyg5V4L28sHsRJuV/X2+3zXGlVyzDgBNtEaQdhFFMj58ZO3g6s6rYNrd0rpHm++8ZjOLGuFevVRc0ghOOARQO7BwLOT0Zlo/jmBftxF4hTKazogR6Gd9XQOpQYPwN6fpghg3UkD/rOJaS2Zc91dKFrJOWfd9EkHtX3zTW5slkb4SyT5xQOmWDUlpZ7wWlJQt+Pkeku8r0jn2fFjs/4m1dBP9WKcqTLkSw92EOsufF24fBUB1Np6aaLd6ZaihQLSYFlbrPkrJeGQMJzHFjJkA2Q0b7eDIH1b3urtBaN5DZ1hAB8GSoQ0EiIZPBWzezXQA8+1DS+X+/CokjeX329dmqFnD444mTz+qAs2xC4+KjD9G5nkCZTmBbk= 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:(13230022)(4636009)(396003)(346002)(376002)(39860400002)(136003)(451199015)(46966006)(40470700004)(36840700001)(83380400001)(36860700001)(81166007)(82740400003)(41300700001)(356005)(86362001)(82310400005)(44832011)(2906002)(8936002)(5660300002)(4326008)(40460700003)(16526019)(40480700001)(316002)(8676002)(26005)(186003)(70586007)(47076005)(336012)(426003)(70206006)(1076003)(2616005)(54906003)(478600001)(110136005)(7696005)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 09:06:03.4450 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33c775b7-536b-4b03-5fe0-08dafdea384a 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: BL02EPF000108EA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5925 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