replace GCC marker extension with C11 anonymous unions
RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
In reply to Tyler RetzlaffQuoted 154 lines
Subject: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Signed-off-by Tyler Retzlaff <[email protected]>--- 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(-)doc/guides/rel_notes/release_24_03.rst +9
-0@@ -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 -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +13
-22@@ -18,6 +18,7 @@#include <assert.h> #include <stddef.h> +#include <stdalign.h> #include <stdint.h> #include <rte_common.h> @@ -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" );
lib/mbuf/rte_mbuf_core.h struct rte_mbuf {
Quoted 10 lines
lib/mbuf/rte_mbuf_core.h +2
-3static_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. --
Quoted 1 line
1.8.3.1
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
In reply to Tyler RetzlaffHello Dodji,
Quoted 11 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.
Quoted 5 lines
Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Signed-off-by Tyler Retzlaff <[email protected]>
This change is reported as a potential ABI change.
For the context, this patch
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
removes null-sized markers (those fields were using RTE_MARKER, see
https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from the rte_mbuf struct.
I would argue this change do not impact ABI as the layout of the mbuf object is not impacted.
As reported by the CI:
[C] 'function const rte_eth_rxtx_callback*rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn, void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
parameter 3 of type 'typedef rte_rx_callback_fn' has sub-type changes:
underlying type 'typedef uint16_t (typedef uint16_t, typedefuint16_t, rte_mbuf**, typedef uint16_t, typedef uint16_t, void*)*' changed:
in pointed to type 'function type typedef uint16_t (typedefuint16_t, typedef uint16_t, rte_mbuf**, typedef uint16_t, typedef uint16_t, void*)':
parameter 3 of type 'rte_mbuf**' has sub-type changes:
in pointed to type 'rte_mbuf*':
in pointed to type 'struct rte_mbuf' at rte_mbuf_core.h:470:1:
type size hasn't changed
4 data member deletions:
'RTE_MARKER cacheline0', at offset 0 (in bits) at
rte_mbuf_core.h:467:1
'RTE_MARKER64 rearm_data', at offset 128 (in bits)
at rte_mbuf_core.h:490:1
'RTE_MARKER rx_descriptor_fields1', at offset 256
(in bits) at rte_mbuf_core.h:517:1
'RTE_MARKER cacheline1', at offset 512 (in bits) at
rte_mbuf_core.h:598:1
no data member change (1 filtered);
Error: ABI issue reported for abidiff --suppr /home/runner/work/dpdk/dpdk/devtools/libabigail.abignore --no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 install/usr/local/include reference/usr/local/lib/librte_ethdev.so.24.0 install/usr/local/lib/librte_ethdev.so.24.1 ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).
Opinions?
Btw, I see no way to suppress this (except a global [suppress_type] name = rte_mbuf)...
Signature · 1 line
David Marchand
RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
Quoted 75 lines
From: David Marchand [mailto:[email protected]]
Sent: Tuesday, 27 February 2024 16.18Hello Dodji,
Quoted 5 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by
placing
Quoted 7 lines
C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Update
static_assertofrte_mbufstruct fields to referencedata_offand
Quoted 4 lines
packet_typefields that occupy the original offsets of the marker fields.Signed-off-by Tyler Retzlaff <[email protected]>This change is reported as a potential ABI change.
For the context, this patch
https://patchwork.dpdk.org/project/dpdk/patch/1709012499-12813-21-git-
[email protected]/
removes null-sized markers (those fields were usingRTE_MARKER, see
https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from therte_mbufstruct.
I would argue this change do not impact ABI as the layout of the mbuf object is not impacted.As reported by the CI:
[C] 'function const rte_eth_rxtx_callback*
rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn, void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
parameter 3 of type 'typedefrte_rx_callback_fn' has sub-type
changes:
underlying type 'typedefuint16_t(typedefuint16_t, typedefuint16_t, rte_mbuf**, typedefuint16_t, typedefuint16_t, void*)*' changed:
in pointed to type 'function type typedefuint16_t(typedefuint16_t, typedefuint16_t, rte_mbuf**, typedefuint16_t, typedefuint16_t, void*)':
parameter 3 of type 'rte_mbuf**' has sub-type changes:
in pointed to type 'rte_mbuf*':
in pointed to type 'structrte_mbuf' at
rte_mbuf_core.h:470:1:
type size hasn't changed
4 data member deletions:
'RTE_MARKERcacheline0', at offset 0 (in bits) at
rte_mbuf_core.h:467:1
'RTE_MARKER64rearm_data', at offset 128 (in bits)
at rte_mbuf_core.h:490:1
'RTE_MARKERrx_descriptor_fields1', at offset 256
(in bits) at rte_mbuf_core.h:517:1
'RTE_MARKERcacheline1', at offset 512 (in bits) at
rte_mbuf_core.h:598:1no data member change (1 filtered);Error: ABI issue reported for abidiff --suppr
/home/runner/work/dpdk/dpdk/devtools/libabigail.abignore--no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 install/usr/local/include reference/usr/local/lib/librte_ethdev.so.24.0 install/usr/local/lib/librte_ethdev.so.24.1ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).
Quoted 1 line
Opinions?
Agree: Not an ABI change, only API change.
Quoted 7 lines
Btw, I see no way to suppress this (except a global [
suppress_type] name =rte_mbuf)...--
David Marchand
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
In reply to David MarchandQuoted 23 lines · David Marchand
Hello Dodji,
Quoted 11 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Quoted 5 lines
Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Signed-off-by Tyler Retzlaff <[email protected]>This change is reported as a potential ABI change.
Quoted 7 lines
For the context, this patch
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
removes null-sized markers (those fields were usingRTE_MARKER, see
https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from therte_mbufstruct.
I would argue this change do not impact ABI as the layout of the mbuf object is not impacted.
It isn't a surprise that the change got flagged because the 0 sized fields being removed probably not something the checker understands. So no ABI change just API break (as was requested).
Quoted 36 lines
As reported by the CI:
[C] 'function const rte_eth_rxtx_callback*
rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn, void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
parameter 3 of type 'typedefrte_rx_callback_fn' has sub-type changes:
underlying type 'typedefuint16_t(typedefuint16_t, typedefuint16_t, rte_mbuf**, typedefuint16_t, typedefuint16_t, void*)*' changed:
in pointed to type 'function type typedefuint16_t(typedefuint16_t, typedefuint16_t, rte_mbuf**, typedefuint16_t, typedefuint16_t, void*)':
parameter 3 of type 'rte_mbuf**' has sub-type changes:
in pointed to type 'rte_mbuf*':
in pointed to type 'structrte_mbuf' at rte_mbuf_core.h:470:1:
type size hasn't changed
4 data member deletions:
'RTE_MARKERcacheline0', at offset 0 (in bits) at
rte_mbuf_core.h:467:1
'RTE_MARKER64rearm_data', at offset 128 (in bits)
at rte_mbuf_core.h:490:1
'RTE_MARKERrx_descriptor_fields1', at offset 256
(in bits) at rte_mbuf_core.h:517:1
'RTE_MARKERcacheline1', at offset 512 (in bits) at
rte_mbuf_core.h:598:1no data member change (1 filtered);Error: ABI issue reported for abidiff --suppr
/home/runner/work/dpdk/dpdk/devtools/libabigail.abignore--no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 install/usr/local/include reference/usr/local/lib/librte_ethdev.so.24.0 install/usr/local/lib/librte_ethdev.so.24.1ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).
Quoted 4 lines
Opinions?
Btw, I see no way to suppress this (except a global [
suppress_type] name =rte_mbuf)...
I am unfamiliar with the ABI checker I'm afraid i have no suggestion to offer. Maybe we can just ignore the failure for this one series when we decide it is ready to be merged and don't suppress the checker?
Quoted 4 lines
Signature · 2 lines
-- David Marchand
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
Quoted 73 lines · Tyler Retzlaff
Quoted 23 lines · David Marchand
Hello Dodji,
Quoted 11 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Quoted 5 lines
Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Signed-off-by Tyler Retzlaff <[email protected]>This change is reported as a potential ABI change.
Quoted 7 lines
For the context, this patch
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
removes null-sized markers (those fields were usingRTE_MARKER, see
https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from therte_mbufstruct.
I would argue this change do not impact ABI as the layout of the mbuf object is not impacted.It isn't a surprise that the change got flagged because the 0 sized fields being removed probably not something the checker understands. So no ABI change just API break (as was requested).
Quoted 36 lines
As reported by the CI:
[C] 'function const rte_eth_rxtx_callback*
rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn, void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
parameter 3 of type 'typedefrte_rx_callback_fn' has sub-type changes:
underlying type 'typedefuint16_t(typedefuint16_t, typedefuint16_t, rte_mbuf**, typedefuint16_t, typedefuint16_t, void*)*' changed:
in pointed to type 'function type typedefuint16_t(typedefuint16_t, typedefuint16_t, rte_mbuf**, typedefuint16_t, typedefuint16_t, void*)':
parameter 3 of type 'rte_mbuf**' has sub-type changes:
in pointed to type 'rte_mbuf*':
in pointed to type 'structrte_mbuf' at rte_mbuf_core.h:470:1:
type size hasn't changed
4 data member deletions:
'RTE_MARKERcacheline0', at offset 0 (in bits) at
rte_mbuf_core.h:467:1
'RTE_MARKER64rearm_data', at offset 128 (in bits)
at rte_mbuf_core.h:490:1
'RTE_MARKERrx_descriptor_fields1', at offset 256
(in bits) at rte_mbuf_core.h:517:1
'RTE_MARKERcacheline1', at offset 512 (in bits) at
rte_mbuf_core.h:598:1no data member change (1 filtered);Error: ABI issue reported for abidiff --suppr
/home/runner/work/dpdk/dpdk/devtools/libabigail.abignore--no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 install/usr/local/include reference/usr/local/lib/librte_ethdev.so.24.0 install/usr/local/lib/librte_ethdev.so.24.1ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).
Quoted 8 lines
Quoted 4 lines
Opinions?
Btw, I see no way to suppress this (except a global [
suppress_type] name =rte_mbuf)...I am unfamiliar with the ABI checker I'm afraid i have no suggestion to offer. Maybe we can just ignore the failure for this one series when we decide it is ready to be merged and don't suppress the checker?
The ABI check compares a current build with a (cached) reference build. There is no "let's ignore this specific error" mechanism at the moment. And I suspect it would be non-trivial to add (parsing abidiff text output... brrr).
Changing the check so that it compares against origin/main (for example) every time is doable *on paper*, but it would consume a lot of cpu for maintainers (like Thomas, Ferruh or me) and the CI. CI scripts would have to be updated too.
Fow now, one thing we can do is to change the reference to point at the exact commit that introduces a change we know safe. This requires a little sync between people (maintainers / users of test-meson-builds.h) and UNH CI, but this is doable.
On the other hand, by the time we merge this series, libabigail may have fixed this for us already? ;-)
Signature · 1 line
David Marchand
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
In reply to David MarchandHello,
Quoted 1 line · David Marchand
Hello Dodji,
o/
[...]
Quoted 7 lines
This change is reported as a potential ABI change.
For the context, this patch
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
removes null-sized markers (those fields were usingRTE_MARKER, see
https://git.dpdk.org/dpdk/tree/lib/eal/include/rte_common.h#n583) from therte_mbufstruct.
Thank you for the context.
[...]
Quoted 1 line
As reported by the CI:
[...]
Quoted 4 lines
[C] 'function const rte_eth_rxtx_callback*
rte_eth_add_first_rx_callback(uint16_t, uint16_t, rte_rx_callback_fn, void*)' at rte_ethdev.c:5768:1 has some indirect sub-type changes:
parameter 3 of type 'typedefrte_rx_callback_fn' has sub-type changes:
[...]
Quoted 12 lines
in pointed to type 'struct
rte_mbuf' at rte_mbuf_core.h:470:1:
type size hasn't changed
4 data member deletions:
'RTE_MARKERcacheline0', at offset 0 (in bits) at
rte_mbuf_core.h:467:1
'RTE_MARKER64rearm_data', at offset 128 (in bits)
at rte_mbuf_core.h:490:1
'RTE_MARKERrx_descriptor_fields1', at offset 256
(in bits) at rte_mbuf_core.h:517:1
'RTE_MARKERcacheline1', at offset 512 (in bits) at
rte_mbuf_core.h:598:1no data member change (1 filtered);
[...]
Quoted 2 lines
I would argue this change do not impact ABI as the layout of the mbuf object is not impacted.
I agree that on the /particular platform/ that the checker runs on, there is no incompatible ABI change because no data member offset from the 'struct rte_mbuf' type got modified and the size of the type hasn't changed either.
Quoted 10 lines
Error: ABI issue reported for abidiff --suppr
/home/runner/work/dpdk/dpdk/devtools/libabigail.abignore--no-added-syms --headers-dir1 reference/usr/local/include --headers-dir2 install/usr/local/include reference/usr/local/lib/librte_ethdev.so.24.0 install/usr/local/lib/librte_ethdev.so.24.1ABIDIFF_ABI_CHANGE, this change requires a review (abidiff flagged this as a potential issue).
Quoted 4 lines
Opinions?
Btw, I see no way to suppress this (except a global [
suppress_type] name =rte_mbuf)...
Right.
To avoid having subsequent changes to that type from being "overly" suppressed, maybe do something like:
[suppress_type]
name = rte_mbuf
has_size_change = no
has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
That way, only size-impacting changes to struct rte_mbuf in its form that predates this patch would be suppressed, hopefully.
[...]
Cheers,
Signature · 1 line
Dodji
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
Quoted 8 lines · Dodji Seketeli
Quoted 2 lines
Btw, I see no way to suppress this (except a global [
suppress_type] name =rte_mbuf)...Right.
To avoid having subsequent changes to that type from being "overly" suppressed, maybe do something like:
Quoted 7 lines
[
suppress_type]
name =rte_mbuf
has_size_change= no
has_data_member= {cacheline0,rearm_data,rx_descriptor_fields1, cacheline1}That way, only size-impacting changes to struct
rte_mbufin its form that predates this patch would be suppressed, hopefully.
Do you mean, only changes *not* size-impacting would be suppressed?
This is slightly better than the suppression on the whole rte_mbuf object, but it won't catch field reordering iiuc.
On the other hand, now that I try reordering fields (to test this suggestion of yours), I get build failures all over the DPDK tree because we have many build checks to ensure those fields are at known locations...
So maybe we can relax and just go with the full suppression.
Signature · 1 line
David Marchand
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
Quoted 14 lines · David Marchand
Quoted 13 lines · Dodji Seketeli
Quoted 2 lines
Btw, I see no way to suppress this (except a global [
suppress_type] name =rte_mbuf)...Right.
To avoid having subsequent changes to that type from being "overly" suppressed, maybe do something like:
[
suppress_type]
name =rte_mbuf
has_size_change= no
has_data_member= {cacheline0,rearm_data,rx_descriptor_fields1, cacheline1}
Quoted 4 lines
Quoted 2 lines
That way, only size-impacting changes to struct
rte_mbufin its form that predates this patch would be suppressed, hopefully.Do you mean, only changes *not* size-impacting would be suppressed?
Yes, of course. Sorry for the typo. You are right.
Quoted 2 lines
This is slightly better than the suppression on the whole
rte_mbufobject, but it won't catch field reordering iiuc.
Indeed.
Quoted 6 lines
On the other hand, now that I try reordering fields (to test this suggestion of yours), I get build failures all over the DPDK tree because we have many build checks to ensure those fields are at known locations...
So maybe we can relax and just go with the full suppression.
Yes, that would make sense.
Thanks!
Signature · 1 line
Dodji
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
In reply to Tyler RetzlaffQuoted 86 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Signed-off-by Tyler Retzlaff <[email protected]>--- 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(-)doc/guides/rel_notes/release_24_03.rst +9
-0@@ -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 -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +1
-2@@ -18,6 +18,7 @@#include <assert.h> #include <stddef.h> +#include <stdalign.h> #include <stdint.h> #include <rte_common.h> @@ -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 /**
lib/mbuf/rte_mbuf_core.h struct rte_mbuf { · line 497
Quoted 5 lines
lib/mbuf/rte_mbuf_core.h +0
-1@@ -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;
One subtile change of removing the marker is that fields may not be aligned as before.
#if RTE_IOVA_IN_MBUF
/**
* Physical address of segment buffer.
* This field is undefined if the build is configured to use only
* virtual address as IOVA (i.e. RTE_IOVA_IN_MBUF is 0).
* Force alignment to 8-bytes, so as to ensure we have the exact
* same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
* working on vector drivers easier.
*/
rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
#else
/**
* Next segment of scattered packet.
* This field is valid when physical address field is undefined.
* Otherwise next pointer in the second cache line will be used. */
struct rte_mbuf *next;
#endif
When building ! RTE_IOVA_IN_MBUF on a 32 bits arch, the next pointer is not force aligned to 64bits.
Which has a cascade effect on data_off alignement.
In file included from ../lib/mbuf/rte_mbuf_core.h:19,
from ../lib/mbuf/rte_mbuf.h:42,
from ../lib/mbuf/rte_mbuf_dyn.c:18:
../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off"
676 | static_assert(!(offsetof(struct rte_mbuf, data_off) !=
| ^~~~~~~~~~~~~I hope reviewers pay attention to the alignment changes when removing those markers.
This is not trivial to catch in the CI.
Signature · 1 line
David Marchand
RE: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
Quoted 135 lines
From: David Marchand [mailto:[email protected]]
Sent: Wednesday, 28 February 2024 15.19Quoted 15 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Quoted 5 lines
Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 9 ++++++++ lib/mbuf/rte_mbuf.h | 4 ++-- lib/mbuf/rte_mbuf_core.h | 39 +++++++++++++---------------------
Review
Quoted 3 lines
3 files changed, 26 insertions(+), 26 deletions(-)(quoted diff) +0
-0
b/doc/guides/rel_notes/release_24_03.rstdoc/guides/rel_notes/release_24_03.rst Removed Items · line 156
Quoted 5 lines
index 879bb49..67750f2 100644
doc/guides/rel_notes/release_24_03.rst +0
-0@@ -156,6 +156,15 @@ Removed Items The application reserved statically defined logtypes``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
Quoted 58 lines
doc/guides/rel_notes/release_24_03.rst +9
-0are 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 -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +1
-2@@ -18,6 +18,7 @@#include <assert.h> #include <stddef.h> +#include <stdalign.h> #include <stdint.h> #include <rte_common.h> @@ -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 /** lib/mbuf/rte_mbuf_core.h struct rte_mbuf { · line 495
Quoted 2 lines
lib/mbuf/rte_mbuf_core.h +0
-0@@ -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.
lib/mbuf/rte_mbuf_core.h struct rte_mbuf { · line 497
Quoted 3 lines
lib/mbuf/rte_mbuf_core.h +0
-1*/ -RTE_MARKER64 rearm_data;uint16_t data_off;One subtile change of removing the marker is that fields may not be aligned as before.
#if
RTE_IOVA_IN_MBUF
/**
* Physical address of segment buffer.
* This field is undefined if the build is configured to use only
* virtual address as IOVA (i.e.RTE_IOVA_IN_MBUFis 0).
* Force alignment to 8-bytes, so as to ensure we have the exact
* same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
* working on vector drivers easier.
*/
rte_iova_tbuf_iova__rte_aligned(sizeof(rte_iova_t));
#else
/**
* Next segment of scattered packet.
* This field is valid when physical address field is undefined.
* Otherwise next pointer in the second cache line will be used. */
structrte_mbuf*next;
#endifWhen building !
RTE_IOVA_IN_MBUFon a 32 bits arch, the next pointer is not force aligned to 64bits.
Which has a cascade effect ondata_offalignement.In file included from
../lib/mbuf/rte_mbuf_core.h:19,from ../lib/mbuf/rte_mbuf.h:42, from ../lib/mbuf/rte_mbuf_dyn.c:18: ../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off" 676 | static_assert(!(offsetof(struct rte_mbuf, data_off) != | ^~~~~~~~~~~~~
Quoted 3 lines
I hope reviewers pay attention to the alignment changes when removing those markers.
This is not trivial to catch in the CI.
Good catch, David.
I wonder about the reason for 64 bit aligning the rearm_data group of fields? Perhaps it's there for (64 bit arch) vector instruction purposes?
Regardless, it's an ABI break, so padding or an alignment attribute must be added to avoid ABI breakage. If there is no valid reason for the 64 bit alignment, it could be noted that the padding (or alignment attribute) is there for 32 bit arch ABI compatibility reasons only.
Please note that only RTE_MARKER64 is affected by this. The other marker types have arch bit-width (or smaller) alignment, i.e. RTE_MARKER is 8 byte aligned on 64 bit arch and 4 byte aligned on 32 bit arch.
And RTE_MARKER64 is only used in the rte_mbuf structure.
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
Quoted 140 lines · Morten Brørup
Quoted 136 lines
From: David Marchand [mailto:[email protected]]
Sent: Wednesday, 28 February 2024 15.19Quoted 15 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Quoted 5 lines
Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 9 ++++++++ lib/mbuf/rte_mbuf.h | 4 ++-- lib/mbuf/rte_mbuf_core.h | 39 +++++++++++++---------------------
Review
Quoted 3 lines
3 files changed, 26 insertions(+), 26 deletions(-)(quoted diff) +0
-0
b/doc/guides/rel_notes/release_24_03.rstdoc/guides/rel_notes/release_24_03.rst Removed Items · line 156
Quoted 5 lines
index 879bb49..67750f2 100644
doc/guides/rel_notes/release_24_03.rst +0
-0@@ -156,6 +156,15 @@ Removed Items The application reserved statically defined logtypes``RTE_LOGTYPE_USER1..RTE_LOGTYPE_USER8``
Quoted 58 lines
doc/guides/rel_notes/release_24_03.rst +9
-0are 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 -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +1
-2@@ -18,6 +18,7 @@#include <assert.h> #include <stddef.h> +#include <stdalign.h> #include <stdint.h> #include <rte_common.h> @@ -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 /** lib/mbuf/rte_mbuf_core.h struct rte_mbuf { · line 495
Quoted 2 lines
lib/mbuf/rte_mbuf_core.h +0
-0@@ -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.
lib/mbuf/rte_mbuf_core.h struct rte_mbuf { · line 497
Quoted 3 lines
lib/mbuf/rte_mbuf_core.h +0
-1*/ -RTE_MARKER64 rearm_data;uint16_t data_off;One subtile change of removing the marker is that fields may not be aligned as before.
#if
RTE_IOVA_IN_MBUF
/**
* Physical address of segment buffer.
* This field is undefined if the build is configured to use only
* virtual address as IOVA (i.e.RTE_IOVA_IN_MBUFis 0).
* Force alignment to 8-bytes, so as to ensure we have the exact
* same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
* working on vector drivers easier.
*/
rte_iova_tbuf_iova__rte_aligned(sizeof(rte_iova_t));
#else
/**
* Next segment of scattered packet.
* This field is valid when physical address field is undefined.
* Otherwise next pointer in the second cache line will be used. */
structrte_mbuf*next;
#endifWhen building !
RTE_IOVA_IN_MBUFon a 32 bits arch, the next pointer is not force aligned to 64bits.
Which has a cascade effect ondata_offalignement.In file included from
../lib/mbuf/rte_mbuf_core.h:19,from ../lib/mbuf/rte_mbuf.h:42, from ../lib/mbuf/rte_mbuf_dyn.c:18: ../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off" 676 | static_assert(!(offsetof(struct rte_mbuf, data_off) != | ^~~~~~~~~~~~~Quoted 3 lines
I hope reviewers pay attention to the alignment changes when removing those markers.
This is not trivial to catch in the CI.
Quoted 7 lines
Good catch, David.
I wonder about the reason for 64 bit aligning the
rearm_datagroup of fields? Perhaps it's there for (64 bit arch) vector instruction purposes?Regardless, it's an ABI break, so padding or an alignment attribute must be added to avoid ABI breakage. If there is no valid reason for the 64 bit alignment, it could be noted that the padding (or alignment attribute) is there for 32 bit arch ABI compatibility reasons only.
Please note that only
RTE_MARKER64is affected by this. The other marker types have arch bit-width (or smaller) alignment, i.e.RTE_MARKERis 8 byte aligned on 64 bit arch and 4 byte aligned on 32 bit arch.
Well, strictly speaking other RTE_MARKER users *may* be affected, depending on the alignement for the following fields.
For example, I think removing the rxq_fastpath_data_end RTE_MARKER in struct nicvf_rxq
(https://git.dpdk.org/dpdk/tree/drivers/net/thunderx/nicvf_struct.h#n72)
impacts rx_drop_en alignment and subsequent fields.
Now, in practice and focusing only on what this series touches, either the markers were coupled with an explicit alignment constraint (__rte_cache*_aligned) which is preserved by the series, or the alignement constraint is stronger than that of the marker. So there is probably only this ABI breakage I reported.
Signature · 1 line
David Marchand
Re: [PATCH v6 20/23] mbuf: remove and stop using rte marker fields
In reply to David MarchandQuoted 120 lines · David Marchand
Quoted 86 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Update implementation of
rte_mbuf_prefetch_part1()andrte_mbuf_prefetch_part2()inline functions calculate pointer for prefetch of cachline0 and cachline1 without using removed markers.Update
static_assertofrte_mbufstruct fields to referencedata_offandpacket_typefields that occupy the original offsets of the marker fields.Signed-off-by Tyler Retzlaff <[email protected]>--- 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(-)doc/guides/rel_notes/release_24_03.rst +9
-0@@ -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 -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +1
-2@@ -18,6 +18,7 @@#include <assert.h> #include <stddef.h> +#include <stdalign.h> #include <stdint.h> #include <rte_common.h> @@ -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 /** lib/mbuf/rte_mbuf_core.h struct rte_mbuf { · line 497
Quoted 5 lines
lib/mbuf/rte_mbuf_core.h +0
-1@@ -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;One subtile change of removing the marker is that fields may not be aligned as before.
#if
RTE_IOVA_IN_MBUF
/**
* Physical address of segment buffer.
* This field is undefined if the build is configured to use only
* virtual address as IOVA (i.e.RTE_IOVA_IN_MBUFis 0).
* Force alignment to 8-bytes, so as to ensure we have the exact
* same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
* working on vector drivers easier.
*/
rte_iova_tbuf_iova__rte_aligned(sizeof(rte_iova_t));
#else
/**
* Next segment of scattered packet.
* This field is valid when physical address field is undefined.
* Otherwise next pointer in the second cache line will be used. */
structrte_mbuf*next;
#endifWhen building !
RTE_IOVA_IN_MBUFon a 32 bits arch, the next pointer is not force aligned to 64bits.
Which has a cascade effect ondata_offalignement.
Quoted 7 lines
In file included from
../lib/mbuf/rte_mbuf_core.h:19,from ../lib/mbuf/rte_mbuf.h:42, from ../lib/mbuf/rte_mbuf_dyn.c:18: ../lib/mbuf/rte_mbuf_core.h:676:1: error: static assertion failed: "data_off" 676 | static_assert(!(offsetof(struct rte_mbuf, data_off) != | ^~~~~~~~~~~~~
it is the assert that is wrong here not the offset/alignment of the fields, i failed to notice when i moved the assert from drivers to rte_mbuf_core.h that it was only being evaluated for drivers that *require* enable_iova_as_pa=true.
you can easily test by adding just this assert alone and building with enable_iova_as_pa=false for -m32 you'll see the assert trigger.
sorry i should have been more careful about which asserts i consolidated here. i can wrap this one up in conditional compile to only fire when RTE_IOVA_IN_MBUF=1.
Quoted 7 lines
I hope reviewers pay attention to the alignment changes when removing those markers.
This is not trivial to catch in the CI.Signature · 1 line
David Marchand
PATCH v6 21/23 security: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -166,6 +166,9 @@ Removed Items through new inline functions ``rte_mbuf_rearm_data()`` and ``rte_mbuf_rx_descriptor_fields1()`` respectively. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------
lib/security/rte_security_driver.h +3 -2
@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif
@@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - RTE_MARKER cacheline1 __rte_cache_min_aligned; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
Signature · 1 line
1.8.3.1
PATCH v6 22/23 cryptodev: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/cryptodev/cryptodev_pmd.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -169,6 +169,9 @@ Removed Items * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_security_session``. +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct cryptodev_driver``. + API Changes -----------
lib/cryptodev/cryptodev_pmd.h +3 -2
@@ -5,6 +5,8 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#include <stdalign.h> + #ifdef __cplusplus extern "C" { #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - RTE_MARKER cacheline1 __rte_cache_min_aligned; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */
Signature · 1 line
1.8.3.1
PATCH v6 23/23 devtools: forbid new use of rte marker typedefs
In reply to Tyler RetzlaffAdd a check for RTE_MARKER{,8,16,32,64} forbidding new use.
--- devtools/checkpatches.sh | 8 ++++++++ 1 file changed, 8 insertions(+)
devtools/checkpatches.sh +8 -0
@@ -61,6 +61,14 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # refrain from new uses of RTE_MARKER + awk -v FOLDERS="lib drivers" \ + -v EXPRESSIONS="RTE_MARKER(8|16|32|64)?" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using RTE_MARKER' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # no output on stdout or stderr awk -v FOLDERS="lib drivers" \ -v EXPRESSIONS="\\\<printf\\\> \\\<fprintf\\\(stdout, \\\<fprintf\\\(stderr," \
Signature · 1 line
1.8.3.1
v7 cover remove use of RTE_MARKER fields in libraries
In reply to Tyler RetzlaffAs per techboard meeting 2024/03/20 adopt hybrid proposal of adapting descriptor fields and removing cachline fields.
RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove RTE_MARKER fields.
For cacheline{0,1} fields remove fields entirely and use inline functions to prefetch.
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Tyler Retzlaff (4):
net/i40e: use inline prefetch function
mbuf: remove rte marker fields
security: remove rte marker fields
cryptodev: remove rte marker fields
doc/guides/rel_notes/release_24_03.rst | 8 ++ drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- lib/cryptodev/cryptodev_pmd.h | 5 +- lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 +++++++++++++++++--------------- lib/security/rte_security_driver.h | 5 +- 6 files changed, 117 insertions(+), 95 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v7 1/4 net/i40e: use inline prefetch function
Don't directly access the cacheline1 field in rte_mbuf struct for prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1 -1
@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) {
Signature · 1 line
1.8.3.1
RE: [PATCH v7 1/4] net/i40e: use inline prefetch function
Quoted 17 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 20 March 2024 23.02Don't directly access the cacheline1 field in
rte_mbufstruct for prefetch instead just userte_mbuf_prefetch_part2()to prefetch.Signed-off-by Tyler Retzlaff <[email protected]>--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/i40e/i40e_rxtx_vec_avx512.c +0
-0
drivers/net/i40e/i40e_rxtx_vec_avx512.c line 829
Quoted 5 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1
-1@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf);
@Yuying Zhang:
If this prefetch is for m->next, I think it can be omitted if m->next is in the first cache line:
- rte_prefetch0(&txep[i + 3].mbuf->cacheline1);
+#if RTE_IOVA_IN_MBUF
+ rte_mbuf_prefetch_part2(txep[i + 3].mbuf);
+#endif
If so, it belongs in a separate patch anyway.
Quoted 5 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +0
-1m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) { --1.8.3.1
Re: [PATCH v7 1/4] net/i40e: use inline prefetch function
Quoted 26 lines · Morten Brørup
Quoted 17 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 20 March 2024 23.02Don't directly access the cacheline1 field in
rte_mbufstruct for prefetch instead just userte_mbuf_prefetch_part2()to prefetch.Signed-off-by Tyler Retzlaff <[email protected]>--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/i40e/i40e_rxtx_vec_avx512.c +0
-0drivers/net/i40e/i40e_rxtx_vec_avx512.c line 829
Quoted 5 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1
-1@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf);@Yuying Zhang:
If this prefetch is form->next, I think it can be omitted ifm->nextis in the first cache line:
drivers/net/i40e/i40e_rxtx_vec_avx512.c
Quoted 4 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +3
-1-rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +#if RTE_IOVA_IN_MBUF +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); +#endif
Yuying Zhang any reply here to confirm?
If not I will leave it unconditionally prefetch.
Quoted 10 lines
If so, it belongs in a separate patch anyway.
Quoted 5 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +0
-1m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) { --1.8.3.1
Reviewed-by Morten Brørup <[email protected]>
RE: [PATCH v7 1/4] net/i40e: use inline prefetch function
Quoted 31 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 27 March 2024 19.15Quoted 11 lines · Morten Brørup
Quoted 11 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 20 March 2024 23.02Don't directly access the cacheline1 field in
rte_mbufstruct for prefetch instead just userte_mbuf_prefetch_part2()to prefetch.Signed-off-by Tyler Retzlaff <[email protected]>--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c line 829
Quoted 11 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1
-1@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf);@Yuying Zhang:
If this prefetch is form->next, I think it can be omitted ifm->nextis in the first cache line:
Quoted 1 line
Quoted 8 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c
Quoted 4 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +3
-1-rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +#if RTE_IOVA_IN_MBUF +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); +#endif Yuying Zhang any reply here to confirm?
If not I will leave it unconditionally prefetch.
I think you should leave it unconditionally prefetch under all circumstances.
An optimization to omit it (if it can be conditionally omitted) belongs in a separate patch. Also, Intel might want to test and document the performance improvement of such a patch.
Quoted 11 lines
Quoted 11 lines
If so, it belongs in a separate patch anyway.
Quoted 5 lines
drivers/net/i40e/i40e_rxtx_vec_avx512.c +0
-1m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) { --1.8.3.1
Reviewed-by Morten Brørup <[email protected]>
PATCH v7 2/4 mbuf: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
--- doc/guides/rel_notes/release_24_03.rst | 2 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 ++++++++++++++++++--------------- 3 files changed, 104 insertions(+), 90 deletions(-)
doc/guides/rel_notes/release_24_03.rst +2 -0
@@ -216,6 +216,8 @@ Removed Items * acc101: Removed obsolete code for non productized HW variant. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. API Changes -----------
lib/mbuf/rte_mbuf.h +2 -2
@@ -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
lib/mbuf/rte_mbuf_core.h +100 -88
224 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH v7 2/4] mbuf: remove rte marker fields
Quoted 124 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 2 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 ++++++++++++++++++--------------- 3 files changed, 104 insertions(+), 90 deletions(-)doc/guides/rel_notes/release_24_03.rst +2
-0@@ -216,6 +216,8 @@ Removed Items * acc101: Removed obsolete code for non productized HW variant. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. API Changes -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +26
-25@@ -465,8 +465,6 @@ enum {* The generic rte_mbuf, containing a packet mbuf. */ struct __rte_cache_aligned rte_mbuf { -RTE_MARKER cacheline0; -void *buf_addr;/**< Virtual address of segment buffer. */ #if RTE_IOVA_IN_MBUF /** @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {#endif /* next 8 bytes are initialised on RX descriptor rearm */ -RTE_MARKER64 rearm_data; -uint16_t data_off; - -/** -* Reference counter. Its size should at least equal to the size -* of port field (16 bits), to support zero-copy broadcast. -* It should only be accessed using the following functions: -* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and -* rte_mbuf_refcnt_set(). The functionality of these functions (atomic, -* or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag. -*/ -RTE_ATOMIC (uint16_t ) refcnt; +union { +uint64_t rearm_data[1 ]; + __extension__ +struct { +uint16_t data_off; + +/** +* Reference counter. Its size should at least equal to the size +* of port field (16 bits), to support zero-copy broadcast. +* It should only be accessed using the following functions: +* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and +* rte_mbuf_refcnt_set(). The functionality of these functions (atomic, +* or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag. +*/ +RTE_ATOMIC (uint16_t ) refcnt; -/** -* Number of segments. Only valid for the first segment of an mbuf -* chain. -*/ -uint16_t nb_segs; +/** +* Number of segments. Only valid for the first segment of an mbuf +* chain. +*/ +uint16_t nb_segs; -/** Input port (16 bits to support more than 256 virtual ports). -* The event eth Tx adapter uses this field to specify the output port. -*/ -uint16_t port; +/** Input port (16 bits to support more than 256 virtual ports). +* The event eth Tx adapter uses this field to specify the output port. +*/ +uint16_t port; + }; + };uint64_t ol_flags;/**< Offload features. */ /* remaining bytes are set on RX when pulling packet from descriptor */ -RTE_MARKER rx_descriptor_fields1; -
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 522
Quoted 10 lines
lib/mbuf/rte_mbuf_core.h +1
-8-/* -* 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 -* mbuf. Example: if vlan stripping is enabled, a received vlan packet -* would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the -* vlan is stripped from the data. -*/ union { -uint32_t packet_type;/**< L2/L3/L4 and tunnel information. */ +void *rx_descriptor_fields1[1 ];
Can we make this array the actual size of all the fields, rather than just an 8-byte value? That would allow the right think to be done if assigning the descriptor fields from one mbuf to another, or when using memset or memcpy on them.
/Bruce
Re: [PATCH v7 2/4] mbuf: remove rte marker fields
Quoted 132 lines · Bruce Richardson
Quoted 131 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 2 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 ++++++++++++++++++--------------- 3 files changed, 104 insertions(+), 90 deletions(-)doc/guides/rel_notes/release_24_03.rst +2
-0@@ -216,6 +216,8 @@ Removed Items * acc101: Removed obsolete code for non productized HW variant. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. API Changes -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +26
-32@@ -465,8 +465,6 @@ enum {* The generic rte_mbuf, containing a packet mbuf. */ struct __rte_cache_aligned rte_mbuf { -RTE_MARKER cacheline0; -void *buf_addr;/**< Virtual address of segment buffer. */ #if RTE_IOVA_IN_MBUF /** @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {#endif /* next 8 bytes are initialised on RX descriptor rearm */ -RTE_MARKER64 rearm_data; -uint16_t data_off; - -/** -* Reference counter. Its size should at least equal to the size -* of port field (16 bits), to support zero-copy broadcast. -* It should only be accessed using the following functions: -* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and -* rte_mbuf_refcnt_set(). The functionality of these functions (atomic, -* or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag. -*/ -RTE_ATOMIC (uint16_t ) refcnt; +union { +uint64_t rearm_data[1 ]; + __extension__ +struct { +uint16_t data_off; + +/** +* Reference counter. Its size should at least equal to the size +* of port field (16 bits), to support zero-copy broadcast. +* It should only be accessed using the following functions: +* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and +* rte_mbuf_refcnt_set(). The functionality of these functions (atomic, +* or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag. +*/ +RTE_ATOMIC (uint16_t ) refcnt; -/** -* Number of segments. Only valid for the first segment of an mbuf -* chain. -*/ -uint16_t nb_segs; +/** +* Number of segments. Only valid for the first segment of an mbuf +* chain. +*/ +uint16_t nb_segs; -/** Input port (16 bits to support more than 256 virtual ports). -* The event eth Tx adapter uses this field to specify the output port. -*/ -uint16_t port; +/** Input port (16 bits to support more than 256 virtual ports). +* The event eth Tx adapter uses this field to specify the output port. +*/ +uint16_t port; + }; + };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 -* mbuf. Example: if vlan stripping is enabled, a received vlan packet -* would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the -* vlan is stripped from the data. -*/
Quoted 8 lines
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 522
Quoted 3 lines
lib/mbuf/rte_mbuf_core.h +1
-1union { -uint32_t packet_type;/**< L2/L3/L4 and tunnel information. */ +void *rx_descriptor_fields1[1 ];Can we make this array the actual size of all the fields, rather than just an 8-byte value? That would allow the right think to be done if assigning the descriptor fields from one mbuf to another, or when using memset or memcpy on them.
Morten pointed out in a previous version that the marker being an array of void * was a bug to begin with.
The other field of the union is 24 bytes. I suppose it would be possible to conditionally compile the array to be either 3 or 6 elements. I guess this would be an improvement over what the marker is doing now.
Just a reminder that we cannot 'correct' the type since that would require adaptation of calling code.
What do others think? Keep it as a single element array or conditional compile based on sizeof(void *)?
Quoted 2 lines
/Bruce
RE: [PATCH v7 2/4] mbuf: remove rte marker fields
Quoted 155 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Thursday, 21 March 2024 16.31Quoted 11 lines · Bruce Richardson
Quoted 10 lines · Tyler Retzlaff
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.Quoted 5 lines
Quoted 5 lines
Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 2 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 ++++++++++++++++++---------------
Quoted 3 lines
Review
Quoted 3 lines
3 files changed, 104 insertions(+), 90 deletions(-)(quoted diff) +0
-0
b/doc/guides/rel_notes/release_24_03.rstQuoted 63 lines
Quoted 63 lines
index 14826ea..4f18cca 100644
doc/guides/rel_notes/release_24_03.rst +2
-0@@ -216,6 +216,8 @@ Removed Items * acc101: Removed obsolete code for non productized HW variant. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. API Changes -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +0
-14@@ -465,8 +465,6 @@ enum {* The generic rte_mbuf, containing a packet mbuf. */ struct __rte_cache_aligned rte_mbuf { -RTE_MARKER cacheline0; -void *buf_addr;/**< Virtual address of segment buffer. */ #if RTE_IOVA_IN_MBUF /** @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {#endif /* next 8 bytes are initialised on RX descriptor rearm */ -RTE_MARKER64 rearm_data; -uint16_t data_off; - -/** -* Reference counter. Its size should at least equal to the size -* of port field (16 bits), to support zero-copy broadcast. -* It should only be accessed using the following functions: -* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and -* rte_mbuf_refcnt_set(). The functionality of these functions (atomic, -* or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag. -*/ -RTE_ATOMIC (uint16_t ) refcnt;Quoted 8 lines
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf {
Quoted 8 lines
lib/mbuf/rte_mbuf_core.h +8
-0+union { +uint64_t rearm_data[1 ]; + __extension__ +struct { +uint16_t data_off; + +/** +* Reference counter. Its size should at least equal to the size
Quoted 1 line
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 497
Quoted 1 line
lib/mbuf/rte_mbuf_core.h +1
-0+* of port field (16 bits), to support zero-copy broadcast.
Quoted 1 line
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 498
Quoted 1 line
lib/mbuf/rte_mbuf_core.h +1
-0+* It should only be accessed using the following functions:
Quoted 2 lines
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 500
Quoted 2 lines
lib/mbuf/rte_mbuf_core.h +2
-0+* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and +* rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
Quoted 1 line
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 501
Quoted 1 line
lib/mbuf/rte_mbuf_core.h +1
-0+* or non-atomic) is controlled by the
RTE_MBUF_REFCNT_ATOMICflag.Quoted 10 lines
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf {
Quoted 10 lines
lib/mbuf/rte_mbuf_core.h +4
-5+*/ +RTE_ATOMIC (uint16_t ) refcnt; -/** -* Number of segments. Only valid for the first segment of an mbuf -* chain. -*/ -uint16_t nb_segs; +/** +* Number of segments. Only valid for the first segment of an mbuf
Quoted 9 lines
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf {
Quoted 9 lines
lib/mbuf/rte_mbuf_core.h +4
-4+* chain. +*/ +uint16_t nb_segs; -/** Input port (16 bits to support more than 256 virtual ports). -* The event eth Tx adapter uses this field to specify the output port. -*/ -uint16_t port; +/** Input port (16 bits to support more than 256 virtual ports).
Quoted 1 line
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 512
Quoted 1 line
lib/mbuf/rte_mbuf_core.h +1
-0+* The event eth Tx adapter uses this field to specify the output port.
Quoted 17 lines
Quoted 17 lines
lib/mbuf/rte_mbuf_core.h +4
-9+*/ +uint16_t port; + }; + };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 -* mbuf. Example: if vlan stripping is enabled, a received vlan packet -* would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the -* vlan is stripped from the data. -*/ Quoted 8 lines
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 522
Quoted 3 lines
lib/mbuf/rte_mbuf_core.h +1
-1union { -uint32_t packet_type;/**< L2/L3/L4 and tunnel information. */ +void *rx_descriptor_fields1[1 ];Can we make this array the actual size of all the fields, rather than just an 8-byte value? That would allow the right think to be done if assigning the descriptor fields from one mbuf to another, or when using memset or memcpy on them.
Quoted 6 lines
Morten pointed out in a previous version that the marker being an array of void * was a bug to begin with.
The other field of the union is 24 bytes. I suppose it would be possible to conditionally compile the array to be either 3 or 6 elements. I guess this would be an improvement over what the marker is doing now.
Agree; it would be an improvement to give it the same size as the other struct in the union.
Quoted 3 lines
Just a reminder that we cannot 'correct' the type since that would require adaptation of calling code.
I considered the following:
Only drivers should be using rx_descriptor_fields1.
We could probably change it to an array of uint64_t (or uint32_t, or even uint8_t) without breaking anything, because the drivers should only be using the address of rx_descriptor_fields1, not the value of it. However, keeping it an array of void* is certain to avoid any 32/64 bit CPU alignment related issues, because void* is the natural size to any CPU.
Quoted 3 lines
What do others think? Keep it as a single element array or conditional compile based on
sizeof(void *)?
Going for an array of 3/6 void pointers should be safe. I'm in favor of this.
At your discretion, if you think it clarifies anything, consider adding a comment that the type void* is used for historical reasons (or something similar).
RE: [PATCH v7 2/4] mbuf: remove rte marker fields
In reply to Tyler RetzlaffQuoted 6 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 20 March 2024 23.02
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.
Quoted 8 lines
Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.Signed-off-by Tyler Retzlaff <[email protected]>
I agree with the concepts in this patch.
A few comments inline below.
Quoted 143 lines
--- doc/guides/rel_notes/release_24_03.rst | 2 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 ++++++++++++++++++-------- ------- 3 files changed, 104 insertions(+), 90 deletions(-)doc/guides/rel_notes/release_24_03.rst +2
-0@@ -216,6 +216,8 @@ Removed Items * acc101: Removed obsolete code for non productized HW variant. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. API Changes -----------lib/mbuf/rte_mbuf.h +2
-2@@ -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 lib/mbuf/rte_mbuf_core.h +0
-2@@ -465,8 +465,6 @@ enum {* The generic rte_mbuf, containing a packet mbuf. */ struct __rte_cache_aligned rte_mbuf { -RTE_MARKER cacheline0; -void *buf_addr;/**< Virtual address of segment buffer. */ #if RTE_IOVA_IN_MBUF lib/mbuf/rte_mbuf_core.h +0
-10/** @@ -488,116 +486,130 @@ struct __rte_cache_aligned rte_mbuf {#endif /* next 8 bytes are initialised on RX descriptor rearm */ -RTE_MARKER64 rearm_data; -uint16_t data_off; - -/** -* Reference counter. Its size should at least equal to the size -* of port field (16 bits), to support zero-copy broadcast. -* It should only be accessed using the following functions: -* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and -* rte_mbuf_refcnt_set(). The functionality of these functions (atomic, -* or non-atomic) is controlled by the RTE_MBUF_REFCNT_ATOMIC flag.
lib/mbuf/rte_mbuf_core.h +8
-2-*/ -RTE_ATOMIC (uint16_t ) refcnt; +union { +uint64_t rearm_data[1 ]; + __extension__ +struct { +uint16_t data_off; + +/** +* Reference counter. Its size should at least equal to the size
lib/mbuf/rte_mbuf_core.h +1
-0+* of port field (16 bits), to support zero-copy broadcast.
lib/mbuf/rte_mbuf_core.h +1
-0+* It should only be accessed using the following functions:
lib/mbuf/rte_mbuf_core.h +1
-0+* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
lib/mbuf/rte_mbuf_core.h +1
-0+* rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
lib/mbuf/rte_mbuf_core.h +1
-0+* or non-atomic) is controlled by the
RTE_MBUF_REFCNT_ATOMICflag.lib/mbuf/rte_mbuf_core.h +4
-5+*/ +RTE_ATOMIC (uint16_t ) refcnt; -/** -* Number of segments. Only valid for the first segment of an mbuf -* chain. -*/ -uint16_t nb_segs; +/** +* Number of segments. Only valid for the first segment of an mbuf
lib/mbuf/rte_mbuf_core.h +3
-2+* chain. +*/ +uint16_t nb_segs; -/** Input port (16 bits to support more than 256 virtual ports). -* The event eth Tx adapter uses this field to specify the output port.
lib/mbuf/rte_mbuf_core.h +1
-2-*/ -uint16_t port; +/** Input port (16 bits to support more than 256 virtual ports).
lib/mbuf/rte_mbuf_core.h +1
-0+* The event eth Tx adapter uses this field to specify the output port.
lib/mbuf/rte_mbuf_core.h +4
-0+*/ +uint16_t port; + }; + };uint64_t ol_flags;/**< Offload features. */ /* remaining bytes are set on RX when pulling packet from descriptor */
lib/mbuf/rte_mbuf_core.h +0
-4-RTE_MARKER rx_descriptor_fields1; - -/* -* The packet type, which is the combination of outer/inner L2, L3, L4
lib/mbuf/rte_mbuf_core.h +0
-1-* and tunnel types. The packet_type is about data really present in the
lib/mbuf/rte_mbuf_core.h +0
-1-* mbuf. Example: if vlan stripping is enabled, a received vlan packet
lib/mbuf/rte_mbuf_core.h +0
-1-* would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
lib/mbuf/rte_mbuf_core.h +0
-3-* vlan is stripped from the data. -*/ union { -uint32_t packet_type;/**< L2/L3/L4 and tunnel information. */
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 522
Quoted 1 line
lib/mbuf/rte_mbuf_core.h +1
-0+void *rx_descriptor_fields1[1 ];
(As suggested by Bruce, and already discussed, please make this array 3/6 elements.)
Quoted 44 lines
lib/mbuf/rte_mbuf_core.h +2
-4__extension__ struct { - uint8_t l2_type:4; /**< (Outer) L2 type. */ - uint8_t l3_type:4; /**< (Outer) L3 type. */ - uint8_t l4_type:4; /**< (Outer) L4 type. */ - uint8_t tun_type:4; /**< Tunnel type. */ + /* + * The packet type, which is the combination ofouter/inner L2, L3, L4
lib/mbuf/rte_mbuf_core.h +1
-0+* and tunnel types. The packet_type is about data really present in the
lib/mbuf/rte_mbuf_core.h +1
-0+* mbuf. Example: if vlan stripping is enabled, a received vlan packet
lib/mbuf/rte_mbuf_core.h +1
-0+* would have RTE_PTYPE_L2_ETHER and not
RTE_PTYPE_L2_VLANbecause thelib/mbuf/rte_mbuf_core.h +3
-5+* vlan is stripped from the data. +*/ union { -uint8_t inner_esp_next_proto; -/**< ESP next protocol type, valid if -* RTE_PTYPE_TUNNEL_ESP tunnel type is set -* on both Tx and Rx. -*/ +uint32_t packet_type;/**< L2/L3/L4 and tunnel information. */
lib/mbuf/rte_mbuf_core.h +1
-4__extension__ struct { - uint8_t inner_l2_type:4; - /**< Inner L2 type. */ - uint8_t inner_l3_type:4; - /**< Inner L3 type. */ + uint8_t l2_type:4; /**< (Outer) L2type. */
lib/mbuf/rte_mbuf_core.h +1
-0+ uint8_t l3_type:4; /**< (Outer) L3type. */
lib/mbuf/rte_mbuf_core.h +1
-0+ uint8_t l4_type:4; /**< (Outer) L4type. */
lib/mbuf/rte_mbuf_core.h +4
-0+ uint8_t tun_type:4; /**< Tunnel type. */ +union { +uint8_t inner_esp_next_proto; +/**< ESP next protocol type, valid if
lib/mbuf/rte_mbuf_core.h +1
-0+* RTE_PTYPE_TUNNEL_ESP tunnel type is set
lib/mbuf/rte_mbuf_core.h
Quoted 2 lines
lib/mbuf/rte_mbuf_core.h +2
-0+* on both Tx and Rx. +*/
If the comment describing the field doesn't fit on the same line as the field, please put the description before the field, not after it.
This applies to many more field descriptions in the rte_mbuf structure.
Please note that multiple field's descriptions were also "after" before this patch, so perhaps the descriptions should be moved around in a preceding patch. Or not at all, if minimal changes are preferred. I wouldn't mind moving them with this patch, but some people prefer multiple smaller patches for separate changes.
Quoted 27 lines
lib/mbuf/rte_mbuf_core.h +9
-0+ __extension__ +struct { +uint8_t inner_l2_type:4 ; +/**< Inner L2 type. */ +uint8_t inner_l3_type:4 ; +/**< Inner L3 type. */ + }; + }; + uint8_t inner_l4_type:4; /**< Inner L4type. */
lib/mbuf/rte_mbuf_core.h +0
-4}; }; - uint8_t inner_l4_type:4; /**< Inner L4 type. */ - }; - }; -uint32_t pkt_len;/**< Total pkt len: sum of all segments. */
lib/mbuf/rte_mbuf_core.h +0
-1-uint16_t data_len;/**< Amount of data in segment buffer. */
lib/mbuf/rte_mbuf_core.h +2
-2-/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */ -uint16_t vlan_tci; +/* +* pkt_len is not actually part of
rx_descriptor_fields1lib/mbuf/rte_mbuf_core.h +1
-0+* but is included here to account for changes in alignment
lib/mbuf/rte_mbuf_core.h
Quoted 2 lines
lib/mbuf/rte_mbuf_core.h +2
-0+* and offset for void * on 32-bit vs 64-bit targets. +*/
I disagree with this comment.
For non-segmented packets, it is part of rx_descriptor_fields1.
Also, the high-level comment says "/* remaining bytes are set on RX when pulling packet from descriptor */", which also covers the pkt_len field. I think you should not add the comment.
Quoted 100 lines
lib/mbuf/rte_mbuf_core.h +1
-0+uint32_t pkt_len;/**< Total pkt len: sum of all segments. */
lib/mbuf/rte_mbuf_core.h +0
-3- union { - union { - uint32_t rss; /**< RSS hash result if RSS enabled*/
lib/mbuf/rte_mbuf_core.h +1
-1-struct { +uint16_t data_len;/**< Amount of data in segment buffer. */
lib/mbuf/rte_mbuf_core.h +1
-0+/** VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_VLAN is set. */
lib/mbuf/rte_mbuf_core.h +4
-0+uint16_t vlan_tci; + + union { union { + uint32_t rss; /**< RSS hash result ifRSS enabled */
lib/mbuf/rte_mbuf_core.h +0
-24struct { -uint16_t hash; -uint16_t id; - }; -uint32_t lo; -/**< Second 4 flexible bytes */ - }; -uint32_t hi; -/**< First 4 flexible bytes or FD ID, dependent -* on RTE_MBUF_F_RX_FDIR_* flag in ol_flags. -*/ - } fdir;/**< Filter identifier if FDIR enabled */ -struct rte_mbuf_sched sched; -/**< Hierarchical scheduler : 8 bytes */ -struct { -uint32_t reserved1; -uint16_t reserved2; -uint16_t txq; -/**< The event eth Tx adapter uses this field -* to store Tx queue id. -* @see rte_event_eth_tx_adapter_txq_set() -*/ - } txadapter;/**< Eventdev ethdev Tx adapter */ -uint32_t usr; -/**< User defined tags. See rte_distributor_process() */
lib/mbuf/rte_mbuf_core.h +7
-2- } hash;/**< hash information */ - }; +union { +struct { +uint16_t hash; +uint16_t id; + }; +uint32_t lo; +/**< Second 4 flexible bytes */
lib/mbuf/rte_mbuf_core.h +3
-0+ }; +uint32_t hi; +/**< First 4 flexible bytes or FD ID, dependent
lib/mbuf/rte_mbuf_core.h +1
-0+* on RTE_MBUF_F_RX_FDIR_* flag in
ol_flags.lib/mbuf/rte_mbuf_core.h +2
-0+*/ + } fdir;/**< Filter identifier if FDIR enabled */
lib/mbuf/rte_mbuf_core.h +7
-0+struct rte_mbuf_sched sched; +/**< Hierarchical scheduler : 8 bytes */ +struct { +uint32_t reserved1; +uint16_t reserved2; +uint16_t txq; +/**< The event eth Tx adapter uses this field
lib/mbuf/rte_mbuf_core.h +2
-0+* to store Tx queue id. +* @see
rte_event_eth_tx_adapter_txq_set()lib/mbuf/rte_mbuf_core.h +2
-0+*/ + } txadapter;/**< Eventdev ethdev Tx adapter */
lib/mbuf/rte_mbuf_core.h +2
-0+uint32_t usr; +/**< User defined tags. See
rte_distributor_process()*/lib/mbuf/rte_mbuf_core.h +1
-0+ } hash;/**< hash information */
lib/mbuf/rte_mbuf_core.h +1
-1+ }; -/** Outer VLAN TCI (CPU order), valid if RTE_MBUF_F_RX_QINQ is set. */
lib/mbuf/rte_mbuf_core.h +1
-1-uint16_t vlan_tci_outer; +/** Outer VLAN TCI (CPU order), valid if
RTE_MBUF_F_RX_QINQis set. */lib/mbuf/rte_mbuf_core.h +2
-1+uint16_t vlan_tci_outer; -uint16_t buf_len;/**< Length of segment buffer. */ +uint16_t buf_len;/**< Length of segment buffer. */
lib/mbuf/rte_mbuf_core.h +2
-0+ }; + };struct rte_mempool *pool;/**< Pool from which mbuf was allocated. */
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 612
Quoted 4 lines
lib/mbuf/rte_mbuf_core.h +1
-2/* second cache line - fields only used in slow path or on TX */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; - + alignas(RTE_CACHE_LINE_MIN_SIZE)
I strongly prefer having this alignas() immediately preceding the field it applies to; otherwise it might be overlooked. I.e. both after #if RTE_IOVA_IN_MBUF and #else, instead of only before #if RTE_IOVA_IN_MBUF.
Quoted 5 lines
#if
RTE_IOVA_IN_MBUFlib/mbuf/rte_mbuf_core.h +0
-1/** * Next segment of scattered packet. Must be NULL in the last -- 1.8.3.1
PATCH v7 3/4 security: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -219,6 +219,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------
lib/security/rte_security_driver.h +3 -2
@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif
@@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
Signature · 1 line
1.8.3.1
RE: [PATCH v7 3/4] security: remove rte marker fields
Quoted 61 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 20 March 2024 23.02
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)doc/guides/rel_notes/release_24_03.rst +3
-0@@ -219,6 +219,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------lib/security/rte_security_driver.h +3
-2@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif @@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */
Quoted 3 lines
};
--
1.8.3.1
No explicit alignment was ever specified for the struct rte_security_session itself. I wonder which implicit alignment applies to it.
Anyway, the changes are correct, so
Re: [PATCH v7 3/4] security: remove rte marker fields
Quoted 56 lines · Morten Brørup
Quoted 56 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 20 March 2024 23.02
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)doc/guides/rel_notes/release_24_03.rst +3
-0@@ -219,6 +219,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------lib/security/rte_security_driver.h +2
-1@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif @@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */
Quoted 10 lines
Quoted 8 lines
lib/security/rte_security_driver.h +1
-1- alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
--
1.8.3.1No explicit alignment was ever specified for the struct
rte_security_sessionitself. I wonder which implicit alignment applies to it.
it falls back to standard C. it will be over aligned to the strictest alignment of any of the struct fields. so it will be aligned to alignas(RTE_CACHE_LINE_MIN_SIZE).
Quoted 2 lines
Anyway, the changes are correct, so
thanks!
Quoted 1 line
Reviewed-by Morten Brørup <[email protected]>
PATCH v7 4/4 cryptodev: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/cryptodev/cryptodev_pmd.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -222,6 +222,9 @@ Removed Items * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_security_session``. +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct cryptodev_driver``. + API Changes -----------
lib/cryptodev/cryptodev_pmd.h +3 -2
@@ -5,6 +5,8 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#include <stdalign.h> + #ifdef __cplusplus extern "C" { #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */
Signature · 1 line
1.8.3.1
RE: [PATCH v7 4/4] cryptodev: remove rte marker fields
Quoted 62 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 20 March 2024 23.02
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Signed-off-by Tyler Retzlaff <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/cryptodev/cryptodev_pmd.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)doc/guides/rel_notes/release_24_03.rst +3
-0@@ -222,6 +222,9 @@ Removed Items * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_security_session``. +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct cryptodev_driver``. + API Changes -----------lib/cryptodev/cryptodev_pmd.h +3
-3@@ -5,6 +5,8 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#include <stdalign.h> + #ifdef __cplusplus extern "C" { #endif@@ -139,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */ --
Quoted 1 line
1.8.3.1
v8 cover remove use of RTE_MARKER fields in libraries
In reply to Tyler RetzlaffAs per techboard meeting 2024/03/20 adopt hybrid proposal of adapting descriptor fields and removing cachline fields.
RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove RTE_MARKER fields.
For cacheline{0,1} fields remove fields entirely and use inline functions to prefetch.
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Note: diff is easier viewed with -b due to additional nesting from
unions / structs that have been introduced.
v8:
* rx_descriptor_fields1 array is now constexpr sized to 24 / sizeof(void *) so that the array encompasses fields accessed via the array.
* add a comment to rx_descriptor_fields1 array site noting that void * type of elements is retained for compatibility with existing drivers.
* clean up comments of fields in rte_mbuf to be before the field they apply to instead of after.
* duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of conditional compile for first field of cacheline 1 instead of once before conditional compile block.
v7:
* complete re-write of series, previous versions not noted. all reviewed-by and acked-by tags (if any) were removed.
Tyler Retzlaff (4):
net/i40e: use inline prefetch function
mbuf: remove rte marker fields
security: remove rte marker fields
cryptodev: remove rte marker fields
doc/guides/rel_notes/release_24_03.rst | 8 ++ drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- lib/cryptodev/cryptodev_pmd.h | 5 +- lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 200 +++++++++++++++++--------------- lib/security/rte_security_driver.h | 5 +- 6 files changed, 121 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v8 1/4 net/i40e: use inline prefetch function
Don't directly access the cacheline1 field in rte_mbuf struct for prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1 -1
@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) {
Signature · 1 line
1.8.3.1
PATCH v8 2/4 mbuf: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
--- doc/guides/rel_notes/release_24_03.rst | 2 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 200 +++++++++++++++++---------------- 3 files changed, 108 insertions(+), 98 deletions(-)
doc/guides/rel_notes/release_24_03.rst +2 -0
@@ -216,6 +216,8 @@ Removed Items * acc101: Removed obsolete code for non productized HW variant. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. API Changes -----------
lib/mbuf/rte_mbuf.h +2 -2
@@ -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
lib/mbuf/rte_mbuf_core.h +104 -96
266 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v8 3/4 security: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -219,6 +219,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------
lib/security/rte_security_driver.h +3 -2
@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif
@@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
Signature · 1 line
1.8.3.1
PATCH v8 4/4 cryptodev: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/cryptodev/cryptodev_pmd.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -222,6 +222,9 @@ Removed Items * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_security_session``. +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct cryptodev_driver``. + API Changes -----------
lib/cryptodev/cryptodev_pmd.h +3 -2
@@ -5,6 +5,8 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#include <stdalign.h> + #ifdef __cplusplus extern "C" { #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */
Signature · 1 line
1.8.3.1
v9 cover remove use of RTE_MARKER fields in libraries
In reply to Tyler RetzlaffAs per techboard meeting 2024/03/20 adopt hybrid proposal of adapting descriptor fields and removing cachline fields.
RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove RTE_MARKER fields.
For cacheline{0,1} fields remove fields entirely and use inline functions to prefetch.
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Note: diff is easier viewed with -b due to additional nesting from
unions / structs that have been introduced.
v9:
* provide narrowest possible libabigail.abignore to suppress removal of fields that were agreed are not actual abi changes.
v8:
* rx_descriptor_fields1 array is now constexpr sized to 24 / sizeof(void *) so that the array encompasses fields accessed via the array.
* add a comment to rx_descriptor_fields1 array site noting that void * type of elements is retained for compatibility with existing drivers.
* clean up comments of fields in rte_mbuf to be before the field they apply to instead of after.
* duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of conditional compile for first field of cacheline 1 instead of once before conditional compile block.
v7:
* complete re-write of series, previous versions not noted. all reviewed-by and acked-by tags (if any) were removed.
Tyler Retzlaff (4):
net/i40e: use inline prefetch function
mbuf: remove rte marker fields
security: remove rte marker fields
cryptodev: remove rte marker fields
devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_03.rst | 8 ++ drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- lib/cryptodev/cryptodev_pmd.h | 5 +- lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 200 +++++++++++++++++--------------- lib/security/rte_security_driver.h | 5 +- 7 files changed, 127 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v9 1/4 net/i40e: use inline prefetch function
Don't directly access the cacheline1 field in rte_mbuf struct for prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1 -1
@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) {
Signature · 1 line
1.8.3.1
PATCH v9 2/4 mbuf: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
This change breaks the API for cacheline{0,1} fields that have been removed from rte_mbuf but it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type = rte_mbuf.
--- devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_03.rst | 2 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 200 +++++++++++++++++---------------- 4 files changed, 114 insertions(+), 98 deletions(-)
devtools/libabigail.abignore +6 -0
@@ -37,3 +37,9 @@ [suppress_type] name = rte_eth_fp_ops has_data_member_inserted_between = {offset_of(reserved2), end} + +[suppress_type] + name = rte_mbuf + type_kind = struct + has_size_change = no + has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
doc/guides/rel_notes/release_24_03.rst +2 -0
@@ -161,6 +161,8 @@ Removed Items * acc101: Removed obsolete code for non productized HW variant. +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. API Changes -----------
lib/mbuf/rte_mbuf.h +2 -2
@@ -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
lib/mbuf/rte_mbuf_core.h +104 -96
266 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH v9 2/4] mbuf: remove rte marker fields
Quoted 10 lines · On Tue, 2 Apr 2024 13:08:48 -0700 Tyler Retzlaff…
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Quoted 6 lines
This change breaks the API for cacheline{0,1} fields that have been removed from
rte_mbufbut it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type =rte_mbuf.Signed-off-by Tyler Retzlaff <[email protected]>
Release note should be for 24.07 not 24.03.
Re: [PATCH v9 2/4] mbuf: remove rte marker fields
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Tue, 2 Apr 2024 13:08:48 -0700 Tyler Retzlaff…
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Quoted 8 lines
Quoted 6 lines
This change breaks the API for cacheline{0,1} fields that have been removed from
rte_mbufbut it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type =rte_mbuf.Signed-off-by Tyler Retzlaff <[email protected]>Release note should be for 24.07 not 24.03.
yeah, pressed send and noticed it seconds later. when the new empty release notes are added i'll move the notes to 24.07.
thanks.
PATCH v9 3/4 security: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -164,6 +164,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------
lib/security/rte_security_driver.h +3 -2
@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif
@@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
Signature · 1 line
1.8.3.1
PATCH v9 4/4 cryptodev: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/cryptodev/cryptodev_pmd.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -167,6 +167,9 @@ Removed Items * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_security_session``. +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct cryptodev_driver``. + API Changes -----------
lib/cryptodev/cryptodev_pmd.h +3 -2
@@ -5,6 +5,8 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#include <stdalign.h> + #ifdef __cplusplus extern "C" { #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */
Signature · 1 line
1.8.3.1
v10 cover remove use of RTE_MARKER fields in libraries
In reply to Tyler RetzlaffAs per techboard meeting 2024/03/20 adopt hybrid proposal of adapting descriptor fields and removing cachline fields.
RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove RTE_MARKER fields.
For cacheline{0,1} fields remove fields entirely and use inline functions to prefetch.
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Note: diff is easier viewed with -b due to additional nesting from
unions / structs that have been introduced.
v10:
* move removal notices in in release notes from 24.03 to 24.07
v9:
* provide narrowest possible libabigail.abignore to suppress removal of fields that were agreed are not actual abi changes.
v8:
* rx_descriptor_fields1 array is now constexpr sized to 24 / sizeof(void *) so that the array encompasses fields accessed via the array.
* add a comment to rx_descriptor_fields1 array site noting that void * type of elements is retained for compatibility with existing drivers.
* clean up comments of fields in rte_mbuf to be before the field they apply to instead of after.
* duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of conditional compile for first field of cacheline 1 instead of once before conditional compile block.
v7:
* complete re-write of series, previous versions not noted. all reviewed-by and acked-by tags (if any) were removed.
Tyler Retzlaff (4):
net/i40e: use inline prefetch function
mbuf: remove rte marker fields
security: remove rte marker fields
cryptodev: remove rte marker fields
devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_07.rst | 9 ++ drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- lib/cryptodev/cryptodev_pmd.h | 5 +- lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 200 +++++++++++++++++--------------- lib/security/rte_security_driver.h | 5 +- 7 files changed, 128 insertions(+), 103 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v10 1/4 net/i40e: use inline prefetch function
Don't directly access the cacheline1 field in rte_mbuf struct for prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1 -1
@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) {
Signature · 1 line
1.8.3.1
Re: [PATCH v10 1/4] net/i40e: use inline prefetch function
Quoted 5 lines · On Wed, 3 Apr 2024 10:53:33 -0700 Tyler Retzlaff…
Don't directly access the cacheline1 field in
rte_mbufstruct for prefetch instead just userte_mbuf_prefetch_part2()to prefetch.Signed-off-by Tyler Retzlaff <[email protected]>Reviewed-by Morten Brørup <[email protected]>
PATCH v10 2/4 mbuf: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
This change breaks the API for cacheline{0,1} fields that have been removed from rte_mbuf but it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type = rte_mbuf.
--- devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_07.rst | 3 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 200 +++++++++++++++++---------------- 4 files changed, 115 insertions(+), 98 deletions(-)
devtools/libabigail.abignore +6 -0
@@ -37,3 +37,9 @@ [suppress_type] name = rte_eth_fp_ops has_data_member_inserted_between = {offset_of(reserved2), end} + +[suppress_type] + name = rte_mbuf + type_kind = struct + has_size_change = no + has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
doc/guides/rel_notes/release_24_07.rst +3 -0
@@ -68,6 +68,9 @@ Removed Items Also, make sure to start the actual text at the margin. ======================================================= +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. + API Changes -----------
lib/mbuf/rte_mbuf.h +2 -2
@@ -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
lib/mbuf/rte_mbuf_core.h +104 -96
266 lines not on this page · raw message
Signature · 1 line
1.8.3.1
RE: [PATCH v10 2/4] mbuf: remove rte marker fields
Quoted 20 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 3 April 2024 19.54
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.This change breaks the API for cacheline{0,1} fields that have been removed from
rte_mbufbut it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type =rte_mbuf.Signed-off-by Tyler Retzlaff <[email protected]>---
[...]
Quoted 2 lines
(quoted diff) +1
-0+ /* remaining 24 bytes are set on RX when pulling packet fromdescriptor */
Good.
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 523
Quoted 4 lines
(quoted diff) +1
-0union { + /* void * type of the array elements is retained for drivercompatibility. */
lib/mbuf/rte_mbuf_core.h +1
-0+void *rx_descriptor_fields1[24 /sizeof (void *)];
Good, also the description.
Quoted 23 lines
lib/mbuf/rte_mbuf_core.h +2
-4__extension__ struct { - uint8_t l2_type:4; /**< (Outer) L2 type. */ - uint8_t l3_type:4; /**< (Outer) L3 type. */ - uint8_t l4_type:4; /**< (Outer) L4 type. */ - uint8_t tun_type:4; /**< Tunnel type. */ + /* + * The packet type, which is the combination ofouter/inner L2, L3, L4
(quoted diff) +1
-0+ * and tunnel types. The packet_type is about datareally present in the
(quoted diff) +1
-0+ * mbuf. Example: if vlan stripping is enabled, areceived vlan packet
(quoted diff) +1
-0+ * would have RTE_PTYPE_L2_ETHER and not
RTE_PTYPE_L2_VLANbecause thelib/mbuf/rte_mbuf_core.h +2
-5+* vlan is stripped from the data. +*/ union { -uint8_t inner_esp_next_proto; -/**< ESP next protocol type, valid if -* RTE_PTYPE_TUNNEL_ESP tunnel type is set -* on both Tx and Rx. -*/
[...]
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 546
Quoted 7 lines
(quoted diff) +1
-0+ /**< ESP next protocol type, validif
(quoted diff) +1
-0+ * RTE_PTYPE_TUNNEL_ESP tunnel typeis set
lib/mbuf/rte_mbuf_core.h +3
-0+* on both Tx and Rx. +*/ +uint8_t inner_esp_next_proto;
Thank you for moving the comments up before the fields.
Please note that "/**<" means that the description is related to the field preceding the comment, so it should be replaced by "/**" when moving the description up above a field.
Maybe moving the descriptions as part of this patch was not a good idea after all; it doesn't improve the readability of the patch itself. I regret suggesting it. If you leave the descriptions at their originals positions (relative to the fields), we can clean up the formatting of the descriptions in a later patch.
[...]
Quoted 15 lines
lib/mbuf/rte_mbuf_core.h +1
-2/* second cache line - fields only used in slow path or on TX */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; -#if RTE_IOVA_IN_MBUF /** * Next segment of scattered packet. Must be NULL in the last * segment or in case of non-segmented packet. */ + alignas(RTE_CACHE_LINE_MIN_SIZE )struct rte_mbuf *next;#else /** * Reserved for dynamic fields * when the next pointer is in first cache line (i.e.
RTE_IOVA_IN_MBUFis 0).
Review
Quoted 2 lines
(quoted diff) +1
-0*/ + alignas(RTE_CACHE_LINE_MIN_SIZE)
Good positioning of the alignas().
I like everything in this patch.
Please fix the descriptions preceding the fields "/**<" -> "/**" or move them back to their location after the fields; then you may add Reviewed-by: Morten Brørup <[email protected]> to the next version.
Re: [PATCH v10 2/4] mbuf: remove rte marker fields
Quoted 71 lines · Morten Brørup
Quoted 20 lines
From: Tyler Retzlaff [mailto:[email protected]]
Sent: Wednesday, 3 April 2024 19.54
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.This change breaks the API for cacheline{0,1} fields that have been removed from
rte_mbufbut it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type =rte_mbuf.Signed-off-by Tyler Retzlaff <[email protected]>---
[...]
Quoted 2 lines
(quoted diff) +1
-0+ /* remaining 24 bytes are set on RX when pulling packet fromdescriptor */
Good.
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 523
Quoted 4 lines
(quoted diff) +1
-0union { + /* void * type of the array elements is retained for drivercompatibility. */
lib/mbuf/rte_mbuf_core.h +1
-0+void *rx_descriptor_fields1[24 /sizeof (void *)];Good, also the description.
Quoted 23 lines
lib/mbuf/rte_mbuf_core.h +2
-4__extension__ struct { - uint8_t l2_type:4; /**< (Outer) L2 type. */ - uint8_t l3_type:4; /**< (Outer) L3 type. */ - uint8_t l4_type:4; /**< (Outer) L4 type. */ - uint8_t tun_type:4; /**< Tunnel type. */ + /* + * The packet type, which is the combination ofouter/inner L2, L3, L4
(quoted diff) +1
-0+ * and tunnel types. The packet_type is about datareally present in the
(quoted diff) +1
-0+ * mbuf. Example: if vlan stripping is enabled, areceived vlan packet
(quoted diff) +1
-0+ * would have RTE_PTYPE_L2_ETHER and not
RTE_PTYPE_L2_VLANbecause thelib/mbuf/rte_mbuf_core.h +2
-5+* vlan is stripped from the data. +*/ union { -uint8_t inner_esp_next_proto; -/**< ESP next protocol type, valid if -* RTE_PTYPE_TUNNEL_ESP tunnel type is set -* on both Tx and Rx. -*/ [...]
lib/mbuf/rte_mbuf_core.h struct __rte_cache_aligned rte_mbuf { · line 546
Quoted 7 lines
(quoted diff) +1
-0+ /**< ESP next protocol type, validif
(quoted diff) +1
-0+ * RTE_PTYPE_TUNNEL_ESP tunnel typeis set
lib/mbuf/rte_mbuf_core.h +3
-0+* on both Tx and Rx. +*/ +uint8_t inner_esp_next_proto;Thank you for moving the comments up before the fields.
Quoted 1 line
Please note that "/**<" means that the description is related to the field preceding the comment, so it should be replaced by "/**" when moving the description up above a field.
ooh, i'll fix it i'm not well versed in doxygen documentation.
Quoted 3 lines
Maybe moving the descriptions as part of this patch was not a good idea after all; it doesn't improve the readability of the patch itself. I regret suggesting it. If you leave the descriptions at their originals positions (relative to the fields), we can clean up the formatting of the descriptions in a later patch.
it's easy enough for me to fix the comments in place and bring in a new version of the series, assuming other reviewers don't object i'll do that. the diff is already kind of annoying to review in mail without -b anyway.
Quoted 23 lines
[...]
Quoted 15 lines
lib/mbuf/rte_mbuf_core.h +1
-2/* second cache line - fields only used in slow path or on TX */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; -#if RTE_IOVA_IN_MBUF /** * Next segment of scattered packet. Must be NULL in the last * segment or in case of non-segmented packet. */ + alignas(RTE_CACHE_LINE_MIN_SIZE )struct rte_mbuf *next;#else /** * Reserved for dynamic fields * when the next pointer is in first cache line (i.e.
RTE_IOVA_IN_MBUFis 0).Review
Quoted 2 lines
(quoted diff) +1
-0*/ + alignas(RTE_CACHE_LINE_MIN_SIZE)Good positioning of the
alignas().
Quoted 3 lines
I like everything in this patch.
Please fix the descriptions preceding the fields "/**<" -> "/**" or move them back to their location after the fields; then you may add Reviewed-by: Morten Brørup <[email protected]> to the next version.
ack, next rev.
Re: [PATCH v10 2/4] mbuf: remove rte marker fields
In reply to Tyler RetzlaffQuoted 10 lines · On Wed, 3 Apr 2024 10:53:34 -0700 Tyler Retzlaff…
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Quoted 6 lines
This change breaks the API for cacheline{0,1} fields that have been removed from
rte_mbufbut it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type =rte_mbuf.Signed-off-by Tyler Retzlaff <[email protected]>
PATCH v10 3/4 security: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_07.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_07.rst +3 -0
@@ -71,6 +71,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------
lib/security/rte_security_driver.h +3 -2
@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif
@@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
Signature · 1 line
1.8.3.1
Re: [PATCH v10 3/4] security: remove rte marker fields
Quoted 9 lines · On Wed, 3 Apr 2024 10:53:35 -0700 Tyler Retzlaff…
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Signed-off-by Tyler Retzlaff <[email protected]>Reviewed-by Morten Brørup <[email protected]>---
PATCH v10 4/4 cryptodev: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_07.rst | 3 +++ lib/cryptodev/cryptodev_pmd.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_07.rst +3 -0
@@ -71,6 +71,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct cryptodev_driver``. + * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_security_session``.
lib/cryptodev/cryptodev_pmd.h +3 -2
@@ -5,6 +5,8 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#include <stdalign.h> + #ifdef __cplusplus extern "C" { #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */
Signature · 1 line
1.8.3.1
Re: [PATCH v10 4/4] cryptodev: remove rte marker fields
Quoted 8 lines · On Wed, 3 Apr 2024 10:53:36 -0700 Tyler Retzlaff…
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields fromrte_mbufstruct.Maintain alignment of fields after removed cacheline1 marker by placing C11
alignas(RTE_CACHE_LINE_MIN_SIZE).Signed-off-by Tyler Retzlaff <[email protected]>Reviewed-by Morten Brørup <[email protected]>
v11 cover remove use of RTE_MARKER fields in libraries
In reply to Tyler RetzlaffAs per techboard meeting 2024/03/20 adopt hybrid proposal of adapting descriptor fields and removing cachline fields.
RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove RTE_MARKER fields.
For cacheline{0,1} fields remove fields entirely and use inline functions to prefetch.
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Note: diff is easier viewed with -b due to additional nesting from
unions / structs that have been introduced.
v11:
* correct doxygen comment style for field documentation.
v10:
* move removal notices in in release notes from 24.03 to 24.07.
v9:
* provide narrowest possible libabigail.abignore to suppress removal of fields that were agreed are not actual abi changes.
v8:
* rx_descriptor_fields1 array is now constexpr sized to 24 / sizeof(void *) so that the array encompasses fields accessed via the array.
* add a comment to rx_descriptor_fields1 array site noting that void * type of elements is retained for compatibility with existing drivers.
* clean up comments of fields in rte_mbuf to be before the field they apply to instead of after.
* duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of conditional compile for first field of cacheline 1 instead of once before conditional compile block.
v7:
* complete re-write of series, previous versions not noted. all reviewed-by and acked-by tags (if any) were removed.
Tyler Retzlaff (4):
net/i40e: use inline prefetch function
mbuf: remove rte marker fields
security: remove rte marker fields
cryptodev: remove rte marker fields
devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_07.rst | 9 ++ drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- lib/cryptodev/cryptodev_pmd.h | 5 +- lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 202 +++++++++++++++++--------------- lib/security/rte_security_driver.h | 5 +- 7 files changed, 129 insertions(+), 104 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v11 1/4 net/i40e: use inline prefetch function
Don't directly access the cacheline1 field in rte_mbuf struct for prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1 -1
@@ -826,7 +826,7 @@ free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) {
Signature · 1 line
1.8.3.1
PATCH v11 2/4 mbuf: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
This change breaks the API for cacheline{0,1} fields that have been removed from rte_mbuf but it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type = rte_mbuf.
--- devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_07.rst | 3 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 202 +++++++++++++++++---------------- 4 files changed, 116 insertions(+), 99 deletions(-)
devtools/libabigail.abignore +6 -0
@@ -37,3 +37,9 @@ [suppress_type] name = rte_eth_fp_ops has_data_member_inserted_between = {offset_of(reserved2), end} + +[suppress_type] + name = rte_mbuf + type_kind = struct + has_size_change = no + has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1}
doc/guides/rel_notes/release_24_07.rst +3 -0
@@ -68,6 +68,9 @@ Removed Items Also, make sure to start the actual text at the margin. ======================================================= +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. + API Changes -----------
lib/mbuf/rte_mbuf.h +2 -2
@@ -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
lib/mbuf/rte_mbuf_core.h +105 -97
267 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v11 3/4 security: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_07.rst | 3 +++ lib/security/rte_security_driver.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_07.rst +3 -0
@@ -71,6 +71,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_security_session``. + API Changes -----------
lib/security/rte_security_driver.h +3 -2
@@ -12,6 +12,8 @@* RTE Security Common Definitions */ +#include <stdalign.h> +#ifdef __cplusplusextern "C" {#endif
@@ -24,7 +26,6 @@* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;
@@ -32,7 +33,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
Signature · 1 line
1.8.3.1
PATCH v11 4/4 cryptodev: remove rte marker fields
In reply to Tyler RetzlaffRTE_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).
--- doc/guides/rel_notes/release_24_07.rst | 3 +++ lib/cryptodev/cryptodev_pmd.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_24_07.rst +3 -0
@@ -71,6 +71,9 @@ Removed Items * mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_mbuf``. +* cryptodev: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct cryptodev_driver``. + * security: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` have been removed from ``struct rte_security_session``.
lib/cryptodev/cryptodev_pmd.h +3 -2
@@ -5,6 +5,8 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#include <stdalign.h> + #ifdef __cplusplus extern "C" { #endif
@@ -139,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;
@@ -151,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */
Signature · 1 line
1.8.3.1
v12 cover remove use of RTE_MARKER fields in libraries
In reply to Tyler RetzlaffAs per techboard meeting 2024/03/20 adopt hybrid proposal of adapting descriptor fields and removing cachline fields.
RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Remove RTE_MARKER fields.
For cacheline{0,1} fields remove fields entirely and use inline functions to prefetch.
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
Note: diff is easier viewed with -b due to additional nesting from
unions / structs that have been introduced.
v12:
* rebased,
* did some cosmetic changes,
* and resending to double check CI (v11 had an issue in UNH Debian containers),
v11:
* correct doxygen comment style for field documentation.
v10:
* move removal notices in in release notes from 24.03 to 24.07.
v9:
* provide narrowest possible libabigail.abignore to suppress removal of fields that were agreed are not actual abi changes.
v8:
* rx_descriptor_fields1 array is now constexpr sized to 24 / sizeof(void *) so that the array encompasses fields accessed via the array.
* add a comment to rx_descriptor_fields1 array site noting that void * type of elements is retained for compatibility with existing drivers.
* clean up comments of fields in rte_mbuf to be before the field they apply to instead of after.
* duplicate alignas(RTE_CACHE_LINE_MIN_SIZE) into both legs of conditional compile for first field of cacheline 1 instead of once before conditional compile block.
v7:
* complete re-write of series, previous versions not noted. all reviewed-by and acked-by tags (if any) were removed.
Signature · 20 lines
David Marchand Tyler Retzlaff (4): net/i40e: use mbuf prefetch helper mbuf: remove marker fields security: remove marker fields cryptodev: remove marker fields devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_07.rst | 3 + drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- lib/cryptodev/cryptodev_pmd.h | 3 +- lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 ++++++++++++------------ lib/security/rte_security_driver.h | 3 +- 7 files changed, 112 insertions(+), 97 deletions(-) -- 2.45.1
PATCH v12 1/4 net/i40e: use mbuf prefetch helper
From: Tyler Retzlaff <[email protected]>
Don't directly access the cacheline1 field in rte_mbuf struct for prefetch instead just use rte_mbuf_prefetch_part2() to prefetch.
--- drivers/net/i40e/i40e_rxtx_vec_avx512.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_rxtx_vec_avx512.c +1 -1
@@ -826,7 +826,7 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq) free[0 ] = m; nb_free =1 ;for (i =1 ; i < n; i++) { -rte_prefetch0 (&txep[i +3 ].mbuf->cacheline1); +rte_mbuf_prefetch_part2 (txep[i +3 ].mbuf); m =rte_pktmbuf_prefree_seg (txep[i].mbuf);if (likely (m)) {if (likely (m->pool == free[0 ]->pool)) {
Signature · 1 line
2.45.1
PATCH v12 2/4 mbuf: remove marker fields
In reply to David MarchandFrom: Tyler Retzlaff <[email protected]>
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).
Provide new rearm_data and rx_descriptor_fields1 fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.
This change breaks the API for cacheline{0,1} fields that have been removed from rte_mbuf but it does not break the ABI, to address the false positives of the removed (but 0 size fields) provide the minimum libabigail.abignore for type = rte_mbuf.
---
Changes since v11:
- moved libabigail suppression,
- moved RN update to API change,
- updated one comment in rte_mbuf_core.h referring to cacheline0,
- removed (unrelated) doxygen updates,
--- devtools/libabigail.abignore | 6 + doc/guides/rel_notes/release_24_07.rst | 3 + lib/mbuf/rte_mbuf.h | 4 +- lib/mbuf/rte_mbuf_core.h | 188 +++++++++++++------------ 4 files changed, 109 insertions(+), 92 deletions(-)
devtools/libabigail.abignore +6 -0
@@ -33,6 +33,12 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Temporary exceptions till next major ABI version ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +[suppress_type] + name = rte_mbuf + type_kind = struct + has_size_change = no + has_data_member = {cacheline0, rearm_data, rx_descriptor_fields1, cacheline1} + [suppress_type] name = rte_pipeline_table_entry
doc/guides/rel_notes/release_24_07.rst +3 -0
@@ -178,6 +178,9 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* mbuf: ``RTE_MARKER`` fields ``cacheline0`` and ``cacheline1`` + have been removed from ``struct rte_mbuf``. + ABI Changes -----------
lib/mbuf/rte_mbuf.h +2 -2
@@ -108,7 +108,7 @@ int rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen);static inline void rte_mbuf_prefetch_part1 (struct rte_mbuf *m) { -rte_prefetch0 (&m->cacheline0); +rte_prefetch0 (m); }/**
@@ -126,7 +126,7 @@ static inline void 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
lib/mbuf/rte_mbuf_core.h +98 -90
240 lines not on this page · raw message
Signature · 1 line
2.45.1
PATCH v12 3/4 security: remove marker fields
In reply to David MarchandFrom: Tyler Retzlaff <[email protected]>
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).
---
Changes since v11:
- removed RN update, as this change impacts only a internal driver structure and no intree code refers to it,
--- lib/security/rte_security_driver.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/security/rte_security_driver.h +1 -2
@@ -24,7 +24,6 @@ extern "C" {* Security session to be used by library for internal usage */ struct rte_security_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Opaque user defined data */ uint64_t fast_mdata;
@@ -32,7 +31,7 @@ struct rte_security_session {rte_iova_t driver_priv_data_iova;/**< session private data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )uint8_t driver_priv_data[];/**< Private session material, variable size (depends on driver) */ };
Signature · 1 line
2.45.1
PATCH v12 4/4 cryptodev: remove marker fields
In reply to David MarchandFrom: Tyler Retzlaff <[email protected]>
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).
---
Changes since v11:
- removed RN update, as this change impacts only a internal driver structure and no intree code refers to it,
--- lib/cryptodev/cryptodev_pmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/cryptodev/cryptodev_pmd.h +1 -2
@@ -141,7 +141,6 @@ struct cryptodev_driver {* has a fixed algo, key, op-type, digest_len etc. */ struct rte_cryptodev_sym_session { -RTE_MARKER cacheline0;uint64_t opaque_data;/**< Can be used for external metadata */ uint32_t sess_data_sz;
@@ -153,7 +152,7 @@ struct rte_cryptodev_sym_session {rte_iova_t driver_priv_data_iova;/**< Session driver data IOVA address */ - alignas(RTE_CACHE_LINE_MIN_SIZE )RTE_MARKER cacheline1; + alignas(RTE_CACHE_LINE_MIN_SIZE )/**< Second cache line - start of the driver session data */ uint8_t driver_priv_data[];/**< Driver specific session data, variable size */
Signature · 1 line
2.45.1
Re: [PATCH v12 0/4] remove use of RTE_MARKER fields in libraries
In reply to David MarchandQuoted 10 lines · David Marchand
As per techboard meeting 2024/03/20 adopt hybrid proposal of adapting descriptor fields and removing cachline fields.
RTE_MARKERtypedefs are a GCC extension unsupported by MSVC. RemoveRTE_MARKERfields.For cacheline{0,1} fields remove fields entirely and use inline functions to prefetch.
Quoted 7 lines
Provide new
rearm_dataandrx_descriptor_fields1fields in anonymous unions as single element arrays of with types matching the original markers to maintain API compatibility.Note: diff is easier viewed with -b due to additional nesting from
unions / structs that have been introduced.
There was one issue in UNH Debian containers, in the past that is supposed to be fixed.
UNH lab seems quite busy today and I did not get a report for this series to double check the Debian containers are indeed fixed.
Today was long enough, and rc1 is waiting, let's try our luck and take the series.
At worse, we may get some false reports from UNH, but it should be fixed soon.
Series applied, thanks Tyler.
Signature · 1 line
David Marchand