From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 08C6941BBE;
	Fri,  3 Feb 2023 17:50:06 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D40E742D55;
	Fri,  3 Feb 2023 17:49:36 +0100 (CET)
Received: from NAM10-MW2-obe.outbound.protection.outlook.com
 (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88])
 by mails.dpdk.org (Postfix) with ESMTP id D923342D70
 for <dev@dpdk.org>; Fri,  3 Feb 2023 17:49:34 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Eb3/Q/VIodXqqi7YkG/bZBeJWH96zjZNpPparG5wNLiL4/usgwSQ8CQ4TQG+y+G91p3IW+aJh2yPTD6utOpjnfdtG49C0DQqEfU+t+zE0bp7XJybn4HF301qPcp8LxA/CavFK9FllVRb+LaQQZp+PWYzypt+iQW4P9B7rl0ogYrLnANb1Q4vx2u+CgjUWGdrFqdMRhl14yibqQ7hOwceiVwDdFdGsFlVb64SWhAHCCVf5LHLwo6b9obAqxLQPY4IbBe4hTGva47h1israTGLyUYzLeG1O+UAM+Udbb+WcOBHxYCa6Ci6MPJwSKZJCiK0QozMdh3bXK4V9Cmk2yk1Uw==
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=YVm4UCPrzTC038NBS/tkQit8iFZnhUQU0xxJJ2d1RwM=;
 b=GvVHFA5Ml7397/kKO3XSGdqrRCnxoWVQm+Nh2JBUiDkq0Mdg3Wix2dWDHwmBFqoF3p+loRV3xMCq94Kqed4QHoi8S+KCeBw5OrwPeuk5tJ/BKwlgaEAZsWTkbC9FSTtKxvd3AxPGBof2ZuzVWiyJHiKnrtNNZG6Lh5hYyAUq4EuRm+NPPZbLdLpXvvNqkLJ2xmIsFanTZdsfwJ1DU74eJ4ASQzK8nuR2NtZH7LuP+8Rx52p0ly5Ds/rwxKz0VYvSdsIqAgJwWNsyF2nCKdSpZ7jIqWviPAcEVVVu6goIeMXhzrOAD4SycnnLje5gr5UKTqIFWMMJDufa1mGI1ZJQOA==
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=YVm4UCPrzTC038NBS/tkQit8iFZnhUQU0xxJJ2d1RwM=;
 b=jg2H0He3L1crXjNaQDtE3Jnqp/DRU3eR6a8F5RExRMOOexZx4/rTshIYsFbHqFhZGWVmSSVzNQXNYCRYjRTuXaQSiiv/z0lx4dHv2R7X1QsyyklOivqAmaZiy+glCLXFLcW/AFdlHseGS6/5Po+TwCAs8JNo2CoBJsT96SkylvY=
Received: from DS7PR06CA0053.namprd06.prod.outlook.com (2603:10b6:8:54::8) by
 IA1PR12MB6185.namprd12.prod.outlook.com (2603:10b6:208:3e7::21) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Fri, 3 Feb
 2023 16:49:30 +0000
Received: from DS1PEPF0000E65C.namprd02.prod.outlook.com
 (2603:10b6:8:54:cafe::8) by DS7PR06CA0053.outlook.office365.com
 (2603:10b6:8:54::8) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend
 Transport; Fri, 3 Feb 2023 16:49:30 +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
 DS1PEPF0000E65C.mail.protection.outlook.com (10.167.18.74) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.20.6064.21 via Frontend Transport; Fri, 3 Feb 2023 16:49:30 +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; Fri, 3 Feb
 2023 10:49:29 -0600
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Thomas Monjalon <thomas@monjalon.net>, Ori Kam <orika@nvidia.com>, Andrew
 Rybchenko <andrew.rybchenko@oktetlabs.ru>, Olivier Matz
 <olivier.matz@6wind.com>
CC: David Marchand <david.marchand@redhat.com>, <dev@dpdk.org>
Subject: [PATCH v7 7/7] net: mark all big endian types
Date: Fri, 3 Feb 2023 16:48:54 +0000
Message-ID: <20230203164854.602595-8-ferruh.yigit@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20230203164854.602595-1-ferruh.yigit@amd.com>
References: <20221025214410.715864-1-thomas@monjalon.net>
 <20230203164854.602595-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: DS1PEPF0000E65C:EE_|IA1PR12MB6185:EE_
X-MS-Office365-Filtering-Correlation-Id: 1d52d90f-3763-49ad-ffaf-08db06069eaf
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: CDenfF0IBAclSASWGoGz2ec0BF6FIF6yjmt0zy2Ry0Dw/fcw0M85eCyBRzcEnz0unYYVFq41ElwozadpLvWKunpIlEkP71TeBCkauJeznEYO6Cn/aJD0mQ9VyukclxmFnCLUUIrawPqGb7HueXbsqNqG5de2KOZzOxU7J8K4uE8YC168eK3mfp0eZJnvb2tXG6BJ8eYTsOhe47nsmyT4SgR1pzN9GLUUsKz/VAyPYRQ+8yuTqUBizr8iNzZAS6ppRurRVXMwexcOvx8pzMI6+TsoVc77ON0g7xl2d4Ji0ysuKiIbBNSF3xHq9EFed1Ie/qPlDq8IBaxk7u7Xa3cpAq1HTFczIrLxrW14bJl2+CWCldZ0CM3+DBBCHhNQt7beEJzT5bhWqotJy21tAU05bABSCT2PlPKRVfVRBl8FItee8FGTyz84eEMXgQWFn2tCSOaVJxoZDfxVH3gRVwJyMFmLc/f8LmA75FcEN6DWG4yuCX/IyRbcBi5+RYCOLGCMcA/trdR00rHq0SjdPIcFGRz3ixf8Vm2L+NFc1f2ciqUDbVXgKb6v63+aJrgBiXC4QASjs4iGVCa+imD4f3nMaheZsdiJ1+Z4AjvKH4+risRMlNXqiC3IbzIzthqLH0f+j0bPpQnaGYR1ddV0wsFBWKF9FGs4YDtGXnZQkn0tjoYtw/8hs2mchbUlVld65iirW/kwDtoLCnV9R7X6gVXIpTYAK7gauapsnHBfKfmgDtk=
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)(136003)(396003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(36860700001)(82310400005)(82740400003)(86362001)(40460700003)(40480700001)(356005)(81166007)(2906002)(426003)(4326008)(54906003)(110136005)(336012)(6666004)(70586007)(70206006)(83380400001)(41300700001)(5660300002)(7696005)(478600001)(44832011)(8936002)(316002)(16526019)(8676002)(47076005)(36756003)(186003)(2616005)(26005)(1076003)(36900700001);
 DIR:OUT; SFP:1101; 
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 16:49:30.4180 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 1d52d90f-3763-49ad-ffaf-08db06069eaf
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: DS1PEPF0000E65C.namprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6185
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Thomas Monjalon <thomas@monjalon.net>

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 <thomas@monjalon.net>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 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 b8f66d668cac..7b780f70a56f 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(UINT16_MAX),
+			.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 6c6aef6fcaa0..8da8027b43da 100644
--- a/lib/net/rte_gre.h
+++ b/lib/net/rte_gre.h
@@ -45,7 +45,7 @@ struct rte_gre_hdr {
 	uint16_t res3:5; /**< Reserved */
 	uint16_t ver:3;  /**< Version Number */
 #endif
-	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