* [dpdk-dev] [PATCH 00/15] remove mbuf userdata
@ 2020-10-26 5:20 Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
` (19 more replies)
0 siblings, 20 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
The mbuf field userdata (aliased as udata64)
was announced to be removed for two reasons:
- applications, libraries and drivers used the same field
for different purposes, with a risk of usage conflict.
- this field always used 8 bytes even if unneeded
Some dynamic fields are created when needed to replace
the big static userdata field.
As a consequence, 8 bytes can be re-allocated to dynamic fields.
This mbuf layout change is important to allow adding more features
(consuming more dynamic fields) during the next year.
Thomas Monjalon (15):
examples: enclose DPDK includes with angle brackets
kni: move header file from EAL
mbuf: fix typo in dynamic field convention note
node: switch IPv4 metadata to dynamic mbuf field
security: switch metadata to dynamic mbuf field
event/sw: switch test counter to dynamic mbuf field
net/ark: ignore user data
net/bnxt: switch CFA code to dynamic mbuf field
net/vmxnet3: switch MSS hint to dynamic mbuf field
test/distributor: switch sequence to dynamic mbuf field
test/graph: switch user data to dynamic mbuf field
app/eventdev: switch flow ID to dynamic mbuf field
examples/bbdev: switch to dynamic mbuf field
examples/rxtx_callbacks: switch to dynamic mbuf field
mbuf: remove userdata field
app/test-eventdev/test_order_atq.c | 4 +-
app/test-eventdev/test_order_common.c | 16 +++-
app/test-eventdev/test_order_common.h | 5 +
app/test-eventdev/test_order_queue.c | 4 +-
app/test/test_distributor.c | 27 +++++-
app/test/test_graph.c | 93 +++++++++++--------
doc/guides/prog_guide/rte_security.rst | 9 +-
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 +-
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 +-
drivers/event/sw/sw_evdev_selftest.c | 22 ++++-
drivers/net/ark/ark_ddm.h | 2 +-
drivers/net/ark/ark_ethdev_rx.c | 1 -
drivers/net/ark/ark_ethdev_tx.c | 1 -
drivers/net/ark/ark_udm.h | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 19 ++++
drivers/net/bnxt/bnxt_rxr.c | 5 +-
drivers/net/bnxt/bnxt_rxr.h | 2 +
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +
drivers/net/ixgbe/ixgbe_ipsec.c | 5 +-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 +-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 +-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +
drivers/net/vmxnet3/vmxnet3_rxtx.c | 10 +-
examples/bbdev_app/main.c | 67 ++++++++-----
examples/bond/main.c | 11 +--
examples/ipsec-secgw/ipsec-secgw.c | 15 ++-
examples/ipsec-secgw/ipsec.h | 3 +
examples/ipsec-secgw/ipsec_worker.c | 13 ++-
examples/rxtx_callbacks/main.c | 19 +++-
examples/tep_termination/vxlan_setup.c | 2 +-
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
.../include => librte_kni}/rte_kni_common.h | 3 +-
lib/librte_mbuf/rte_mbuf_core.h | 8 +-
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
lib/librte_node/ip4_lookup.c | 7 ++
lib/librte_node/ip4_rewrite.c | 10 ++
lib/librte_node/node_private.h | 12 ++-
lib/librte_security/rte_security.c | 10 ++
lib/librte_security/rte_security.h | 5 +
lib/librte_security/rte_security_driver.h | 20 ++++
lib/librte_security/version.map | 2 +
49 files changed, 357 insertions(+), 133 deletions(-)
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (97%)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 14:23 ` Andrew Rybchenko
2020-10-27 11:32 ` Bruce Richardson
2020-10-26 5:20 ` [dpdk-dev] [PATCH 02/15] kni: move header file from EAL Thomas Monjalon
` (18 subsequent siblings)
19 siblings, 2 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru, Chas Williams,
Min Hu (Connor),
Xiaoyun Li
In examples, DPDK header files are external,
so they must be enclosed with angle brackets, not quotes.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/bbdev_app/main.c | 30 +++++++++++++-------------
examples/bond/main.c | 11 ++++------
examples/tep_termination/vxlan_setup.c | 2 +-
3 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 43fe631760..e512c807cd 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -18,21 +18,21 @@
#include <getopt.h>
#include <signal.h>
-#include "rte_atomic.h"
-#include "rte_common.h"
-#include "rte_eal.h"
-#include "rte_cycles.h"
-#include "rte_ether.h"
-#include "rte_ethdev.h"
-#include "rte_ip.h"
-#include "rte_lcore.h"
-#include "rte_malloc.h"
-#include "rte_mbuf.h"
-#include "rte_memory.h"
-#include "rte_mempool.h"
-#include "rte_log.h"
-#include "rte_bbdev.h"
-#include "rte_bbdev_op.h"
+#include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_eal.h>
+#include <rte_cycles.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_ip.h>
+#include <rte_lcore.h>
+#include <rte_malloc.h>
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_log.h>
+#include <rte_bbdev.h>
+#include <rte_bbdev_op.h>
/* LLR values - negative value for '1' bit */
#define LLR_1_BIT 0x81
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 398553b785..81a6fa976b 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -41,6 +41,10 @@
#include <rte_tcp.h>
#include <rte_arp.h>
#include <rte_spinlock.h>
+#include <rte_devargs.h>
+#include <rte_byteorder.h>
+#include <rte_cpuflags.h>
+#include <rte_eth_bond.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
@@ -53,13 +57,6 @@
#include "main.h"
-#include <rte_devargs.h>
-
-
-#include "rte_byteorder.h"
-#include "rte_cpuflags.h"
-#include "rte_eth_bond.h"
-
#define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1
#define NB_MBUF (1024*8)
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index 4b44ccc143..0bcd870b4a 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -18,9 +18,9 @@
#include <rte_ip.h>
#include <rte_udp.h>
#include <rte_tcp.h>
+#include <rte_vhost.h>
#include "main.h"
-#include "rte_vhost.h"
#include "vxlan.h"
#include "vxlan_setup.h"
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 02/15] kni: move header file from EAL
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 14:25 ` Andrew Rybchenko
2020-10-27 11:33 ` Bruce Richardson
2020-10-26 5:20 ` [dpdk-dev] [PATCH 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
` (17 subsequent siblings)
19 siblings, 2 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
Since the kernel module is not part of EAL anymore,
there is no need to have the common KNI header file in EAL.
The file rte_kni_common.h is moved to librte_kni.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h | 0
4 files changed, 2 insertions(+), 3 deletions(-)
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (100%)
diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build
index d696347f22..07e0c9dae7 100644
--- a/kernel/linux/kni/meson.build
+++ b/kernel/linux/kni/meson.build
@@ -18,7 +18,7 @@ custom_target('rte_kni',
'src=' + meson.current_source_dir(),
'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
' -I' + meson.source_root() + '/lib/librte_eal/include' +
- ' -I' + meson.source_root() + '/lib/librte_eal/linux/include' +
+ ' -I' + meson.source_root() + '/lib/librte_kni' +
' -I' + meson.build_root() +
' -I' + meson.current_source_dir(),
'modules'],
diff --git a/lib/librte_eal/linux/include/meson.build b/lib/librte_eal/linux/include/meson.build
index 1241894b3c..7d18dd52f1 100644
--- a/lib/librte_eal/linux/include/meson.build
+++ b/lib/librte_eal/linux/include/meson.build
@@ -4,6 +4,5 @@
includes += include_directories('.')
headers += files(
- 'rte_kni_common.h',
'rte_os.h',
)
diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build
index 963eae6fe0..ad598bb3d0 100644
--- a/lib/librte_kni/meson.build
+++ b/lib/librte_kni/meson.build
@@ -6,5 +6,5 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
reason = 'only supported on 64-bit linux'
endif
sources = files('rte_kni.c')
-headers = files('rte_kni.h')
+headers = files('rte_kni.h', 'rte_kni_common.h')
deps += ['ethdev', 'pci']
diff --git a/lib/librte_eal/linux/include/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
similarity index 100%
rename from lib/librte_eal/linux/include/rte_kni_common.h
rename to lib/librte_kni/rte_kni_common.h
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 03/15] mbuf: fix typo in dynamic field convention note
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 02/15] kni: move header file from EAL Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 14:26 ` Andrew Rybchenko
2020-10-26 5:20 ` [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
` (16 subsequent siblings)
19 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, stable, Konstantin Ananyev
Replace "in a in PMD" with "in a PMD".
Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 8407230ecf..0ebac88b83 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -62,7 +62,7 @@
* conventions than function names in dpdk:
* - "rte_mbuf_dynfield_<name>" if defined in mbuf library
* - "rte_<libname>_dynfield_<name>" if defined in another library
- * - "rte_net_<pmd>_dynfield_<name>" if defined in a in PMD
+ * - "rte_net_<pmd>_dynfield_<name>" if defined in a PMD
* - any name that does not start with "rte_" in an application
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (2 preceding siblings ...)
2020-10-26 5:20 ` [dpdk-dev] [PATCH 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 10:40 ` David Marchand
2020-10-26 5:20 ` [dpdk-dev] [PATCH 05/15] security: switch " Thomas Monjalon
` (15 subsequent siblings)
19 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nithin Dabilpuram,
Pavan Nikhilesh
The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_node/ip4_lookup.c | 7 +++++++
lib/librte_node/ip4_rewrite.c | 10 ++++++++++
lib/librte_node/node_private.h | 12 ++++++++++--
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 8835aab9dd..2cc91c0c67 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -21,6 +21,8 @@
#include "node_private.h"
+int node_mbuf_priv1_dynfield_offset;
+
#define IPV4_L3FWD_LPM_MAX_RULES 1024
#define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)
@@ -178,6 +180,11 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
RTE_SET_USED(node);
if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -1;
+
/* Setup LPM tables for all sockets */
RTE_LCORE_FOREACH(lcore_id)
{
diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c
index bb7f671b5c..2ffb3f4340 100644
--- a/lib/librte_node/ip4_rewrite.c
+++ b/lib/librte_node/ip4_rewrite.c
@@ -248,9 +248,19 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
static int
ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
{
+ static bool init_once;
RTE_SET_USED(graph);
RTE_SET_USED(node);
+
+ if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -1;
+ init_once = true;
+ }
+
node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
return 0;
diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
index ab7941c12b..bafea3704d 100644
--- a/lib/librte_node/node_private.h
+++ b/lib/librte_node/node_private.h
@@ -8,6 +8,7 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
extern int rte_node_logtype;
#define NODE_LOG(level, node_name, ...) \
@@ -21,7 +22,6 @@ extern int rte_node_logtype;
#define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
/**
- *
* Node mbuf private data to store next hop, ttl and checksum.
*/
struct node_mbuf_priv1 {
@@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
};
};
+static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
+ .name = "rte_node_dynfield_priv1",
+ .size = sizeof(uint64_t),
+ .align = __alignof__(uint64_t),
+};
+extern int node_mbuf_priv1_dynfield_offset;
+
/**
* Node mbuf private area 2.
*/
@@ -60,7 +67,8 @@ struct node_mbuf_priv2 {
static __rte_always_inline struct node_mbuf_priv1 *
node_mbuf_priv1(struct rte_mbuf *m)
{
- return (struct node_mbuf_priv1 *)&m->udata64;
+ return RTE_MBUF_DYNFIELD(m,
+ node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *);
}
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (3 preceding siblings ...)
2020-10-26 5:20 ` [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 10:41 ` David Marchand
2020-10-26 15:06 ` Andrew Rybchenko
2020-10-26 5:20 ` [dpdk-dev] [PATCH 06/15] event/sw: switch test counter " Thomas Monjalon
` (14 subsequent siblings)
19 siblings, 2 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
The device-specific metadata was stored in the deprecated field udata64.
It is moved to a dynamic mbuf field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/prog_guide/rte_security.rst | 9 +++++----
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++++-
drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++++-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++--
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++++-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 15 +++++++++-----
examples/ipsec-secgw/ipsec.h | 3 +++
examples/ipsec-secgw/ipsec_worker.c | 13 ++++++++----
lib/librte_security/rte_security.c | 10 ++++++++++
lib/librte_security/rte_security.h | 5 +++++
lib/librte_security/rte_security_driver.h | 20 +++++++++++++++++++
lib/librte_security/version.map | 2 ++
15 files changed, 83 insertions(+), 20 deletions(-)
diff --git a/doc/guides/prog_guide/rte_security.rst b/doc/guides/prog_guide/rte_security.rst
index c64aef3de9..f72bc8a78f 100644
--- a/doc/guides/prog_guide/rte_security.rst
+++ b/doc/guides/prog_guide/rte_security.rst
@@ -125,8 +125,9 @@ ESP/AH headers will be removed from the packet and the received packet
will contains the decrypted packet only. The driver Rx path checks the
descriptors and based on the crypto status sets additional flags in
``rte_mbuf.ol_flags`` field. The driver would also set device-specific
-metadata in ``rte_mbuf.udata64`` field. This will allow the application
-to identify the security processing done on the packet.
+metadata in ``RTE_SECURITY_DYNFIELD_NAME`` field.
+This will allow the application to identify the security processing
+done on the packet.
.. note::
@@ -568,8 +569,8 @@ security session which processed the packet.
.. note::
- In case of inline processed packets, ``rte_mbuf.udata64`` field would be
- used by the driver to relay information on the security processing
+ In case of inline processed packets, ``RTE_SECURITY_DYNFIELD_NAME`` field
+ would be used by the driver to relay information on the security processing
associated with the packet. In ingress, the driver would set this in Rx
path while in egress, ``rte_security_set_pkt_metadata()`` would perform a
similar operation. The application is expected not to modify the field
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
index b80ec7bff2..2e5e73143b 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
@@ -455,6 +455,9 @@ otx2_crypto_sec_session_create(void *device,
if (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL)
return -ENOTSUP;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
if (rte_mempool_get(mempool, (void **)&priv)) {
otx2_err("Could not allocate security session private data");
return -ENOMEM;
@@ -514,7 +517,7 @@ otx2_crypto_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (RTE_SECURITY_DYNFIELD_TYPE)session;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c
index 48f5082d49..0232db20ed 100644
--- a/drivers/net/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ixgbe/ixgbe_ipsec.c
@@ -484,7 +484,8 @@ ixgbe_crypto_update_mb(void *device __rte_unused,
get_sec_session_private_data(session);
if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) {
union ixgbe_crypto_tx_desc_md *mdata =
- (union ixgbe_crypto_tx_desc_md *)&m->udata64;
+ (union ixgbe_crypto_tx_desc_md *)
+ rte_security_dynfield(m);
mdata->enc = 1;
mdata->sa_idx = ic_session->sa_index;
mdata->pad_len = ixgbe_crypto_compute_pad_len(m);
@@ -751,5 +752,7 @@ ixgbe_ipsec_ctx_create(struct rte_eth_dev *dev)
return -ENOMEM;
}
}
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 5f19972031..5e7ea001f3 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -34,6 +34,7 @@
#include <rte_mbuf.h>
#include <rte_ether.h>
#include <rte_ethdev_driver.h>
+#include <rte_security_driver.h>
#include <rte_prefetch.h>
#include <rte_udp.h>
#include <rte_tcp.h>
@@ -694,7 +695,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
if (use_ipsec) {
union ixgbe_crypto_tx_desc_md *ipsec_mdata =
(union ixgbe_crypto_tx_desc_md *)
- &tx_pkt->udata64;
+ rte_security_dynfield(tx_pkt);
tx_offload.sa_idx = ipsec_mdata->sa_idx;
tx_offload.sec_pad_len = ipsec_mdata->pad_len;
}
@@ -859,7 +860,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
- tx_offload, &tx_pkt->udata64);
+ tx_offload,
+ rte_security_dynfield(tx_pkt));
txe->last_id = tx_last;
tx_id = txe->next_id;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index b20f399a15..3b9871f4dc 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -13,6 +13,7 @@
#include <rte_kvargs.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
+#include <rte_security_driver.h>
#include <rte_string_fns.h>
#include <rte_time.h>
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec.c b/drivers/net/octeontx2/otx2_ethdev_sec.c
index 4e0dd4e49e..78c5bbeb99 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec.c
+++ b/drivers/net/octeontx2/otx2_ethdev_sec.c
@@ -684,7 +684,7 @@ otx2_eth_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (RTE_SECURITY_DYNFIELD_TYPE)session;
return 0;
}
@@ -831,6 +831,9 @@ otx2_eth_sec_init(struct rte_eth_dev *eth_dev)
!(dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY))
return 0;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
nb_sa = dev->ipsec_in_max_spi;
mz_sz = nb_sa * sa_width;
in_sa_mz_name_get(name, RTE_MEMZONE_NAMESIZE, port);
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
index 5bf8c19995..284bcd5367 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
+++ b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
@@ -55,7 +55,7 @@ otx2_sec_event_tx(struct otx2_ssogws *ws, struct rte_event *ev,
struct nix_iova_s nix_iova;
} *sd;
- priv = get_sec_session_private_data((void *)(m->udata64));
+ priv = get_sec_session_private_data((void *)(*rte_security_dynfield(m)));
sess = &priv->ipsec.ip;
sa = &sess->out_sa;
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index f29a0542f9..61a5c436dd 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -241,7 +241,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
spi = cq->tag & 0xFFFFF;
sa = nix_rx_sec_sa_get(lookup_mem, spi, m->port);
- m->udata64 = (uint64_t)sa->userdata;
+ *rte_security_dynfield(m) = sa->udata64;
data = rte_pktmbuf_mtod(m, char *);
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 2219148285..b68d1212ba 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -165,6 +165,8 @@ static uint32_t nb_lcores;
static uint32_t single_sa;
static uint32_t nb_bufs_in_pool;
+int security_dynfield_offset;
+
/*
* RX/TX HW offload capabilities to enable/use on ethernet ports.
* By default all capabilities are enabled.
@@ -426,7 +428,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
* with the security session.
*/
- if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD) {
+ if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD &&
+ security_dynfield_offset >= 0) {
struct ipsec_sa *sa;
struct ipsec_mbuf_metadata *priv;
struct rte_security_ctx *ctx = (struct rte_security_ctx *)
@@ -436,10 +439,9 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
/* Retrieve the userdata registered. Here, the userdata
* registered is the SA pointer.
*/
-
- sa = (struct ipsec_sa *)
- rte_security_get_userdata(ctx, pkt->udata64);
-
+ sa = (struct ipsec_sa *) rte_security_get_userdata(ctx,
+ *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
+ RTE_SECURITY_DYNFIELD_TYPE *));
if (sa == NULL) {
/* userdata could not be retrieved */
return;
@@ -2898,6 +2900,9 @@ main(int32_t argc, char **argv)
}
printf("Number of mbufs in packet pool %d\n", nb_bufs_in_pool);
+ security_dynfield_offset =
+ rte_mbuf_dynfield_lookup(RTE_SECURITY_DYNFIELD_NAME, NULL);
+
RTE_ETH_FOREACH_DEV(portid) {
if ((enabled_port_mask & (1 << portid)) == 0)
continue;
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 7031e28c46..49cd6ce923 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <rte_byteorder.h>
+#include <rte_mbuf_dyn.h>
#include <rte_crypto.h>
#include <rte_security.h>
#include <rte_flow.h>
@@ -67,6 +68,8 @@ struct ip_addr {
#define MAX_KEY_SIZE 36
+extern int security_dynfield_offset;
+
/*
* application wide SA parameters
*/
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index b6c851f257..72f698893d 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -208,7 +208,8 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
+ struct ipsec_sa *);
}
/* Check if we have a match */
@@ -226,7 +227,8 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
+ struct ipsec_sa *);
}
/* Check if we have a match */
@@ -357,7 +359,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
}
if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
- pkt->userdata = sess->security.ses;
+ *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
+ struct rte_security_session **) = sess->security.ses;
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
@@ -465,7 +468,9 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
}
/* Save security session */
- pkt->userdata = sess_tbl[port_id];
+ *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
+ struct rte_security_session **) =
+ sess_tbl[port_id];
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
index ee4666026a..9b5f9b72aa 100644
--- a/lib/librte_security/rte_security.c
+++ b/lib/librte_security/rte_security.c
@@ -23,6 +23,16 @@
RTE_PTR_OR_ERR_RET(p1->p2->p3, last_retval); \
} while (0)
+int rte_security_dynfield_offset;
+
+int
+rte_security_dynfield_register(void)
+{
+ rte_security_dynfield_offset =
+ rte_mbuf_dynfield_register(&rte_security_dynfield_desc);
+ return rte_security_dynfield_offset;
+}
+
struct rte_security_session *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index 271531af12..c3647151e5 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -451,6 +451,11 @@ int
rte_security_session_destroy(struct rte_security_ctx *instance,
struct rte_security_session *sess);
+/** Device-specific metadata field name (for mbuf dynfield lookup) */
+#define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+/** Device-specific metadata field type */
+#define RTE_SECURITY_DYNFIELD_TYPE uint64_t
+
/**
* Updates the buffer with device-specific defined metadata
*
diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
index 1b561f8528..ba9691b4a0 100644
--- a/lib/librte_security/rte_security_driver.h
+++ b/lib/librte_security/rte_security_driver.h
@@ -17,6 +17,8 @@
extern "C" {
#endif
+#include <rte_mbuf_dyn.h>
+
#include "rte_security.h"
/**
@@ -89,6 +91,24 @@ typedef int (*security_session_stats_get_t)(void *device,
struct rte_security_session *sess,
struct rte_security_stats *stats);
+/* Dynamic mbuf field for device-specific metadata */
+static const struct rte_mbuf_dynfield rte_security_dynfield_desc = {
+ .name = RTE_SECURITY_DYNFIELD_NAME,
+ .size = sizeof(RTE_SECURITY_DYNFIELD_TYPE),
+ .align = __alignof__(RTE_SECURITY_DYNFIELD_TYPE),
+};
+extern int rte_security_dynfield_offset;
+
+__rte_experimental
+int rte_security_dynfield_register(void);
+
+static inline RTE_SECURITY_DYNFIELD_TYPE *
+rte_security_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ rte_security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
+}
+
/**
* Update the mbuf with provided metadata.
*
diff --git a/lib/librte_security/version.map b/lib/librte_security/version.map
index d84eec0a88..22775558c8 100644
--- a/lib/librte_security/version.map
+++ b/lib/librte_security/version.map
@@ -15,6 +15,8 @@ DPDK_21 {
EXPERIMENTAL {
global:
+ rte_security_dynfield_offset;
+ rte_security_dynfield_register;
rte_security_get_userdata;
rte_security_session_stats_get;
rte_security_session_update;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (4 preceding siblings ...)
2020-10-26 5:20 ` [dpdk-dev] [PATCH 05/15] security: switch " Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 15:09 ` Andrew Rybchenko
2020-10-26 5:20 ` [dpdk-dev] [PATCH 07/15] net/ark: ignore user data Thomas Monjalon
` (13 subsequent siblings)
19 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Harry van Haaren
The test worker_loopback used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/event/sw/sw_evdev_selftest.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index 5c7e527917..754504c421 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -40,6 +40,10 @@ struct test {
uint32_t service_id;
};
+static int counter_dynfield_offset;
+#define COUNTER_FIELD(mbuf) \
+ (*RTE_MBUF_DYNFIELD(mbuf, counter_dynfield_offset, uint8_t *))
+
static struct rte_event release_ev;
static inline struct rte_mbuf *
@@ -2987,8 +2991,8 @@ worker_loopback_worker_fn(void *arg)
}
ev[i].queue_id = 0;
- ev[i].mbuf->udata64++;
- if (ev[i].mbuf->udata64 != 16) {
+ COUNTER_FIELD(ev[i].mbuf)++;
+ if (COUNTER_FIELD(ev[i].mbuf) != 16) {
ev[i].op = RTE_EVENT_OP_FORWARD;
enqd = rte_event_enqueue_burst(evdev, port,
&ev[i], 1);
@@ -3028,7 +3032,7 @@ worker_loopback_producer_fn(void *arg)
m = rte_pktmbuf_alloc(t->mbuf_pool);
} while (m == NULL);
- m->udata64 = 0;
+ COUNTER_FIELD(m) = 0;
struct rte_event ev = {
.op = RTE_EVENT_OP_NEW,
@@ -3061,6 +3065,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)
int err;
int w_lcore, p_lcore;
+ static const struct rte_mbuf_dynfield counter_dynfield_desc = {
+ .name = "rte_event_sw_dynfield_selftest_counter",
+ .size = sizeof(uint8_t),
+ .align = __alignof__(uint8_t),
+ };
+ counter_dynfield_offset =
+ rte_mbuf_dynfield_register(&counter_dynfield_desc);
+ if (counter_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return -1;
+ }
+
if (init(t, 8, 2) < 0 ||
create_atomic_qids(t, 8) < 0) {
printf("%d: Error initializing device\n", __LINE__);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 07/15] net/ark: ignore user data
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (5 preceding siblings ...)
2020-10-26 5:20 ` [dpdk-dev] [PATCH 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
` (12 subsequent siblings)
19 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Shepard Siegel, Ed Czeck,
John Miller
The second field of metadata is reserved for user data
which is a deprecated mbuf field.
The usage of mbuf udata64 is removed
and the corresponding ark metadata field is annotated as ignored.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/ark/ark_ddm.h | 2 +-
drivers/net/ark/ark_ethdev_rx.c | 1 -
drivers/net/ark/ark_ethdev_tx.c | 1 -
drivers/net/ark/ark_udm.h | 2 +-
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ark/ark_ddm.h b/drivers/net/ark/ark_ddm.h
index 5456b4b5cc..99eded8524 100644
--- a/drivers/net/ark/ark_ddm.h
+++ b/drivers/net/ark/ark_ddm.h
@@ -19,7 +19,7 @@
/* struct defining Tx meta data -- fixed in FPGA -- 16 bytes */
struct ark_tx_meta {
uint64_t physaddr;
- uint32_t user1;
+ uint32_t user1; /* ignored */
uint16_t data_len; /* of this MBUF */
#define ARK_DDM_EOP 0x01
#define ARK_DDM_SOP 0x02
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 2f8d05099c..5ead67e6b8 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -272,7 +272,6 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->pkt_len = meta->pkt_len;
mbuf->data_len = meta->pkt_len;
mbuf->timestamp = meta->timestamp;
- mbuf->udata64 = meta->user_data;
if (ARK_DEBUG_CORE) { /* debug sanity checks */
if ((meta->pkt_len > (1024 * 16)) ||
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index a0e35af880..8a0a9381f7 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -70,7 +70,6 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
uint8_t flags)
{
meta->physaddr = rte_mbuf_data_iova(mbuf);
- meta->user1 = (uint32_t)mbuf->udata64;
meta->data_len = rte_pktmbuf_data_len(mbuf);
meta->flags = flags;
}
diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
index 5846c825b8..ba436ee25b 100644
--- a/drivers/net/ark/ark_udm.h
+++ b/drivers/net/ark/ark_udm.h
@@ -18,7 +18,7 @@
/* Meta data structure apssed from FPGA, must match layout in FPGA */
struct ark_rx_meta {
uint64_t timestamp;
- uint64_t user_data;
+ uint64_t user_data; /* ignored */
uint8_t port;
uint8_t dst_queue;
uint16_t pkt_len;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (6 preceding siblings ...)
2020-10-26 5:20 ` [dpdk-dev] [PATCH 07/15] net/ark: ignore user data Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 10:42 ` David Marchand
2020-10-26 5:20 ` [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
` (11 subsequent siblings)
19 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ajit Khaparde, Somnath Kotur
The CFA code from mark was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++
drivers/net/bnxt/bnxt_rxr.c | 5 ++++-
drivers/net/bnxt/bnxt_rxr.h | 2 ++
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++
4 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1c7d1b758d..e12de94f04 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -31,6 +31,7 @@
#include "bnxt_nvm_defs.h"
#include "bnxt_tf_common.h"
#include "ulp_flow_db.h"
+#include "rte_pmd_bnxt.h"
#define DRV_MODULE_NAME "bnxt"
static const char bnxt_version[] =
@@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = {
*/
#define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
+int bnxt_cfa_code_dynfield_offset;
+
/*
* max_num_kflows must be >= 32
* and must be a power-of-2 supported value
@@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF)
bp->flags |= BNXT_FLAG_STINGRAY;
+ if (BNXT_TRUFLOW_EN(bp)) {
+ /* extra mbuf field is required to store CFA code from mark */
+ static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = {
+ .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME,
+ .size = sizeof(uint32_t),
+ .align = __alignof__(uint32_t),
+ };
+ bnxt_cfa_code_dynfield_offset =
+ rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc);
+ if (bnxt_cfa_code_dynfield_offset < 0) {
+ PMD_DRV_LOG(ERR,
+ "Failed to register mbuf field for TruFlow mark\n");
+ return -1;
+ }
+ }
+
rc = bnxt_init_board(eth_dev);
if (rc) {
PMD_DRV_LOG(ERR,
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 039217fa60..e913745e91 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -28,6 +28,8 @@
* RX Ring handling
*/
+int cfa_code_dynfield_offset;
+
static inline struct rte_mbuf *__bnxt_alloc_rx_data(struct rte_mempool *mb)
{
struct rte_mbuf *data;
@@ -606,7 +608,8 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
return mark_id;
/* Got the mark, write it to the mbuf and return */
mbuf->hash.fdir.hi = mark_id;
- mbuf->udata64 = (cfa_code & 0xffffffffull) << 32;
+ *RTE_MBUF_DYNFIELD(mbuf, bnxt_cfa_code_dynfield_offset,
+ uint32_t *) = cfa_code & 0xffffffffull;
mbuf->hash.fdir.id = rxcmp1->cfa_code;
mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
return mark_id;
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index b874e54a8c..324d5dad50 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -95,6 +95,8 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
struct rx_pkt_cmpl_hi *rxcmp1,
struct rte_mbuf *mbuf);
+extern int bnxt_cfa_code_dynfield_offset;
+
#define BNXT_RX_META_CFA_CODE_SHIFT 19
#define BNXT_CFA_CODE_META_SHIFT 16
#define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 81d0d0e032..8d3303bb0f 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -9,6 +9,9 @@
#include <rte_ethdev.h>
#include <rte_ether.h>
+/* mbuf dynfield where CFA code is stored */
+#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
+
/*
* Response sent back to the caller after callback
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (7 preceding siblings ...)
2020-10-26 5:20 ` [dpdk-dev] [PATCH 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
@ 2020-10-26 5:20 ` Thomas Monjalon
2020-10-26 15:14 ` Andrew Rybchenko
2020-10-26 5:21 ` [dpdk-dev] [PATCH 10/15] test/distributor: switch sequence " Thomas Monjalon
` (10 subsequent siblings)
19 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Yong Wang
The segment count, used for MSS guess,
was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 ++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 10 ++++++----
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 6920ab568c..eeb1152b61 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -59,6 +59,8 @@
DEV_RX_OFFLOAD_JUMBO_FRAME | \
DEV_RX_OFFLOAD_RSS_HASH)
+int vmxnet3_segs_dynfield_offset;
+
static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
@@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
struct vmxnet3_hw *hw = eth_dev->data->dev_private;
uint32_t mac_hi, mac_lo, ver;
struct rte_eth_link link;
+ static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
+ .name = "rte_net_vmxnet3_dynfield_segs",
+ .size = sizeof(uint8_t),
+ .align = __alignof__(uint8_t),
+ };
PMD_INIT_FUNC_TRACE();
@@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ /* extra mbuf field is required to guess MSS */
+ vmxnet3_segs_dynfield_offset =
+ rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
+ if (vmxnet3_segs_dynfield_offset < 0) {
+ PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
+ return -rte_errno;
+ }
+
/*
* for secondary processes, we don't initialize any further as primary
* has already done this work.
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
index dd685b02b7..5730e94d50 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
@@ -193,4 +193,6 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
+extern int vmxnet3_segs_dynfield_offset;
+
#endif /* _VMXNET3_ETHDEV_H_ */
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index e10f9ee870..6655622f94 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
struct rte_ipv6_hdr *ipv6_hdr;
struct rte_tcp_hdr *tcp_hdr;
char *ptr;
+ uint8_t segs;
RTE_ASSERT(rcd->tcp);
@@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
hlen += (tcp_hdr->data_off & 0xf0) >> 2;
- if (rxm->udata64 > 1)
- return (rte_pktmbuf_pkt_len(rxm) - hlen +
- rxm->udata64 - 1) / rxm->udata64;
+ segs = *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset, uint8_t *);
+ if (segs > 1)
+ return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
else
return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
}
@@ -737,7 +738,8 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
(const Vmxnet3_RxCompDescExt *)rcd;
rxm->tso_segsz = rcde->mss;
- rxm->udata64 = rcde->segCnt;
+ *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset,
+ uint8_t *) = rcde->segCnt;
ol_flags |= PKT_RX_LRO;
}
} else { /* Offloads set in eop */
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 10/15] test/distributor: switch sequence to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (8 preceding siblings ...)
2020-10-26 5:20 ` [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
@ 2020-10-26 5:21 ` Thomas Monjalon
2020-10-26 9:39 ` Lukasz Wojciechowski
2020-10-26 5:21 ` [dpdk-dev] [PATCH 11/15] test/graph: switch user data " Thomas Monjalon
` (9 subsequent siblings)
19 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:21 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, David Hunt
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_distributor.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index eb889b91d1..074a06f4a2 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -10,6 +10,7 @@
#include <rte_errno.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_distributor.h>
#include <rte_string_fns.h>
@@ -17,6 +18,10 @@
#define BURST 32
#define BIG_BATCH 1024
+static int seq_dynfield_offset;
+#define SEQ_FIELD(mbuf) \
+ (*RTE_MBUF_DYNFIELD(mbuf, seq_dynfield_offset, uint32_t *))
+
struct worker_params {
char name[64];
struct rte_distributor *dist;
@@ -578,7 +583,7 @@ handle_and_mark_work(void *arg)
__atomic_fetch_add(&worker_stats[id].handled_packets, num,
__ATOMIC_RELAXED);
for (i = 0; i < num; i++)
- buf[i]->udata64 += id + 1;
+ SEQ_FIELD(buf[i]) += id + 1;
num = rte_distributor_get_pkt(db, id,
buf, buf, num);
}
@@ -631,10 +636,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
<< shift;
}
/* Assign a sequence number to each packet. The sequence is shifted,
- * so that lower bits of the udate64 will hold mark from worker.
+ * so that lower bits will hold mark from worker.
*/
for (i = 0; i < buf_count; i++)
- bufs[i]->udata64 = i << seq_shift;
+ SEQ_FIELD(bufs[i]) = i << seq_shift;
count = 0;
for (i = 0; i < buf_count/burst; i++) {
@@ -660,8 +665,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
/* Sort returned packets by sent order (sequence numbers). */
for (i = 0; i < buf_count; i++) {
- seq = returns[i]->udata64 >> seq_shift;
- id = returns[i]->udata64 - (seq << seq_shift);
+ seq = SEQ_FIELD(returns[i]) >> seq_shift;
+ id = SEQ_FIELD(returns[i]) - (seq << seq_shift);
sorted[seq] = id;
}
@@ -805,6 +810,18 @@ test_distributor(void)
static struct rte_mempool *p;
int i;
+ static const struct rte_mbuf_dynfield seq_dynfield_desc = {
+ .name = "test_distributor_dynfield_seq",
+ .size = sizeof(uint32_t),
+ .align = __alignof__(uint32_t),
+ };
+ seq_dynfield_offset =
+ rte_mbuf_dynfield_register(&seq_dynfield_desc);
+ if (seq_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return TEST_FAILED;
+ }
+
if (rte_lcore_count() < 2) {
printf("Not enough cores for distributor_autotest, expecting at least 2\n");
return TEST_SKIPPED;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 11/15] test/graph: switch user data to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (9 preceding siblings ...)
2020-10-26 5:21 ` [dpdk-dev] [PATCH 10/15] test/distributor: switch sequence " Thomas Monjalon
@ 2020-10-26 5:21 ` Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 12/15] app/eventdev: switch flow ID " Thomas Monjalon
` (8 subsequent siblings)
19 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:21 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob, Kiran Kumar K,
Nithin Dabilpuram
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_graph.c | 93 +++++++++++++++++++++++++------------------
1 file changed, 55 insertions(+), 38 deletions(-)
diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index ed69eda997..74d8e78353 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
#include <rte_graph.h>
#include <rte_graph_worker.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_random.h>
#include "test.h"
@@ -39,6 +40,10 @@ static uint16_t test_node3_worker(struct rte_graph *graph,
#define MBUFF_SIZE 512
#define MAX_NODES 4
+static int graph_dynfield_offset;
+#define GRAPH_FIELD(mbuf) \
+ (*RTE_MBUF_DYNFIELD(mbuf, graph_dynfield_offset, uint64_t *))
+
static struct rte_mbuf mbuf[MAX_NODES + 1][MBUFF_SIZE];
static void *mbuf_p[MAX_NODES + 1][MBUFF_SIZE];
static rte_graph_t graph_id;
@@ -162,9 +167,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node0);
for (i = 0; i < obj_node0; i++) {
data = &mbuf[0][i];
- data->udata64 = ((uint64_t)tm->test_node[0].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[0].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][i];
}
rte_node_next_stream_put(graph, node, next, obj_node0);
@@ -175,9 +180,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node1);
for (i = 0; i < obj_node1; i++) {
data = &mbuf[0][obj_node0 + i];
- data->udata64 = ((uint64_t)tm->test_node[1].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][obj_node0 + i];
}
@@ -205,23 +210,23 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[0].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[0].idx) {
printf("Data idx miss match at node 0, expected"
" = %u got = %u\n",
tm->test_node[0].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at "
"node 0\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -233,12 +238,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * obj_node0 * 0.01;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[1][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[1][0],
obj_node0);
@@ -246,12 +251,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node1 = nb_objs - obj_node0;
for (i = 0; i < obj_node1; i++) {
data = &mbuf[1][obj_node0 + i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 1, (void **)&mbuf_p[1][obj_node0],
obj_node1);
@@ -285,22 +290,22 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[2] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[1].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[1].idx) {
printf("Data idx miss match at node 1, expected = %u"
" got = %u\n",
tm->test_node[1].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 1\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -312,11 +317,11 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[2][i];
- data->udata64 = ((uint64_t)tm->test_node[2].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[2][0], obj_node0);
@@ -339,22 +344,22 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[3] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[2].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[2].idx) {
printf("Data idx miss match at node 2, expected = %u"
" got = %u\n",
tm->test_node[2].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 2\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -367,10 +372,10 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[3][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[3].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[3][0],
obj_node0);
@@ -395,22 +400,22 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[4] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[3].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[3].idx) {
printf("Data idx miss match at node 3, expected = %u"
" got = %u\n",
tm->test_node[3].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 3\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -426,11 +431,11 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * 2;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[4][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[0].idx << 32) | i;
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[4][0],
obj_node0);
@@ -765,6 +770,18 @@ graph_setup(void)
{
int i, j;
+ static const struct rte_mbuf_dynfield graph_dynfield_desc = {
+ .name = "test_graph_dynfield",
+ .size = sizeof(uint64_t),
+ .align = __alignof__(uint64_t),
+ };
+ graph_dynfield_offset =
+ rte_mbuf_dynfield_register(&graph_dynfield_desc);
+ if (graph_dynfield_offset < 0) {
+ printf("Cannot register mbuf field\n");
+ return TEST_FAILED;
+ }
+
for (i = 0; i <= MAX_NODES; i++) {
for (j = 0; j < MBUFF_SIZE; j++)
mbuf_p[i][j] = &mbuf[i][j];
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (10 preceding siblings ...)
2020-10-26 5:21 ` [dpdk-dev] [PATCH 11/15] test/graph: switch user data " Thomas Monjalon
@ 2020-10-26 5:21 ` Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 13/15] examples/bbdev: switch " Thomas Monjalon
` (7 subsequent siblings)
19 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:21 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob
The order test stored the flow ID in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-eventdev/test_order_atq.c | 4 ++--
app/test-eventdev/test_order_common.c | 16 +++++++++++++++-
app/test-eventdev/test_order_common.h | 5 +++++
app/test-eventdev/test_order_queue.c | 4 ++--
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c
index cfcb1dc4e9..4087c26fc5 100644
--- a/app/test-eventdev/test_order_atq.c
+++ b/app/test-eventdev/test_order_atq.c
@@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ ev.flow_id = FLOW_ID(ev.mbuf);
if (ev.sub_event_type == 0) { /* stage 0 from producer */
order_atq_process_stage_0(&ev);
@@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ ev[i].flow_id = FLOW_ID(ev[i].mbuf);
if (ev[i].sub_event_type == 0) { /*stage 0 */
order_atq_process_stage_0(&ev[i]);
diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
index dc55d93921..fc82e3ff41 100644
--- a/app/test-eventdev/test_order_common.c
+++ b/app/test-eventdev/test_order_common.c
@@ -4,6 +4,8 @@
#include "test_order_common.h"
+int flow_id_dynfield_offset;
+
int
order_test_result(struct evt_test *test, struct evt_options *opt)
{
@@ -49,7 +51,7 @@ order_producer(void *arg)
const uint32_t flow = (uintptr_t)m % nb_flows;
/* Maintain seq number per flow */
m->seqn = producer_flow_seq[flow]++;
- m->udata64 = flow;
+ FLOW_ID(m) = flow;
ev.flow_id = flow;
ev.mbuf = m;
@@ -139,6 +141,18 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
{
void *test_order;
+ static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
+ .name = "test_event_dynfield_flow_id",
+ .size = sizeof(uint32_t),
+ .align = __alignof__(uint32_t),
+ };
+ flow_id_dynfield_offset =
+ rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
+ if (flow_id_dynfield_offset < 0) {
+ evt_err("failed to register mbuf field");
+ return -rte_errno;
+ }
+
test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
RTE_CACHE_LINE_SIZE, opt->socket_id);
if (test_order == NULL) {
diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index e0fe9c968a..13bf791564 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -13,6 +13,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include "evt_common.h"
#include "evt_options.h"
@@ -20,6 +21,10 @@
#define BURST_SIZE 16
+extern int flow_id_dynfield_offset;
+#define FLOW_ID(mbuf) \
+ (*RTE_MBUF_DYNFIELD(mbuf, flow_id_dynfield_offset, uint32_t *))
+
struct test_order;
struct worker_data {
diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c
index 1511c0092d..80c9c24af5 100644
--- a/app/test-eventdev/test_order_queue.c
+++ b/app/test-eventdev/test_order_queue.c
@@ -35,7 +35,7 @@ order_queue_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ ev.flow_id = FLOW_ID(ev.mbuf);
if (ev.queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev);
@@ -73,7 +73,7 @@ order_queue_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ ev[i].flow_id = FLOW_ID(ev[i].mbuf);
if (ev[i].queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev[i]);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (11 preceding siblings ...)
2020-10-26 5:21 ` [dpdk-dev] [PATCH 12/15] app/eventdev: switch flow ID " Thomas Monjalon
@ 2020-10-26 5:21 ` Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: " Thomas Monjalon
` (6 subsequent siblings)
19 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:21 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru
The example used the deprecated mbuf field udata64 as input mbuf pointer.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/bbdev_app/main.c | 37 +++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index e512c807cd..7a06f9c7d6 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -28,6 +28,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_log.h>
@@ -59,6 +60,10 @@
} \
} while (0)
+static int input_dynfield_offset;
+#define INPUT_FIELD(mbuf) \
+ (*RTE_MBUF_DYNFIELD(mbuf, input_dynfield_offset, struct rte_mbuf **))
+
static const struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_NONE,
@@ -294,11 +299,11 @@ pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
}
static inline void
-pktmbuf_userdata_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
+pktmbuf_input_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
{
unsigned int i;
for (i = 0; i < nb_to_free; ++i) {
- struct rte_mbuf *rx_pkt = mbufs[i]->userdata;
+ struct rte_mbuf *rx_pkt = INPUT_FIELD(mbufs[i]);
rte_pktmbuf_free(rx_pkt);
rte_pktmbuf_free(mbufs[i]);
}
@@ -429,7 +434,7 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts)
uint16_t i;
for (i = 0; i < num_pkts; ++i) {
struct rte_mbuf *out = mbufs[i];
- struct rte_mbuf *in = out->userdata;
+ struct rte_mbuf *in = INPUT_FIELD(out);
if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *,
sizeof(struct rte_ether_hdr)),
@@ -731,7 +736,7 @@ run_encoding(struct lcore_conf *lcore_conf)
rte_pktmbuf_data_len(rx_pkts_burst[i]) -
sizeof(struct rte_ether_hdr);
/* save input mbuf pointer for later comparison */
- enc_out_pkts[i]->userdata = rx_pkts_burst[i];
+ INPUT_FIELD(enc_out_pkts[i]) = rx_pkts_burst[i];
/* copy ethernet header */
rte_pktmbuf_reset(enc_out_pkts[i]);
@@ -775,7 +780,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_enc_ops(bbdev_id, enc_queue_id,
bbdev_ops_burst, nb_rx);
if (unlikely(nb_enq < nb_rx)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_enq],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_enq],
nb_rx - nb_enq);
rte_bbdev_enc_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_rx - nb_enq);
@@ -805,7 +810,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_sent = rte_ring_enqueue_burst(enc_to_dec_ring, (void **)enc_out_pkts,
nb_deq, NULL);
if (unlikely(nb_sent < nb_deq)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_sent],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_sent],
nb_deq - nb_sent);
lcore_stats->enc_to_dec_lost_packets += nb_deq - nb_sent;
}
@@ -842,7 +847,7 @@ run_decoding(struct lcore_conf *lcore_conf)
if (unlikely(rte_bbdev_dec_op_alloc_bulk(bbdev_op_pool, bbdev_ops_burst,
nb_recv) != 0)) {
- pktmbuf_userdata_free_bulk(recv_pkts_burst, nb_recv);
+ pktmbuf_input_free_bulk(recv_pkts_burst, nb_recv);
lcore_stats->rx_lost_packets += nb_recv;
return;
}
@@ -871,7 +876,7 @@ run_decoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_dec_ops(bbdev_id, bbdev_queue_id,
bbdev_ops_burst, nb_recv);
if (unlikely(nb_enq < nb_recv)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_enq],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_enq],
nb_recv - nb_enq);
rte_bbdev_dec_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_recv - nb_enq);
@@ -898,12 +903,12 @@ run_decoding(struct lcore_conf *lcore_conf)
/* Free the RX mbufs after verification */
for (i = 0; i < nb_deq; ++i)
- rte_pktmbuf_free(recv_pkts_burst[i]->userdata);
+ rte_pktmbuf_free(INPUT_FIELD(recv_pkts_burst[i]));
/* Transmit the packets */
nb_tx = rte_eth_tx_burst(port_id, tx_queue_id, recv_pkts_burst, nb_deq);
if (unlikely(nb_tx < nb_deq)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_tx],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_tx],
nb_deq - nb_tx);
lcore_stats->tx_lost_packets += nb_deq - nb_tx;
}
@@ -1046,6 +1051,12 @@ main(int argc, char **argv)
bool stats_thread_started = false;
unsigned int main_lcore_id = rte_get_main_lcore();
+ static const struct rte_mbuf_dynfield input_dynfield_desc = {
+ .name = "example_bbdev_dynfield_input",
+ .size = sizeof(void *),
+ .align = __alignof__(void *),
+ };
+
rte_atomic16_init(&global_exit_flag);
sigret = signal(SIGTERM, signal_handler);
@@ -1115,6 +1126,12 @@ main(int argc, char **argv)
if (bbdev_mbuf_mempool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create ethdev mbuf mempool\n");
+ /* register mbuf field to store input pointer */
+ input_dynfield_offset =
+ rte_mbuf_dynfield_register(&input_dynfield_desc);
+ if (input_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize ports */
ret = initialize_ports(&app_params, ethdev_mbuf_mempool);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (12 preceding siblings ...)
2020-10-26 5:21 ` [dpdk-dev] [PATCH 13/15] examples/bbdev: switch " Thomas Monjalon
@ 2020-10-26 5:21 ` Thomas Monjalon
2020-10-26 10:43 ` David Marchand
2020-10-26 5:21 ` [dpdk-dev] [PATCH 15/15] mbuf: remove userdata field Thomas Monjalon
` (5 subsequent siblings)
19 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:21 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, John McNamara
The example used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Note: RTE_MBUF_DYNFIELD_TIMESTAMP_NAME is an existing mbuf field name.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 ++--
examples/rxtx_callbacks/main.c | 19 +++++++++++++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 62d1f39d7e..8c3b49ae62 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -152,7 +152,7 @@ all packets received:
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TIMESTAMP_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -179,7 +179,7 @@ packets prior to transmission:
unsigned i;
for (i = 0; i < nb_pkts; i++)
- cycles += now - pkts[i]->udata64;
+ cycles += now - TIMESTAMP_FIELD(pkts[i]);
latency_numbers.total_cycles += cycles;
latency_numbers.total_pkts += nb_pkts;
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 6fe39546dd..8f9852bf6f 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -10,6 +10,7 @@
#include <rte_cycles.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#define RX_RING_SIZE 1024
#define TX_RING_SIZE 1024
@@ -18,6 +19,10 @@
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
+static int timestamp_dynfield_offset;
+#define TIMESTAMP_FIELD(mbuf) \
+ (*RTE_MBUF_DYNFIELD(mbuf, timestamp_dynfield_offset, uint64_t *))
+
static const char usage[] =
"%s EAL_ARGS -- [-t]\n";
@@ -47,7 +52,7 @@ add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TIMESTAMP_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -65,7 +70,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused,
rte_eth_read_clock(port, &ticks);
for (i = 0; i < nb_pkts; i++) {
- cycles += now - pkts[i]->udata64;
+ cycles += now - TIMESTAMP_FIELD(pkts[i]);
if (hw_timestamping)
queue_ticks += ticks - pkts[i]->timestamp;
}
@@ -261,6 +266,11 @@ main(int argc, char *argv[])
};
int opt, option_index;
+ static const struct rte_mbuf_dynfield timestamp_dynfield_desc = {
+ .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME,
+ .size = sizeof(uint64_t),
+ .align = __alignof__(uint64_t),
+ };
/* init EAL */
int ret = rte_eal_init(argc, argv);
@@ -292,6 +302,11 @@ main(int argc, char *argv[])
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
+ timestamp_dynfield_offset =
+ rte_mbuf_dynfield_register(×tamp_dynfield_desc);
+ if (timestamp_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize all ports */
RTE_ETH_FOREACH_DEV(portid)
if (port_init(portid, mbuf_pool) != 0)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH 15/15] mbuf: remove userdata field
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (13 preceding siblings ...)
2020-10-26 5:21 ` [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: " Thomas Monjalon
@ 2020-10-26 5:21 ` Thomas Monjalon
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (4 subsequent siblings)
19 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 5:21 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ray Kinsella, Neil Horman
As announced in the deprecation note, the field userdata / udata64
is removed to give more space to the dynamic fields.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +++
lib/librte_kni/rte_kni_common.h | 3 +--
lib/librte_mbuf/rte_mbuf_core.h | 8 +-------
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 2e082499b8..0f6f1df12a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,7 +87,6 @@ Deprecation Notices
The following static fields will be moved as dynamic:
- ``timestamp``
- - ``userdata`` / ``udata64``
- ``seqn``
As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index d8ac359e51..3cec526b6a 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -426,6 +426,9 @@ API Changes
the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
The field ``refcnt`` is remaining from the old unions.
+* mbuf: Removed the unioned fields ``userdata`` and ``udata64``
+ from the structure ``rte_mbuf``. It is replaced with dynamic fields.
+
* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
replaced with a private enum in the PCI subsystem.
diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
index 21b477f0aa..0db45e6a24 100644
--- a/lib/librte_kni/rte_kni_common.h
+++ b/lib/librte_kni/rte_kni_common.h
@@ -86,8 +86,7 @@ struct rte_kni_mbuf {
uint16_t data_len; /**< Amount of data in segment buffer. */
/* fields on second cache line */
- char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
- void *pool;
+ void *pool __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
void *next; /**< Physical address of next mbuf in kernel. */
};
diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index 065d87d28a..a65eaaf692 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -599,12 +599,6 @@ struct rte_mbuf {
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
- RTE_STD_C11
- union {
- void *userdata; /**< Can be used for external metadata */
- uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
- };
-
struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
struct rte_mbuf *next; /**< Next segment of scattered packet. */
@@ -662,7 +656,7 @@ struct rte_mbuf {
*/
struct rte_mbuf_ext_shared_info *shinfo;
- uint64_t dynfield1[2]; /**< Reserved for dynamic fields. */
+ uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */
} __rte_cache_aligned;
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 10/15] test/distributor: switch sequence to dynamic mbuf field
2020-10-26 5:21 ` [dpdk-dev] [PATCH 10/15] test/distributor: switch sequence " Thomas Monjalon
@ 2020-10-26 9:39 ` Lukasz Wojciechowski
0 siblings, 0 replies; 178+ messages in thread
From: Lukasz Wojciechowski @ 2020-10-26 9:39 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, David Hunt
Changes in distributor tests look good.
All tests pass
W dniu 26.10.2020 o 06:21, Thomas Monjalon pisze:
> The test used the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
> ---
> app/test/test_distributor.c | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
> index eb889b91d1..074a06f4a2 100644
> --- a/app/test/test_distributor.c
> +++ b/app/test/test_distributor.c
> @@ -10,6 +10,7 @@
> #include <rte_errno.h>
> #include <rte_mempool.h>
> #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
> #include <rte_distributor.h>
> #include <rte_string_fns.h>
>
> @@ -17,6 +18,10 @@
> #define BURST 32
> #define BIG_BATCH 1024
>
> +static int seq_dynfield_offset;
> +#define SEQ_FIELD(mbuf) \
> + (*RTE_MBUF_DYNFIELD(mbuf, seq_dynfield_offset, uint32_t *))
> +
> struct worker_params {
> char name[64];
> struct rte_distributor *dist;
> @@ -578,7 +583,7 @@ handle_and_mark_work(void *arg)
> __atomic_fetch_add(&worker_stats[id].handled_packets, num,
> __ATOMIC_RELAXED);
> for (i = 0; i < num; i++)
> - buf[i]->udata64 += id + 1;
> + SEQ_FIELD(buf[i]) += id + 1;
> num = rte_distributor_get_pkt(db, id,
> buf, buf, num);
> }
> @@ -631,10 +636,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
> << shift;
> }
> /* Assign a sequence number to each packet. The sequence is shifted,
> - * so that lower bits of the udate64 will hold mark from worker.
> + * so that lower bits will hold mark from worker.
> */
> for (i = 0; i < buf_count; i++)
> - bufs[i]->udata64 = i << seq_shift;
> + SEQ_FIELD(bufs[i]) = i << seq_shift;
>
> count = 0;
> for (i = 0; i < buf_count/burst; i++) {
> @@ -660,8 +665,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
>
> /* Sort returned packets by sent order (sequence numbers). */
> for (i = 0; i < buf_count; i++) {
> - seq = returns[i]->udata64 >> seq_shift;
> - id = returns[i]->udata64 - (seq << seq_shift);
> + seq = SEQ_FIELD(returns[i]) >> seq_shift;
> + id = SEQ_FIELD(returns[i]) - (seq << seq_shift);
> sorted[seq] = id;
> }
>
> @@ -805,6 +810,18 @@ test_distributor(void)
> static struct rte_mempool *p;
> int i;
>
> + static const struct rte_mbuf_dynfield seq_dynfield_desc = {
> + .name = "test_distributor_dynfield_seq",
> + .size = sizeof(uint32_t),
> + .align = __alignof__(uint32_t),
> + };
> + seq_dynfield_offset =
> + rte_mbuf_dynfield_register(&seq_dynfield_desc);
> + if (seq_dynfield_offset < 0) {
> + printf("Error registering mbuf field\n");
> + return TEST_FAILED;
> + }
> +
> if (rte_lcore_count() < 2) {
> printf("Not enough cores for distributor_autotest, expecting at least 2\n");
> return TEST_SKIPPED;
--
Lukasz Wojciechowski
Principal Software Engineer
Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 5:20 ` [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
@ 2020-10-26 10:40 ` David Marchand
2020-10-26 14:29 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: David Marchand @ 2020-10-26 10:40 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, Nithin Dabilpuram,
Pavan Nikhilesh
On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> lib/librte_node/ip4_lookup.c | 7 +++++++
> lib/librte_node/ip4_rewrite.c | 10 ++++++++++
> lib/librte_node/node_private.h | 12 ++++++++++--
> 3 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
> index 8835aab9dd..2cc91c0c67 100644
> --- a/lib/librte_node/ip4_lookup.c
> +++ b/lib/librte_node/ip4_lookup.c
> @@ -21,6 +21,8 @@
>
> #include "node_private.h"
>
> +int node_mbuf_priv1_dynfield_offset;
> +
> #define IPV4_L3FWD_LPM_MAX_RULES 1024
> #define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)
>
> @@ -178,6 +180,11 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
> RTE_SET_USED(node);
>
> if (!init_once) {
> + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
> + &node_mbuf_priv1_dynfield_desc);
> + if (node_mbuf_priv1_dynfield_offset < 0)
> + return -1;
How about return -rte_errno like what is done in setup_lpm()?
> +
> /* Setup LPM tables for all sockets */
> RTE_LCORE_FOREACH(lcore_id)
> {
[snip]
> diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
> index ab7941c12b..bafea3704d 100644
> --- a/lib/librte_node/node_private.h
> +++ b/lib/librte_node/node_private.h
> @@ -8,6 +8,7 @@
> #include <rte_common.h>
> #include <rte_log.h>
> #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
>
> extern int rte_node_logtype;
> #define NODE_LOG(level, node_name, ...) \
> @@ -21,7 +22,6 @@ extern int rte_node_logtype;
> #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
>
> /**
> - *
> * Node mbuf private data to store next hop, ttl and checksum.
> */
> struct node_mbuf_priv1 {
> @@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
> };
> };
>
> +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
> + .name = "rte_node_dynfield_priv1",
> + .size = sizeof(uint64_t),
> + .align = __alignof__(uint64_t),
s/uint64_t/struct node_mbuf_priv1/g ?
> +};
> +extern int node_mbuf_priv1_dynfield_offset;
> +
> /**
> * Node mbuf private area 2.
> */
--
David Marchand
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 5:20 ` [dpdk-dev] [PATCH 05/15] security: switch " Thomas Monjalon
@ 2020-10-26 10:41 ` David Marchand
2020-10-26 14:30 ` Thomas Monjalon
2020-10-26 17:58 ` Akhil Goyal
2020-10-26 15:06 ` Andrew Rybchenko
1 sibling, 2 replies; 178+ messages in thread
From: David Marchand @ 2020-10-26 10:41 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
> index 1b561f8528..ba9691b4a0 100644
> --- a/lib/librte_security/rte_security_driver.h
> +++ b/lib/librte_security/rte_security_driver.h
> @@ -17,6 +17,8 @@
> extern "C" {
> #endif
>
> +#include <rte_mbuf_dyn.h>
> +
> #include "rte_security.h"
>
> /**
> @@ -89,6 +91,24 @@ typedef int (*security_session_stats_get_t)(void *device,
> struct rte_security_session *sess,
> struct rte_security_stats *stats);
>
> +/* Dynamic mbuf field for device-specific metadata */
> +static const struct rte_mbuf_dynfield rte_security_dynfield_desc = {
> + .name = RTE_SECURITY_DYNFIELD_NAME,
> + .size = sizeof(RTE_SECURITY_DYNFIELD_TYPE),
> + .align = __alignof__(RTE_SECURITY_DYNFIELD_TYPE),
> +};
Should be in rte_security.c?
> +extern int rte_security_dynfield_offset;
> +
> +__rte_experimental
> +int rte_security_dynfield_register(void);
> +
> +static inline RTE_SECURITY_DYNFIELD_TYPE *
> +rte_security_dynfield(struct rte_mbuf *mbuf)
> +{
> + return RTE_MBUF_DYNFIELD(mbuf,
> + rte_security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
> +}
> +
--
David Marchand
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-26 5:20 ` [dpdk-dev] [PATCH 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
@ 2020-10-26 10:42 ` David Marchand
2020-10-26 14:32 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: David Marchand @ 2020-10-26 10:42 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, Ajit Khaparde, Somnath Kotur
On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The CFA code from mark was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
We convert from a 64 bits (with only upper 32 bits filled) to a 32 bits field.
Worth a comment on the API change for users (if any).
--
David Marchand
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-26 5:21 ` [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: " Thomas Monjalon
@ 2020-10-26 10:43 ` David Marchand
2020-10-26 14:33 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: David Marchand @ 2020-10-26 10:43 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, John McNamara
On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The example used the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Note: RTE_MBUF_DYNFIELD_TIMESTAMP_NAME is an existing mbuf field name.
I am a bit lost.
How is this going to work as the mbuf timestamp field is used in this
example too?
--
David Marchand
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets
2020-10-26 5:20 ` [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
@ 2020-10-26 14:23 ` Andrew Rybchenko
2020-10-27 11:32 ` Bruce Richardson
1 sibling, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 14:23 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, Nicolas Chautru, Chas Williams, Min Hu (Connor),
Xiaoyun Li
On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> In examples, DPDK header files are external,
> so they must be enclosed with angle brackets, not quotes.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 02/15] kni: move header file from EAL
2020-10-26 5:20 ` [dpdk-dev] [PATCH 02/15] kni: move header file from EAL Thomas Monjalon
@ 2020-10-26 14:25 ` Andrew Rybchenko
2020-10-27 11:33 ` Bruce Richardson
1 sibling, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 14:25 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal
On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> Since the kernel module is not part of EAL anymore,
> there is no need to have the common KNI header file in EAL.
> The file rte_kni_common.h is moved to librte_kni.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] mbuf: fix typo in dynamic field convention note
2020-10-26 5:20 ` [dpdk-dev] [PATCH 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
@ 2020-10-26 14:26 ` Andrew Rybchenko
0 siblings, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 14:26 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, stable, Konstantin Ananyev
On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> Replace "in a in PMD" with "in a PMD".
>
> Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
> Cc: stable@dpdk.org
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 10:40 ` David Marchand
@ 2020-10-26 14:29 ` Thomas Monjalon
2020-10-26 14:34 ` Andrew Rybchenko
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 14:29 UTC (permalink / raw)
To: David Marchand
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, Nithin Dabilpuram,
Pavan Nikhilesh
26/10/2020 11:40, David Marchand:
> On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
> > + &node_mbuf_priv1_dynfield_desc);
> > + if (node_mbuf_priv1_dynfield_offset < 0)
> > + return -1;
>
> How about return -rte_errno like what is done in setup_lpm()?
Yes, looks better
[...]
> > +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
> > + .name = "rte_node_dynfield_priv1",
> > + .size = sizeof(uint64_t),
> > + .align = __alignof__(uint64_t),
>
> s/uint64_t/struct node_mbuf_priv1/g ?
Yes will do
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 10:41 ` David Marchand
@ 2020-10-26 14:30 ` Thomas Monjalon
2020-10-26 17:58 ` Akhil Goyal
1 sibling, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 14:30 UTC (permalink / raw)
To: David Marchand
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella
26/10/2020 11:41, David Marchand:
> On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > +/* Dynamic mbuf field for device-specific metadata */
> > +static const struct rte_mbuf_dynfield rte_security_dynfield_desc = {
> > + .name = RTE_SECURITY_DYNFIELD_NAME,
> > + .size = sizeof(RTE_SECURITY_DYNFIELD_TYPE),
> > + .align = __alignof__(RTE_SECURITY_DYNFIELD_TYPE),
> > +};
>
> Should be in rte_security.c?
Yes,
and the inline function below can be a simple macro.
> > +extern int rte_security_dynfield_offset;
> > +
> > +__rte_experimental
> > +int rte_security_dynfield_register(void);
> > +
> > +static inline RTE_SECURITY_DYNFIELD_TYPE *
> > +rte_security_dynfield(struct rte_mbuf *mbuf)
> > +{
> > + return RTE_MBUF_DYNFIELD(mbuf,
> > + rte_security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
> > +}
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-26 10:42 ` David Marchand
@ 2020-10-26 14:32 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 14:32 UTC (permalink / raw)
To: David Marchand
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, Ajit Khaparde, Somnath Kotur
26/10/2020 11:42, David Marchand:
> On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > The CFA code from mark was stored in the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
>
> We convert from a 64 bits (with only upper 32 bits filled) to a 32 bits field.
> Worth a comment on the API change for users (if any).
Yes
There is no good place to note this change except in the commit log.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-26 10:43 ` David Marchand
@ 2020-10-26 14:33 ` Thomas Monjalon
2020-10-26 14:53 ` Stephen Hemminger
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 14:33 UTC (permalink / raw)
To: David Marchand
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Akhil Goyal, John McNamara
26/10/2020 11:43, David Marchand:
> On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > The example used the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Note: RTE_MBUF_DYNFIELD_TIMESTAMP_NAME is an existing mbuf field name.
>
> I am a bit lost.
> How is this going to work as the mbuf timestamp field is used in this
> example too?
Oh, you're right!
I will change the naming scheme to a custom "TSC" field.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 14:29 ` Thomas Monjalon
@ 2020-10-26 14:34 ` Andrew Rybchenko
2020-10-26 14:39 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 14:34 UTC (permalink / raw)
To: Thomas Monjalon, David Marchand
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz, Akhil Goyal,
Nithin Dabilpuram, Pavan Nikhilesh
On 10/26/20 5:29 PM, Thomas Monjalon wrote:
> 26/10/2020 11:40, David Marchand:
>> On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>>> + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
>>> + &node_mbuf_priv1_dynfield_desc);
>>> + if (node_mbuf_priv1_dynfield_offset < 0)
>>> + return -1;
>>
>> How about return -rte_errno like what is done in setup_lpm()?
>
> Yes, looks better
>
> [...]
>>> +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
>>> + .name = "rte_node_dynfield_priv1",
>>> + .size = sizeof(uint64_t),
>>> + .align = __alignof__(uint64_t),
>>
>> s/uint64_t/struct node_mbuf_priv1/g ?
>
> Yes will do
>
Just to be sure - "struct node_mbuf_priv1 *"
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 14:34 ` Andrew Rybchenko
@ 2020-10-26 14:39 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 14:39 UTC (permalink / raw)
To: David Marchand, Andrew Rybchenko
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz, Akhil Goyal,
Nithin Dabilpuram, Pavan Nikhilesh
26/10/2020 15:34, Andrew Rybchenko:
> On 10/26/20 5:29 PM, Thomas Monjalon wrote:
> > 26/10/2020 11:40, David Marchand:
> >> On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> >>> + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
> >>> + &node_mbuf_priv1_dynfield_desc);
> >>> + if (node_mbuf_priv1_dynfield_offset < 0)
> >>> + return -1;
> >>
> >> How about return -rte_errno like what is done in setup_lpm()?
> >
> > Yes, looks better
> >
> > [...]
> >>> +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
> >>> + .name = "rte_node_dynfield_priv1",
> >>> + .size = sizeof(uint64_t),
> >>> + .align = __alignof__(uint64_t),
> >>
> >> s/uint64_t/struct node_mbuf_priv1/g ?
> >
> > Yes will do
> >
>
> Just to be sure - "struct node_mbuf_priv1 *"
Yes, pointer to node_mbuf_priv1.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-26 14:33 ` Thomas Monjalon
@ 2020-10-26 14:53 ` Stephen Hemminger
2020-10-26 16:32 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Stephen Hemminger @ 2020-10-26 14:53 UTC (permalink / raw)
To: Thomas Monjalon
Cc: David Marchand, dev, Yigit, Ferruh, Bruce Richardson,
Olivier Matz, Andrew Rybchenko, Akhil Goyal, John McNamara
On Mon, 26 Oct 2020 15:33:14 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:
> 26/10/2020 11:43, David Marchand:
> > On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > >
> > > The example used the deprecated mbuf field udata64.
> > > It is moved to a dynamic field in order to allow removal of udata64.
> > >
> > > Note: RTE_MBUF_DYNFIELD_TIMESTAMP_NAME is an existing mbuf field name.
> >
> > I am a bit lost.
> > How is this going to work as the mbuf timestamp field is used in this
> > example too?
>
> Oh, you're right!
> I will change the naming scheme to a custom "TSC" field.
>
>
Since timestamp is still there why doesn't the example just use that?
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 5:20 ` [dpdk-dev] [PATCH 05/15] security: switch " Thomas Monjalon
2020-10-26 10:41 ` David Marchand
@ 2020-10-26 15:06 ` Andrew Rybchenko
2020-10-26 16:49 ` Thomas Monjalon
1 sibling, 1 reply; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 15:06 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, Declan Doherty, Ankur Dwivedi, Anoob Joseph,
Jeff Guo, Haiyue Wang, Jerin Jacob, Nithin Dabilpuram,
Kiran Kumar K, Radu Nicolau, Ray Kinsella, Neil Horman
On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> The device-specific metadata was stored in the deprecated field udata64.
> It is moved to a dynamic mbuf field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
[snip]
> diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c
> index 48f5082d49..0232db20ed 100644
> --- a/drivers/net/ixgbe/ixgbe_ipsec.c
> +++ b/drivers/net/ixgbe/ixgbe_ipsec.c
> @@ -484,7 +484,8 @@ ixgbe_crypto_update_mb(void *device __rte_unused,
> get_sec_session_private_data(session);
> if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) {
> union ixgbe_crypto_tx_desc_md *mdata =
> - (union ixgbe_crypto_tx_desc_md *)&m->udata64;
> + (union ixgbe_crypto_tx_desc_md *)
> + rte_security_dynfield(m);
IMHO alignment looks a bit confusing here, may be add one more
TAB?
> mdata->enc = 1;
> mdata->sa_idx = ic_session->sa_index;
> mdata->pad_len = ixgbe_crypto_compute_pad_len(m);
> @@ -751,5 +752,7 @@ ixgbe_ipsec_ctx_create(struct rte_eth_dev *dev)
> return -ENOMEM;
> }
> }
> + if (rte_security_dynfield_register() < 0)
> + return -rte_errno;
> return 0;
> }
[snip]
> diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
> index b6c851f257..72f698893d 100644
> --- a/examples/ipsec-secgw/ipsec_worker.c
> +++ b/examples/ipsec-secgw/ipsec_worker.c
> @@ -208,7 +208,8 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
> "Inbound security offload failed\n");
> goto drop_pkt_and_exit;
> }
> - sa = pkt->userdata;
> + sa = RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
> + struct ipsec_sa *);
I think it should be de-reference above, i.e.
sa = (struct ipsec_sa *)*RTE_MBUF_DYNFIELD(pkt,
security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
or just
sa = *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset, struct ipsec_sa **);
and why not rte_security_dynfield()?
It all looks very fragile. May be at least add
RTE_BUILD_BUG_ON(sizeof(RTE_SECURITY_DYNFIELD_TYPE) ==
sizeof(ipsec_sa *));
and similar checks when an application or a library does
lookup for a dynamic field.
In general since lookup should not happen on data path,
may be lookup should return size of the field which must
be checked by the caller for consistency.
> }
>
> /* Check if we have a match */
> @@ -226,7 +227,8 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
> "Inbound security offload failed\n");
> goto drop_pkt_and_exit;
> }
> - sa = pkt->userdata;
> + sa = RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
> + struct ipsec_sa *);
same
> }
>
> /* Check if we have a match */
> @@ -357,7 +359,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
> }
>
> if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
> - pkt->userdata = sess->security.ses;
> + *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
> + struct rte_security_session **) = sess->security.ses;
rte_security_dynfield() ?
Is it really different types of value in one example
application? It looks like it should be different
dynamic fields. Otherwise, I don't understand how
to work with it.
In fact may be above is out of scope of the patch series...
>
> /* Mark the packet for Tx security offload */
> pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
> @@ -465,7 +468,9 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
> }
>
> /* Save security session */
> - pkt->userdata = sess_tbl[port_id];
> + *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
> + struct rte_security_session **) =
> + sess_tbl[port_id];
rte_security_dynfield() ?
>
> /* Mark the packet for Tx security offload */
> pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
[snip]
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-26 5:20 ` [dpdk-dev] [PATCH 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-26 15:09 ` Andrew Rybchenko
0 siblings, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 15:09 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, Harry van Haaren
On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> The test worker_loopback used the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-26 5:20 ` [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
@ 2020-10-26 15:14 ` Andrew Rybchenko
2020-10-26 15:21 ` Andrew Rybchenko
0 siblings, 1 reply; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 15:14 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, Yong Wang
On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> The segment count, used for MSS guess,
> was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
> drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 ++
> drivers/net/vmxnet3/vmxnet3_rxtx.c | 10 ++++++----
> 3 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> index 6920ab568c..eeb1152b61 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> @@ -59,6 +59,8 @@
> DEV_RX_OFFLOAD_JUMBO_FRAME | \
> DEV_RX_OFFLOAD_RSS_HASH)
>
> +int vmxnet3_segs_dynfield_offset;
> +
> static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
> static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
> static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
> @@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
> struct vmxnet3_hw *hw = eth_dev->data->dev_private;
> uint32_t mac_hi, mac_lo, ver;
> struct rte_eth_link link;
> + static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
> + .name = "rte_net_vmxnet3_dynfield_segs",
> + .size = sizeof(uint8_t),
> + .align = __alignof__(uint8_t),
> + };
>
> PMD_INIT_FUNC_TRACE();
>
> @@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
> eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
> pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
>
> + /* extra mbuf field is required to guess MSS */
> + vmxnet3_segs_dynfield_offset =
> + rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
> + if (vmxnet3_segs_dynfield_offset < 0) {
> + PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
> + return -rte_errno;
> + }
> +
> /*
> * for secondary processes, we don't initialize any further as primary
> * has already done this work.
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
> index dd685b02b7..5730e94d50 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
> @@ -193,4 +193,6 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> uint16_t nb_pkts);
>
> +extern int vmxnet3_segs_dynfield_offset;
> +
> #endif /* _VMXNET3_ETHDEV_H_ */
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index e10f9ee870..6655622f94 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
> struct rte_ipv6_hdr *ipv6_hdr;
> struct rte_tcp_hdr *tcp_hdr;
> char *ptr;
> + uint8_t segs;
>
> RTE_ASSERT(rcd->tcp);
>
> @@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
> tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
> hlen += (tcp_hdr->data_off & 0xf0) >> 2;
>
> - if (rxm->udata64 > 1)
> - return (rte_pktmbuf_pkt_len(rxm) - hlen +
> - rxm->udata64 - 1) / rxm->udata64;
> + segs = *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset, uint8_t *);
> + if (segs > 1)
> + return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
> else
> return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
> }
> @@ -737,7 +738,8 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
> (const Vmxnet3_RxCompDescExt *)rcd;
>
> rxm->tso_segsz = rcde->mss;
> - rxm->udata64 = rcde->segCnt;
> + *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset,
> + uint8_t *) = rcde->segCnt;
> ol_flags |= PKT_RX_LRO;
> }
> } else { /* Offloads set in eop */
>
I think it should be a rule of thumb to introduce helper
macro to access a dynamic field (as you do in few of
previous patches).
It should be just nearby declaration of the the offset
variable.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-26 15:14 ` Andrew Rybchenko
@ 2020-10-26 15:21 ` Andrew Rybchenko
2020-10-26 16:50 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-26 15:21 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, Yong Wang
On 10/26/20 6:14 PM, Andrew Rybchenko wrote:
> On 10/26/20 8:20 AM, Thomas Monjalon wrote:
>> The segment count, used for MSS guess,
>> was stored in the deprecated mbuf field udata64.
>> It is moved to a dynamic field in order to allow removal of udata64.
>>
>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>> ---
>> drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
>> drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 ++
>> drivers/net/vmxnet3/vmxnet3_rxtx.c | 10 ++++++----
>> 3 files changed, 23 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>> index 6920ab568c..eeb1152b61 100644
>> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
>> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>> @@ -59,6 +59,8 @@
>> DEV_RX_OFFLOAD_JUMBO_FRAME | \
>> DEV_RX_OFFLOAD_RSS_HASH)
>>
>> +int vmxnet3_segs_dynfield_offset;
>> +
>> static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
>> static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
>> static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
>> @@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
>> struct vmxnet3_hw *hw = eth_dev->data->dev_private;
>> uint32_t mac_hi, mac_lo, ver;
>> struct rte_eth_link link;
>> + static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
>> + .name = "rte_net_vmxnet3_dynfield_segs",
>> + .size = sizeof(uint8_t),
>> + .align = __alignof__(uint8_t),
>> + };
>>
>> PMD_INIT_FUNC_TRACE();
>>
>> @@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
>> eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
>> pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
>>
>> + /* extra mbuf field is required to guess MSS */
>> + vmxnet3_segs_dynfield_offset =
>> + rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
>> + if (vmxnet3_segs_dynfield_offset < 0) {
>> + PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
>> + return -rte_errno;
>> + }
>> +
>> /*
>> * for secondary processes, we don't initialize any further as primary
>> * has already done this work.
>> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
>> index dd685b02b7..5730e94d50 100644
>> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
>> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
>> @@ -193,4 +193,6 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
>> uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
>> uint16_t nb_pkts);
>>
>> +extern int vmxnet3_segs_dynfield_offset;
>> +
>> #endif /* _VMXNET3_ETHDEV_H_ */
>> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
>> index e10f9ee870..6655622f94 100644
>> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
>> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
>> @@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
>> struct rte_ipv6_hdr *ipv6_hdr;
>> struct rte_tcp_hdr *tcp_hdr;
>> char *ptr;
>> + uint8_t segs;
>>
>> RTE_ASSERT(rcd->tcp);
>>
>> @@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
>> tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
>> hlen += (tcp_hdr->data_off & 0xf0) >> 2;
>>
>> - if (rxm->udata64 > 1)
>> - return (rte_pktmbuf_pkt_len(rxm) - hlen +
>> - rxm->udata64 - 1) / rxm->udata64;
>> + segs = *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset, uint8_t *);
>> + if (segs > 1)
>> + return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
>> else
>> return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
>> }
>> @@ -737,7 +738,8 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
>> (const Vmxnet3_RxCompDescExt *)rcd;
>>
>> rxm->tso_segsz = rcde->mss;
>> - rxm->udata64 = rcde->segCnt;
>> + *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset,
>> + uint8_t *) = rcde->segCnt;
>> ol_flags |= PKT_RX_LRO;
>> }
>> } else { /* Offloads set in eop */
>>
>
> I think it should be a rule of thumb to introduce helper
> macro to access a dynamic field (as you do in few of
> previous patches).
>
> It should be just nearby declaration of the the offset
> variable.
>
May be inline function is even better since, IMHO, if you
both ways are possible, inline function is the right choice.
In this particular case inline function will not add value
from type safety point of view, but it is still better as
an example to follow. In some case inline function could be
used as a place to put build assertion to check size.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-26 14:53 ` Stephen Hemminger
@ 2020-10-26 16:32 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 16:32 UTC (permalink / raw)
To: Stephen Hemminger
Cc: David Marchand, dev, Yigit, Ferruh, Bruce Richardson,
Olivier Matz, Andrew Rybchenko, Akhil Goyal, John McNamara
26/10/2020 15:53, Stephen Hemminger:
> On Mon, 26 Oct 2020 15:33:14 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
>
> > 26/10/2020 11:43, David Marchand:
> > > On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > > >
> > > > The example used the deprecated mbuf field udata64.
> > > > It is moved to a dynamic field in order to allow removal of udata64.
> > > >
> > > > Note: RTE_MBUF_DYNFIELD_TIMESTAMP_NAME is an existing mbuf field name.
> > >
> > > I am a bit lost.
> > > How is this going to work as the mbuf timestamp field is used in this
> > > example too?
> >
> > Oh, you're right!
> > I will change the naming scheme to a custom "TSC" field.
>
> Since timestamp is still there why doesn't the example just use that?
This is what I did, but it's wrong because it is a different timestamp.
The example is doing a comparison of timestamps (AFAIU).
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 15:06 ` Andrew Rybchenko
@ 2020-10-26 16:49 ` Thomas Monjalon
2020-10-26 19:03 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 16:49 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, akhil.goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
26/10/2020 16:06, Andrew Rybchenko:
> On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> > --- a/drivers/net/ixgbe/ixgbe_ipsec.c
> > +++ b/drivers/net/ixgbe/ixgbe_ipsec.c
> > - (union ixgbe_crypto_tx_desc_md *)&m->udata64;
> > + (union ixgbe_crypto_tx_desc_md *)
> > + rte_security_dynfield(m);
>
> IMHO alignment looks a bit confusing here, may be add one more
> TAB?
OK, no opinion
> [snip]
> > - sa = pkt->userdata;
> > + sa = RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
> > + struct ipsec_sa *);
>
> I think it should be de-reference above, i.e.
> sa = (struct ipsec_sa *)*RTE_MBUF_DYNFIELD(pkt,
> security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
> or just
> sa = *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset, struct ipsec_sa **);
You're right something is wrong.
I should add a dereference.
> and why not rte_security_dynfield()?
Because I need good reviews from you and David :)
Will fix one and the other occurences.
I've prepared a v2 using a macro, but I think I will follow
your suggestion of having static inline functions.
> It all looks very fragile. May be at least add
> RTE_BUILD_BUG_ON(sizeof(RTE_SECURITY_DYNFIELD_TYPE) ==
> sizeof(ipsec_sa *));
> and similar checks when an application or a library does
> lookup for a dynamic field.
You mean adding this after the lookup in the app?
> In general since lookup should not happen on data path,
> may be lookup should return size of the field which must
> be checked by the caller for consistency.
It does. I can add a check.
> Is it really different types of value in one example
> application? It looks like it should be different
> dynamic fields. Otherwise, I don't understand how
> to work with it.
Yes, udata64 was a trash bin used to store different kind of data,
even inside librte_security.
> In fact may be above is out of scope of the patch series...
Yes, I think moving to a dedicated field is a first step.
Second step (not by me) will be to split in different fields.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-26 15:21 ` Andrew Rybchenko
@ 2020-10-26 16:50 ` Thomas Monjalon
2020-10-26 18:13 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 16:50 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, akhil.goyal, Yong Wang
26/10/2020 16:21, Andrew Rybchenko:
> On 10/26/20 6:14 PM, Andrew Rybchenko wrote:
> > On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> >> - rxm->udata64 = rcde->segCnt;
> >> + *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset,
> >> + uint8_t *) = rcde->segCnt;
> >
> > I think it should be a rule of thumb to introduce helper
> > macro to access a dynamic field (as you do in few of
> > previous patches).
> >
> > It should be just nearby declaration of the the offset
> > variable.
>
> May be inline function is even better since, IMHO, if you
> both ways are possible, inline function is the right choice.
> In this particular case inline function will not add value
> from type safety point of view, but it is still better as
> an example to follow. In some case inline function could be
> used as a place to put build assertion to check size.
OK I will review the patches to provide a static inline getter function
for each dynamic field.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 10:41 ` David Marchand
2020-10-26 14:30 ` Thomas Monjalon
@ 2020-10-26 17:58 ` Akhil Goyal
1 sibling, 0 replies; 178+ messages in thread
From: Akhil Goyal @ 2020-10-26 17:58 UTC (permalink / raw)
To: David Marchand, Thomas Monjalon
Cc: dev, Yigit, Ferruh, Bruce Richardson, Olivier Matz,
Andrew Rybchenko, Declan Doherty, Ankur Dwivedi, Anoob Joseph,
Jeff Guo, Haiyue Wang, Jerin Jacob, Nithin Dabilpuram,
Kiran Kumar K, Radu Nicolau, Ray Kinsella, Neil Horman
> On Mon, Oct 26, 2020 at 6:21 AM Thomas Monjalon <thomas@monjalon.net>
> wrote:
> > diff --git a/lib/librte_security/rte_security_driver.h
> b/lib/librte_security/rte_security_driver.h
> > index 1b561f8528..ba9691b4a0 100644
> > --- a/lib/librte_security/rte_security_driver.h
> > +++ b/lib/librte_security/rte_security_driver.h
> > @@ -17,6 +17,8 @@
> > extern "C" {
> > #endif
> >
> > +#include <rte_mbuf_dyn.h>
> > +
> > #include "rte_security.h"
> >
> > /**
> > @@ -89,6 +91,24 @@ typedef int (*security_session_stats_get_t)(void
> *device,
> > struct rte_security_session *sess,
> > struct rte_security_stats *stats);
> >
> > +/* Dynamic mbuf field for device-specific metadata */
> > +static const struct rte_mbuf_dynfield rte_security_dynfield_desc = {
> > + .name = RTE_SECURITY_DYNFIELD_NAME,
> > + .size = sizeof(RTE_SECURITY_DYNFIELD_TYPE),
> > + .align = __alignof__(RTE_SECURITY_DYNFIELD_TYPE),
> > +};
>
> Should be in rte_security.c?
>
>
> > +extern int rte_security_dynfield_offset;
> > +
> > +__rte_experimental
> > +int rte_security_dynfield_register(void);
> > +
> > +static inline RTE_SECURITY_DYNFIELD_TYPE *
> > +rte_security_dynfield(struct rte_mbuf *mbuf)
> > +{
> > + return RTE_MBUF_DYNFIELD(mbuf,
> > + rte_security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
> > +}
code indentation -
Atleast one more tab before rte_security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *).
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-26 16:50 ` Thomas Monjalon
@ 2020-10-26 18:13 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 18:13 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, akhil.goyal, Yong Wang
26/10/2020 17:50, Thomas Monjalon:
> 26/10/2020 16:21, Andrew Rybchenko:
> > On 10/26/20 6:14 PM, Andrew Rybchenko wrote:
> > > On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> > >> - rxm->udata64 = rcde->segCnt;
> > >> + *RTE_MBUF_DYNFIELD(rxm, vmxnet3_segs_dynfield_offset,
> > >> + uint8_t *) = rcde->segCnt;
> > >
> > > I think it should be a rule of thumb to introduce helper
> > > macro to access a dynamic field (as you do in few of
> > > previous patches).
> > >
> > > It should be just nearby declaration of the the offset
> > > variable.
> >
> > May be inline function is even better since, IMHO, if you
> > both ways are possible, inline function is the right choice.
> > In this particular case inline function will not add value
> > from type safety point of view, but it is still better as
> > an example to follow. In some case inline function could be
> > used as a place to put build assertion to check size.
>
> OK I will review the patches to provide a static inline getter function
> for each dynamic field.
After more thoughts, I think it is good to have static inline
returning a pointer to the field in general case:
static inline my_type *
rte_foo_dynfield_bar(struct rte_mbuf * mbuf)
{
return RTE_MBUF_DYNFIELD(mbuf, my_dynfield_offset, my_type *);
}
But when the scope is limited, it is easier to read a macro
which contains dereferencing of the field pointer with the right type:
#define MY_DYNFIELD(mbuf) \
(*RTE_MBUF_DYNFIELD(mbuf, my_dynfield_offset, my_type *))
If type cast is never needed, this form allows simple assignment:
MY_DYNFIELD(mbuf) = field_value;
I would tend to use this latter form for tests or small apps.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 16:49 ` Thomas Monjalon
@ 2020-10-26 19:03 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 19:03 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, akhil.goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
26/10/2020 17:49, Thomas Monjalon:
> 26/10/2020 16:06, Andrew Rybchenko:
> > On 10/26/20 8:20 AM, Thomas Monjalon wrote:
> > [snip]
> > > - sa = pkt->userdata;
> > > + sa = RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset,
> > > + struct ipsec_sa *);
> >
> > I think it should be de-reference above, i.e.
> > sa = (struct ipsec_sa *)*RTE_MBUF_DYNFIELD(pkt,
> > security_dynfield_offset, RTE_SECURITY_DYNFIELD_TYPE *);
> > or just
> > sa = *RTE_MBUF_DYNFIELD(pkt, security_dynfield_offset, struct ipsec_sa **);
>
> You're right something is wrong.
> I should add a dereference.
>
> > and why not rte_security_dynfield()?
>
> Because I need good reviews from you and David :)
The initial idea was to have a field lookup in the app,
and to not rely on what drivers have registered.
After more thoughts, the lookup can be replaced with a check
rte_security_dynfield_is_registered(),
so rte_security_dynfield() can be used.
> Will fix one and the other occurences.
> I've prepared a v2 using a macro, but I think I will follow
> your suggestion of having static inline functions.
>
> > It all looks very fragile. May be at least add
> > RTE_BUILD_BUG_ON(sizeof(RTE_SECURITY_DYNFIELD_TYPE) ==
> > sizeof(ipsec_sa *));
> > and similar checks when an application or a library does
> > lookup for a dynamic field.
>
> You mean adding this after the lookup in the app?
I will remove the lookup, it is less fragile.
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (14 preceding siblings ...)
2020-10-26 5:21 ` [dpdk-dev] [PATCH 15/15] mbuf: remove userdata field Thomas Monjalon
@ 2020-10-26 22:19 ` Thomas Monjalon
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
` (14 more replies)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (3 subsequent siblings)
19 siblings, 15 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:19 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
The mbuf field userdata (aliased as udata64)
was announced to be removed for two reasons:
- applications, libraries and drivers used the same field
for different purposes, with a risk of usage conflict.
- this field always used 8 bytes even if unneeded
Some dynamic fields are created when needed to replace
the big static userdata field.
As a consequence, 8 bytes can be re-allocated to dynamic fields.
This mbuf layout change is important to allow adding more features
(consuming more dynamic fields) during the next year.
v2 (thanks David & Andrew):
- fix some indentations
- return -rte_errno consistently
- make some type casts more precise
- define dynfield types in macros
- hide field description in rte_security
- do not lookup security dynfield in ipsec-secgw
- do not use the existing timestamp field for other purpose
Thomas Monjalon (15):
examples: enclose DPDK includes with angle brackets
kni: move header file from EAL
mbuf: fix typo in dynamic field convention note
node: switch IPv4 metadata to dynamic mbuf field
security: switch metadata to dynamic mbuf field
event/sw: switch test counter to dynamic mbuf field
net/ark: ignore user data
net/bnxt: switch CFA code to dynamic mbuf field
net/vmxnet3: switch MSS hint to dynamic mbuf field
test/distributor: switch sequence to dynamic mbuf field
test/graph: switch user data to dynamic mbuf field
app/eventdev: switch flow ID to dynamic mbuf field
examples/bbdev: switch to dynamic mbuf field
examples/rxtx_callbacks: switch to dynamic mbuf field
mbuf: remove userdata field
app/test-eventdev/test_order_atq.c | 4 +-
app/test-eventdev/test_order_common.c | 16 +++-
app/test-eventdev/test_order_common.h | 6 ++
app/test-eventdev/test_order_queue.c | 4 +-
app/test/test_distributor.c | 28 +++++-
app/test/test_graph.c | 94 +++++++++++--------
doc/guides/prog_guide/rte_security.rst | 9 +-
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 +-
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 +-
drivers/event/sw/sw_evdev_selftest.c | 23 ++++-
drivers/net/ark/ark_ddm.h | 2 +-
drivers/net/ark/ark_ethdev_rx.c | 1 -
drivers/net/ark/ark_ethdev_tx.c | 1 -
drivers/net/ark/ark_udm.h | 2 +-
drivers/net/bnxt/bnxt_ethdev.c | 19 ++++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 5 +
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +
drivers/net/ixgbe/ixgbe_ipsec.c | 5 +-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 +-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 +-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +-
examples/bbdev_app/main.c | 68 +++++++++-----
examples/bond/main.c | 11 +--
examples/ipsec-secgw/ipsec-secgw.c | 9 +-
examples/ipsec-secgw/ipsec_worker.c | 12 ++-
examples/rxtx_callbacks/main.c | 20 +++-
examples/tep_termination/vxlan_setup.c | 2 +-
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
.../include => librte_kni}/rte_kni_common.h | 3 +-
lib/librte_mbuf/rte_mbuf_core.h | 8 +-
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
lib/librte_node/ip4_lookup.c | 7 ++
lib/librte_node/ip4_rewrite.c | 10 ++
lib/librte_node/node_private.h | 12 ++-
lib/librte_security/rte_security.c | 22 +++++
lib/librte_security/rte_security.h | 32 +++++++
lib/librte_security/rte_security_driver.h | 3 +
lib/librte_security/version.map | 3 +
48 files changed, 379 insertions(+), 133 deletions(-)
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (97%)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 01/15] examples: enclose DPDK includes with angle brackets
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-26 22:19 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 02/15] kni: move header file from EAL Thomas Monjalon
` (13 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:19 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru, Chas Williams,
Min Hu (Connor),
Xiaoyun Li
In examples, DPDK header files are external,
so they must be enclosed with angle brackets, not quotes.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
examples/bbdev_app/main.c | 30 +++++++++++++-------------
examples/bond/main.c | 11 ++++------
examples/tep_termination/vxlan_setup.c | 2 +-
3 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 43fe631760..e512c807cd 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -18,21 +18,21 @@
#include <getopt.h>
#include <signal.h>
-#include "rte_atomic.h"
-#include "rte_common.h"
-#include "rte_eal.h"
-#include "rte_cycles.h"
-#include "rte_ether.h"
-#include "rte_ethdev.h"
-#include "rte_ip.h"
-#include "rte_lcore.h"
-#include "rte_malloc.h"
-#include "rte_mbuf.h"
-#include "rte_memory.h"
-#include "rte_mempool.h"
-#include "rte_log.h"
-#include "rte_bbdev.h"
-#include "rte_bbdev_op.h"
+#include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_eal.h>
+#include <rte_cycles.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_ip.h>
+#include <rte_lcore.h>
+#include <rte_malloc.h>
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_log.h>
+#include <rte_bbdev.h>
+#include <rte_bbdev_op.h>
/* LLR values - negative value for '1' bit */
#define LLR_1_BIT 0x81
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 398553b785..81a6fa976b 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -41,6 +41,10 @@
#include <rte_tcp.h>
#include <rte_arp.h>
#include <rte_spinlock.h>
+#include <rte_devargs.h>
+#include <rte_byteorder.h>
+#include <rte_cpuflags.h>
+#include <rte_eth_bond.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
@@ -53,13 +57,6 @@
#include "main.h"
-#include <rte_devargs.h>
-
-
-#include "rte_byteorder.h"
-#include "rte_cpuflags.h"
-#include "rte_eth_bond.h"
-
#define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1
#define NB_MBUF (1024*8)
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index 4b44ccc143..0bcd870b4a 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -18,9 +18,9 @@
#include <rte_ip.h>
#include <rte_udp.h>
#include <rte_tcp.h>
+#include <rte_vhost.h>
#include "main.h"
-#include "rte_vhost.h"
#include "vxlan.h"
#include "vxlan_setup.h"
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 02/15] kni: move header file from EAL
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
` (12 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
Since the kernel module is not part of EAL anymore,
there is no need to have the common KNI header file in EAL.
The file rte_kni_common.h is moved to librte_kni.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h | 0
4 files changed, 2 insertions(+), 3 deletions(-)
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (100%)
diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build
index d696347f22..07e0c9dae7 100644
--- a/kernel/linux/kni/meson.build
+++ b/kernel/linux/kni/meson.build
@@ -18,7 +18,7 @@ custom_target('rte_kni',
'src=' + meson.current_source_dir(),
'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
' -I' + meson.source_root() + '/lib/librte_eal/include' +
- ' -I' + meson.source_root() + '/lib/librte_eal/linux/include' +
+ ' -I' + meson.source_root() + '/lib/librte_kni' +
' -I' + meson.build_root() +
' -I' + meson.current_source_dir(),
'modules'],
diff --git a/lib/librte_eal/linux/include/meson.build b/lib/librte_eal/linux/include/meson.build
index 1241894b3c..7d18dd52f1 100644
--- a/lib/librte_eal/linux/include/meson.build
+++ b/lib/librte_eal/linux/include/meson.build
@@ -4,6 +4,5 @@
includes += include_directories('.')
headers += files(
- 'rte_kni_common.h',
'rte_os.h',
)
diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build
index 963eae6fe0..ad598bb3d0 100644
--- a/lib/librte_kni/meson.build
+++ b/lib/librte_kni/meson.build
@@ -6,5 +6,5 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
reason = 'only supported on 64-bit linux'
endif
sources = files('rte_kni.c')
-headers = files('rte_kni.h')
+headers = files('rte_kni.h', 'rte_kni_common.h')
deps += ['ethdev', 'pci']
diff --git a/lib/librte_eal/linux/include/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
similarity index 100%
rename from lib/librte_eal/linux/include/rte_kni_common.h
rename to lib/librte_kni/rte_kni_common.h
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 03/15] mbuf: fix typo in dynamic field convention note
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 02/15] kni: move header file from EAL Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
` (11 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, stable, Konstantin Ananyev
Replace "in a in PMD" with "in a PMD".
Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 8407230ecf..0ebac88b83 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -62,7 +62,7 @@
* conventions than function names in dpdk:
* - "rte_mbuf_dynfield_<name>" if defined in mbuf library
* - "rte_<libname>_dynfield_<name>" if defined in another library
- * - "rte_net_<pmd>_dynfield_<name>" if defined in a in PMD
+ * - "rte_net_<pmd>_dynfield_<name>" if defined in a PMD
* - any name that does not start with "rte_" in an application
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (2 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-27 9:32 ` Olivier Matz
2020-10-27 14:23 ` Nithin Dabilpuram
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 05/15] security: switch " Thomas Monjalon
` (10 subsequent siblings)
14 siblings, 2 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nithin Dabilpuram,
Pavan Nikhilesh
The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_node/ip4_lookup.c | 7 +++++++
lib/librte_node/ip4_rewrite.c | 10 ++++++++++
lib/librte_node/node_private.h | 12 ++++++++++--
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 8835aab9dd..c2f6d653f9 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -21,6 +21,8 @@
#include "node_private.h"
+int node_mbuf_priv1_dynfield_offset;
+
#define IPV4_L3FWD_LPM_MAX_RULES 1024
#define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)
@@ -178,6 +180,11 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
RTE_SET_USED(node);
if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+
/* Setup LPM tables for all sockets */
RTE_LCORE_FOREACH(lcore_id)
{
diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c
index bb7f671b5c..1c4e51968c 100644
--- a/lib/librte_node/ip4_rewrite.c
+++ b/lib/librte_node/ip4_rewrite.c
@@ -248,9 +248,19 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
static int
ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
{
+ static bool init_once;
RTE_SET_USED(graph);
RTE_SET_USED(node);
+
+ if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+ init_once = true;
+ }
+
node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
return 0;
diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
index ab7941c12b..359b40faed 100644
--- a/lib/librte_node/node_private.h
+++ b/lib/librte_node/node_private.h
@@ -8,6 +8,7 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
extern int rte_node_logtype;
#define NODE_LOG(level, node_name, ...) \
@@ -21,7 +22,6 @@ extern int rte_node_logtype;
#define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
/**
- *
* Node mbuf private data to store next hop, ttl and checksum.
*/
struct node_mbuf_priv1 {
@@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
};
};
+static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
+ .name = "rte_node_dynfield_priv1",
+ .size = sizeof(struct node_mbuf_priv1 *),
+ .align = __alignof__(struct node_mbuf_priv1 *),
+};
+extern int node_mbuf_priv1_dynfield_offset;
+
/**
* Node mbuf private area 2.
*/
@@ -60,7 +67,8 @@ struct node_mbuf_priv2 {
static __rte_always_inline struct node_mbuf_priv1 *
node_mbuf_priv1(struct rte_mbuf *m)
{
- return (struct node_mbuf_priv1 *)&m->udata64;
+ return RTE_MBUF_DYNFIELD(m,
+ node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *);
}
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (3 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-27 2:01 ` Wang, Haiyue
2020-10-27 10:05 ` Olivier Matz
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter " Thomas Monjalon
` (9 subsequent siblings)
14 siblings, 2 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
The device-specific metadata was stored in the deprecated field udata64.
It is moved to a dynamic mbuf field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/prog_guide/rte_security.rst | 9 +++---
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++-
drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++--
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 9 +++---
examples/ipsec-secgw/ipsec_worker.c | 12 ++++---
lib/librte_security/rte_security.c | 22 +++++++++++++
lib/librte_security/rte_security.h | 32 +++++++++++++++++++
lib/librte_security/rte_security_driver.h | 3 ++
lib/librte_security/version.map | 3 ++
14 files changed, 96 insertions(+), 20 deletions(-)
diff --git a/doc/guides/prog_guide/rte_security.rst b/doc/guides/prog_guide/rte_security.rst
index c64aef3de9..f72bc8a78f 100644
--- a/doc/guides/prog_guide/rte_security.rst
+++ b/doc/guides/prog_guide/rte_security.rst
@@ -125,8 +125,9 @@ ESP/AH headers will be removed from the packet and the received packet
will contains the decrypted packet only. The driver Rx path checks the
descriptors and based on the crypto status sets additional flags in
``rte_mbuf.ol_flags`` field. The driver would also set device-specific
-metadata in ``rte_mbuf.udata64`` field. This will allow the application
-to identify the security processing done on the packet.
+metadata in ``RTE_SECURITY_DYNFIELD_NAME`` field.
+This will allow the application to identify the security processing
+done on the packet.
.. note::
@@ -568,8 +569,8 @@ security session which processed the packet.
.. note::
- In case of inline processed packets, ``rte_mbuf.udata64`` field would be
- used by the driver to relay information on the security processing
+ In case of inline processed packets, ``RTE_SECURITY_DYNFIELD_NAME`` field
+ would be used by the driver to relay information on the security processing
associated with the packet. In ingress, the driver would set this in Rx
path while in egress, ``rte_security_set_pkt_metadata()`` would perform a
similar operation. The application is expected not to modify the field
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
index b80ec7bff2..2e5e73143b 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
@@ -455,6 +455,9 @@ otx2_crypto_sec_session_create(void *device,
if (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL)
return -ENOTSUP;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
if (rte_mempool_get(mempool, (void **)&priv)) {
otx2_err("Could not allocate security session private data");
return -ENOMEM;
@@ -514,7 +517,7 @@ otx2_crypto_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (RTE_SECURITY_DYNFIELD_TYPE)session;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c
index 48f5082d49..62f2a5f764 100644
--- a/drivers/net/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ixgbe/ixgbe_ipsec.c
@@ -484,7 +484,8 @@ ixgbe_crypto_update_mb(void *device __rte_unused,
get_sec_session_private_data(session);
if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) {
union ixgbe_crypto_tx_desc_md *mdata =
- (union ixgbe_crypto_tx_desc_md *)&m->udata64;
+ (union ixgbe_crypto_tx_desc_md *)
+ rte_security_dynfield(m);
mdata->enc = 1;
mdata->sa_idx = ic_session->sa_index;
mdata->pad_len = ixgbe_crypto_compute_pad_len(m);
@@ -751,5 +752,7 @@ ixgbe_ipsec_ctx_create(struct rte_eth_dev *dev)
return -ENOMEM;
}
}
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 5f19972031..6cfbb582e2 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -34,6 +34,7 @@
#include <rte_mbuf.h>
#include <rte_ether.h>
#include <rte_ethdev_driver.h>
+#include <rte_security_driver.h>
#include <rte_prefetch.h>
#include <rte_udp.h>
#include <rte_tcp.h>
@@ -694,7 +695,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
if (use_ipsec) {
union ixgbe_crypto_tx_desc_md *ipsec_mdata =
(union ixgbe_crypto_tx_desc_md *)
- &tx_pkt->udata64;
+ rte_security_dynfield(tx_pkt);
tx_offload.sa_idx = ipsec_mdata->sa_idx;
tx_offload.sec_pad_len = ipsec_mdata->pad_len;
}
@@ -859,7 +860,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
- tx_offload, &tx_pkt->udata64);
+ tx_offload,
+ rte_security_dynfield(tx_pkt));
txe->last_id = tx_last;
tx_id = txe->next_id;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index b20f399a15..3b9871f4dc 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -13,6 +13,7 @@
#include <rte_kvargs.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
+#include <rte_security_driver.h>
#include <rte_string_fns.h>
#include <rte_time.h>
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec.c b/drivers/net/octeontx2/otx2_ethdev_sec.c
index 4e0dd4e49e..78c5bbeb99 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec.c
+++ b/drivers/net/octeontx2/otx2_ethdev_sec.c
@@ -684,7 +684,7 @@ otx2_eth_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (RTE_SECURITY_DYNFIELD_TYPE)session;
return 0;
}
@@ -831,6 +831,9 @@ otx2_eth_sec_init(struct rte_eth_dev *eth_dev)
!(dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY))
return 0;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
nb_sa = dev->ipsec_in_max_spi;
mz_sz = nb_sa * sa_width;
in_sa_mz_name_get(name, RTE_MEMZONE_NAMESIZE, port);
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
index 5bf8c19995..284bcd5367 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
+++ b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
@@ -55,7 +55,7 @@ otx2_sec_event_tx(struct otx2_ssogws *ws, struct rte_event *ev,
struct nix_iova_s nix_iova;
} *sd;
- priv = get_sec_session_private_data((void *)(m->udata64));
+ priv = get_sec_session_private_data((void *)(*rte_security_dynfield(m)));
sess = &priv->ipsec.ip;
sa = &sess->out_sa;
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index f29a0542f9..61a5c436dd 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -241,7 +241,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
spi = cq->tag & 0xFFFFF;
sa = nix_rx_sec_sa_get(lookup_mem, spi, m->port);
- m->udata64 = (uint64_t)sa->userdata;
+ *rte_security_dynfield(m) = sa->udata64;
data = rte_pktmbuf_mtod(m, char *);
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 2219148285..bbe7ce48d9 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -426,7 +426,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
* with the security session.
*/
- if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD) {
+ if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD &&
+ rte_security_dynfield_is_registered()) {
struct ipsec_sa *sa;
struct ipsec_mbuf_metadata *priv;
struct rte_security_ctx *ctx = (struct rte_security_ctx *)
@@ -436,10 +437,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
/* Retrieve the userdata registered. Here, the userdata
* registered is the SA pointer.
*/
-
- sa = (struct ipsec_sa *)
- rte_security_get_userdata(ctx, pkt->udata64);
-
+ sa = (struct ipsec_sa *)rte_security_get_userdata(ctx,
+ *rte_security_dynfield(pkt));
if (sa == NULL) {
/* userdata could not be retrieved */
return;
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index b6c851f257..647e22df59 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -208,7 +208,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -226,7 +226,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -357,7 +357,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
}
if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
- pkt->userdata = sess->security.ses;
+ *(struct rte_security_session **)rte_security_dynfield(pkt) =
+ sess->security.ses;
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
@@ -465,7 +466,10 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
}
/* Save security session */
- pkt->userdata = sess_tbl[port_id];
+ if (rte_security_dynfield_is_registered())
+ *(struct rte_security_session **)
+ rte_security_dynfield(pkt) =
+ sess_tbl[port_id];
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
index ee4666026a..4fb0b797e9 100644
--- a/lib/librte_security/rte_security.c
+++ b/lib/librte_security/rte_security.c
@@ -23,6 +23,28 @@
RTE_PTR_OR_ERR_RET(p1->p2->p3, last_retval); \
} while (0)
+#define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+int rte_security_dynfield_offset = -1;
+
+int
+rte_security_dynfield_register(void)
+{
+ static const struct rte_mbuf_dynfield dynfield_desc = {
+ .name = RTE_SECURITY_DYNFIELD_NAME,
+ .size = sizeof(RTE_SECURITY_DYNFIELD_TYPE),
+ .align = __alignof__(RTE_SECURITY_DYNFIELD_TYPE),
+ };
+ rte_security_dynfield_offset =
+ rte_mbuf_dynfield_register(&dynfield_desc);
+ return rte_security_dynfield_offset;
+}
+
+bool
+rte_security_dynfield_is_registered(void)
+{
+ return rte_security_dynfield_offset >= 0;
+}
+
struct rte_security_session *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index 271531af12..7fbdee99cc 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -27,6 +27,7 @@ extern "C" {
#include <rte_common.h>
#include <rte_crypto.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
@@ -451,6 +452,37 @@ int
rte_security_session_destroy(struct rte_security_ctx *instance,
struct rte_security_session *sess);
+/** Device-specific metadata field type */
+#define RTE_SECURITY_DYNFIELD_TYPE uint64_t
+/** Dynamic mbuf field for device-specific metadata */
+extern int rte_security_dynfield_offset;
+
+/**
+ * Get pointer to mbuf field for device-specific metadata.
+ *
+ * For performance reason, no check is done,
+ * the dynamic field may not be registered.
+ * @see rte_security_dynfield_is_registered
+ *
+ * @param mbuf packet to access
+ * @return pointer to mbuf field
+ */
+static inline RTE_SECURITY_DYNFIELD_TYPE *
+rte_security_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ rte_security_dynfield_offset,
+ RTE_SECURITY_DYNFIELD_TYPE *);
+}
+
+/**
+ * Check whether the dynamic field is registered.
+ *
+ * @return true if rte_security_dynfield_register() has been called.
+ */
+__rte_experimental
+bool rte_security_dynfield_is_registered(void);
+
/**
* Updates the buffer with device-specific defined metadata
*
diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
index 1b561f8528..c5abb07990 100644
--- a/lib/librte_security/rte_security_driver.h
+++ b/lib/librte_security/rte_security_driver.h
@@ -89,6 +89,9 @@ typedef int (*security_session_stats_get_t)(void *device,
struct rte_security_session *sess,
struct rte_security_stats *stats);
+__rte_experimental
+int rte_security_dynfield_register(void);
+
/**
* Update the mbuf with provided metadata.
*
diff --git a/lib/librte_security/version.map b/lib/librte_security/version.map
index d84eec0a88..f2fbec28e6 100644
--- a/lib/librte_security/version.map
+++ b/lib/librte_security/version.map
@@ -15,6 +15,9 @@ DPDK_21 {
EXPERIMENTAL {
global:
+ rte_security_dynfield_is_registered;
+ rte_security_dynfield_offset;
+ rte_security_dynfield_register;
rte_security_get_userdata;
rte_security_session_stats_get;
rte_security_session_update;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (4 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 05/15] security: switch " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-27 10:15 ` Olivier Matz
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data Thomas Monjalon
` (8 subsequent siblings)
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Harry van Haaren
The test worker_loopback used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/event/sw/sw_evdev_selftest.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index 5c7e527917..9af20cecf1 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -40,6 +40,11 @@ struct test {
uint32_t service_id;
};
+static int counter_dynfield_offset;
+#define COUNTER_FIELD_TYPE uint8_t
+#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ counter_dynfield_offset, COUNTER_FIELD_TYPE *))
+
static struct rte_event release_ev;
static inline struct rte_mbuf *
@@ -2987,8 +2992,8 @@ worker_loopback_worker_fn(void *arg)
}
ev[i].queue_id = 0;
- ev[i].mbuf->udata64++;
- if (ev[i].mbuf->udata64 != 16) {
+ COUNTER_FIELD(ev[i].mbuf)++;
+ if (COUNTER_FIELD(ev[i].mbuf) != 16) {
ev[i].op = RTE_EVENT_OP_FORWARD;
enqd = rte_event_enqueue_burst(evdev, port,
&ev[i], 1);
@@ -3028,7 +3033,7 @@ worker_loopback_producer_fn(void *arg)
m = rte_pktmbuf_alloc(t->mbuf_pool);
} while (m == NULL);
- m->udata64 = 0;
+ COUNTER_FIELD(m) = 0;
struct rte_event ev = {
.op = RTE_EVENT_OP_NEW,
@@ -3061,6 +3066,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)
int err;
int w_lcore, p_lcore;
+ static const struct rte_mbuf_dynfield counter_dynfield_desc = {
+ .name = "rte_event_sw_dynfield_selftest_counter",
+ .size = sizeof(COUNTER_FIELD_TYPE),
+ .align = __alignof__(COUNTER_FIELD_TYPE),
+ };
+ counter_dynfield_offset =
+ rte_mbuf_dynfield_register(&counter_dynfield_desc);
+ if (counter_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return -rte_errno;
+ }
+
if (init(t, 8, 2) < 0 ||
create_atomic_qids(t, 8) < 0) {
printf("%d: Error initializing device\n", __LINE__);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (5 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-27 15:32 ` Ed Czeck
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
` (7 subsequent siblings)
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Shepard Siegel, Ed Czeck,
John Miller
The second field of metadata is reserved for user data
which is a deprecated mbuf field.
The usage of mbuf udata64 is removed
and the corresponding ark metadata field is annotated as ignored.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/ark/ark_ddm.h | 2 +-
drivers/net/ark/ark_ethdev_rx.c | 1 -
drivers/net/ark/ark_ethdev_tx.c | 1 -
drivers/net/ark/ark_udm.h | 2 +-
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ark/ark_ddm.h b/drivers/net/ark/ark_ddm.h
index 5456b4b5cc..99eded8524 100644
--- a/drivers/net/ark/ark_ddm.h
+++ b/drivers/net/ark/ark_ddm.h
@@ -19,7 +19,7 @@
/* struct defining Tx meta data -- fixed in FPGA -- 16 bytes */
struct ark_tx_meta {
uint64_t physaddr;
- uint32_t user1;
+ uint32_t user1; /* ignored */
uint16_t data_len; /* of this MBUF */
#define ARK_DDM_EOP 0x01
#define ARK_DDM_SOP 0x02
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 2f8d05099c..5ead67e6b8 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -272,7 +272,6 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->pkt_len = meta->pkt_len;
mbuf->data_len = meta->pkt_len;
mbuf->timestamp = meta->timestamp;
- mbuf->udata64 = meta->user_data;
if (ARK_DEBUG_CORE) { /* debug sanity checks */
if ((meta->pkt_len > (1024 * 16)) ||
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index a0e35af880..8a0a9381f7 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -70,7 +70,6 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
uint8_t flags)
{
meta->physaddr = rte_mbuf_data_iova(mbuf);
- meta->user1 = (uint32_t)mbuf->udata64;
meta->data_len = rte_pktmbuf_data_len(mbuf);
meta->flags = flags;
}
diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
index 5846c825b8..ba436ee25b 100644
--- a/drivers/net/ark/ark_udm.h
+++ b/drivers/net/ark/ark_udm.h
@@ -18,7 +18,7 @@
/* Meta data structure apssed from FPGA, must match layout in FPGA */
struct ark_rx_meta {
uint64_t timestamp;
- uint64_t user_data;
+ uint64_t user_data; /* ignored */
uint8_t port;
uint8_t dst_queue;
uint16_t pkt_len;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (6 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-27 4:44 ` Ajit Khaparde
2020-10-27 10:31 ` Olivier Matz
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
` (6 subsequent siblings)
14 siblings, 2 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ajit Khaparde, Somnath Kotur
The CFA code from mark was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Note: the new field has 32 bits, smaller than udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 5 +++++
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++
4 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1c7d1b758d..1090d28341 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -31,6 +31,7 @@
#include "bnxt_nvm_defs.h"
#include "bnxt_tf_common.h"
#include "ulp_flow_db.h"
+#include "rte_pmd_bnxt.h"
#define DRV_MODULE_NAME "bnxt"
static const char bnxt_version[] =
@@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = {
*/
#define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
+int bnxt_cfa_code_dynfield_offset;
+
/*
* max_num_kflows must be >= 32
* and must be a power-of-2 supported value
@@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF)
bp->flags |= BNXT_FLAG_STINGRAY;
+ if (BNXT_TRUFLOW_EN(bp)) {
+ /* extra mbuf field is required to store CFA code from mark */
+ static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = {
+ .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME,
+ .size = sizeof(BNXT_CFA_CODE_DYNFIELD_TYPE),
+ .align = __alignof__(BNXT_CFA_CODE_DYNFIELD_TYPE),
+ };
+ bnxt_cfa_code_dynfield_offset =
+ rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc);
+ if (bnxt_cfa_code_dynfield_offset < 0) {
+ PMD_DRV_LOG(ERR,
+ "Failed to register mbuf field for TruFlow mark\n");
+ return -rte_errno;
+ }
+ }
+
rc = bnxt_init_board(eth_dev);
if (rc) {
PMD_DRV_LOG(ERR,
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 039217fa60..7156ce7dd8 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -606,7 +606,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
return mark_id;
/* Got the mark, write it to the mbuf and return */
mbuf->hash.fdir.hi = mark_id;
- mbuf->udata64 = (cfa_code & 0xffffffffull) << 32;
+ BNXT_CFA_CODE_DYNFIELD(mbuf) = cfa_code & 0xffffffffull;
mbuf->hash.fdir.id = rxcmp1->cfa_code;
mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
return mark_id;
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index b874e54a8c..e01d3e4f18 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -95,6 +95,11 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
struct rx_pkt_cmpl_hi *rxcmp1,
struct rte_mbuf *mbuf);
+extern int bnxt_cfa_code_dynfield_offset;
+#define BNXT_CFA_CODE_DYNFIELD_TYPE uint32_t
+#define BNXT_CFA_CODE_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ bnxt_cfa_code_dynfield_offset, BNXT_CFA_CODE_DYNFIELD_TYPE *))
+
#define BNXT_RX_META_CFA_CODE_SHIFT 19
#define BNXT_CFA_CODE_META_SHIFT 16
#define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 81d0d0e032..8d3303bb0f 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -9,6 +9,9 @@
#include <rte_ethdev.h>
#include <rte_ether.h>
+/* mbuf dynfield where CFA code is stored */
+#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
+
/*
* Response sent back to the caller after callback
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (7 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-27 10:45 ` Olivier Matz
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 10/15] test/distributor: switch sequence " Thomas Monjalon
` (5 subsequent siblings)
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Yong Wang
The segment count, used for MSS guess,
was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++++++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++----
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 6920ab568c..6e99b67b5a 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -59,6 +59,8 @@
DEV_RX_OFFLOAD_JUMBO_FRAME | \
DEV_RX_OFFLOAD_RSS_HASH)
+int vmxnet3_segs_dynfield_offset;
+
static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
@@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
struct vmxnet3_hw *hw = eth_dev->data->dev_private;
uint32_t mac_hi, mac_lo, ver;
struct rte_eth_link link;
+ static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
+ .name = VMXNET3_SEGS_DYNFIELD_NAME,
+ .size = sizeof(VMXNET3_SEGS_DYNFIELD_TYPE),
+ .align = __alignof__(VMXNET3_SEGS_DYNFIELD_TYPE),
+ };
PMD_INIT_FUNC_TRACE();
@@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ /* extra mbuf field is required to guess MSS */
+ vmxnet3_segs_dynfield_offset =
+ rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
+ if (vmxnet3_segs_dynfield_offset < 0) {
+ PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
+ return -rte_errno;
+ }
+
/*
* for secondary processes, we don't initialize any further as primary
* has already done this work.
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
index dd685b02b7..e35edf07be 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
@@ -193,4 +193,10 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
+extern int vmxnet3_segs_dynfield_offset;
+#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs"
+#define VMXNET3_SEGS_DYNFIELD_TYPE uint8_t
+#define VMXNET3_SEGS_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(rxm, \
+ vmxnet3_segs_dynfield_offset, VMXNET3_SEGS_DYNFIELD_TYPE *))
+
#endif /* _VMXNET3_ETHDEV_H_ */
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index e10f9ee870..2b0e2e6f19 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
struct rte_ipv6_hdr *ipv6_hdr;
struct rte_tcp_hdr *tcp_hdr;
char *ptr;
+ uint8_t segs;
RTE_ASSERT(rcd->tcp);
@@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
hlen += (tcp_hdr->data_off & 0xf0) >> 2;
- if (rxm->udata64 > 1)
- return (rte_pktmbuf_pkt_len(rxm) - hlen +
- rxm->udata64 - 1) / rxm->udata64;
+ segs = VMXNET3_SEGS_DYNFIELD(rxm);
+ if (segs > 1)
+ return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
else
return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
}
@@ -737,7 +738,7 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
(const Vmxnet3_RxCompDescExt *)rcd;
rxm->tso_segsz = rcde->mss;
- rxm->udata64 = rcde->segCnt;
+ VMXNET3_SEGS_DYNFIELD(rxm) = rcde->segCnt;
ol_flags |= PKT_RX_LRO;
}
} else { /* Offloads set in eop */
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 10/15] test/distributor: switch sequence to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (8 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 11/15] test/graph: switch user data " Thomas Monjalon
` (4 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Lukasz Wojciechowski, David Hunt
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
---
app/test/test_distributor.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index eb889b91d1..4a8bed5ae4 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -10,6 +10,7 @@
#include <rte_errno.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_distributor.h>
#include <rte_string_fns.h>
@@ -17,6 +18,11 @@
#define BURST 32
#define BIG_BATCH 1024
+static int seq_dynfield_offset;
+#define SEQ_FIELD_TYPE uint32_t
+#define SEQ_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ seq_dynfield_offset, SEQ_FIELD_TYPE *))
+
struct worker_params {
char name[64];
struct rte_distributor *dist;
@@ -578,7 +584,7 @@ handle_and_mark_work(void *arg)
__atomic_fetch_add(&worker_stats[id].handled_packets, num,
__ATOMIC_RELAXED);
for (i = 0; i < num; i++)
- buf[i]->udata64 += id + 1;
+ SEQ_FIELD(buf[i]) += id + 1;
num = rte_distributor_get_pkt(db, id,
buf, buf, num);
}
@@ -631,10 +637,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
<< shift;
}
/* Assign a sequence number to each packet. The sequence is shifted,
- * so that lower bits of the udate64 will hold mark from worker.
+ * so that lower bits will hold mark from worker.
*/
for (i = 0; i < buf_count; i++)
- bufs[i]->udata64 = i << seq_shift;
+ SEQ_FIELD(bufs[i]) = i << seq_shift;
count = 0;
for (i = 0; i < buf_count/burst; i++) {
@@ -660,8 +666,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
/* Sort returned packets by sent order (sequence numbers). */
for (i = 0; i < buf_count; i++) {
- seq = returns[i]->udata64 >> seq_shift;
- id = returns[i]->udata64 - (seq << seq_shift);
+ seq = SEQ_FIELD(returns[i]) >> seq_shift;
+ id = SEQ_FIELD(returns[i]) - (seq << seq_shift);
sorted[seq] = id;
}
@@ -805,6 +811,18 @@ test_distributor(void)
static struct rte_mempool *p;
int i;
+ static const struct rte_mbuf_dynfield seq_dynfield_desc = {
+ .name = "test_distributor_dynfield_seq",
+ .size = sizeof(SEQ_FIELD_TYPE),
+ .align = __alignof__(SEQ_FIELD_TYPE),
+ };
+ seq_dynfield_offset =
+ rte_mbuf_dynfield_register(&seq_dynfield_desc);
+ if (seq_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return TEST_FAILED;
+ }
+
if (rte_lcore_count() < 2) {
printf("Not enough cores for distributor_autotest, expecting at least 2\n");
return TEST_SKIPPED;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 11/15] test/graph: switch user data to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (9 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 10/15] test/distributor: switch sequence " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 12/15] app/eventdev: switch flow ID " Thomas Monjalon
` (3 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob, Kiran Kumar K,
Nithin Dabilpuram
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_graph.c | 94 ++++++++++++++++++++++++++-----------------
1 file changed, 56 insertions(+), 38 deletions(-)
diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index ed69eda997..d6b9e368e0 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
#include <rte_graph.h>
#include <rte_graph_worker.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_random.h>
#include "test.h"
@@ -39,6 +40,11 @@ static uint16_t test_node3_worker(struct rte_graph *graph,
#define MBUFF_SIZE 512
#define MAX_NODES 4
+static int graph_dynfield_offset;
+#define GRAPH_FIELD_TYPE uint64_t
+#define GRAPH_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ graph_dynfield_offset, GRAPH_FIELD_TYPE *))
+
static struct rte_mbuf mbuf[MAX_NODES + 1][MBUFF_SIZE];
static void *mbuf_p[MAX_NODES + 1][MBUFF_SIZE];
static rte_graph_t graph_id;
@@ -162,9 +168,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node0);
for (i = 0; i < obj_node0; i++) {
data = &mbuf[0][i];
- data->udata64 = ((uint64_t)tm->test_node[0].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[0].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][i];
}
rte_node_next_stream_put(graph, node, next, obj_node0);
@@ -175,9 +181,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node1);
for (i = 0; i < obj_node1; i++) {
data = &mbuf[0][obj_node0 + i];
- data->udata64 = ((uint64_t)tm->test_node[1].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][obj_node0 + i];
}
@@ -205,23 +211,23 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[0].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[0].idx) {
printf("Data idx miss match at node 0, expected"
" = %u got = %u\n",
tm->test_node[0].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at "
"node 0\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -233,12 +239,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * obj_node0 * 0.01;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[1][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[1][0],
obj_node0);
@@ -246,12 +252,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node1 = nb_objs - obj_node0;
for (i = 0; i < obj_node1; i++) {
data = &mbuf[1][obj_node0 + i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 1, (void **)&mbuf_p[1][obj_node0],
obj_node1);
@@ -285,22 +291,22 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[2] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[1].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[1].idx) {
printf("Data idx miss match at node 1, expected = %u"
" got = %u\n",
tm->test_node[1].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 1\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -312,11 +318,11 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[2][i];
- data->udata64 = ((uint64_t)tm->test_node[2].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[2][0], obj_node0);
@@ -339,22 +345,22 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[3] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[2].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[2].idx) {
printf("Data idx miss match at node 2, expected = %u"
" got = %u\n",
tm->test_node[2].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 2\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -367,10 +373,10 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[3][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[3].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[3][0],
obj_node0);
@@ -395,22 +401,22 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[4] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[3].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[3].idx) {
printf("Data idx miss match at node 3, expected = %u"
" got = %u\n",
tm->test_node[3].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 3\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -426,11 +432,11 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * 2;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[4][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[0].idx << 32) | i;
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[4][0],
obj_node0);
@@ -765,6 +771,18 @@ graph_setup(void)
{
int i, j;
+ static const struct rte_mbuf_dynfield graph_dynfield_desc = {
+ .name = "test_graph_dynfield",
+ .size = sizeof(GRAPH_FIELD_TYPE),
+ .align = __alignof__(GRAPH_FIELD_TYPE),
+ };
+ graph_dynfield_offset =
+ rte_mbuf_dynfield_register(&graph_dynfield_desc);
+ if (graph_dynfield_offset < 0) {
+ printf("Cannot register mbuf field\n");
+ return TEST_FAILED;
+ }
+
for (i = 0; i <= MAX_NODES; i++) {
for (j = 0; j < MBUFF_SIZE; j++)
mbuf_p[i][j] = &mbuf[i][j];
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (10 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 11/15] test/graph: switch user data " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 13/15] examples/bbdev: switch " Thomas Monjalon
` (2 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob
The order test stored the flow ID in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-eventdev/test_order_atq.c | 4 ++--
app/test-eventdev/test_order_common.c | 16 +++++++++++++++-
app/test-eventdev/test_order_common.h | 6 ++++++
app/test-eventdev/test_order_queue.c | 4 ++--
4 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c
index cfcb1dc4e9..4087c26fc5 100644
--- a/app/test-eventdev/test_order_atq.c
+++ b/app/test-eventdev/test_order_atq.c
@@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ ev.flow_id = FLOW_ID(ev.mbuf);
if (ev.sub_event_type == 0) { /* stage 0 from producer */
order_atq_process_stage_0(&ev);
@@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ ev[i].flow_id = FLOW_ID(ev[i].mbuf);
if (ev[i].sub_event_type == 0) { /*stage 0 */
order_atq_process_stage_0(&ev[i]);
diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
index dc55d93921..3721dbabd9 100644
--- a/app/test-eventdev/test_order_common.c
+++ b/app/test-eventdev/test_order_common.c
@@ -4,6 +4,8 @@
#include "test_order_common.h"
+int flow_id_dynfield_offset;
+
int
order_test_result(struct evt_test *test, struct evt_options *opt)
{
@@ -49,7 +51,7 @@ order_producer(void *arg)
const uint32_t flow = (uintptr_t)m % nb_flows;
/* Maintain seq number per flow */
m->seqn = producer_flow_seq[flow]++;
- m->udata64 = flow;
+ FLOW_ID(m) = flow;
ev.flow_id = flow;
ev.mbuf = m;
@@ -139,6 +141,18 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
{
void *test_order;
+ static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
+ .name = "test_event_dynfield_flow_id",
+ .size = sizeof(FLOW_ID_TYPE),
+ .align = __alignof__(FLOW_ID_TYPE),
+ };
+ flow_id_dynfield_offset =
+ rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
+ if (flow_id_dynfield_offset < 0) {
+ evt_err("failed to register mbuf field");
+ return -rte_errno;
+ }
+
test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
RTE_CACHE_LINE_SIZE, opt->socket_id);
if (test_order == NULL) {
diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index e0fe9c968a..e384856710 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -13,6 +13,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include "evt_common.h"
#include "evt_options.h"
@@ -20,6 +21,11 @@
#define BURST_SIZE 16
+extern int flow_id_dynfield_offset;
+#define FLOW_ID_TYPE uint32_t
+#define FLOW_ID(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ flow_id_dynfield_offset, FLOW_ID_TYPE *))
+
struct test_order;
struct worker_data {
diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c
index 1511c0092d..80c9c24af5 100644
--- a/app/test-eventdev/test_order_queue.c
+++ b/app/test-eventdev/test_order_queue.c
@@ -35,7 +35,7 @@ order_queue_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ ev.flow_id = FLOW_ID(ev.mbuf);
if (ev.queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev);
@@ -73,7 +73,7 @@ order_queue_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ ev[i].flow_id = FLOW_ID(ev[i].mbuf);
if (ev[i].queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev[i]);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (11 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 12/15] app/eventdev: switch flow ID " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 14/15] examples/rxtx_callbacks: " Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 15/15] mbuf: remove userdata field Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru
The example used the deprecated mbuf field udata64 as input mbuf pointer.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/bbdev_app/main.c | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index e512c807cd..e7918264d1 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -28,6 +28,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_log.h>
@@ -59,6 +60,11 @@
} \
} while (0)
+static int input_dynfield_offset;
+#define INPUT_FIELD_TYPE struct rte_mbuf *
+#define INPUT_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ input_dynfield_offset, INPUT_FIELD_TYPE *))
+
static const struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_NONE,
@@ -294,11 +300,11 @@ pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
}
static inline void
-pktmbuf_userdata_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
+pktmbuf_input_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
{
unsigned int i;
for (i = 0; i < nb_to_free; ++i) {
- struct rte_mbuf *rx_pkt = mbufs[i]->userdata;
+ struct rte_mbuf *rx_pkt = INPUT_FIELD(mbufs[i]);
rte_pktmbuf_free(rx_pkt);
rte_pktmbuf_free(mbufs[i]);
}
@@ -429,7 +435,7 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts)
uint16_t i;
for (i = 0; i < num_pkts; ++i) {
struct rte_mbuf *out = mbufs[i];
- struct rte_mbuf *in = out->userdata;
+ struct rte_mbuf *in = INPUT_FIELD(out);
if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *,
sizeof(struct rte_ether_hdr)),
@@ -731,7 +737,7 @@ run_encoding(struct lcore_conf *lcore_conf)
rte_pktmbuf_data_len(rx_pkts_burst[i]) -
sizeof(struct rte_ether_hdr);
/* save input mbuf pointer for later comparison */
- enc_out_pkts[i]->userdata = rx_pkts_burst[i];
+ INPUT_FIELD(enc_out_pkts[i]) = rx_pkts_burst[i];
/* copy ethernet header */
rte_pktmbuf_reset(enc_out_pkts[i]);
@@ -775,7 +781,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_enc_ops(bbdev_id, enc_queue_id,
bbdev_ops_burst, nb_rx);
if (unlikely(nb_enq < nb_rx)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_enq],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_enq],
nb_rx - nb_enq);
rte_bbdev_enc_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_rx - nb_enq);
@@ -805,7 +811,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_sent = rte_ring_enqueue_burst(enc_to_dec_ring, (void **)enc_out_pkts,
nb_deq, NULL);
if (unlikely(nb_sent < nb_deq)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_sent],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_sent],
nb_deq - nb_sent);
lcore_stats->enc_to_dec_lost_packets += nb_deq - nb_sent;
}
@@ -842,7 +848,7 @@ run_decoding(struct lcore_conf *lcore_conf)
if (unlikely(rte_bbdev_dec_op_alloc_bulk(bbdev_op_pool, bbdev_ops_burst,
nb_recv) != 0)) {
- pktmbuf_userdata_free_bulk(recv_pkts_burst, nb_recv);
+ pktmbuf_input_free_bulk(recv_pkts_burst, nb_recv);
lcore_stats->rx_lost_packets += nb_recv;
return;
}
@@ -871,7 +877,7 @@ run_decoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_dec_ops(bbdev_id, bbdev_queue_id,
bbdev_ops_burst, nb_recv);
if (unlikely(nb_enq < nb_recv)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_enq],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_enq],
nb_recv - nb_enq);
rte_bbdev_dec_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_recv - nb_enq);
@@ -898,12 +904,12 @@ run_decoding(struct lcore_conf *lcore_conf)
/* Free the RX mbufs after verification */
for (i = 0; i < nb_deq; ++i)
- rte_pktmbuf_free(recv_pkts_burst[i]->userdata);
+ rte_pktmbuf_free(INPUT_FIELD(recv_pkts_burst[i]));
/* Transmit the packets */
nb_tx = rte_eth_tx_burst(port_id, tx_queue_id, recv_pkts_burst, nb_deq);
if (unlikely(nb_tx < nb_deq)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_tx],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_tx],
nb_deq - nb_tx);
lcore_stats->tx_lost_packets += nb_deq - nb_tx;
}
@@ -1046,6 +1052,12 @@ main(int argc, char **argv)
bool stats_thread_started = false;
unsigned int main_lcore_id = rte_get_main_lcore();
+ static const struct rte_mbuf_dynfield input_dynfield_desc = {
+ .name = "example_bbdev_dynfield_input",
+ .size = sizeof(INPUT_FIELD_TYPE),
+ .align = __alignof__(INPUT_FIELD_TYPE),
+ };
+
rte_atomic16_init(&global_exit_flag);
sigret = signal(SIGTERM, signal_handler);
@@ -1115,6 +1127,12 @@ main(int argc, char **argv)
if (bbdev_mbuf_mempool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create ethdev mbuf mempool\n");
+ /* register mbuf field to store input pointer */
+ input_dynfield_offset =
+ rte_mbuf_dynfield_register(&input_dynfield_desc);
+ if (input_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize ports */
ret = initialize_ports(&app_params, ethdev_mbuf_mempool);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (12 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 13/15] examples/bbdev: switch " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 15/15] mbuf: remove userdata field Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, John McNamara
The example used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 ++--
examples/rxtx_callbacks/main.c | 20 ++++++++++++++++++--
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 62d1f39d7e..56c4293a1a 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -152,7 +152,7 @@ all packets received:
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TSC_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -179,7 +179,7 @@ packets prior to transmission:
unsigned i;
for (i = 0; i < nb_pkts; i++)
- cycles += now - pkts[i]->udata64;
+ cycles += now - TSC_FIELD(pkts[i]);
latency_numbers.total_cycles += cycles;
latency_numbers.total_pkts += nb_pkts;
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 6fe39546dd..db3412dafe 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -10,6 +10,7 @@
#include <rte_cycles.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#define RX_RING_SIZE 1024
#define TX_RING_SIZE 1024
@@ -18,6 +19,11 @@
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
+static int tsc_dynfield_offset;
+#define TSC_FIELD_TYPE uint64_t
+#define TSC_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ tsc_dynfield_offset, TSC_FIELD_TYPE *))
+
static const char usage[] =
"%s EAL_ARGS -- [-t]\n";
@@ -47,7 +53,7 @@ add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TSC_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -65,7 +71,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused,
rte_eth_read_clock(port, &ticks);
for (i = 0; i < nb_pkts; i++) {
- cycles += now - pkts[i]->udata64;
+ cycles += now - TSC_FIELD(pkts[i]);
if (hw_timestamping)
queue_ticks += ticks - pkts[i]->timestamp;
}
@@ -261,6 +267,11 @@ main(int argc, char *argv[])
};
int opt, option_index;
+ static const struct rte_mbuf_dynfield tsc_dynfield_desc = {
+ .name = "example_bbdev_dynfield_tsc",
+ .size = sizeof(TSC_FIELD_TYPE),
+ .align = __alignof__(TSC_FIELD_TYPE),
+ };
/* init EAL */
int ret = rte_eal_init(argc, argv);
@@ -292,6 +303,11 @@ main(int argc, char *argv[])
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
+ tsc_dynfield_offset =
+ rte_mbuf_dynfield_register(&tsc_dynfield_desc);
+ if (tsc_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize all ports */
RTE_ETH_FOREACH_DEV(portid)
if (port_init(portid, mbuf_pool) != 0)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v2 15/15] mbuf: remove userdata field
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
` (13 preceding siblings ...)
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 14/15] examples/rxtx_callbacks: " Thomas Monjalon
@ 2020-10-26 22:20 ` Thomas Monjalon
2020-10-27 10:53 ` Olivier Matz
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-26 22:20 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ray Kinsella, Neil Horman
As announced in the deprecation note, the field userdata / udata64
is removed to give more space to the dynamic fields.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +++
lib/librte_kni/rte_kni_common.h | 3 +--
lib/librte_mbuf/rte_mbuf_core.h | 8 +-------
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 2e082499b8..0f6f1df12a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,7 +87,6 @@ Deprecation Notices
The following static fields will be moved as dynamic:
- ``timestamp``
- - ``userdata`` / ``udata64``
- ``seqn``
As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index d8ac359e51..3cec526b6a 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -426,6 +426,9 @@ API Changes
the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
The field ``refcnt`` is remaining from the old unions.
+* mbuf: Removed the unioned fields ``userdata`` and ``udata64``
+ from the structure ``rte_mbuf``. It is replaced with dynamic fields.
+
* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
replaced with a private enum in the PCI subsystem.
diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
index 21b477f0aa..0db45e6a24 100644
--- a/lib/librte_kni/rte_kni_common.h
+++ b/lib/librte_kni/rte_kni_common.h
@@ -86,8 +86,7 @@ struct rte_kni_mbuf {
uint16_t data_len; /**< Amount of data in segment buffer. */
/* fields on second cache line */
- char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
- void *pool;
+ void *pool __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
void *next; /**< Physical address of next mbuf in kernel. */
};
diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index 065d87d28a..a65eaaf692 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -599,12 +599,6 @@ struct rte_mbuf {
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
- RTE_STD_C11
- union {
- void *userdata; /**< Can be used for external metadata */
- uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
- };
-
struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
struct rte_mbuf *next; /**< Next segment of scattered packet. */
@@ -662,7 +656,7 @@ struct rte_mbuf {
*/
struct rte_mbuf_ext_shared_info *shinfo;
- uint64_t dynfield1[2]; /**< Reserved for dynamic fields. */
+ uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */
} __rte_cache_aligned;
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 05/15] security: switch " Thomas Monjalon
@ 2020-10-27 2:01 ` Wang, Haiyue
2020-10-27 8:52 ` Thomas Monjalon
2020-10-27 10:05 ` Olivier Matz
1 sibling, 1 reply; 178+ messages in thread
From: Wang, Haiyue @ 2020-10-27 2:01 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: Yigit, Ferruh, david.marchand, Richardson, Bruce, olivier.matz,
andrew.rybchenko, akhil.goyal, Doherty, Declan, Ankur Dwivedi,
Anoob Joseph, Guo, Jia, Jerin Jacob, Nithin Dabilpuram,
Kiran Kumar K, Nicolau, Radu, Ray Kinsella, Neil Horman
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, October 27, 2020 06:20
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; david.marchand@redhat.com; Richardson, Bruce
> <bruce.richardson@intel.com>; olivier.matz@6wind.com; andrew.rybchenko@oktetlabs.ru;
> akhil.goyal@nxp.com; Doherty, Declan <declan.doherty@intel.com>; Ankur Dwivedi <adwivedi@marvell.com>;
> Anoob Joseph <anoobj@marvell.com>; Guo, Jia <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>;
> Jerin Jacob <jerinj@marvell.com>; Nithin Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar K
> <kirankumark@marvell.com>; Nicolau, Radu <radu.nicolau@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Neil
> Horman <nhorman@tuxdriver.com>
> Subject: [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
>
> The device-specific metadata was stored in the deprecated field udata64.
> It is moved to a dynamic mbuf field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> doc/guides/prog_guide/rte_security.rst | 9 +++---
> drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++-
> drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++-
> drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++--
> drivers/net/octeontx2/otx2_ethdev.h | 1 +
> drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++-
> drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
> drivers/net/octeontx2/otx2_rx.h | 2 +-
> examples/ipsec-secgw/ipsec-secgw.c | 9 +++---
> examples/ipsec-secgw/ipsec_worker.c | 12 ++++---
> lib/librte_security/rte_security.c | 22 +++++++++++++
> lib/librte_security/rte_security.h | 32 +++++++++++++++++++
> lib/librte_security/rte_security_driver.h | 3 ++
> lib/librte_security/version.map | 3 ++
> 14 files changed, 96 insertions(+), 20 deletions(-)
>
For ixgbe PMD,
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
But I feel that 'rte_security_dynfield' name is too generic, can it be
more specific about what the field is used for ?
Like below ;-)
#define RTE_SECURITY_DEV_METADATA(m) \
RTE_MBUF_DYNFIELD((m), \
rte_security_dev_metadata_offset, \
RTE_SECURITY_DEV_METADATA_TYPE *)
> +/**
> + * Get pointer to mbuf field for device-specific metadata.
> + *
> + * For performance reason, no check is done,
> + * the dynamic field may not be registered.
> + * @see rte_security_dynfield_is_registered
> + *
> + * @param mbuf packet to access
> + * @return pointer to mbuf field
> + */
> +static inline RTE_SECURITY_DYNFIELD_TYPE *
> +rte_security_dynfield(struct rte_mbuf *mbuf)
> +{
> + return RTE_MBUF_DYNFIELD(mbuf,
> + rte_security_dynfield_offset,
> + RTE_SECURITY_DYNFIELD_TYPE *);
> +}
> --
> 2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
@ 2020-10-27 4:44 ` Ajit Khaparde
2020-10-27 10:31 ` Olivier Matz
1 sibling, 0 replies; 178+ messages in thread
From: Ajit Khaparde @ 2020-10-27 4:44 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dpdk-dev, Ferruh Yigit, David Marchand, Bruce Richardson,
Olivier Matz, Andrew Rybchenko, Akhil Goyal, Somnath Kotur
On Mon, Oct 26, 2020 at 3:20 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The CFA code from mark was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Note: the new field has 32 bits, smaller than udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>
> ---
> drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++
> drivers/net/bnxt/bnxt_rxr.c | 2 +-
> drivers/net/bnxt/bnxt_rxr.h | 5 +++++
> drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++
> 4 files changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 1c7d1b758d..1090d28341 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -31,6 +31,7 @@
> #include "bnxt_nvm_defs.h"
> #include "bnxt_tf_common.h"
> #include "ulp_flow_db.h"
> +#include "rte_pmd_bnxt.h"
>
> #define DRV_MODULE_NAME "bnxt"
> static const char bnxt_version[] =
> @@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = {
> */
> #define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
>
> +int bnxt_cfa_code_dynfield_offset;
> +
> /*
> * max_num_kflows must be >= 32
> * and must be a power-of-2 supported value
> @@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
> pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF)
> bp->flags |= BNXT_FLAG_STINGRAY;
>
> + if (BNXT_TRUFLOW_EN(bp)) {
> + /* extra mbuf field is required to store CFA code from mark */
> + static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = {
> + .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME,
> + .size = sizeof(BNXT_CFA_CODE_DYNFIELD_TYPE),
> + .align = __alignof__(BNXT_CFA_CODE_DYNFIELD_TYPE),
> + };
> + bnxt_cfa_code_dynfield_offset =
> + rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc);
> + if (bnxt_cfa_code_dynfield_offset < 0) {
> + PMD_DRV_LOG(ERR,
> + "Failed to register mbuf field for TruFlow mark\n");
> + return -rte_errno;
> + }
> + }
> +
> rc = bnxt_init_board(eth_dev);
> if (rc) {
> PMD_DRV_LOG(ERR,
> diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
> index 039217fa60..7156ce7dd8 100644
> --- a/drivers/net/bnxt/bnxt_rxr.c
> +++ b/drivers/net/bnxt/bnxt_rxr.c
> @@ -606,7 +606,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
> return mark_id;
> /* Got the mark, write it to the mbuf and return */
> mbuf->hash.fdir.hi = mark_id;
> - mbuf->udata64 = (cfa_code & 0xffffffffull) << 32;
> + BNXT_CFA_CODE_DYNFIELD(mbuf) = cfa_code & 0xffffffffull;
> mbuf->hash.fdir.id = rxcmp1->cfa_code;
> mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
> return mark_id;
> diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
> index b874e54a8c..e01d3e4f18 100644
> --- a/drivers/net/bnxt/bnxt_rxr.h
> +++ b/drivers/net/bnxt/bnxt_rxr.h
> @@ -95,6 +95,11 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
> struct rx_pkt_cmpl_hi *rxcmp1,
> struct rte_mbuf *mbuf);
>
> +extern int bnxt_cfa_code_dynfield_offset;
> +#define BNXT_CFA_CODE_DYNFIELD_TYPE uint32_t
> +#define BNXT_CFA_CODE_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
> + bnxt_cfa_code_dynfield_offset, BNXT_CFA_CODE_DYNFIELD_TYPE *))
> +
> #define BNXT_RX_META_CFA_CODE_SHIFT 19
> #define BNXT_CFA_CODE_META_SHIFT 16
> #define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000
> diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
> index 81d0d0e032..8d3303bb0f 100644
> --- a/drivers/net/bnxt/rte_pmd_bnxt.h
> +++ b/drivers/net/bnxt/rte_pmd_bnxt.h
> @@ -9,6 +9,9 @@
> #include <rte_ethdev.h>
> #include <rte_ether.h>
>
> +/* mbuf dynfield where CFA code is stored */
> +#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
> +
> /*
> * Response sent back to the caller after callback
> */
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
2020-10-27 2:01 ` Wang, Haiyue
@ 2020-10-27 8:52 ` Thomas Monjalon
2020-10-27 13:12 ` Wang, Haiyue
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 8:52 UTC (permalink / raw)
To: Wang, Haiyue
Cc: dev, Yigit, Ferruh, david.marchand, Richardson, Bruce,
olivier.matz, andrew.rybchenko, akhil.goyal, Doherty, Declan,
Ankur Dwivedi, Anoob Joseph, Guo, Jia, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Nicolau, Radu, Ray Kinsella,
Neil Horman
27/10/2020 03:01, Wang, Haiyue:
> From: Thomas Monjalon <thomas@monjalon.net>
> For ixgbe PMD,
>
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>
>
> But I feel that 'rte_security_dynfield' name is too generic, can it be
> more specific about what the field is used for ?
>
> Like below ;-)
>
> #define RTE_SECURITY_DEV_METADATA(m) \
> RTE_MBUF_DYNFIELD((m), \
> rte_security_dev_metadata_offset, \
> RTE_SECURITY_DEV_METADATA_TYPE *)
Yes rte_security_dynfield is too much generic,
as well as RTE_SECURITY_DEV_METADATA.
It seems there are different data stored in this field.
We should have different fields for different data.
But such cleanup is another step for someone else.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
@ 2020-10-27 9:32 ` Olivier Matz
2020-10-27 9:34 ` Thomas Monjalon
2020-10-27 14:23 ` Nithin Dabilpuram
1 sibling, 1 reply; 178+ messages in thread
From: Olivier Matz @ 2020-10-27 9:32 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Nithin Dabilpuram,
Pavan Nikhilesh
Hi Thomas,
On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> lib/librte_node/ip4_lookup.c | 7 +++++++
> lib/librte_node/ip4_rewrite.c | 10 ++++++++++
> lib/librte_node/node_private.h | 12 ++++++++++--
> 3 files changed, 27 insertions(+), 2 deletions(-)
<...>
> --- a/lib/librte_node/node_private.h
> +++ b/lib/librte_node/node_private.h
> @@ -8,6 +8,7 @@
> #include <rte_common.h>
> #include <rte_log.h>
> #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
>
> extern int rte_node_logtype;
> #define NODE_LOG(level, node_name, ...) \
> @@ -21,7 +22,6 @@ extern int rte_node_logtype;
> #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
>
> /**
> - *
> * Node mbuf private data to store next hop, ttl and checksum.
> */
> struct node_mbuf_priv1 {
> @@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
> };
> };
>
> +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
> + .name = "rte_node_dynfield_priv1",
> + .size = sizeof(struct node_mbuf_priv1 *),
> + .align = __alignof__(struct node_mbuf_priv1 *),
> +};
> +extern int node_mbuf_priv1_dynfield_offset;
> +
It should be "struct node_mbuf_priv1", not "struct node_mbuf_priv1 *"
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 9:32 ` Olivier Matz
@ 2020-10-27 9:34 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 9:34 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Nithin Dabilpuram,
Pavan Nikhilesh
27/10/2020 10:32, Olivier Matz:
> On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> > +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
> > + .name = "rte_node_dynfield_priv1",
> > + .size = sizeof(struct node_mbuf_priv1 *),
> > + .align = __alignof__(struct node_mbuf_priv1 *),
> > +};
> > +extern int node_mbuf_priv1_dynfield_offset;
> > +
>
> It should be "struct node_mbuf_priv1", not "struct node_mbuf_priv1 *"
Yes, will fix in v3.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 05/15] security: switch " Thomas Monjalon
2020-10-27 2:01 ` Wang, Haiyue
@ 2020-10-27 10:05 ` Olivier Matz
2020-10-27 16:10 ` Thomas Monjalon
1 sibling, 1 reply; 178+ messages in thread
From: Olivier Matz @ 2020-10-27 10:05 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
On Mon, Oct 26, 2020 at 11:20:03PM +0100, Thomas Monjalon wrote:
> The device-specific metadata was stored in the deprecated field udata64.
> It is moved to a dynamic mbuf field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> doc/guides/prog_guide/rte_security.rst | 9 +++---
> drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++-
> drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++-
> drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++--
> drivers/net/octeontx2/otx2_ethdev.h | 1 +
> drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++-
> drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
> drivers/net/octeontx2/otx2_rx.h | 2 +-
> examples/ipsec-secgw/ipsec-secgw.c | 9 +++---
> examples/ipsec-secgw/ipsec_worker.c | 12 ++++---
> lib/librte_security/rte_security.c | 22 +++++++++++++
> lib/librte_security/rte_security.h | 32 +++++++++++++++++++
> lib/librte_security/rte_security_driver.h | 3 ++
> lib/librte_security/version.map | 3 ++
> 14 files changed, 96 insertions(+), 20 deletions(-)
>
<...>
> --- a/examples/ipsec-secgw/ipsec_worker.c
> +++ b/examples/ipsec-secgw/ipsec_worker.c
> @@ -208,7 +208,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
> "Inbound security offload failed\n");
> goto drop_pkt_and_exit;
> }
> - sa = pkt->userdata;
> + sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
> }
>
> /* Check if we have a match */
> @@ -226,7 +226,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
> "Inbound security offload failed\n");
> goto drop_pkt_and_exit;
> }
> - sa = pkt->userdata;
> + sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
> }
>
> /* Check if we have a match */
> @@ -357,7 +357,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
> }
>
> if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
> - pkt->userdata = sess->security.ses;
> + *(struct rte_security_session **)rte_security_dynfield(pkt) =
> + sess->security.ses;
>
> /* Mark the packet for Tx security offload */
> pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
> @@ -465,7 +466,10 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
> }
>
> /* Save security session */
> - pkt->userdata = sess_tbl[port_id];
> + if (rte_security_dynfield_is_registered())
> + *(struct rte_security_session **)
> + rte_security_dynfield(pkt) =
> + sess_tbl[port_id];
>
Maybe the last 2 lines can be on the same line (a bit more than 80,
but less than 100 chars).
This is not clear to me why you need to call
rte_security_dynfield_is_registered() here, and not in other places.
Would it make sense instead to always register the dynfield at some
place in rte_security, so that we are sure that as soon as we use
rte_security, the dynfield is registered. A good place would be an init
function, but I don't see one.
> /* Mark the packet for Tx security offload */
> pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
> diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
> index ee4666026a..4fb0b797e9 100644
> --- a/lib/librte_security/rte_security.c
> +++ b/lib/librte_security/rte_security.c
> @@ -23,6 +23,28 @@
> RTE_PTR_OR_ERR_RET(p1->p2->p3, last_retval); \
> } while (0)
>
> +#define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
> +int rte_security_dynfield_offset = -1;
> +
> +int
> +rte_security_dynfield_register(void)
> +{
> + static const struct rte_mbuf_dynfield dynfield_desc = {
> + .name = RTE_SECURITY_DYNFIELD_NAME,
> + .size = sizeof(RTE_SECURITY_DYNFIELD_TYPE),
> + .align = __alignof__(RTE_SECURITY_DYNFIELD_TYPE),
> + };
> + rte_security_dynfield_offset =
> + rte_mbuf_dynfield_register(&dynfield_desc);
> + return rte_security_dynfield_offset;
> +}
> +
> +bool
> +rte_security_dynfield_is_registered(void)
> +{
> + return rte_security_dynfield_offset >= 0;
> +}
> +
Wouldn't it be better to have it in a static inline function?
The point is just to check that offset is >= 0, and it is used
in data path.
> struct rte_security_session *
> rte_security_session_create(struct rte_security_ctx *instance,
> struct rte_security_session_conf *conf,
> diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
> index 271531af12..7fbdee99cc 100644
> --- a/lib/librte_security/rte_security.h
> +++ b/lib/librte_security/rte_security.h
> @@ -27,6 +27,7 @@ extern "C" {
> #include <rte_common.h>
> #include <rte_crypto.h>
> #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
> #include <rte_memory.h>
> #include <rte_mempool.h>
>
> @@ -451,6 +452,37 @@ int
> rte_security_session_destroy(struct rte_security_ctx *instance,
> struct rte_security_session *sess);
>
> +/** Device-specific metadata field type */
> +#define RTE_SECURITY_DYNFIELD_TYPE uint64_t
What about using a typedef instead of a #define?
It could be in lowercase: rte_security_dynfield_t
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-27 10:15 ` Olivier Matz
2020-10-27 16:14 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Olivier Matz @ 2020-10-27 10:15 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Harry van Haaren
On Mon, Oct 26, 2020 at 11:20:04PM +0100, Thomas Monjalon wrote:
> The test worker_loopback used the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> drivers/event/sw/sw_evdev_selftest.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
> index 5c7e527917..9af20cecf1 100644
> --- a/drivers/event/sw/sw_evdev_selftest.c
> +++ b/drivers/event/sw/sw_evdev_selftest.c
> @@ -40,6 +40,11 @@ struct test {
> uint32_t service_id;
> };
>
> +static int counter_dynfield_offset;
In general, I wonder if we shouldn't initialize offset to -1.
> +#define COUNTER_FIELD_TYPE uint8_t
Another general comment, I suggest to use a typedef instead of
a define when relevant.
> +#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
> + counter_dynfield_offset, COUNTER_FIELD_TYPE *))
> +
I'm not sure this comment applies here, but since it's a simple example,
it's a good place for another general comment. The RTE_MBUF_DYNFIELD()
macro is convenient because it can be used to set or get a value of any
type, but in my opinion it is not always easy to read:
RTE_MBUF_DYNFIELD(m, off, type) = value;
In some situations, having wrappers may make the code more readable:
static inline void mbuf_set_counter(struct rte_mbuf *m, counter_field_t counter);
static inline counter_field_t mbuf_get_counter(struct rte_mbuf *m);
static inline void mbuf_inc_counter(struct rte_mbuf *m);
> static struct rte_event release_ev;
>
> static inline struct rte_mbuf *
> @@ -2987,8 +2992,8 @@ worker_loopback_worker_fn(void *arg)
> }
>
> ev[i].queue_id = 0;
> - ev[i].mbuf->udata64++;
> - if (ev[i].mbuf->udata64 != 16) {
> + COUNTER_FIELD(ev[i].mbuf)++;
> + if (COUNTER_FIELD(ev[i].mbuf) != 16) {
> ev[i].op = RTE_EVENT_OP_FORWARD;
> enqd = rte_event_enqueue_burst(evdev, port,
> &ev[i], 1);
> @@ -3028,7 +3033,7 @@ worker_loopback_producer_fn(void *arg)
> m = rte_pktmbuf_alloc(t->mbuf_pool);
> } while (m == NULL);
>
> - m->udata64 = 0;
> + COUNTER_FIELD(m) = 0;
>
> struct rte_event ev = {
> .op = RTE_EVENT_OP_NEW,
> @@ -3061,6 +3066,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)
> int err;
> int w_lcore, p_lcore;
>
> + static const struct rte_mbuf_dynfield counter_dynfield_desc = {
> + .name = "rte_event_sw_dynfield_selftest_counter",
> + .size = sizeof(COUNTER_FIELD_TYPE),
> + .align = __alignof__(COUNTER_FIELD_TYPE),
> + };
> + counter_dynfield_offset =
> + rte_mbuf_dynfield_register(&counter_dynfield_desc);
> + if (counter_dynfield_offset < 0) {
> + printf("Error registering mbuf field\n");
> + return -rte_errno;
> + }
> +
> if (init(t, 8, 2) < 0 ||
> create_atomic_qids(t, 8) < 0) {
> printf("%d: Error initializing device\n", __LINE__);
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
2020-10-27 4:44 ` Ajit Khaparde
@ 2020-10-27 10:31 ` Olivier Matz
2020-10-27 16:22 ` Thomas Monjalon
1 sibling, 1 reply; 178+ messages in thread
From: Olivier Matz @ 2020-10-27 10:31 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Ajit Khaparde, Somnath Kotur
On Mon, Oct 26, 2020 at 11:20:06PM +0100, Thomas Monjalon wrote:
> The CFA code from mark was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Note: the new field has 32 bits, smaller than udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
How is it used by an application?
It seems that the cfa code is not always set. Is there a flag to
know when the field is valid?
Also, for ice and iavf PMDs, we were discussing what is the better
way to export the offset.
Note that there is an open discussion about how to export dynamic
fields offset for PMDs:
http://inbox.dpdk.org/dev/20201025071352.221953-1-haiyue.wang@intel.com/T/#mab79dd5cbb7d199a33515b7456dfe1831cf473bc
> ---
> drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++
> drivers/net/bnxt/bnxt_rxr.c | 2 +-
> drivers/net/bnxt/bnxt_rxr.h | 5 +++++
> drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++
> 4 files changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 1c7d1b758d..1090d28341 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -31,6 +31,7 @@
> #include "bnxt_nvm_defs.h"
> #include "bnxt_tf_common.h"
> #include "ulp_flow_db.h"
> +#include "rte_pmd_bnxt.h"
>
> #define DRV_MODULE_NAME "bnxt"
> static const char bnxt_version[] =
> @@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = {
> */
> #define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
>
> +int bnxt_cfa_code_dynfield_offset;
> +
> /*
> * max_num_kflows must be >= 32
> * and must be a power-of-2 supported value
> @@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
> pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF)
> bp->flags |= BNXT_FLAG_STINGRAY;
>
> + if (BNXT_TRUFLOW_EN(bp)) {
> + /* extra mbuf field is required to store CFA code from mark */
> + static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = {
> + .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME,
> + .size = sizeof(BNXT_CFA_CODE_DYNFIELD_TYPE),
> + .align = __alignof__(BNXT_CFA_CODE_DYNFIELD_TYPE),
> + };
> + bnxt_cfa_code_dynfield_offset =
> + rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc);
> + if (bnxt_cfa_code_dynfield_offset < 0) {
> + PMD_DRV_LOG(ERR,
> + "Failed to register mbuf field for TruFlow mark\n");
> + return -rte_errno;
> + }
> + }
> +
> rc = bnxt_init_board(eth_dev);
> if (rc) {
> PMD_DRV_LOG(ERR,
> diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
> index 039217fa60..7156ce7dd8 100644
> --- a/drivers/net/bnxt/bnxt_rxr.c
> +++ b/drivers/net/bnxt/bnxt_rxr.c
> @@ -606,7 +606,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
> return mark_id;
> /* Got the mark, write it to the mbuf and return */
> mbuf->hash.fdir.hi = mark_id;
> - mbuf->udata64 = (cfa_code & 0xffffffffull) << 32;
> + BNXT_CFA_CODE_DYNFIELD(mbuf) = cfa_code & 0xffffffffull;
> mbuf->hash.fdir.id = rxcmp1->cfa_code;
> mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
> return mark_id;
> diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
> index b874e54a8c..e01d3e4f18 100644
> --- a/drivers/net/bnxt/bnxt_rxr.h
> +++ b/drivers/net/bnxt/bnxt_rxr.h
> @@ -95,6 +95,11 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
> struct rx_pkt_cmpl_hi *rxcmp1,
> struct rte_mbuf *mbuf);
>
> +extern int bnxt_cfa_code_dynfield_offset;
> +#define BNXT_CFA_CODE_DYNFIELD_TYPE uint32_t
> +#define BNXT_CFA_CODE_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
> + bnxt_cfa_code_dynfield_offset, BNXT_CFA_CODE_DYNFIELD_TYPE *))
> +
> #define BNXT_RX_META_CFA_CODE_SHIFT 19
> #define BNXT_CFA_CODE_META_SHIFT 16
> #define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000
> diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
> index 81d0d0e032..8d3303bb0f 100644
> --- a/drivers/net/bnxt/rte_pmd_bnxt.h
> +++ b/drivers/net/bnxt/rte_pmd_bnxt.h
> @@ -9,6 +9,9 @@
> #include <rte_ethdev.h>
> #include <rte_ether.h>
>
> +/* mbuf dynfield where CFA code is stored */
> +#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
> +
> /*
> * Response sent back to the caller after callback
> */
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
@ 2020-10-27 10:45 ` Olivier Matz
2020-10-27 16:25 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Olivier Matz @ 2020-10-27 10:45 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Yong Wang
On Mon, Oct 26, 2020 at 11:20:07PM +0100, Thomas Monjalon wrote:
> The segment count, used for MSS guess,
> was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
After seeing this commit, I wonder if we shouldn't introduce an
enhancement in the dynamic field API.
Previously, the driver used udata64 only internally, so without any
risk. The risky usages of udata64 were when the mbuf goes out of a
module.
Changing to dynamic field makes the code safe for any use, but consumes
more memory.
I wonder if we shouldn't (later) introduce a flag RTE_MBUF_DYN_F_SHARED,
or something similar, to say that this field is only used inside a
module, and that its memory can be shared with other dynamic fields.
> ---
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
> drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++++++
> drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++----
> 3 files changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> index 6920ab568c..6e99b67b5a 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> @@ -59,6 +59,8 @@
> DEV_RX_OFFLOAD_JUMBO_FRAME | \
> DEV_RX_OFFLOAD_RSS_HASH)
>
> +int vmxnet3_segs_dynfield_offset;
> +
> static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
> static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
> static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
> @@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
> struct vmxnet3_hw *hw = eth_dev->data->dev_private;
> uint32_t mac_hi, mac_lo, ver;
> struct rte_eth_link link;
> + static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
> + .name = VMXNET3_SEGS_DYNFIELD_NAME,
> + .size = sizeof(VMXNET3_SEGS_DYNFIELD_TYPE),
> + .align = __alignof__(VMXNET3_SEGS_DYNFIELD_TYPE),
> + };
>
> PMD_INIT_FUNC_TRACE();
>
> @@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
> eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
> pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
>
> + /* extra mbuf field is required to guess MSS */
> + vmxnet3_segs_dynfield_offset =
> + rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
> + if (vmxnet3_segs_dynfield_offset < 0) {
> + PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
> + return -rte_errno;
> + }
> +
> /*
> * for secondary processes, we don't initialize any further as primary
> * has already done this work.
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
> index dd685b02b7..e35edf07be 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
> @@ -193,4 +193,10 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> uint16_t nb_pkts);
>
> +extern int vmxnet3_segs_dynfield_offset;
> +#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs"
> +#define VMXNET3_SEGS_DYNFIELD_TYPE uint8_t
> +#define VMXNET3_SEGS_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(rxm, \
> + vmxnet3_segs_dynfield_offset, VMXNET3_SEGS_DYNFIELD_TYPE *))
> +
> #endif /* _VMXNET3_ETHDEV_H_ */
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index e10f9ee870..2b0e2e6f19 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
> struct rte_ipv6_hdr *ipv6_hdr;
> struct rte_tcp_hdr *tcp_hdr;
> char *ptr;
> + uint8_t segs;
>
> RTE_ASSERT(rcd->tcp);
>
> @@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
> tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
> hlen += (tcp_hdr->data_off & 0xf0) >> 2;
>
> - if (rxm->udata64 > 1)
> - return (rte_pktmbuf_pkt_len(rxm) - hlen +
> - rxm->udata64 - 1) / rxm->udata64;
> + segs = VMXNET3_SEGS_DYNFIELD(rxm);
> + if (segs > 1)
> + return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
> else
> return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
> }
> @@ -737,7 +738,7 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
> (const Vmxnet3_RxCompDescExt *)rcd;
>
> rxm->tso_segsz = rcde->mss;
> - rxm->udata64 = rcde->segCnt;
> + VMXNET3_SEGS_DYNFIELD(rxm) = rcde->segCnt;
> ol_flags |= PKT_RX_LRO;
> }
> } else { /* Offloads set in eop */
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 15/15] mbuf: remove userdata field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 15/15] mbuf: remove userdata field Thomas Monjalon
@ 2020-10-27 10:53 ` Olivier Matz
0 siblings, 0 replies; 178+ messages in thread
From: Olivier Matz @ 2020-10-27 10:53 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Ray Kinsella, Neil Horman
On Mon, Oct 26, 2020 at 11:20:13PM +0100, Thomas Monjalon wrote:
> As announced in the deprecation note, the field userdata / udata64
> is removed to give more space to the dynamic fields.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets
2020-10-26 5:20 ` [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-26 14:23 ` Andrew Rybchenko
@ 2020-10-27 11:32 ` Bruce Richardson
1 sibling, 0 replies; 178+ messages in thread
From: Bruce Richardson @ 2020-10-27 11:32 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru, Chas Williams,
Min Hu (Connor),
Xiaoyun Li
On Mon, Oct 26, 2020 at 06:20:51AM +0100, Thomas Monjalon wrote:
> In examples, DPDK header files are external,
> so they must be enclosed with angle brackets, not quotes.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> examples/bbdev_app/main.c | 30 +++++++++++++-------------
> examples/bond/main.c | 11 ++++------
> examples/tep_termination/vxlan_setup.c | 2 +-
> 3 files changed, 20 insertions(+), 23 deletions(-)
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH 02/15] kni: move header file from EAL
2020-10-26 5:20 ` [dpdk-dev] [PATCH 02/15] kni: move header file from EAL Thomas Monjalon
2020-10-26 14:25 ` Andrew Rybchenko
@ 2020-10-27 11:33 ` Bruce Richardson
1 sibling, 0 replies; 178+ messages in thread
From: Bruce Richardson @ 2020-10-27 11:33 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, olivier.matz,
andrew.rybchenko, akhil.goyal
On Mon, Oct 26, 2020 at 06:20:52AM +0100, Thomas Monjalon wrote:
> Since the kernel module is not part of EAL anymore,
> there is no need to have the common KNI header file in EAL.
> The file rte_kni_common.h is moved to librte_kni.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> kernel/linux/kni/meson.build | 2 +-
> lib/librte_eal/linux/include/meson.build | 1 -
> lib/librte_kni/meson.build | 2 +-
> lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h | 0
> 4 files changed, 2 insertions(+), 3 deletions(-)
> rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (100%)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
2020-10-27 8:52 ` Thomas Monjalon
@ 2020-10-27 13:12 ` Wang, Haiyue
0 siblings, 0 replies; 178+ messages in thread
From: Wang, Haiyue @ 2020-10-27 13:12 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Yigit, Ferruh, david.marchand, Richardson, Bruce,
olivier.matz, andrew.rybchenko, akhil.goyal, Doherty, Declan,
Ankur Dwivedi, Anoob Joseph, Guo, Jia, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Nicolau, Radu, Ray Kinsella,
Neil Horman
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, October 27, 2020 16:52
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; david.marchand@redhat.com; Richardson, Bruce
> <bruce.richardson@intel.com>; olivier.matz@6wind.com; andrew.rybchenko@oktetlabs.ru;
> akhil.goyal@nxp.com; Doherty, Declan <declan.doherty@intel.com>; Ankur Dwivedi <adwivedi@marvell.com>;
> Anoob Joseph <anoobj@marvell.com>; Guo, Jia <jia.guo@intel.com>; Jerin Jacob <jerinj@marvell.com>;
> Nithin Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar K <kirankumark@marvell.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; Ray Kinsella <mdr@ashroe.eu>; Neil Horman <nhorman@tuxdriver.com>
> Subject: Re: [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
>
> 27/10/2020 03:01, Wang, Haiyue:
> > From: Thomas Monjalon <thomas@monjalon.net>
> > For ixgbe PMD,
> >
> > Acked-by: Haiyue Wang <haiyue.wang@intel.com>
> >
> > But I feel that 'rte_security_dynfield' name is too generic, can it be
> > more specific about what the field is used for ?
> >
> > Like below ;-)
> >
> > #define RTE_SECURITY_DEV_METADATA(m) \
> > RTE_MBUF_DYNFIELD((m), \
> > rte_security_dev_metadata_offset, \
> > RTE_SECURITY_DEV_METADATA_TYPE *)
>
> Yes rte_security_dynfield is too much generic,
> as well as RTE_SECURITY_DEV_METADATA.
> It seems there are different data stored in this field.
> We should have different fields for different data.
> But such cleanup is another step for someone else.
Understood, thanks, then 'DEV_METADATA' is also generic.
>
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
2020-10-27 9:32 ` Olivier Matz
@ 2020-10-27 14:23 ` Nithin Dabilpuram
2020-10-27 14:33 ` Thomas Monjalon
1 sibling, 1 reply; 178+ messages in thread
From: Nithin Dabilpuram @ 2020-10-27 14:23 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, andrew.rybchenko, akhil.goyal, Pavan Nikhilesh
On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> lib/librte_node/ip4_lookup.c | 7 +++++++
> lib/librte_node/ip4_rewrite.c | 10 ++++++++++
> lib/librte_node/node_private.h | 12 ++++++++++--
> 3 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
> index 8835aab9dd..c2f6d653f9 100644
> --- a/lib/librte_node/ip4_lookup.c
> +++ b/lib/librte_node/ip4_lookup.c
> @@ -21,6 +21,8 @@
>
> #include "node_private.h"
>
> +int node_mbuf_priv1_dynfield_offset;
> +
This change doesn't work in secondary as it is process local memory.
> #define IPV4_L3FWD_LPM_MAX_RULES 1024
> #define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)
>
> @@ -178,6 +180,11 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
> RTE_SET_USED(node);
>
> if (!init_once) {
> + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
> + &node_mbuf_priv1_dynfield_desc);
> + if (node_mbuf_priv1_dynfield_offset < 0)
> + return -rte_errno;
> +
> /* Setup LPM tables for all sockets */
> RTE_LCORE_FOREACH(lcore_id)
> {
> diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c
> index bb7f671b5c..1c4e51968c 100644
> --- a/lib/librte_node/ip4_rewrite.c
> +++ b/lib/librte_node/ip4_rewrite.c
> @@ -248,9 +248,19 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
> static int
> ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
> {
> + static bool init_once;
>
> RTE_SET_USED(graph);
> RTE_SET_USED(node);
> +
> + if (!init_once) {
> + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
> + &node_mbuf_priv1_dynfield_desc);
> + if (node_mbuf_priv1_dynfield_offset < 0)
> + return -rte_errno;
> + init_once = true;
> + }
> +
> node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
>
> return 0;
> diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
> index ab7941c12b..359b40faed 100644
> --- a/lib/librte_node/node_private.h
> +++ b/lib/librte_node/node_private.h
> @@ -8,6 +8,7 @@
> #include <rte_common.h>
> #include <rte_log.h>
> #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
>
> extern int rte_node_logtype;
> #define NODE_LOG(level, node_name, ...) \
> @@ -21,7 +22,6 @@ extern int rte_node_logtype;
> #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
>
> /**
> - *
> * Node mbuf private data to store next hop, ttl and checksum.
> */
> struct node_mbuf_priv1 {
> @@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
> };
> };
>
> +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
> + .name = "rte_node_dynfield_priv1",
> + .size = sizeof(struct node_mbuf_priv1 *),
> + .align = __alignof__(struct node_mbuf_priv1 *),
> +};
> +extern int node_mbuf_priv1_dynfield_offset;
> +
> /**
> * Node mbuf private area 2.
> */
> @@ -60,7 +67,8 @@ struct node_mbuf_priv2 {
> static __rte_always_inline struct node_mbuf_priv1 *
> node_mbuf_priv1(struct rte_mbuf *m)
> {
> - return (struct node_mbuf_priv1 *)&m->udata64;
> + return RTE_MBUF_DYNFIELD(m,
> + node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *);
There is a performance regression of ~1.4% in our platform (Octeontx2) because
of this change.
> }
>
> /**
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 14:23 ` Nithin Dabilpuram
@ 2020-10-27 14:33 ` Thomas Monjalon
2020-10-27 15:33 ` Nithin Dabilpuram
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 14:33 UTC (permalink / raw)
To: Nithin Dabilpuram
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, andrew.rybchenko, akhil.goyal, Pavan Nikhilesh
27/10/2020 15:23, Nithin Dabilpuram:
> On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> > --- a/lib/librte_node/ip4_lookup.c
> > +++ b/lib/librte_node/ip4_lookup.c
> > +int node_mbuf_priv1_dynfield_offset;
> > +
>
> This change doesn't work in secondary as it is process local memory.
Yes that's an issue.
Can we copy the value when starting a secondary process?
[...]
> > static __rte_always_inline struct node_mbuf_priv1 *
> > node_mbuf_priv1(struct rte_mbuf *m)
> > {
> > - return (struct node_mbuf_priv1 *)&m->udata64;
> > + return RTE_MBUF_DYNFIELD(m,
> > + node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *);
>
> There is a performance regression of ~1.4% in our platform (Octeontx2) because
> of this change.
Yes that's the price to pay for a more extensible DPDK.
It is much cheaper than not having room for new features,
or having features conflicting on the same mbuf field like here.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data Thomas Monjalon
@ 2020-10-27 15:32 ` Ed Czeck
2020-10-27 15:55 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Ed Czeck @ 2020-10-27 15:32 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Ferruh Yigit, david.marchand, Richardson, Bruce,
Olivier MATZ, andrew.rybchenko, akhil.goyal, Shepard Siegel,
John Miller
HI Thomas,
Atomic Rules will be submitting a patch to connect user_data into the
mbuf stuct using
the dynfield interface restoring lost functionality from this patch.
You can expect a patch in the next few days. Are you targeting this
patch series for the 20.11 release?
Thanks
Ed.
On Mon, Oct 26, 2020 at 6:20 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The second field of metadata is reserved for user data
> which is a deprecated mbuf field.
> The usage of mbuf udata64 is removed
> and the corresponding ark metadata field is annotated as ignored.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> drivers/net/ark/ark_ddm.h | 2 +-
> drivers/net/ark/ark_ethdev_rx.c | 1 -
> drivers/net/ark/ark_ethdev_tx.c | 1 -
> drivers/net/ark/ark_udm.h | 2 +-
> 4 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ark/ark_ddm.h b/drivers/net/ark/ark_ddm.h
> index 5456b4b5cc..99eded8524 100644
> --- a/drivers/net/ark/ark_ddm.h
> +++ b/drivers/net/ark/ark_ddm.h
> @@ -19,7 +19,7 @@
> /* struct defining Tx meta data -- fixed in FPGA -- 16 bytes */
> struct ark_tx_meta {
> uint64_t physaddr;
> - uint32_t user1;
> + uint32_t user1; /* ignored */
> uint16_t data_len; /* of this MBUF */
> #define ARK_DDM_EOP 0x01
> #define ARK_DDM_SOP 0x02
> diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
> index 2f8d05099c..5ead67e6b8 100644
> --- a/drivers/net/ark/ark_ethdev_rx.c
> +++ b/drivers/net/ark/ark_ethdev_rx.c
> @@ -272,7 +272,6 @@ eth_ark_recv_pkts(void *rx_queue,
> mbuf->pkt_len = meta->pkt_len;
> mbuf->data_len = meta->pkt_len;
> mbuf->timestamp = meta->timestamp;
> - mbuf->udata64 = meta->user_data;
>
> if (ARK_DEBUG_CORE) { /* debug sanity checks */
> if ((meta->pkt_len > (1024 * 16)) ||
> diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
> index a0e35af880..8a0a9381f7 100644
> --- a/drivers/net/ark/ark_ethdev_tx.c
> +++ b/drivers/net/ark/ark_ethdev_tx.c
> @@ -70,7 +70,6 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
> uint8_t flags)
> {
> meta->physaddr = rte_mbuf_data_iova(mbuf);
> - meta->user1 = (uint32_t)mbuf->udata64;
> meta->data_len = rte_pktmbuf_data_len(mbuf);
> meta->flags = flags;
> }
> diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
> index 5846c825b8..ba436ee25b 100644
> --- a/drivers/net/ark/ark_udm.h
> +++ b/drivers/net/ark/ark_udm.h
> @@ -18,7 +18,7 @@
> /* Meta data structure apssed from FPGA, must match layout in FPGA */
> struct ark_rx_meta {
> uint64_t timestamp;
> - uint64_t user_data;
> + uint64_t user_data; /* ignored */
> uint8_t port;
> uint8_t dst_queue;
> uint16_t pkt_len;
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 14:33 ` Thomas Monjalon
@ 2020-10-27 15:33 ` Nithin Dabilpuram
2020-10-27 15:57 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Nithin Dabilpuram @ 2020-10-27 15:33 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, andrew.rybchenko, akhil.goyal, Pavan Nikhilesh
On Tue, Oct 27, 2020 at 03:33:35PM +0100, Thomas Monjalon wrote:
> 27/10/2020 15:23, Nithin Dabilpuram:
> > On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> > > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > > It is moved to a dynamic field in order to allow removal of udata64.
> > >
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > ---
> > > --- a/lib/librte_node/ip4_lookup.c
> > > +++ b/lib/librte_node/ip4_lookup.c
> > > +int node_mbuf_priv1_dynfield_offset;
> > > +
> >
> > This change doesn't work in secondary as it is process local memory.
>
> Yes that's an issue.
> Can we copy the value when starting a secondary process?
Currently there is no call back which will be called only in secondary.
Can you move this value to node->ctx 8'th byte offset ? Node context is of size
16 bytes and should be sufficient.
Currently first 8 B of node->ctx is used to store that socket's lpm pointer.
>
> [...]
> > > static __rte_always_inline struct node_mbuf_priv1 *
> > > node_mbuf_priv1(struct rte_mbuf *m)
> > > {
> > > - return (struct node_mbuf_priv1 *)&m->udata64;
> > > + return RTE_MBUF_DYNFIELD(m,
> > > + node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *);
> >
> > There is a performance regression of ~1.4% in our platform (Octeontx2) because
> > of this change.
>
> Yes that's the price to pay for a more extensible DPDK.
> It is much cheaper than not having room for new features,
> or having features conflicting on the same mbuf field like here.
>
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data
2020-10-27 15:32 ` Ed Czeck
@ 2020-10-27 15:55 ` Thomas Monjalon
2020-10-27 16:05 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 15:55 UTC (permalink / raw)
To: Ed Czeck
Cc: dev, Ferruh Yigit, david.marchand, Richardson, Bruce,
Olivier MATZ, andrew.rybchenko, akhil.goyal, Shepard Siegel,
John Miller
27/10/2020 16:32, Ed Czeck:
> HI Thomas,
> Atomic Rules will be submitting a patch to connect user_data into the
> mbuf stuct using
> the dynfield interface restoring lost functionality from this patch.
I don't understand what you are looking for.
The user data has no meaning, and is removed.
Please explain your use case and what you need.
Does it mean you ack this patch?
> You can expect a patch in the next few days. Are you targeting this
> patch series for the 20.11 release?
Yes 20.11-rc2 (this week) is the target.
> On Mon, Oct 26, 2020 at 6:20 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > The second field of metadata is reserved for user data
> > which is a deprecated mbuf field.
> > The usage of mbuf udata64 is removed
> > and the corresponding ark metadata field is annotated as ignored.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> > drivers/net/ark/ark_ddm.h | 2 +-
> > drivers/net/ark/ark_ethdev_rx.c | 1 -
> > drivers/net/ark/ark_ethdev_tx.c | 1 -
> > drivers/net/ark/ark_udm.h | 2 +-
> > 4 files changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ark/ark_ddm.h b/drivers/net/ark/ark_ddm.h
> > index 5456b4b5cc..99eded8524 100644
> > --- a/drivers/net/ark/ark_ddm.h
> > +++ b/drivers/net/ark/ark_ddm.h
> > @@ -19,7 +19,7 @@
> > /* struct defining Tx meta data -- fixed in FPGA -- 16 bytes */
> > struct ark_tx_meta {
> > uint64_t physaddr;
> > - uint32_t user1;
> > + uint32_t user1; /* ignored */
> > uint16_t data_len; /* of this MBUF */
> > #define ARK_DDM_EOP 0x01
> > #define ARK_DDM_SOP 0x02
> > diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
> > index 2f8d05099c..5ead67e6b8 100644
> > --- a/drivers/net/ark/ark_ethdev_rx.c
> > +++ b/drivers/net/ark/ark_ethdev_rx.c
> > @@ -272,7 +272,6 @@ eth_ark_recv_pkts(void *rx_queue,
> > mbuf->pkt_len = meta->pkt_len;
> > mbuf->data_len = meta->pkt_len;
> > mbuf->timestamp = meta->timestamp;
> > - mbuf->udata64 = meta->user_data;
> >
> > if (ARK_DEBUG_CORE) { /* debug sanity checks */
> > if ((meta->pkt_len > (1024 * 16)) ||
> > diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
> > index a0e35af880..8a0a9381f7 100644
> > --- a/drivers/net/ark/ark_ethdev_tx.c
> > +++ b/drivers/net/ark/ark_ethdev_tx.c
> > @@ -70,7 +70,6 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
> > uint8_t flags)
> > {
> > meta->physaddr = rte_mbuf_data_iova(mbuf);
> > - meta->user1 = (uint32_t)mbuf->udata64;
> > meta->data_len = rte_pktmbuf_data_len(mbuf);
> > meta->flags = flags;
> > }
> > diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
> > index 5846c825b8..ba436ee25b 100644
> > --- a/drivers/net/ark/ark_udm.h
> > +++ b/drivers/net/ark/ark_udm.h
> > @@ -18,7 +18,7 @@
> > /* Meta data structure apssed from FPGA, must match layout in FPGA */
> > struct ark_rx_meta {
> > uint64_t timestamp;
> > - uint64_t user_data;
> > + uint64_t user_data; /* ignored */
> > uint8_t port;
> > uint8_t dst_queue;
> > uint16_t pkt_len;
> > --
> > 2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 15:33 ` Nithin Dabilpuram
@ 2020-10-27 15:57 ` Thomas Monjalon
2020-10-27 16:16 ` Nithin Dabilpuram
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 15:57 UTC (permalink / raw)
To: Nithin Dabilpuram
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, andrew.rybchenko, akhil.goyal, Pavan Nikhilesh
27/10/2020 16:33, Nithin Dabilpuram:
> On Tue, Oct 27, 2020 at 03:33:35PM +0100, Thomas Monjalon wrote:
> > 27/10/2020 15:23, Nithin Dabilpuram:
> > > On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> > > > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > > > It is moved to a dynamic field in order to allow removal of udata64.
> > > >
> > > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > > ---
> > > > --- a/lib/librte_node/ip4_lookup.c
> > > > +++ b/lib/librte_node/ip4_lookup.c
> > > > +int node_mbuf_priv1_dynfield_offset;
> > > > +
> > >
> > > This change doesn't work in secondary as it is process local memory.
> >
> > Yes that's an issue.
> > Can we copy the value when starting a secondary process?
>
> Currently there is no call back which will be called only in secondary.
>
> Can you move this value to node->ctx 8'th byte offset ? Node context is of size
> 16 bytes and should be sufficient.
> Currently first 8 B of node->ctx is used to store that socket's lpm pointer.
Please would you be able to do such patch?
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data
2020-10-27 15:55 ` Thomas Monjalon
@ 2020-10-27 16:05 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 16:05 UTC (permalink / raw)
To: Ed Czeck
Cc: dev, Ferruh Yigit, david.marchand, Richardson, Bruce,
Olivier MATZ, andrew.rybchenko, akhil.goyal, Shepard Siegel,
John Miller, Thomas Monjalon
27/10/2020 16:55, Thomas Monjalon:
> 27/10/2020 16:32, Ed Czeck:
> > HI Thomas,
> > Atomic Rules will be submitting a patch to connect user_data into the
> > mbuf stuct using
> > the dynfield interface restoring lost functionality from this patch.
>
> I don't understand what you are looking for.
> The user data has no meaning, and is removed.
> Please explain your use case and what you need.
>
> Does it mean you ack this patch?
>
> > You can expect a patch in the next few days. Are you targeting this
> > patch series for the 20.11 release?
>
> Yes 20.11-rc2 (this week) is the target.
Please be aware that seqn field could be removed as well.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/15] security: switch metadata to dynamic mbuf field
2020-10-27 10:05 ` Olivier Matz
@ 2020-10-27 16:10 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 16:10 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Declan Doherty, Ankur Dwivedi,
Anoob Joseph, Jeff Guo, Haiyue Wang, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
27/10/2020 11:05, Olivier Matz:
> On Mon, Oct 26, 2020 at 11:20:03PM +0100, Thomas Monjalon wrote:
> > The device-specific metadata was stored in the deprecated field udata64.
> > It is moved to a dynamic mbuf field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> <...>
> > /* Save security session */
> > - pkt->userdata = sess_tbl[port_id];
> > + if (rte_security_dynfield_is_registered())
> > + *(struct rte_security_session **)
> > + rte_security_dynfield(pkt) =
> > + sess_tbl[port_id];
> >
>
> Maybe the last 2 lines can be on the same line (a bit more than 80,
> but less than 100 chars).
I prefer limiting to 80 if possible.
> This is not clear to me why you need to call
> rte_security_dynfield_is_registered() here, and not in other places.
I think other places are paths for rte_security only.
> Would it make sense instead to always register the dynfield at some
> place in rte_security, so that we are sure that as soon as we use
> rte_security, the dynfield is registered. A good place would be an init
> function, but I don't see one.
Indeed there is no such place in rte_security.
I keep thinking this is not a real library.
> > +bool
> > +rte_security_dynfield_is_registered(void)
> > +{
> > + return rte_security_dynfield_offset >= 0;
> > +}
> > +
>
> Wouldn't it be better to have it in a static inline function?
> The point is just to check that offset is >= 0, and it is used
> in data path.
Yes I'll make it inline
> > +/** Device-specific metadata field type */
> > +#define RTE_SECURITY_DYNFIELD_TYPE uint64_t
>
> What about using a typedef instead of a #define?
> It could be in lowercase: rte_security_dynfield_t
Yes
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-27 10:15 ` Olivier Matz
@ 2020-10-27 16:14 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 16:14 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Harry van Haaren
27/10/2020 11:15, Olivier Matz:
> On Mon, Oct 26, 2020 at 11:20:04PM +0100, Thomas Monjalon wrote:
> > The test worker_loopback used the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > ---
[...]
> > +static int counter_dynfield_offset;
>
> In general, I wonder if we shouldn't initialize offset to -1.
Yes good idea.
> > +#define COUNTER_FIELD_TYPE uint8_t
>
> Another general comment, I suggest to use a typedef instead of
> a define when relevant.
Yes
> > +#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
> > + counter_dynfield_offset, COUNTER_FIELD_TYPE *))
> > +
>
> I'm not sure this comment applies here, but since it's a simple example,
> it's a good place for another general comment. The RTE_MBUF_DYNFIELD()
> macro is convenient because it can be used to set or get a value of any
> type, but in my opinion it is not always easy to read:
>
> RTE_MBUF_DYNFIELD(m, off, type) = value;
>
> In some situations, having wrappers may make the code more readable:
>
> static inline void mbuf_set_counter(struct rte_mbuf *m, counter_field_t counter);
> static inline counter_field_t mbuf_get_counter(struct rte_mbuf *m);
> static inline void mbuf_inc_counter(struct rte_mbuf *m);
I agree, I will add some wrapper functions.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 15:57 ` Thomas Monjalon
@ 2020-10-27 16:16 ` Nithin Dabilpuram
2020-10-27 16:26 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Nithin Dabilpuram @ 2020-10-27 16:16 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, andrew.rybchenko, akhil.goyal, Pavan Nikhilesh
On Tue, Oct 27, 2020 at 04:57:16PM +0100, Thomas Monjalon wrote:
> 27/10/2020 16:33, Nithin Dabilpuram:
> > On Tue, Oct 27, 2020 at 03:33:35PM +0100, Thomas Monjalon wrote:
> > > 27/10/2020 15:23, Nithin Dabilpuram:
> > > > On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> > > > > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > > > > It is moved to a dynamic field in order to allow removal of udata64.
> > > > >
> > > > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > > > ---
> > > > > --- a/lib/librte_node/ip4_lookup.c
> > > > > +++ b/lib/librte_node/ip4_lookup.c
> > > > > +int node_mbuf_priv1_dynfield_offset;
> > > > > +
> > > >
> > > > This change doesn't work in secondary as it is process local memory.
> > >
> > > Yes that's an issue.
> > > Can we copy the value when starting a secondary process?
> >
> > Currently there is no call back which will be called only in secondary.
> >
> > Can you move this value to node->ctx 8'th byte offset ? Node context is of size
> > 16 bytes and should be sufficient.
> > Currently first 8 B of node->ctx is used to store that socket's lpm pointer.
>
> Please would you be able to do such patch?
Ack, will send a patch on this thread so that you can include in next version.
>
>
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-27 10:31 ` Olivier Matz
@ 2020-10-27 16:22 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 16:22 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Ajit Khaparde, Somnath Kotur
27/10/2020 11:31, Olivier Matz:
> On Mon, Oct 26, 2020 at 11:20:06PM +0100, Thomas Monjalon wrote:
> > The CFA code from mark was stored in the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Note: the new field has 32 bits, smaller than udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>
> How is it used by an application?
> It seems that the cfa code is not always set. Is there a flag to
> know when the field is valid?
I don't know, and it is PMD-specific,
but this behaviour is equivalent with what was before.
> Also, for ice and iavf PMDs, we were discussing what is the better
> way to export the offset.
>
> Note that there is an open discussion about how to export dynamic
> fields offset for PMDs:
> http://inbox.dpdk.org/dev/20201025071352.221953-1-haiyue.wang@intel.com/T/#mab79dd5cbb7d199a33515b7456dfe1831cf473bc
In general I think it is better not exporting the offset,
but keep a local copy of it.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-27 10:45 ` Olivier Matz
@ 2020-10-27 16:25 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 16:25 UTC (permalink / raw)
To: Olivier Matz
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
andrew.rybchenko, akhil.goyal, Yong Wang
27/10/2020 11:45, Olivier Matz:
> On Mon, Oct 26, 2020 at 11:20:07PM +0100, Thomas Monjalon wrote:
> > The segment count, used for MSS guess,
> > was stored in the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>
> After seeing this commit, I wonder if we shouldn't introduce an
> enhancement in the dynamic field API.
>
> Previously, the driver used udata64 only internally, so without any
> risk. The risky usages of udata64 were when the mbuf goes out of a
> module.
>
> Changing to dynamic field makes the code safe for any use, but consumes
> more memory.
>
> I wonder if we shouldn't (later) introduce a flag RTE_MBUF_DYN_F_SHARED,
> or something similar, to say that this field is only used inside a
> module, and that its memory can be shared with other dynamic fields.
Yes can be a later improvement if the sharing limitations
are properly defined.
We can also share some offsets which are used differently in Rx and Tx.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 16:16 ` Nithin Dabilpuram
@ 2020-10-27 16:26 ` Thomas Monjalon
2020-10-28 9:30 ` [dpdk-dev] [PATCH v4] " Nithin Dabilpuram
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 16:26 UTC (permalink / raw)
To: Nithin Dabilpuram
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, andrew.rybchenko, akhil.goyal, Pavan Nikhilesh
27/10/2020 17:16, Nithin Dabilpuram:
> On Tue, Oct 27, 2020 at 04:57:16PM +0100, Thomas Monjalon wrote:
> > 27/10/2020 16:33, Nithin Dabilpuram:
> > > On Tue, Oct 27, 2020 at 03:33:35PM +0100, Thomas Monjalon wrote:
> > > > 27/10/2020 15:23, Nithin Dabilpuram:
> > > > > On Mon, Oct 26, 2020 at 11:20:02PM +0100, Thomas Monjalon wrote:
> > > > > > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > > > > > It is moved to a dynamic field in order to allow removal of udata64.
> > > > > >
> > > > > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > > > > ---
> > > > > > --- a/lib/librte_node/ip4_lookup.c
> > > > > > +++ b/lib/librte_node/ip4_lookup.c
> > > > > > +int node_mbuf_priv1_dynfield_offset;
> > > > > > +
> > > > >
> > > > > This change doesn't work in secondary as it is process local memory.
> > > >
> > > > Yes that's an issue.
> > > > Can we copy the value when starting a secondary process?
> > >
> > > Currently there is no call back which will be called only in secondary.
> > >
> > > Can you move this value to node->ctx 8'th byte offset ? Node context is of size
> > > 16 bytes and should be sufficient.
> > > Currently first 8 B of node->ctx is used to store that socket's lpm pointer.
> >
> > Please would you be able to do such patch?
>
> Ack, will send a patch on this thread so that you can include in next version.
Thanks
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (15 preceding siblings ...)
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
` (14 more replies)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (2 subsequent siblings)
19 siblings, 15 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
The mbuf field userdata (aliased as udata64)
was announced to be removed for two reasons:
- applications, libraries and drivers used the same field
for different purposes, with a risk of usage conflict.
- this field always used 8 bytes even if unneeded
Some dynamic fields are created when needed to replace
the big static userdata field.
As a consequence, 8 bytes can be re-allocated to dynamic fields.
This mbuf layout change is important to allow adding more features
(consuming more dynamic fields) during the next year.
v3 (thanks Olivier):
- use typedef for new field types
- fix node field type
- initialize offsets to -1
- add more inline functions
- inline rte_security_dynfield_is_registered
- add PMD-specific userdata field for ARK
v2 (thanks David & Andrew):
- fix some indentations
- return -rte_errno consistently
- make some type casts more precise
- define dynfield types in macros
- hide field description in rte_security
- do not lookup security dynfield in ipsec-secgw
- do not use the existing timestamp field for other purpose
Thomas Monjalon (15):
examples: enclose DPDK includes with angle brackets
kni: move header file from EAL
mbuf: fix typo in dynamic field convention note
node: switch IPv4 metadata to dynamic mbuf field
security: switch metadata to dynamic mbuf field
event/sw: switch test counter to dynamic mbuf field
net/ark: switch user data to dynamic mbuf field
net/bnxt: switch CFA code to dynamic mbuf field
net/vmxnet3: switch MSS hint to dynamic mbuf field
test/distributor: switch sequence to dynamic mbuf field
test/graph: switch user data to dynamic mbuf field
app/eventdev: switch flow ID to dynamic mbuf field
examples/bbdev: switch to dynamic mbuf field
examples/rxtx_callbacks: switch to dynamic mbuf field
mbuf: remove userdata field
app/test-eventdev/test_order_atq.c | 4 +-
app/test-eventdev/test_order_common.c | 21 ++++-
app/test-eventdev/test_order_common.h | 19 ++++
app/test-eventdev/test_order_queue.c | 4 +-
app/test/test_distributor.c | 28 +++++-
app/test/test_graph.c | 94 +++++++++++--------
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf.in | 1 +
doc/guides/prog_guide/rte_security.rst | 9 +-
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 +-
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 +-
drivers/event/sw/sw_evdev_selftest.c | 23 ++++-
drivers/net/ark/ark_ethdev.c | 18 ++++
drivers/net/ark/ark_ethdev_rx.c | 3 +-
drivers/net/ark/ark_ethdev_tx.c | 3 +-
drivers/net/ark/rte_pmd_ark.h | 56 +++++++++++
drivers/net/bnxt/bnxt_ethdev.c | 19 ++++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 5 +
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +
drivers/net/ixgbe/ixgbe_ipsec.c | 5 +-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 +-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 +-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +-
examples/bbdev_app/main.c | 79 +++++++++++-----
examples/bond/main.c | 11 +--
examples/ipsec-secgw/ipsec-secgw.c | 9 +-
examples/ipsec-secgw/ipsec_worker.c | 12 ++-
examples/rxtx_callbacks/main.c | 20 +++-
examples/tep_termination/vxlan_setup.c | 2 +-
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
.../include => librte_kni}/rte_kni_common.h | 3 +-
lib/librte_mbuf/rte_mbuf_core.h | 8 +-
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
lib/librte_node/ip4_lookup.c | 7 ++
lib/librte_node/ip4_rewrite.c | 10 ++
lib/librte_node/node_private.h | 12 ++-
lib/librte_security/rte_security.c | 16 ++++
lib/librte_security/rte_security.h | 42 +++++++++
lib/librte_security/rte_security_driver.h | 3 +
lib/librte_security/version.map | 2 +
50 files changed, 485 insertions(+), 135 deletions(-)
create mode 100644 drivers/net/ark/rte_pmd_ark.h
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (97%)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 01/15] examples: enclose DPDK includes with angle brackets
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 02/15] kni: move header file from EAL Thomas Monjalon
` (13 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru, Chas Williams,
Min Hu (Connor),
Xiaoyun Li
In examples, DPDK header files are external,
so they must be enclosed with angle brackets, not quotes.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/bbdev_app/main.c | 30 +++++++++++++-------------
examples/bond/main.c | 11 ++++------
examples/tep_termination/vxlan_setup.c | 2 +-
3 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 43fe631760..e512c807cd 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -18,21 +18,21 @@
#include <getopt.h>
#include <signal.h>
-#include "rte_atomic.h"
-#include "rte_common.h"
-#include "rte_eal.h"
-#include "rte_cycles.h"
-#include "rte_ether.h"
-#include "rte_ethdev.h"
-#include "rte_ip.h"
-#include "rte_lcore.h"
-#include "rte_malloc.h"
-#include "rte_mbuf.h"
-#include "rte_memory.h"
-#include "rte_mempool.h"
-#include "rte_log.h"
-#include "rte_bbdev.h"
-#include "rte_bbdev_op.h"
+#include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_eal.h>
+#include <rte_cycles.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_ip.h>
+#include <rte_lcore.h>
+#include <rte_malloc.h>
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_log.h>
+#include <rte_bbdev.h>
+#include <rte_bbdev_op.h>
/* LLR values - negative value for '1' bit */
#define LLR_1_BIT 0x81
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 398553b785..81a6fa976b 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -41,6 +41,10 @@
#include <rte_tcp.h>
#include <rte_arp.h>
#include <rte_spinlock.h>
+#include <rte_devargs.h>
+#include <rte_byteorder.h>
+#include <rte_cpuflags.h>
+#include <rte_eth_bond.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
@@ -53,13 +57,6 @@
#include "main.h"
-#include <rte_devargs.h>
-
-
-#include "rte_byteorder.h"
-#include "rte_cpuflags.h"
-#include "rte_eth_bond.h"
-
#define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1
#define NB_MBUF (1024*8)
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index 4b44ccc143..0bcd870b4a 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -18,9 +18,9 @@
#include <rte_ip.h>
#include <rte_udp.h>
#include <rte_tcp.h>
+#include <rte_vhost.h>
#include "main.h"
-#include "rte_vhost.h"
#include "vxlan.h"
#include "vxlan_setup.h"
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 02/15] kni: move header file from EAL
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
` (12 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
Since the kernel module is not part of EAL anymore,
there is no need to have the common KNI header file in EAL.
The file rte_kni_common.h is moved to librte_kni.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h | 0
4 files changed, 2 insertions(+), 3 deletions(-)
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (100%)
diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build
index d696347f22..07e0c9dae7 100644
--- a/kernel/linux/kni/meson.build
+++ b/kernel/linux/kni/meson.build
@@ -18,7 +18,7 @@ custom_target('rte_kni',
'src=' + meson.current_source_dir(),
'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
' -I' + meson.source_root() + '/lib/librte_eal/include' +
- ' -I' + meson.source_root() + '/lib/librte_eal/linux/include' +
+ ' -I' + meson.source_root() + '/lib/librte_kni' +
' -I' + meson.build_root() +
' -I' + meson.current_source_dir(),
'modules'],
diff --git a/lib/librte_eal/linux/include/meson.build b/lib/librte_eal/linux/include/meson.build
index 1241894b3c..7d18dd52f1 100644
--- a/lib/librte_eal/linux/include/meson.build
+++ b/lib/librte_eal/linux/include/meson.build
@@ -4,6 +4,5 @@
includes += include_directories('.')
headers += files(
- 'rte_kni_common.h',
'rte_os.h',
)
diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build
index 963eae6fe0..ad598bb3d0 100644
--- a/lib/librte_kni/meson.build
+++ b/lib/librte_kni/meson.build
@@ -6,5 +6,5 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
reason = 'only supported on 64-bit linux'
endif
sources = files('rte_kni.c')
-headers = files('rte_kni.h')
+headers = files('rte_kni.h', 'rte_kni_common.h')
deps += ['ethdev', 'pci']
diff --git a/lib/librte_eal/linux/include/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
similarity index 100%
rename from lib/librte_eal/linux/include/rte_kni_common.h
rename to lib/librte_kni/rte_kni_common.h
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 03/15] mbuf: fix typo in dynamic field convention note
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 02/15] kni: move header file from EAL Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
` (11 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, stable, Konstantin Ananyev
Replace "in a in PMD" with "in a PMD".
Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 8407230ecf..0ebac88b83 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -62,7 +62,7 @@
* conventions than function names in dpdk:
* - "rte_mbuf_dynfield_<name>" if defined in mbuf library
* - "rte_<libname>_dynfield_<name>" if defined in another library
- * - "rte_net_<pmd>_dynfield_<name>" if defined in a in PMD
+ * - "rte_net_<pmd>_dynfield_<name>" if defined in a PMD
* - any name that does not start with "rte_" in an application
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (2 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 05/15] security: switch " Thomas Monjalon
` (10 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nithin Dabilpuram,
Pavan Nikhilesh
The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
WARNING: this change should be replaced with another solution
proposed by Nithin. Waiting for the patch to be integrated.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_node/ip4_lookup.c | 7 +++++++
lib/librte_node/ip4_rewrite.c | 10 ++++++++++
lib/librte_node/node_private.h | 12 ++++++++++--
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 8835aab9dd..3bd7c179ab 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -21,6 +21,8 @@
#include "node_private.h"
+int node_mbuf_priv1_dynfield_offset = -1;
+
#define IPV4_L3FWD_LPM_MAX_RULES 1024
#define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)
@@ -178,6 +180,11 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
RTE_SET_USED(node);
if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+
/* Setup LPM tables for all sockets */
RTE_LCORE_FOREACH(lcore_id)
{
diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c
index bb7f671b5c..1c4e51968c 100644
--- a/lib/librte_node/ip4_rewrite.c
+++ b/lib/librte_node/ip4_rewrite.c
@@ -248,9 +248,19 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
static int
ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
{
+ static bool init_once;
RTE_SET_USED(graph);
RTE_SET_USED(node);
+
+ if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+ init_once = true;
+ }
+
node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
return 0;
diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
index ab7941c12b..9258082df0 100644
--- a/lib/librte_node/node_private.h
+++ b/lib/librte_node/node_private.h
@@ -8,6 +8,7 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
extern int rte_node_logtype;
#define NODE_LOG(level, node_name, ...) \
@@ -21,7 +22,6 @@ extern int rte_node_logtype;
#define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
/**
- *
* Node mbuf private data to store next hop, ttl and checksum.
*/
struct node_mbuf_priv1 {
@@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
};
};
+static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
+ .name = "rte_node_dynfield_priv1",
+ .size = sizeof(struct node_mbuf_priv1),
+ .align = __alignof__(struct node_mbuf_priv1),
+};
+extern int node_mbuf_priv1_dynfield_offset;
+
/**
* Node mbuf private area 2.
*/
@@ -60,7 +67,8 @@ struct node_mbuf_priv2 {
static __rte_always_inline struct node_mbuf_priv1 *
node_mbuf_priv1(struct rte_mbuf *m)
{
- return (struct node_mbuf_priv1 *)&m->udata64;
+ return RTE_MBUF_DYNFIELD(m,
+ node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *);
}
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 05/15] security: switch metadata to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (3 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 06/15] event/sw: switch test counter " Thomas Monjalon
` (9 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Haiyue Wang, Declan Doherty,
Ankur Dwivedi, Anoob Joseph, Jeff Guo, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
The device-specific metadata was stored in the deprecated field udata64.
It is moved to a dynamic mbuf field in order to allow removal of udata64.
The name rte_security_dynfield is not very descriptive
but it should be replaced later by separate fields for each type of data
that drivers pass to the upper layer.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
---
doc/guides/prog_guide/rte_security.rst | 9 ++--
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++-
drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 9 ++--
examples/ipsec-secgw/ipsec_worker.c | 12 ++++--
lib/librte_security/rte_security.c | 16 +++++++
lib/librte_security/rte_security.h | 42 +++++++++++++++++++
lib/librte_security/rte_security_driver.h | 3 ++
lib/librte_security/version.map | 2 +
14 files changed, 99 insertions(+), 20 deletions(-)
diff --git a/doc/guides/prog_guide/rte_security.rst b/doc/guides/prog_guide/rte_security.rst
index c64aef3de9..f72bc8a78f 100644
--- a/doc/guides/prog_guide/rte_security.rst
+++ b/doc/guides/prog_guide/rte_security.rst
@@ -125,8 +125,9 @@ ESP/AH headers will be removed from the packet and the received packet
will contains the decrypted packet only. The driver Rx path checks the
descriptors and based on the crypto status sets additional flags in
``rte_mbuf.ol_flags`` field. The driver would also set device-specific
-metadata in ``rte_mbuf.udata64`` field. This will allow the application
-to identify the security processing done on the packet.
+metadata in ``RTE_SECURITY_DYNFIELD_NAME`` field.
+This will allow the application to identify the security processing
+done on the packet.
.. note::
@@ -568,8 +569,8 @@ security session which processed the packet.
.. note::
- In case of inline processed packets, ``rte_mbuf.udata64`` field would be
- used by the driver to relay information on the security processing
+ In case of inline processed packets, ``RTE_SECURITY_DYNFIELD_NAME`` field
+ would be used by the driver to relay information on the security processing
associated with the packet. In ingress, the driver would set this in Rx
path while in egress, ``rte_security_set_pkt_metadata()`` would perform a
similar operation. The application is expected not to modify the field
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
index b80ec7bff2..4e2a0e3afe 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
@@ -455,6 +455,9 @@ otx2_crypto_sec_session_create(void *device,
if (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL)
return -ENOTSUP;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
if (rte_mempool_get(mempool, (void **)&priv)) {
otx2_err("Could not allocate security session private data");
return -ENOMEM;
@@ -514,7 +517,7 @@ otx2_crypto_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (rte_security_dynfield_t)session;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c
index 48f5082d49..62f2a5f764 100644
--- a/drivers/net/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ixgbe/ixgbe_ipsec.c
@@ -484,7 +484,8 @@ ixgbe_crypto_update_mb(void *device __rte_unused,
get_sec_session_private_data(session);
if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) {
union ixgbe_crypto_tx_desc_md *mdata =
- (union ixgbe_crypto_tx_desc_md *)&m->udata64;
+ (union ixgbe_crypto_tx_desc_md *)
+ rte_security_dynfield(m);
mdata->enc = 1;
mdata->sa_idx = ic_session->sa_index;
mdata->pad_len = ixgbe_crypto_compute_pad_len(m);
@@ -751,5 +752,7 @@ ixgbe_ipsec_ctx_create(struct rte_eth_dev *dev)
return -ENOMEM;
}
}
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 5f19972031..6cfbb582e2 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -34,6 +34,7 @@
#include <rte_mbuf.h>
#include <rte_ether.h>
#include <rte_ethdev_driver.h>
+#include <rte_security_driver.h>
#include <rte_prefetch.h>
#include <rte_udp.h>
#include <rte_tcp.h>
@@ -694,7 +695,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
if (use_ipsec) {
union ixgbe_crypto_tx_desc_md *ipsec_mdata =
(union ixgbe_crypto_tx_desc_md *)
- &tx_pkt->udata64;
+ rte_security_dynfield(tx_pkt);
tx_offload.sa_idx = ipsec_mdata->sa_idx;
tx_offload.sec_pad_len = ipsec_mdata->pad_len;
}
@@ -859,7 +860,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
- tx_offload, &tx_pkt->udata64);
+ tx_offload,
+ rte_security_dynfield(tx_pkt));
txe->last_id = tx_last;
tx_id = txe->next_id;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index b20f399a15..3b9871f4dc 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -13,6 +13,7 @@
#include <rte_kvargs.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
+#include <rte_security_driver.h>
#include <rte_string_fns.h>
#include <rte_time.h>
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec.c b/drivers/net/octeontx2/otx2_ethdev_sec.c
index 4e0dd4e49e..1ee597ff6e 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec.c
+++ b/drivers/net/octeontx2/otx2_ethdev_sec.c
@@ -684,7 +684,7 @@ otx2_eth_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (rte_security_dynfield_t)session;
return 0;
}
@@ -831,6 +831,9 @@ otx2_eth_sec_init(struct rte_eth_dev *eth_dev)
!(dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY))
return 0;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
nb_sa = dev->ipsec_in_max_spi;
mz_sz = nb_sa * sa_width;
in_sa_mz_name_get(name, RTE_MEMZONE_NAMESIZE, port);
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
index 5bf8c19995..284bcd5367 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
+++ b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
@@ -55,7 +55,7 @@ otx2_sec_event_tx(struct otx2_ssogws *ws, struct rte_event *ev,
struct nix_iova_s nix_iova;
} *sd;
- priv = get_sec_session_private_data((void *)(m->udata64));
+ priv = get_sec_session_private_data((void *)(*rte_security_dynfield(m)));
sess = &priv->ipsec.ip;
sa = &sess->out_sa;
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index f29a0542f9..61a5c436dd 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -241,7 +241,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
spi = cq->tag & 0xFFFFF;
sa = nix_rx_sec_sa_get(lookup_mem, spi, m->port);
- m->udata64 = (uint64_t)sa->userdata;
+ *rte_security_dynfield(m) = sa->udata64;
data = rte_pktmbuf_mtod(m, char *);
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 2219148285..bbe7ce48d9 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -426,7 +426,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
* with the security session.
*/
- if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD) {
+ if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD &&
+ rte_security_dynfield_is_registered()) {
struct ipsec_sa *sa;
struct ipsec_mbuf_metadata *priv;
struct rte_security_ctx *ctx = (struct rte_security_ctx *)
@@ -436,10 +437,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
/* Retrieve the userdata registered. Here, the userdata
* registered is the SA pointer.
*/
-
- sa = (struct ipsec_sa *)
- rte_security_get_userdata(ctx, pkt->udata64);
-
+ sa = (struct ipsec_sa *)rte_security_get_userdata(ctx,
+ *rte_security_dynfield(pkt));
if (sa == NULL) {
/* userdata could not be retrieved */
return;
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index b6c851f257..647e22df59 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -208,7 +208,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -226,7 +226,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -357,7 +357,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
}
if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
- pkt->userdata = sess->security.ses;
+ *(struct rte_security_session **)rte_security_dynfield(pkt) =
+ sess->security.ses;
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
@@ -465,7 +466,10 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
}
/* Save security session */
- pkt->userdata = sess_tbl[port_id];
+ if (rte_security_dynfield_is_registered())
+ *(struct rte_security_session **)
+ rte_security_dynfield(pkt) =
+ sess_tbl[port_id];
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
index ee4666026a..e8116d5447 100644
--- a/lib/librte_security/rte_security.c
+++ b/lib/librte_security/rte_security.c
@@ -23,6 +23,22 @@
RTE_PTR_OR_ERR_RET(p1->p2->p3, last_retval); \
} while (0)
+#define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+int rte_security_dynfield_offset = -1;
+
+int
+rte_security_dynfield_register(void)
+{
+ static const struct rte_mbuf_dynfield dynfield_desc = {
+ .name = RTE_SECURITY_DYNFIELD_NAME,
+ .size = sizeof(rte_security_dynfield_t),
+ .align = __alignof__(rte_security_dynfield_t),
+ };
+ rte_security_dynfield_offset =
+ rte_mbuf_dynfield_register(&dynfield_desc);
+ return rte_security_dynfield_offset;
+}
+
struct rte_security_session *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index 271531af12..88d31de0a6 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -27,6 +27,7 @@ extern "C" {
#include <rte_common.h>
#include <rte_crypto.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
@@ -451,6 +452,47 @@ int
rte_security_session_destroy(struct rte_security_ctx *instance,
struct rte_security_session *sess);
+/** Device-specific metadata field type */
+typedef uint64_t rte_security_dynfield_t;
+/** Dynamic mbuf field for device-specific metadata */
+extern int rte_security_dynfield_offset;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get pointer to mbuf field for device-specific metadata.
+ *
+ * For performance reason, no check is done,
+ * the dynamic field may not be registered.
+ * @see rte_security_dynfield_is_registered
+ *
+ * @param mbuf packet to access
+ * @return pointer to mbuf field
+ */
+__rte_experimental
+static inline rte_security_dynfield_t *
+rte_security_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ rte_security_dynfield_offset,
+ rte_security_dynfield_t *);
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Check whether the dynamic field is registered.
+ *
+ * @return true if rte_security_dynfield_register() has been called.
+ */
+__rte_experimental
+static inline bool rte_security_dynfield_is_registered(void)
+{
+ return rte_security_dynfield_offset >= 0;
+}
+
/**
* Updates the buffer with device-specific defined metadata
*
diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
index 1b561f8528..c5abb07990 100644
--- a/lib/librte_security/rte_security_driver.h
+++ b/lib/librte_security/rte_security_driver.h
@@ -89,6 +89,9 @@ typedef int (*security_session_stats_get_t)(void *device,
struct rte_security_session *sess,
struct rte_security_stats *stats);
+__rte_experimental
+int rte_security_dynfield_register(void);
+
/**
* Update the mbuf with provided metadata.
*
diff --git a/lib/librte_security/version.map b/lib/librte_security/version.map
index d84eec0a88..22775558c8 100644
--- a/lib/librte_security/version.map
+++ b/lib/librte_security/version.map
@@ -15,6 +15,8 @@ DPDK_21 {
EXPERIMENTAL {
global:
+ rte_security_dynfield_offset;
+ rte_security_dynfield_register;
rte_security_get_userdata;
rte_security_session_stats_get;
rte_security_session_update;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (4 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 05/15] security: switch " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 07/15] net/ark: switch user data " Thomas Monjalon
` (8 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Harry van Haaren
The test worker_loopback used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/event/sw/sw_evdev_selftest.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index 5c7e527917..ad4fc0eed7 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -40,6 +40,11 @@ struct test {
uint32_t service_id;
};
+typedef uint8_t counter_dynfield_t;
+static int counter_dynfield_offset = -1;
+#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ counter_dynfield_offset, counter_dynfield_t *))
+
static struct rte_event release_ev;
static inline struct rte_mbuf *
@@ -2987,8 +2992,8 @@ worker_loopback_worker_fn(void *arg)
}
ev[i].queue_id = 0;
- ev[i].mbuf->udata64++;
- if (ev[i].mbuf->udata64 != 16) {
+ COUNTER_FIELD(ev[i].mbuf)++;
+ if (COUNTER_FIELD(ev[i].mbuf) != 16) {
ev[i].op = RTE_EVENT_OP_FORWARD;
enqd = rte_event_enqueue_burst(evdev, port,
&ev[i], 1);
@@ -3028,7 +3033,7 @@ worker_loopback_producer_fn(void *arg)
m = rte_pktmbuf_alloc(t->mbuf_pool);
} while (m == NULL);
- m->udata64 = 0;
+ COUNTER_FIELD(m) = 0;
struct rte_event ev = {
.op = RTE_EVENT_OP_NEW,
@@ -3061,6 +3066,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)
int err;
int w_lcore, p_lcore;
+ static const struct rte_mbuf_dynfield counter_dynfield_desc = {
+ .name = "rte_event_sw_dynfield_selftest_counter",
+ .size = sizeof(counter_dynfield_t),
+ .align = __alignof__(counter_dynfield_t),
+ };
+ counter_dynfield_offset =
+ rte_mbuf_dynfield_register(&counter_dynfield_desc);
+ if (counter_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return -rte_errno;
+ }
+
if (init(t, 8, 2) < 0 ||
create_atomic_qids(t, 8) < 0) {
printf("%d: Error initializing device\n", __LINE__);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 07/15] net/ark: switch user data to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (5 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 22:30 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 08/15] net/bnxt: switch CFA code " Thomas Monjalon
` (7 subsequent siblings)
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Shepard Siegel, Ed Czeck,
John Miller
The second field of metadata is reserved for user data
which was using a deprecated mbuf field.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf.in | 1 +
drivers/net/ark/ark_ethdev.c | 18 +++++++++++
drivers/net/ark/ark_ethdev_rx.c | 3 +-
drivers/net/ark/ark_ethdev_tx.c | 3 +-
drivers/net/ark/rte_pmd_ark.h | 56 +++++++++++++++++++++++++++++++++
6 files changed, 80 insertions(+), 2 deletions(-)
create mode 100644 drivers/net/ark/rte_pmd_ark.h
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index a9c12d1a2f..b865a51e8c 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -41,6 +41,7 @@ The public API headers are grouped by topics:
[vhost] (@ref rte_vhost.h),
[vdpa] (@ref rte_vdpa.h),
[KNI] (@ref rte_kni.h),
+ [ark] (@ref rte_pmd_ark.h),
[ixgbe] (@ref rte_pmd_ixgbe.h),
[i40e] (@ref rte_pmd_i40e.h),
[ice] (@ref rte_pmd_ice.h),
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index e37f8c2e80..c5b01a1814 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -8,6 +8,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \
@TOPDIR@/drivers/bus/vdev \
@TOPDIR@/drivers/crypto/scheduler \
@TOPDIR@/drivers/mempool/dpaa2 \
+ @TOPDIR@/drivers/net/ark \
@TOPDIR@/drivers/net/bnxt \
@TOPDIR@/drivers/net/bonding \
@TOPDIR@/drivers/net/dpaa \
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 168b3659d6..5f19d8d1ea 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -10,6 +10,7 @@
#include <rte_ethdev_pci.h>
#include <rte_kvargs.h>
+#include "rte_pmd_ark.h"
#include "ark_global.h"
#include "ark_logs.h"
#include "ark_ethdev_tx.h"
@@ -78,6 +79,8 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
#define ARK_TX_MAX_QUEUE (4096 * 4)
#define ARK_TX_MIN_QUEUE (256)
+int rte_pmd_ark_userdata_dynfield_offset = -1;
+
static const char * const valid_arguments[] = {
ARK_PKTGEN_ARG,
ARK_PKTCHKR_ARG,
@@ -245,6 +248,11 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
int ret;
int port_count = 1;
int p;
+ static const struct rte_mbuf_dynfield ark_userdata_dynfield_desc = {
+ .name = RTE_PMD_ARK_USERDATA_DYNFIELD_NAME,
+ .size = sizeof(rte_pmd_ark_userdata_t),
+ .align = __alignof__(rte_pmd_ark_userdata_t),
+ };
ark->eth_dev = dev;
@@ -254,6 +262,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
ret = check_for_ext(ark);
if (ret)
return ret;
+
+ /* Extra mbuf field for user data */
+ rte_pmd_ark_userdata_dynfield_offset =
+ rte_mbuf_dynfield_register(&ark_userdata_dynfield_desc);
+ if (rte_pmd_ark_userdata_dynfield_offset < 0) {
+ ARK_PMD_LOG(ERR,
+ "Failed to register mbuf field for userdata\n");
+ return -rte_errno;
+ }
+
pci_dev = RTE_ETH_DEV_TO_PCI(dev);
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 2f8d05099c..c5788498b3 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -4,6 +4,7 @@
#include <unistd.h>
+#include "rte_pmd_ark.h"
#include "ark_ethdev_rx.h"
#include "ark_global.h"
#include "ark_logs.h"
@@ -272,7 +273,7 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->pkt_len = meta->pkt_len;
mbuf->data_len = meta->pkt_len;
mbuf->timestamp = meta->timestamp;
- mbuf->udata64 = meta->user_data;
+ rte_pmd_ark_mbuf_userdata_set(mbuf, meta->user_data);
if (ARK_DEBUG_CORE) { /* debug sanity checks */
if ((meta->pkt_len > (1024 * 16)) ||
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index a0e35af880..ab488d83f2 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -4,6 +4,7 @@
#include <unistd.h>
+#include "rte_pmd_ark.h"
#include "ark_ethdev_tx.h"
#include "ark_global.h"
#include "ark_mpu.h"
@@ -70,7 +71,7 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
uint8_t flags)
{
meta->physaddr = rte_mbuf_data_iova(mbuf);
- meta->user1 = (uint32_t)mbuf->udata64;
+ meta->user1 = (uint32_t)rte_pmd_ark_mbuf_userdata_get(mbuf);
meta->data_len = rte_pktmbuf_data_len(mbuf);
meta->flags = flags;
}
diff --git a/drivers/net/ark/rte_pmd_ark.h b/drivers/net/ark/rte_pmd_ark.h
new file mode 100644
index 0000000000..11e96e0e9c
--- /dev/null
+++ b/drivers/net/ark/rte_pmd_ark.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2020 Atomic Rules LLC
+ */
+
+#ifndef RTE_PMD_ARK_H
+#define RTE_PMD_ARK_H
+
+/**
+ * @file
+ * ARK driver-specific API
+ */
+
+#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
+
+typedef uint64_t rte_pmd_ark_userdata_t;
+extern int rte_pmd_ark_userdata_dynfield_offset;
+
+/** mbuf dynamic field for custom ARK data */
+#define RTE_PMD_ARK_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_userdata"
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Read user data from mbuf.
+ *
+ * @param mbuf Structure to read from.
+ * @return user data
+ */
+__rte_experimental
+static inline rte_pmd_ark_userdata_t
+rte_pmd_ark_mbuf_userdata_get(const struct rte_mbuf *mbuf)
+{
+ return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_userdata_dynfield_offset,
+ rte_pmd_ark_userdata_t *);
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Write user data to mbuf.
+ *
+ * @param mbuf Structure to write into.
+ */
+__rte_experimental
+static inline void
+rte_pmd_ark_mbuf_userdata_set(struct rte_mbuf *mbuf,
+ rte_pmd_ark_userdata_t data)
+{
+ *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_userdata_dynfield_offset,
+ rte_pmd_ark_userdata_t *) = data;
+}
+
+#endif /* RTE_PMD_ARK_H */
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (6 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 07/15] net/ark: switch user data " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
` (6 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ajit Khaparde, Somnath Kotur
The CFA code from mark was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Note: the new field has 32 bits, smaller than udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 5 +++++
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++
4 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1c7d1b758d..f1350d39da 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -31,6 +31,7 @@
#include "bnxt_nvm_defs.h"
#include "bnxt_tf_common.h"
#include "ulp_flow_db.h"
+#include "rte_pmd_bnxt.h"
#define DRV_MODULE_NAME "bnxt"
static const char bnxt_version[] =
@@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = {
*/
#define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
+int bnxt_cfa_code_dynfield_offset = -1;
+
/*
* max_num_kflows must be >= 32
* and must be a power-of-2 supported value
@@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF)
bp->flags |= BNXT_FLAG_STINGRAY;
+ if (BNXT_TRUFLOW_EN(bp)) {
+ /* extra mbuf field is required to store CFA code from mark */
+ static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = {
+ .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME,
+ .size = sizeof(bnxt_cfa_code_dynfield_t),
+ .align = __alignof__(bnxt_cfa_code_dynfield_t),
+ };
+ bnxt_cfa_code_dynfield_offset =
+ rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc);
+ if (bnxt_cfa_code_dynfield_offset < 0) {
+ PMD_DRV_LOG(ERR,
+ "Failed to register mbuf field for TruFlow mark\n");
+ return -rte_errno;
+ }
+ }
+
rc = bnxt_init_board(eth_dev);
if (rc) {
PMD_DRV_LOG(ERR,
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 039217fa60..7156ce7dd8 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -606,7 +606,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
return mark_id;
/* Got the mark, write it to the mbuf and return */
mbuf->hash.fdir.hi = mark_id;
- mbuf->udata64 = (cfa_code & 0xffffffffull) << 32;
+ BNXT_CFA_CODE_DYNFIELD(mbuf) = cfa_code & 0xffffffffull;
mbuf->hash.fdir.id = rxcmp1->cfa_code;
mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
return mark_id;
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index b874e54a8c..2d16a551ce 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -95,6 +95,11 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
struct rx_pkt_cmpl_hi *rxcmp1,
struct rte_mbuf *mbuf);
+typedef uint32_t bnxt_cfa_code_dynfield_t;
+extern int bnxt_cfa_code_dynfield_offset;
+#define BNXT_CFA_CODE_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ bnxt_cfa_code_dynfield_offset, bnxt_cfa_code_dynfield_t *))
+
#define BNXT_RX_META_CFA_CODE_SHIFT 19
#define BNXT_CFA_CODE_META_SHIFT 16
#define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 81d0d0e032..f538b6550e 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -9,6 +9,9 @@
#include <rte_ethdev.h>
#include <rte_ether.h>
+/** mbuf dynamic field where CFA code is stored */
+#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
+
/*
* Response sent back to the caller after callback
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (7 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 08/15] net/bnxt: switch CFA code " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 10/15] test/distributor: switch sequence " Thomas Monjalon
` (5 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Yong Wang
The segment count, used for MSS guess,
was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++++++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++----
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 6920ab568c..23a2ebbefa 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -59,6 +59,8 @@
DEV_RX_OFFLOAD_JUMBO_FRAME | \
DEV_RX_OFFLOAD_RSS_HASH)
+int vmxnet3_segs_dynfield_offset = -1;
+
static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
@@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
struct vmxnet3_hw *hw = eth_dev->data->dev_private;
uint32_t mac_hi, mac_lo, ver;
struct rte_eth_link link;
+ static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
+ .name = VMXNET3_SEGS_DYNFIELD_NAME,
+ .size = sizeof(vmxnet3_segs_dynfield_t),
+ .align = __alignof__(vmxnet3_segs_dynfield_t),
+ };
PMD_INIT_FUNC_TRACE();
@@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ /* extra mbuf field is required to guess MSS */
+ vmxnet3_segs_dynfield_offset =
+ rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
+ if (vmxnet3_segs_dynfield_offset < 0) {
+ PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
+ return -rte_errno;
+ }
+
/*
* for secondary processes, we don't initialize any further as primary
* has already done this work.
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
index dd685b02b7..e19718ce64 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
@@ -193,4 +193,10 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
+#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs"
+typedef uint8_t vmxnet3_segs_dynfield_t;
+extern int vmxnet3_segs_dynfield_offset;
+#define VMXNET3_SEGS_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(rxm, \
+ vmxnet3_segs_dynfield_offset, vmxnet3_segs_dynfield_t *))
+
#endif /* _VMXNET3_ETHDEV_H_ */
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index e10f9ee870..2b0e2e6f19 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
struct rte_ipv6_hdr *ipv6_hdr;
struct rte_tcp_hdr *tcp_hdr;
char *ptr;
+ uint8_t segs;
RTE_ASSERT(rcd->tcp);
@@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
hlen += (tcp_hdr->data_off & 0xf0) >> 2;
- if (rxm->udata64 > 1)
- return (rte_pktmbuf_pkt_len(rxm) - hlen +
- rxm->udata64 - 1) / rxm->udata64;
+ segs = VMXNET3_SEGS_DYNFIELD(rxm);
+ if (segs > 1)
+ return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
else
return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
}
@@ -737,7 +738,7 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
(const Vmxnet3_RxCompDescExt *)rcd;
rxm->tso_segsz = rcde->mss;
- rxm->udata64 = rcde->segCnt;
+ VMXNET3_SEGS_DYNFIELD(rxm) = rcde->segCnt;
ol_flags |= PKT_RX_LRO;
}
} else { /* Offloads set in eop */
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 10/15] test/distributor: switch sequence to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (8 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 11/15] test/graph: switch user data " Thomas Monjalon
` (4 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Lukasz Wojciechowski, David Hunt
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
---
app/test/test_distributor.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index eb889b91d1..24ee824eef 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -10,6 +10,7 @@
#include <rte_errno.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_distributor.h>
#include <rte_string_fns.h>
@@ -17,6 +18,11 @@
#define BURST 32
#define BIG_BATCH 1024
+typedef uint32_t seq_dynfield_t;
+static int seq_dynfield_offset = -1;
+#define SEQ_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ seq_dynfield_offset, seq_dynfield_t *))
+
struct worker_params {
char name[64];
struct rte_distributor *dist;
@@ -578,7 +584,7 @@ handle_and_mark_work(void *arg)
__atomic_fetch_add(&worker_stats[id].handled_packets, num,
__ATOMIC_RELAXED);
for (i = 0; i < num; i++)
- buf[i]->udata64 += id + 1;
+ SEQ_FIELD(buf[i]) += id + 1;
num = rte_distributor_get_pkt(db, id,
buf, buf, num);
}
@@ -631,10 +637,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
<< shift;
}
/* Assign a sequence number to each packet. The sequence is shifted,
- * so that lower bits of the udate64 will hold mark from worker.
+ * so that lower bits will hold mark from worker.
*/
for (i = 0; i < buf_count; i++)
- bufs[i]->udata64 = i << seq_shift;
+ SEQ_FIELD(bufs[i]) = i << seq_shift;
count = 0;
for (i = 0; i < buf_count/burst; i++) {
@@ -660,8 +666,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
/* Sort returned packets by sent order (sequence numbers). */
for (i = 0; i < buf_count; i++) {
- seq = returns[i]->udata64 >> seq_shift;
- id = returns[i]->udata64 - (seq << seq_shift);
+ seq = SEQ_FIELD(returns[i]) >> seq_shift;
+ id = SEQ_FIELD(returns[i]) - (seq << seq_shift);
sorted[seq] = id;
}
@@ -805,6 +811,18 @@ test_distributor(void)
static struct rte_mempool *p;
int i;
+ static const struct rte_mbuf_dynfield seq_dynfield_desc = {
+ .name = "test_distributor_dynfield_seq",
+ .size = sizeof(seq_dynfield_t),
+ .align = __alignof__(seq_dynfield_t),
+ };
+ seq_dynfield_offset =
+ rte_mbuf_dynfield_register(&seq_dynfield_desc);
+ if (seq_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return TEST_FAILED;
+ }
+
if (rte_lcore_count() < 2) {
printf("Not enough cores for distributor_autotest, expecting at least 2\n");
return TEST_SKIPPED;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 11/15] test/graph: switch user data to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (9 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 10/15] test/distributor: switch sequence " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID " Thomas Monjalon
` (3 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob, Kiran Kumar K,
Nithin Dabilpuram
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_graph.c | 94 ++++++++++++++++++++++++++-----------------
1 file changed, 56 insertions(+), 38 deletions(-)
diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index ed69eda997..164486911f 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
#include <rte_graph.h>
#include <rte_graph_worker.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_random.h>
#include "test.h"
@@ -39,6 +40,11 @@ static uint16_t test_node3_worker(struct rte_graph *graph,
#define MBUFF_SIZE 512
#define MAX_NODES 4
+typedef uint64_t graph_dynfield_t;
+static int graph_dynfield_offset = -1;
+#define GRAPH_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ graph_dynfield_offset, graph_dynfield_t *))
+
static struct rte_mbuf mbuf[MAX_NODES + 1][MBUFF_SIZE];
static void *mbuf_p[MAX_NODES + 1][MBUFF_SIZE];
static rte_graph_t graph_id;
@@ -162,9 +168,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node0);
for (i = 0; i < obj_node0; i++) {
data = &mbuf[0][i];
- data->udata64 = ((uint64_t)tm->test_node[0].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[0].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][i];
}
rte_node_next_stream_put(graph, node, next, obj_node0);
@@ -175,9 +181,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node1);
for (i = 0; i < obj_node1; i++) {
data = &mbuf[0][obj_node0 + i];
- data->udata64 = ((uint64_t)tm->test_node[1].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][obj_node0 + i];
}
@@ -205,23 +211,23 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[0].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[0].idx) {
printf("Data idx miss match at node 0, expected"
" = %u got = %u\n",
tm->test_node[0].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at "
"node 0\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -233,12 +239,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * obj_node0 * 0.01;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[1][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[1][0],
obj_node0);
@@ -246,12 +252,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node1 = nb_objs - obj_node0;
for (i = 0; i < obj_node1; i++) {
data = &mbuf[1][obj_node0 + i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 1, (void **)&mbuf_p[1][obj_node0],
obj_node1);
@@ -285,22 +291,22 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[2] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[1].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[1].idx) {
printf("Data idx miss match at node 1, expected = %u"
" got = %u\n",
tm->test_node[1].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 1\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -312,11 +318,11 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[2][i];
- data->udata64 = ((uint64_t)tm->test_node[2].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[2][0], obj_node0);
@@ -339,22 +345,22 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[3] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[2].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[2].idx) {
printf("Data idx miss match at node 2, expected = %u"
" got = %u\n",
tm->test_node[2].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 2\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -367,10 +373,10 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[3][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[3].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[3][0],
obj_node0);
@@ -395,22 +401,22 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[4] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[3].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[3].idx) {
printf("Data idx miss match at node 3, expected = %u"
" got = %u\n",
tm->test_node[3].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 3\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -426,11 +432,11 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * 2;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[4][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[0].idx << 32) | i;
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[4][0],
obj_node0);
@@ -765,6 +771,18 @@ graph_setup(void)
{
int i, j;
+ static const struct rte_mbuf_dynfield graph_dynfield_desc = {
+ .name = "test_graph_dynfield",
+ .size = sizeof(graph_dynfield_t),
+ .align = __alignof__(graph_dynfield_t),
+ };
+ graph_dynfield_offset =
+ rte_mbuf_dynfield_register(&graph_dynfield_desc);
+ if (graph_dynfield_offset < 0) {
+ printf("Cannot register mbuf field\n");
+ return TEST_FAILED;
+ }
+
for (i = 0; i <= MAX_NODES; i++) {
for (j = 0; j < MBUFF_SIZE; j++)
mbuf_p[i][j] = &mbuf[i][j];
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (10 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 11/15] test/graph: switch user data " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-28 4:54 ` Jerin Jacob
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 13/15] examples/bbdev: switch " Thomas Monjalon
` (2 subsequent siblings)
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob
The order test stored the flow ID in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-eventdev/test_order_atq.c | 4 ++--
app/test-eventdev/test_order_common.c | 21 ++++++++++++++++-----
app/test-eventdev/test_order_common.h | 19 +++++++++++++++++++
app/test-eventdev/test_order_queue.c | 4 ++--
4 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c
index cfcb1dc4e9..b135ac4e55 100644
--- a/app/test-eventdev/test_order_atq.c
+++ b/app/test-eventdev/test_order_atq.c
@@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ flow_id_copy_from_mbuf(&ev);
if (ev.sub_event_type == 0) { /* stage 0 from producer */
order_atq_process_stage_0(&ev);
@@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ flow_id_copy_from_mbuf(&ev[i]);
if (ev[i].sub_event_type == 0) { /*stage 0 */
order_atq_process_stage_0(&ev[i]);
diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
index dc55d93921..c5f7317440 100644
--- a/app/test-eventdev/test_order_common.c
+++ b/app/test-eventdev/test_order_common.c
@@ -4,6 +4,8 @@
#include "test_order_common.h"
+int flow_id_dynfield_offset = -1;
+
int
order_test_result(struct evt_test *test, struct evt_options *opt)
{
@@ -46,13 +48,10 @@ order_producer(void *arg)
if (m == NULL)
continue;
- const uint32_t flow = (uintptr_t)m % nb_flows;
+ const flow_id_t flow = (uintptr_t)m % nb_flows;
/* Maintain seq number per flow */
m->seqn = producer_flow_seq[flow]++;
- m->udata64 = flow;
-
- ev.flow_id = flow;
- ev.mbuf = m;
+ flow_id_save(flow, m, &ev);
while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) {
if (t->err)
@@ -139,6 +138,18 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
{
void *test_order;
+ static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
+ .name = "test_event_dynfield_flow_id",
+ .size = sizeof(flow_id_t),
+ .align = __alignof__(flow_id_t),
+ };
+ flow_id_dynfield_offset =
+ rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
+ if (flow_id_dynfield_offset < 0) {
+ evt_err("failed to register mbuf field");
+ return -rte_errno;
+ }
+
test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
RTE_CACHE_LINE_SIZE, opt->socket_id);
if (test_order == NULL) {
diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index e0fe9c968a..9e3415e421 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -13,6 +13,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include "evt_common.h"
#include "evt_options.h"
@@ -20,6 +21,24 @@
#define BURST_SIZE 16
+typedef uint32_t flow_id_t;
+extern int flow_id_dynfield_offset;
+
+static inline void
+flow_id_copy_from_mbuf(struct rte_event *event)
+{
+ event->flow_id = *RTE_MBUF_DYNFIELD(event->mbuf,
+ flow_id_dynfield_offset, flow_id_t *);
+}
+
+static inline void
+flow_id_save(flow_id_t flow, struct rte_mbuf *mbuf, struct rte_event *event)
+{
+ *RTE_MBUF_DYNFIELD(mbuf, flow_id_dynfield_offset, flow_id_t *) = flow;
+ event->flow_id = flow;
+ event->mbuf = mbuf;
+}
+
struct test_order;
struct worker_data {
diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c
index 1511c0092d..42950626c9 100644
--- a/app/test-eventdev/test_order_queue.c
+++ b/app/test-eventdev/test_order_queue.c
@@ -35,7 +35,7 @@ order_queue_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ flow_id_copy_from_mbuf(&ev);
if (ev.queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev);
@@ -73,7 +73,7 @@ order_queue_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ flow_id_copy_from_mbuf(&ev[i]);
if (ev[i].queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev[i]);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (11 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 14/15] examples/rxtx_callbacks: " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 15/15] mbuf: remove userdata field Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru
The example used the deprecated mbuf field udata64 as input mbuf pointer.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/bbdev_app/main.c | 49 +++++++++++++++++++++++++++++++--------
1 file changed, 39 insertions(+), 10 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index e512c807cd..63e8b18e44 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -28,6 +28,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_log.h>
@@ -59,6 +60,22 @@
} \
} while (0)
+static int input_dynfield_offset = -1;
+
+static inline struct rte_mbuf *
+get_mbuf_input(struct rte_mbuf *mbuf)
+{
+ return *RTE_MBUF_DYNFIELD(mbuf,
+ input_dynfield_offset, struct rte_mbuf **);
+}
+
+static inline void
+set_mbuf_input(struct rte_mbuf *mbuf, struct rte_mbuf *input)
+{
+ *RTE_MBUF_DYNFIELD(mbuf,
+ input_dynfield_offset, struct rte_mbuf **) = input;
+}
+
static const struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_NONE,
@@ -294,11 +311,11 @@ pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
}
static inline void
-pktmbuf_userdata_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
+pktmbuf_input_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
{
unsigned int i;
for (i = 0; i < nb_to_free; ++i) {
- struct rte_mbuf *rx_pkt = mbufs[i]->userdata;
+ struct rte_mbuf *rx_pkt = get_mbuf_input(mbufs[i]);
rte_pktmbuf_free(rx_pkt);
rte_pktmbuf_free(mbufs[i]);
}
@@ -429,7 +446,7 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts)
uint16_t i;
for (i = 0; i < num_pkts; ++i) {
struct rte_mbuf *out = mbufs[i];
- struct rte_mbuf *in = out->userdata;
+ struct rte_mbuf *in = get_mbuf_input(out);
if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *,
sizeof(struct rte_ether_hdr)),
@@ -731,7 +748,7 @@ run_encoding(struct lcore_conf *lcore_conf)
rte_pktmbuf_data_len(rx_pkts_burst[i]) -
sizeof(struct rte_ether_hdr);
/* save input mbuf pointer for later comparison */
- enc_out_pkts[i]->userdata = rx_pkts_burst[i];
+ set_mbuf_input(enc_out_pkts[i], rx_pkts_burst[i]);
/* copy ethernet header */
rte_pktmbuf_reset(enc_out_pkts[i]);
@@ -775,7 +792,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_enc_ops(bbdev_id, enc_queue_id,
bbdev_ops_burst, nb_rx);
if (unlikely(nb_enq < nb_rx)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_enq],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_enq],
nb_rx - nb_enq);
rte_bbdev_enc_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_rx - nb_enq);
@@ -805,7 +822,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_sent = rte_ring_enqueue_burst(enc_to_dec_ring, (void **)enc_out_pkts,
nb_deq, NULL);
if (unlikely(nb_sent < nb_deq)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_sent],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_sent],
nb_deq - nb_sent);
lcore_stats->enc_to_dec_lost_packets += nb_deq - nb_sent;
}
@@ -842,7 +859,7 @@ run_decoding(struct lcore_conf *lcore_conf)
if (unlikely(rte_bbdev_dec_op_alloc_bulk(bbdev_op_pool, bbdev_ops_burst,
nb_recv) != 0)) {
- pktmbuf_userdata_free_bulk(recv_pkts_burst, nb_recv);
+ pktmbuf_input_free_bulk(recv_pkts_burst, nb_recv);
lcore_stats->rx_lost_packets += nb_recv;
return;
}
@@ -871,7 +888,7 @@ run_decoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_dec_ops(bbdev_id, bbdev_queue_id,
bbdev_ops_burst, nb_recv);
if (unlikely(nb_enq < nb_recv)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_enq],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_enq],
nb_recv - nb_enq);
rte_bbdev_dec_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_recv - nb_enq);
@@ -898,12 +915,12 @@ run_decoding(struct lcore_conf *lcore_conf)
/* Free the RX mbufs after verification */
for (i = 0; i < nb_deq; ++i)
- rte_pktmbuf_free(recv_pkts_burst[i]->userdata);
+ rte_pktmbuf_free(get_mbuf_input(recv_pkts_burst[i]));
/* Transmit the packets */
nb_tx = rte_eth_tx_burst(port_id, tx_queue_id, recv_pkts_burst, nb_deq);
if (unlikely(nb_tx < nb_deq)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_tx],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_tx],
nb_deq - nb_tx);
lcore_stats->tx_lost_packets += nb_deq - nb_tx;
}
@@ -1046,6 +1063,12 @@ main(int argc, char **argv)
bool stats_thread_started = false;
unsigned int main_lcore_id = rte_get_main_lcore();
+ static const struct rte_mbuf_dynfield input_dynfield_desc = {
+ .name = "example_bbdev_dynfield_input",
+ .size = sizeof(struct rte_mbuf *),
+ .align = __alignof__(struct rte_mbuf *),
+ };
+
rte_atomic16_init(&global_exit_flag);
sigret = signal(SIGTERM, signal_handler);
@@ -1115,6 +1138,12 @@ main(int argc, char **argv)
if (bbdev_mbuf_mempool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create ethdev mbuf mempool\n");
+ /* register mbuf field to store input pointer */
+ input_dynfield_offset =
+ rte_mbuf_dynfield_register(&input_dynfield_desc);
+ if (input_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize ports */
ret = initialize_ports(&app_params, ethdev_mbuf_mempool);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (12 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 13/15] examples/bbdev: switch " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 15/15] mbuf: remove userdata field Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, John McNamara
The example used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 ++--
examples/rxtx_callbacks/main.c | 20 ++++++++++++++++++--
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 62d1f39d7e..56c4293a1a 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -152,7 +152,7 @@ all packets received:
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TSC_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -179,7 +179,7 @@ packets prior to transmission:
unsigned i;
for (i = 0; i < nb_pkts; i++)
- cycles += now - pkts[i]->udata64;
+ cycles += now - TSC_FIELD(pkts[i]);
latency_numbers.total_cycles += cycles;
latency_numbers.total_pkts += nb_pkts;
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 6fe39546dd..b9a98ceddc 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -10,6 +10,7 @@
#include <rte_cycles.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#define RX_RING_SIZE 1024
#define TX_RING_SIZE 1024
@@ -18,6 +19,11 @@
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
+typedef uint64_t tsc_t;
+static int tsc_dynfield_offset = -1;
+#define TSC_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ tsc_dynfield_offset, tsc_t *))
+
static const char usage[] =
"%s EAL_ARGS -- [-t]\n";
@@ -47,7 +53,7 @@ add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TSC_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -65,7 +71,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused,
rte_eth_read_clock(port, &ticks);
for (i = 0; i < nb_pkts; i++) {
- cycles += now - pkts[i]->udata64;
+ cycles += now - TSC_FIELD(pkts[i]);
if (hw_timestamping)
queue_ticks += ticks - pkts[i]->timestamp;
}
@@ -261,6 +267,11 @@ main(int argc, char *argv[])
};
int opt, option_index;
+ static const struct rte_mbuf_dynfield tsc_dynfield_desc = {
+ .name = "example_bbdev_dynfield_tsc",
+ .size = sizeof(tsc_t),
+ .align = __alignof__(tsc_t),
+ };
/* init EAL */
int ret = rte_eal_init(argc, argv);
@@ -292,6 +303,11 @@ main(int argc, char *argv[])
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
+ tsc_dynfield_offset =
+ rte_mbuf_dynfield_register(&tsc_dynfield_desc);
+ if (tsc_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize all ports */
RTE_ETH_FOREACH_DEV(portid)
if (port_init(portid, mbuf_pool) != 0)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v3 15/15] mbuf: remove userdata field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
` (13 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 14/15] examples/rxtx_callbacks: " Thomas Monjalon
@ 2020-10-27 21:01 ` Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 21:01 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ray Kinsella, Neil Horman
As announced in the deprecation note, the field userdata / udata64
is removed to give more space to the dynamic fields.
This is how the mbuf layout looks like (pahole-style):
word type name byte size
0 void * buf_addr; /* 0 + 8 */
1 rte_iova_t buf_iova /* 8 + 8 */
/* --- RTE_MARKER64 rearm_data; */
2 uint16_t data_off; /* 16 + 2 */
uint16_t refcnt; /* 18 + 2 */
uint16_t nb_segs; /* 20 + 2 */
uint16_t port; /* 22 + 2 */
3 uint64_t ol_flags; /* 24 + 8 */
/* --- RTE_MARKER rx_descriptor_fields1; */
4 uint32_t union packet_type; /* 32 + 4 */
uint32_t pkt_len; /* 36 + 4 */
5 uint16_t data_len; /* 40 + 2 */
uint16_t vlan_tci; /* 42 + 2 */
5.5 uint64_t union hash; /* 44 + 8 */
6.5 uint16_t vlan_tci_outer; /* 52 + 2 */
uint16_t buf_len; /* 54 + 2 */
7 uint64_t timestamp; /* 56 + 8 */
/* --- RTE_MARKER cacheline1; */
8 struct rte_mempool * pool; /* 64 + 8 */
9 struct rte_mbuf * next; /* 72 + 8 */
10 uint64_t union tx_offload; /* 80 + 8 */
11 uint16_t priv_size; /* 88 + 2 */
uint16_t timesync; /* 90 + 2 */
uint32_t seqn; /* 92 + 4 */
12 struct rte_mbuf_ext_shared_info * shinfo; /* 96 + 8 */
13 uint64_t dynfield1[3]; /* 104 + 24 */
16 /* --- END 128 */
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +++
lib/librte_kni/rte_kni_common.h | 3 +--
lib/librte_mbuf/rte_mbuf_core.h | 8 +-------
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 2e082499b8..0f6f1df12a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,7 +87,6 @@ Deprecation Notices
The following static fields will be moved as dynamic:
- ``timestamp``
- - ``userdata`` / ``udata64``
- ``seqn``
As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index d8ac359e51..3cec526b6a 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -426,6 +426,9 @@ API Changes
the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
The field ``refcnt`` is remaining from the old unions.
+* mbuf: Removed the unioned fields ``userdata`` and ``udata64``
+ from the structure ``rte_mbuf``. It is replaced with dynamic fields.
+
* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
replaced with a private enum in the PCI subsystem.
diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
index 21b477f0aa..0db45e6a24 100644
--- a/lib/librte_kni/rte_kni_common.h
+++ b/lib/librte_kni/rte_kni_common.h
@@ -86,8 +86,7 @@ struct rte_kni_mbuf {
uint16_t data_len; /**< Amount of data in segment buffer. */
/* fields on second cache line */
- char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
- void *pool;
+ void *pool __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
void *next; /**< Physical address of next mbuf in kernel. */
};
diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index 065d87d28a..a65eaaf692 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -599,12 +599,6 @@ struct rte_mbuf {
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
- RTE_STD_C11
- union {
- void *userdata; /**< Can be used for external metadata */
- uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
- };
-
struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
struct rte_mbuf *next; /**< Next segment of scattered packet. */
@@ -662,7 +656,7 @@ struct rte_mbuf {
*/
struct rte_mbuf_ext_shared_info *shinfo;
- uint64_t dynfield1[2]; /**< Reserved for dynamic fields. */
+ uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */
} __rte_cache_aligned;
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v3 07/15] net/ark: switch user data to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 07/15] net/ark: switch user data " Thomas Monjalon
@ 2020-10-27 22:30 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-27 22:30 UTC (permalink / raw)
To: Ed Czeck
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, andrew.rybchenko, akhil.goyal, Shepard Siegel,
John Miller, Thomas Monjalon
27/10/2020 22:01, Thomas Monjalon:
> The second field of metadata is reserved for user data
> which was using a deprecated mbuf field.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> doc/api/doxy-api-index.md | 1 +
> doc/api/doxy-api.conf.in | 1 +
> drivers/net/ark/ark_ethdev.c | 18 +++++++++++
> drivers/net/ark/ark_ethdev_rx.c | 3 +-
> drivers/net/ark/ark_ethdev_tx.c | 3 +-
> drivers/net/ark/rte_pmd_ark.h | 56 +++++++++++++++++++++++++++++++++
> 6 files changed, 80 insertions(+), 2 deletions(-)
Missing changes (for future v4):
--- a/drivers/net/ark/rte_pmd_ark.h
+++ b/drivers/net/ark/rte_pmd_ark.h
@@ -43,6 +43,7 @@ rte_pmd_ark_mbuf_userdata_get(const struct rte_mbuf *mbuf)
* Write user data to mbuf.
*
* @param mbuf Structure to write into.
+ * @param data User data.
*/
__rte_experimental
static inline void
--- a/drivers/net/ark/version.map
+++ b/drivers/net/ark/version.map
@@ -1,3 +1,7 @@
DPDK_21 {
+ global:
+
+ rte_pmd_ark_userdata_dynfield_offset;
+
local: *;
};
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID " Thomas Monjalon
@ 2020-10-28 4:54 ` Jerin Jacob
2020-10-28 7:43 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Jerin Jacob @ 2020-10-28 4:54 UTC (permalink / raw)
To: Thomas Monjalon, McDaniel, Timothy
Cc: dpdk-dev, Ferruh Yigit, David Marchand, Richardson, Bruce,
Olivier Matz, Andrew Rybchenko, Akhil Goyal, Jerin Jacob
On Wed, Oct 28, 2020 at 2:35 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The order test stored the flow ID in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> app/test-eventdev/test_order_atq.c | 4 ++--
> app/test-eventdev/test_order_common.c | 21 ++++++++++++++++-----
> app/test-eventdev/test_order_common.h | 19 +++++++++++++++++++
> app/test-eventdev/test_order_queue.c | 4 ++--
> 4 files changed, 39 insertions(+), 9 deletions(-)
+ timothy.mcdaniel@intel.com
>
> diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c
> index cfcb1dc4e9..b135ac4e55 100644
> --- a/app/test-eventdev/test_order_atq.c
> +++ b/app/test-eventdev/test_order_atq.c
> @@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap)
> }
>
> if (!flow_id_cap)
> - ev.flow_id = ev.mbuf->udata64;
> + flow_id_copy_from_mbuf(&ev);
>
> if (ev.sub_event_type == 0) { /* stage 0 from producer */
> order_atq_process_stage_0(&ev);
> @@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap)
>
> for (i = 0; i < nb_rx; i++) {
> if (!flow_id_cap)
> - ev[i].flow_id = ev[i].mbuf->udata64;
> + flow_id_copy_from_mbuf(&ev[i]);
>
> if (ev[i].sub_event_type == 0) { /*stage 0 */
> order_atq_process_stage_0(&ev[i]);
> diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
> index dc55d93921..c5f7317440 100644
> --- a/app/test-eventdev/test_order_common.c
> +++ b/app/test-eventdev/test_order_common.c
> @@ -4,6 +4,8 @@
>
> #include "test_order_common.h"
>
> +int flow_id_dynfield_offset = -1;
See below,
> +
> int
> order_test_result(struct evt_test *test, struct evt_options *opt)
> {
> @@ -46,13 +48,10 @@ order_producer(void *arg)
> if (m == NULL)
> continue;
>
> - const uint32_t flow = (uintptr_t)m % nb_flows;
> + const flow_id_t flow = (uintptr_t)m % nb_flows;
> /* Maintain seq number per flow */
> m->seqn = producer_flow_seq[flow]++;
> - m->udata64 = flow;
> -
> - ev.flow_id = flow;
> - ev.mbuf = m;
> + flow_id_save(flow, m, &ev);
>
> while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) {
> if (t->err)
> @@ -139,6 +138,18 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
> {
> void *test_order;
>
> + static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
> + .name = "test_event_dynfield_flow_id",
> + .size = sizeof(flow_id_t),
> + .align = __alignof__(flow_id_t),
> + };
> + flow_id_dynfield_offset =
> + rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
Since this path used in fastpath, could you move flow_id_dynfield_offset to
test_order's initial entry as that cache will be warm always.
> + if (flow_id_dynfield_offset < 0) {
> + evt_err("failed to register mbuf field");
> + return -rte_errno;
> + }
> +
> test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
> RTE_CACHE_LINE_SIZE, opt->socket_id);
See above
The rest of the eventdev and Graph changes are fine.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-28 4:54 ` Jerin Jacob
@ 2020-10-28 7:43 ` Thomas Monjalon
2020-10-28 8:06 ` Jerin Jacob
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 7:43 UTC (permalink / raw)
To: Jerin Jacob, Jerin Jacob
Cc: McDaniel, Timothy, dpdk-dev, Ferruh Yigit, David Marchand,
Richardson, Bruce, Olivier Matz, Andrew Rybchenko, Akhil Goyal
28/10/2020 05:54, Jerin Jacob:
> On Wed, Oct 28, 2020 at 2:35 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > The order test stored the flow ID in the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> > + static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
> > + .name = "test_event_dynfield_flow_id",
> > + .size = sizeof(flow_id_t),
> > + .align = __alignof__(flow_id_t),
> > + };
> > + flow_id_dynfield_offset =
> > + rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
>
>
> Since this path used in fastpath, could you move flow_id_dynfield_offset to
> test_order's initial entry as that cache will be warm always.
I don't understand. Are you talking about the offset value?
This field will be in the second part of mbuf, as udata64 was.
Or are you talking about the storage of the offset variable?
> > + if (flow_id_dynfield_offset < 0) {
> > + evt_err("failed to register mbuf field");
> > + return -rte_errno;
> > + }
> > +
> > test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
> > RTE_CACHE_LINE_SIZE, opt->socket_id);
>
> See above
You mean the offset should be stored in this struct test_order?
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-28 7:43 ` Thomas Monjalon
@ 2020-10-28 8:06 ` Jerin Jacob
0 siblings, 0 replies; 178+ messages in thread
From: Jerin Jacob @ 2020-10-28 8:06 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Jerin Jacob, McDaniel, Timothy, dpdk-dev, Ferruh Yigit,
David Marchand, Richardson, Bruce, Olivier Matz,
Andrew Rybchenko, Akhil Goyal
On Wed, Oct 28, 2020 at 1:13 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 28/10/2020 05:54, Jerin Jacob:
> > On Wed, Oct 28, 2020 at 2:35 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > >
> > > The order test stored the flow ID in the deprecated mbuf field udata64.
> > > It is moved to a dynamic field in order to allow removal of udata64.
> > >
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > ---
> > > + static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
> > > + .name = "test_event_dynfield_flow_id",
> > > + .size = sizeof(flow_id_t),
> > > + .align = __alignof__(flow_id_t),
> > > + };
> > > + flow_id_dynfield_offset =
> > > + rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
> >
> >
> > Since this path used in fastpath, could you move flow_id_dynfield_offset to
> > test_order's initial entry as that cache will be warm always.
>
> I don't understand. Are you talking about the offset value?
> This field will be in the second part of mbuf, as udata64 was.
> Or are you talking about the storage of the offset variable?
Yes. Storage of the offset variable.
>
> > > + if (flow_id_dynfield_offset < 0) {
> > > + evt_err("failed to register mbuf field");
> > > + return -rte_errno;
> > > + }
> > > +
> > > test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
> > > RTE_CACHE_LINE_SIZE, opt->socket_id);
> >
> > See above
>
> You mean the offset should be stored in this struct test_order?
Yes. Instead of a global variable flow_id_dynfield_offset
>
>
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-27 16:26 ` Thomas Monjalon
@ 2020-10-28 9:30 ` Nithin Dabilpuram
2020-10-28 10:08 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Nithin Dabilpuram @ 2020-10-28 9:30 UTC (permalink / raw)
To: thomas, Nithin Dabilpuram, Pavan Nikhilesh, Jerin Jacob,
Ruifeng Wang, Bruce Richardson, Konstantin Ananyev
Cc: kirankumark, dev
From: Thomas Monjalon <thomas@monjalon.net>
The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
lib/librte_node/ip4_lookup.c | 40 ++++++++++++++++++++++++--------
lib/librte_node/ip4_lookup_neon.h | 20 +++++++---------
lib/librte_node/ip4_lookup_sse.h | 36 ++++++++++++++--------------
lib/librte_node/ip4_rewrite.c | 49 +++++++++++++++++++++++++++++----------
lib/librte_node/node_private.h | 13 ++++++++---
5 files changed, 103 insertions(+), 55 deletions(-)
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 8835aab..d083a72 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -29,8 +29,23 @@ struct ip4_lookup_node_main {
struct rte_lpm *lpm_tbl[RTE_MAX_NUMA_NODES];
};
+struct ip4_lookup_node_ctx {
+ /* Socket's LPM table */
+ struct rte_lpm *lpm;
+ /* Dynamic offset to mbuf priv1 */
+ int mbuf_priv1_off;
+};
+
+int node_mbuf_priv1_dynfield_offset = -1;
+
static struct ip4_lookup_node_main ip4_lookup_nm;
+#define IP4_LOOKUP_NODE_LPM(ctx) \
+ (((struct ip4_lookup_node_ctx *)ctx)->lpm)
+
+#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \
+ (((struct ip4_lookup_node_ctx *)ctx)->mbuf_priv1_off)
+
#if defined(__ARM_NEON)
#include "ip4_lookup_neon.h"
#elif defined(RTE_ARCH_X86)
@@ -41,12 +56,13 @@ static uint16_t
ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
struct rte_ipv4_hdr *ipv4_hdr;
void **to_next, **from;
uint16_t last_spec = 0;
struct rte_mbuf *mbuf;
rte_edge_t next_index;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
int i, rc;
@@ -55,9 +71,6 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE;
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
-
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
from = objs;
/* Get stream for the speculated next node */
@@ -72,14 +85,14 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf)->nh = (uint16_t)next_hop;
+ node_mbuf_priv1(mbuf, dyn)->nh = (uint16_t)next_hop;
next_hop = next_hop >> 16;
next = (uint16_t)next_hop;
@@ -169,15 +182,19 @@ setup_lpm(struct ip4_lookup_node_main *nm, int socket)
static int
ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
{
- struct rte_lpm **lpm_p = (struct rte_lpm **)&node->ctx;
uint16_t socket, lcore_id;
static uint8_t init_once;
int rc;
RTE_SET_USED(graph);
- RTE_SET_USED(node);
+ RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_node_ctx) > RTE_NODE_CTX_SZ);
if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+
/* Setup LPM tables for all sockets */
RTE_LCORE_FOREACH(lcore_id)
{
@@ -192,7 +209,10 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
}
init_once = 1;
}
- *lpm_p = ip4_lookup_nm.lpm_tbl[graph->socket];
+
+ /* Update socket's LPM and mbuf dyn priv1 offset in node ctx */
+ IP4_LOOKUP_NODE_LPM(node->ctx) = ip4_lookup_nm.lpm_tbl[graph->socket];
+ IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
#if defined(__ARM_NEON) || defined(RTE_ARCH_X86)
if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h
index 0ad2763..d5c8da3 100644
--- a/lib/librte_node/ip4_lookup_neon.h
+++ b/lib/librte_node/ip4_lookup_neon.h
@@ -11,12 +11,13 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
struct rte_ipv4_hdr *ipv4_hdr;
void **to_next, **from;
uint16_t last_spec = 0;
rte_edge_t next_index;
uint16_t n_left_from;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
rte_xmm_t result;
@@ -30,9 +31,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
-
pkts = (struct rte_mbuf **)objs;
from = objs;
n_left_from = nb_objs;
@@ -119,10 +117,10 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
priv23.u16[0] = result.u16[4];
priv23.u16[4] = result.u16[6];
- node_mbuf_priv1(mbuf0)->u = priv01.u64[0];
- node_mbuf_priv1(mbuf1)->u = priv01.u64[1];
- node_mbuf_priv1(mbuf2)->u = priv23.u64[0];
- node_mbuf_priv1(mbuf3)->u = priv23.u64[1];
+ node_mbuf_priv1(mbuf0, dyn)->u = priv01.u64[0];
+ node_mbuf_priv1(mbuf1, dyn)->u = priv01.u64[1];
+ node_mbuf_priv1(mbuf2, dyn)->u = priv23.u64[0];
+ node_mbuf_priv1(mbuf3, dyn)->u = priv23.u64[1];
/* Enqueue four to next node */
rte_edge_t fix_spec = ((next_index == result.u16[1]) &&
@@ -197,14 +195,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf0)->nh = (uint16_t)next_hop;
+ node_mbuf_priv1(mbuf0, dyn)->nh = (uint16_t)next_hop;
next_hop = next_hop >> 16;
next0 = (uint16_t)next_hop;
diff --git a/lib/librte_node/ip4_lookup_sse.h b/lib/librte_node/ip4_lookup_sse.h
index 264c986..74dbf97 100644
--- a/lib/librte_node/ip4_lookup_sse.h
+++ b/lib/librte_node/ip4_lookup_sse.h
@@ -11,13 +11,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
rte_edge_t next0, next1, next2, next3, next_index;
struct rte_ipv4_hdr *ipv4_hdr;
uint32_t ip0, ip1, ip2, ip3;
void **to_next, **from;
uint16_t last_spec = 0;
uint16_t n_left_from;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
rte_xmm_t dst;
@@ -29,9 +30,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
-
pkts = (struct rte_mbuf **)objs;
from = objs;
n_left_from = nb_objs;
@@ -78,24 +76,24 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
sizeof(struct rte_ether_hdr));
ip0 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf1 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
ip1 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf1)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf1)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf1, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf1, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf2 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
ip2 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf2)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf2)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf2, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf2, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf3 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv4_hdr *,
@@ -111,23 +109,23 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
dip = _mm_shuffle_epi8(dip, bswap_mask);
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf3)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf3)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf3, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf3, dyn)->ttl = ipv4_hdr->time_to_live;
/* Perform LPM lookup to get NH and next node */
rte_lpm_lookupx4(lpm, dip, dst.u32, drop_nh);
/* Extract next node id and NH */
- node_mbuf_priv1(mbuf0)->nh = dst.u32[0] & 0xFFFF;
+ node_mbuf_priv1(mbuf0, dyn)->nh = dst.u32[0] & 0xFFFF;
next0 = (dst.u32[0] >> 16);
- node_mbuf_priv1(mbuf1)->nh = dst.u32[1] & 0xFFFF;
+ node_mbuf_priv1(mbuf1, dyn)->nh = dst.u32[1] & 0xFFFF;
next1 = (dst.u32[1] >> 16);
- node_mbuf_priv1(mbuf2)->nh = dst.u32[2] & 0xFFFF;
+ node_mbuf_priv1(mbuf2, dyn)->nh = dst.u32[2] & 0xFFFF;
next2 = (dst.u32[2] >> 16);
- node_mbuf_priv1(mbuf3)->nh = dst.u32[3] & 0xFFFF;
+ node_mbuf_priv1(mbuf3, dyn)->nh = dst.u32[3] & 0xFFFF;
next3 = (dst.u32[3] >> 16);
/* Enqueue four to next node */
@@ -202,14 +200,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf0)->nh = next_hop & 0xFFFF;
+ node_mbuf_priv1(mbuf0, dyn)->nh = next_hop & 0xFFFF;
next0 = (next_hop >> 16);
if (unlikely(next_index ^ next0)) {
diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c
index bb7f671..99ecb45 100644
--- a/lib/librte_node/ip4_rewrite.c
+++ b/lib/librte_node/ip4_rewrite.c
@@ -19,14 +19,28 @@
#include "ip4_rewrite_priv.h"
#include "node_private.h"
+struct ip4_rewrite_node_ctx {
+ /* Dynamic offset to mbuf priv1 */
+ int mbuf_priv1_off;
+ /* Cached next index */
+ uint16_t next_index;
+};
+
static struct ip4_rewrite_node_main *ip4_rewrite_nm;
+#define IP4_REWRITE_NODE_LAST_NEXT(ctx) \
+ (((struct ip4_rewrite_node_ctx *)ctx)->next_index)
+
+#define IP4_REWRITE_NODE_PRIV1_OFF(ctx) \
+ (((struct ip4_rewrite_node_ctx *)ctx)->mbuf_priv1_off)
+
static uint16_t
ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
struct ip4_rewrite_nh_header *nh = ip4_rewrite_nm->nh;
+ const int dyn = IP4_REWRITE_NODE_PRIV1_OFF(node->ctx);
uint16_t next0, next1, next2, next3, next_index;
struct rte_ipv4_hdr *ip0, *ip1, *ip2, *ip3;
uint16_t n_left_from, held = 0, last_spec = 0;
@@ -37,7 +51,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
int i;
/* Speculative next as last next */
- next_index = *(uint16_t *)node->ctx;
+ next_index = IP4_REWRITE_NODE_LAST_NEXT(node->ctx);
rte_prefetch0(nh);
pkts = (struct rte_mbuf **)objs;
@@ -68,10 +82,10 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
pkts += 4;
n_left_from -= 4;
- priv01.u64[0] = node_mbuf_priv1(mbuf0)->u;
- priv01.u64[1] = node_mbuf_priv1(mbuf1)->u;
- priv23.u64[0] = node_mbuf_priv1(mbuf2)->u;
- priv23.u64[1] = node_mbuf_priv1(mbuf3)->u;
+ priv01.u64[0] = node_mbuf_priv1(mbuf0, dyn)->u;
+ priv01.u64[1] = node_mbuf_priv1(mbuf1, dyn)->u;
+ priv23.u64[0] = node_mbuf_priv1(mbuf2, dyn)->u;
+ priv23.u64[1] = node_mbuf_priv1(mbuf3, dyn)->u;
/* Increment checksum by one. */
priv01.u32[1] += rte_cpu_to_be_16(0x0100);
@@ -203,17 +217,17 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
n_left_from -= 1;
d0 = rte_pktmbuf_mtod(mbuf0, void *);
- rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0)->nh].rewrite_data,
- nh[node_mbuf_priv1(mbuf0)->nh].rewrite_len);
+ rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_data,
+ nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_len);
- next0 = nh[node_mbuf_priv1(mbuf0)->nh].tx_node;
+ next0 = nh[node_mbuf_priv1(mbuf0, dyn)->nh].tx_node;
ip0 = (struct rte_ipv4_hdr *)((uint8_t *)d0 +
sizeof(struct rte_ether_hdr));
- chksum = node_mbuf_priv1(mbuf0)->cksum +
+ chksum = node_mbuf_priv1(mbuf0, dyn)->cksum +
rte_cpu_to_be_16(0x0100);
chksum += chksum >= 0xffff;
ip0->hdr_checksum = chksum;
- ip0->time_to_live = node_mbuf_priv1(mbuf0)->ttl - 1;
+ ip0->time_to_live = node_mbuf_priv1(mbuf0, dyn)->ttl - 1;
if (unlikely(next_index ^ next0)) {
/* Copy things successfully speculated till now */
@@ -240,7 +254,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
rte_memcpy(to_next, from, last_spec * sizeof(from[0]));
rte_node_next_stream_put(graph, node, next_index, held);
/* Save the last next used */
- *(uint16_t *)node->ctx = next_index;
+ IP4_REWRITE_NODE_LAST_NEXT(node->ctx) = next_index;
return nb_objs;
}
@@ -248,9 +262,20 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
static int
ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
{
+ static bool init_once;
RTE_SET_USED(graph);
- RTE_SET_USED(node);
+ RTE_BUILD_BUG_ON(sizeof(struct ip4_rewrite_node_ctx) > RTE_NODE_CTX_SZ);
+
+ if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+ init_once = true;
+ }
+ IP4_REWRITE_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
+
node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
return 0;
diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
index ab7941c..8c73d5d 100644
--- a/lib/librte_node/node_private.h
+++ b/lib/librte_node/node_private.h
@@ -8,6 +8,7 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
extern int rte_node_logtype;
#define NODE_LOG(level, node_name, ...) \
@@ -21,7 +22,6 @@ extern int rte_node_logtype;
#define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
/**
- *
* Node mbuf private data to store next hop, ttl and checksum.
*/
struct node_mbuf_priv1 {
@@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
};
};
+static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
+ .name = "rte_node_dynfield_priv1",
+ .size = sizeof(struct node_mbuf_priv1),
+ .align = __alignof__(struct node_mbuf_priv1),
+};
+extern int node_mbuf_priv1_dynfield_offset;
+
/**
* Node mbuf private area 2.
*/
@@ -58,9 +65,9 @@ struct node_mbuf_priv2 {
* Pointer to the mbuf_priv1.
*/
static __rte_always_inline struct node_mbuf_priv1 *
-node_mbuf_priv1(struct rte_mbuf *m)
+node_mbuf_priv1(struct rte_mbuf *m, const int offset)
{
- return (struct node_mbuf_priv1 *)&m->udata64;
+ return RTE_MBUF_DYNFIELD(m, offset, struct node_mbuf_priv1 *);
}
/**
--
2.8.4
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 9:30 ` [dpdk-dev] [PATCH v4] " Nithin Dabilpuram
@ 2020-10-28 10:08 ` Thomas Monjalon
2020-10-28 10:24 ` Van Haaren, Harry
2020-10-28 10:33 ` Nithin Dabilpuram
0 siblings, 2 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:08 UTC (permalink / raw)
To: Nithin Dabilpuram
Cc: Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang, Bruce Richardson,
Konstantin Ananyev, kirankumark, dev, david.marchand,
olivier.matz
28/10/2020 10:30, Nithin Dabilpuram:
> From: Thomas Monjalon <thomas@monjalon.net>
>
> The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
[...]
> + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
That's interesting.
You copy the offset in the node context for better performance.
How much is it better than with global offset variable?
How much it decreases compared to a static mbuf field?
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 10:08 ` Thomas Monjalon
@ 2020-10-28 10:24 ` Van Haaren, Harry
2020-10-28 10:42 ` Nithin Dabilpuram
2020-10-28 18:07 ` Thomas Monjalon
2020-10-28 10:33 ` Nithin Dabilpuram
1 sibling, 2 replies; 178+ messages in thread
From: Van Haaren, Harry @ 2020-10-28 10:24 UTC (permalink / raw)
To: Thomas Monjalon, Nithin Dabilpuram
Cc: Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang, Richardson, Bruce,
Ananyev, Konstantin, kirankumark, dev, david.marchand,
olivier.matz
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Thomas Monjalon
> Sent: Wednesday, October 28, 2020 10:09 AM
> To: Nithin Dabilpuram <ndabilpuram@marvell.com>
> Cc: Pavan Nikhilesh <pbhagavatula@marvell.com>; Jerin Jacob
> <jerinj@marvell.com>; Ruifeng Wang <ruifeng.wang@arm.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; kirankumark@marvell.com; dev@dpdk.org;
> david.marchand@redhat.com; olivier.matz@6wind.com
> Subject: Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf
> field
>
> 28/10/2020 10:30, Nithin Dabilpuram:
> > From: Thomas Monjalon <thomas@monjalon.net>
> >
> > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> [...]
> > + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) =
> node_mbuf_priv1_dynfield_offset;
>
> That's interesting.
> You copy the offset in the node context for better performance.
> How much is it better than with global offset variable?
> How much it decreases compared to a static mbuf field?
Also interested in this topic, I'll offer the logical/theory point of view;
With a static field, the offset into the mbuf can be encoded in the instruction
stream, meaning there are no d-cache loads to identify particular dynamic field.
With a static/global variable, the cache line where the value resides is presumably
not hot in cache per burst (assuming an application that does significant work, so not
in cache since last burst). Hence overhead estimate could be 1x cache line load per burst.
With the data copied into the node, the offset is presumably on a hot cache line as the
node is using other data-members of its context. As a result, perhaps a cold static cache
line load is converted to a hot node-context line re-use.
Real world overhead likely depends on A) does the application cache-trash enough to make
the static/global line fall out of cache - causing perf degradation due to reload, and B) does
the node->ctx still fit in the same number of lines as before if the value is copied there.
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (16 preceding siblings ...)
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
` (14 more replies)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
19 siblings, 15 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
The mbuf field userdata (aliased as udata64)
was announced to be removed for two reasons:
- applications, libraries and drivers used the same field
for different purposes, with a risk of usage conflict.
- this field always used 8 bytes even if unneeded
Some dynamic fields are created when needed to replace
the big static userdata field.
As a consequence, 8 bytes can be re-allocated to dynamic fields.
This mbuf layout change is important to allow adding more features
(consuming more dynamic fields) during the next year.
v4 (thanks Jerin, Nithin and Ed):
- move rte_node dynfield offset to hotter context in cache
- move test-eventdev dynfield offset to hotter context in cache
- split ARK user data for Rx and Tx + more ARK fixes
v3 (thanks Olivier):
- use typedef for new field types
- fix node field type
- initialize offsets to -1
- add more inline functions
- inline rte_security_dynfield_is_registered
- add PMD-specific userdata field for ARK
v2 (thanks David & Andrew):
- fix some indentations
- return -rte_errno consistently
- make some type casts more precise
- define dynfield types in macros
- hide field description in rte_security
- do not lookup security dynfield in ipsec-secgw
- do not use the existing timestamp field for other purpose
Ed Czeck (1):
net/ark: switch user data to dynamic mbuf fields
Nithin Dabilpuram (1):
node: switch IPv4 metadata to dynamic mbuf field
Thomas Monjalon (13):
examples: enclose DPDK includes with angle brackets
kni: move header file from EAL
mbuf: fix typo in dynamic field convention note
security: switch metadata to dynamic mbuf field
event/sw: switch test counter to dynamic mbuf field
net/bnxt: switch CFA code to dynamic mbuf field
net/vmxnet3: switch MSS hint to dynamic mbuf field
test/distributor: switch sequence to dynamic mbuf field
test/graph: switch user data to dynamic mbuf field
app/eventdev: switch flow ID to dynamic mbuf field
examples/bbdev: switch to dynamic mbuf field
examples/rxtx_callbacks: switch to dynamic mbuf field
mbuf: remove userdata field
app/test-eventdev/test_order_atq.c | 4 +-
app/test-eventdev/test_order_common.c | 21 ++-
app/test-eventdev/test_order_common.h | 21 +++
app/test-eventdev/test_order_queue.c | 4 +-
app/test/test_distributor.c | 28 +++-
app/test/test_graph.c | 94 +++++++------
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf.in | 1 +
doc/guides/prog_guide/rte_security.rst | 9 +-
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 +-
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 +-
drivers/event/sw/sw_evdev_selftest.c | 23 +++-
drivers/net/ark/ark_ethdev.c | 39 ++++++
drivers/net/ark/ark_ethdev_rx.c | 3 +-
drivers/net/ark/ark_ethdev_tx.c | 3 +-
drivers/net/ark/meson.build | 2 +
drivers/net/ark/rte_pmd_ark.h | 123 ++++++++++++++++++
drivers/net/ark/version.map | 7 +
drivers/net/bnxt/bnxt_ethdev.c | 19 +++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 5 +
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +
drivers/net/ixgbe/ixgbe_ipsec.c | 5 +-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 +-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 +-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 +
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +-
examples/bbdev_app/main.c | 79 +++++++----
examples/bond/main.c | 11 +-
examples/ipsec-secgw/ipsec-secgw.c | 9 +-
examples/ipsec-secgw/ipsec_worker.c | 12 +-
examples/rxtx_callbacks/main.c | 20 ++-
examples/tep_termination/vxlan_setup.c | 2 +-
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
.../include => librte_kni}/rte_kni_common.h | 3 +-
lib/librte_mbuf/rte_mbuf_core.h | 8 +-
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
lib/librte_node/ip4_lookup.c | 40 ++++--
lib/librte_node/ip4_lookup_neon.h | 20 ++-
lib/librte_node/ip4_lookup_sse.h | 36 +++--
lib/librte_node/ip4_rewrite.c | 49 +++++--
lib/librte_node/node_private.h | 13 +-
lib/librte_security/rte_security.c | 16 +++
lib/librte_security/rte_security.h | 42 ++++++
lib/librte_security/rte_security_driver.h | 3 +
lib/librte_security/version.map | 2 +
54 files changed, 659 insertions(+), 189 deletions(-)
create mode 100644 drivers/net/ark/rte_pmd_ark.h
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (97%)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 01/15] examples: enclose DPDK includes with angle brackets
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 02/15] kni: move header file from EAL Thomas Monjalon
` (13 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru, Chas Williams,
Min Hu (Connor),
Xiaoyun Li
In examples, DPDK header files are external,
so they must be enclosed with angle brackets, not quotes.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/bbdev_app/main.c | 30 +++++++++++++-------------
examples/bond/main.c | 11 ++++------
examples/tep_termination/vxlan_setup.c | 2 +-
3 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 43fe631760..e512c807cd 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -18,21 +18,21 @@
#include <getopt.h>
#include <signal.h>
-#include "rte_atomic.h"
-#include "rte_common.h"
-#include "rte_eal.h"
-#include "rte_cycles.h"
-#include "rte_ether.h"
-#include "rte_ethdev.h"
-#include "rte_ip.h"
-#include "rte_lcore.h"
-#include "rte_malloc.h"
-#include "rte_mbuf.h"
-#include "rte_memory.h"
-#include "rte_mempool.h"
-#include "rte_log.h"
-#include "rte_bbdev.h"
-#include "rte_bbdev_op.h"
+#include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_eal.h>
+#include <rte_cycles.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_ip.h>
+#include <rte_lcore.h>
+#include <rte_malloc.h>
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_log.h>
+#include <rte_bbdev.h>
+#include <rte_bbdev_op.h>
/* LLR values - negative value for '1' bit */
#define LLR_1_BIT 0x81
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 398553b785..81a6fa976b 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -41,6 +41,10 @@
#include <rte_tcp.h>
#include <rte_arp.h>
#include <rte_spinlock.h>
+#include <rte_devargs.h>
+#include <rte_byteorder.h>
+#include <rte_cpuflags.h>
+#include <rte_eth_bond.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
@@ -53,13 +57,6 @@
#include "main.h"
-#include <rte_devargs.h>
-
-
-#include "rte_byteorder.h"
-#include "rte_cpuflags.h"
-#include "rte_eth_bond.h"
-
#define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1
#define NB_MBUF (1024*8)
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index 4b44ccc143..0bcd870b4a 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -18,9 +18,9 @@
#include <rte_ip.h>
#include <rte_udp.h>
#include <rte_tcp.h>
+#include <rte_vhost.h>
#include "main.h"
-#include "rte_vhost.h"
#include "vxlan.h"
#include "vxlan_setup.h"
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 02/15] kni: move header file from EAL
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
` (12 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal
Since the kernel module is not part of EAL anymore,
there is no need to have the common KNI header file in EAL.
The file rte_kni_common.h is moved to librte_kni.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h | 0
4 files changed, 2 insertions(+), 3 deletions(-)
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (100%)
diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build
index d696347f22..07e0c9dae7 100644
--- a/kernel/linux/kni/meson.build
+++ b/kernel/linux/kni/meson.build
@@ -18,7 +18,7 @@ custom_target('rte_kni',
'src=' + meson.current_source_dir(),
'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
' -I' + meson.source_root() + '/lib/librte_eal/include' +
- ' -I' + meson.source_root() + '/lib/librte_eal/linux/include' +
+ ' -I' + meson.source_root() + '/lib/librte_kni' +
' -I' + meson.build_root() +
' -I' + meson.current_source_dir(),
'modules'],
diff --git a/lib/librte_eal/linux/include/meson.build b/lib/librte_eal/linux/include/meson.build
index 1241894b3c..7d18dd52f1 100644
--- a/lib/librte_eal/linux/include/meson.build
+++ b/lib/librte_eal/linux/include/meson.build
@@ -4,6 +4,5 @@
includes += include_directories('.')
headers += files(
- 'rte_kni_common.h',
'rte_os.h',
)
diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build
index 963eae6fe0..ad598bb3d0 100644
--- a/lib/librte_kni/meson.build
+++ b/lib/librte_kni/meson.build
@@ -6,5 +6,5 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
reason = 'only supported on 64-bit linux'
endif
sources = files('rte_kni.c')
-headers = files('rte_kni.h')
+headers = files('rte_kni.h', 'rte_kni_common.h')
deps += ['ethdev', 'pci']
diff --git a/lib/librte_eal/linux/include/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
similarity index 100%
rename from lib/librte_eal/linux/include/rte_kni_common.h
rename to lib/librte_kni/rte_kni_common.h
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 03/15] mbuf: fix typo in dynamic field convention note
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 02/15] kni: move header file from EAL Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
` (11 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, stable, Konstantin Ananyev
Replace "in a in PMD" with "in a PMD".
Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 8407230ecf..0ebac88b83 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -62,7 +62,7 @@
* conventions than function names in dpdk:
* - "rte_mbuf_dynfield_<name>" if defined in mbuf library
* - "rte_<libname>_dynfield_<name>" if defined in another library
- * - "rte_net_<pmd>_dynfield_<name>" if defined in a in PMD
+ * - "rte_net_<pmd>_dynfield_<name>" if defined in a PMD
* - any name that does not start with "rte_" in an application
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (2 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 05/15] security: switch " Thomas Monjalon
` (10 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nithin Dabilpuram,
Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang, Konstantin Ananyev
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
lib/librte_node/ip4_lookup.c | 40 ++++++++++++++++++-------
lib/librte_node/ip4_lookup_neon.h | 20 ++++++-------
lib/librte_node/ip4_lookup_sse.h | 36 +++++++++++------------
lib/librte_node/ip4_rewrite.c | 49 +++++++++++++++++++++++--------
lib/librte_node/node_private.h | 13 ++++++--
5 files changed, 103 insertions(+), 55 deletions(-)
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 8835aab9dd..d083a725fc 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -29,8 +29,23 @@ struct ip4_lookup_node_main {
struct rte_lpm *lpm_tbl[RTE_MAX_NUMA_NODES];
};
+struct ip4_lookup_node_ctx {
+ /* Socket's LPM table */
+ struct rte_lpm *lpm;
+ /* Dynamic offset to mbuf priv1 */
+ int mbuf_priv1_off;
+};
+
+int node_mbuf_priv1_dynfield_offset = -1;
+
static struct ip4_lookup_node_main ip4_lookup_nm;
+#define IP4_LOOKUP_NODE_LPM(ctx) \
+ (((struct ip4_lookup_node_ctx *)ctx)->lpm)
+
+#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \
+ (((struct ip4_lookup_node_ctx *)ctx)->mbuf_priv1_off)
+
#if defined(__ARM_NEON)
#include "ip4_lookup_neon.h"
#elif defined(RTE_ARCH_X86)
@@ -41,12 +56,13 @@ static uint16_t
ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
struct rte_ipv4_hdr *ipv4_hdr;
void **to_next, **from;
uint16_t last_spec = 0;
struct rte_mbuf *mbuf;
rte_edge_t next_index;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
int i, rc;
@@ -55,9 +71,6 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE;
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
-
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
from = objs;
/* Get stream for the speculated next node */
@@ -72,14 +85,14 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf)->nh = (uint16_t)next_hop;
+ node_mbuf_priv1(mbuf, dyn)->nh = (uint16_t)next_hop;
next_hop = next_hop >> 16;
next = (uint16_t)next_hop;
@@ -169,15 +182,19 @@ setup_lpm(struct ip4_lookup_node_main *nm, int socket)
static int
ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
{
- struct rte_lpm **lpm_p = (struct rte_lpm **)&node->ctx;
uint16_t socket, lcore_id;
static uint8_t init_once;
int rc;
RTE_SET_USED(graph);
- RTE_SET_USED(node);
+ RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_node_ctx) > RTE_NODE_CTX_SZ);
if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+
/* Setup LPM tables for all sockets */
RTE_LCORE_FOREACH(lcore_id)
{
@@ -192,7 +209,10 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
}
init_once = 1;
}
- *lpm_p = ip4_lookup_nm.lpm_tbl[graph->socket];
+
+ /* Update socket's LPM and mbuf dyn priv1 offset in node ctx */
+ IP4_LOOKUP_NODE_LPM(node->ctx) = ip4_lookup_nm.lpm_tbl[graph->socket];
+ IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
#if defined(__ARM_NEON) || defined(RTE_ARCH_X86)
if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h
index 0ad2763b82..d5c8da3719 100644
--- a/lib/librte_node/ip4_lookup_neon.h
+++ b/lib/librte_node/ip4_lookup_neon.h
@@ -11,12 +11,13 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
struct rte_ipv4_hdr *ipv4_hdr;
void **to_next, **from;
uint16_t last_spec = 0;
rte_edge_t next_index;
uint16_t n_left_from;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
rte_xmm_t result;
@@ -30,9 +31,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
-
pkts = (struct rte_mbuf **)objs;
from = objs;
n_left_from = nb_objs;
@@ -119,10 +117,10 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
priv23.u16[0] = result.u16[4];
priv23.u16[4] = result.u16[6];
- node_mbuf_priv1(mbuf0)->u = priv01.u64[0];
- node_mbuf_priv1(mbuf1)->u = priv01.u64[1];
- node_mbuf_priv1(mbuf2)->u = priv23.u64[0];
- node_mbuf_priv1(mbuf3)->u = priv23.u64[1];
+ node_mbuf_priv1(mbuf0, dyn)->u = priv01.u64[0];
+ node_mbuf_priv1(mbuf1, dyn)->u = priv01.u64[1];
+ node_mbuf_priv1(mbuf2, dyn)->u = priv23.u64[0];
+ node_mbuf_priv1(mbuf3, dyn)->u = priv23.u64[1];
/* Enqueue four to next node */
rte_edge_t fix_spec = ((next_index == result.u16[1]) &&
@@ -197,14 +195,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf0)->nh = (uint16_t)next_hop;
+ node_mbuf_priv1(mbuf0, dyn)->nh = (uint16_t)next_hop;
next_hop = next_hop >> 16;
next0 = (uint16_t)next_hop;
diff --git a/lib/librte_node/ip4_lookup_sse.h b/lib/librte_node/ip4_lookup_sse.h
index 264c986071..74dbf97533 100644
--- a/lib/librte_node/ip4_lookup_sse.h
+++ b/lib/librte_node/ip4_lookup_sse.h
@@ -11,13 +11,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
rte_edge_t next0, next1, next2, next3, next_index;
struct rte_ipv4_hdr *ipv4_hdr;
uint32_t ip0, ip1, ip2, ip3;
void **to_next, **from;
uint16_t last_spec = 0;
uint16_t n_left_from;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
rte_xmm_t dst;
@@ -29,9 +30,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
-
pkts = (struct rte_mbuf **)objs;
from = objs;
n_left_from = nb_objs;
@@ -78,24 +76,24 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
sizeof(struct rte_ether_hdr));
ip0 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf1 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
ip1 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf1)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf1)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf1, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf1, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf2 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
ip2 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf2)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf2)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf2, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf2, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf3 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv4_hdr *,
@@ -111,23 +109,23 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
dip = _mm_shuffle_epi8(dip, bswap_mask);
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf3)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf3)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf3, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf3, dyn)->ttl = ipv4_hdr->time_to_live;
/* Perform LPM lookup to get NH and next node */
rte_lpm_lookupx4(lpm, dip, dst.u32, drop_nh);
/* Extract next node id and NH */
- node_mbuf_priv1(mbuf0)->nh = dst.u32[0] & 0xFFFF;
+ node_mbuf_priv1(mbuf0, dyn)->nh = dst.u32[0] & 0xFFFF;
next0 = (dst.u32[0] >> 16);
- node_mbuf_priv1(mbuf1)->nh = dst.u32[1] & 0xFFFF;
+ node_mbuf_priv1(mbuf1, dyn)->nh = dst.u32[1] & 0xFFFF;
next1 = (dst.u32[1] >> 16);
- node_mbuf_priv1(mbuf2)->nh = dst.u32[2] & 0xFFFF;
+ node_mbuf_priv1(mbuf2, dyn)->nh = dst.u32[2] & 0xFFFF;
next2 = (dst.u32[2] >> 16);
- node_mbuf_priv1(mbuf3)->nh = dst.u32[3] & 0xFFFF;
+ node_mbuf_priv1(mbuf3, dyn)->nh = dst.u32[3] & 0xFFFF;
next3 = (dst.u32[3] >> 16);
/* Enqueue four to next node */
@@ -202,14 +200,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf0)->nh = next_hop & 0xFFFF;
+ node_mbuf_priv1(mbuf0, dyn)->nh = next_hop & 0xFFFF;
next0 = (next_hop >> 16);
if (unlikely(next_index ^ next0)) {
diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c
index bb7f671b5c..99ecb457ff 100644
--- a/lib/librte_node/ip4_rewrite.c
+++ b/lib/librte_node/ip4_rewrite.c
@@ -19,14 +19,28 @@
#include "ip4_rewrite_priv.h"
#include "node_private.h"
+struct ip4_rewrite_node_ctx {
+ /* Dynamic offset to mbuf priv1 */
+ int mbuf_priv1_off;
+ /* Cached next index */
+ uint16_t next_index;
+};
+
static struct ip4_rewrite_node_main *ip4_rewrite_nm;
+#define IP4_REWRITE_NODE_LAST_NEXT(ctx) \
+ (((struct ip4_rewrite_node_ctx *)ctx)->next_index)
+
+#define IP4_REWRITE_NODE_PRIV1_OFF(ctx) \
+ (((struct ip4_rewrite_node_ctx *)ctx)->mbuf_priv1_off)
+
static uint16_t
ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
struct ip4_rewrite_nh_header *nh = ip4_rewrite_nm->nh;
+ const int dyn = IP4_REWRITE_NODE_PRIV1_OFF(node->ctx);
uint16_t next0, next1, next2, next3, next_index;
struct rte_ipv4_hdr *ip0, *ip1, *ip2, *ip3;
uint16_t n_left_from, held = 0, last_spec = 0;
@@ -37,7 +51,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
int i;
/* Speculative next as last next */
- next_index = *(uint16_t *)node->ctx;
+ next_index = IP4_REWRITE_NODE_LAST_NEXT(node->ctx);
rte_prefetch0(nh);
pkts = (struct rte_mbuf **)objs;
@@ -68,10 +82,10 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
pkts += 4;
n_left_from -= 4;
- priv01.u64[0] = node_mbuf_priv1(mbuf0)->u;
- priv01.u64[1] = node_mbuf_priv1(mbuf1)->u;
- priv23.u64[0] = node_mbuf_priv1(mbuf2)->u;
- priv23.u64[1] = node_mbuf_priv1(mbuf3)->u;
+ priv01.u64[0] = node_mbuf_priv1(mbuf0, dyn)->u;
+ priv01.u64[1] = node_mbuf_priv1(mbuf1, dyn)->u;
+ priv23.u64[0] = node_mbuf_priv1(mbuf2, dyn)->u;
+ priv23.u64[1] = node_mbuf_priv1(mbuf3, dyn)->u;
/* Increment checksum by one. */
priv01.u32[1] += rte_cpu_to_be_16(0x0100);
@@ -203,17 +217,17 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
n_left_from -= 1;
d0 = rte_pktmbuf_mtod(mbuf0, void *);
- rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0)->nh].rewrite_data,
- nh[node_mbuf_priv1(mbuf0)->nh].rewrite_len);
+ rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_data,
+ nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_len);
- next0 = nh[node_mbuf_priv1(mbuf0)->nh].tx_node;
+ next0 = nh[node_mbuf_priv1(mbuf0, dyn)->nh].tx_node;
ip0 = (struct rte_ipv4_hdr *)((uint8_t *)d0 +
sizeof(struct rte_ether_hdr));
- chksum = node_mbuf_priv1(mbuf0)->cksum +
+ chksum = node_mbuf_priv1(mbuf0, dyn)->cksum +
rte_cpu_to_be_16(0x0100);
chksum += chksum >= 0xffff;
ip0->hdr_checksum = chksum;
- ip0->time_to_live = node_mbuf_priv1(mbuf0)->ttl - 1;
+ ip0->time_to_live = node_mbuf_priv1(mbuf0, dyn)->ttl - 1;
if (unlikely(next_index ^ next0)) {
/* Copy things successfully speculated till now */
@@ -240,7 +254,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
rte_memcpy(to_next, from, last_spec * sizeof(from[0]));
rte_node_next_stream_put(graph, node, next_index, held);
/* Save the last next used */
- *(uint16_t *)node->ctx = next_index;
+ IP4_REWRITE_NODE_LAST_NEXT(node->ctx) = next_index;
return nb_objs;
}
@@ -248,9 +262,20 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
static int
ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
{
+ static bool init_once;
RTE_SET_USED(graph);
- RTE_SET_USED(node);
+ RTE_BUILD_BUG_ON(sizeof(struct ip4_rewrite_node_ctx) > RTE_NODE_CTX_SZ);
+
+ if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+ init_once = true;
+ }
+ IP4_REWRITE_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
+
node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
return 0;
diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
index ab7941c12b..8c73d5dc10 100644
--- a/lib/librte_node/node_private.h
+++ b/lib/librte_node/node_private.h
@@ -8,6 +8,7 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
extern int rte_node_logtype;
#define NODE_LOG(level, node_name, ...) \
@@ -21,7 +22,6 @@ extern int rte_node_logtype;
#define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
/**
- *
* Node mbuf private data to store next hop, ttl and checksum.
*/
struct node_mbuf_priv1 {
@@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
};
};
+static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
+ .name = "rte_node_dynfield_priv1",
+ .size = sizeof(struct node_mbuf_priv1),
+ .align = __alignof__(struct node_mbuf_priv1),
+};
+extern int node_mbuf_priv1_dynfield_offset;
+
/**
* Node mbuf private area 2.
*/
@@ -58,9 +65,9 @@ struct node_mbuf_priv2 {
* Pointer to the mbuf_priv1.
*/
static __rte_always_inline struct node_mbuf_priv1 *
-node_mbuf_priv1(struct rte_mbuf *m)
+node_mbuf_priv1(struct rte_mbuf *m, const int offset)
{
- return (struct node_mbuf_priv1 *)&m->udata64;
+ return RTE_MBUF_DYNFIELD(m, offset, struct node_mbuf_priv1 *);
}
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 05/15] security: switch metadata to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (3 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 06/15] event/sw: switch test counter " Thomas Monjalon
` (9 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Haiyue Wang, Declan Doherty,
Ankur Dwivedi, Anoob Joseph, Jeff Guo, Jerin Jacob,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
The device-specific metadata was stored in the deprecated field udata64.
It is moved to a dynamic mbuf field in order to allow removal of udata64.
The name rte_security_dynfield is not very descriptive
but it should be replaced later by separate fields for each type of data
that drivers pass to the upper layer.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
---
doc/guides/prog_guide/rte_security.rst | 9 ++--
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++-
drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 9 ++--
examples/ipsec-secgw/ipsec_worker.c | 12 ++++--
lib/librte_security/rte_security.c | 16 +++++++
lib/librte_security/rte_security.h | 42 +++++++++++++++++++
lib/librte_security/rte_security_driver.h | 3 ++
lib/librte_security/version.map | 2 +
14 files changed, 99 insertions(+), 20 deletions(-)
diff --git a/doc/guides/prog_guide/rte_security.rst b/doc/guides/prog_guide/rte_security.rst
index c64aef3de9..f72bc8a78f 100644
--- a/doc/guides/prog_guide/rte_security.rst
+++ b/doc/guides/prog_guide/rte_security.rst
@@ -125,8 +125,9 @@ ESP/AH headers will be removed from the packet and the received packet
will contains the decrypted packet only. The driver Rx path checks the
descriptors and based on the crypto status sets additional flags in
``rte_mbuf.ol_flags`` field. The driver would also set device-specific
-metadata in ``rte_mbuf.udata64`` field. This will allow the application
-to identify the security processing done on the packet.
+metadata in ``RTE_SECURITY_DYNFIELD_NAME`` field.
+This will allow the application to identify the security processing
+done on the packet.
.. note::
@@ -568,8 +569,8 @@ security session which processed the packet.
.. note::
- In case of inline processed packets, ``rte_mbuf.udata64`` field would be
- used by the driver to relay information on the security processing
+ In case of inline processed packets, ``RTE_SECURITY_DYNFIELD_NAME`` field
+ would be used by the driver to relay information on the security processing
associated with the packet. In ingress, the driver would set this in Rx
path while in egress, ``rte_security_set_pkt_metadata()`` would perform a
similar operation. The application is expected not to modify the field
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
index b80ec7bff2..4e2a0e3afe 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
@@ -455,6 +455,9 @@ otx2_crypto_sec_session_create(void *device,
if (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL)
return -ENOTSUP;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
if (rte_mempool_get(mempool, (void **)&priv)) {
otx2_err("Could not allocate security session private data");
return -ENOMEM;
@@ -514,7 +517,7 @@ otx2_crypto_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (rte_security_dynfield_t)session;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c
index 48f5082d49..62f2a5f764 100644
--- a/drivers/net/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ixgbe/ixgbe_ipsec.c
@@ -484,7 +484,8 @@ ixgbe_crypto_update_mb(void *device __rte_unused,
get_sec_session_private_data(session);
if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) {
union ixgbe_crypto_tx_desc_md *mdata =
- (union ixgbe_crypto_tx_desc_md *)&m->udata64;
+ (union ixgbe_crypto_tx_desc_md *)
+ rte_security_dynfield(m);
mdata->enc = 1;
mdata->sa_idx = ic_session->sa_index;
mdata->pad_len = ixgbe_crypto_compute_pad_len(m);
@@ -751,5 +752,7 @@ ixgbe_ipsec_ctx_create(struct rte_eth_dev *dev)
return -ENOMEM;
}
}
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 5f19972031..6cfbb582e2 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -34,6 +34,7 @@
#include <rte_mbuf.h>
#include <rte_ether.h>
#include <rte_ethdev_driver.h>
+#include <rte_security_driver.h>
#include <rte_prefetch.h>
#include <rte_udp.h>
#include <rte_tcp.h>
@@ -694,7 +695,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
if (use_ipsec) {
union ixgbe_crypto_tx_desc_md *ipsec_mdata =
(union ixgbe_crypto_tx_desc_md *)
- &tx_pkt->udata64;
+ rte_security_dynfield(tx_pkt);
tx_offload.sa_idx = ipsec_mdata->sa_idx;
tx_offload.sec_pad_len = ipsec_mdata->pad_len;
}
@@ -859,7 +860,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
- tx_offload, &tx_pkt->udata64);
+ tx_offload,
+ rte_security_dynfield(tx_pkt));
txe->last_id = tx_last;
tx_id = txe->next_id;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index b20f399a15..3b9871f4dc 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -13,6 +13,7 @@
#include <rte_kvargs.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
+#include <rte_security_driver.h>
#include <rte_string_fns.h>
#include <rte_time.h>
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec.c b/drivers/net/octeontx2/otx2_ethdev_sec.c
index 4e0dd4e49e..1ee597ff6e 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec.c
+++ b/drivers/net/octeontx2/otx2_ethdev_sec.c
@@ -684,7 +684,7 @@ otx2_eth_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (rte_security_dynfield_t)session;
return 0;
}
@@ -831,6 +831,9 @@ otx2_eth_sec_init(struct rte_eth_dev *eth_dev)
!(dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY))
return 0;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
nb_sa = dev->ipsec_in_max_spi;
mz_sz = nb_sa * sa_width;
in_sa_mz_name_get(name, RTE_MEMZONE_NAMESIZE, port);
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
index 5bf8c19995..284bcd5367 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
+++ b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
@@ -55,7 +55,7 @@ otx2_sec_event_tx(struct otx2_ssogws *ws, struct rte_event *ev,
struct nix_iova_s nix_iova;
} *sd;
- priv = get_sec_session_private_data((void *)(m->udata64));
+ priv = get_sec_session_private_data((void *)(*rte_security_dynfield(m)));
sess = &priv->ipsec.ip;
sa = &sess->out_sa;
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index f29a0542f9..61a5c436dd 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -241,7 +241,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
spi = cq->tag & 0xFFFFF;
sa = nix_rx_sec_sa_get(lookup_mem, spi, m->port);
- m->udata64 = (uint64_t)sa->userdata;
+ *rte_security_dynfield(m) = sa->udata64;
data = rte_pktmbuf_mtod(m, char *);
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 2219148285..bbe7ce48d9 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -426,7 +426,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
* with the security session.
*/
- if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD) {
+ if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD &&
+ rte_security_dynfield_is_registered()) {
struct ipsec_sa *sa;
struct ipsec_mbuf_metadata *priv;
struct rte_security_ctx *ctx = (struct rte_security_ctx *)
@@ -436,10 +437,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
/* Retrieve the userdata registered. Here, the userdata
* registered is the SA pointer.
*/
-
- sa = (struct ipsec_sa *)
- rte_security_get_userdata(ctx, pkt->udata64);
-
+ sa = (struct ipsec_sa *)rte_security_get_userdata(ctx,
+ *rte_security_dynfield(pkt));
if (sa == NULL) {
/* userdata could not be retrieved */
return;
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index b6c851f257..647e22df59 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -208,7 +208,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -226,7 +226,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -357,7 +357,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
}
if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
- pkt->userdata = sess->security.ses;
+ *(struct rte_security_session **)rte_security_dynfield(pkt) =
+ sess->security.ses;
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
@@ -465,7 +466,10 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
}
/* Save security session */
- pkt->userdata = sess_tbl[port_id];
+ if (rte_security_dynfield_is_registered())
+ *(struct rte_security_session **)
+ rte_security_dynfield(pkt) =
+ sess_tbl[port_id];
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
index ee4666026a..e8116d5447 100644
--- a/lib/librte_security/rte_security.c
+++ b/lib/librte_security/rte_security.c
@@ -23,6 +23,22 @@
RTE_PTR_OR_ERR_RET(p1->p2->p3, last_retval); \
} while (0)
+#define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+int rte_security_dynfield_offset = -1;
+
+int
+rte_security_dynfield_register(void)
+{
+ static const struct rte_mbuf_dynfield dynfield_desc = {
+ .name = RTE_SECURITY_DYNFIELD_NAME,
+ .size = sizeof(rte_security_dynfield_t),
+ .align = __alignof__(rte_security_dynfield_t),
+ };
+ rte_security_dynfield_offset =
+ rte_mbuf_dynfield_register(&dynfield_desc);
+ return rte_security_dynfield_offset;
+}
+
struct rte_security_session *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index 271531af12..88d31de0a6 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -27,6 +27,7 @@ extern "C" {
#include <rte_common.h>
#include <rte_crypto.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
@@ -451,6 +452,47 @@ int
rte_security_session_destroy(struct rte_security_ctx *instance,
struct rte_security_session *sess);
+/** Device-specific metadata field type */
+typedef uint64_t rte_security_dynfield_t;
+/** Dynamic mbuf field for device-specific metadata */
+extern int rte_security_dynfield_offset;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get pointer to mbuf field for device-specific metadata.
+ *
+ * For performance reason, no check is done,
+ * the dynamic field may not be registered.
+ * @see rte_security_dynfield_is_registered
+ *
+ * @param mbuf packet to access
+ * @return pointer to mbuf field
+ */
+__rte_experimental
+static inline rte_security_dynfield_t *
+rte_security_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ rte_security_dynfield_offset,
+ rte_security_dynfield_t *);
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Check whether the dynamic field is registered.
+ *
+ * @return true if rte_security_dynfield_register() has been called.
+ */
+__rte_experimental
+static inline bool rte_security_dynfield_is_registered(void)
+{
+ return rte_security_dynfield_offset >= 0;
+}
+
/**
* Updates the buffer with device-specific defined metadata
*
diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
index 1b561f8528..c5abb07990 100644
--- a/lib/librte_security/rte_security_driver.h
+++ b/lib/librte_security/rte_security_driver.h
@@ -89,6 +89,9 @@ typedef int (*security_session_stats_get_t)(void *device,
struct rte_security_session *sess,
struct rte_security_stats *stats);
+__rte_experimental
+int rte_security_dynfield_register(void);
+
/**
* Update the mbuf with provided metadata.
*
diff --git a/lib/librte_security/version.map b/lib/librte_security/version.map
index d84eec0a88..22775558c8 100644
--- a/lib/librte_security/version.map
+++ b/lib/librte_security/version.map
@@ -15,6 +15,8 @@ DPDK_21 {
EXPERIMENTAL {
global:
+ rte_security_dynfield_offset;
+ rte_security_dynfield_register;
rte_security_get_userdata;
rte_security_session_stats_get;
rte_security_session_update;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (4 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 05/15] security: switch " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 07/15] net/ark: switch user data to dynamic mbuf fields Thomas Monjalon
` (8 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Harry van Haaren
The test worker_loopback used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/event/sw/sw_evdev_selftest.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index 5c7e527917..ad4fc0eed7 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -40,6 +40,11 @@ struct test {
uint32_t service_id;
};
+typedef uint8_t counter_dynfield_t;
+static int counter_dynfield_offset = -1;
+#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ counter_dynfield_offset, counter_dynfield_t *))
+
static struct rte_event release_ev;
static inline struct rte_mbuf *
@@ -2987,8 +2992,8 @@ worker_loopback_worker_fn(void *arg)
}
ev[i].queue_id = 0;
- ev[i].mbuf->udata64++;
- if (ev[i].mbuf->udata64 != 16) {
+ COUNTER_FIELD(ev[i].mbuf)++;
+ if (COUNTER_FIELD(ev[i].mbuf) != 16) {
ev[i].op = RTE_EVENT_OP_FORWARD;
enqd = rte_event_enqueue_burst(evdev, port,
&ev[i], 1);
@@ -3028,7 +3033,7 @@ worker_loopback_producer_fn(void *arg)
m = rte_pktmbuf_alloc(t->mbuf_pool);
} while (m == NULL);
- m->udata64 = 0;
+ COUNTER_FIELD(m) = 0;
struct rte_event ev = {
.op = RTE_EVENT_OP_NEW,
@@ -3061,6 +3066,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)
int err;
int w_lcore, p_lcore;
+ static const struct rte_mbuf_dynfield counter_dynfield_desc = {
+ .name = "rte_event_sw_dynfield_selftest_counter",
+ .size = sizeof(counter_dynfield_t),
+ .align = __alignof__(counter_dynfield_t),
+ };
+ counter_dynfield_offset =
+ rte_mbuf_dynfield_register(&counter_dynfield_desc);
+ if (counter_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return -rte_errno;
+ }
+
if (init(t, 8, 2) < 0 ||
create_atomic_qids(t, 8) < 0) {
printf("%d: Error initializing device\n", __LINE__);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 07/15] net/ark: switch user data to dynamic mbuf fields
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (5 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
` (7 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ed Czeck, Shepard Siegel,
John Miller, Ray Kinsella, Neil Horman
From: Ed Czeck <ed.czeck@atomicrules.com>
The second field of metadata is reserved for user data
which was using a deprecated mbuf field.
It is moved to dynamic fields in order to allow removal of udata64.
The use of meta data must be enabled with a compile-time flag
RTE_PMD_ARK_{TX,RX}_USERDATA_ENABLE.
User data on Tx and Rx paths can be defined and used separately.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf.in | 1 +
drivers/net/ark/ark_ethdev.c | 39 ++++++++++
drivers/net/ark/ark_ethdev_rx.c | 3 +-
drivers/net/ark/ark_ethdev_tx.c | 3 +-
drivers/net/ark/meson.build | 2 +
drivers/net/ark/rte_pmd_ark.h | 123 ++++++++++++++++++++++++++++++++
drivers/net/ark/version.map | 7 ++
8 files changed, 177 insertions(+), 2 deletions(-)
create mode 100644 drivers/net/ark/rte_pmd_ark.h
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index a9c12d1a2f..b865a51e8c 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -41,6 +41,7 @@ The public API headers are grouped by topics:
[vhost] (@ref rte_vhost.h),
[vdpa] (@ref rte_vdpa.h),
[KNI] (@ref rte_kni.h),
+ [ark] (@ref rte_pmd_ark.h),
[ixgbe] (@ref rte_pmd_ixgbe.h),
[i40e] (@ref rte_pmd_i40e.h),
[ice] (@ref rte_pmd_ice.h),
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index e37f8c2e80..c5b01a1814 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -8,6 +8,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \
@TOPDIR@/drivers/bus/vdev \
@TOPDIR@/drivers/crypto/scheduler \
@TOPDIR@/drivers/mempool/dpaa2 \
+ @TOPDIR@/drivers/net/ark \
@TOPDIR@/drivers/net/bnxt \
@TOPDIR@/drivers/net/bonding \
@TOPDIR@/drivers/net/dpaa \
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 168b3659d6..7b03f0fbc2 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -10,6 +10,7 @@
#include <rte_ethdev_pci.h>
#include <rte_kvargs.h>
+#include "rte_pmd_ark.h"
#include "ark_global.h"
#include "ark_logs.h"
#include "ark_ethdev_tx.h"
@@ -78,6 +79,9 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
#define ARK_TX_MAX_QUEUE (4096 * 4)
#define ARK_TX_MIN_QUEUE (256)
+int rte_pmd_ark_rx_userdata_dynfield_offset = -1;
+int rte_pmd_ark_tx_userdata_dynfield_offset = -1;
+
static const char * const valid_arguments[] = {
ARK_PKTGEN_ARG,
ARK_PKTCHKR_ARG,
@@ -245,6 +249,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
int ret;
int port_count = 1;
int p;
+ static const struct rte_mbuf_dynfield ark_tx_userdata_dynfield_desc = {
+ .name = RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME,
+ .size = sizeof(rte_pmd_ark_userdata_t),
+ .align = __alignof__(rte_pmd_ark_userdata_t),
+ };
+ static const struct rte_mbuf_dynfield ark_rx_userdata_dynfield_desc = {
+ .name = RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME,
+ .size = sizeof(rte_pmd_ark_userdata_t),
+ .align = __alignof__(rte_pmd_ark_userdata_t),
+ };
ark->eth_dev = dev;
@@ -254,6 +268,31 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
ret = check_for_ext(ark);
if (ret)
return ret;
+
+ /* Extra mbuf fields for user data */
+ if (RTE_PMD_ARK_TX_USERDATA_ENABLE) {
+ rte_pmd_ark_tx_userdata_dynfield_offset =
+ rte_mbuf_dynfield_register(&ark_tx_userdata_dynfield_desc);
+ if (rte_pmd_ark_tx_userdata_dynfield_offset < 0) {
+ ARK_PMD_LOG(ERR,
+ "Failed to register mbuf field for tx userdata\n");
+ return -rte_errno;
+ }
+ ARK_PMD_LOG(INFO, "Registered TX-meta dynamic field at %d\n",
+ rte_pmd_ark_tx_userdata_dynfield_offset);
+ }
+ if (RTE_PMD_ARK_RX_USERDATA_ENABLE) {
+ rte_pmd_ark_rx_userdata_dynfield_offset =
+ rte_mbuf_dynfield_register(&ark_rx_userdata_dynfield_desc);
+ if (rte_pmd_ark_rx_userdata_dynfield_offset < 0) {
+ ARK_PMD_LOG(ERR,
+ "Failed to register mbuf field for rx userdata\n");
+ return -rte_errno;
+ }
+ ARK_PMD_LOG(INFO, "Registered RX-meta dynamic field at %d\n",
+ rte_pmd_ark_rx_userdata_dynfield_offset);
+ }
+
pci_dev = RTE_ETH_DEV_TO_PCI(dev);
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 2f8d05099c..825b4791be 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -4,6 +4,7 @@
#include <unistd.h>
+#include "rte_pmd_ark.h"
#include "ark_ethdev_rx.h"
#include "ark_global.h"
#include "ark_logs.h"
@@ -272,7 +273,7 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->pkt_len = meta->pkt_len;
mbuf->data_len = meta->pkt_len;
mbuf->timestamp = meta->timestamp;
- mbuf->udata64 = meta->user_data;
+ rte_pmd_ark_mbuf_rx_userdata_set(mbuf, meta->user_data);
if (ARK_DEBUG_CORE) { /* debug sanity checks */
if ((meta->pkt_len > (1024 * 16)) ||
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index a0e35af880..612d918e33 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -4,6 +4,7 @@
#include <unistd.h>
+#include "rte_pmd_ark.h"
#include "ark_ethdev_tx.h"
#include "ark_global.h"
#include "ark_mpu.h"
@@ -70,7 +71,7 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
uint8_t flags)
{
meta->physaddr = rte_mbuf_data_iova(mbuf);
- meta->user1 = (uint32_t)mbuf->udata64;
+ meta->user1 = rte_pmd_ark_mbuf_tx_userdata_get(mbuf);
meta->data_len = rte_pktmbuf_data_len(mbuf);
meta->flags = flags;
}
diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
index 99151bba1d..80bce94e1a 100644
--- a/drivers/net/ark/meson.build
+++ b/drivers/net/ark/meson.build
@@ -1,6 +1,8 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
+headers = files('rte_pmd_ark.h')
+
sources = files('ark_ddm.c',
'ark_ethdev.c',
'ark_ethdev_rx.c',
diff --git a/drivers/net/ark/rte_pmd_ark.h b/drivers/net/ark/rte_pmd_ark.h
new file mode 100644
index 0000000000..2a23b82951
--- /dev/null
+++ b/drivers/net/ark/rte_pmd_ark.h
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2020 Atomic Rules LLC
+ */
+
+#ifndef RTE_PMD_ARK_H
+#define RTE_PMD_ARK_H
+
+/**
+ * @file
+ * ARK driver-specific API
+ */
+
+#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
+
+#ifndef RTE_PMD_ARK_TX_USERDATA_ENABLE
+#define RTE_PMD_ARK_TX_USERDATA_ENABLE 0
+#endif
+
+#ifndef RTE_PMD_ARK_RX_USERDATA_ENABLE
+#define RTE_PMD_ARK_RX_USERDATA_ENABLE 0
+#endif
+
+typedef uint32_t rte_pmd_ark_userdata_t;
+extern int rte_pmd_ark_tx_userdata_dynfield_offset;
+extern int rte_pmd_ark_rx_userdata_dynfield_offset;
+
+/** mbuf dynamic field for custom Tx ARK data */
+#define RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_tx_userdata"
+/** mbuf dynamic field for custom Rx ARK data */
+#define RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_rx_userdata"
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Read Tx user data from mbuf.
+ *
+ * @param mbuf Structure to read from.
+ * @return user data
+ */
+__rte_experimental
+static inline rte_pmd_ark_userdata_t
+rte_pmd_ark_mbuf_tx_userdata_get(const struct rte_mbuf *mbuf)
+{
+#if RTE_PMD_ARK_TX_USERDATA_ENABLE
+ return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset,
+ rte_pmd_ark_userdata_t *);
+#else
+ RTE_SET_USED(mbuf);
+ return 0;
+#endif
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Write Tx user data to mbuf.
+ *
+ * @param mbuf Structure to write into.
+ * @param data User data.
+ */
+__rte_experimental
+static inline void
+rte_pmd_ark_mbuf_tx_userdata_set(struct rte_mbuf *mbuf,
+ rte_pmd_ark_userdata_t data)
+{
+#if RTE_PMD_ARK_TX_USERDATA_ENABLE
+ *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset,
+ rte_pmd_ark_userdata_t *) = data;
+#else
+ RTE_SET_USED(mbuf);
+ RTE_SET_USED(data);
+#endif
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Read Rx user data from mbuf.
+ *
+ * @param mbuf Structure to read from.
+ * @return user data
+ */
+__rte_experimental
+static inline rte_pmd_ark_userdata_t
+rte_pmd_ark_mbuf_rx_userdata_get(const struct rte_mbuf *mbuf)
+{
+#if RTE_PMD_ARK_RX_USERDATA_ENABLE
+ return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset,
+ rte_pmd_ark_userdata_t *);
+#else
+ RTE_SET_USED(mbuf);
+ return 0;
+#endif
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Write Rx user data to mbuf.
+ *
+ * @param mbuf Structure to write into.
+ * @param data User data.
+ */
+__rte_experimental
+static inline void
+rte_pmd_ark_mbuf_rx_userdata_set(struct rte_mbuf *mbuf,
+ rte_pmd_ark_userdata_t data)
+{
+#if RTE_PMD_ARK_RX_USERDATA_ENABLE
+ *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset,
+ rte_pmd_ark_userdata_t *) = data;
+#else
+ RTE_SET_USED(mbuf);
+ RTE_SET_USED(data);
+#endif
+}
+
+#endif /* RTE_PMD_ARK_H */
diff --git a/drivers/net/ark/version.map b/drivers/net/ark/version.map
index 4a76d1d52d..954bea6796 100644
--- a/drivers/net/ark/version.map
+++ b/drivers/net/ark/version.map
@@ -1,3 +1,10 @@
DPDK_21 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ rte_pmd_ark_tx_userdata_dynfield_offset;
+ rte_pmd_ark_rx_userdata_dynfield_offset;
+};
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (6 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 07/15] net/ark: switch user data to dynamic mbuf fields Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
` (6 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ajit Khaparde, Somnath Kotur
The CFA code from mark was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Note: the new field has 32 bits, smaller than udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 5 +++++
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++
4 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1c7d1b758d..f1350d39da 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -31,6 +31,7 @@
#include "bnxt_nvm_defs.h"
#include "bnxt_tf_common.h"
#include "ulp_flow_db.h"
+#include "rte_pmd_bnxt.h"
#define DRV_MODULE_NAME "bnxt"
static const char bnxt_version[] =
@@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = {
*/
#define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
+int bnxt_cfa_code_dynfield_offset = -1;
+
/*
* max_num_kflows must be >= 32
* and must be a power-of-2 supported value
@@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF)
bp->flags |= BNXT_FLAG_STINGRAY;
+ if (BNXT_TRUFLOW_EN(bp)) {
+ /* extra mbuf field is required to store CFA code from mark */
+ static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = {
+ .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME,
+ .size = sizeof(bnxt_cfa_code_dynfield_t),
+ .align = __alignof__(bnxt_cfa_code_dynfield_t),
+ };
+ bnxt_cfa_code_dynfield_offset =
+ rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc);
+ if (bnxt_cfa_code_dynfield_offset < 0) {
+ PMD_DRV_LOG(ERR,
+ "Failed to register mbuf field for TruFlow mark\n");
+ return -rte_errno;
+ }
+ }
+
rc = bnxt_init_board(eth_dev);
if (rc) {
PMD_DRV_LOG(ERR,
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 039217fa60..7156ce7dd8 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -606,7 +606,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
return mark_id;
/* Got the mark, write it to the mbuf and return */
mbuf->hash.fdir.hi = mark_id;
- mbuf->udata64 = (cfa_code & 0xffffffffull) << 32;
+ BNXT_CFA_CODE_DYNFIELD(mbuf) = cfa_code & 0xffffffffull;
mbuf->hash.fdir.id = rxcmp1->cfa_code;
mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
return mark_id;
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index b874e54a8c..2d16a551ce 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -95,6 +95,11 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
struct rx_pkt_cmpl_hi *rxcmp1,
struct rte_mbuf *mbuf);
+typedef uint32_t bnxt_cfa_code_dynfield_t;
+extern int bnxt_cfa_code_dynfield_offset;
+#define BNXT_CFA_CODE_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ bnxt_cfa_code_dynfield_offset, bnxt_cfa_code_dynfield_t *))
+
#define BNXT_RX_META_CFA_CODE_SHIFT 19
#define BNXT_CFA_CODE_META_SHIFT 16
#define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 81d0d0e032..f538b6550e 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -9,6 +9,9 @@
#include <rte_ethdev.h>
#include <rte_ether.h>
+/** mbuf dynamic field where CFA code is stored */
+#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
+
/*
* Response sent back to the caller after callback
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (7 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 10/15] test/distributor: switch sequence " Thomas Monjalon
` (5 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Yong Wang
The segment count, used for MSS guess,
was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 6 ++++++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++----
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 6920ab568c..23a2ebbefa 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -59,6 +59,8 @@
DEV_RX_OFFLOAD_JUMBO_FRAME | \
DEV_RX_OFFLOAD_RSS_HASH)
+int vmxnet3_segs_dynfield_offset = -1;
+
static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
@@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
struct vmxnet3_hw *hw = eth_dev->data->dev_private;
uint32_t mac_hi, mac_lo, ver;
struct rte_eth_link link;
+ static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
+ .name = VMXNET3_SEGS_DYNFIELD_NAME,
+ .size = sizeof(vmxnet3_segs_dynfield_t),
+ .align = __alignof__(vmxnet3_segs_dynfield_t),
+ };
PMD_INIT_FUNC_TRACE();
@@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ /* extra mbuf field is required to guess MSS */
+ vmxnet3_segs_dynfield_offset =
+ rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
+ if (vmxnet3_segs_dynfield_offset < 0) {
+ PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
+ return -rte_errno;
+ }
+
/*
* for secondary processes, we don't initialize any further as primary
* has already done this work.
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
index dd685b02b7..e19718ce64 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
@@ -193,4 +193,10 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
+#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs"
+typedef uint8_t vmxnet3_segs_dynfield_t;
+extern int vmxnet3_segs_dynfield_offset;
+#define VMXNET3_SEGS_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(rxm, \
+ vmxnet3_segs_dynfield_offset, vmxnet3_segs_dynfield_t *))
+
#endif /* _VMXNET3_ETHDEV_H_ */
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index e10f9ee870..2b0e2e6f19 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
struct rte_ipv6_hdr *ipv6_hdr;
struct rte_tcp_hdr *tcp_hdr;
char *ptr;
+ uint8_t segs;
RTE_ASSERT(rcd->tcp);
@@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
hlen += (tcp_hdr->data_off & 0xf0) >> 2;
- if (rxm->udata64 > 1)
- return (rte_pktmbuf_pkt_len(rxm) - hlen +
- rxm->udata64 - 1) / rxm->udata64;
+ segs = VMXNET3_SEGS_DYNFIELD(rxm);
+ if (segs > 1)
+ return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
else
return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
}
@@ -737,7 +738,7 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
(const Vmxnet3_RxCompDescExt *)rcd;
rxm->tso_segsz = rcde->mss;
- rxm->udata64 = rcde->segCnt;
+ VMXNET3_SEGS_DYNFIELD(rxm) = rcde->segCnt;
ol_flags |= PKT_RX_LRO;
}
} else { /* Offloads set in eop */
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 10/15] test/distributor: switch sequence to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (8 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 11/15] test/graph: switch user data " Thomas Monjalon
` (4 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Lukasz Wojciechowski, David Hunt
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
---
app/test/test_distributor.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index eb889b91d1..24ee824eef 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -10,6 +10,7 @@
#include <rte_errno.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_distributor.h>
#include <rte_string_fns.h>
@@ -17,6 +18,11 @@
#define BURST 32
#define BIG_BATCH 1024
+typedef uint32_t seq_dynfield_t;
+static int seq_dynfield_offset = -1;
+#define SEQ_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ seq_dynfield_offset, seq_dynfield_t *))
+
struct worker_params {
char name[64];
struct rte_distributor *dist;
@@ -578,7 +584,7 @@ handle_and_mark_work(void *arg)
__atomic_fetch_add(&worker_stats[id].handled_packets, num,
__ATOMIC_RELAXED);
for (i = 0; i < num; i++)
- buf[i]->udata64 += id + 1;
+ SEQ_FIELD(buf[i]) += id + 1;
num = rte_distributor_get_pkt(db, id,
buf, buf, num);
}
@@ -631,10 +637,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
<< shift;
}
/* Assign a sequence number to each packet. The sequence is shifted,
- * so that lower bits of the udate64 will hold mark from worker.
+ * so that lower bits will hold mark from worker.
*/
for (i = 0; i < buf_count; i++)
- bufs[i]->udata64 = i << seq_shift;
+ SEQ_FIELD(bufs[i]) = i << seq_shift;
count = 0;
for (i = 0; i < buf_count/burst; i++) {
@@ -660,8 +666,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
/* Sort returned packets by sent order (sequence numbers). */
for (i = 0; i < buf_count; i++) {
- seq = returns[i]->udata64 >> seq_shift;
- id = returns[i]->udata64 - (seq << seq_shift);
+ seq = SEQ_FIELD(returns[i]) >> seq_shift;
+ id = SEQ_FIELD(returns[i]) - (seq << seq_shift);
sorted[seq] = id;
}
@@ -805,6 +811,18 @@ test_distributor(void)
static struct rte_mempool *p;
int i;
+ static const struct rte_mbuf_dynfield seq_dynfield_desc = {
+ .name = "test_distributor_dynfield_seq",
+ .size = sizeof(seq_dynfield_t),
+ .align = __alignof__(seq_dynfield_t),
+ };
+ seq_dynfield_offset =
+ rte_mbuf_dynfield_register(&seq_dynfield_desc);
+ if (seq_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return TEST_FAILED;
+ }
+
if (rte_lcore_count() < 2) {
printf("Not enough cores for distributor_autotest, expecting at least 2\n");
return TEST_SKIPPED;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 11/15] test/graph: switch user data to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (9 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 10/15] test/distributor: switch sequence " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 12/15] app/eventdev: switch flow ID " Thomas Monjalon
` (3 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob, Kiran Kumar K,
Nithin Dabilpuram
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_graph.c | 94 ++++++++++++++++++++++++++-----------------
1 file changed, 56 insertions(+), 38 deletions(-)
diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index ed69eda997..164486911f 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
#include <rte_graph.h>
#include <rte_graph_worker.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_random.h>
#include "test.h"
@@ -39,6 +40,11 @@ static uint16_t test_node3_worker(struct rte_graph *graph,
#define MBUFF_SIZE 512
#define MAX_NODES 4
+typedef uint64_t graph_dynfield_t;
+static int graph_dynfield_offset = -1;
+#define GRAPH_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ graph_dynfield_offset, graph_dynfield_t *))
+
static struct rte_mbuf mbuf[MAX_NODES + 1][MBUFF_SIZE];
static void *mbuf_p[MAX_NODES + 1][MBUFF_SIZE];
static rte_graph_t graph_id;
@@ -162,9 +168,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node0);
for (i = 0; i < obj_node0; i++) {
data = &mbuf[0][i];
- data->udata64 = ((uint64_t)tm->test_node[0].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[0].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][i];
}
rte_node_next_stream_put(graph, node, next, obj_node0);
@@ -175,9 +181,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node1);
for (i = 0; i < obj_node1; i++) {
data = &mbuf[0][obj_node0 + i];
- data->udata64 = ((uint64_t)tm->test_node[1].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
next_stream[i] = &mbuf[0][obj_node0 + i];
}
@@ -205,23 +211,23 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[0].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[0].idx) {
printf("Data idx miss match at node 0, expected"
" = %u got = %u\n",
tm->test_node[0].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at "
"node 0\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -233,12 +239,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * obj_node0 * 0.01;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[1][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[1][0],
obj_node0);
@@ -246,12 +252,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node1 = nb_objs - obj_node0;
for (i = 0; i < obj_node1; i++) {
data = &mbuf[1][obj_node0 + i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 1, (void **)&mbuf_p[1][obj_node0],
obj_node1);
@@ -285,22 +291,22 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[2] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[1].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[1].idx) {
printf("Data idx miss match at node 1, expected = %u"
" got = %u\n",
tm->test_node[1].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 1\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -312,11 +318,11 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[2][i];
- data->udata64 = ((uint64_t)tm->test_node[2].idx << 32) | i;
+ GRAPH_FIELD(data) = ((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[2][0], obj_node0);
@@ -339,22 +345,22 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[3] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[2].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[2].idx) {
printf("Data idx miss match at node 2, expected = %u"
" got = %u\n",
tm->test_node[2].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 2\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -367,10 +373,10 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[3][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[3].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[3][0],
obj_node0);
@@ -395,22 +401,22 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[4] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[3].idx) {
+ if ((GRAPH_FIELD(data) >> 32) != tm->test_node[3].idx) {
printf("Data idx miss match at node 3, expected = %u"
" got = %u\n",
tm->test_node[3].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(GRAPH_FIELD(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 3\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (GRAPH_FIELD(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (GRAPH_FIELD(data) & (0x1 << 17))
second_pass = 1;
}
@@ -426,11 +432,11 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * 2;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[4][i];
- data->udata64 =
+ GRAPH_FIELD(data) =
((uint64_t)tm->test_node[0].idx << 32) | i;
- data->udata64 |= (1 << 17);
+ GRAPH_FIELD(data) |= (1 << 17);
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ GRAPH_FIELD(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[4][0],
obj_node0);
@@ -765,6 +771,18 @@ graph_setup(void)
{
int i, j;
+ static const struct rte_mbuf_dynfield graph_dynfield_desc = {
+ .name = "test_graph_dynfield",
+ .size = sizeof(graph_dynfield_t),
+ .align = __alignof__(graph_dynfield_t),
+ };
+ graph_dynfield_offset =
+ rte_mbuf_dynfield_register(&graph_dynfield_desc);
+ if (graph_dynfield_offset < 0) {
+ printf("Cannot register mbuf field\n");
+ return TEST_FAILED;
+ }
+
for (i = 0; i <= MAX_NODES; i++) {
for (j = 0; j < MBUFF_SIZE; j++)
mbuf_p[i][j] = &mbuf[i][j];
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (10 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 11/15] test/graph: switch user data " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch " Thomas Monjalon
` (2 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Jerin Jacob
The order test stored the flow ID in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-eventdev/test_order_atq.c | 4 ++--
app/test-eventdev/test_order_common.c | 21 +++++++++++++++------
app/test-eventdev/test_order_common.h | 21 +++++++++++++++++++++
app/test-eventdev/test_order_queue.c | 4 ++--
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c
index cfcb1dc4e9..71215a07b6 100644
--- a/app/test-eventdev/test_order_atq.c
+++ b/app/test-eventdev/test_order_atq.c
@@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev);
if (ev.sub_event_type == 0) { /* stage 0 from producer */
order_atq_process_stage_0(&ev);
@@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev[i]);
if (ev[i].sub_event_type == 0) { /*stage 0 */
order_atq_process_stage_0(&ev[i]);
diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
index dc55d93921..01a44bcd75 100644
--- a/app/test-eventdev/test_order_common.c
+++ b/app/test-eventdev/test_order_common.c
@@ -46,13 +46,10 @@ order_producer(void *arg)
if (m == NULL)
continue;
- const uint32_t flow = (uintptr_t)m % nb_flows;
+ const flow_id_t flow = (uintptr_t)m % nb_flows;
/* Maintain seq number per flow */
m->seqn = producer_flow_seq[flow]++;
- m->udata64 = flow;
-
- ev.flow_id = flow;
- ev.mbuf = m;
+ order_flow_id_save(t, flow, m, &ev);
while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) {
if (t->err)
@@ -138,6 +135,12 @@ int
order_test_setup(struct evt_test *test, struct evt_options *opt)
{
void *test_order;
+ struct test_order *t;
+ static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
+ .name = "test_event_dynfield_flow_id",
+ .size = sizeof(flow_id_t),
+ .align = __alignof__(flow_id_t),
+ };
test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
RTE_CACHE_LINE_SIZE, opt->socket_id);
@@ -146,8 +149,14 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
goto nomem;
}
test->test_priv = test_order;
+ t = evt_test_priv(test);
- struct test_order *t = evt_test_priv(test);
+ t->flow_id_dynfield_offset =
+ rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
+ if (t->flow_id_dynfield_offset < 0) {
+ evt_err("failed to register mbuf field");
+ return -rte_errno;
+ }
t->producer_flow_seq = rte_zmalloc_socket("test_producer_flow_seq",
sizeof(*t->producer_flow_seq) * opt->nb_flows,
diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index e0fe9c968a..90eac96fc8 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -13,6 +13,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include "evt_common.h"
#include "evt_options.h"
@@ -20,6 +21,8 @@
#define BURST_SIZE 16
+typedef uint32_t flow_id_t;
+
struct test_order;
struct worker_data {
@@ -49,6 +52,7 @@ struct test_order {
uint32_t nb_flows;
uint64_t nb_pkts;
struct rte_mempool *pool;
+ int flow_id_dynfield_offset;
struct prod_data prod;
struct worker_data worker[EVT_MAX_PORTS];
uint32_t *producer_flow_seq;
@@ -56,6 +60,23 @@ struct test_order {
struct evt_options *opt;
} __rte_cache_aligned;
+static inline void
+order_flow_id_copy_from_mbuf(struct test_order *t, struct rte_event *event)
+{
+ event->flow_id = *RTE_MBUF_DYNFIELD(event->mbuf,
+ t->flow_id_dynfield_offset, flow_id_t *);
+}
+
+static inline void
+order_flow_id_save(struct test_order *t, flow_id_t flow_id,
+ struct rte_mbuf *mbuf, struct rte_event *event)
+{
+ *RTE_MBUF_DYNFIELD(mbuf,
+ t->flow_id_dynfield_offset, flow_id_t *) = flow_id;
+ event->flow_id = flow_id;
+ event->mbuf = mbuf;
+}
+
static inline int
order_nb_event_ports(struct evt_options *opt)
{
diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c
index 1511c0092d..621367805a 100644
--- a/app/test-eventdev/test_order_queue.c
+++ b/app/test-eventdev/test_order_queue.c
@@ -35,7 +35,7 @@ order_queue_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev);
if (ev.queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev);
@@ -73,7 +73,7 @@ order_queue_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev[i]);
if (ev[i].queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev[i]);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (11 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 12/15] app/eventdev: switch flow ID " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 11:51 ` Andrew Rybchenko
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 14/15] examples/rxtx_callbacks: " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 15/15] mbuf: remove userdata field Thomas Monjalon
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Nicolas Chautru
The example used the deprecated mbuf field udata64 as input mbuf pointer.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/bbdev_app/main.c | 49 +++++++++++++++++++++++++++++++--------
1 file changed, 39 insertions(+), 10 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index e512c807cd..63e8b18e44 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -28,6 +28,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_log.h>
@@ -59,6 +60,22 @@
} \
} while (0)
+static int input_dynfield_offset = -1;
+
+static inline struct rte_mbuf *
+get_mbuf_input(struct rte_mbuf *mbuf)
+{
+ return *RTE_MBUF_DYNFIELD(mbuf,
+ input_dynfield_offset, struct rte_mbuf **);
+}
+
+static inline void
+set_mbuf_input(struct rte_mbuf *mbuf, struct rte_mbuf *input)
+{
+ *RTE_MBUF_DYNFIELD(mbuf,
+ input_dynfield_offset, struct rte_mbuf **) = input;
+}
+
static const struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_NONE,
@@ -294,11 +311,11 @@ pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
}
static inline void
-pktmbuf_userdata_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
+pktmbuf_input_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
{
unsigned int i;
for (i = 0; i < nb_to_free; ++i) {
- struct rte_mbuf *rx_pkt = mbufs[i]->userdata;
+ struct rte_mbuf *rx_pkt = get_mbuf_input(mbufs[i]);
rte_pktmbuf_free(rx_pkt);
rte_pktmbuf_free(mbufs[i]);
}
@@ -429,7 +446,7 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts)
uint16_t i;
for (i = 0; i < num_pkts; ++i) {
struct rte_mbuf *out = mbufs[i];
- struct rte_mbuf *in = out->userdata;
+ struct rte_mbuf *in = get_mbuf_input(out);
if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *,
sizeof(struct rte_ether_hdr)),
@@ -731,7 +748,7 @@ run_encoding(struct lcore_conf *lcore_conf)
rte_pktmbuf_data_len(rx_pkts_burst[i]) -
sizeof(struct rte_ether_hdr);
/* save input mbuf pointer for later comparison */
- enc_out_pkts[i]->userdata = rx_pkts_burst[i];
+ set_mbuf_input(enc_out_pkts[i], rx_pkts_burst[i]);
/* copy ethernet header */
rte_pktmbuf_reset(enc_out_pkts[i]);
@@ -775,7 +792,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_enc_ops(bbdev_id, enc_queue_id,
bbdev_ops_burst, nb_rx);
if (unlikely(nb_enq < nb_rx)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_enq],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_enq],
nb_rx - nb_enq);
rte_bbdev_enc_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_rx - nb_enq);
@@ -805,7 +822,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_sent = rte_ring_enqueue_burst(enc_to_dec_ring, (void **)enc_out_pkts,
nb_deq, NULL);
if (unlikely(nb_sent < nb_deq)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_sent],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_sent],
nb_deq - nb_sent);
lcore_stats->enc_to_dec_lost_packets += nb_deq - nb_sent;
}
@@ -842,7 +859,7 @@ run_decoding(struct lcore_conf *lcore_conf)
if (unlikely(rte_bbdev_dec_op_alloc_bulk(bbdev_op_pool, bbdev_ops_burst,
nb_recv) != 0)) {
- pktmbuf_userdata_free_bulk(recv_pkts_burst, nb_recv);
+ pktmbuf_input_free_bulk(recv_pkts_burst, nb_recv);
lcore_stats->rx_lost_packets += nb_recv;
return;
}
@@ -871,7 +888,7 @@ run_decoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_dec_ops(bbdev_id, bbdev_queue_id,
bbdev_ops_burst, nb_recv);
if (unlikely(nb_enq < nb_recv)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_enq],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_enq],
nb_recv - nb_enq);
rte_bbdev_dec_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_recv - nb_enq);
@@ -898,12 +915,12 @@ run_decoding(struct lcore_conf *lcore_conf)
/* Free the RX mbufs after verification */
for (i = 0; i < nb_deq; ++i)
- rte_pktmbuf_free(recv_pkts_burst[i]->userdata);
+ rte_pktmbuf_free(get_mbuf_input(recv_pkts_burst[i]));
/* Transmit the packets */
nb_tx = rte_eth_tx_burst(port_id, tx_queue_id, recv_pkts_burst, nb_deq);
if (unlikely(nb_tx < nb_deq)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_tx],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_tx],
nb_deq - nb_tx);
lcore_stats->tx_lost_packets += nb_deq - nb_tx;
}
@@ -1046,6 +1063,12 @@ main(int argc, char **argv)
bool stats_thread_started = false;
unsigned int main_lcore_id = rte_get_main_lcore();
+ static const struct rte_mbuf_dynfield input_dynfield_desc = {
+ .name = "example_bbdev_dynfield_input",
+ .size = sizeof(struct rte_mbuf *),
+ .align = __alignof__(struct rte_mbuf *),
+ };
+
rte_atomic16_init(&global_exit_flag);
sigret = signal(SIGTERM, signal_handler);
@@ -1115,6 +1138,12 @@ main(int argc, char **argv)
if (bbdev_mbuf_mempool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create ethdev mbuf mempool\n");
+ /* register mbuf field to store input pointer */
+ input_dynfield_offset =
+ rte_mbuf_dynfield_register(&input_dynfield_desc);
+ if (input_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize ports */
ret = initialize_ports(&app_params, ethdev_mbuf_mempool);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 14/15] examples/rxtx_callbacks: switch to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (12 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 15/15] mbuf: remove userdata field Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, John McNamara
The example used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 ++--
examples/rxtx_callbacks/main.c | 20 ++++++++++++++++++--
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 62d1f39d7e..56c4293a1a 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -152,7 +152,7 @@ all packets received:
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TSC_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -179,7 +179,7 @@ packets prior to transmission:
unsigned i;
for (i = 0; i < nb_pkts; i++)
- cycles += now - pkts[i]->udata64;
+ cycles += now - TSC_FIELD(pkts[i]);
latency_numbers.total_cycles += cycles;
latency_numbers.total_pkts += nb_pkts;
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 6fe39546dd..b9a98ceddc 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -10,6 +10,7 @@
#include <rte_cycles.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#define RX_RING_SIZE 1024
#define TX_RING_SIZE 1024
@@ -18,6 +19,11 @@
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
+typedef uint64_t tsc_t;
+static int tsc_dynfield_offset = -1;
+#define TSC_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+ tsc_dynfield_offset, tsc_t *))
+
static const char usage[] =
"%s EAL_ARGS -- [-t]\n";
@@ -47,7 +53,7 @@ add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ TSC_FIELD(pkts[i]) = now;
return nb_pkts;
}
@@ -65,7 +71,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused,
rte_eth_read_clock(port, &ticks);
for (i = 0; i < nb_pkts; i++) {
- cycles += now - pkts[i]->udata64;
+ cycles += now - TSC_FIELD(pkts[i]);
if (hw_timestamping)
queue_ticks += ticks - pkts[i]->timestamp;
}
@@ -261,6 +267,11 @@ main(int argc, char *argv[])
};
int opt, option_index;
+ static const struct rte_mbuf_dynfield tsc_dynfield_desc = {
+ .name = "example_bbdev_dynfield_tsc",
+ .size = sizeof(tsc_t),
+ .align = __alignof__(tsc_t),
+ };
/* init EAL */
int ret = rte_eal_init(argc, argv);
@@ -292,6 +303,11 @@ main(int argc, char *argv[])
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
+ tsc_dynfield_offset =
+ rte_mbuf_dynfield_register(&tsc_dynfield_desc);
+ if (tsc_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize all ports */
RTE_ETH_FOREACH_DEV(portid)
if (port_init(portid, mbuf_pool) != 0)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v4 15/15] mbuf: remove userdata field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
` (13 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 14/15] examples/rxtx_callbacks: " Thomas Monjalon
@ 2020-10-28 10:26 ` Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:26 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, Ray Kinsella, Neil Horman
As announced in the deprecation note, the field userdata / udata64
is removed to give more space to the dynamic fields.
This is how the mbuf layout looks like (pahole-style):
word type name byte size
0 void * buf_addr; /* 0 + 8 */
1 rte_iova_t buf_iova /* 8 + 8 */
/* --- RTE_MARKER64 rearm_data; */
2 uint16_t data_off; /* 16 + 2 */
uint16_t refcnt; /* 18 + 2 */
uint16_t nb_segs; /* 20 + 2 */
uint16_t port; /* 22 + 2 */
3 uint64_t ol_flags; /* 24 + 8 */
/* --- RTE_MARKER rx_descriptor_fields1; */
4 uint32_t union packet_type; /* 32 + 4 */
uint32_t pkt_len; /* 36 + 4 */
5 uint16_t data_len; /* 40 + 2 */
uint16_t vlan_tci; /* 42 + 2 */
5.5 uint64_t union hash; /* 44 + 8 */
6.5 uint16_t vlan_tci_outer; /* 52 + 2 */
uint16_t buf_len; /* 54 + 2 */
7 uint64_t timestamp; /* 56 + 8 */
/* --- RTE_MARKER cacheline1; */
8 struct rte_mempool * pool; /* 64 + 8 */
9 struct rte_mbuf * next; /* 72 + 8 */
10 uint64_t union tx_offload; /* 80 + 8 */
11 uint16_t priv_size; /* 88 + 2 */
uint16_t timesync; /* 90 + 2 */
uint32_t seqn; /* 92 + 4 */
12 struct rte_mbuf_ext_shared_info * shinfo; /* 96 + 8 */
13 uint64_t dynfield1[3]; /* 104 + 24 */
16 /* --- END 128 */
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +++
lib/librte_kni/rte_kni_common.h | 3 +--
lib/librte_mbuf/rte_mbuf_core.h | 8 +-------
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 2e082499b8..0f6f1df12a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,7 +87,6 @@ Deprecation Notices
The following static fields will be moved as dynamic:
- ``timestamp``
- - ``userdata`` / ``udata64``
- ``seqn``
As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index d8ac359e51..3cec526b6a 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -426,6 +426,9 @@ API Changes
the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
The field ``refcnt`` is remaining from the old unions.
+* mbuf: Removed the unioned fields ``userdata`` and ``udata64``
+ from the structure ``rte_mbuf``. It is replaced with dynamic fields.
+
* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
replaced with a private enum in the PCI subsystem.
diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
index 21b477f0aa..0db45e6a24 100644
--- a/lib/librte_kni/rte_kni_common.h
+++ b/lib/librte_kni/rte_kni_common.h
@@ -86,8 +86,7 @@ struct rte_kni_mbuf {
uint16_t data_len; /**< Amount of data in segment buffer. */
/* fields on second cache line */
- char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
- void *pool;
+ void *pool __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
void *next; /**< Physical address of next mbuf in kernel. */
};
diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index 065d87d28a..a65eaaf692 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -599,12 +599,6 @@ struct rte_mbuf {
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
- RTE_STD_C11
- union {
- void *userdata; /**< Can be used for external metadata */
- uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
- };
-
struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
struct rte_mbuf *next; /**< Next segment of scattered packet. */
@@ -662,7 +656,7 @@ struct rte_mbuf {
*/
struct rte_mbuf_ext_shared_info *shinfo;
- uint64_t dynfield1[2]; /**< Reserved for dynamic fields. */
+ uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */
} __rte_cache_aligned;
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 10:08 ` Thomas Monjalon
2020-10-28 10:24 ` Van Haaren, Harry
@ 2020-10-28 10:33 ` Nithin Dabilpuram
1 sibling, 0 replies; 178+ messages in thread
From: Nithin Dabilpuram @ 2020-10-28 10:33 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang, Bruce Richardson,
Konstantin Ananyev, kirankumark, dev, david.marchand,
olivier.matz
On Wed, Oct 28, 2020 at 11:08:47AM +0100, Thomas Monjalon wrote:
> 28/10/2020 10:30, Nithin Dabilpuram:
> > From: Thomas Monjalon <thomas@monjalon.net>
> >
> > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> [...]
> > + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
>
> That's interesting.
> You copy the offset in the node context for better performance.
> How much is it better than with global offset variable?
> How much it decreases compared to a static mbuf field?
Moving it to node context was not for performance but for functionality as for
graph's created in primary can be looked up in secondary and graph walk can
be called on them. So having the dyn offset in global variable doesn't reflect
in secondary.
This is partially better than referring global offset variable directly in
node_mbuf_priv1() as it is caching the dyn offset locally and passing it to
node_mbuf_priv1() instead of loading from global variable for every mbuf.
As mentioned earlier, this is done only because currently there is no mechanism
to have a callback triggered in secondary alone where we can update the
global variable.
>
>
>
>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 10:24 ` Van Haaren, Harry
@ 2020-10-28 10:42 ` Nithin Dabilpuram
2020-10-28 10:43 ` Thomas Monjalon
2020-10-28 18:07 ` Thomas Monjalon
1 sibling, 1 reply; 178+ messages in thread
From: Nithin Dabilpuram @ 2020-10-28 10:42 UTC (permalink / raw)
To: Van Haaren, Harry
Cc: Thomas Monjalon, Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang,
Richardson, Bruce, Ananyev, Konstantin, kirankumark, dev,
david.marchand, olivier.matz
On Wed, Oct 28, 2020 at 10:24:01AM +0000, Van Haaren, Harry wrote:
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Thomas Monjalon
> > Sent: Wednesday, October 28, 2020 10:09 AM
> > To: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > Cc: Pavan Nikhilesh <pbhagavatula@marvell.com>; Jerin Jacob
> > <jerinj@marvell.com>; Ruifeng Wang <ruifeng.wang@arm.com>; Richardson, Bruce
> > <bruce.richardson@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; kirankumark@marvell.com; dev@dpdk.org;
> > david.marchand@redhat.com; olivier.matz@6wind.com
> > Subject: Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf
> > field
> >
> > 28/10/2020 10:30, Nithin Dabilpuram:
> > > From: Thomas Monjalon <thomas@monjalon.net>
> > >
> > > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > > It is moved to a dynamic field in order to allow removal of udata64.
> > >
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > [...]
> > > + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) =
> > node_mbuf_priv1_dynfield_offset;
> >
> > That's interesting.
> > You copy the offset in the node context for better performance.
> > How much is it better than with global offset variable?
> > How much it decreases compared to a static mbuf field?
>
> Also interested in this topic, I'll offer the logical/theory point of view;
>
> With a static field, the offset into the mbuf can be encoded in the instruction
> stream, meaning there are no d-cache loads to identify particular dynamic field.
>
> With a static/global variable, the cache line where the value resides is presumably
> not hot in cache per burst (assuming an application that does significant work, so not
> in cache since last burst). Hence overhead estimate could be 1x cache line load per burst.
>
> With the data copied into the node, the offset is presumably on a hot cache line as the
> node is using other data-members of its context. As a result, perhaps a cold static cache
> line load is converted to a hot node-context line re-use.
>
> Real world overhead likely depends on A) does the application cache-trash enough to make
> the static/global line fall out of cache - causing perf degradation due to reload, and B) does
> the node->ctx still fit in the same number of lines as before if the value is copied there.
Agreed, node->ctx is already referred to get other data (lpm pointer). So
referening another 4 bytes might even convert that to load pair which is at
no extra cost.
Number's wise,
it decreases by ~1.4 % from static mbuf field to global offset variable
and it decreases by ~1% from static mbuf field to node context field
cached per process call
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 10:42 ` Nithin Dabilpuram
@ 2020-10-28 10:43 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 10:43 UTC (permalink / raw)
To: Van Haaren, Harry, Nithin Dabilpuram
Cc: Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang, Richardson, Bruce,
Ananyev, Konstantin, kirankumark, dev, david.marchand,
olivier.matz
28/10/2020 11:42, Nithin Dabilpuram:
> On Wed, Oct 28, 2020 at 10:24:01AM +0000, Van Haaren, Harry wrote:
> > From: Thomas Monjalon
> > > 28/10/2020 10:30, Nithin Dabilpuram:
> > > > From: Thomas Monjalon <thomas@monjalon.net>
> > > >
> > > > The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
> > > > It is moved to a dynamic field in order to allow removal of udata64.
> > > >
> > > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > [...]
> > > > + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) =
> > > node_mbuf_priv1_dynfield_offset;
> > >
> > > That's interesting.
> > > You copy the offset in the node context for better performance.
> > > How much is it better than with global offset variable?
> > > How much it decreases compared to a static mbuf field?
> >
> > Also interested in this topic, I'll offer the logical/theory point of view;
> >
> > With a static field, the offset into the mbuf can be encoded in the instruction
> > stream, meaning there are no d-cache loads to identify particular dynamic field.
> >
> > With a static/global variable, the cache line where the value resides is presumably
> > not hot in cache per burst (assuming an application that does significant work, so not
> > in cache since last burst). Hence overhead estimate could be 1x cache line load per burst.
> >
> > With the data copied into the node, the offset is presumably on a hot cache line as the
> > node is using other data-members of its context. As a result, perhaps a cold static cache
> > line load is converted to a hot node-context line re-use.
> >
> > Real world overhead likely depends on A) does the application cache-trash enough to make
> > the static/global line fall out of cache - causing perf degradation due to reload, and B) does
> > the node->ctx still fit in the same number of lines as before if the value is copied there.
>
> Agreed, node->ctx is already referred to get other data (lpm pointer). So
> referening another 4 bytes might even convert that to load pair which is at
> no extra cost.
>
> Number's wise,
> it decreases by ~1.4 % from static mbuf field to global offset variable
> and it decreases by ~1% from static mbuf field to node context field
> cached per process call
OK thanks for providing these numbers.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch " Thomas Monjalon
@ 2020-10-28 11:51 ` Andrew Rybchenko
2020-10-28 12:21 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-28 11:51 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, Nicolas Chautru
On 10/28/20 1:26 PM, Thomas Monjalon wrote:
> The example used the deprecated mbuf field udata64 as input mbuf pointer.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
I like the approach with inline function(s) more than approach
with macros. Not sure that get/set is needed. Approach in
David's patches looks a bit simpler to me - less duplicated
code (i.e. just one function which returns pointer of correct
type to a dynamic field and allow to get and set it).
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-28 11:51 ` Andrew Rybchenko
@ 2020-10-28 12:21 ` Thomas Monjalon
2020-10-28 12:55 ` Andrew Rybchenko
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 12:21 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, akhil.goyal, Nicolas Chautru
28/10/2020 12:51, Andrew Rybchenko:
> On 10/28/20 1:26 PM, Thomas Monjalon wrote:
> > The example used the deprecated mbuf field udata64 as input mbuf pointer.
> > It is moved to a dynamic field in order to allow removal of udata64.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>
> I like the approach with inline function(s) more than approach
> with macros. Not sure that get/set is needed. Approach in
> David's patches looks a bit simpler to me - less duplicated
> code (i.e. just one function which returns pointer of correct
> type to a dynamic field and allow to get and set it).
Yes I tend to agree with you.
Olivier was asking for more functions,
especially if it has a semantic meaning.
Here get/set has no real added value but I don't have strong opinion,
and I don't think it deserves a respin :)
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-28 12:21 ` Thomas Monjalon
@ 2020-10-28 12:55 ` Andrew Rybchenko
0 siblings, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-10-28 12:55 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, akhil.goyal, Nicolas Chautru
On 10/28/20 3:21 PM, Thomas Monjalon wrote:
> 28/10/2020 12:51, Andrew Rybchenko:
>> On 10/28/20 1:26 PM, Thomas Monjalon wrote:
>>> The example used the deprecated mbuf field udata64 as input mbuf pointer.
>>> It is moved to a dynamic field in order to allow removal of udata64.
>>>
>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>>
>> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>>
>> I like the approach with inline function(s) more than approach
>> with macros. Not sure that get/set is needed. Approach in
>> David's patches looks a bit simpler to me - less duplicated
>> code (i.e. just one function which returns pointer of correct
>> type to a dynamic field and allow to get and set it).
>
> Yes I tend to agree with you.
> Olivier was asking for more functions,
> especially if it has a semantic meaning.
> Here get/set has no real added value but I don't have strong opinion,
> and I don't think it deserves a respin :)
>
Agreed.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 10:24 ` Van Haaren, Harry
2020-10-28 10:42 ` Nithin Dabilpuram
@ 2020-10-28 18:07 ` Thomas Monjalon
2020-10-29 10:17 ` Van Haaren, Harry
1 sibling, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-28 18:07 UTC (permalink / raw)
To: Nithin Dabilpuram, Van Haaren, Harry
Cc: dev, Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang, Richardson,
Bruce, Ananyev, Konstantin, kirankumark, dev, david.marchand,
olivier.matz
28/10/2020 11:24, Van Haaren, Harry:
> From: Thomas Monjalon
> > > + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
> >
> > That's interesting.
> > You copy the offset in the node context for better performance.
> > How much is it better than with global offset variable?
> > How much it decreases compared to a static mbuf field?
>
> Also interested in this topic, I'll offer the logical/theory point of view;
>
> With a static field, the offset into the mbuf can be encoded in the instruction
> stream, meaning there are no d-cache loads to identify particular dynamic field.
>
> With a static/global variable, the cache line where the value resides is presumably
> not hot in cache per burst (assuming an application that does significant work, so not
> in cache since last burst). Hence overhead estimate could be 1x cache line load per burst.
Would it help to group all dynfields and dynflags offsets
in the same cache line?
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf field
2020-10-28 18:07 ` Thomas Monjalon
@ 2020-10-29 10:17 ` Van Haaren, Harry
0 siblings, 0 replies; 178+ messages in thread
From: Van Haaren, Harry @ 2020-10-29 10:17 UTC (permalink / raw)
To: Thomas Monjalon, Nithin Dabilpuram
Cc: dev, Pavan Nikhilesh, Jerin Jacob, Ruifeng Wang, Richardson,
Bruce, Ananyev, Konstantin, kirankumark, dev, david.marchand,
olivier.matz
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, October 28, 2020 6:08 PM
> To: Nithin Dabilpuram <ndabilpuram@marvell.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@marvell.com>; Jerin Jacob
> <jerinj@marvell.com>; Ruifeng Wang <ruifeng.wang@arm.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; kirankumark@marvell.com; dev@dpdk.org;
> david.marchand@redhat.com; olivier.matz@6wind.com
> Subject: Re: [dpdk-dev] [PATCH v4] node: switch IPv4 metadata to dynamic mbuf
> field
>
> 28/10/2020 11:24, Van Haaren, Harry:
> > From: Thomas Monjalon
> > > > + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) =
> node_mbuf_priv1_dynfield_offset;
> > >
> > > That's interesting.
> > > You copy the offset in the node context for better performance.
> > > How much is it better than with global offset variable?
> > > How much it decreases compared to a static mbuf field?
> >
> > Also interested in this topic, I'll offer the logical/theory point of view;
> >
> > With a static field, the offset into the mbuf can be encoded in the instruction
> > stream, meaning there are no d-cache loads to identify particular dynamic field.
> >
> > With a static/global variable, the cache line where the value resides is presumably
> > not hot in cache per burst (assuming an application that does significant work, so
> not
> > in cache since last burst). Hence overhead estimate could be 1x cache line load per
> burst.
>
> Would it help to group all dynfields and dynflags offsets
> in the same cache line?
It could - but if/how-much it would benefit depends on the workload I think.
Using each cache line fully is always good, so if grouping the offsets together is
reasonable to do, it seems a good idea.
My assumptions is that registration of dynamic fields/flags is expected at init time,
and that the values remain constant at runtime. That would make this a cache-line
in "shared" state in each core that uses the dynfields of mbuf.
Overall, it is unlikely to have much impact on a real-world application.. but DPDK
puts performance first! And packing a single cache-line full of hot data is best practice :)
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (17 preceding siblings ...)
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 01/15] eventdev: remove software Rx timestamp Thomas Monjalon
` (14 more replies)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
19 siblings, 15 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
The mbuf field userdata (aliased as udata64)
was announced to be removed for two reasons:
- applications, libraries and drivers used the same field
for different purposes, with a risk of usage conflict.
- this field always used 8 bytes even if unneeded
Some dynamic fields are created when needed to replace
the big static userdata field.
As a consequence, 8 bytes can be re-allocated to dynamic fields.
This mbuf layout change is important to allow adding more features
(consuming more dynamic fields) during the next year.
v5:
- ARK field types different for Rx and Tx
- replace macros with inline functions
v4 (thanks Jerin, Nithin and Ed):
- move rte_node dynfield offset to hotter context in cache
- move test-eventdev dynfield offset to hotter context in cache
- split ARK user data for Rx and Tx + more ARK fixes
v3 (thanks Olivier):
- use typedef for new field types
- fix node field type
- initialize offsets to -1
- add more inline functions
- inline rte_security_dynfield_is_registered
- add PMD-specific userdata field for ARK
v2 (thanks David & Andrew):
- fix some indentations
- return -rte_errno consistently
- make some type casts more precise
- define dynfield types in macros
- hide field description in rte_security
- do not lookup security dynfield in ipsec-secgw
- do not use the existing timestamp field for other purpose
Thomas Monjalon (15):
eventdev: remove software Rx timestamp
mbuf: add Rx timestamp dynamic flag
ethdev: register mbuf field and flags for timestamp
latency: switch timestamp to dynamic mbuf field
net/ark: switch timestamp to dynamic mbuf field
net/dpaa2: switch timestamp to dynamic mbuf field
net/mlx5: fix dynamic mbuf offset lookup check
net/mlx5: switch timestamp to dynamic mbuf field
net/nfb: switch timestamp to dynamic mbuf field
net/octeontx2: switch timestamp to dynamic mbuf field
net/pcap: switch timestamp to dynamic mbuf field
app/testpmd: switch timestamp to dynamic mbuf field
examples/rxtx_callbacks: switch timestamp to dynamic field
mbuf: remove deprecated timestamp field
mbuf: move pool pointer in hotter first half
app/test-pmd/config.c | 38 ----------
app/test-pmd/util.c | 39 ++++++++++-
app/test/test_mbuf.c | 1 -
doc/guides/nics/mlx5.rst | 5 +-
.../prog_guide/event_ethernet_rx_adapter.rst | 6 +-
doc/guides/rel_notes/deprecation.rst | 6 --
doc/guides/rel_notes/release_20_11.rst | 4 ++
drivers/net/ark/ark_ethdev.c | 23 ++++++
drivers/net/ark/ark_ethdev_rx.c | 10 ++-
drivers/net/dpaa2/dpaa2_ethdev.c | 20 ++++++
drivers/net/dpaa2/dpaa2_ethdev.h | 2 +
drivers/net/dpaa2/dpaa2_rxtx.c | 25 +++++--
drivers/net/mlx5/mlx5_rxq.c | 36 ++++++++++
drivers/net/mlx5/mlx5_rxtx.c | 8 +--
drivers/net/mlx5/mlx5_rxtx.h | 19 +++++
drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 41 +++++------
drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 43 ++++++------
drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 35 +++++-----
drivers/net/mlx5/mlx5_trigger.c | 2 +-
drivers/net/mlx5/mlx5_txq.c | 2 +-
drivers/net/nfb/nfb_rx.c | 23 +++++-
drivers/net/nfb/nfb_rx.h | 18 +++--
drivers/net/octeontx2/otx2_ethdev.c | 33 +++++++++
drivers/net/octeontx2/otx2_rx.h | 19 ++++-
drivers/net/octeontx2/version.map | 7 ++
drivers/net/pcap/rte_eth_pcap.c | 29 +++++++-
examples/rxtx_callbacks/main.c | 17 ++++-
lib/librte_ethdev/rte_ethdev.c | 70 +++++++++++++++++++
lib/librte_ethdev/rte_ethdev.h | 13 +++-
.../rte_event_eth_rx_adapter.c | 11 ---
.../rte_event_eth_rx_adapter.h | 6 +-
lib/librte_kni/rte_kni_common.h | 3 +-
lib/librte_latencystats/rte_latencystats.c | 48 +++++++++++--
lib/librte_mbuf/rte_mbuf.c | 2 -
lib/librte_mbuf/rte_mbuf.h | 1 -
lib/librte_mbuf/rte_mbuf_core.h | 15 +---
lib/librte_mbuf/rte_mbuf_dyn.h | 11 +--
37 files changed, 507 insertions(+), 184 deletions(-)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 01/15] eventdev: remove software Rx timestamp
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 02/15] mbuf: add Rx timestamp dynamic flag Thomas Monjalon
` (13 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Nikhil Rao
This a revert of the commit 569758758dcd ("eventdev: add Rx timestamp").
If the Rx timestamp is not configured on the ethdev port,
there is no reason to set one.
Also the accuracy of the timestamp was bad because set at a late stage.
Anyway there is no trace of the usage of this timestamp.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/prog_guide/event_ethernet_rx_adapter.rst | 6 +-----
lib/librte_eventdev/rte_event_eth_rx_adapter.c | 11 -----------
lib/librte_eventdev/rte_event_eth_rx_adapter.h | 6 +-----
3 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
index 236f43f455..cb44ce0e47 100644
--- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
+++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst
@@ -12,11 +12,7 @@ be supported in hardware or require a software thread to receive packets from
the ethdev port using ethdev poll mode APIs and enqueue these as events to the
event device using the eventdev API. Both transfer mechanisms may be present on
the same platform depending on the particular combination of the ethdev and
-the event device. For SW based packet transfer, if the mbuf does not have a
-timestamp set, the adapter adds a timestamp to the mbuf using
-rte_get_tsc_cycles(), this provides a more accurate timestamp as compared to
-if the application were to set the timestamp since it avoids event device
-schedule latency.
+the event device.
The Event Ethernet Rx Adapter library is intended for the application code to
configure both transfer mechanisms using a common API. A capability API allows
diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
index f0000d1ede..3c73046551 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -763,7 +763,6 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
uint32_t rss_mask;
uint32_t rss;
int do_rss;
- uint64_t ts;
uint16_t nb_cb;
uint16_t dropped;
@@ -771,16 +770,6 @@ rxa_buffer_mbufs(struct rte_event_eth_rx_adapter *rx_adapter,
rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
- if ((m->ol_flags & PKT_RX_TIMESTAMP) == 0) {
- ts = rte_get_tsc_cycles();
- for (i = 0; i < num; i++) {
- m = mbufs[i];
-
- m->timestamp = ts;
- m->ol_flags |= PKT_RX_TIMESTAMP;
- }
- }
-
for (i = 0; i < num; i++) {
m = mbufs[i];
diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.h b/lib/librte_eventdev/rte_event_eth_rx_adapter.h
index 2dd259c279..21bb1e54c8 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.h
@@ -21,11 +21,7 @@
*
* The adapter uses a EAL service core function for SW based packet transfer
* and uses the eventdev PMD functions to configure HW based packet transfer
- * between the ethernet device and the event device. For SW based packet
- * transfer, if the mbuf does not have a timestamp set, the adapter adds a
- * timestamp to the mbuf using rte_get_tsc_cycles(), this provides a more
- * accurate timestamp as compared to if the application were to set the time
- * stamp since it avoids event device schedule latency.
+ * between the ethernet device and the event device.
*
* The ethernet Rx event adapter's functions are:
* - rte_event_eth_rx_adapter_create_ext()
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 02/15] mbuf: add Rx timestamp dynamic flag
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 01/15] eventdev: remove software Rx timestamp Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-11-01 20:03 ` Andrew Rybchenko
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 03/15] ethdev: register mbuf field and flags for timestamp Thomas Monjalon
` (12 subsequent siblings)
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
There is already a dynamic field for timestamp,
used only for Tx scheduling, thanks to the dedicated flag.
The same field can be used for Rx timestamp filled by drivers.
The only missing part to get rid of the static timestamp field
was to declare a new dynamic flag for Rx usage.
After migrating all Rx timestamp usages, it will be possible
to remove the deprecated timestamp field.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_mbuf/rte_mbuf_dyn.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 0ebac88b83..5fb85c0610 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -258,14 +258,14 @@ void rte_mbuf_dyn_dump(FILE *out);
* timestamp. The dynamic Tx timestamp flag tells whether the field contains
* actual timestamp value for the packets being sent, this value can be
* used by PMD to schedule packet sending.
- *
- * After PKT_RX_TIMESTAMP flag and fixed timestamp field deprecation
- * and obsoleting, the dedicated Rx timestamp flag is supposed to be
- * introduced and the shared dynamic timestamp field will be used
- * to handle the timestamps on receiving datapath as well.
*/
#define RTE_MBUF_DYNFIELD_TIMESTAMP_NAME "rte_dynfield_timestamp"
+/**
+ * Indicate that the timestamp field in the mbuf was filled by the driver.
+ */
+#define RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME "rte_dynflag_rx_timestamp"
+
/**
* When PMD sees the RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME flag set on the
* packet being sent it tries to synchronize the time of packet appearing
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 03/15] ethdev: register mbuf field and flags for timestamp
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 01/15] eventdev: remove software Rx timestamp Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 02/15] mbuf: add Rx timestamp dynamic flag Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-11-01 20:10 ` Andrew Rybchenko
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 04/15] latency: switch timestamp to dynamic mbuf field Thomas Monjalon
` (11 subsequent siblings)
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Wenzhuo Lu, Beilei Xing,
Bernard Iremonger, Matan Azrad, Shahaf Shuler,
Viacheslav Ovsiienko
During port configure or queue setup, the offload flags
DEV_RX_OFFLOAD_TIMESTAMP and DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP
trigger the registration of the related mbuf field and flags.
Previously, the Tx timestamp field and flag were registered in testpmd,
as described in mlx5 guide.
For the general usage of Rx and Tx timestamps,
managing registrations inside ethdev is simpler and properly documented.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-pmd/config.c | 38 ------------------
doc/guides/nics/mlx5.rst | 5 +--
lib/librte_ethdev/rte_ethdev.c | 70 ++++++++++++++++++++++++++++++++++
lib/librte_ethdev/rte_ethdev.h | 9 ++++-
lib/librte_mbuf/rte_mbuf_dyn.h | 1 +
5 files changed, 81 insertions(+), 42 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1668ae3238..9a2baf16fe 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3955,44 +3955,6 @@ show_tx_pkt_times(void)
void
set_tx_pkt_times(unsigned int *tx_times)
{
- uint16_t port_id;
- int offload_found = 0;
- int offset;
- int flag;
-
- static const struct rte_mbuf_dynfield desc_offs = {
- .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME,
- .size = sizeof(uint64_t),
- .align = __alignof__(uint64_t),
- };
- static const struct rte_mbuf_dynflag desc_flag = {
- .name = RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME,
- };
-
- RTE_ETH_FOREACH_DEV(port_id) {
- struct rte_eth_dev_info dev_info = { 0 };
- int ret;
-
- ret = rte_eth_dev_info_get(port_id, &dev_info);
- if (ret == 0 && dev_info.tx_offload_capa &
- DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) {
- offload_found = 1;
- break;
- }
- }
- if (!offload_found) {
- printf("No device supporting Tx timestamp scheduling found, "
- "dynamic flag and field not registered\n");
- return;
- }
- offset = rte_mbuf_dynfield_register(&desc_offs);
- if (offset < 0 && rte_errno != EEXIST)
- printf("Dynamic timestamp field registration error: %d",
- rte_errno);
- flag = rte_mbuf_dynflag_register(&desc_flag);
- if (flag < 0 && rte_errno != EEXIST)
- printf("Dynamic timestamp flag registration error: %d",
- rte_errno);
tx_pkt_times_inter = tx_times[0];
tx_pkt_times_intra = tx_times[1];
}
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index afa65a1379..fa8b13dd1b 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -237,9 +237,8 @@ Limitations
``txq_inline_max`` and ``txq_inline_mpw`` devargs keys.
- To provide the packet send scheduling on mbuf timestamps the ``tx_pp``
- parameter should be specified, RTE_MBUF_DYNFIELD_TIMESTAMP_NAME and
- RTE_MBUF_DYNFLAG_TIMESTAMP_NAME should be registered by application.
- When PMD sees the RTE_MBUF_DYNFLAG_TIMESTAMP_NAME set on the packet
+ parameter should be specified.
+ When PMD sees the RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME set on the packet
being sent it tries to synchronize the time of packet appearing on
the wire with the specified packet timestamp. It the specified one
is in the past it should be ignored, if one is in the distant future
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b12bb3854d..7c9aadb461 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -31,6 +31,7 @@
#include <rte_mempool.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_errno.h>
#include <rte_spinlock.h>
#include <rte_string_fns.h>
@@ -1232,6 +1233,59 @@ eth_dev_check_lro_pkt_size(uint16_t port_id, uint32_t config_size,
return ret;
}
+static inline int
+eth_dev_timestamp_mbuf_register(uint64_t rx_offloads, uint64_t tx_offloads)
+{
+ static const struct rte_mbuf_dynfield field_desc = {
+ .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME,
+ .size = sizeof(rte_mbuf_timestamp_t),
+ .align = __alignof__(rte_mbuf_timestamp_t),
+ };
+ static const struct rte_mbuf_dynflag rx_flag_desc = {
+ .name = RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME,
+ };
+ static const struct rte_mbuf_dynflag tx_flag_desc = {
+ .name = RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME,
+ };
+ static bool done_rx, done_tx;
+ bool todo_rx, todo_tx;
+ int offset;
+
+ todo_rx = (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) != 0
+ && !done_rx;
+ todo_tx = (tx_offloads & DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) != 0
+ && !done_tx;
+
+ if (todo_rx || todo_tx) {
+ offset = rte_mbuf_dynfield_register(&field_desc);
+ if (offset < 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Failed to register mbuf field for timestamp\n");
+ return -rte_errno;
+ }
+ }
+ if (todo_rx) {
+ offset = rte_mbuf_dynflag_register(&rx_flag_desc);
+ if (offset < 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Failed to register mbuf flag for Rx timestamp\n");
+ return -rte_errno;
+ }
+ done_rx = true;
+ }
+ if (todo_tx) {
+ offset = rte_mbuf_dynflag_register(&tx_flag_desc);
+ if (offset < 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Failed to register mbuf flag for Tx timestamp\n");
+ return -rte_errno;
+ }
+ done_tx = true;
+ }
+
+ return 0;
+}
+
/*
* Validate offloads that are requested through rte_eth_dev_configure against
* the offloads successfully set by the ethernet device.
@@ -1481,6 +1535,12 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
goto rollback;
}
+ /* Register mbuf field and flags for timestamp offloads if enabled. */
+ ret = eth_dev_timestamp_mbuf_register(dev_conf->rxmode.offloads,
+ dev_conf->txmode.offloads);
+ if (ret != 0)
+ goto rollback;
+
/*
* Setup new number of RX/TX queues and reconfigure device.
*/
@@ -2088,6 +2148,11 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
return ret;
}
+ /* Register mbuf field and flag for Rx timestamp offload if enabled. */
+ ret = eth_dev_timestamp_mbuf_register(local_conf.offloads, 0);
+ if (ret != 0)
+ return ret;
+
ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc,
socket_id, &local_conf, mp);
if (!ret) {
@@ -2268,6 +2333,11 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
return -EINVAL;
}
+ /* Register mbuf field and flag for Tx timestamp offload if enabled. */
+ ret = eth_dev_timestamp_mbuf_register(0, local_conf.offloads);
+ if (ret != 0)
+ return ret;
+
rte_ethdev_trace_txq_setup(port_id, tx_queue_id, nb_tx_desc, tx_conf);
return eth_err(port_id, (*dev->dev_ops->tx_queue_setup)(dev,
tx_queue_id, nb_tx_desc, socket_id, &local_conf));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index ba997f16ce..3be0050592 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1344,6 +1344,9 @@ struct rte_eth_conf {
#define DEV_RX_OFFLOAD_VLAN_EXTEND 0x00000400
#define DEV_RX_OFFLOAD_JUMBO_FRAME 0x00000800
#define DEV_RX_OFFLOAD_SCATTER 0x00002000
+/**
+ * The mbuf field and flag are registered when the offload is configured.
+ */
#define DEV_RX_OFFLOAD_TIMESTAMP 0x00004000
#define DEV_RX_OFFLOAD_SECURITY 0x00008000
#define DEV_RX_OFFLOAD_KEEP_CRC 0x00010000
@@ -1408,7 +1411,11 @@ struct rte_eth_conf {
#define DEV_TX_OFFLOAD_IP_TNL_TSO 0x00080000
/** Device supports outer UDP checksum */
#define DEV_TX_OFFLOAD_OUTER_UDP_CKSUM 0x00100000
-/** Device supports send on timestamp */
+/**
+ * Device sends on time read from RTE_MBUF_DYNFIELD_TIMESTAMP_NAME
+ * if RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME is set in ol_flags.
+ * The mbuf field and flag are registered when the offload is configured.
+ */
#define DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP 0x00200000
/*
* If new Tx offload capabilities are defined, they also must be
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 5fb85c0610..d4d8f66f77 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -260,6 +260,7 @@ void rte_mbuf_dyn_dump(FILE *out);
* used by PMD to schedule packet sending.
*/
#define RTE_MBUF_DYNFIELD_TIMESTAMP_NAME "rte_dynfield_timestamp"
+typedef uint64_t rte_mbuf_timestamp_t;
/**
* Indicate that the timestamp field in the mbuf was filled by the driver.
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 04/15] latency: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (2 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 03/15] ethdev: register mbuf field and flags for timestamp Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 05/15] net/ark: " Thomas Monjalon
` (10 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Reshma Pattan
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related mbuf flag is also replaced with the dynamic one.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_latencystats/rte_latencystats.c | 48 +++++++++++++++++++---
1 file changed, 43 insertions(+), 5 deletions(-)
diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c
index ba2fff3bcb..a21f6239d9 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -8,7 +8,9 @@
#include <math.h>
#include <rte_string_fns.h>
+#include <rte_bitops.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_log.h>
#include <rte_cycles.h>
#include <rte_ethdev.h>
@@ -31,6 +33,16 @@ latencystat_cycles_per_ns(void)
/* Macros for printing using RTE_LOG */
#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+static uint64_t timestamp_dynflag;
+static int timestamp_dynfield_offset = -1;
+
+static inline rte_mbuf_timestamp_t *
+timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
static const char *MZ_RTE_LATENCY_STATS = "rte_latencystats";
static int latency_stats_index;
static uint64_t samp_intvl;
@@ -128,10 +140,10 @@ add_time_stamps(uint16_t pid __rte_unused,
diff_tsc = now - prev_tsc;
timer_tsc += diff_tsc;
- if ((pkts[i]->ol_flags & PKT_RX_TIMESTAMP) == 0
+ if ((pkts[i]->ol_flags & timestamp_dynflag) == 0
&& (timer_tsc >= samp_intvl)) {
- pkts[i]->timestamp = now;
- pkts[i]->ol_flags |= PKT_RX_TIMESTAMP;
+ *timestamp_dynfield(pkts[i]) = now;
+ pkts[i]->ol_flags |= timestamp_dynflag;
timer_tsc = 0;
}
prev_tsc = now;
@@ -161,8 +173,8 @@ calc_latency(uint16_t pid __rte_unused,
now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++) {
- if (pkts[i]->ol_flags & PKT_RX_TIMESTAMP)
- latency[cnt++] = now - pkts[i]->timestamp;
+ if (pkts[i]->ol_flags & timestamp_dynflag)
+ latency[cnt++] = now - *timestamp_dynfield(pkts[i]);
}
rte_spinlock_lock(&glob_stats->lock);
@@ -204,6 +216,14 @@ int
rte_latencystats_init(uint64_t app_samp_intvl,
rte_latency_stats_flow_type_fn user_cb)
{
+ static const struct rte_mbuf_dynfield timestamp_dynfield_desc = {
+ .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME,
+ .size = sizeof(rte_mbuf_timestamp_t),
+ .align = __alignof__(rte_mbuf_timestamp_t),
+ };
+ static const struct rte_mbuf_dynflag timestamp_dynflag_desc = {
+ .name = RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME,
+ };
unsigned int i;
uint16_t pid;
uint16_t qid;
@@ -211,6 +231,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
const char *ptr_strings[NUM_LATENCY_STATS] = {0};
const struct rte_memzone *mz = NULL;
const unsigned int flags = 0;
+ int timestamp_dynflag_offset;
int ret;
if (rte_memzone_lookup(MZ_RTE_LATENCY_STATS))
@@ -241,6 +262,23 @@ rte_latencystats_init(uint64_t app_samp_intvl,
return -1;
}
+ /* Register mbuf field and flag for Rx timestamp */
+ timestamp_dynfield_offset =
+ rte_mbuf_dynfield_register(×tamp_dynfield_desc);
+ if (timestamp_dynfield_offset < 0) {
+ RTE_LOG(ERR, LATENCY_STATS,
+ "Cannot register mbuf field for timestamp\n");
+ return -rte_errno;
+ }
+ timestamp_dynflag_offset =
+ rte_mbuf_dynflag_register(×tamp_dynflag_desc);
+ if (timestamp_dynflag_offset < 0) {
+ RTE_LOG(ERR, LATENCY_STATS,
+ "Cannot register mbuf field for timestamp\n");
+ return -rte_errno;
+ }
+ timestamp_dynflag = RTE_BIT64(timestamp_dynflag_offset);
+
/** Register Rx/Tx callbacks */
RTE_ETH_FOREACH_DEV(pid) {
struct rte_eth_dev_info dev_info;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 05/15] net/ark: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (3 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 04/15] latency: switch timestamp to dynamic mbuf field Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 06/15] net/dpaa2: " Thomas Monjalon
` (9 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Shepard Siegel, Ed Czeck,
John Miller
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related dynamic mbuf flag is set, although was missing previously.
The timestamp is set if configured for at least one device.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/ark/ark_ethdev.c | 23 +++++++++++++++++++++++
drivers/net/ark/ark_ethdev_rx.c | 10 +++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index fa343999a1..629f825019 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -9,6 +9,7 @@
#include <rte_bus_pci.h>
#include <rte_ethdev_pci.h>
#include <rte_kvargs.h>
+#include <rte_bitops.h>
#include "rte_pmd_ark.h"
#include "ark_global.h"
@@ -79,6 +80,8 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
#define ARK_TX_MAX_QUEUE (4096 * 4)
#define ARK_TX_MIN_QUEUE (256)
+uint64_t ark_timestamp_rx_dynflag;
+int ark_timestamp_dynfield_offset = -1;
int rte_pmd_ark_rx_userdata_dynfield_offset = -1;
int rte_pmd_ark_tx_userdata_dynfield_offset = -1;
@@ -552,6 +555,24 @@ static int
eth_ark_dev_configure(struct rte_eth_dev *dev)
{
struct ark_adapter *ark = dev->data->dev_private;
+ int ark_timestamp_rx_dynflag_offset;
+
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TIMESTAMP) {
+ ark_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (ark_timestamp_dynfield_offset < 0) {
+ ARK_PMD_LOG(ERR, "Failed to lookup timestamp field\n");
+ return -rte_errno;
+ }
+ ark_timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
+ RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
+ if (ark_timestamp_rx_dynflag_offset < 0) {
+ ARK_PMD_LOG(ERR, "Failed to lookup Rx timestamp flag\n");
+ return -rte_errno;
+ }
+ ark_timestamp_rx_dynflag =
+ RTE_BIT64(ark_timestamp_rx_dynflag_offset);
+ }
eth_ark_dev_set_link_up(dev);
if (ark->user_ext.dev_configure)
@@ -782,6 +803,8 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev,
ETH_LINK_SPEED_50G |
ETH_LINK_SPEED_100G);
+ dev_info->rx_offload_capa = DEV_RX_OFFLOAD_TIMESTAMP;
+
return 0;
}
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 825b4791be..dda796da0d 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -15,6 +15,9 @@
#define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
+extern uint64_t ark_timestamp_rx_dynflag;
+extern int ark_timestamp_dynfield_offset;
+
/* Forward declarations */
struct ark_rx_queue;
struct ark_rx_meta;
@@ -272,7 +275,12 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->port = meta->port;
mbuf->pkt_len = meta->pkt_len;
mbuf->data_len = meta->pkt_len;
- mbuf->timestamp = meta->timestamp;
+ /* set timestamp if enabled at least on one device */
+ if (ark_timestamp_rx_dynflag > 0) {
+ *RTE_MBUF_DYNFIELD(mbuf, ark_timestamp_dynfield_offset,
+ rte_mbuf_timestamp_t *) = meta->timestamp;
+ mbuf->ol_flags |= ark_timestamp_rx_dynflag;
+ }
rte_pmd_ark_mbuf_rx_userdata_set(mbuf, meta->user_data);
if (ARK_DEBUG_CORE) { /* debug sanity checks */
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 06/15] net/dpaa2: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (4 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 05/15] net/ark: " Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 07/15] net/mlx5: fix dynamic mbuf offset lookup check Thomas Monjalon
` (8 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Hemant Agrawal,
Sachin Saxena
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related mbuf flag is also replaced.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/dpaa2/dpaa2_ethdev.c | 20 ++++++++++++++++++++
drivers/net/dpaa2/dpaa2_ethdev.h | 2 ++
drivers/net/dpaa2/dpaa2_rxtx.c | 25 ++++++++++++++++++-------
3 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 04e60c56f2..ff368174bd 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -8,6 +8,7 @@
#include <time.h>
#include <net/if.h>
+#include <rte_bitops.h>
#include <rte_mbuf.h>
#include <rte_ethdev_driver.h>
#include <rte_malloc.h>
@@ -65,6 +66,8 @@ static uint64_t dev_tx_offloads_nodis =
/* enable timestamp in mbuf */
bool dpaa2_enable_ts[RTE_MAX_ETHPORTS];
+uint64_t dpaa2_timestamp_rx_dynflag;
+int dpaa2_timestamp_dynfield_offset = -1;
struct rte_dpaa2_xstats_name_off {
char name[RTE_ETH_XSTATS_NAME_SIZE];
@@ -505,6 +508,7 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
uint64_t rx_offloads = eth_conf->rxmode.offloads;
uint64_t tx_offloads = eth_conf->txmode.offloads;
+ int timestamp_rx_dynflag_offset;
int rx_l3_csum_offload = false;
int rx_l4_csum_offload = false;
int tx_l3_csum_offload = false;
@@ -587,7 +591,23 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
#if !defined(RTE_LIBRTE_IEEE1588)
if (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
#endif
+ {
+ dpaa2_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (dpaa2_timestamp_dynfield_offset < 0) {
+ DPAA2_PMD_ERR("Error to lookup timestamp field");
+ return -rte_errno;
+ }
+ timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
+ RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
+ if (timestamp_rx_dynflag_offset < 0) {
+ DPAA2_PMD_ERR("Error to lookup Rx timestamp flag");
+ return -rte_errno;
+ }
+ dpaa2_timestamp_rx_dynflag =
+ RTE_BIT64(timestamp_rx_dynflag_offset);
dpaa2_enable_ts[dev->data->port_id] = true;
+ }
if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)
tx_l3_csum_offload = true;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 94cf253827..8d82f74684 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -92,6 +92,8 @@
/* enable timestamp in mbuf*/
extern bool dpaa2_enable_ts[];
+extern uint64_t dpaa2_timestamp_rx_dynflag;
+extern int dpaa2_timestamp_dynfield_offset;
#define DPAA2_QOS_TABLE_RECONFIGURE 1
#define DPAA2_FS_TABLE_RECONFIGURE 2
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 4dd1d5f578..cef70bfabe 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -31,6 +31,13 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
static void enable_tx_tstamp(struct qbman_fd *fd) __rte_unused;
+static inline rte_mbuf_timestamp_t *
+dpaa2_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ dpaa2_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
#define DPAA2_MBUF_TO_CONTIG_FD(_mbuf, _fd, _bpid) do { \
DPAA2_SET_FD_ADDR(_fd, DPAA2_MBUF_VADDR_TO_IOVA(_mbuf)); \
DPAA2_SET_FD_LEN(_fd, _mbuf->data_len); \
@@ -109,9 +116,10 @@ dpaa2_dev_rx_parse_new(struct rte_mbuf *m, const struct qbman_fd *fd,
m->ol_flags |= PKT_RX_RSS_HASH;
if (dpaa2_enable_ts[m->port]) {
- m->timestamp = annotation->word2;
- m->ol_flags |= PKT_RX_TIMESTAMP;
- DPAA2_PMD_DP_DEBUG("pkt timestamp:0x%" PRIx64 "", m->timestamp);
+ *dpaa2_timestamp_dynfield(m) = annotation->word2;
+ m->ol_flags |= dpaa2_timestamp_rx_dynflag;
+ DPAA2_PMD_DP_DEBUG("pkt timestamp:0x%" PRIx64 "",
+ *dpaa2_timestamp_dynfield(m));
}
DPAA2_PMD_DP_DEBUG("HW frc = 0x%x\t packet type =0x%x "
@@ -223,9 +231,12 @@ dpaa2_dev_rx_parse(struct rte_mbuf *mbuf, void *hw_annot_addr)
else if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L4CE))
mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
- mbuf->ol_flags |= PKT_RX_TIMESTAMP;
- mbuf->timestamp = annotation->word2;
- DPAA2_PMD_DP_DEBUG("pkt timestamp: 0x%" PRIx64 "", mbuf->timestamp);
+ if (dpaa2_enable_ts[mbuf->port]) {
+ *dpaa2_timestamp_dynfield(mbuf) = annotation->word2;
+ mbuf->ol_flags |= dpaa2_timestamp_rx_dynflag;
+ DPAA2_PMD_DP_DEBUG("pkt timestamp: 0x%" PRIx64 "",
+ *dpaa2_timestamp_dynfield(mbuf));
+ }
/* Check detailed parsing requirement */
if (annotation->word3 & 0x7FFFFC3FFFF)
@@ -629,7 +640,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
else
bufs[num_rx] = eth_fd_to_mbuf(fd, eth_data->port_id);
#if defined(RTE_LIBRTE_IEEE1588)
- priv->rx_timestamp = bufs[num_rx]->timestamp;
+ priv->rx_timestamp = *dpaa2_timestamp_dynfield(bufs[num_rx]);
#endif
if (eth_data->dev_conf.rxmode.offloads &
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 07/15] net/mlx5: fix dynamic mbuf offset lookup check
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (5 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 06/15] net/dpaa2: " Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 08/15] net/mlx5: switch timestamp to dynamic mbuf field Thomas Monjalon
` (7 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, stable, Matan Azrad,
Shahaf Shuler, Viacheslav Ovsiienko, Ori Kam
The functions rte_mbuf_dynfield_lookup() and rte_mbuf_dynflag_lookup()
can return an offset starting with 0 or a negative error code.
In reality the first offsets are probably reserved forever,
but for the sake of strict API compliance,
the checks which considered 0 as an error are fixed.
Fixes: efa79e68c8cd ("net/mlx5: support fine grain dynamic flag")
Fixes: 3172c471b86f ("net/mlx5: prepare Tx queue structures to support timestamp")
Fixes: 0febfcce3693 ("net/mlx5: prepare Tx to support scheduling")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/mlx5/mlx5_rxtx.c | 4 ++--
drivers/net/mlx5/mlx5_trigger.c | 2 +-
drivers/net/mlx5/mlx5_txq.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index b530ff421f..e86468b67a 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -5661,9 +5661,9 @@ mlx5_select_tx_function(struct rte_eth_dev *dev)
}
if (tx_offloads & DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP &&
rte_mbuf_dynflag_lookup
- (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL) > 0 &&
+ (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL) >= 0 &&
rte_mbuf_dynfield_lookup
- (RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL) > 0) {
+ (RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL) >= 0) {
/* Offload configured, dynamic entities registered. */
olx |= MLX5_TXOFF_CONFIG_TXPP;
}
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 7735f022a3..917b433c4a 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -302,7 +302,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
DRV_LOG(DEBUG, "port %u starting device", dev->data->port_id);
fine_inline = rte_mbuf_dynflag_lookup
(RTE_PMD_MLX5_FINE_GRANULARITY_INLINE, NULL);
- if (fine_inline > 0)
+ if (fine_inline >= 0)
rte_net_mlx5_dynf_inline_mask = 1UL << fine_inline;
else
rte_net_mlx5_dynf_inline_mask = 0;
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index af84f5f72b..8ed2bcff7b 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -1305,7 +1305,7 @@ mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev)
(RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL);
off = rte_mbuf_dynfield_lookup
(RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
- if (nbit > 0 && off >= 0 && sh->txpp.refcnt)
+ if (nbit >= 0 && off >= 0 && sh->txpp.refcnt)
mask = 1ULL << nbit;
for (i = 0; i != priv->txqs_n; ++i) {
data = (*priv->txqs)[i];
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 08/15] net/mlx5: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (6 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 07/15] net/mlx5: fix dynamic mbuf offset lookup check Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 09/15] net/nfb: " Thomas Monjalon
` (6 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Matan Azrad,
Shahaf Shuler, Viacheslav Ovsiienko, David Christensen,
Ruifeng Wang, Konstantin Ananyev
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related mbuf flag is also replaced.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/mlx5/mlx5_rxq.c | 36 ++++++++++++++++++++
drivers/net/mlx5/mlx5_rxtx.c | 4 +--
drivers/net/mlx5/mlx5_rxtx.h | 19 +++++++++++
drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 41 +++++++++++-----------
drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 43 ++++++++++++------------
drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 35 +++++++++----------
6 files changed, 118 insertions(+), 60 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index f1d8373079..877aa24a18 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1310,6 +1310,39 @@ mlx5_max_lro_msg_size_adjust(struct rte_eth_dev *dev, uint16_t idx,
priv->max_lro_msg_size * MLX5_LRO_SEG_CHUNK_SIZE);
}
+/**
+ * Lookup mbuf field and flag for Rx timestamp if offload requested.
+ *
+ * @param rxq_data
+ * Datapath struct where field offset and flag mask are stored.
+ *
+ * @return
+ * 0 on success or offload disabled, negative errno otherwise.
+ */
+static int
+mlx5_rx_timestamp_setup(struct mlx5_rxq_data *rxq_data)
+{
+ int timestamp_rx_dynflag_offset;
+
+ rxq_data->timestamp_rx_flag = 0;
+ if (rxq_data->hw_timestamp == 0)
+ return 0;
+ rxq_data->timestamp_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (rxq_data->timestamp_offset < 0) {
+ DRV_LOG(ERR, "Cannot lookup timestamp field\n");
+ return -rte_errno;
+ }
+ timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
+ RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
+ if (timestamp_rx_dynflag_offset < 0) {
+ DRV_LOG(ERR, "Cannot lookup Rx timestamp flag\n");
+ return -rte_errno;
+ }
+ rxq_data->timestamp_rx_flag = RTE_BIT64(timestamp_rx_dynflag_offset);
+ return 0;
+}
+
/**
* Create a DPDK Rx queue.
*
@@ -1492,7 +1525,10 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
mlx5_max_lro_msg_size_adjust(dev, idx, max_lro_size);
/* Toggle RX checksum offload if hardware supports it. */
tmpl->rxq.csum = !!(offloads & DEV_RX_OFFLOAD_CHECKSUM);
+ /* Configure Rx timestamp. */
tmpl->rxq.hw_timestamp = !!(offloads & DEV_RX_OFFLOAD_TIMESTAMP);
+ if (mlx5_rx_timestamp_setup(&tmpl->rxq) != 0)
+ goto error;
/* Configure VLAN stripping. */
tmpl->rxq.vlan_strip = !!(offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
/* By default, FCS (CRC) is stripped by hardware. */
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index e86468b67a..b577aab00b 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1287,8 +1287,8 @@ rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt,
if (rxq->rt_timestamp)
ts = mlx5_txpp_convert_rx_ts(rxq->sh, ts);
- pkt->timestamp = ts;
- pkt->ol_flags |= PKT_RX_TIMESTAMP;
+ mlx5_timestamp_set(pkt, rxq->timestamp_offset, ts);
+ pkt->ol_flags |= rxq->timestamp_rx_flag;
}
}
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 674296ee98..e9eca36b40 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -151,6 +151,8 @@ struct mlx5_rxq_data {
/* CQ (UAR) access lock required for 32bit implementations */
#endif
uint32_t tunnel; /* Tunnel information. */
+ int timestamp_offset; /* Dynamic mbuf field for timestamp. */
+ uint64_t timestamp_rx_flag; /* Dynamic mbuf flag for timestamp. */
uint64_t flow_meta_mask;
int32_t flow_meta_offset;
} __rte_cache_aligned;
@@ -681,4 +683,21 @@ mlx5_txpp_convert_tx_ts(struct mlx5_dev_ctx_shared *sh, uint64_t mts)
return ci;
}
+/**
+ * Set timestamp in mbuf dynamic field.
+ *
+ * @param mbuf
+ * Structure to write into.
+ * @param offset
+ * Dynamic field offset in mbuf structure.
+ * @param timestamp
+ * Value to write.
+ */
+static __rte_always_inline void
+mlx5_timestamp_set(struct rte_mbuf *mbuf, int offset,
+ rte_mbuf_timestamp_t timestamp)
+{
+ *RTE_MBUF_DYNFIELD(mbuf, offset, rte_mbuf_timestamp_t *) = timestamp;
+}
+
#endif /* RTE_PMD_MLX5_RXTX_H_ */
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
index 6bf0c9b540..171d7bb0f8 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h
@@ -330,13 +330,13 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq,
vector unsigned char ol_flags = (vector unsigned char)
(vector unsigned int){
rxq->rss_hash * PKT_RX_RSS_HASH |
- rxq->hw_timestamp * PKT_RX_TIMESTAMP,
+ rxq->hw_timestamp * rxq->timestamp_rx_flag,
rxq->rss_hash * PKT_RX_RSS_HASH |
- rxq->hw_timestamp * PKT_RX_TIMESTAMP,
+ rxq->hw_timestamp * rxq->timestamp_rx_flag,
rxq->rss_hash * PKT_RX_RSS_HASH |
- rxq->hw_timestamp * PKT_RX_TIMESTAMP,
+ rxq->hw_timestamp * rxq->timestamp_rx_flag,
rxq->rss_hash * PKT_RX_RSS_HASH |
- rxq->hw_timestamp * PKT_RX_TIMESTAMP};
+ rxq->hw_timestamp * rxq->timestamp_rx_flag};
vector unsigned char cv_flags;
const vector unsigned char zero = (vector unsigned char){0};
const vector unsigned char ptype_mask =
@@ -1025,31 +1025,32 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n,
/* D.5 fill in mbuf - rearm_data and packet_type. */
rxq_cq_to_ptype_oflags_v(rxq, cqes, opcode, &pkts[pos]);
if (rxq->hw_timestamp) {
+ int offset = rxq->timestamp_offset;
if (rxq->rt_timestamp) {
struct mlx5_dev_ctx_shared *sh = rxq->sh;
uint64_t ts;
ts = rte_be_to_cpu_64(cq[pos].timestamp);
- pkts[pos]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64(cq[pos + p1].timestamp);
- pkts[pos + 1]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos + 1], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64(cq[pos + p2].timestamp);
- pkts[pos + 2]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos + 2], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64(cq[pos + p3].timestamp);
- pkts[pos + 3]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos + 3], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
} else {
- pkts[pos]->timestamp = rte_be_to_cpu_64
- (cq[pos].timestamp);
- pkts[pos + 1]->timestamp = rte_be_to_cpu_64
- (cq[pos + p1].timestamp);
- pkts[pos + 2]->timestamp = rte_be_to_cpu_64
- (cq[pos + p2].timestamp);
- pkts[pos + 3]->timestamp = rte_be_to_cpu_64
- (cq[pos + p3].timestamp);
+ mlx5_timestamp_set(pkts[pos], offset,
+ rte_be_to_cpu_64(cq[pos].timestamp));
+ mlx5_timestamp_set(pkts[pos + 1], offset,
+ rte_be_to_cpu_64(cq[pos + p1].timestamp));
+ mlx5_timestamp_set(pkts[pos + 2], offset,
+ rte_be_to_cpu_64(cq[pos + p2].timestamp));
+ mlx5_timestamp_set(pkts[pos + 3], offset,
+ rte_be_to_cpu_64(cq[pos + p3].timestamp));
}
}
if (rxq->dynf_meta) {
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index d122dad4fe..436b247ade 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -271,7 +271,7 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq,
uint32x4_t pinfo, cv_flags;
uint32x4_t ol_flags =
vdupq_n_u32(rxq->rss_hash * PKT_RX_RSS_HASH |
- rxq->hw_timestamp * PKT_RX_TIMESTAMP);
+ rxq->hw_timestamp * rxq->timestamp_rx_flag);
const uint32x4_t ptype_ol_mask = { 0x106, 0x106, 0x106, 0x106 };
const uint8x16_t cv_flag_sel = {
0,
@@ -697,6 +697,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n,
rxq_cq_to_ptype_oflags_v(rxq, ptype_info, flow_tag,
opcode, &elts[pos]);
if (rxq->hw_timestamp) {
+ int offset = rxq->timestamp_offset;
if (rxq->rt_timestamp) {
struct mlx5_dev_ctx_shared *sh = rxq->sh;
uint64_t ts;
@@ -704,36 +705,36 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n,
ts = rte_be_to_cpu_64
(container_of(p0, struct mlx5_cqe,
pkt_info)->timestamp);
- elts[pos]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(elts[pos], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64
(container_of(p1, struct mlx5_cqe,
pkt_info)->timestamp);
- elts[pos + 1]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(elts[pos + 1], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64
(container_of(p2, struct mlx5_cqe,
pkt_info)->timestamp);
- elts[pos + 2]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(elts[pos + 2], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64
(container_of(p3, struct mlx5_cqe,
pkt_info)->timestamp);
- elts[pos + 3]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(elts[pos + 3], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
} else {
- elts[pos]->timestamp = rte_be_to_cpu_64
- (container_of(p0, struct mlx5_cqe,
- pkt_info)->timestamp);
- elts[pos + 1]->timestamp = rte_be_to_cpu_64
- (container_of(p1, struct mlx5_cqe,
- pkt_info)->timestamp);
- elts[pos + 2]->timestamp = rte_be_to_cpu_64
- (container_of(p2, struct mlx5_cqe,
- pkt_info)->timestamp);
- elts[pos + 3]->timestamp = rte_be_to_cpu_64
- (container_of(p3, struct mlx5_cqe,
- pkt_info)->timestamp);
+ mlx5_timestamp_set(elts[pos], offset,
+ rte_be_to_cpu_64(container_of(p0,
+ struct mlx5_cqe, pkt_info)->timestamp));
+ mlx5_timestamp_set(elts[pos + 1], offset,
+ rte_be_to_cpu_64(container_of(p1,
+ struct mlx5_cqe, pkt_info)->timestamp));
+ mlx5_timestamp_set(elts[pos + 2], offset,
+ rte_be_to_cpu_64(container_of(p2,
+ struct mlx5_cqe, pkt_info)->timestamp));
+ mlx5_timestamp_set(elts[pos + 3], offset,
+ rte_be_to_cpu_64(container_of(p3,
+ struct mlx5_cqe, pkt_info)->timestamp));
}
}
if (rxq->dynf_meta) {
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 0bbcbeefff..ae4439efc7 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -251,7 +251,7 @@ rxq_cq_to_ptype_oflags_v(struct mlx5_rxq_data *rxq, __m128i cqes[4],
__m128i pinfo0, pinfo1;
__m128i pinfo, ptype;
__m128i ol_flags = _mm_set1_epi32(rxq->rss_hash * PKT_RX_RSS_HASH |
- rxq->hw_timestamp * PKT_RX_TIMESTAMP);
+ rxq->hw_timestamp * rxq->timestamp_rx_flag);
__m128i cv_flags;
const __m128i zero = _mm_setzero_si128();
const __m128i ptype_mask =
@@ -656,31 +656,32 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n,
/* D.5 fill in mbuf - rearm_data and packet_type. */
rxq_cq_to_ptype_oflags_v(rxq, cqes, opcode, &pkts[pos]);
if (rxq->hw_timestamp) {
+ int offset = rxq->timestamp_offset;
if (rxq->rt_timestamp) {
struct mlx5_dev_ctx_shared *sh = rxq->sh;
uint64_t ts;
ts = rte_be_to_cpu_64(cq[pos].timestamp);
- pkts[pos]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64(cq[pos + p1].timestamp);
- pkts[pos + 1]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos + 1], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64(cq[pos + p2].timestamp);
- pkts[pos + 2]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos + 2], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
ts = rte_be_to_cpu_64(cq[pos + p3].timestamp);
- pkts[pos + 3]->timestamp =
- mlx5_txpp_convert_rx_ts(sh, ts);
+ mlx5_timestamp_set(pkts[pos + 3], offset,
+ mlx5_txpp_convert_rx_ts(sh, ts));
} else {
- pkts[pos]->timestamp = rte_be_to_cpu_64
- (cq[pos].timestamp);
- pkts[pos + 1]->timestamp = rte_be_to_cpu_64
- (cq[pos + p1].timestamp);
- pkts[pos + 2]->timestamp = rte_be_to_cpu_64
- (cq[pos + p2].timestamp);
- pkts[pos + 3]->timestamp = rte_be_to_cpu_64
- (cq[pos + p3].timestamp);
+ mlx5_timestamp_set(pkts[pos], offset,
+ rte_be_to_cpu_64(cq[pos].timestamp));
+ mlx5_timestamp_set(pkts[pos + 1], offset,
+ rte_be_to_cpu_64(cq[pos + p1].timestamp));
+ mlx5_timestamp_set(pkts[pos + 2], offset,
+ rte_be_to_cpu_64(cq[pos + p2].timestamp));
+ mlx5_timestamp_set(pkts[pos + 3], offset,
+ rte_be_to_cpu_64(cq[pos + p3].timestamp));
}
}
if (rxq->dynf_meta) {
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 09/15] net/nfb: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (7 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 08/15] net/mlx5: switch timestamp to dynamic mbuf field Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 10/15] net/octeontx2: " Thomas Monjalon
` (5 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Martin Spinler
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related mbuf flag is also replaced.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/nfb/nfb_rx.c | 23 ++++++++++++++++++++++-
drivers/net/nfb/nfb_rx.h | 18 ++++++++++++++----
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/drivers/net/nfb/nfb_rx.c b/drivers/net/nfb/nfb_rx.c
index d97179f818..1f90357522 100644
--- a/drivers/net/nfb/nfb_rx.c
+++ b/drivers/net/nfb/nfb_rx.c
@@ -5,10 +5,14 @@
*/
#include <rte_kvargs.h>
+#include <rte_bitops.h>
#include "nfb_rx.h"
#include "nfb.h"
+uint64_t nfb_timestamp_rx_dynflag;
+int nfb_timestamp_dynfield_offset = -1;
+
static int
timestamp_check_handler(__rte_unused const char *key,
const char *value, __rte_unused void *opaque)
@@ -23,6 +27,7 @@ timestamp_check_handler(__rte_unused const char *key,
static int
nfb_check_timestamp(struct rte_devargs *devargs)
{
+ int timestamp_rx_dynflag_offset;
struct rte_kvargs *kvlist;
if (devargs == NULL)
@@ -38,6 +43,7 @@ nfb_check_timestamp(struct rte_devargs *devargs)
}
/* Timestamps are enabled when there is
* key-value pair: enable_timestamp=1
+ * TODO: timestamp should be enabled with DEV_RX_OFFLOAD_TIMESTAMP
*/
if (rte_kvargs_process(kvlist, TIMESTAMP_ARG,
timestamp_check_handler, NULL) < 0) {
@@ -46,6 +52,21 @@ nfb_check_timestamp(struct rte_devargs *devargs)
}
rte_kvargs_free(kvlist);
+ nfb_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (nfb_timestamp_dynfield_offset < 0) {
+ RTE_LOG(ERR, PMD, "Cannot lookup timestamp field\n");
+ return -rte_errno;
+ }
+ timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
+ RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
+ if (timestamp_rx_dynflag_offset < 0) {
+ RTE_LOG(ERR, PMD, "Cannot lookup Rx timestamp flag\n");
+ return -rte_errno;
+ }
+ nfb_timestamp_rx_dynflag =
+ RTE_BIT64(timestamp_rx_dynflag_offset);
+
return 1;
}
@@ -125,7 +146,7 @@ nfb_eth_rx_queue_setup(struct rte_eth_dev *dev,
else
rte_free(rxq);
- if (nfb_check_timestamp(dev->device->devargs))
+ if (nfb_check_timestamp(dev->device->devargs) > 0)
rxq->flags |= NFB_TIMESTAMP_FLAG;
return ret;
diff --git a/drivers/net/nfb/nfb_rx.h b/drivers/net/nfb/nfb_rx.h
index cf3899b2fb..e548226e0f 100644
--- a/drivers/net/nfb/nfb_rx.h
+++ b/drivers/net/nfb/nfb_rx.h
@@ -15,6 +15,16 @@
#define NFB_TIMESTAMP_FLAG (1 << 0)
+extern uint64_t nfb_timestamp_rx_dynflag;
+extern int nfb_timestamp_dynfield_offset;
+
+static inline rte_mbuf_timestamp_t *
+nfb_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ nfb_timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
struct ndp_rx_queue {
struct nfb_device *nfb; /* nfb dev structure */
struct ndp_queue *queue; /* rx queue */
@@ -191,15 +201,15 @@ nfb_eth_ndp_rx(void *queue,
if (timestamping_enabled) {
/* nanoseconds */
- mbuf->timestamp =
+ *nfb_timestamp_dynfield(mbuf) =
rte_le_to_cpu_32(*((uint32_t *)
(packets[i].header + 4)));
- mbuf->timestamp <<= 32;
+ *nfb_timestamp_dynfield(mbuf) <<= 32;
/* seconds */
- mbuf->timestamp |=
+ *nfb_timestamp_dynfield(mbuf) |=
rte_le_to_cpu_32(*((uint32_t *)
(packets[i].header + 8)));
- mbuf->ol_flags |= PKT_RX_TIMESTAMP;
+ mbuf->ol_flags |= nfb_timestamp_rx_dynflag;
}
bufs[num_rx++] = mbuf;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 10/15] net/octeontx2: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (8 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 09/15] net/nfb: " Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 11/15] net/pcap: " Thomas Monjalon
` (4 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Nithin Dabilpuram,
Kiran Kumar K, Ray Kinsella, Neil Horman
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related mbuf flag is also replaced.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/octeontx2/otx2_ethdev.c | 33 +++++++++++++++++++++++++++++
drivers/net/octeontx2/otx2_rx.h | 19 ++++++++++++++---
drivers/net/octeontx2/version.map | 7 ++++++
3 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index cfb733a4b5..ad95219438 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -4,6 +4,7 @@
#include <inttypes.h>
+#include <rte_bitops.h>
#include <rte_ethdev_pci.h>
#include <rte_io.h>
#include <rte_malloc.h>
@@ -14,6 +15,35 @@
#include "otx2_ethdev.h"
#include "otx2_ethdev_sec.h"
+uint64_t rte_pmd_octeontx2_timestamp_rx_dynflag;
+int rte_pmd_octeontx2_timestamp_dynfield_offset = -1;
+
+static int
+otx2_rx_timestamp_setup(uint16_t flags)
+{
+ int timestamp_rx_dynflag_offset;
+
+ if ((flags & NIX_RX_OFFLOAD_TSTAMP_F) == 0)
+ return 0;
+
+ rte_pmd_octeontx2_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (rte_pmd_octeontx2_timestamp_dynfield_offset < 0) {
+ otx2_err("Failed to lookup timestamp field");
+ return -rte_errno;
+ }
+ timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
+ RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
+ if (timestamp_rx_dynflag_offset < 0) {
+ otx2_err("Failed to lookup Rx timestamp flag");
+ return -rte_errno;
+ }
+ rte_pmd_octeontx2_timestamp_rx_dynflag =
+ RTE_BIT64(timestamp_rx_dynflag_offset);
+
+ return 0;
+}
+
static inline uint64_t
nix_get_rx_offload_capa(struct otx2_eth_dev *dev)
{
@@ -1874,6 +1904,9 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
dev->tx_offload_flags |= nix_tx_offload_flags(eth_dev);
dev->rss_info.rss_grps = NIX_RSS_GRPS;
+ if (otx2_rx_timestamp_setup(dev->rx_offload_flags) != 0)
+ goto fail_offloads;
+
nb_rxq = RTE_MAX(data->nb_rx_queues, 1);
nb_txq = RTE_MAX(data->nb_tx_queues, 1);
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index 61a5c436dd..6981edce82 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -63,6 +63,18 @@ union mbuf_initializer {
uint64_t value;
};
+/* variables are exported because this file is included in other drivers */
+extern uint64_t rte_pmd_octeontx2_timestamp_rx_dynflag;
+extern int rte_pmd_octeontx2_timestamp_dynfield_offset;
+
+static inline rte_mbuf_timestamp_t *
+otx2_timestamp_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ rte_pmd_octeontx2_timestamp_dynfield_offset,
+ rte_mbuf_timestamp_t *);
+}
+
static __rte_always_inline void
otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf,
struct otx2_timesync_info *tstamp, const uint16_t flag,
@@ -77,15 +89,16 @@ otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf,
/* Reading the rx timestamp inserted by CGX, viz at
* starting of the packet data.
*/
- mbuf->timestamp = rte_be_to_cpu_64(*tstamp_ptr);
+ *otx2_timestamp_dynfield(mbuf) = rte_be_to_cpu_64(*tstamp_ptr);
/* PKT_RX_IEEE1588_TMST flag needs to be set only in case
* PTP packets are received.
*/
if (mbuf->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) {
- tstamp->rx_tstamp = mbuf->timestamp;
+ tstamp->rx_tstamp = *otx2_timestamp_dynfield(mbuf);
tstamp->rx_ready = 1;
mbuf->ol_flags |= PKT_RX_IEEE1588_PTP |
- PKT_RX_IEEE1588_TMST | PKT_RX_TIMESTAMP;
+ PKT_RX_IEEE1588_TMST |
+ rte_pmd_octeontx2_timestamp_rx_dynflag;
}
}
}
diff --git a/drivers/net/octeontx2/version.map b/drivers/net/octeontx2/version.map
index 4a76d1d52d..d4f4784bcd 100644
--- a/drivers/net/octeontx2/version.map
+++ b/drivers/net/octeontx2/version.map
@@ -1,3 +1,10 @@
DPDK_21 {
local: *;
};
+
+INTERNAL {
+ global:
+
+ rte_pmd_octeontx2_timestamp_dynfield_offset;
+ rte_pmd_octeontx2_timestamp_rx_dynflag;
+};
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 11/15] net/pcap: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (9 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 10/15] net/octeontx2: " Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 12/15] app/testpmd: " Thomas Monjalon
` (3 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related mbuf flag is also replaced.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/pcap/rte_eth_pcap.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 34e82317b1..b4b7a1839b 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -18,6 +18,7 @@
#include <pcap.h>
+#include <rte_bitops.h>
#include <rte_cycles.h>
#include <rte_ethdev_driver.h>
#include <rte_ethdev_vdev.h>
@@ -51,6 +52,9 @@ static uint64_t start_cycles;
static uint64_t hz;
static uint8_t iface_idx;
+static uint64_t timestamp_rx_dynflag;
+static int timestamp_dynfield_offset = -1;
+
struct queue_stat {
volatile unsigned long pkts;
volatile unsigned long bytes;
@@ -265,9 +269,11 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
}
mbuf->pkt_len = (uint16_t)header.caplen;
- mbuf->timestamp = (uint64_t)header.ts.tv_sec * 1000000
- + header.ts.tv_usec;
- mbuf->ol_flags |= PKT_RX_TIMESTAMP;
+ *RTE_MBUF_DYNFIELD(mbuf, timestamp_dynfield_offset,
+ rte_mbuf_timestamp_t *) =
+ (uint64_t)header.ts.tv_sec * 1000000 +
+ header.ts.tv_usec;
+ mbuf->ol_flags |= timestamp_rx_dynflag;
mbuf->port = pcap_q->port_id;
bufs[num_rx] = mbuf;
num_rx++;
@@ -656,6 +662,23 @@ eth_dev_stop(struct rte_eth_dev *dev)
static int
eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
{
+ int timestamp_rx_dynflag_offset;
+
+ timestamp_dynfield_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (timestamp_dynfield_offset < 0) {
+ PMD_LOG(ERR, "Failed to lookup timestamp field");
+ return -rte_errno;
+ }
+ timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
+ RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
+ if (timestamp_rx_dynflag_offset < 0) {
+ PMD_LOG(ERR, "Failed lookup Rx timestamp flag");
+ return -rte_errno;
+ }
+ timestamp_rx_dynflag =
+ RTE_BIT64(timestamp_rx_dynflag_offset);
+
return 0;
}
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 12/15] app/testpmd: switch timestamp to dynamic mbuf field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (10 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 11/15] net/pcap: " Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 13/15] examples/rxtx_callbacks: switch timestamp to dynamic field Thomas Monjalon
` (2 subsequent siblings)
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Wenzhuo Lu, Beilei Xing,
Bernard Iremonger
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
The related mbuf flag is also replaced.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-pmd/util.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 781a813759..eebb5166ad 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -5,6 +5,7 @@
#include <stdio.h>
+#include <rte_bitops.h>
#include <rte_net.h>
#include <rte_mbuf.h>
#include <rte_ether.h>
@@ -22,6 +23,40 @@ print_ether_addr(const char *what, const struct rte_ether_addr *eth_addr)
printf("%s%s", what, buf);
}
+static inline bool
+is_timestamp_enabled(const struct rte_mbuf *mbuf)
+{
+ static uint64_t timestamp_rx_dynflag;
+
+ int timestamp_rx_dynflag_offset;
+
+ if (timestamp_rx_dynflag == 0) {
+ timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
+ RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
+ if (timestamp_rx_dynflag_offset < 0)
+ return false;
+ timestamp_rx_dynflag = RTE_BIT64(timestamp_rx_dynflag_offset);
+ }
+
+ return (mbuf->ol_flags & timestamp_rx_dynflag) != 0;
+}
+
+static inline rte_mbuf_timestamp_t
+get_timestamp(const struct rte_mbuf *mbuf)
+{
+ static int timestamp_dynfield_offset = -1;
+
+ if (timestamp_dynfield_offset < 0) {
+ timestamp_dynfield_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (timestamp_dynfield_offset < 0)
+ return 0;
+ }
+
+ return *RTE_MBUF_DYNFIELD(mbuf,
+ timestamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
static inline void
dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
uint16_t nb_pkts, int is_rx)
@@ -107,8 +142,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
printf("hash=0x%x ID=0x%x ",
mb->hash.fdir.hash, mb->hash.fdir.id);
}
- if (ol_flags & PKT_RX_TIMESTAMP)
- printf(" - timestamp %"PRIu64" ", mb->timestamp);
+ if (is_timestamp_enabled(mb))
+ printf(" - timestamp %"PRIu64" ", get_timestamp(mb));
if (ol_flags & PKT_RX_QINQ)
printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
mb->vlan_tci, mb->vlan_tci_outer);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 13/15] examples/rxtx_callbacks: switch timestamp to dynamic field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (11 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 12/15] app/testpmd: " Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 14/15] mbuf: remove deprecated timestamp field Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 15/15] mbuf: move pool pointer in hotter first half Thomas Monjalon
14 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, John McNamara
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/rxtx_callbacks/main.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 1a8e7d47d9..b1869a5ce8 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -19,6 +19,15 @@
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
+static int hwts_dynfield_offset = -1;
+
+static inline rte_mbuf_timestamp_t *
+hwts_field(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ hwts_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
typedef uint64_t tsc_t;
static int tsc_dynfield_offset = -1;
@@ -77,7 +86,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused,
for (i = 0; i < nb_pkts; i++) {
cycles += now - *tsc_field(pkts[i]);
if (hw_timestamping)
- queue_ticks += ticks - pkts[i]->timestamp;
+ queue_ticks += ticks - *hwts_field(pkts[i]);
}
latency_numbers.total_cycles += cycles;
@@ -141,6 +150,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
return -1;
}
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
+ hwts_dynfield_offset = rte_mbuf_dynfield_lookup(
+ RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
+ if (hwts_dynfield_offset < 0) {
+ printf("ERROR: Failed to lookup timestamp field\n");
+ return -rte_errno;
+ }
}
retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 14/15] mbuf: remove deprecated timestamp field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (12 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 13/15] examples/rxtx_callbacks: switch timestamp to dynamic field Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-11-01 20:13 ` Andrew Rybchenko
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 15/15] mbuf: move pool pointer in hotter first half Thomas Monjalon
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Ray Kinsella, Neil Horman
As announced in the deprecation note, the field timestamp
is removed to allow giving more space to the dynamic fields.
The related offload flag PKT_RX_TIMESTAMP is also removed.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_mbuf.c | 1 -
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 4 ++++
lib/librte_ethdev/rte_ethdev.h | 4 +++-
lib/librte_mbuf/rte_mbuf.c | 2 --
lib/librte_mbuf/rte_mbuf.h | 1 -
lib/librte_mbuf/rte_mbuf_core.h | 12 +-----------
7 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 80d1850da9..85c150d843 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -1621,7 +1621,6 @@ test_get_rx_ol_flag_name(void)
VAL_NAME(PKT_RX_FDIR_FLX),
VAL_NAME(PKT_RX_QINQ_STRIPPED),
VAL_NAME(PKT_RX_LRO),
- VAL_NAME(PKT_RX_TIMESTAMP),
VAL_NAME(PKT_RX_SEC_OFFLOAD),
VAL_NAME(PKT_RX_SEC_OFFLOAD_FAILED),
VAL_NAME(PKT_RX_OUTER_L4_CKSUM_BAD),
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 0f6f1df12a..72dbb25b83 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -86,7 +86,6 @@ Deprecation Notices
`this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
The following static fields will be moved as dynamic:
- - ``timestamp``
- ``seqn``
As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 70cefb6d07..eb02b6a3cd 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -445,6 +445,10 @@ API Changes
* mbuf: Removed the unioned fields ``userdata`` and ``udata64``
from the structure ``rte_mbuf``. It is replaced with dynamic fields.
+* mbuf: Removed the field ``timestamp`` from the structure ``rte_mbuf``.
+ It is replaced with the dynamic field RTE_MBUF_DYNFIELD_TIMESTAMP_NAME
+ which was previously used only for Tx.
+
* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
replaced with a private enum in the PCI subsystem.
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 3be0050592..619cbe521e 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1345,6 +1345,8 @@ struct rte_eth_conf {
#define DEV_RX_OFFLOAD_JUMBO_FRAME 0x00000800
#define DEV_RX_OFFLOAD_SCATTER 0x00002000
/**
+ * Timestamp is set by the driver in RTE_MBUF_DYNFIELD_TIMESTAMP_NAME
+ * and RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME is set in ol_flags.
* The mbuf field and flag are registered when the offload is configured.
*/
#define DEV_RX_OFFLOAD_TIMESTAMP 0x00004000
@@ -4654,7 +4656,7 @@ int rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *time);
* rte_eth_read_clock(port, base_clock);
*
* Then, convert the raw mbuf timestamp with:
- * base_time_sec + (double)(mbuf->timestamp - base_clock) / freq;
+ * base_time_sec + (double)(*timestamp_dynfield(mbuf) - base_clock) / freq;
*
* This simple example will not provide a very good accuracy. One must
* at least measure multiple times the frequency and do a regression.
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 8a456e5e64..09d93e6899 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -764,7 +764,6 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask)
case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED";
case PKT_RX_QINQ: return "PKT_RX_QINQ";
case PKT_RX_LRO: return "PKT_RX_LRO";
- case PKT_RX_TIMESTAMP: return "PKT_RX_TIMESTAMP";
case PKT_RX_SEC_OFFLOAD: return "PKT_RX_SEC_OFFLOAD";
case PKT_RX_SEC_OFFLOAD_FAILED: return "PKT_RX_SEC_OFFLOAD_FAILED";
case PKT_RX_OUTER_L4_CKSUM_BAD: return "PKT_RX_OUTER_L4_CKSUM_BAD";
@@ -808,7 +807,6 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
{ PKT_RX_FDIR_FLX, PKT_RX_FDIR_FLX, NULL },
{ PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL },
{ PKT_RX_LRO, PKT_RX_LRO, NULL },
- { PKT_RX_TIMESTAMP, PKT_RX_TIMESTAMP, NULL },
{ PKT_RX_SEC_OFFLOAD, PKT_RX_SEC_OFFLOAD, NULL },
{ PKT_RX_SEC_OFFLOAD_FAILED, PKT_RX_SEC_OFFLOAD_FAILED, NULL },
{ PKT_RX_QINQ, PKT_RX_QINQ, NULL },
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a1414ed7cd..6774c6281b 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1108,7 +1108,6 @@ __rte_pktmbuf_copy_hdr(struct rte_mbuf *mdst, const struct rte_mbuf *msrc)
mdst->tx_offload = msrc->tx_offload;
mdst->hash = msrc->hash;
mdst->packet_type = msrc->packet_type;
- mdst->timestamp = msrc->timestamp;
rte_mbuf_dynfield_copy(mdst, msrc);
}
diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index a65eaaf692..52ca1c842f 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -149,11 +149,6 @@ extern "C" {
*/
#define PKT_RX_LRO (1ULL << 16)
-/**
- * Indicate that the timestamp field in the mbuf is valid.
- */
-#define PKT_RX_TIMESTAMP (1ULL << 17)
-
/**
* Indicate that security offload processing was applied on the RX packet.
*/
@@ -589,12 +584,7 @@ struct rte_mbuf {
uint16_t buf_len; /**< Length of segment buffer. */
- /** Valid if PKT_RX_TIMESTAMP is set. The unit and time reference
- * are not normalized but are always the same for a given port.
- * Some devices allow to query rte_eth_read_clock that will return the
- * current device timestamp.
- */
- uint64_t timestamp;
+ uint64_t unused;
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v5 15/15] mbuf: move pool pointer in hotter first half
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
` (13 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 14/15] mbuf: remove deprecated timestamp field Thomas Monjalon
@ 2020-10-30 17:29 ` Thomas Monjalon
2020-11-01 20:23 ` Andrew Rybchenko
14 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:29 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Ray Kinsella, Neil Horman
The mempool pointer in the mbuf struct is moved
from the second to the first half.
It should increase performance on most systems having 64-byte cache line,
i.e. mbuf is split in two cache lines.
On such system, the first half (also called first cache line) is hotter
than the second one where the pool pointer was.
Moving this field gives more space to dynfield1.
This is how the mbuf layout looks like (pahole-style):
word type name byte size
0 void * buf_addr; /* 0 + 8 */
1 rte_iova_t buf_iova /* 8 + 8 */
/* --- RTE_MARKER64 rearm_data; */
2 uint16_t data_off; /* 16 + 2 */
uint16_t refcnt; /* 18 + 2 */
uint16_t nb_segs; /* 20 + 2 */
uint16_t port; /* 22 + 2 */
3 uint64_t ol_flags; /* 24 + 8 */
/* --- RTE_MARKER rx_descriptor_fields1; */
4 uint32_t union packet_type; /* 32 + 4 */
uint32_t pkt_len; /* 36 + 4 */
5 uint16_t data_len; /* 40 + 2 */
uint16_t vlan_tci; /* 42 + 2 */
5.5 uint64_t union hash; /* 44 + 8 */
6.5 uint16_t vlan_tci_outer; /* 52 + 2 */
uint16_t buf_len; /* 54 + 2 */
7 struct rte_mempool * pool; /* 56 + 8 */
/* --- RTE_MARKER cacheline1; */
8 struct rte_mbuf * next; /* 64 + 8 */
9 uint64_t union tx_offload; /* 72 + 8 */
10 uint16_t priv_size; /* 80 + 2 */
uint16_t timesync; /* 82 + 2 */
uint32_t seqn; /* 84 + 4 */
11 struct rte_mbuf_ext_shared_info * shinfo; /* 88 + 8 */
12 uint64_t dynfield1[4]; /* 96 + 32 */
16 /* --- END 128 */
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/rel_notes/deprecation.rst | 5 -----
lib/librte_kni/rte_kni_common.h | 3 ++-
lib/librte_mbuf/rte_mbuf_core.h | 5 ++---
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 72dbb25b83..07ca1dcbb2 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -88,11 +88,6 @@ Deprecation Notices
- ``seqn``
- As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
- avoiding impact on vectorized implementation of the driver datapaths,
- while evaluating performance gains of a better use of the first cache line.
-
-
* ethdev: the legacy filter API, including
``rte_eth_dev_filter_supported()``, ``rte_eth_dev_filter_ctrl()`` as well
as filter types MACVLAN, ETHERTYPE, FLEXIBLE, SYN, NTUPLE, TUNNEL, FDIR,
diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
index 36d66e2ffa..ffb3182731 100644
--- a/lib/librte_kni/rte_kni_common.h
+++ b/lib/librte_kni/rte_kni_common.h
@@ -84,10 +84,11 @@ struct rte_kni_mbuf {
char pad2[4];
uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */
uint16_t data_len; /**< Amount of data in segment buffer. */
+ char pad3[14];
+ void *pool;
/* fields on second cache line */
__attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)))
- void *pool;
void *next; /**< Physical address of next mbuf in kernel. */
};
diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index 52ca1c842f..ee185fa32b 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -584,12 +584,11 @@ struct rte_mbuf {
uint16_t buf_len; /**< Length of segment buffer. */
- uint64_t unused;
+ 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;
- struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
struct rte_mbuf *next; /**< Next segment of scattered packet. */
/* fields to support TX offloads */
@@ -646,7 +645,7 @@ struct rte_mbuf {
*/
struct rte_mbuf_ext_shared_info *shinfo;
- uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */
+ uint64_t dynfield1[4]; /**< Reserved for dynamic fields. */
} __rte_cache_aligned;
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
` (18 preceding siblings ...)
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
` (15 more replies)
19 siblings, 16 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
The mbuf field userdata (aliased as udata64)
was announced to be removed for two reasons:
- applications, libraries and drivers used the same field
for different purposes, with a risk of usage conflict.
- this field always used 8 bytes even if unneeded
Some dynamic fields are created when needed to replace
the big static userdata field.
As a consequence, 8 bytes can be re-allocated to dynamic fields.
This mbuf layout change is important to allow adding more features
(consuming more dynamic fields) during the next year.
v6:
- ARK field types different for Rx and Tx
- replace macros with inline functions
v5: sent "timestamp series" by mistake
v4 (thanks Jerin, Nithin and Ed):
- move rte_node dynfield offset to hotter context in cache
- move test-eventdev dynfield offset to hotter context in cache
- split ARK user data for Rx and Tx + more ARK fixes
v3 (thanks Olivier):
- use typedef for new field types
- fix node field type
- initialize offsets to -1
- add more inline functions
- inline rte_security_dynfield_is_registered
- add PMD-specific userdata field for ARK
v2 (thanks David & Andrew):
- fix some indentations
- return -rte_errno consistently
- make some type casts more precise
- define dynfield types in macros
- hide field description in rte_security
- do not lookup security dynfield in ipsec-secgw
- do not use the existing timestamp field for other purpose
Ed Czeck (1):
net/ark: switch user data to dynamic mbuf fields
Nithin Dabilpuram (1):
node: switch IPv4 metadata to dynamic mbuf field
Thomas Monjalon (13):
examples: enclose DPDK includes with angle brackets
kni: move header file from EAL
mbuf: fix typo in dynamic field convention note
security: switch metadata to dynamic mbuf field
event/sw: switch test counter to dynamic mbuf field
net/bnxt: switch CFA code to dynamic mbuf field
net/vmxnet3: switch MSS hint to dynamic mbuf field
test/distributor: switch sequence to dynamic mbuf field
test/graph: switch user data to dynamic mbuf field
app/eventdev: switch flow ID to dynamic mbuf field
examples/bbdev: switch to dynamic mbuf field
examples/rxtx_callbacks: switch TSC to dynamic field
mbuf: remove userdata field
app/test-eventdev/test_order_atq.c | 4 +-
app/test-eventdev/test_order_common.c | 21 ++-
app/test-eventdev/test_order_common.h | 21 +++
app/test-eventdev/test_order_queue.c | 4 +-
app/test/test_distributor.c | 32 ++++-
app/test/test_graph.c | 99 ++++++++------
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf.in | 1 +
doc/guides/prog_guide/rte_security.rst | 9 +-
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 +-
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 +-
drivers/event/sw/sw_evdev_selftest.c | 28 +++-
drivers/net/ark/ark_ethdev.c | 39 ++++++
drivers/net/ark/ark_ethdev_rx.c | 3 +-
drivers/net/ark/ark_ethdev_tx.c | 3 +-
drivers/net/ark/meson.build | 2 +
drivers/net/ark/rte_pmd_ark.h | 125 ++++++++++++++++++
drivers/net/ark/version.map | 7 +
drivers/net/bnxt/bnxt_ethdev.c | 19 +++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 10 ++
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +
drivers/net/ixgbe/ixgbe_ipsec.c | 5 +-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 +-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 +-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 11 ++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +-
examples/bbdev_app/main.c | 72 ++++++----
examples/bond/main.c | 11 +-
examples/ipsec-secgw/ipsec-secgw.c | 9 +-
examples/ipsec-secgw/ipsec_worker.c | 12 +-
examples/rxtx_callbacks/main.c | 24 +++-
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
.../include => librte_kni}/rte_kni_common.h | 2 +-
lib/librte_mbuf/rte_mbuf_core.h | 8 +-
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
lib/librte_node/ip4_lookup.c | 40 ++++--
lib/librte_node/ip4_lookup_neon.h | 20 ++-
lib/librte_node/ip4_lookup_sse.h | 36 +++--
lib/librte_node/ip4_rewrite.c | 49 +++++--
lib/librte_node/node_private.h | 13 +-
lib/librte_security/rte_security.c | 16 +++
lib/librte_security/rte_security.h | 42 ++++++
lib/librte_security/rte_security_driver.h | 3 +
lib/librte_security/version.map | 2 +
53 files changed, 681 insertions(+), 187 deletions(-)
create mode 100644 drivers/net/ark/rte_pmd_ark.h
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (98%)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 01/15] examples: enclose DPDK includes with angle brackets
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 02/15] kni: move header file from EAL Thomas Monjalon
` (14 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Nicolas Chautru,
Chas Williams, Min Hu (Connor)
In examples, DPDK header files are external,
so they must be enclosed with angle brackets, not quotes.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/bbdev_app/main.c | 30 +++++++++++++++---------------
examples/bond/main.c | 11 ++++-------
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 43fe631760..e512c807cd 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -18,21 +18,21 @@
#include <getopt.h>
#include <signal.h>
-#include "rte_atomic.h"
-#include "rte_common.h"
-#include "rte_eal.h"
-#include "rte_cycles.h"
-#include "rte_ether.h"
-#include "rte_ethdev.h"
-#include "rte_ip.h"
-#include "rte_lcore.h"
-#include "rte_malloc.h"
-#include "rte_mbuf.h"
-#include "rte_memory.h"
-#include "rte_mempool.h"
-#include "rte_log.h"
-#include "rte_bbdev.h"
-#include "rte_bbdev_op.h"
+#include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_eal.h>
+#include <rte_cycles.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_ip.h>
+#include <rte_lcore.h>
+#include <rte_malloc.h>
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_log.h>
+#include <rte_bbdev.h>
+#include <rte_bbdev_op.h>
/* LLR values - negative value for '1' bit */
#define LLR_1_BIT 0x81
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 398553b785..81a6fa976b 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -41,6 +41,10 @@
#include <rte_tcp.h>
#include <rte_arp.h>
#include <rte_spinlock.h>
+#include <rte_devargs.h>
+#include <rte_byteorder.h>
+#include <rte_cpuflags.h>
+#include <rte_eth_bond.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
@@ -53,13 +57,6 @@
#include "main.h"
-#include <rte_devargs.h>
-
-
-#include "rte_byteorder.h"
-#include "rte_cpuflags.h"
-#include "rte_eth_bond.h"
-
#define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1
#define NB_MBUF (1024*8)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 02/15] kni: move header file from EAL
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
` (13 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
Since the kernel module is not part of EAL anymore,
there is no need to have the common KNI header file in EAL.
The file rte_kni_common.h is moved to librte_kni.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
kernel/linux/kni/meson.build | 2 +-
lib/librte_eal/linux/include/meson.build | 1 -
lib/librte_kni/meson.build | 2 +-
lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h | 0
4 files changed, 2 insertions(+), 3 deletions(-)
rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (100%)
diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build
index d696347f22..07e0c9dae7 100644
--- a/kernel/linux/kni/meson.build
+++ b/kernel/linux/kni/meson.build
@@ -18,7 +18,7 @@ custom_target('rte_kni',
'src=' + meson.current_source_dir(),
'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +
' -I' + meson.source_root() + '/lib/librte_eal/include' +
- ' -I' + meson.source_root() + '/lib/librte_eal/linux/include' +
+ ' -I' + meson.source_root() + '/lib/librte_kni' +
' -I' + meson.build_root() +
' -I' + meson.current_source_dir(),
'modules'],
diff --git a/lib/librte_eal/linux/include/meson.build b/lib/librte_eal/linux/include/meson.build
index 1241894b3c..7d18dd52f1 100644
--- a/lib/librte_eal/linux/include/meson.build
+++ b/lib/librte_eal/linux/include/meson.build
@@ -4,6 +4,5 @@
includes += include_directories('.')
headers += files(
- 'rte_kni_common.h',
'rte_os.h',
)
diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build
index 963eae6fe0..ad598bb3d0 100644
--- a/lib/librte_kni/meson.build
+++ b/lib/librte_kni/meson.build
@@ -6,5 +6,5 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
reason = 'only supported on 64-bit linux'
endif
sources = files('rte_kni.c')
-headers = files('rte_kni.h')
+headers = files('rte_kni.h', 'rte_kni_common.h')
deps += ['ethdev', 'pci']
diff --git a/lib/librte_eal/linux/include/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
similarity index 100%
rename from lib/librte_eal/linux/include/rte_kni_common.h
rename to lib/librte_kni/rte_kni_common.h
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 03/15] mbuf: fix typo in dynamic field convention note
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 02/15] kni: move header file from EAL Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
` (12 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, stable,
Konstantin Ananyev
Replace "in a in PMD" with "in a PMD".
Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
lib/librte_mbuf/rte_mbuf_dyn.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h
index 8407230ecf..0ebac88b83 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.h
+++ b/lib/librte_mbuf/rte_mbuf_dyn.h
@@ -62,7 +62,7 @@
* conventions than function names in dpdk:
* - "rte_mbuf_dynfield_<name>" if defined in mbuf library
* - "rte_<libname>_dynfield_<name>" if defined in another library
- * - "rte_net_<pmd>_dynfield_<name>" if defined in a in PMD
+ * - "rte_net_<pmd>_dynfield_<name>" if defined in a PMD
* - any name that does not start with "rte_" in an application
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 04/15] node: switch IPv4 metadata to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (2 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 05/15] security: switch " Thomas Monjalon
` (11 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Nithin Dabilpuram,
Pavan Nikhilesh, Ruifeng Wang, Konstantin Ananyev
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
The node_mbuf_priv1 was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
lib/librte_node/ip4_lookup.c | 40 ++++++++++++++++++-------
lib/librte_node/ip4_lookup_neon.h | 20 ++++++-------
lib/librte_node/ip4_lookup_sse.h | 36 +++++++++++------------
lib/librte_node/ip4_rewrite.c | 49 +++++++++++++++++++++++--------
lib/librte_node/node_private.h | 13 ++++++--
5 files changed, 103 insertions(+), 55 deletions(-)
diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c
index 8835aab9dd..d083a725fc 100644
--- a/lib/librte_node/ip4_lookup.c
+++ b/lib/librte_node/ip4_lookup.c
@@ -29,8 +29,23 @@ struct ip4_lookup_node_main {
struct rte_lpm *lpm_tbl[RTE_MAX_NUMA_NODES];
};
+struct ip4_lookup_node_ctx {
+ /* Socket's LPM table */
+ struct rte_lpm *lpm;
+ /* Dynamic offset to mbuf priv1 */
+ int mbuf_priv1_off;
+};
+
+int node_mbuf_priv1_dynfield_offset = -1;
+
static struct ip4_lookup_node_main ip4_lookup_nm;
+#define IP4_LOOKUP_NODE_LPM(ctx) \
+ (((struct ip4_lookup_node_ctx *)ctx)->lpm)
+
+#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \
+ (((struct ip4_lookup_node_ctx *)ctx)->mbuf_priv1_off)
+
#if defined(__ARM_NEON)
#include "ip4_lookup_neon.h"
#elif defined(RTE_ARCH_X86)
@@ -41,12 +56,13 @@ static uint16_t
ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
struct rte_ipv4_hdr *ipv4_hdr;
void **to_next, **from;
uint16_t last_spec = 0;
struct rte_mbuf *mbuf;
rte_edge_t next_index;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
int i, rc;
@@ -55,9 +71,6 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE;
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
-
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
from = objs;
/* Get stream for the speculated next node */
@@ -72,14 +85,14 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf)->nh = (uint16_t)next_hop;
+ node_mbuf_priv1(mbuf, dyn)->nh = (uint16_t)next_hop;
next_hop = next_hop >> 16;
next = (uint16_t)next_hop;
@@ -169,15 +182,19 @@ setup_lpm(struct ip4_lookup_node_main *nm, int socket)
static int
ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
{
- struct rte_lpm **lpm_p = (struct rte_lpm **)&node->ctx;
uint16_t socket, lcore_id;
static uint8_t init_once;
int rc;
RTE_SET_USED(graph);
- RTE_SET_USED(node);
+ RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_node_ctx) > RTE_NODE_CTX_SZ);
if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+
/* Setup LPM tables for all sockets */
RTE_LCORE_FOREACH(lcore_id)
{
@@ -192,7 +209,10 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node)
}
init_once = 1;
}
- *lpm_p = ip4_lookup_nm.lpm_tbl[graph->socket];
+
+ /* Update socket's LPM and mbuf dyn priv1 offset in node ctx */
+ IP4_LOOKUP_NODE_LPM(node->ctx) = ip4_lookup_nm.lpm_tbl[graph->socket];
+ IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
#if defined(__ARM_NEON) || defined(RTE_ARCH_X86)
if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h
index 0ad2763b82..d5c8da3719 100644
--- a/lib/librte_node/ip4_lookup_neon.h
+++ b/lib/librte_node/ip4_lookup_neon.h
@@ -11,12 +11,13 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
struct rte_ipv4_hdr *ipv4_hdr;
void **to_next, **from;
uint16_t last_spec = 0;
rte_edge_t next_index;
uint16_t n_left_from;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
rte_xmm_t result;
@@ -30,9 +31,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
-
pkts = (struct rte_mbuf **)objs;
from = objs;
n_left_from = nb_objs;
@@ -119,10 +117,10 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
priv23.u16[0] = result.u16[4];
priv23.u16[4] = result.u16[6];
- node_mbuf_priv1(mbuf0)->u = priv01.u64[0];
- node_mbuf_priv1(mbuf1)->u = priv01.u64[1];
- node_mbuf_priv1(mbuf2)->u = priv23.u64[0];
- node_mbuf_priv1(mbuf3)->u = priv23.u64[1];
+ node_mbuf_priv1(mbuf0, dyn)->u = priv01.u64[0];
+ node_mbuf_priv1(mbuf1, dyn)->u = priv01.u64[1];
+ node_mbuf_priv1(mbuf2, dyn)->u = priv23.u64[0];
+ node_mbuf_priv1(mbuf3, dyn)->u = priv23.u64[1];
/* Enqueue four to next node */
rte_edge_t fix_spec = ((next_index == result.u16[1]) &&
@@ -197,14 +195,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf0)->nh = (uint16_t)next_hop;
+ node_mbuf_priv1(mbuf0, dyn)->nh = (uint16_t)next_hop;
next_hop = next_hop >> 16;
next0 = (uint16_t)next_hop;
diff --git a/lib/librte_node/ip4_lookup_sse.h b/lib/librte_node/ip4_lookup_sse.h
index 264c986071..74dbf97533 100644
--- a/lib/librte_node/ip4_lookup_sse.h
+++ b/lib/librte_node/ip4_lookup_sse.h
@@ -11,13 +11,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
+ struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx);
+ const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx);
rte_edge_t next0, next1, next2, next3, next_index;
struct rte_ipv4_hdr *ipv4_hdr;
uint32_t ip0, ip1, ip2, ip3;
void **to_next, **from;
uint16_t last_spec = 0;
uint16_t n_left_from;
- struct rte_lpm *lpm;
uint16_t held = 0;
uint32_t drop_nh;
rte_xmm_t dst;
@@ -29,9 +30,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
/* Drop node */
drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16;
- /* Get socket specific LPM from ctx */
- lpm = *((struct rte_lpm **)node->ctx);
-
pkts = (struct rte_mbuf **)objs;
from = objs;
n_left_from = nb_objs;
@@ -78,24 +76,24 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
sizeof(struct rte_ether_hdr));
ip0 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf1 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
ip1 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf1)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf1)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf1, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf1, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf2 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
ip2 = ipv4_hdr->dst_addr;
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf2)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf2)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf2, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf2, dyn)->ttl = ipv4_hdr->time_to_live;
/* Extract DIP of mbuf3 */
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv4_hdr *,
@@ -111,23 +109,23 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
dip = _mm_shuffle_epi8(dip, bswap_mask);
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf3)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf3)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf3, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf3, dyn)->ttl = ipv4_hdr->time_to_live;
/* Perform LPM lookup to get NH and next node */
rte_lpm_lookupx4(lpm, dip, dst.u32, drop_nh);
/* Extract next node id and NH */
- node_mbuf_priv1(mbuf0)->nh = dst.u32[0] & 0xFFFF;
+ node_mbuf_priv1(mbuf0, dyn)->nh = dst.u32[0] & 0xFFFF;
next0 = (dst.u32[0] >> 16);
- node_mbuf_priv1(mbuf1)->nh = dst.u32[1] & 0xFFFF;
+ node_mbuf_priv1(mbuf1, dyn)->nh = dst.u32[1] & 0xFFFF;
next1 = (dst.u32[1] >> 16);
- node_mbuf_priv1(mbuf2)->nh = dst.u32[2] & 0xFFFF;
+ node_mbuf_priv1(mbuf2, dyn)->nh = dst.u32[2] & 0xFFFF;
next2 = (dst.u32[2] >> 16);
- node_mbuf_priv1(mbuf3)->nh = dst.u32[3] & 0xFFFF;
+ node_mbuf_priv1(mbuf3, dyn)->nh = dst.u32[3] & 0xFFFF;
next3 = (dst.u32[3] >> 16);
/* Enqueue four to next node */
@@ -202,14 +200,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node,
ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *,
sizeof(struct rte_ether_hdr));
/* Extract cksum, ttl as ipv4 hdr is in cache */
- node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum;
- node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live;
+ node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr),
&next_hop);
next_hop = (rc == 0) ? next_hop : drop_nh;
- node_mbuf_priv1(mbuf0)->nh = next_hop & 0xFFFF;
+ node_mbuf_priv1(mbuf0, dyn)->nh = next_hop & 0xFFFF;
next0 = (next_hop >> 16);
if (unlikely(next_index ^ next0)) {
diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c
index bb7f671b5c..99ecb457ff 100644
--- a/lib/librte_node/ip4_rewrite.c
+++ b/lib/librte_node/ip4_rewrite.c
@@ -19,14 +19,28 @@
#include "ip4_rewrite_priv.h"
#include "node_private.h"
+struct ip4_rewrite_node_ctx {
+ /* Dynamic offset to mbuf priv1 */
+ int mbuf_priv1_off;
+ /* Cached next index */
+ uint16_t next_index;
+};
+
static struct ip4_rewrite_node_main *ip4_rewrite_nm;
+#define IP4_REWRITE_NODE_LAST_NEXT(ctx) \
+ (((struct ip4_rewrite_node_ctx *)ctx)->next_index)
+
+#define IP4_REWRITE_NODE_PRIV1_OFF(ctx) \
+ (((struct ip4_rewrite_node_ctx *)ctx)->mbuf_priv1_off)
+
static uint16_t
ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
void **objs, uint16_t nb_objs)
{
struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
struct ip4_rewrite_nh_header *nh = ip4_rewrite_nm->nh;
+ const int dyn = IP4_REWRITE_NODE_PRIV1_OFF(node->ctx);
uint16_t next0, next1, next2, next3, next_index;
struct rte_ipv4_hdr *ip0, *ip1, *ip2, *ip3;
uint16_t n_left_from, held = 0, last_spec = 0;
@@ -37,7 +51,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
int i;
/* Speculative next as last next */
- next_index = *(uint16_t *)node->ctx;
+ next_index = IP4_REWRITE_NODE_LAST_NEXT(node->ctx);
rte_prefetch0(nh);
pkts = (struct rte_mbuf **)objs;
@@ -68,10 +82,10 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
pkts += 4;
n_left_from -= 4;
- priv01.u64[0] = node_mbuf_priv1(mbuf0)->u;
- priv01.u64[1] = node_mbuf_priv1(mbuf1)->u;
- priv23.u64[0] = node_mbuf_priv1(mbuf2)->u;
- priv23.u64[1] = node_mbuf_priv1(mbuf3)->u;
+ priv01.u64[0] = node_mbuf_priv1(mbuf0, dyn)->u;
+ priv01.u64[1] = node_mbuf_priv1(mbuf1, dyn)->u;
+ priv23.u64[0] = node_mbuf_priv1(mbuf2, dyn)->u;
+ priv23.u64[1] = node_mbuf_priv1(mbuf3, dyn)->u;
/* Increment checksum by one. */
priv01.u32[1] += rte_cpu_to_be_16(0x0100);
@@ -203,17 +217,17 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
n_left_from -= 1;
d0 = rte_pktmbuf_mtod(mbuf0, void *);
- rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0)->nh].rewrite_data,
- nh[node_mbuf_priv1(mbuf0)->nh].rewrite_len);
+ rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_data,
+ nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_len);
- next0 = nh[node_mbuf_priv1(mbuf0)->nh].tx_node;
+ next0 = nh[node_mbuf_priv1(mbuf0, dyn)->nh].tx_node;
ip0 = (struct rte_ipv4_hdr *)((uint8_t *)d0 +
sizeof(struct rte_ether_hdr));
- chksum = node_mbuf_priv1(mbuf0)->cksum +
+ chksum = node_mbuf_priv1(mbuf0, dyn)->cksum +
rte_cpu_to_be_16(0x0100);
chksum += chksum >= 0xffff;
ip0->hdr_checksum = chksum;
- ip0->time_to_live = node_mbuf_priv1(mbuf0)->ttl - 1;
+ ip0->time_to_live = node_mbuf_priv1(mbuf0, dyn)->ttl - 1;
if (unlikely(next_index ^ next0)) {
/* Copy things successfully speculated till now */
@@ -240,7 +254,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
rte_memcpy(to_next, from, last_spec * sizeof(from[0]));
rte_node_next_stream_put(graph, node, next_index, held);
/* Save the last next used */
- *(uint16_t *)node->ctx = next_index;
+ IP4_REWRITE_NODE_LAST_NEXT(node->ctx) = next_index;
return nb_objs;
}
@@ -248,9 +262,20 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node,
static int
ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
{
+ static bool init_once;
RTE_SET_USED(graph);
- RTE_SET_USED(node);
+ RTE_BUILD_BUG_ON(sizeof(struct ip4_rewrite_node_ctx) > RTE_NODE_CTX_SZ);
+
+ if (!init_once) {
+ node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+ &node_mbuf_priv1_dynfield_desc);
+ if (node_mbuf_priv1_dynfield_offset < 0)
+ return -rte_errno;
+ init_once = true;
+ }
+ IP4_REWRITE_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset;
+
node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
return 0;
diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h
index ab7941c12b..8c73d5dc10 100644
--- a/lib/librte_node/node_private.h
+++ b/lib/librte_node/node_private.h
@@ -8,6 +8,7 @@
#include <rte_common.h>
#include <rte_log.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
extern int rte_node_logtype;
#define NODE_LOG(level, node_name, ...) \
@@ -21,7 +22,6 @@ extern int rte_node_logtype;
#define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
/**
- *
* Node mbuf private data to store next hop, ttl and checksum.
*/
struct node_mbuf_priv1 {
@@ -37,6 +37,13 @@ struct node_mbuf_priv1 {
};
};
+static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
+ .name = "rte_node_dynfield_priv1",
+ .size = sizeof(struct node_mbuf_priv1),
+ .align = __alignof__(struct node_mbuf_priv1),
+};
+extern int node_mbuf_priv1_dynfield_offset;
+
/**
* Node mbuf private area 2.
*/
@@ -58,9 +65,9 @@ struct node_mbuf_priv2 {
* Pointer to the mbuf_priv1.
*/
static __rte_always_inline struct node_mbuf_priv1 *
-node_mbuf_priv1(struct rte_mbuf *m)
+node_mbuf_priv1(struct rte_mbuf *m, const int offset)
{
- return (struct node_mbuf_priv1 *)&m->udata64;
+ return RTE_MBUF_DYNFIELD(m, offset, struct node_mbuf_priv1 *);
}
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 05/15] security: switch metadata to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (3 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-31 8:56 ` David Marchand
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 06/15] event/sw: switch test counter " Thomas Monjalon
` (10 subsequent siblings)
15 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Haiyue Wang,
Declan Doherty, Ankur Dwivedi, Anoob Joseph, Jeff Guo,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
The device-specific metadata was stored in the deprecated field udata64.
It is moved to a dynamic mbuf field in order to allow removal of udata64.
The name rte_security_dynfield is not very descriptive
but it should be replaced later by separate fields for each type of data
that drivers pass to the upper layer.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
---
doc/guides/prog_guide/rte_security.rst | 9 ++--
drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++-
drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++-
drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++-
drivers/net/octeontx2/otx2_ethdev.h | 1 +
drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++-
drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +-
drivers/net/octeontx2/otx2_rx.h | 2 +-
examples/ipsec-secgw/ipsec-secgw.c | 9 ++--
examples/ipsec-secgw/ipsec_worker.c | 12 ++++--
lib/librte_security/rte_security.c | 16 +++++++
lib/librte_security/rte_security.h | 42 +++++++++++++++++++
lib/librte_security/rte_security_driver.h | 3 ++
lib/librte_security/version.map | 2 +
14 files changed, 99 insertions(+), 20 deletions(-)
diff --git a/doc/guides/prog_guide/rte_security.rst b/doc/guides/prog_guide/rte_security.rst
index c64aef3de9..f72bc8a78f 100644
--- a/doc/guides/prog_guide/rte_security.rst
+++ b/doc/guides/prog_guide/rte_security.rst
@@ -125,8 +125,9 @@ ESP/AH headers will be removed from the packet and the received packet
will contains the decrypted packet only. The driver Rx path checks the
descriptors and based on the crypto status sets additional flags in
``rte_mbuf.ol_flags`` field. The driver would also set device-specific
-metadata in ``rte_mbuf.udata64`` field. This will allow the application
-to identify the security processing done on the packet.
+metadata in ``RTE_SECURITY_DYNFIELD_NAME`` field.
+This will allow the application to identify the security processing
+done on the packet.
.. note::
@@ -568,8 +569,8 @@ security session which processed the packet.
.. note::
- In case of inline processed packets, ``rte_mbuf.udata64`` field would be
- used by the driver to relay information on the security processing
+ In case of inline processed packets, ``RTE_SECURITY_DYNFIELD_NAME`` field
+ would be used by the driver to relay information on the security processing
associated with the packet. In ingress, the driver would set this in Rx
path while in egress, ``rte_security_set_pkt_metadata()`` would perform a
similar operation. The application is expected not to modify the field
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
index b80ec7bff2..4e2a0e3afe 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
@@ -455,6 +455,9 @@ otx2_crypto_sec_session_create(void *device,
if (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL)
return -ENOTSUP;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
if (rte_mempool_get(mempool, (void **)&priv)) {
otx2_err("Could not allocate security session private data");
return -ENOMEM;
@@ -514,7 +517,7 @@ otx2_crypto_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (rte_security_dynfield_t)session;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c
index 48f5082d49..62f2a5f764 100644
--- a/drivers/net/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ixgbe/ixgbe_ipsec.c
@@ -484,7 +484,8 @@ ixgbe_crypto_update_mb(void *device __rte_unused,
get_sec_session_private_data(session);
if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) {
union ixgbe_crypto_tx_desc_md *mdata =
- (union ixgbe_crypto_tx_desc_md *)&m->udata64;
+ (union ixgbe_crypto_tx_desc_md *)
+ rte_security_dynfield(m);
mdata->enc = 1;
mdata->sa_idx = ic_session->sa_index;
mdata->pad_len = ixgbe_crypto_compute_pad_len(m);
@@ -751,5 +752,7 @@ ixgbe_ipsec_ctx_create(struct rte_eth_dev *dev)
return -ENOMEM;
}
}
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
return 0;
}
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 5f19972031..6cfbb582e2 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -34,6 +34,7 @@
#include <rte_mbuf.h>
#include <rte_ether.h>
#include <rte_ethdev_driver.h>
+#include <rte_security_driver.h>
#include <rte_prefetch.h>
#include <rte_udp.h>
#include <rte_tcp.h>
@@ -694,7 +695,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
if (use_ipsec) {
union ixgbe_crypto_tx_desc_md *ipsec_mdata =
(union ixgbe_crypto_tx_desc_md *)
- &tx_pkt->udata64;
+ rte_security_dynfield(tx_pkt);
tx_offload.sa_idx = ipsec_mdata->sa_idx;
tx_offload.sec_pad_len = ipsec_mdata->pad_len;
}
@@ -859,7 +860,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
- tx_offload, &tx_pkt->udata64);
+ tx_offload,
+ rte_security_dynfield(tx_pkt));
txe->last_id = tx_last;
tx_id = txe->next_id;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index b20f399a15..3b9871f4dc 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -13,6 +13,7 @@
#include <rte_kvargs.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
+#include <rte_security_driver.h>
#include <rte_string_fns.h>
#include <rte_time.h>
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec.c b/drivers/net/octeontx2/otx2_ethdev_sec.c
index 4e0dd4e49e..1ee597ff6e 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec.c
+++ b/drivers/net/octeontx2/otx2_ethdev_sec.c
@@ -684,7 +684,7 @@ otx2_eth_sec_set_pkt_mdata(void *device __rte_unused,
struct rte_mbuf *m, void *params __rte_unused)
{
/* Set security session as the pkt metadata */
- m->udata64 = (uint64_t)session;
+ *rte_security_dynfield(m) = (rte_security_dynfield_t)session;
return 0;
}
@@ -831,6 +831,9 @@ otx2_eth_sec_init(struct rte_eth_dev *eth_dev)
!(dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY))
return 0;
+ if (rte_security_dynfield_register() < 0)
+ return -rte_errno;
+
nb_sa = dev->ipsec_in_max_spi;
mz_sz = nb_sa * sa_width;
in_sa_mz_name_get(name, RTE_MEMZONE_NAMESIZE, port);
diff --git a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
index 5bf8c19995..284bcd5367 100644
--- a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
+++ b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h
@@ -55,7 +55,7 @@ otx2_sec_event_tx(struct otx2_ssogws *ws, struct rte_event *ev,
struct nix_iova_s nix_iova;
} *sd;
- priv = get_sec_session_private_data((void *)(m->udata64));
+ priv = get_sec_session_private_data((void *)(*rte_security_dynfield(m)));
sess = &priv->ipsec.ip;
sa = &sess->out_sa;
diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h
index f29a0542f9..61a5c436dd 100644
--- a/drivers/net/octeontx2/otx2_rx.h
+++ b/drivers/net/octeontx2/otx2_rx.h
@@ -241,7 +241,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
spi = cq->tag & 0xFFFFF;
sa = nix_rx_sec_sa_get(lookup_mem, spi, m->port);
- m->udata64 = (uint64_t)sa->userdata;
+ *rte_security_dynfield(m) = sa->udata64;
data = rte_pktmbuf_mtod(m, char *);
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 2219148285..bbe7ce48d9 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -426,7 +426,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
* with the security session.
*/
- if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD) {
+ if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD &&
+ rte_security_dynfield_is_registered()) {
struct ipsec_sa *sa;
struct ipsec_mbuf_metadata *priv;
struct rte_security_ctx *ctx = (struct rte_security_ctx *)
@@ -436,10 +437,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)
/* Retrieve the userdata registered. Here, the userdata
* registered is the SA pointer.
*/
-
- sa = (struct ipsec_sa *)
- rte_security_get_userdata(ctx, pkt->udata64);
-
+ sa = (struct ipsec_sa *)rte_security_get_userdata(ctx,
+ *rte_security_dynfield(pkt));
if (sa == NULL) {
/* userdata could not be retrieved */
return;
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index b6c851f257..647e22df59 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -208,7 +208,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -226,7 +226,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,
"Inbound security offload failed\n");
goto drop_pkt_and_exit;
}
- sa = pkt->userdata;
+ sa = *(struct ipsec_sa **)rte_security_dynfield(pkt);
}
/* Check if we have a match */
@@ -357,7 +357,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
}
if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
- pkt->userdata = sess->security.ses;
+ *(struct rte_security_session **)rte_security_dynfield(pkt) =
+ sess->security.ses;
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
@@ -465,7 +466,10 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
}
/* Save security session */
- pkt->userdata = sess_tbl[port_id];
+ if (rte_security_dynfield_is_registered())
+ *(struct rte_security_session **)
+ rte_security_dynfield(pkt) =
+ sess_tbl[port_id];
/* Mark the packet for Tx security offload */
pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
index ee4666026a..e8116d5447 100644
--- a/lib/librte_security/rte_security.c
+++ b/lib/librte_security/rte_security.c
@@ -23,6 +23,22 @@
RTE_PTR_OR_ERR_RET(p1->p2->p3, last_retval); \
} while (0)
+#define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata"
+int rte_security_dynfield_offset = -1;
+
+int
+rte_security_dynfield_register(void)
+{
+ static const struct rte_mbuf_dynfield dynfield_desc = {
+ .name = RTE_SECURITY_DYNFIELD_NAME,
+ .size = sizeof(rte_security_dynfield_t),
+ .align = __alignof__(rte_security_dynfield_t),
+ };
+ rte_security_dynfield_offset =
+ rte_mbuf_dynfield_register(&dynfield_desc);
+ return rte_security_dynfield_offset;
+}
+
struct rte_security_session *
rte_security_session_create(struct rte_security_ctx *instance,
struct rte_security_session_conf *conf,
diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index 271531af12..88d31de0a6 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -27,6 +27,7 @@ extern "C" {
#include <rte_common.h>
#include <rte_crypto.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
@@ -451,6 +452,47 @@ int
rte_security_session_destroy(struct rte_security_ctx *instance,
struct rte_security_session *sess);
+/** Device-specific metadata field type */
+typedef uint64_t rte_security_dynfield_t;
+/** Dynamic mbuf field for device-specific metadata */
+extern int rte_security_dynfield_offset;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Get pointer to mbuf field for device-specific metadata.
+ *
+ * For performance reason, no check is done,
+ * the dynamic field may not be registered.
+ * @see rte_security_dynfield_is_registered
+ *
+ * @param mbuf packet to access
+ * @return pointer to mbuf field
+ */
+__rte_experimental
+static inline rte_security_dynfield_t *
+rte_security_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ rte_security_dynfield_offset,
+ rte_security_dynfield_t *);
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Check whether the dynamic field is registered.
+ *
+ * @return true if rte_security_dynfield_register() has been called.
+ */
+__rte_experimental
+static inline bool rte_security_dynfield_is_registered(void)
+{
+ return rte_security_dynfield_offset >= 0;
+}
+
/**
* Updates the buffer with device-specific defined metadata
*
diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h
index 1b561f8528..c5abb07990 100644
--- a/lib/librte_security/rte_security_driver.h
+++ b/lib/librte_security/rte_security_driver.h
@@ -89,6 +89,9 @@ typedef int (*security_session_stats_get_t)(void *device,
struct rte_security_session *sess,
struct rte_security_stats *stats);
+__rte_experimental
+int rte_security_dynfield_register(void);
+
/**
* Update the mbuf with provided metadata.
*
diff --git a/lib/librte_security/version.map b/lib/librte_security/version.map
index d84eec0a88..22775558c8 100644
--- a/lib/librte_security/version.map
+++ b/lib/librte_security/version.map
@@ -15,6 +15,8 @@ DPDK_21 {
EXPERIMENTAL {
global:
+ rte_security_dynfield_offset;
+ rte_security_dynfield_register;
rte_security_get_userdata;
rte_security_session_stats_get;
rte_security_session_update;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (4 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 05/15] security: switch " Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 18:53 ` Van Haaren, Harry
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 07/15] net/ark: switch user data to dynamic mbuf fields Thomas Monjalon
` (9 subsequent siblings)
15 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Harry van Haaren
The test worker_loopback used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/event/sw/sw_evdev_selftest.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index 5c7e527917..0929fa68ef 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -40,6 +40,16 @@ struct test {
uint32_t service_id;
};
+typedef uint8_t counter_dynfield_t;
+static int counter_dynfield_offset = -1;
+
+static inline counter_dynfield_t *
+counter_field(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf, \
+ counter_dynfield_offset, counter_dynfield_t *);
+}
+
static struct rte_event release_ev;
static inline struct rte_mbuf *
@@ -2987,8 +2997,8 @@ worker_loopback_worker_fn(void *arg)
}
ev[i].queue_id = 0;
- ev[i].mbuf->udata64++;
- if (ev[i].mbuf->udata64 != 16) {
+ (*counter_field(ev[i].mbuf))++;
+ if (*counter_field(ev[i].mbuf) != 16) {
ev[i].op = RTE_EVENT_OP_FORWARD;
enqd = rte_event_enqueue_burst(evdev, port,
&ev[i], 1);
@@ -3028,7 +3038,7 @@ worker_loopback_producer_fn(void *arg)
m = rte_pktmbuf_alloc(t->mbuf_pool);
} while (m == NULL);
- m->udata64 = 0;
+ *counter_field(m) = 0;
struct rte_event ev = {
.op = RTE_EVENT_OP_NEW,
@@ -3061,6 +3071,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)
int err;
int w_lcore, p_lcore;
+ static const struct rte_mbuf_dynfield counter_dynfield_desc = {
+ .name = "rte_event_sw_dynfield_selftest_counter",
+ .size = sizeof(counter_dynfield_t),
+ .align = __alignof__(counter_dynfield_t),
+ };
+ counter_dynfield_offset =
+ rte_mbuf_dynfield_register(&counter_dynfield_desc);
+ if (counter_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return -rte_errno;
+ }
+
if (init(t, 8, 2) < 0 ||
create_atomic_qids(t, 8) < 0) {
printf("%d: Error initializing device\n", __LINE__);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 07/15] net/ark: switch user data to dynamic mbuf fields
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (5 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
` (8 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Ed Czeck, Shepard Siegel,
John Miller, Ray Kinsella, Neil Horman
From: Ed Czeck <ed.czeck@atomicrules.com>
The second field of metadata is reserved for user data
which was using a deprecated mbuf field.
It is moved to dynamic fields in order to allow removal of udata64.
The use of meta data must be enabled with a compile-time flag
RTE_PMD_ARK_{TX,RX}_USERDATA_ENABLE.
User data on Tx and Rx paths can be defined and used separately.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf.in | 1 +
drivers/net/ark/ark_ethdev.c | 39 ++++++++++
drivers/net/ark/ark_ethdev_rx.c | 3 +-
drivers/net/ark/ark_ethdev_tx.c | 3 +-
drivers/net/ark/meson.build | 2 +
drivers/net/ark/rte_pmd_ark.h | 125 ++++++++++++++++++++++++++++++++
drivers/net/ark/version.map | 7 ++
8 files changed, 179 insertions(+), 2 deletions(-)
create mode 100644 drivers/net/ark/rte_pmd_ark.h
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index a9c12d1a2f..b865a51e8c 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -41,6 +41,7 @@ The public API headers are grouped by topics:
[vhost] (@ref rte_vhost.h),
[vdpa] (@ref rte_vdpa.h),
[KNI] (@ref rte_kni.h),
+ [ark] (@ref rte_pmd_ark.h),
[ixgbe] (@ref rte_pmd_ixgbe.h),
[i40e] (@ref rte_pmd_i40e.h),
[ice] (@ref rte_pmd_ice.h),
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index e37f8c2e80..c5b01a1814 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -8,6 +8,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \
@TOPDIR@/drivers/bus/vdev \
@TOPDIR@/drivers/crypto/scheduler \
@TOPDIR@/drivers/mempool/dpaa2 \
+ @TOPDIR@/drivers/net/ark \
@TOPDIR@/drivers/net/bnxt \
@TOPDIR@/drivers/net/bonding \
@TOPDIR@/drivers/net/dpaa \
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 168b3659d6..fa343999a1 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -10,6 +10,7 @@
#include <rte_ethdev_pci.h>
#include <rte_kvargs.h>
+#include "rte_pmd_ark.h"
#include "ark_global.h"
#include "ark_logs.h"
#include "ark_ethdev_tx.h"
@@ -78,6 +79,9 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
#define ARK_TX_MAX_QUEUE (4096 * 4)
#define ARK_TX_MIN_QUEUE (256)
+int rte_pmd_ark_rx_userdata_dynfield_offset = -1;
+int rte_pmd_ark_tx_userdata_dynfield_offset = -1;
+
static const char * const valid_arguments[] = {
ARK_PKTGEN_ARG,
ARK_PKTCHKR_ARG,
@@ -245,6 +249,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
int ret;
int port_count = 1;
int p;
+ static const struct rte_mbuf_dynfield ark_tx_userdata_dynfield_desc = {
+ .name = RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME,
+ .size = sizeof(rte_pmd_ark_tx_userdata_t),
+ .align = __alignof__(rte_pmd_ark_tx_userdata_t),
+ };
+ static const struct rte_mbuf_dynfield ark_rx_userdata_dynfield_desc = {
+ .name = RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME,
+ .size = sizeof(rte_pmd_ark_rx_userdata_t),
+ .align = __alignof__(rte_pmd_ark_rx_userdata_t),
+ };
ark->eth_dev = dev;
@@ -254,6 +268,31 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
ret = check_for_ext(ark);
if (ret)
return ret;
+
+ /* Extra mbuf fields for user data */
+ if (RTE_PMD_ARK_TX_USERDATA_ENABLE) {
+ rte_pmd_ark_tx_userdata_dynfield_offset =
+ rte_mbuf_dynfield_register(&ark_tx_userdata_dynfield_desc);
+ if (rte_pmd_ark_tx_userdata_dynfield_offset < 0) {
+ ARK_PMD_LOG(ERR,
+ "Failed to register mbuf field for tx userdata\n");
+ return -rte_errno;
+ }
+ ARK_PMD_LOG(INFO, "Registered TX-meta dynamic field at %d\n",
+ rte_pmd_ark_tx_userdata_dynfield_offset);
+ }
+ if (RTE_PMD_ARK_RX_USERDATA_ENABLE) {
+ rte_pmd_ark_rx_userdata_dynfield_offset =
+ rte_mbuf_dynfield_register(&ark_rx_userdata_dynfield_desc);
+ if (rte_pmd_ark_rx_userdata_dynfield_offset < 0) {
+ ARK_PMD_LOG(ERR,
+ "Failed to register mbuf field for rx userdata\n");
+ return -rte_errno;
+ }
+ ARK_PMD_LOG(INFO, "Registered RX-meta dynamic field at %d\n",
+ rte_pmd_ark_rx_userdata_dynfield_offset);
+ }
+
pci_dev = RTE_ETH_DEV_TO_PCI(dev);
rte_eth_copy_pci_info(dev, pci_dev);
dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 2f8d05099c..825b4791be 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -4,6 +4,7 @@
#include <unistd.h>
+#include "rte_pmd_ark.h"
#include "ark_ethdev_rx.h"
#include "ark_global.h"
#include "ark_logs.h"
@@ -272,7 +273,7 @@ eth_ark_recv_pkts(void *rx_queue,
mbuf->pkt_len = meta->pkt_len;
mbuf->data_len = meta->pkt_len;
mbuf->timestamp = meta->timestamp;
- mbuf->udata64 = meta->user_data;
+ rte_pmd_ark_mbuf_rx_userdata_set(mbuf, meta->user_data);
if (ARK_DEBUG_CORE) { /* debug sanity checks */
if ((meta->pkt_len > (1024 * 16)) ||
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index a0e35af880..612d918e33 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -4,6 +4,7 @@
#include <unistd.h>
+#include "rte_pmd_ark.h"
#include "ark_ethdev_tx.h"
#include "ark_global.h"
#include "ark_mpu.h"
@@ -70,7 +71,7 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,
uint8_t flags)
{
meta->physaddr = rte_mbuf_data_iova(mbuf);
- meta->user1 = (uint32_t)mbuf->udata64;
+ meta->user1 = rte_pmd_ark_mbuf_tx_userdata_get(mbuf);
meta->data_len = rte_pktmbuf_data_len(mbuf);
meta->flags = flags;
}
diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
index 99151bba1d..80bce94e1a 100644
--- a/drivers/net/ark/meson.build
+++ b/drivers/net/ark/meson.build
@@ -1,6 +1,8 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
+headers = files('rte_pmd_ark.h')
+
sources = files('ark_ddm.c',
'ark_ethdev.c',
'ark_ethdev_rx.c',
diff --git a/drivers/net/ark/rte_pmd_ark.h b/drivers/net/ark/rte_pmd_ark.h
new file mode 100644
index 0000000000..6f26d66b12
--- /dev/null
+++ b/drivers/net/ark/rte_pmd_ark.h
@@ -0,0 +1,125 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2020 Atomic Rules LLC
+ */
+
+#ifndef RTE_PMD_ARK_H
+#define RTE_PMD_ARK_H
+
+/**
+ * @file
+ * ARK driver-specific API
+ */
+
+#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
+
+#ifndef RTE_PMD_ARK_TX_USERDATA_ENABLE
+#define RTE_PMD_ARK_TX_USERDATA_ENABLE 0
+#endif
+
+#ifndef RTE_PMD_ARK_RX_USERDATA_ENABLE
+#define RTE_PMD_ARK_RX_USERDATA_ENABLE 0
+#endif
+
+typedef uint32_t rte_pmd_ark_tx_userdata_t;
+typedef uint64_t rte_pmd_ark_rx_userdata_t;
+
+extern int rte_pmd_ark_tx_userdata_dynfield_offset;
+extern int rte_pmd_ark_rx_userdata_dynfield_offset;
+
+/** mbuf dynamic field for custom Tx ARK data */
+#define RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_tx_userdata"
+/** mbuf dynamic field for custom Rx ARK data */
+#define RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_rx_userdata"
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Read Tx user data from mbuf.
+ *
+ * @param mbuf Structure to read from.
+ * @return user data
+ */
+__rte_experimental
+static inline rte_pmd_ark_tx_userdata_t
+rte_pmd_ark_mbuf_tx_userdata_get(const struct rte_mbuf *mbuf)
+{
+#if RTE_PMD_ARK_TX_USERDATA_ENABLE
+ return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset,
+ rte_pmd_ark_tx_userdata_t *);
+#else
+ RTE_SET_USED(mbuf);
+ return 0;
+#endif
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Write Tx user data to mbuf.
+ *
+ * @param mbuf Structure to write into.
+ * @param data User data.
+ */
+__rte_experimental
+static inline void
+rte_pmd_ark_mbuf_tx_userdata_set(struct rte_mbuf *mbuf,
+ rte_pmd_ark_tx_userdata_t data)
+{
+#if RTE_PMD_ARK_TX_USERDATA_ENABLE
+ *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset,
+ rte_pmd_ark_tx_userdata_t *) = data;
+#else
+ RTE_SET_USED(mbuf);
+ RTE_SET_USED(data);
+#endif
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Read Rx user data from mbuf.
+ *
+ * @param mbuf Structure to read from.
+ * @return user data
+ */
+__rte_experimental
+static inline rte_pmd_ark_rx_userdata_t
+rte_pmd_ark_mbuf_rx_userdata_get(const struct rte_mbuf *mbuf)
+{
+#if RTE_PMD_ARK_RX_USERDATA_ENABLE
+ return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset,
+ rte_pmd_ark_rx_userdata_t *);
+#else
+ RTE_SET_USED(mbuf);
+ return 0;
+#endif
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Write Rx user data to mbuf.
+ *
+ * @param mbuf Structure to write into.
+ * @param data User data.
+ */
+__rte_experimental
+static inline void
+rte_pmd_ark_mbuf_rx_userdata_set(struct rte_mbuf *mbuf,
+ rte_pmd_ark_rx_userdata_t data)
+{
+#if RTE_PMD_ARK_RX_USERDATA_ENABLE
+ *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset,
+ rte_pmd_ark_rx_userdata_t *) = data;
+#else
+ RTE_SET_USED(mbuf);
+ RTE_SET_USED(data);
+#endif
+}
+
+#endif /* RTE_PMD_ARK_H */
diff --git a/drivers/net/ark/version.map b/drivers/net/ark/version.map
index 4a76d1d52d..954bea6796 100644
--- a/drivers/net/ark/version.map
+++ b/drivers/net/ark/version.map
@@ -1,3 +1,10 @@
DPDK_21 {
local: *;
};
+
+EXPERIMENTAL {
+ global:
+
+ rte_pmd_ark_tx_userdata_dynfield_offset;
+ rte_pmd_ark_rx_userdata_dynfield_offset;
+};
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 08/15] net/bnxt: switch CFA code to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (6 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 07/15] net/ark: switch user data to dynamic mbuf fields Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
` (7 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Ajit Khaparde,
Somnath Kotur
The CFA code from mark was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Note: the new field has 32 bits, smaller than udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++
drivers/net/bnxt/bnxt_rxr.c | 2 +-
drivers/net/bnxt/bnxt_rxr.h | 10 ++++++++++
drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++
4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1c7d1b758d..f1350d39da 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -31,6 +31,7 @@
#include "bnxt_nvm_defs.h"
#include "bnxt_tf_common.h"
#include "ulp_flow_db.h"
+#include "rte_pmd_bnxt.h"
#define DRV_MODULE_NAME "bnxt"
static const char bnxt_version[] =
@@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = {
*/
#define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
+int bnxt_cfa_code_dynfield_offset = -1;
+
/*
* max_num_kflows must be >= 32
* and must be a power-of-2 supported value
@@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF)
bp->flags |= BNXT_FLAG_STINGRAY;
+ if (BNXT_TRUFLOW_EN(bp)) {
+ /* extra mbuf field is required to store CFA code from mark */
+ static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = {
+ .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME,
+ .size = sizeof(bnxt_cfa_code_dynfield_t),
+ .align = __alignof__(bnxt_cfa_code_dynfield_t),
+ };
+ bnxt_cfa_code_dynfield_offset =
+ rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc);
+ if (bnxt_cfa_code_dynfield_offset < 0) {
+ PMD_DRV_LOG(ERR,
+ "Failed to register mbuf field for TruFlow mark\n");
+ return -rte_errno;
+ }
+ }
+
rc = bnxt_init_board(eth_dev);
if (rc) {
PMD_DRV_LOG(ERR,
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 039217fa60..2645ed61f4 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -606,7 +606,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
return mark_id;
/* Got the mark, write it to the mbuf and return */
mbuf->hash.fdir.hi = mark_id;
- mbuf->udata64 = (cfa_code & 0xffffffffull) << 32;
+ *bnxt_cfa_code_dynfield(mbuf) = cfa_code & 0xffffffffull;
mbuf->hash.fdir.id = rxcmp1->cfa_code;
mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
return mark_id;
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index b874e54a8c..f9e60d01c2 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -95,6 +95,16 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
struct rx_pkt_cmpl_hi *rxcmp1,
struct rte_mbuf *mbuf);
+typedef uint32_t bnxt_cfa_code_dynfield_t;
+extern int bnxt_cfa_code_dynfield_offset;
+
+static inline bnxt_cfa_code_dynfield_t *
+bnxt_cfa_code_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ bnxt_cfa_code_dynfield_offset, bnxt_cfa_code_dynfield_t *);
+}
+
#define BNXT_RX_META_CFA_CODE_SHIFT 19
#define BNXT_CFA_CODE_META_SHIFT 16
#define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h
index 81d0d0e032..f538b6550e 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.h
+++ b/drivers/net/bnxt/rte_pmd_bnxt.h
@@ -9,6 +9,9 @@
#include <rte_ethdev.h>
#include <rte_ether.h>
+/** mbuf dynamic field where CFA code is stored */
+#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code"
+
/*
* Response sent back to the caller after callback
*/
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (7 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 10/15] test/distributor: switch sequence " Thomas Monjalon
` (6 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Yong Wang
The segment count, used for MSS guess,
was stored in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++
drivers/net/vmxnet3/vmxnet3_ethdev.h | 11 +++++++++++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++----
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 6920ab568c..23a2ebbefa 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -59,6 +59,8 @@
DEV_RX_OFFLOAD_JUMBO_FRAME | \
DEV_RX_OFFLOAD_RSS_HASH)
+int vmxnet3_segs_dynfield_offset = -1;
+
static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
@@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
struct vmxnet3_hw *hw = eth_dev->data->dev_private;
uint32_t mac_hi, mac_lo, ver;
struct rte_eth_link link;
+ static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
+ .name = VMXNET3_SEGS_DYNFIELD_NAME,
+ .size = sizeof(vmxnet3_segs_dynfield_t),
+ .align = __alignof__(vmxnet3_segs_dynfield_t),
+ };
PMD_INIT_FUNC_TRACE();
@@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ /* extra mbuf field is required to guess MSS */
+ vmxnet3_segs_dynfield_offset =
+ rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
+ if (vmxnet3_segs_dynfield_offset < 0) {
+ PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
+ return -rte_errno;
+ }
+
/*
* for secondary processes, we don't initialize any further as primary
* has already done this work.
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
index dd685b02b7..9d00f5d127 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
@@ -193,4 +193,15 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
+#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs"
+typedef uint8_t vmxnet3_segs_dynfield_t;
+extern int vmxnet3_segs_dynfield_offset;
+
+static inline vmxnet3_segs_dynfield_t *
+vmxnet3_segs_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf, \
+ vmxnet3_segs_dynfield_offset, vmxnet3_segs_dynfield_t *);
+}
+
#endif /* _VMXNET3_ETHDEV_H_ */
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index e10f9ee870..95c697f8e3 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
struct rte_ipv6_hdr *ipv6_hdr;
struct rte_tcp_hdr *tcp_hdr;
char *ptr;
+ uint8_t segs;
RTE_ASSERT(rcd->tcp);
@@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
hlen += (tcp_hdr->data_off & 0xf0) >> 2;
- if (rxm->udata64 > 1)
- return (rte_pktmbuf_pkt_len(rxm) - hlen +
- rxm->udata64 - 1) / rxm->udata64;
+ segs = *vmxnet3_segs_dynfield(rxm);
+ if (segs > 1)
+ return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
else
return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
}
@@ -737,7 +738,7 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
(const Vmxnet3_RxCompDescExt *)rcd;
rxm->tso_segsz = rcde->mss;
- rxm->udata64 = rcde->segCnt;
+ *vmxnet3_segs_dynfield(rxm) = rcde->segCnt;
ol_flags |= PKT_RX_LRO;
}
} else { /* Offloads set in eop */
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 10/15] test/distributor: switch sequence to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (8 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 11/15] test/graph: switch user data " Thomas Monjalon
` (5 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Lukasz Wojciechowski,
David Hunt
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
---
app/test/test_distributor.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index eb889b91d1..f4c6229f16 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -10,6 +10,7 @@
#include <rte_errno.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_distributor.h>
#include <rte_string_fns.h>
@@ -17,6 +18,15 @@
#define BURST 32
#define BIG_BATCH 1024
+typedef uint32_t seq_dynfield_t;
+static int seq_dynfield_offset = -1;
+
+static inline seq_dynfield_t *
+seq_field(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf, seq_dynfield_offset, seq_dynfield_t *);
+}
+
struct worker_params {
char name[64];
struct rte_distributor *dist;
@@ -578,7 +588,7 @@ handle_and_mark_work(void *arg)
__atomic_fetch_add(&worker_stats[id].handled_packets, num,
__ATOMIC_RELAXED);
for (i = 0; i < num; i++)
- buf[i]->udata64 += id + 1;
+ *seq_field(buf[i]) += id + 1;
num = rte_distributor_get_pkt(db, id,
buf, buf, num);
}
@@ -631,10 +641,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
<< shift;
}
/* Assign a sequence number to each packet. The sequence is shifted,
- * so that lower bits of the udate64 will hold mark from worker.
+ * so that lower bits will hold mark from worker.
*/
for (i = 0; i < buf_count; i++)
- bufs[i]->udata64 = i << seq_shift;
+ *seq_field(bufs[i]) = i << seq_shift;
count = 0;
for (i = 0; i < buf_count/burst; i++) {
@@ -660,8 +670,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p)
/* Sort returned packets by sent order (sequence numbers). */
for (i = 0; i < buf_count; i++) {
- seq = returns[i]->udata64 >> seq_shift;
- id = returns[i]->udata64 - (seq << seq_shift);
+ seq = *seq_field(returns[i]) >> seq_shift;
+ id = *seq_field(returns[i]) - (seq << seq_shift);
sorted[seq] = id;
}
@@ -805,6 +815,18 @@ test_distributor(void)
static struct rte_mempool *p;
int i;
+ static const struct rte_mbuf_dynfield seq_dynfield_desc = {
+ .name = "test_distributor_dynfield_seq",
+ .size = sizeof(seq_dynfield_t),
+ .align = __alignof__(seq_dynfield_t),
+ };
+ seq_dynfield_offset =
+ rte_mbuf_dynfield_register(&seq_dynfield_desc);
+ if (seq_dynfield_offset < 0) {
+ printf("Error registering mbuf field\n");
+ return TEST_FAILED;
+ }
+
if (rte_lcore_count() < 2) {
printf("Not enough cores for distributor_autotest, expecting at least 2\n");
return TEST_SKIPPED;
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 11/15] test/graph: switch user data to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (9 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 10/15] test/distributor: switch sequence " Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 12/15] app/eventdev: switch flow ID " Thomas Monjalon
` (4 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Kiran Kumar K,
Nithin Dabilpuram
The test used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test/test_graph.c | 99 ++++++++++++++++++++++++++-----------------
1 file changed, 61 insertions(+), 38 deletions(-)
diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index ed69eda997..81bdcb9bea 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
#include <rte_graph.h>
#include <rte_graph_worker.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_random.h>
#include "test.h"
@@ -39,6 +40,16 @@ static uint16_t test_node3_worker(struct rte_graph *graph,
#define MBUFF_SIZE 512
#define MAX_NODES 4
+typedef uint64_t graph_dynfield_t;
+static int graph_dynfield_offset = -1;
+
+static inline graph_dynfield_t *
+graph_field(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf, \
+ graph_dynfield_offset, graph_dynfield_t *);
+}
+
static struct rte_mbuf mbuf[MAX_NODES + 1][MBUFF_SIZE];
static void *mbuf_p[MAX_NODES + 1][MBUFF_SIZE];
static rte_graph_t graph_id;
@@ -162,9 +173,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node0);
for (i = 0; i < obj_node0; i++) {
data = &mbuf[0][i];
- data->udata64 = ((uint64_t)tm->test_node[0].idx << 32) | i;
+ *graph_field(data) = ((uint64_t)tm->test_node[0].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ *graph_field(data) |= (1 << 16);
next_stream[i] = &mbuf[0][i];
}
rte_node_next_stream_put(graph, node, next, obj_node0);
@@ -175,9 +186,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
next_stream = rte_node_next_stream_get(graph, node, next, obj_node1);
for (i = 0; i < obj_node1; i++) {
data = &mbuf[0][obj_node0 + i];
- data->udata64 = ((uint64_t)tm->test_node[1].idx << 32) | i;
+ *graph_field(data) = ((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ *graph_field(data) |= (1 << 16);
next_stream[i] = &mbuf[0][obj_node0 + i];
}
@@ -205,23 +216,23 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[0].idx) {
+ if ((*graph_field(data) >> 32) != tm->test_node[0].idx) {
printf("Data idx miss match at node 0, expected"
" = %u got = %u\n",
tm->test_node[0].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(*graph_field(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((*graph_field(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at "
"node 0\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (*graph_field(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (*graph_field(data) & (0x1 << 17))
second_pass = 1;
}
@@ -233,12 +244,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * obj_node0 * 0.01;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[1][i];
- data->udata64 =
+ *graph_field(data) =
((uint64_t)tm->test_node[1].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ *graph_field(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ *graph_field(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[1][0],
obj_node0);
@@ -246,12 +257,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node1 = nb_objs - obj_node0;
for (i = 0; i < obj_node1; i++) {
data = &mbuf[1][obj_node0 + i];
- data->udata64 =
+ *graph_field(data) =
((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node1)
- data->udata64 |= (1 << 16);
+ *graph_field(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ *graph_field(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 1, (void **)&mbuf_p[1][obj_node0],
obj_node1);
@@ -285,22 +296,22 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[2] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[1].idx) {
+ if ((*graph_field(data) >> 32) != tm->test_node[1].idx) {
printf("Data idx miss match at node 1, expected = %u"
" got = %u\n",
tm->test_node[1].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(*graph_field(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((*graph_field(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 1\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (*graph_field(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (*graph_field(data) & (0x1 << 17))
second_pass = 1;
}
@@ -312,11 +323,11 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[2][i];
- data->udata64 = ((uint64_t)tm->test_node[2].idx << 32) | i;
+ *graph_field(data) = ((uint64_t)tm->test_node[2].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ *graph_field(data) |= (1 << 16);
if (second_pass)
- data->udata64 |= (1 << 17);
+ *graph_field(data) |= (1 << 17);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[2][0], obj_node0);
@@ -339,22 +350,22 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[3] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[2].idx) {
+ if ((*graph_field(data) >> 32) != tm->test_node[2].idx) {
printf("Data idx miss match at node 2, expected = %u"
" got = %u\n",
tm->test_node[2].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(*graph_field(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((*graph_field(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 2\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (*graph_field(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (*graph_field(data) & (0x1 << 17))
second_pass = 1;
}
@@ -367,10 +378,10 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[3][i];
- data->udata64 =
+ *graph_field(data) =
((uint64_t)tm->test_node[3].idx << 32) | i;
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ *graph_field(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[3][0],
obj_node0);
@@ -395,22 +406,22 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
fn_calls[4] += 1;
for (i = 0; i < nb_objs; i++) {
data = (struct rte_mbuf *)objs[i];
- if ((data->udata64 >> 32) != tm->test_node[3].idx) {
+ if ((*graph_field(data) >> 32) != tm->test_node[3].idx) {
printf("Data idx miss match at node 3, expected = %u"
" got = %u\n",
tm->test_node[3].idx,
- (uint32_t)(data->udata64 >> 32));
+ (uint32_t)(*graph_field(data) >> 32));
goto end;
}
- if ((data->udata64 & 0xffff) != (i - count)) {
+ if ((*graph_field(data) & 0xffff) != (i - count)) {
printf("Expected buff count miss match at node 3\n");
goto end;
}
- if (data->udata64 & (0x1 << 16))
+ if (*graph_field(data) & (0x1 << 16))
count = i + 1;
- if (data->udata64 & (0x1 << 17))
+ if (*graph_field(data) & (0x1 << 17))
second_pass = 1;
}
@@ -426,11 +437,11 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
obj_node0 = nb_objs * 2;
for (i = 0; i < obj_node0; i++) {
data = &mbuf[4][i];
- data->udata64 =
+ *graph_field(data) =
((uint64_t)tm->test_node[0].idx << 32) | i;
- data->udata64 |= (1 << 17);
+ *graph_field(data) |= (1 << 17);
if ((i + 1) == obj_node0)
- data->udata64 |= (1 << 16);
+ *graph_field(data) |= (1 << 16);
}
rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[4][0],
obj_node0);
@@ -765,6 +776,18 @@ graph_setup(void)
{
int i, j;
+ static const struct rte_mbuf_dynfield graph_dynfield_desc = {
+ .name = "test_graph_dynfield",
+ .size = sizeof(graph_dynfield_t),
+ .align = __alignof__(graph_dynfield_t),
+ };
+ graph_dynfield_offset =
+ rte_mbuf_dynfield_register(&graph_dynfield_desc);
+ if (graph_dynfield_offset < 0) {
+ printf("Cannot register mbuf field\n");
+ return TEST_FAILED;
+ }
+
for (i = 0; i <= MAX_NODES; i++) {
for (j = 0; j < MBUFF_SIZE; j++)
mbuf_p[i][j] = &mbuf[i][j];
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 12/15] app/eventdev: switch flow ID to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (10 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 11/15] test/graph: switch user data " Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 13/15] examples/bbdev: switch " Thomas Monjalon
` (3 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
The order test stored the flow ID in the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-eventdev/test_order_atq.c | 4 ++--
app/test-eventdev/test_order_common.c | 21 +++++++++++++++------
app/test-eventdev/test_order_common.h | 21 +++++++++++++++++++++
app/test-eventdev/test_order_queue.c | 4 ++--
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c
index cfcb1dc4e9..71215a07b6 100644
--- a/app/test-eventdev/test_order_atq.c
+++ b/app/test-eventdev/test_order_atq.c
@@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev);
if (ev.sub_event_type == 0) { /* stage 0 from producer */
order_atq_process_stage_0(&ev);
@@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev[i]);
if (ev[i].sub_event_type == 0) { /*stage 0 */
order_atq_process_stage_0(&ev[i]);
diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
index dc55d93921..01a44bcd75 100644
--- a/app/test-eventdev/test_order_common.c
+++ b/app/test-eventdev/test_order_common.c
@@ -46,13 +46,10 @@ order_producer(void *arg)
if (m == NULL)
continue;
- const uint32_t flow = (uintptr_t)m % nb_flows;
+ const flow_id_t flow = (uintptr_t)m % nb_flows;
/* Maintain seq number per flow */
m->seqn = producer_flow_seq[flow]++;
- m->udata64 = flow;
-
- ev.flow_id = flow;
- ev.mbuf = m;
+ order_flow_id_save(t, flow, m, &ev);
while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) {
if (t->err)
@@ -138,6 +135,12 @@ int
order_test_setup(struct evt_test *test, struct evt_options *opt)
{
void *test_order;
+ struct test_order *t;
+ static const struct rte_mbuf_dynfield flow_id_dynfield_desc = {
+ .name = "test_event_dynfield_flow_id",
+ .size = sizeof(flow_id_t),
+ .align = __alignof__(flow_id_t),
+ };
test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
RTE_CACHE_LINE_SIZE, opt->socket_id);
@@ -146,8 +149,14 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
goto nomem;
}
test->test_priv = test_order;
+ t = evt_test_priv(test);
- struct test_order *t = evt_test_priv(test);
+ t->flow_id_dynfield_offset =
+ rte_mbuf_dynfield_register(&flow_id_dynfield_desc);
+ if (t->flow_id_dynfield_offset < 0) {
+ evt_err("failed to register mbuf field");
+ return -rte_errno;
+ }
t->producer_flow_seq = rte_zmalloc_socket("test_producer_flow_seq",
sizeof(*t->producer_flow_seq) * opt->nb_flows,
diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index e0fe9c968a..90eac96fc8 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -13,6 +13,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include "evt_common.h"
#include "evt_options.h"
@@ -20,6 +21,8 @@
#define BURST_SIZE 16
+typedef uint32_t flow_id_t;
+
struct test_order;
struct worker_data {
@@ -49,6 +52,7 @@ struct test_order {
uint32_t nb_flows;
uint64_t nb_pkts;
struct rte_mempool *pool;
+ int flow_id_dynfield_offset;
struct prod_data prod;
struct worker_data worker[EVT_MAX_PORTS];
uint32_t *producer_flow_seq;
@@ -56,6 +60,23 @@ struct test_order {
struct evt_options *opt;
} __rte_cache_aligned;
+static inline void
+order_flow_id_copy_from_mbuf(struct test_order *t, struct rte_event *event)
+{
+ event->flow_id = *RTE_MBUF_DYNFIELD(event->mbuf,
+ t->flow_id_dynfield_offset, flow_id_t *);
+}
+
+static inline void
+order_flow_id_save(struct test_order *t, flow_id_t flow_id,
+ struct rte_mbuf *mbuf, struct rte_event *event)
+{
+ *RTE_MBUF_DYNFIELD(mbuf,
+ t->flow_id_dynfield_offset, flow_id_t *) = flow_id;
+ event->flow_id = flow_id;
+ event->mbuf = mbuf;
+}
+
static inline int
order_nb_event_ports(struct evt_options *opt)
{
diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c
index 1511c0092d..621367805a 100644
--- a/app/test-eventdev/test_order_queue.c
+++ b/app/test-eventdev/test_order_queue.c
@@ -35,7 +35,7 @@ order_queue_worker(void *arg, const bool flow_id_cap)
}
if (!flow_id_cap)
- ev.flow_id = ev.mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev);
if (ev.queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev);
@@ -73,7 +73,7 @@ order_queue_worker_burst(void *arg, const bool flow_id_cap)
for (i = 0; i < nb_rx; i++) {
if (!flow_id_cap)
- ev[i].flow_id = ev[i].mbuf->udata64;
+ order_flow_id_copy_from_mbuf(t, &ev[i]);
if (ev[i].queue_id == 0) { /* from ordered queue */
order_queue_process_stage_0(&ev[i]);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 13/15] examples/bbdev: switch to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (11 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 12/15] app/eventdev: switch flow ID " Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 14/15] examples/rxtx_callbacks: switch TSC to dynamic field Thomas Monjalon
` (2 subsequent siblings)
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Nicolas Chautru
The example used the deprecated mbuf field udata64 as input mbuf pointer.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
examples/bbdev_app/main.c | 42 +++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index e512c807cd..2e170caf84 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -28,6 +28,7 @@
#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_log.h>
@@ -59,6 +60,15 @@
} \
} while (0)
+static int input_dynfield_offset = -1;
+
+static inline struct rte_mbuf **
+mbuf_input(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf,
+ input_dynfield_offset, struct rte_mbuf **);
+}
+
static const struct rte_eth_conf port_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_NONE,
@@ -294,11 +304,11 @@ pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
}
static inline void
-pktmbuf_userdata_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
+pktmbuf_input_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free)
{
unsigned int i;
for (i = 0; i < nb_to_free; ++i) {
- struct rte_mbuf *rx_pkt = mbufs[i]->userdata;
+ struct rte_mbuf *rx_pkt = *mbuf_input(mbufs[i]);
rte_pktmbuf_free(rx_pkt);
rte_pktmbuf_free(mbufs[i]);
}
@@ -429,7 +439,7 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts)
uint16_t i;
for (i = 0; i < num_pkts; ++i) {
struct rte_mbuf *out = mbufs[i];
- struct rte_mbuf *in = out->userdata;
+ struct rte_mbuf *in = *mbuf_input(out);
if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *,
sizeof(struct rte_ether_hdr)),
@@ -731,7 +741,7 @@ run_encoding(struct lcore_conf *lcore_conf)
rte_pktmbuf_data_len(rx_pkts_burst[i]) -
sizeof(struct rte_ether_hdr);
/* save input mbuf pointer for later comparison */
- enc_out_pkts[i]->userdata = rx_pkts_burst[i];
+ *mbuf_input(enc_out_pkts[i]) = rx_pkts_burst[i];
/* copy ethernet header */
rte_pktmbuf_reset(enc_out_pkts[i]);
@@ -775,7 +785,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_enc_ops(bbdev_id, enc_queue_id,
bbdev_ops_burst, nb_rx);
if (unlikely(nb_enq < nb_rx)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_enq],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_enq],
nb_rx - nb_enq);
rte_bbdev_enc_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_rx - nb_enq);
@@ -805,7 +815,7 @@ run_encoding(struct lcore_conf *lcore_conf)
nb_sent = rte_ring_enqueue_burst(enc_to_dec_ring, (void **)enc_out_pkts,
nb_deq, NULL);
if (unlikely(nb_sent < nb_deq)) {
- pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_sent],
+ pktmbuf_input_free_bulk(&enc_out_pkts[nb_sent],
nb_deq - nb_sent);
lcore_stats->enc_to_dec_lost_packets += nb_deq - nb_sent;
}
@@ -842,7 +852,7 @@ run_decoding(struct lcore_conf *lcore_conf)
if (unlikely(rte_bbdev_dec_op_alloc_bulk(bbdev_op_pool, bbdev_ops_burst,
nb_recv) != 0)) {
- pktmbuf_userdata_free_bulk(recv_pkts_burst, nb_recv);
+ pktmbuf_input_free_bulk(recv_pkts_burst, nb_recv);
lcore_stats->rx_lost_packets += nb_recv;
return;
}
@@ -871,7 +881,7 @@ run_decoding(struct lcore_conf *lcore_conf)
nb_enq = rte_bbdev_enqueue_dec_ops(bbdev_id, bbdev_queue_id,
bbdev_ops_burst, nb_recv);
if (unlikely(nb_enq < nb_recv)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_enq],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_enq],
nb_recv - nb_enq);
rte_bbdev_dec_op_free_bulk(&bbdev_ops_burst[nb_enq],
nb_recv - nb_enq);
@@ -898,12 +908,12 @@ run_decoding(struct lcore_conf *lcore_conf)
/* Free the RX mbufs after verification */
for (i = 0; i < nb_deq; ++i)
- rte_pktmbuf_free(recv_pkts_burst[i]->userdata);
+ rte_pktmbuf_free(*mbuf_input(recv_pkts_burst[i]));
/* Transmit the packets */
nb_tx = rte_eth_tx_burst(port_id, tx_queue_id, recv_pkts_burst, nb_deq);
if (unlikely(nb_tx < nb_deq)) {
- pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_tx],
+ pktmbuf_input_free_bulk(&recv_pkts_burst[nb_tx],
nb_deq - nb_tx);
lcore_stats->tx_lost_packets += nb_deq - nb_tx;
}
@@ -1046,6 +1056,12 @@ main(int argc, char **argv)
bool stats_thread_started = false;
unsigned int main_lcore_id = rte_get_main_lcore();
+ static const struct rte_mbuf_dynfield input_dynfield_desc = {
+ .name = "example_bbdev_dynfield_input",
+ .size = sizeof(struct rte_mbuf *),
+ .align = __alignof__(struct rte_mbuf *),
+ };
+
rte_atomic16_init(&global_exit_flag);
sigret = signal(SIGTERM, signal_handler);
@@ -1115,6 +1131,12 @@ main(int argc, char **argv)
if (bbdev_mbuf_mempool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create ethdev mbuf mempool\n");
+ /* register mbuf field to store input pointer */
+ input_dynfield_offset =
+ rte_mbuf_dynfield_register(&input_dynfield_desc);
+ if (input_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize ports */
ret = initialize_ports(&app_params, ethdev_mbuf_mempool);
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 14/15] examples/rxtx_callbacks: switch TSC to dynamic field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (12 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 13/15] examples/bbdev: switch " Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 15/15] mbuf: remove userdata field Thomas Monjalon
2020-10-31 15:07 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, John McNamara
The example used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 ++--
examples/rxtx_callbacks/main.c | 24 +++++++++++++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 62d1f39d7e..344446290b 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -152,7 +152,7 @@ all packets received:
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ *tsc_field(pkts[i]) = now;
return nb_pkts;
}
@@ -179,7 +179,7 @@ packets prior to transmission:
unsigned i;
for (i = 0; i < nb_pkts; i++)
- cycles += now - pkts[i]->udata64;
+ cycles += now - *tsc_field(pkts[i]);
latency_numbers.total_cycles += cycles;
latency_numbers.total_pkts += nb_pkts;
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 6fe39546dd..1a8e7d47d9 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -10,6 +10,7 @@
#include <rte_cycles.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
#define RX_RING_SIZE 1024
#define TX_RING_SIZE 1024
@@ -18,6 +19,15 @@
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
+typedef uint64_t tsc_t;
+static int tsc_dynfield_offset = -1;
+
+static inline tsc_t *
+tsc_field(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf, tsc_dynfield_offset, tsc_t *);
+}
+
static const char usage[] =
"%s EAL_ARGS -- [-t]\n";
@@ -47,7 +57,7 @@ add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
- pkts[i]->udata64 = now;
+ *tsc_field(pkts[i]) = now;
return nb_pkts;
}
@@ -65,7 +75,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused,
rte_eth_read_clock(port, &ticks);
for (i = 0; i < nb_pkts; i++) {
- cycles += now - pkts[i]->udata64;
+ cycles += now - *tsc_field(pkts[i]);
if (hw_timestamping)
queue_ticks += ticks - pkts[i]->timestamp;
}
@@ -261,6 +271,11 @@ main(int argc, char *argv[])
};
int opt, option_index;
+ static const struct rte_mbuf_dynfield tsc_dynfield_desc = {
+ .name = "example_bbdev_dynfield_tsc",
+ .size = sizeof(tsc_t),
+ .align = __alignof__(tsc_t),
+ };
/* init EAL */
int ret = rte_eal_init(argc, argv);
@@ -292,6 +307,11 @@ main(int argc, char *argv[])
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
+ tsc_dynfield_offset =
+ rte_mbuf_dynfield_register(&tsc_dynfield_desc);
+ if (tsc_dynfield_offset < 0)
+ rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n");
+
/* initialize all ports */
RTE_ETH_FOREACH_DEV(portid)
if (port_init(portid, mbuf_pool) != 0)
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* [dpdk-dev] [PATCH v6 15/15] mbuf: remove userdata field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (13 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 14/15] examples/rxtx_callbacks: switch TSC to dynamic field Thomas Monjalon
@ 2020-10-30 17:44 ` Thomas Monjalon
2020-10-31 15:07 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
15 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-30 17:44 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj, Ray Kinsella, Neil Horman
As announced in the deprecation note, the field userdata / udata64
is removed to give more space to the dynamic fields.
This is how the mbuf layout looks like (pahole-style):
word type name byte size
0 void * buf_addr; /* 0 + 8 */
1 rte_iova_t buf_iova /* 8 + 8 */
/* --- RTE_MARKER64 rearm_data; */
2 uint16_t data_off; /* 16 + 2 */
uint16_t refcnt; /* 18 + 2 */
uint16_t nb_segs; /* 20 + 2 */
uint16_t port; /* 22 + 2 */
3 uint64_t ol_flags; /* 24 + 8 */
/* --- RTE_MARKER rx_descriptor_fields1; */
4 uint32_t union packet_type; /* 32 + 4 */
uint32_t pkt_len; /* 36 + 4 */
5 uint16_t data_len; /* 40 + 2 */
uint16_t vlan_tci; /* 42 + 2 */
5.5 uint64_t union hash; /* 44 + 8 */
6.5 uint16_t vlan_tci_outer; /* 52 + 2 */
uint16_t buf_len; /* 54 + 2 */
7 uint64_t timestamp; /* 56 + 8 */
/* --- RTE_MARKER cacheline1; */
8 struct rte_mempool * pool; /* 64 + 8 */
9 struct rte_mbuf * next; /* 72 + 8 */
10 uint64_t union tx_offload; /* 80 + 8 */
11 uint16_t priv_size; /* 88 + 2 */
uint16_t timesync; /* 90 + 2 */
uint32_t seqn; /* 92 + 4 */
12 struct rte_mbuf_ext_shared_info * shinfo; /* 96 + 8 */
13 uint64_t dynfield1[3]; /* 104 + 24 */
16 /* --- END 128 */
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
doc/guides/rel_notes/deprecation.rst | 1 -
doc/guides/rel_notes/release_20_11.rst | 3 +++
lib/librte_kni/rte_kni_common.h | 2 +-
lib/librte_mbuf/rte_mbuf_core.h | 8 +-------
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 2e082499b8..0f6f1df12a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -87,7 +87,6 @@ Deprecation Notices
The following static fields will be moved as dynamic:
- ``timestamp``
- - ``userdata`` / ``udata64``
- ``seqn``
As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged,
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index bae39b2dd0..70cefb6d07 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -442,6 +442,9 @@ API Changes
the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
The field ``refcnt`` is remaining from the old unions.
+* mbuf: Removed the unioned fields ``userdata`` and ``udata64``
+ from the structure ``rte_mbuf``. It is replaced with dynamic fields.
+
* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
replaced with a private enum in the PCI subsystem.
diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h
index 21b477f0aa..36d66e2ffa 100644
--- a/lib/librte_kni/rte_kni_common.h
+++ b/lib/librte_kni/rte_kni_common.h
@@ -86,7 +86,7 @@ struct rte_kni_mbuf {
uint16_t data_len; /**< Amount of data in segment buffer. */
/* fields on second cache line */
- char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)));
+ __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE)))
void *pool;
void *next; /**< Physical address of next mbuf in kernel. */
};
diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h
index 065d87d28a..a65eaaf692 100644
--- a/lib/librte_mbuf/rte_mbuf_core.h
+++ b/lib/librte_mbuf/rte_mbuf_core.h
@@ -599,12 +599,6 @@ struct rte_mbuf {
/* second cache line - fields only used in slow path or on TX */
RTE_MARKER cacheline1 __rte_cache_min_aligned;
- RTE_STD_C11
- union {
- void *userdata; /**< Can be used for external metadata */
- uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
- };
-
struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
struct rte_mbuf *next; /**< Next segment of scattered packet. */
@@ -662,7 +656,7 @@ struct rte_mbuf {
*/
struct rte_mbuf_ext_shared_info *shinfo;
- uint64_t dynfield1[2]; /**< Reserved for dynamic fields. */
+ uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */
} __rte_cache_aligned;
/**
--
2.28.0
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 06/15] event/sw: switch test counter to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 06/15] event/sw: switch test counter " Thomas Monjalon
@ 2020-10-30 18:53 ` Van Haaren, Harry
0 siblings, 0 replies; 178+ messages in thread
From: Van Haaren, Harry @ 2020-10-30 18:53 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: Yigit, Ferruh, david.marchand, Richardson, Bruce, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, October 30, 2020 5:45 PM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; david.marchand@redhat.com;
> Richardson, Bruce <bruce.richardson@intel.com>; olivier.matz@6wind.com;
> andrew.rybchenko@oktetlabs.ru; akhil.goyal@nxp.com; jerinj@marvell.com; Van
> Haaren, Harry <harry.van.haaren@intel.com>
> Subject: [PATCH v6 06/15] event/sw: switch test counter to dynamic mbuf field
>
> The test worker_loopback used the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Review fine, tests fine, thanks!
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/15] security: switch metadata to dynamic mbuf field
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 05/15] security: switch " Thomas Monjalon
@ 2020-10-31 8:56 ` David Marchand
2020-10-31 9:26 ` David Marchand
2020-10-31 14:38 ` Thomas Monjalon
0 siblings, 2 replies; 178+ messages in thread
From: David Marchand @ 2020-10-31 8:56 UTC (permalink / raw)
To: Thomas Monjalon, Olivier Matz
Cc: dev, Yigit, Ferruh, Bruce Richardson, Andrew Rybchenko,
Akhil Goyal, Jerin Jacob Kollanukkaran, Haiyue Wang,
Declan Doherty, Ankur Dwivedi, Anoob Joseph, Jeff Guo,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
On Fri, Oct 30, 2020 at 6:45 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> The device-specific metadata was stored in the deprecated field udata64.
> It is moved to a dynamic mbuf field in order to allow removal of udata64.
>
> The name rte_security_dynfield is not very descriptive
> but it should be replaced later by separate fields for each type of data
> that drivers pass to the upper layer.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>
We have a regression in the mbuf unit test when running with probed
ixgbe devices (UNH lab).
The problem is that the security dyn field is registered when probing
the ixgbe devices.
The unit test fails later while checking one of its own registered
dynfield offset.
I can reproduce the issue by stopping at this patch in the series and
adding the below diff.
The problem can be seen with the whole series applied, there is only a
difference in reported dynfield offsets.
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 80d1850da9..0e4f895187 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -33,6 +33,7 @@
#include <rte_ip.h>
#include <rte_tcp.h>
#include <rte_mbuf_dyn.h>
+#include <rte_security_driver.h>
#include "test.h"
@@ -2589,6 +2590,7 @@ test_mbuf_dyn(struct rte_mempool *pktmbuf_pool)
int ret;
printf("Test mbuf dynamic fields and flags\n");
+ rte_security_dynfield_register();
rte_mbuf_dyn_dump(stdout);
offset = rte_mbuf_dynfield_register(&dynfield);
Then:
# DPDK_TEST=mbuf_autotest ./build/app/test/dpdk-test
EAL: Detected 8 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: No available hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
APP: HPET is not enabled, using TSC as default timer
RTE>>mbuf_autotest
Test mbuf dynamic fields and flags
Reserved fields:
name=rte_security_dynfield_metadata offset=112 size=8 align=8 flags=0
Reserved flags:
Free space in mbuf (0 = occupied, value = free zone alignment):
0000: 00 00 00 00 00 00 00 00
0008: 00 00 00 00 00 00 00 00
0010: 00 00 00 00 00 00 00 00
0018: 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00
0028: 00 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00
0038: 00 00 00 00 00 00 00 00
0040: 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00
0050: 00 00 00 00 00 00 00 00
0058: 00 00 00 00 00 00 00 00
0060: 00 00 00 00 00 00 00 00
0068: 00 00 00 00 00 00 00 00
0070: 00 00 00 00 00 00 00 00
0078: 08 08 08 08 08 08 08 08
Free bit in mbuf->ol_flags (0 = occupied, 1 = free):
0000: 0 0 0 0 0 0 0 0
0008: 0 0 0 0 0 0 0 0
0010: 0 0 0 0 0 0 0 1
0018: 1 1 1 1 1 1 1 1
0020: 1 1 1 1 1 1 1 1
0028: 1 0 0 0 0 0 0 0
0030: 0 0 0 0 0 0 0 0
0038: 0 0 0 0 0 0 0 0
mbuf test FAILED (l.2615): <failed to register dynamic field 3,
offset=-1: No such file or directory>
mbuf dynflag test failed
Test Failed
A lazy fix is to simply ask for registering a field at offset
sizeof(dynfield) - 1 .. what do you think?
--
David Marchand
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/15] security: switch metadata to dynamic mbuf field
2020-10-31 8:56 ` David Marchand
@ 2020-10-31 9:26 ` David Marchand
2020-10-31 14:38 ` Thomas Monjalon
1 sibling, 0 replies; 178+ messages in thread
From: David Marchand @ 2020-10-31 9:26 UTC (permalink / raw)
To: Thomas Monjalon, Olivier Matz
Cc: dev, Yigit, Ferruh, Bruce Richardson, Andrew Rybchenko,
Akhil Goyal, Jerin Jacob Kollanukkaran, Haiyue Wang,
Declan Doherty, Ankur Dwivedi, Anoob Joseph, Jeff Guo,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
On Sat, Oct 31, 2020 at 9:56 AM David Marchand
<david.marchand@redhat.com> wrote:
> A lazy fix is to simply ask for registering a field at offset
> sizeof(dynfield) - 1 .. what do you think?
I meant sizeof(struct rte_mbuf) - 1.
--
David Marchand
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/15] security: switch metadata to dynamic mbuf field
2020-10-31 8:56 ` David Marchand
2020-10-31 9:26 ` David Marchand
@ 2020-10-31 14:38 ` Thomas Monjalon
1 sibling, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-31 14:38 UTC (permalink / raw)
To: Olivier Matz, David Marchand
Cc: dev, Yigit, Ferruh, Bruce Richardson, Andrew Rybchenko,
Akhil Goyal, Jerin Jacob Kollanukkaran, Haiyue Wang,
Declan Doherty, Ankur Dwivedi, Anoob Joseph, Jeff Guo,
Nithin Dabilpuram, Kiran Kumar K, Radu Nicolau, Ray Kinsella,
Neil Horman
31/10/2020 09:56, David Marchand:
> On Fri, Oct 30, 2020 at 6:45 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > The device-specific metadata was stored in the deprecated field udata64.
> > It is moved to a dynamic mbuf field in order to allow removal of udata64.
> >
> > The name rte_security_dynfield is not very descriptive
> > but it should be replaced later by separate fields for each type of data
> > that drivers pass to the upper layer.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Acked-by: Haiyue Wang <haiyue.wang@intel.com>
>
> We have a regression in the mbuf unit test when running with probed
> ixgbe devices (UNH lab).
>
> The problem is that the security dyn field is registered when probing
> the ixgbe devices.
> The unit test fails later while checking one of its own registered
> dynfield offset.
>
> I can reproduce the issue by stopping at this patch in the series and
> adding the below diff.
> The problem can be seen with the whole series applied, there is only a
> difference in reported dynfield offsets.
>
> diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> index 80d1850da9..0e4f895187 100644
> --- a/app/test/test_mbuf.c
> +++ b/app/test/test_mbuf.c
> @@ -33,6 +33,7 @@
> #include <rte_ip.h>
> #include <rte_tcp.h>
> #include <rte_mbuf_dyn.h>
> +#include <rte_security_driver.h>
>
> #include "test.h"
>
> @@ -2589,6 +2590,7 @@ test_mbuf_dyn(struct rte_mempool *pktmbuf_pool)
> int ret;
>
> printf("Test mbuf dynamic fields and flags\n");
> + rte_security_dynfield_register();
> rte_mbuf_dyn_dump(stdout);
>
> offset = rte_mbuf_dynfield_register(&dynfield);
>
>
> Then:
>
> # DPDK_TEST=mbuf_autotest ./build/app/test/dpdk-test
> EAL: Detected 8 lcore(s)
> EAL: Detected 1 NUMA nodes
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'PA'
> EAL: No available hugepages reported in hugepages-1048576kB
> EAL: Probing VFIO support...
> APP: HPET is not enabled, using TSC as default timer
> RTE>>mbuf_autotest
> Test mbuf dynamic fields and flags
> Reserved fields:
> name=rte_security_dynfield_metadata offset=112 size=8 align=8 flags=0
> Reserved flags:
> Free space in mbuf (0 = occupied, value = free zone alignment):
> 0000: 00 00 00 00 00 00 00 00
> 0008: 00 00 00 00 00 00 00 00
> 0010: 00 00 00 00 00 00 00 00
> 0018: 00 00 00 00 00 00 00 00
> 0020: 00 00 00 00 00 00 00 00
> 0028: 00 00 00 00 00 00 00 00
> 0030: 00 00 00 00 00 00 00 00
> 0038: 00 00 00 00 00 00 00 00
> 0040: 00 00 00 00 00 00 00 00
> 0048: 00 00 00 00 00 00 00 00
> 0050: 00 00 00 00 00 00 00 00
> 0058: 00 00 00 00 00 00 00 00
> 0060: 00 00 00 00 00 00 00 00
> 0068: 00 00 00 00 00 00 00 00
> 0070: 00 00 00 00 00 00 00 00
> 0078: 08 08 08 08 08 08 08 08
> Free bit in mbuf->ol_flags (0 = occupied, 1 = free):
> 0000: 0 0 0 0 0 0 0 0
> 0008: 0 0 0 0 0 0 0 0
> 0010: 0 0 0 0 0 0 0 1
> 0018: 1 1 1 1 1 1 1 1
> 0020: 1 1 1 1 1 1 1 1
> 0028: 1 0 0 0 0 0 0 0
> 0030: 0 0 0 0 0 0 0 0
> 0038: 0 0 0 0 0 0 0 0
> mbuf test FAILED (l.2615): <failed to register dynamic field 3,
> offset=-1: No such file or directory>
> mbuf dynflag test failed
> Test Failed
>
> A lazy fix is to simply ask for registering a field at offset
> sizeof(dynfield) - 1 .. what do you think?
I think any offset could be registered,
so it looks more correct to skip the failure if rte_errno is EBUSY.
I did this fix:
https://patches.dpdk.org/patch/83175/
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
` (14 preceding siblings ...)
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 15/15] mbuf: remove userdata field Thomas Monjalon
@ 2020-10-31 15:07 ` Thomas Monjalon
2020-10-31 23:36 ` Ferruh Yigit
15 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-10-31 15:07 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
30/10/2020 18:44, Thomas Monjalon:
> The mbuf field userdata (aliased as udata64)
> was announced to be removed for two reasons:
> - applications, libraries and drivers used the same field
> for different purposes, with a risk of usage conflict.
> - this field always used 8 bytes even if unneeded
>
> Some dynamic fields are created when needed to replace
> the big static userdata field.
> As a consequence, 8 bytes can be re-allocated to dynamic fields.
>
> This mbuf layout change is important to allow adding more features
> (consuming more dynamic fields) during the next year.
Applied
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-10-31 15:07 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
@ 2020-10-31 23:36 ` Ferruh Yigit
2020-11-01 9:15 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Ferruh Yigit @ 2020-10-31 23:36 UTC (permalink / raw)
To: Thomas Monjalon, dev, Jiawen Wu, Jian Wang
Cc: david.marchand, bruce.richardson, olivier.matz, andrew.rybchenko,
akhil.goyal, jerinj
On 10/31/2020 3:07 PM, Thomas Monjalon wrote:
> 30/10/2020 18:44, Thomas Monjalon:
>> The mbuf field userdata (aliased as udata64)
>> was announced to be removed for two reasons:
>> - applications, libraries and drivers used the same field
>> for different purposes, with a risk of usage conflict.
>> - this field always used 8 bytes even if unneeded
>>
>> Some dynamic fields are created when needed to replace
>> the big static userdata field.
>> As a consequence, 8 bytes can be re-allocated to dynamic fields.
>>
>> This mbuf layout change is important to allow adding more features
>> (consuming more dynamic fields) during the next year.
>
> Applied
>
The new txgbe driver in the next-net is also using ‘udata64’, that also needs to
be updated. cc'ed txgbe maintainer.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-10-31 23:36 ` Ferruh Yigit
@ 2020-11-01 9:15 ` Thomas Monjalon
2020-11-01 10:26 ` David Marchand
0 siblings, 1 reply; 178+ messages in thread
From: Thomas Monjalon @ 2020-11-01 9:15 UTC (permalink / raw)
To: Jiawen Wu, Jian Wang, Ferruh Yigit
Cc: dev, david.marchand, bruce.richardson, olivier.matz,
andrew.rybchenko, akhil.goyal, jerinj
01/11/2020 00:36, Ferruh Yigit:
> On 10/31/2020 3:07 PM, Thomas Monjalon wrote:
> > 30/10/2020 18:44, Thomas Monjalon:
> >> The mbuf field userdata (aliased as udata64)
> >> was announced to be removed for two reasons:
> >> - applications, libraries and drivers used the same field
> >> for different purposes, with a risk of usage conflict.
> >> - this field always used 8 bytes even if unneeded
> >>
> >> Some dynamic fields are created when needed to replace
> >> the big static userdata field.
> >> As a consequence, 8 bytes can be re-allocated to dynamic fields.
> >>
> >> This mbuf layout change is important to allow adding more features
> >> (consuming more dynamic fields) during the next year.
> >
> > Applied
>
> The new txgbe driver in the next-net is also using ‘udata64’, that also needs to
> be updated. cc'ed txgbe maintainer.
That's a pity it did not take into account the deprecation notice.
What kind of hack is it used for?
Can it be simply removed to allow quick merging of the PMD?
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-11-01 9:15 ` Thomas Monjalon
@ 2020-11-01 10:26 ` David Marchand
2020-11-02 9:11 ` Jiawen Wu
0 siblings, 1 reply; 178+ messages in thread
From: David Marchand @ 2020-11-01 10:26 UTC (permalink / raw)
To: Thomas Monjalon, Ferruh Yigit, Jiawen Wu
Cc: Jian Wang, dev, Bruce Richardson, Olivier Matz, Andrew Rybchenko,
Akhil Goyal, Jerin Jacob Kollanukkaran
On Sun, Nov 1, 2020 at 10:15 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > The new txgbe driver in the next-net is also using ‘udata64’, that also needs to
> > be updated. cc'ed txgbe maintainer.
>
> That's a pity it did not take into account the deprecation notice.
> What kind of hack is it used for?
> Can it be simply removed to allow quick merging of the PMD?
+1 for removing.
It seems to be a provision for future features, as this field is
simply passed to an internal function that does not use it.
$ git grep -C 2 udata drivers/net/txgbe/
drivers/net/txgbe/txgbe_rxtx.c-
drivers/net/txgbe/txgbe_rxtx.c-
txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
drivers/net/txgbe/txgbe_rxtx.c:
tx_offload, &tx_pkt->udata64);
drivers/net/txgbe/txgbe_rxtx.c-
drivers/net/txgbe/txgbe_rxtx.c- txe->last_id = tx_last;
$ git grep -C 2 txgbe_set_xmit_ctx drivers/net/txgbe/
drivers/net/txgbe/txgbe_rxtx.c-
drivers/net/txgbe/txgbe_rxtx.c-static inline void
drivers/net/txgbe/txgbe_rxtx.c:txgbe_set_xmit_ctx(struct txgbe_tx_queue *txq,
drivers/net/txgbe/txgbe_rxtx.c- volatile struct
txgbe_tx_ctx_desc *ctx_txd,
drivers/net/txgbe/txgbe_rxtx.c- uint64_t ol_flags, union
txgbe_tx_offload tx_offload,
--
drivers/net/txgbe/txgbe_rxtx.c- }
drivers/net/txgbe/txgbe_rxtx.c-
drivers/net/txgbe/txgbe_rxtx.c:
txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
drivers/net/txgbe/txgbe_rxtx.c-
tx_offload, &tx_pkt->udata64);
drivers/net/txgbe/txgbe_rxtx.c-
$ git grep -w mdata drivers/net/txgbe/
drivers/net/txgbe/txgbe_rxtx.c: __rte_unused uint64_t *mdata)
--
David Marchand
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v5 02/15] mbuf: add Rx timestamp dynamic flag
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 02/15] mbuf: add Rx timestamp dynamic flag Thomas Monjalon
@ 2020-11-01 20:03 ` Andrew Rybchenko
0 siblings, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-11-01 20:03 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, jerinj
On 10/30/20 8:29 PM, Thomas Monjalon wrote:
> There is already a dynamic field for timestamp,
> used only for Tx scheduling, thanks to the dedicated flag.
> The same field can be used for Rx timestamp filled by drivers.
> The only missing part to get rid of the static timestamp field
> was to declare a new dynamic flag for Rx usage.
>
> After migrating all Rx timestamp usages, it will be possible
> to remove the deprecated timestamp field.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v5 03/15] ethdev: register mbuf field and flags for timestamp
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 03/15] ethdev: register mbuf field and flags for timestamp Thomas Monjalon
@ 2020-11-01 20:10 ` Andrew Rybchenko
2020-11-01 22:54 ` Thomas Monjalon
0 siblings, 1 reply; 178+ messages in thread
From: Andrew Rybchenko @ 2020-11-01 20:10 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, jerinj, Wenzhuo Lu, Beilei Xing, Bernard Iremonger,
Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko
On 10/30/20 8:29 PM, Thomas Monjalon wrote:
> During port configure or queue setup, the offload flags
> DEV_RX_OFFLOAD_TIMESTAMP and DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP
> trigger the registration of the related mbuf field and flags.
>
> Previously, the Tx timestamp field and flag were registered in testpmd,
> as described in mlx5 guide.
> For the general usage of Rx and Tx timestamps,
> managing registrations inside ethdev is simpler and properly documented.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
A nit below, but regardless of outcome:
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
[snip]
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index b12bb3854d..7c9aadb461 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -31,6 +31,7 @@
> #include <rte_mempool.h>
> #include <rte_malloc.h>
> #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
> #include <rte_errno.h>
> #include <rte_spinlock.h>
> #include <rte_string_fns.h>
> @@ -1232,6 +1233,59 @@ eth_dev_check_lro_pkt_size(uint16_t port_id, uint32_t config_size,
> return ret;
> }
>
> +static inline int
> +eth_dev_timestamp_mbuf_register(uint64_t rx_offloads, uint64_t tx_offloads)
> +{
> + static const struct rte_mbuf_dynfield field_desc = {
> + .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME,
> + .size = sizeof(rte_mbuf_timestamp_t),
> + .align = __alignof__(rte_mbuf_timestamp_t),
> + };
> + static const struct rte_mbuf_dynflag rx_flag_desc = {
> + .name = RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME,
> + };
> + static const struct rte_mbuf_dynflag tx_flag_desc = {
> + .name = RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME,
> + };
> + static bool done_rx, done_tx;
Are these static fields remain by intention? May be I misunderstand
the summary of the previous discussion.
> + bool todo_rx, todo_tx;
> + int offset;
> +
> + todo_rx = (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) != 0
> + && !done_rx;
> + todo_tx = (tx_offloads & DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) != 0
> + && !done_tx;
> +
> + if (todo_rx || todo_tx) {
> + offset = rte_mbuf_dynfield_register(&field_desc);
> + if (offset < 0) {
> + RTE_ETHDEV_LOG(ERR,
> + "Failed to register mbuf field for timestamp\n");
> + return -rte_errno;
> + }
> + }
> + if (todo_rx) {
> + offset = rte_mbuf_dynflag_register(&rx_flag_desc);
> + if (offset < 0) {
> + RTE_ETHDEV_LOG(ERR,
> + "Failed to register mbuf flag for Rx timestamp\n");
> + return -rte_errno;
> + }
> + done_rx = true;
> + }
> + if (todo_tx) {
> + offset = rte_mbuf_dynflag_register(&tx_flag_desc);
> + if (offset < 0) {
> + RTE_ETHDEV_LOG(ERR,
> + "Failed to register mbuf flag for Tx timestamp\n");
> + return -rte_errno;
> + }
> + done_tx = true;
> + }
> +
> + return 0;
> +}
> +
> /*
> * Validate offloads that are requested through rte_eth_dev_configure against
> * the offloads successfully set by the ethernet device.
[snip]
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v5 14/15] mbuf: remove deprecated timestamp field
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 14/15] mbuf: remove deprecated timestamp field Thomas Monjalon
@ 2020-11-01 20:13 ` Andrew Rybchenko
0 siblings, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-11-01 20:13 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, jerinj, Ray Kinsella, Neil Horman
On 10/30/20 8:29 PM, Thomas Monjalon wrote:
> As announced in the deprecation note, the field timestamp
> is removed to allow giving more space to the dynamic fields.
> The related offload flag PKT_RX_TIMESTAMP is also removed.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v5 15/15] mbuf: move pool pointer in hotter first half
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 15/15] mbuf: move pool pointer in hotter first half Thomas Monjalon
@ 2020-11-01 20:23 ` Andrew Rybchenko
0 siblings, 0 replies; 178+ messages in thread
From: Andrew Rybchenko @ 2020-11-01 20:23 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: ferruh.yigit, david.marchand, bruce.richardson, olivier.matz,
akhil.goyal, jerinj, Ray Kinsella, Neil Horman,
Konstantin Ananyev
On 10/30/20 8:29 PM, Thomas Monjalon wrote:
> The mempool pointer in the mbuf struct is moved
> from the second to the first half.
> It should increase performance on most systems having 64-byte cache line,
> i.e. mbuf is split in two cache lines.
> On such system, the first half (also called first cache line) is hotter
> than the second one where the pool pointer was.
>
> Moving this field gives more space to dynfield1.
>
> This is how the mbuf layout looks like (pahole-style):
>
> word type name byte size
> 0 void * buf_addr; /* 0 + 8 */
> 1 rte_iova_t buf_iova /* 8 + 8 */
> /* --- RTE_MARKER64 rearm_data; */
> 2 uint16_t data_off; /* 16 + 2 */
> uint16_t refcnt; /* 18 + 2 */
> uint16_t nb_segs; /* 20 + 2 */
> uint16_t port; /* 22 + 2 */
> 3 uint64_t ol_flags; /* 24 + 8 */
> /* --- RTE_MARKER rx_descriptor_fields1; */
> 4 uint32_t union packet_type; /* 32 + 4 */
> uint32_t pkt_len; /* 36 + 4 */
> 5 uint16_t data_len; /* 40 + 2 */
> uint16_t vlan_tci; /* 42 + 2 */
> 5.5 uint64_t union hash; /* 44 + 8 */
> 6.5 uint16_t vlan_tci_outer; /* 52 + 2 */
> uint16_t buf_len; /* 54 + 2 */
> 7 struct rte_mempool * pool; /* 56 + 8 */
> /* --- RTE_MARKER cacheline1; */
> 8 struct rte_mbuf * next; /* 64 + 8 */
> 9 uint64_t union tx_offload; /* 72 + 8 */
> 10 uint16_t priv_size; /* 80 + 2 */
> uint16_t timesync; /* 82 + 2 */
> uint32_t seqn; /* 84 + 4 */
As I understand rebase is required since seqn is already removed
(or at least fix here).
> 11 struct rte_mbuf_ext_shared_info * shinfo; /* 88 + 8 */
> 12 uint64_t dynfield1[4]; /* 96 + 32 */
> 16 /* --- END 128 */
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Taking Konstantin reply into account ('next' is used on free in any case
together
with 'pool', so the second cache line is accessed in any case), I think
that 'next' is
a better candidate. Also 'tx_offload' is a better candidate than 'pool'.
I think 'next' is better since it works for both Rx and Tx, but
'tx_offload' is Tx only.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v5 03/15] ethdev: register mbuf field and flags for timestamp
2020-11-01 20:10 ` Andrew Rybchenko
@ 2020-11-01 22:54 ` Thomas Monjalon
0 siblings, 0 replies; 178+ messages in thread
From: Thomas Monjalon @ 2020-11-01 22:54 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, ferruh.yigit, david.marchand, bruce.richardson,
olivier.matz, akhil.goyal, jerinj, Wenzhuo Lu, Beilei Xing,
Bernard Iremonger, Matan Azrad, Shahaf Shuler,
Viacheslav Ovsiienko
01/11/2020 21:10, Andrew Rybchenko:
> On 10/30/20 8:29 PM, Thomas Monjalon wrote:
> > + static bool done_rx, done_tx;
>
> Are these static fields remain by intention? May be I misunderstand
> the summary of the previous discussion.
Andrew, you are reading the wrong thread.
The timestamp series has been sent by mistake as v5 of the userdata series.
Please read v6 of userdata (merged) and v2 of timestamp series.
All your comments have been addressed.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-11-01 10:26 ` David Marchand
@ 2020-11-02 9:11 ` Jiawen Wu
2020-11-02 11:08 ` Ferruh Yigit
0 siblings, 1 reply; 178+ messages in thread
From: Jiawen Wu @ 2020-11-02 9:11 UTC (permalink / raw)
To: 'David Marchand', 'Thomas Monjalon',
'Ferruh Yigit'
Cc: 'Jian Wang', 'dev', 'Bruce Richardson',
'Olivier Matz', 'Andrew Rybchenko',
'Akhil Goyal', 'Jerin Jacob Kollanukkaran'
On Sunday, November 1, 2020 6:26 PM, David Marchand wrote:
> On Sun, Nov 1, 2020 at 10:15 AM Thomas Monjalon <thomas@monjalon.net>
> wrote:
> > > The new txgbe driver in the next-net is also using ‘udata64’, that
> > > also needs to be updated. cc'ed txgbe maintainer.
> >
> > That's a pity it did not take into account the deprecation notice.
> > What kind of hack is it used for?
> > Can it be simply removed to allow quick merging of the PMD?
>
> +1 for removing.
>
> It seems to be a provision for future features, as this field is simply passed to
> an internal function that does not use it.
>
> $ git grep -C 2 udata drivers/net/txgbe/
> drivers/net/txgbe/txgbe_rxtx.c-
> drivers/net/txgbe/txgbe_rxtx.c-
> txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
> drivers/net/txgbe/txgbe_rxtx.c:
> tx_offload, &tx_pkt->udata64);
> drivers/net/txgbe/txgbe_rxtx.c-
> drivers/net/txgbe/txgbe_rxtx.c- txe->last_id =
> tx_last;
>
> $ git grep -C 2 txgbe_set_xmit_ctx drivers/net/txgbe/
> drivers/net/txgbe/txgbe_rxtx.c-
> drivers/net/txgbe/txgbe_rxtx.c-static inline void
> drivers/net/txgbe/txgbe_rxtx.c:txgbe_set_xmit_ctx(struct txgbe_tx_queue
> *txq,
> drivers/net/txgbe/txgbe_rxtx.c- volatile struct
> txgbe_tx_ctx_desc *ctx_txd,
> drivers/net/txgbe/txgbe_rxtx.c- uint64_t ol_flags, union
> txgbe_tx_offload tx_offload,
> --
> drivers/net/txgbe/txgbe_rxtx.c- }
> drivers/net/txgbe/txgbe_rxtx.c-
> drivers/net/txgbe/txgbe_rxtx.c:
> txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
> drivers/net/txgbe/txgbe_rxtx.c-
> tx_offload, &tx_pkt->udata64);
> drivers/net/txgbe/txgbe_rxtx.c-
>
> $ git grep -w mdata drivers/net/txgbe/
> drivers/net/txgbe/txgbe_rxtx.c: __rte_unused uint64_t *mdata)
>
>
> --
> David Marchand
Thanks for review.
It can be just simply removed in txgbe driver.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-11-02 9:11 ` Jiawen Wu
@ 2020-11-02 11:08 ` Ferruh Yigit
2020-11-02 11:58 ` Ferruh Yigit
0 siblings, 1 reply; 178+ messages in thread
From: Ferruh Yigit @ 2020-11-02 11:08 UTC (permalink / raw)
To: Jiawen Wu, 'David Marchand', 'Thomas Monjalon'
Cc: 'Jian Wang', 'dev', 'Bruce Richardson',
'Olivier Matz', 'Andrew Rybchenko',
'Akhil Goyal', 'Jerin Jacob Kollanukkaran'
On 11/2/2020 9:11 AM, Jiawen Wu wrote:
> On Sunday, November 1, 2020 6:26 PM, David Marchand wrote:
>> On Sun, Nov 1, 2020 at 10:15 AM Thomas Monjalon <thomas@monjalon.net>
>> wrote:
>>>> The new txgbe driver in the next-net is also using ‘udata64’, that
>>>> also needs to be updated. cc'ed txgbe maintainer.
>>>
>>> That's a pity it did not take into account the deprecation notice.
>>> What kind of hack is it used for?
>>> Can it be simply removed to allow quick merging of the PMD?
>>
>> +1 for removing.
>>
>> It seems to be a provision for future features, as this field is simply passed to
>> an internal function that does not use it.
>>
>> $ git grep -C 2 udata drivers/net/txgbe/
>> drivers/net/txgbe/txgbe_rxtx.c-
>> drivers/net/txgbe/txgbe_rxtx.c-
>> txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
>> drivers/net/txgbe/txgbe_rxtx.c:
>> tx_offload, &tx_pkt->udata64);
>> drivers/net/txgbe/txgbe_rxtx.c-
>> drivers/net/txgbe/txgbe_rxtx.c- txe->last_id =
>> tx_last;
>>
>> $ git grep -C 2 txgbe_set_xmit_ctx drivers/net/txgbe/
>> drivers/net/txgbe/txgbe_rxtx.c-
>> drivers/net/txgbe/txgbe_rxtx.c-static inline void
>> drivers/net/txgbe/txgbe_rxtx.c:txgbe_set_xmit_ctx(struct txgbe_tx_queue
>> *txq,
>> drivers/net/txgbe/txgbe_rxtx.c- volatile struct
>> txgbe_tx_ctx_desc *ctx_txd,
>> drivers/net/txgbe/txgbe_rxtx.c- uint64_t ol_flags, union
>> txgbe_tx_offload tx_offload,
>> --
>> drivers/net/txgbe/txgbe_rxtx.c- }
>> drivers/net/txgbe/txgbe_rxtx.c-
>> drivers/net/txgbe/txgbe_rxtx.c:
>> txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
>> drivers/net/txgbe/txgbe_rxtx.c-
>> tx_offload, &tx_pkt->udata64);
>> drivers/net/txgbe/txgbe_rxtx.c-
>>
>> $ git grep -w mdata drivers/net/txgbe/
>> drivers/net/txgbe/txgbe_rxtx.c: __rte_unused uint64_t *mdata)
>>
>>
>> --
>> David Marchand
>
> Thanks for review.
> It can be just simply removed in txgbe driver.
>
OK, I will remove it in the next-net.
^ permalink raw reply [flat|nested] 178+ messages in thread
* Re: [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata
2020-11-02 11:08 ` Ferruh Yigit
@ 2020-11-02 11:58 ` Ferruh Yigit
0 siblings, 0 replies; 178+ messages in thread
From: Ferruh Yigit @ 2020-11-02 11:58 UTC (permalink / raw)
To: Jiawen Wu, 'David Marchand', 'Thomas Monjalon'
Cc: 'Jian Wang', 'dev', 'Bruce Richardson',
'Olivier Matz', 'Andrew Rybchenko',
'Akhil Goyal', 'Jerin Jacob Kollanukkaran'
On 11/2/2020 11:08 AM, Ferruh Yigit wrote:
> On 11/2/2020 9:11 AM, Jiawen Wu wrote:
>> On Sunday, November 1, 2020 6:26 PM, David Marchand wrote:
>>> On Sun, Nov 1, 2020 at 10:15 AM Thomas Monjalon <thomas@monjalon.net>
>>> wrote:
>>>>> The new txgbe driver in the next-net is also using ‘udata64’, that
>>>>> also needs to be updated. cc'ed txgbe maintainer.
>>>>
>>>> That's a pity it did not take into account the deprecation notice.
>>>> What kind of hack is it used for?
>>>> Can it be simply removed to allow quick merging of the PMD?
>>>
>>> +1 for removing.
>>>
>>> It seems to be a provision for future features, as this field is simply
>>> passed to
>>> an internal function that does not use it.
>>>
>>> $ git grep -C 2 udata drivers/net/txgbe/
>>> drivers/net/txgbe/txgbe_rxtx.c-
>>> drivers/net/txgbe/txgbe_rxtx.c-
>>> txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
>>> drivers/net/txgbe/txgbe_rxtx.c:
>>> tx_offload, &tx_pkt->udata64);
>>> drivers/net/txgbe/txgbe_rxtx.c-
>>> drivers/net/txgbe/txgbe_rxtx.c- txe->last_id =
>>> tx_last;
>>>
>>> $ git grep -C 2 txgbe_set_xmit_ctx drivers/net/txgbe/
>>> drivers/net/txgbe/txgbe_rxtx.c-
>>> drivers/net/txgbe/txgbe_rxtx.c-static inline void
>>> drivers/net/txgbe/txgbe_rxtx.c:txgbe_set_xmit_ctx(struct txgbe_tx_queue
>>> *txq,
>>> drivers/net/txgbe/txgbe_rxtx.c- volatile struct
>>> txgbe_tx_ctx_desc *ctx_txd,
>>> drivers/net/txgbe/txgbe_rxtx.c- uint64_t ol_flags, union
>>> txgbe_tx_offload tx_offload,
>>> --
>>> drivers/net/txgbe/txgbe_rxtx.c- }
>>> drivers/net/txgbe/txgbe_rxtx.c-
>>> drivers/net/txgbe/txgbe_rxtx.c:
>>> txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
>>> drivers/net/txgbe/txgbe_rxtx.c-
>>> tx_offload, &tx_pkt->udata64);
>>> drivers/net/txgbe/txgbe_rxtx.c-
>>>
>>> $ git grep -w mdata drivers/net/txgbe/
>>> drivers/net/txgbe/txgbe_rxtx.c: __rte_unused uint64_t *mdata)
>>>
>>>
>>> --
>>> David Marchand
>>
>> Thanks for review.
>> It can be just simply removed in txgbe driver.
>>
>
> OK, I will remove it in the next-net.
>
Applied following:
diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c
index b35b7de1cb..4d8b43423d 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -281,8 +281,7 @@ txgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf
**tx_pkts,
static inline void
txgbe_set_xmit_ctx(struct txgbe_tx_queue *txq,
volatile struct txgbe_tx_ctx_desc *ctx_txd,
- uint64_t ol_flags, union txgbe_tx_offload tx_offload,
- __rte_unused uint64_t *mdata)
+ uint64_t ol_flags, union txgbe_tx_offload tx_offload)
{
union txgbe_tx_offload tx_offload_mask;
uint32_t type_tucmd_mlhl;
@@ -861,7 +860,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
- tx_offload, &tx_pkt->udata64);
+ tx_offload);
txe->last_id = tx_last;
tx_id = txe->next_id;
^ permalink raw reply [flat|nested] 178+ messages in thread
end of thread, other threads:[~2020-11-02 11:58 UTC | newest]
Thread overview: 178+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 5:20 [dpdk-dev] [PATCH 00/15] remove mbuf userdata Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-26 14:23 ` Andrew Rybchenko
2020-10-27 11:32 ` Bruce Richardson
2020-10-26 5:20 ` [dpdk-dev] [PATCH 02/15] kni: move header file from EAL Thomas Monjalon
2020-10-26 14:25 ` Andrew Rybchenko
2020-10-27 11:33 ` Bruce Richardson
2020-10-26 5:20 ` [dpdk-dev] [PATCH 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
2020-10-26 14:26 ` Andrew Rybchenko
2020-10-26 5:20 ` [dpdk-dev] [PATCH 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
2020-10-26 10:40 ` David Marchand
2020-10-26 14:29 ` Thomas Monjalon
2020-10-26 14:34 ` Andrew Rybchenko
2020-10-26 14:39 ` Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 05/15] security: switch " Thomas Monjalon
2020-10-26 10:41 ` David Marchand
2020-10-26 14:30 ` Thomas Monjalon
2020-10-26 17:58 ` Akhil Goyal
2020-10-26 15:06 ` Andrew Rybchenko
2020-10-26 16:49 ` Thomas Monjalon
2020-10-26 19:03 ` Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 06/15] event/sw: switch test counter " Thomas Monjalon
2020-10-26 15:09 ` Andrew Rybchenko
2020-10-26 5:20 ` [dpdk-dev] [PATCH 07/15] net/ark: ignore user data Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
2020-10-26 10:42 ` David Marchand
2020-10-26 14:32 ` Thomas Monjalon
2020-10-26 5:20 ` [dpdk-dev] [PATCH 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
2020-10-26 15:14 ` Andrew Rybchenko
2020-10-26 15:21 ` Andrew Rybchenko
2020-10-26 16:50 ` Thomas Monjalon
2020-10-26 18:13 ` Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 10/15] test/distributor: switch sequence " Thomas Monjalon
2020-10-26 9:39 ` Lukasz Wojciechowski
2020-10-26 5:21 ` [dpdk-dev] [PATCH 11/15] test/graph: switch user data " Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 12/15] app/eventdev: switch flow ID " Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 13/15] examples/bbdev: switch " Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 14/15] examples/rxtx_callbacks: " Thomas Monjalon
2020-10-26 10:43 ` David Marchand
2020-10-26 14:33 ` Thomas Monjalon
2020-10-26 14:53 ` Stephen Hemminger
2020-10-26 16:32 ` Thomas Monjalon
2020-10-26 5:21 ` [dpdk-dev] [PATCH 15/15] mbuf: remove userdata field Thomas Monjalon
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 00/15] remove mbuf userdata Thomas Monjalon
2020-10-26 22:19 ` [dpdk-dev] [PATCH v2 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 02/15] kni: move header file from EAL Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
2020-10-27 9:32 ` Olivier Matz
2020-10-27 9:34 ` Thomas Monjalon
2020-10-27 14:23 ` Nithin Dabilpuram
2020-10-27 14:33 ` Thomas Monjalon
2020-10-27 15:33 ` Nithin Dabilpuram
2020-10-27 15:57 ` Thomas Monjalon
2020-10-27 16:16 ` Nithin Dabilpuram
2020-10-27 16:26 ` Thomas Monjalon
2020-10-28 9:30 ` [dpdk-dev] [PATCH v4] " Nithin Dabilpuram
2020-10-28 10:08 ` Thomas Monjalon
2020-10-28 10:24 ` Van Haaren, Harry
2020-10-28 10:42 ` Nithin Dabilpuram
2020-10-28 10:43 ` Thomas Monjalon
2020-10-28 18:07 ` Thomas Monjalon
2020-10-29 10:17 ` Van Haaren, Harry
2020-10-28 10:33 ` Nithin Dabilpuram
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 05/15] security: switch " Thomas Monjalon
2020-10-27 2:01 ` Wang, Haiyue
2020-10-27 8:52 ` Thomas Monjalon
2020-10-27 13:12 ` Wang, Haiyue
2020-10-27 10:05 ` Olivier Matz
2020-10-27 16:10 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter " Thomas Monjalon
2020-10-27 10:15 ` Olivier Matz
2020-10-27 16:14 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 07/15] net/ark: ignore user data Thomas Monjalon
2020-10-27 15:32 ` Ed Czeck
2020-10-27 15:55 ` Thomas Monjalon
2020-10-27 16:05 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
2020-10-27 4:44 ` Ajit Khaparde
2020-10-27 10:31 ` Olivier Matz
2020-10-27 16:22 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
2020-10-27 10:45 ` Olivier Matz
2020-10-27 16:25 ` Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 10/15] test/distributor: switch sequence " Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 11/15] test/graph: switch user data " Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 12/15] app/eventdev: switch flow ID " Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 13/15] examples/bbdev: switch " Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 14/15] examples/rxtx_callbacks: " Thomas Monjalon
2020-10-26 22:20 ` [dpdk-dev] [PATCH v2 15/15] mbuf: remove userdata field Thomas Monjalon
2020-10-27 10:53 ` Olivier Matz
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 00/15] remove mbuf userdata Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 02/15] kni: move header file from EAL Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 05/15] security: switch " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 06/15] event/sw: switch test counter " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 07/15] net/ark: switch user data " Thomas Monjalon
2020-10-27 22:30 ` Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 08/15] net/bnxt: switch CFA code " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 10/15] test/distributor: switch sequence " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 11/15] test/graph: switch user data " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 12/15] app/eventdev: switch flow ID " Thomas Monjalon
2020-10-28 4:54 ` Jerin Jacob
2020-10-28 7:43 ` Thomas Monjalon
2020-10-28 8:06 ` Jerin Jacob
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 13/15] examples/bbdev: switch " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 14/15] examples/rxtx_callbacks: " Thomas Monjalon
2020-10-27 21:01 ` [dpdk-dev] [PATCH v3 15/15] mbuf: remove userdata field Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 00/15] remove mbuf userdata Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 02/15] kni: move header file from EAL Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 05/15] security: switch " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 06/15] event/sw: switch test counter " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 07/15] net/ark: switch user data to dynamic mbuf fields Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 10/15] test/distributor: switch sequence " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 11/15] test/graph: switch user data " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 12/15] app/eventdev: switch flow ID " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch " Thomas Monjalon
2020-10-28 11:51 ` Andrew Rybchenko
2020-10-28 12:21 ` Thomas Monjalon
2020-10-28 12:55 ` Andrew Rybchenko
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 14/15] examples/rxtx_callbacks: " Thomas Monjalon
2020-10-28 10:26 ` [dpdk-dev] [PATCH v4 15/15] mbuf: remove userdata field Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 00/15] remove mbuf userdata Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 01/15] eventdev: remove software Rx timestamp Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 02/15] mbuf: add Rx timestamp dynamic flag Thomas Monjalon
2020-11-01 20:03 ` Andrew Rybchenko
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 03/15] ethdev: register mbuf field and flags for timestamp Thomas Monjalon
2020-11-01 20:10 ` Andrew Rybchenko
2020-11-01 22:54 ` Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 04/15] latency: switch timestamp to dynamic mbuf field Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 05/15] net/ark: " Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 06/15] net/dpaa2: " Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 07/15] net/mlx5: fix dynamic mbuf offset lookup check Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 08/15] net/mlx5: switch timestamp to dynamic mbuf field Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 09/15] net/nfb: " Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 10/15] net/octeontx2: " Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 11/15] net/pcap: " Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 12/15] app/testpmd: " Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 13/15] examples/rxtx_callbacks: switch timestamp to dynamic field Thomas Monjalon
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 14/15] mbuf: remove deprecated timestamp field Thomas Monjalon
2020-11-01 20:13 ` Andrew Rybchenko
2020-10-30 17:29 ` [dpdk-dev] [PATCH v5 15/15] mbuf: move pool pointer in hotter first half Thomas Monjalon
2020-11-01 20:23 ` Andrew Rybchenko
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 01/15] examples: enclose DPDK includes with angle brackets Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 02/15] kni: move header file from EAL Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 03/15] mbuf: fix typo in dynamic field convention note Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 04/15] node: switch IPv4 metadata to dynamic mbuf field Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 05/15] security: switch " Thomas Monjalon
2020-10-31 8:56 ` David Marchand
2020-10-31 9:26 ` David Marchand
2020-10-31 14:38 ` Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 06/15] event/sw: switch test counter " Thomas Monjalon
2020-10-30 18:53 ` Van Haaren, Harry
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 07/15] net/ark: switch user data to dynamic mbuf fields Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 08/15] net/bnxt: switch CFA code to dynamic mbuf field Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 09/15] net/vmxnet3: switch MSS hint " Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 10/15] test/distributor: switch sequence " Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 11/15] test/graph: switch user data " Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 12/15] app/eventdev: switch flow ID " Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 13/15] examples/bbdev: switch " Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 14/15] examples/rxtx_callbacks: switch TSC to dynamic field Thomas Monjalon
2020-10-30 17:44 ` [dpdk-dev] [PATCH v6 15/15] mbuf: remove userdata field Thomas Monjalon
2020-10-31 15:07 ` [dpdk-dev] [PATCH v6 00/15] remove mbuf userdata Thomas Monjalon
2020-10-31 23:36 ` Ferruh Yigit
2020-11-01 9:15 ` Thomas Monjalon
2020-11-01 10:26 ` David Marchand
2020-11-02 9:11 ` Jiawen Wu
2020-11-02 11:08 ` Ferruh Yigit
2020-11-02 11:58 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).