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 4114F43C03; Tue, 27 Feb 2024 06:44:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE36842EFA; Tue, 27 Feb 2024 06:42:37 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 799F640295 for ; Tue, 27 Feb 2024 06:41:43 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D5FB720B74D4; Mon, 26 Feb 2024 21:41:41 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D5FB720B74D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709012501; bh=aIAjZY6el0OtlUq+PW7VTBpFXg14OTbvRZVp4+nqP+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FR3eGCpPoeMwgUP+ab5Bm4mXpKyDbGcSrZiqIqHqKVUHGx5u9AyUDcmC1cfdP1R0k lI3ga3/VxMhIEAxr/OcTvHDWawW9xbxn6NZM9FVaPb56owQEcMKiPYjjFYNgax8ya3 Qtuf+QtR41k6IwcyCOIM+mPaRUfSN7cuO/a8Fy8A= From: Tyler Retzlaff To: dev@dpdk.org Cc: Ajit Khaparde , Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Chengwen Feng , Dariusz Sosnowski , David Christensen , Hyong Youb Kim , Jerin Jacob , Jie Hai , Jingjing Wu , John Daley , Kevin Laatz , Kiran Kumar K , Konstantin Ananyev , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nithin Dabilpuram , Ori Kam , Ruifeng Wang , Satha Rao , Somnath Kotur , Suanming Mou , Sunil Kumar Kori , Viacheslav Ovsiienko , Yisen Zhuang , Yuying Zhang , mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Date: Mon, 26 Feb 2024 21:41:36 -0800 Message-Id: <1709012499-12813-21-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> 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 RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove RTE_MARKER fields from rte_mbuf struct. Maintain alignment of fields after removed cacheline1 marker by placing C11 alignas(RTE_CACHE_LINE_MIN_SIZE). Update implementation of rte_mbuf_prefetch_part1() and rte_mbuf_prefetch_part2() inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers. Update static_assert of rte_mbuf struct fields to reference data_off and packet_type fields that occupy the original offsets of the marker fields. Signed-off-by: Tyler Retzlaff --- doc/guides/rel_notes/release_24_03.rst | 9 ++++++++ lib/mbuf/rte_mbuf.h | 4 ++-- lib/mbuf/rte_mbuf_core.h | 39 +++++++++++++--------------------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst index 879bb49..67750f2 100644 --- a/doc/guides/rel_notes/release_24_03.rst +++ b/doc/guides/rel_notes/release_24_03.rst @@ -156,6 +156,15 @@ Removed Items The application reserved statically defined logtypes ``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8`` are still defined. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` ``cacheline1`` + ``rx_descriptor_fields1`` and ``RTE_MARKER64`` field ``rearm_data`` + have been removed from ``struct rte_mbuf``. + Prefetch of ``cacheline0`` and ``cacheline1`` may be achieved through + ``rte_mbuf_prefetch_part1()`` and ``rte_mbuf_prefetch_part2()`` inline + functions respectively. + Access to ``rearm_data`` and ``rx_descriptor_fields1`` should be + through new inline functions ``rte_mbuf_rearm_data()`` and + ``rte_mbuf_rx_descriptor_fields1()`` respectively. API Changes ----------- diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h index aa7495b..61cda20 100644 --- a/lib/mbuf/rte_mbuf.h +++ b/lib/mbuf/rte_mbuf.h @@ -108,7 +108,7 @@ static inline void rte_mbuf_prefetch_part1(struct rte_mbuf *m) { - rte_prefetch0(&m->cacheline0); + rte_prefetch0(m); } /** @@ -126,7 +126,7 @@ rte_mbuf_prefetch_part2(struct rte_mbuf *m) { #if RTE_CACHE_LINE_SIZE == 64 - rte_prefetch0(&m->cacheline1); + rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE)); #else RTE_SET_USED(m); #endif diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h index 36551c2..4e06f15 100644 --- a/lib/mbuf/rte_mbuf_core.h +++ b/lib/mbuf/rte_mbuf_core.h @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -467,8 +468,6 @@ enum { * The generic rte_mbuf, containing a packet mbuf. */ struct rte_mbuf { - RTE_MARKER cacheline0; - void *buf_addr; /**< Virtual address of segment buffer. */ #if RTE_IOVA_IN_MBUF /** @@ -495,7 +494,6 @@ struct rte_mbuf { * To obtain a pointer to rearm_data use the rte_mbuf_rearm_data() * accessor instead of directly referencing through the data_off field. */ - RTE_MARKER64 rearm_data; uint16_t data_off; /** @@ -522,8 +520,6 @@ struct rte_mbuf { uint64_t ol_flags; /**< Offload features. */ /* remaining bytes are set on RX when pulling packet from descriptor */ - RTE_MARKER rx_descriptor_fields1; - /* * The packet type, which is the combination of outer/inner L2, L3, L4 * and tunnel types. The packet_type is about data really present in the @@ -607,8 +603,7 @@ struct rte_mbuf { struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ /* second cache line - fields only used in slow path or on TX */ - RTE_MARKER cacheline1 __rte_cache_min_aligned; - + alignas(RTE_CACHE_LINE_MIN_SIZE) #if RTE_IOVA_IN_MBUF /** * Next segment of scattered packet. Must be NULL in the last @@ -677,35 +672,31 @@ struct rte_mbuf { } __rte_cache_aligned; static_assert(!(offsetof(struct rte_mbuf, ol_flags) != - offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags"); -static_assert(!(offsetof(struct rte_mbuf, rearm_data) != - RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data"); + offsetof(struct rte_mbuf, data_off) + 8), "ol_flags"); static_assert(!(offsetof(struct rte_mbuf, data_off) != - offsetof(struct rte_mbuf, rearm_data)), "data_off"); -static_assert(!(offsetof(struct rte_mbuf, data_off) < - offsetof(struct rte_mbuf, rearm_data)), "data_off"); + RTE_ALIGN(offsetof(struct rte_mbuf, data_off), 16)), "data_off"); static_assert(!(offsetof(struct rte_mbuf, refcnt) < - offsetof(struct rte_mbuf, rearm_data)), "refcnt"); + offsetof(struct rte_mbuf, data_off)), "refcnt"); static_assert(!(offsetof(struct rte_mbuf, nb_segs) < - offsetof(struct rte_mbuf, rearm_data)), "nb_segs"); + offsetof(struct rte_mbuf, data_off)), "nb_segs"); static_assert(!(offsetof(struct rte_mbuf, port) < - offsetof(struct rte_mbuf, rearm_data)), "port"); + offsetof(struct rte_mbuf, data_off)), "port"); static_assert(!(offsetof(struct rte_mbuf, data_off) - - offsetof(struct rte_mbuf, rearm_data) > 6), "data_off"); + offsetof(struct rte_mbuf, data_off) > 6), "data_off"); static_assert(!(offsetof(struct rte_mbuf, refcnt) - - offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt"); + offsetof(struct rte_mbuf, data_off) > 6), "refcnt"); static_assert(!(offsetof(struct rte_mbuf, nb_segs) - - offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs"); + offsetof(struct rte_mbuf, data_off) > 6), "nb_segs"); static_assert(!(offsetof(struct rte_mbuf, port) - - offsetof(struct rte_mbuf, rearm_data) > 6), "port"); + offsetof(struct rte_mbuf, data_off) > 6), "port"); static_assert(!(offsetof(struct rte_mbuf, pkt_len) != - offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len"); + offsetof(struct rte_mbuf, packet_type) + 4), "pkt_len"); static_assert(!(offsetof(struct rte_mbuf, data_len) != - offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len"); + offsetof(struct rte_mbuf, packet_type) + 8), "data_len"); static_assert(!(offsetof(struct rte_mbuf, vlan_tci) != - offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci"); + offsetof(struct rte_mbuf, packet_type) + 10), "vlan_tci"); static_assert(!(offsetof(struct rte_mbuf, hash) != - offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash"); + offsetof(struct rte_mbuf, packet_type) + 12), "hash"); /** * Function typedef of callback to free externally attached buffer. -- 1.8.3.1