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 5E61CA0544; Tue, 25 Oct 2022 23:45:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D88B42C86; Tue, 25 Oct 2022 23:45:16 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mails.dpdk.org (Postfix) with ESMTP id 9DAD441133 for ; Tue, 25 Oct 2022 23:45:14 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 56AB45C0166; Tue, 25 Oct 2022 17:45:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 25 Oct 2022 17:45:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1666734314; x=1666820714; bh=cr 3j07ys3O+NSgovRFCLDFubZV1S/NJJ2ZHUgnXC9MU=; b=mqUVmL/RaY3Jfmd2tZ 49KIBURQC/KpbGEaNO9k43SwF0ZO8W6s7+u1lRu9UkBjv/EmXIzuDvLlgjkdS1ph 9gOsbWKlN3DfC66T21kkee9ttHgCuxLcWjO/W4eI8Oll8LjA5LUlbUIsee8E6IKd Fd850G/noLy3nl/YnrHqibs08kjOk89+1cFl/9pJyOgCkIbD8MuM4IMSQK3nyJQF XaywrRjIrHTggRjUGvVmDWl/EzirbJW2sQzpug1kanSd3b77mzSuUOftp9SY33Ud 5Czkn9NpvfZKju20yJkuW/d2vfIX9WnKIExQeB783tooiG4IupBSpEMGz9xsLt2q oSww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1666734314; x=1666820714; bh=cr3j07ys3O+NS govRFCLDFubZV1S/NJJ2ZHUgnXC9MU=; b=iXGsNc0c5WUr9VKLi1Mld6M6yE3cM ydzgPV/mo/+LCkO8ycxY2BWkYhmUge7Lft0XPliwL+M8Ki7wxk9qQAFi6iWYg27F 0jcbRVnB+/S4wbjHGAFbPQgjR1ieUlh2cXw0xvD5k1ZjdVnTx8YQxTlcrNho3NPl juScGOYi5KXmbYsLCV96XyfNZ2bHjWP793P651XJ8anT8esmc2D2uXNJEhebwK8q R7VYDx+hnN3bxZRXLxUnSOZIKiqgcZ3lwPyxi5H5ArAn4Gb57qM7xL9AhgygiCZ5 Kt19EMmW2DljcgbkCJdrt+BdzR+zyItMD/KxqOwrD/4ewNo/B/DR/3NIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrtddugddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdejhfdugeehvddtieejieegteeuudfgjeeukeeiledthfetveek hefhieelhfdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Oct 2022 17:45:13 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru, Olivier Matz Subject: [PATCH 8/8] net: mark all big endian types Date: Tue, 25 Oct 2022 23:44:10 +0200 Message-Id: <20221025214410.715864-9-thomas@monjalon.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221025214410.715864-1-thomas@monjalon.net> References: <20221025214410.715864-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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/net/rte_arp.h | 28 ++++++++++++++-------------- lib/net/rte_higig.h | 6 +++--- lib/net/rte_mpls.h | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h index 076c8ab314..151e6c641f 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_higig.h b/lib/net/rte_higig.h index b55fb1a7db..bba3898a88 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 3e8cb90ec3..51523e7a11 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.36.1