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 C6F70A034E; Fri, 21 Jan 2022 11:32:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7751E42794; Fri, 21 Jan 2022 11:31:49 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 96A8942780 for ; Fri, 21 Jan 2022 11:31:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642761107; x=1674297107; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KJD9CFYwks2bpcX/wrPxN00yUIJ0KagbgTrqNWaax+Y=; b=KuqU+CRAN6xSwHvG8VJaxuCH3BVfsNCnXD9IaqwCtL4jZADqFXWKGEmR tKl9XYvbWvYg579xyP2ie3S609oV9/FbWoIdlYkILxXFghxLuNDjJsQCm NBV0LVCjJ/kMuiJsQIVd9imjgnnvvVj7AqmGKINhYcrn6Rn0WbDWxUBk/ TYzPyGgdDcercFDwsrh7AgijIwnt/ZvH5PsQHqgVWurqgzRVsCKw0T7Sg NPiPGvwz4xHsJTQp1R8zrrQU61Ib9NFA2raopomuTQ7/sGdkKSpa5fMSH eI01hsbSrdnzY0E5FuHTaR9fpv6bRWgfEigXKBlEOT5DDN6tKuCEDzdg8 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10233"; a="270045152" X-IronPort-AV: E=Sophos;i="5.88,304,1635231600"; d="scan'208";a="270045152" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2022 02:31:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,304,1635231600"; d="scan'208";a="533222795" Received: from silpixa00401120.ir.intel.com ([10.55.128.255]) by orsmga008.jf.intel.com with ESMTP; 21 Jan 2022 02:31:45 -0800 From: Ronan Randles To: dev@dpdk.org Cc: Ronan Randles Subject: [PATCH v2 14/15] net/vxlan: instance flag endianness refactored Date: Fri, 21 Jan 2022 10:31:21 +0000 Message-Id: <20220121103122.2926856-15-ronan.randles@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220121103122.2926856-1-ronan.randles@intel.com> References: <20211214141242.3383831-1-ronan.randles@intel.com> <20220121103122.2926856-1-ronan.randles@intel.com> 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 This patch improves the setting of the instance flag in the rte_vxlan_hdr struct, by using a byte to represent vx_flag_bits. Previously it was exposed to the user via a rte_be32_t value, which required handling endianness at the application level. The code uses a union to ensure that existing code continues to work as before, while allowing the improved more usable method to co-exist. A new #define is introduced to represent the instance bit, which must be set if a vxlan header contains a valid VNI field, see https://datatracker.ietf.org/doc/html/rfc7348 for details Signed-off-by: Ronan Randles --- lib/net/rte_vxlan.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h index 929fa7a1dd..86b6d8a3ae 100644 --- a/lib/net/rte_vxlan.h +++ b/lib/net/rte_vxlan.h @@ -24,6 +24,7 @@ extern "C" { /** VXLAN default port. */ #define RTE_VXLAN_DEFAULT_PORT 4789 #define RTE_VXLAN_GPE_DEFAULT_PORT 4790 +#define RTE_VXLAN_FLAGS_I (1 << 3) /** * VXLAN protocol header. @@ -31,7 +32,14 @@ extern "C" { * Reserved fields (24 bits and 8 bits) */ struct rte_vxlan_hdr { - rte_be32_t vx_flags; /**< flag (8) + Reserved (24). */ + RTE_STD_C11 + union { + struct { + uint8_t vx_flag_bits; + uint8_t reserved[3]; + }; + rte_be32_t vx_flags; /**< flag (8) + Reserved (24). */ + }; rte_be32_t vx_vni; /**< VNI (24) + Reserved (8). */ } __rte_packed; -- 2.25.1