DPDK patches and discussions
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <20230203164854.602595-8-ferruh.yigit@amd.com> (raw)
In-Reply-To: <20230203164854.602595-1-ferruh.yigit@amd.com>

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


  parent reply	other threads:[~2023-02-03 16:50 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 21:44 [PATCH 0/8] start cleanup of rte_flow_item_* Thomas Monjalon
2022-10-25 21:44 ` [PATCH 1/8] ethdev: use Ethernet protocol struct for flow matching Thomas Monjalon
2022-10-25 21:44 ` [PATCH 2/8] net: add smaller fields for VXLAN Thomas Monjalon
2022-10-25 21:44 ` [PATCH 3/8] ethdev: use VXLAN protocol struct for flow matching Thomas Monjalon
2022-10-25 21:44 ` [PATCH 4/8] ethdev: use GRE " Thomas Monjalon
2022-10-26  8:45   ` David Marchand
2023-01-20 17:21     ` Ferruh Yigit
2022-10-25 21:44 ` [PATCH 5/8] ethdev: use GTP " Thomas Monjalon
2022-10-25 21:44 ` [PATCH 6/8] ethdev: use ARP " Thomas Monjalon
2022-10-25 21:44 ` [PATCH 7/8] doc: fix description of L2TPV2 flow item Thomas Monjalon
2022-10-25 21:44 ` [PATCH 8/8] net: mark all big endian types Thomas Monjalon
2022-10-26  8:41   ` David Marchand
2023-01-20 17:18 ` [PATCH v2 0/8] start cleanup of rte_flow_item_* Ferruh Yigit
2023-01-20 17:18   ` [PATCH v2 1/8] ethdev: use Ethernet protocol struct for flow matching Ferruh Yigit
2023-01-20 17:18   ` [PATCH v2 2/8] net: add smaller fields for VXLAN Ferruh Yigit
2023-01-20 17:18   ` [PATCH v2 3/8] ethdev: use VXLAN protocol struct for flow matching Ferruh Yigit
2023-01-20 17:18   ` [PATCH v2 4/8] ethdev: use GRE " Ferruh Yigit
2023-01-20 17:18   ` [PATCH v2 5/8] ethdev: use GTP " Ferruh Yigit
2023-01-20 17:19   ` [PATCH v2 6/8] ethdev: use ARP " Ferruh Yigit
2023-01-20 17:19   ` [PATCH v2 7/8] doc: fix description of L2TPV2 flow item Ferruh Yigit
2023-01-20 17:19   ` [PATCH v2 8/8] net: mark all big endian types Ferruh Yigit
2023-01-22 10:52   ` [PATCH v2 0/8] start cleanup of rte_flow_item_* David Marchand
2023-01-24  9:07     ` Ferruh Yigit
2023-01-24  9:02 ` [PATCH v3 " Ferruh Yigit
2023-01-24  9:02   ` [PATCH v3 1/8] ethdev: use Ethernet protocol struct for flow matching Ferruh Yigit
2023-01-24  9:02   ` [PATCH v3 2/8] net: add smaller fields for VXLAN Ferruh Yigit
2023-01-24  9:02   ` [PATCH v3 3/8] ethdev: use VXLAN protocol struct for flow matching Ferruh Yigit
2023-01-24  9:02   ` [PATCH v3 4/8] ethdev: use GRE " Ferruh Yigit
2023-01-24  9:02   ` [PATCH v3 5/8] ethdev: use GTP " Ferruh Yigit
2023-01-24  9:02   ` [PATCH v3 6/8] ethdev: use ARP " Ferruh Yigit
2023-01-24  9:02   ` [PATCH v3 7/8] doc: fix description of L2TPV2 flow item Ferruh Yigit
2023-01-24  9:03   ` [PATCH v3 8/8] net: mark all big endian types Ferruh Yigit
2023-01-26 13:17 ` [PATCH v4 0/8] start cleanup of rte_flow_item_* Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 1/8] ethdev: use Ethernet protocol struct for flow matching Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 2/8] net: add smaller fields for VXLAN Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 3/8] ethdev: use VXLAN protocol struct for flow matching Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 4/8] ethdev: use GRE " Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 5/8] ethdev: use GTP " Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 6/8] ethdev: use ARP " Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 7/8] doc: fix description of L2TPV2 flow item Ferruh Yigit
2023-01-26 13:17   ` [PATCH v4 8/8] net: mark all big endian types Ferruh Yigit
2023-01-26 16:18 ` [PATCH v5 0/8] start cleanup of rte_flow_item_* Ferruh Yigit
2023-01-26 16:18   ` [PATCH v5 1/8] ethdev: use Ethernet protocol struct for flow matching Ferruh Yigit
2023-01-27 14:33     ` Niklas Söderlund
2023-02-01 17:34     ` Ori Kam
2023-02-02  9:51     ` Andrew Rybchenko
2023-01-26 16:18   ` [PATCH v5 2/8] net: add smaller fields for VXLAN Ferruh Yigit
2023-01-26 16:18   ` [PATCH v5 3/8] ethdev: use VXLAN protocol struct for flow matching Ferruh Yigit
2023-02-01 17:41     ` Ori Kam
2023-02-02  9:52     ` Andrew Rybchenko
2023-01-26 16:19   ` [PATCH v5 4/8] ethdev: use GRE " Ferruh Yigit
2023-01-27 14:34     ` Niklas Söderlund
2023-02-01 17:44     ` Ori Kam
2023-02-02  9:53     ` Andrew Rybchenko
2023-01-26 16:19   ` [PATCH v5 5/8] ethdev: use GTP " Ferruh Yigit
2023-02-02  9:54     ` Andrew Rybchenko
2023-01-26 16:19   ` [PATCH v5 6/8] ethdev: use ARP " Ferruh Yigit
2023-02-01 17:46     ` Ori Kam
2023-02-02  9:55     ` Andrew Rybchenko
2023-01-26 16:19   ` [PATCH v5 7/8] doc: fix description of L2TPV2 flow item Ferruh Yigit
2023-02-02  9:56     ` Andrew Rybchenko
2023-01-26 16:19   ` [PATCH v5 8/8] net: mark all big endian types Ferruh Yigit
2023-02-02 10:01     ` Andrew Rybchenko
2023-02-02 11:11       ` Ferruh Yigit
2023-02-02 12:44 ` [PATCH v6 0/8] start cleanup of rte_flow_item_* Ferruh Yigit
2023-02-02 12:44   ` [PATCH v6 1/8] ethdev: use Ethernet protocol struct for flow matching Ferruh Yigit
2023-02-02 12:44   ` [PATCH v6 2/8] net: add smaller fields for VXLAN Ferruh Yigit
2023-02-02 12:44   ` [PATCH v6 3/8] ethdev: use VXLAN protocol struct for flow matching Ferruh Yigit
2023-02-02 12:44   ` [PATCH v6 4/8] ethdev: use GRE " Ferruh Yigit
2023-02-02 17:16     ` Thomas Monjalon
2023-02-03 15:02       ` Ferruh Yigit
2023-02-03 15:12         ` Thomas Monjalon
2023-02-03 15:16           ` Ferruh Yigit
2023-02-02 12:44   ` [PATCH v6 5/8] ethdev: use GTP " Ferruh Yigit
2023-02-02 12:44   ` [PATCH v6 6/8] ethdev: use ARP " Ferruh Yigit
2023-02-02 12:44   ` [PATCH v6 7/8] doc: fix description of L2TPV2 flow item Ferruh Yigit
2023-02-02 12:45   ` [PATCH v6 8/8] net: mark all big endian types Ferruh Yigit
2023-02-02 17:20     ` Thomas Monjalon
2023-02-03 15:03       ` Ferruh Yigit
2023-02-03 16:48 ` [PATCH v7 0/7] start cleanup of rte_flow_item_* Ferruh Yigit
2023-02-03 16:48   ` [PATCH v7 1/7] ethdev: use Ethernet protocol struct for flow matching Ferruh Yigit
2023-02-03 16:48   ` [PATCH v7 2/7] net: add smaller fields for VXLAN Ferruh Yigit
2023-02-03 16:48   ` [PATCH v7 3/7] ethdev: use VXLAN protocol struct for flow matching Ferruh Yigit
2023-02-03 16:48   ` [PATCH v7 4/7] ethdev: use GTP " Ferruh Yigit
2023-02-03 16:48   ` [PATCH v7 5/7] ethdev: use ARP " Ferruh Yigit
2023-02-03 16:48   ` [PATCH v7 6/7] doc: fix description of L2TPV2 flow item Ferruh Yigit
2023-02-03 16:48   ` Ferruh Yigit [this message]
2023-02-06  2:35   ` [PATCH v7 0/7] start cleanup of rte_flow_item_* fengchengwen
2023-02-07 14:58   ` Thomas Monjalon
2023-02-07 16:33     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230203164854.602595-8-ferruh.yigit@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=orika@nvidia.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).