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 AA47A43BF1; Tue, 27 Feb 2024 11:03:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A19042EC7; Tue, 27 Feb 2024 11:03:32 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 99A1240150 for ; Tue, 27 Feb 2024 11:03:30 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TkY1N2HYpz1xpRc; Tue, 27 Feb 2024 18:02:00 +0800 (CST) Received: from dggpeml100023.china.huawei.com (unknown [7.185.36.151]) by mail.maildlp.com (Postfix) with ESMTPS id 5B7C21A0172; Tue, 27 Feb 2024 18:03:29 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by dggpeml100023.china.huawei.com (7.185.36.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 27 Feb 2024 18:03:28 +0800 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.035; Tue, 27 Feb 2024 11:03:26 +0100 From: Konstantin Ananyev To: Tyler Retzlaff , "dev@dpdk.org" CC: Ajit Khaparde , Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Fengchengwen , "Dariusz Sosnowski" , David Christensen , Hyong Youb Kim , Jerin Jacob , haijie , 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 , "Zhuangyuzeng (Yisen)" , Yuying Zhang , "mb@smartsharesystems.com" Subject: RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Thread-Topic: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields Thread-Index: AQHaaUARbvOooipeiEOvsNY4u3OzOLEd9crg Date: Tue, 27 Feb 2024 10:03:25 +0000 Message-ID: <505503b064d1486e9ff585c14d0fbda9@huawei.com> References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-21-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1709012499-12813-21-git-send-email-roretzla@linux.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 > Subject: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields >=20 > RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove > RTE_MARKER fields from rte_mbuf struct. >=20 > Maintain alignment of fields after removed cacheline1 marker by placing > C11 alignas(RTE_CACHE_LINE_MIN_SIZE). >=20 > 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. >=20 > 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. >=20 > 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(-) >=20 > diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_note= s/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_USE= R1..RTE_LOGTYPE_USER8`` > are still defined. >=20 > +* 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. >=20 > 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); > } >=20 > /** > @@ -126,7 +126,7 @@ > rte_mbuf_prefetch_part2(struct rte_mbuf *m) > { > #if RTE_CACHE_LINE_SIZE =3D=3D 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 @@ >=20 > #include > #include > +#include > #include >=20 > #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; >=20 > /** > @@ -522,8 +520,6 @@ struct rte_mbuf { > uint64_t ol_flags; /**< Offload features. */ >=20 > /* 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 th= e > @@ -607,8 +603,7 @@ struct rte_mbuf { > struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ >=20 > /* 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; >=20 > static_assert(!(offsetof(struct rte_mbuf, ol_flags) !=3D > - offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags"); > -static_assert(!(offsetof(struct rte_mbuf, rearm_data) !=3D > - 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) !=3D > - 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) !=3D > - 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) !=3D > - 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) !=3D > - 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) !=3D > - offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash"); > + offsetof(struct rte_mbuf, packet_type) + 12), "hash"); >=20 > /** > * Function typedef of callback to free externally attached buffer. > -- Acked-by: Konstantin Ananyev =20 > 1.8.3.1