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 337D0A0524;
	Thu,  6 May 2021 17:15:02 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D45DC41103;
	Thu,  6 May 2021 17:14:58 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [216.205.24.124])
 by mails.dpdk.org (Postfix) with ESMTP id E9F02410FF
 for <dev@dpdk.org>; Thu,  6 May 2021 17:14:57 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1620314097;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=FOz1KNbH96B5Otlz1Nt6jOEZ/YlfBbq6e7XMXIRtl5g=;
 b=R3MiRB9HSPE1/msaste0EZe5ql2YhxWRGEInygsEqIg3mUAv0YWgobYh0NzrqMeNCyek3a
 WWtIqf7mAmw1pIAx411TmiQZ5pwI5N3dbLTp2muLblRlNW1sJBCwymRXwD3YVs0JAogmNg
 PqL4/5lGiFUj4SAfT+Z8bC74FvHmvh8=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-115-f-sV6xgjPKew3_f3lDVyQw-1; Thu, 06 May 2021 11:14:53 -0400
X-MC-Unique: f-sV6xgjPKew3_f3lDVyQw-1
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
 [10.5.11.11])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81BB879EC8;
 Thu,  6 May 2021 15:14:52 +0000 (UTC)
Received: from dmarchan.remote.csb (unknown [10.40.192.60])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 2BA9F5B826;
 Thu,  6 May 2021 15:14:50 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: ian.stokes@intel.com, ktraynor@redhat.com,
 Olivier Matz <olivier.matz@6wind.com>
Date: Thu,  6 May 2021 17:14:25 +0200
Message-Id: <20210506151426.28202-2-david.marchand@redhat.com>
In-Reply-To: <20210506151426.28202-1-david.marchand@redhat.com>
References: <20210506151426.28202-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"
Subject: [dpdk-dev] [PATCH 1/2] net: add endianness annotations to ethernet
 headers
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
Sender: "dev" <dev-bounces@dpdk.org>

Spotted by sparse in OVS build:

/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:789:27:
error: incorrect type in initializer (different base types)
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:789:27:
expected unsigned short [usertype] ether_type
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:789:27:
got restricted ovs_be16 [usertype]
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:829:25:
error: incorrect type in initializer (different base types)
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:829:25:
expected unsigned short [usertype] vlan_tci
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:829:25:
got restricted ovs_be16 [usertype]
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:830:26:
error: incorrect type in initializer (different base types)
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:830:26:
expected unsigned short [usertype] eth_proto
/home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:830:26:
got restricted ovs_be16 [usertype]

This was not caught before as no code in headers was using those fields.
This changed with commit 6f2168b69aee ("ethdev: reuse ethernet header
definition in flow item") and commit a56a262e3408 ("ethdev: reuse VLAN
header definition in flow item").

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/net/rte_ether.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
index a303c24a8c..7ee5e9a292 100644
--- a/lib/net/rte_ether.h
+++ b/lib/net/rte_ether.h
@@ -276,7 +276,7 @@ struct rte_ether_hdr {
 			struct rte_ether_addr S_addr;
 		} S_un; /**< Do not use directly; use s_addr instead.*/
 	};
-	uint16_t ether_type; /**< Frame type. */
+	rte_be16_t ether_type; /**< Frame type. */
 } __rte_aligned(2);
 
 #pragma pop_macro("s_addr")
@@ -287,8 +287,8 @@ struct rte_ether_hdr {
  * of the encapsulated frame.
  */
 struct rte_vlan_hdr {
-	uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */
-	uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */
+	rte_be16_t vlan_tci;  /**< Priority (3) + CFI (1) + Identifier Code (12) */
+	rte_be16_t eth_proto; /**< Ethernet type of encapsulated frame. */
 } __rte_packed;
 
 
-- 
2.23.0