graph: introduce graph subsystem
Subsystems (2)
cover graph: introduce graph subsystem
From: Jerin Jacob <[email protected]>
This RFC is targeted for v20.05 release.
This RFC patch includes an implementation of graph architecture for packet processing using DPDK primitives.
Using graph traversal for packet processing is a proven architecture that has been implemented in various open source libraries.
Graph architecture for packet processing enables abstracting the data processing functions as “nodes” and “links” them together to create a complex “graph” to create reusable/modular data processing functions.
The RFC patch further includes performance enhancements and modularity to the DPDK as discussed in more detail below.
What this RFC patch contains:
-----------------------------
1) The API definition to "create" nodes and "link" together to create a "graph" for packet processing. See, lib/librte_graph/rte_graph.h
2) The Fast path API definition for the graph walker and enqueue function used by the workers. See, lib/librte_graph/rte_graph_worker.h
3) Optimized SW implementation for (1) and (2). See, lib/librte_graph/
4) Test case to verify the graph infrastructure functionality See, app/test/test_graph.c
5) Performance test cases to evaluate the cost of graph walker and nodes enqueue fast-path function for various combinations.
See app/test/test_graph_perf.c
6) Packet processing nodes(Null, Rx, Tx, Pkt drop, IPV4 rewrite, IPv4 lookup) using graph infrastructure. See lib/librte_node/*
7) An example application to showcase l3fwd
(functionality same as existing examples/l3fwd) using graph infrastructure and use packets processing nodes (item (6)). See examples/l3fwd-graph/.
Performance
-----------
1) Graph walk and node enqueue overhead can be tested with performance test case application [1]
# If all packets go from a node to another node (we call it as "homerun") then it will be just a pointer swap for a burst of packets.
# In the worst case, a couple of handful cycles to move an object from a node to another node.
2) Performance comparison with existing l3fwd (The complete static code with out any nodes) vs modular l3fwd-graph with 5 nodes
(ip4_lookup, ip4_rewrite, ethdev_tx, ethdev_rx, pkt_drop).
Here is graphical representation of the l3fwd-graph as Graphviz dot file:
http://bit.ly/39UPPGm
# l3fwd-graph performance is -2.5% wrt static l3fwd.
# We have simulated the similar test with existing librte_pipeline application [4]. ip_pipline application is -48.62% wrt static l3fwd.
The above results are on octeontx2. It may vary on other platforms. The platforms with higher L1 and L2 caches will have further better performance.
Tested architectures:
--------------------
1) AArch64
2) X86
Graph library Features
----------------------
1) Nodes as plugins
2) Support for out of tree nodes
3) Multi-process support.
4) Low overhead graph walk and node enqueue
5) Low overhead statistics collection infrastructure
6) Support to export the graph as a Graphviz dot file. See rte_graph_export()
Example of exported graph: http://bit.ly/2PqbqOy
7) Allow having another graph walk implementation
in the future by segregating the fast path and slow path code.
Advantages of Graph architecture:
---------------------------------
1) Memory latency is the enemy for high-speed packet processing,
moving the similar packet processing code to a node will reduce
the I cache and D caches misses.
2) Exploits the probability that most packets will follow the same nodes in the graph.
3) Allow SIMD instructions for packet processing of the node.
4) The modular scheme allows having reusable nodes for the consumers.
5) The modular scheme allows us to abstract the vendor HW specific optimizations as a node.
What is different than existing libpipeline library
---------------------------------------------------
At a very high level, libpipeline created to allow modular plugin interface. Based on our analysis the performance is better in the graph model. Check the details under the Performance section, Item (2).
This rte_graph implementation has taken care of fixing some of the architecture/implementations limitations with libpipeline.
1) Use cases like IP fragmentation, TCP ACK processing
(with new TCP data sent out in the same context)
have a problem as rte_pipeline_run() passes just pkt_mask of 64 bits to different tables and packet pointers are stored in the single array in struct rte_pipeline_run.
In Graph architecture, The node has complete control of how many packets are output to next node seamlessly.
2) Since pktmask is passed to different tables, it takes multiple for loops to extract pkts out of fragmented pkts_mask. This makes it difficult to prefetch ahead a set of packets. This issue does not exist in Graph architecture.
3) Every table have two/three function pointers unlike graph architecture that has a single function pointer for node.
4) The current libpipeline main fast-path function doesn't support tree-like topology where 64 packets can be redirected to 64 different tables. It is currently limited to table-based next table id instead of per-packet action based next table id. So in a typical case, we need to cascade tables and sequentially go through all the tables to reach the last table.
5) pkt_mask limit is 64 bits which is the max burst size possible. The graph library supports up to 256.
In short, both are significantly different architectures. Allowing the end-user to choose the model would be a more appropriate decision by keeping both in DPDK.
Why this RFC
------------
1) We believe, Graph architecture provides the best performance for reusable/modular packet processing framework.
Since DPDK does not have it, it is good to have it in DPDK.
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.
3) The framework enables the protocol stack as use native mbuf for graph processing to avoid any conversion between the formats for better performance.
4) DPDK becomes the "goto library" for userspace HW acceleration. It is good to have native Graph packet processing library in DPDK.
5) Obviously, Our customers are interested in Graph library in DPDK :-)
Identified tweaking for better performance on different targets
---------------------------------------------------------------
1) Test with various burst size values (256, 128, 64, 32) using CONFIG_RTE_GRAPH_BURST_SIZE config option.
Based on our testing, on x86 and arm64 servers, The sweet spot is 256 burst size. While on arm64 embedded SoCs, it is either 64 or 128.
2) Disable node statistics (use CONFIG_RTE_LIBRTE_GRAPH_STATS config option) if not needed.
3) Use arm64 optimized memory copy for arm64 architecture by selecting CONFIG_RTE_ARCH_ARM64_MEMCPY.
Commands to run tests
---------------------
[1]
perf test:
echo "graph_perf_autotest" | sudo ./build/app/test/dpdk-test -c 0x30
[2]
functionality test:
echo "graph_autotest" | sudo ./build/app/test/dpdk-test -c 0x30
[3]
l3fwd-graph:
./l3fwd-graph -c 0x100 -- -p 0x3 --config="(0, 0, 8)" -P
[4]
# ./ip_pipeline --c 0xff0000 -- -s route.cli
Route.cli: (Copy paste to the shell to avoid dos format issues)
https://pastebin.com/raw/B4Ktx7TT
Next steps
-----------------------------
1) Feedback from the community on the library.
2) Collect the API requirements from the community.
3) Sending the next version by addressing the community initial. feedback and fixing the following identified "pending items".
Pending items (Will be addressed in next revision)
-------------------------------------------------
1) Add documentation as a patch
2) Add Doxygen API documentation
3) Split the patches at a more logical level for a better review.
4) code cleanup
5) more optimizations in the nodes and graph infrastructure.
Programming guide and API walk-through
--------------------------------------
# Anatomy of Node:
~~~~~~~~~~~~~~~~~
See the https://github.com/jerinjacobk/share/blob/master/Anatomy_of_a_node.svg
The above diagram depicts the anatomy of a node. The node is the basic building block of the graph framework.
A node consists of:
a) process():
The callback function will be invoked by worker thread using rte_graph_walk() function when there is data to be processed by the node. A graph node process the function using process() and enqueue to next downstream node using rte_node_enqueue*() function.
b) Context memory:
It is memory allocated by the library to store the node-specific context information. which will be used by process(), init(), fini() callbacks.
c) init():
The callback function which will be invoked by rte_graph_create() on when a node gets attached to a graph.
d) fini():
The callback function which will be invoked by rte_graph_destroy() on when a node gets detached to a graph.
e) Node name:
It is the name of the node. When a node registers to graph library, the library gives the ID as rte_node_t type. Both ID or Name shall be used lookup the node. rte_node_from_name(), rte_node_id_to_name() are the node lookup functions.
f) nb_edges:
Number of downstream nodes connected to this node. The next_nodes[] stores the downstream nodes objects. rte_node_edge_update() and rte_node_edge_shrink() functions shall be used to update the next_node[] objects. Consumers of the node APIs are free to update the next_node[] objects till rte_graph_create() invoked.
g) next_node[]:
The dynamic array to store the downstream nodes connected to this node.
# Node creation and registration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a) Node implementer creates the node by implementing ops and attributes of 'struct rte_node_register'
b) The library registers the node by invoking RTE_NODE_REGISTER on library load using the constructor scheme.
The constructor scheme used here to support multi-process.
# Link the Nodes to create the graph topology
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See the https://github.com/jerinjacobk/share/blob/master/Link_the_nodes.svg
The above diagram shows a graph topology after linking the N nodes.
Once nodes are available to the program, Application or node public API functions can links them together to create a complex packet processing graph.
There are multiple different types of strategies to link the nodes.
Method a) Provide the next_nodes[] at the node registration time.
See 'struct rte_node_register::nb_edges'. This is a use case to address the static node scheme where one knows upfront the next_nodes[] of the node.
Method b) Use rte_node_edge_get(), rte_node_edge_update(), rte_node_edge_shrink() to Update the next_nodes[] links for the node dynamically.
Method c) Use rte_node_clone() to clone a already existing node.
When rte_node_clone() invoked, The library, would clone all the attributes of the node and creates a new one. The name for cloned node shall be "parent_node_name-user_provided_name". This method enables the use case of Rx and Tx nodes where multiple of those nodes need to be cloned based on the number of CPU available in the system. The cloned nodes will be identical, except the "context memory". Context memory will have information of port, queue pair incase of Rx and Tx ethdev nodes.
# Create the graph object
~~~~~~~~~~~~~~~~~~~~~~~~~
Now that the nodes are linked, Its time to create a graph by including the required nodes. The application can provide a set of node patterns to form a graph object.
The fnmatch() API used underneath for the pattern matching to include the required nodes.
The rte_graph_create() API shall be used to create the graph.
Example of a graph object creation:
{"ethdev_rx_0_0", ipv4-*, ethdev_tx_0_*"}
In the above example, A graph object will be created with ethdev Rx node of port 0 and queue 0, all ipv4* nodes in the system, and ethdev tx node of port 0 with all queues.
# Multi core graph processing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the current graph library implementation, specifically, rte_graph_walk() and rte_node_enqueue* fast path API functions are designed to work on single-core to have better performance. The fast path API works on graph object, So the multi-core graph processing strategy would be to create graph object PER WORKER.
# In fast path:
~~~~~~~~~~~~~~~
Typical fast-path code looks like below, where the application gets the fast-path graph object through rte_graph_lookup() on the worker thread and run the rte_graph_walk() in a tight loop.
struct rte_graph *graph = rte_graph_lookup("worker0");
while (!done) {
rte_graph_walk(graph);
}# Context update when graph walk in action
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The fast-path object for the node is struct rte_node.
It may be possible that in slow-path or after the graph walk-in action, the user needs to update the context of the node hence access to struct rte_node * memory.
rte_graph_foreach_node(), rte_graph_node_get(), rte_graph_node_get_by_name() APIs can be used to to get the struct rte_node*. rte_graph_foreach_node() iterator function works on struct rte_graph * fast-path graph object while others works on graph ID or name.
# Get the node statistics using graph cluster
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The user may need to know the aggregate stats of the node across multiple graph objects. Especially the situation where each graph object bound to a worker thread.
Introduced a graph cluster object for statistics. rte_graph_cluster_stats_create() shall be used for creating a graph cluster with multiple graph objects and rte_graph_cluster_stats_get() to get the aggregate node statistics.
An example statistics output from rte_graph_cluster_stats_get()
+-----------+------------+-------------+---------------+------------+---------------+-----------+ |Node |calls |objs |realloc_count |objs/call |objs/sec(10E6) |cycles/call| +------------------------+-------------+---------------+------------+---------------+-----------+ |node0 |12977424 |3322220544 |5 |256.000 |3047.151872 |20.0000 | |node1 |12977653 |3322279168 |0 |256.000 |3047.210496 |17.0000 | |node2 |12977696 |3322290176 |0 |256.000 |3047.221504 |17.0000 | |node3 |12977734 |3322299904 |0 |256.000 |3047.231232 |17.0000 | |node4 |12977784 |3322312704 |1 |256.000 |3047.243776 |17.0000 | |node5 |12977825 |3322323200 |0 |256.000 |3047.254528 |17.0000 | +-----------+------------+-------------+---------------+------------+---------------+-----------+
# Node writing guide lines
~~~~~~~~~~~~~~~~~~~~~~~~~~
The process() function of a node is fast-path function and that needs to be written carefully to achieve max performance.
Broadly speaking, there are two different types of nodes.
1) First kind of nodes are those that have a fixed next_nodes[] for the complete burst (like ethdev_rx, ethdev_tx) and it is simple to write. Process() function can move the obj burst to the next node either using rte_node_next_stream_move() or using rte_node_next_stream_get() and rte_node_next_stream_put().
2) The second kind of such node is intermediate nodes that decide what is the next_node[] to send to on a per-packet basis. In these nodes,
a) Firstly, there has to be the best possible packet processing logic.
b) Secondly, each packet needs to be queued to its next node.
At least on some architectures, we get around ~10% more performance if we can avoid copying of packet pointers from one node to next as it is ~= memcpy(BURST_SIZE x sizeof(void *)) x NODE_COUNT.
This can be avoided only in the case where all the packets are destined to the same next node. We call this as home run case and we use rte_node_next_stream_move() to just move burst of object array by swapping the pointer. a.k.a move stream from one node to next node with least number of cycles.
Example of intermediate node implementation with home run:
a) Start with speculation that next_node = ctx->next_node.
This could be the next_node application used in the previous function call of this node.
b) Get the next_node stream array and space using rte_node_next_stream_get(next_node, &space)
c) while space != 0 and n_pkts_left != 0,
prefetch next pkt_set and process current pkt_set to find their next node
d) if all the next nodes of the current pkt_set match speculated next node, just count them as successfully speculated(last_spec) till now and continue the loop without actually moving them to the next node.
else if there is a mismatch,
copy all the pkt_set pointers that were last_spec and
move the current pkt_set to their respective next's nodes using rte_enqueue_next_x1(). Also one of the next_node can be updated as speculated next_node if it is more probable. Also set last_spec = 0
e) if n_pkts_left != 0 and space != 0
goto c) as there is space in the speculated next_node.
f) if last_spec == n_pkts_left,
then we successfully speculated all the packets to right next node. Just call rte_node_next_stream_move(node, next_node) to just move the stream/obj array to next node. This is home run where we avoided memcpy of buffer pointers to next node.
g) if space = 0 and n_pkts_left != 0
goto b)
h) Update the ctx->next_node with more probable next node.
# In-tree node documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a) librte_node/ethdev_rx.c:
This node does rte_eth_rx_burst() into stream buffer acquired using rte_node_next_stream_get() and does rte_node_next_stream_put(count) only when there are packets received. Each rte_node works on only on one rx port and queue that it gets from node->context.
For each (port X, rx_queue Y), a rte_node is cloned from ethdev_rx_base_node as "ethdev_rx-X-Y" in rte_node_eth_config() along with updating node->context. Each graph needs to be associated with a unique rte_node for a (port, rx_queue).
b) librte_node/ethdev_tx.c:
This node does rte_eth_tx_burst() for a burst of objs received by it. It sends the burst to a fixed Tx Port and Queue information from node->context. For each (port X), this rte_node is cloned from ethdev_tx_node_base as "ethdev_tx-X" in rte_node_eth_config() along with updating node->context.
Since each graph doesn't need more than one Txq, per port, a Txq is assigned based on graph id to each rte_node instance. Each graph needs to be associated with a rte_node for each (port).
c) librte_node/pkt_drop.c:
This node frees all the objects that are passed to it.
d) librte_node/ip4_lookup.c:
This node is an intermediate node that does lpm lookup for the received
ipv4 packets and the result determines each packets next node.
a) On successful lpm lookup, the result contains the nex_node id and next-hop id with which the packet needs to be further processed.
b) On lpm lookup failure, objects are redirected to pkt_drop node. rte_node_ip4_route_add() is control path API to add ipv4 routes. To achieve home run, we use rte_node_stream_move() as mentioned in above sections.
e) librte_node/ip4_rewrite.c:
This node gets packets from ip4_lookup node with next-hop id for each packet is embedded in rte_node_mbuf_priv1(mbuf)->nh. This id is used to determine the L2 header to be written to the pkt before sending the pkt out to a particular ethdev_tx node. rte_node_ip4_rewrite_add() is control path API to add next-hop info.
Jerin Jacob (1):
graph: introduce graph subsystem
Kiran Kumar K (1):
test: add graph functional tests
Nithin Dabilpuram (2):
node: add packet processing nodes example/l3fwd_graph: l3fwd using graph architecture
Pavan Nikhilesh (1):
test: add graph performance test cases.
app/test/Makefile | 5 + app/test/meson.build | 10 +- app/test/test_graph.c | 820 +++++++++++++++++ app/test/test_graph_perf.c | 888 +++++++++++++++++++ config/common_base | 13 + config/rte_config.h | 4 + examples/Makefile | 3 + examples/l3fwd-graph/Makefile | 58 ++ examples/l3fwd-graph/main.c | 1131 ++++++++++++++++++++++++ examples/l3fwd-graph/meson.build | 13 + examples/meson.build | 6 +- lib/Makefile | 6 + lib/librte_graph/Makefile | 28 + lib/librte_graph/graph.c | 578 ++++++++++++ lib/librte_graph/graph_debug.c | 81 ++ lib/librte_graph/graph_ops.c | 163 ++++ lib/librte_graph/graph_populate.c | 224 +++++ lib/librte_graph/graph_private.h | 113 +++ lib/librte_graph/graph_stats.c | 396 +++++++++ lib/librte_graph/meson.build | 11 + lib/librte_graph/node.c | 419 +++++++++ lib/librte_graph/rte_graph.h | 277 ++++++ lib/librte_graph/rte_graph_version.map | 46 + lib/librte_graph/rte_graph_worker.h | 280 ++++++ lib/librte_node/Makefile | 30 + lib/librte_node/ethdev_ctrl.c | 106 +++ lib/librte_node/ethdev_rx.c | 218 +++++ lib/librte_node/ethdev_rx.h | 17 + lib/librte_node/ethdev_rx_priv.h | 45 + lib/librte_node/ethdev_tx.c | 74 ++ lib/librte_node/ethdev_tx_priv.h | 33 + lib/librte_node/ip4_lookup.c | 657 ++++++++++++++ lib/librte_node/ip4_lookup_priv.h | 17 + lib/librte_node/ip4_rewrite.c | 340 +++++++ lib/librte_node/ip4_rewrite_priv.h | 44 + lib/librte_node/log.c | 14 + lib/librte_node/meson.build | 8 + lib/librte_node/node_private.h | 61 ++ lib/librte_node/null.c | 23 + lib/librte_node/pkt_drop.c | 26 + lib/librte_node/rte_node_eth_api.h | 31 + lib/librte_node/rte_node_ip4_api.h | 33 + lib/librte_node/rte_node_version.map | 9 + lib/meson.build | 5 +- meson.build | 1 + mk/rte.app.mk | 2 + 46 files changed, 7362 insertions(+), 5 deletions(-) create mode 100644 app/test/test_graph.c create mode 100644 app/test/test_graph_perf.c create mode 100644 examples/l3fwd-graph/Makefile create mode 100644 examples/l3fwd-graph/main.c create mode 100644 examples/l3fwd-graph/meson.build create mode 100644 lib/librte_graph/Makefile create mode 100644 lib/librte_graph/graph.c create mode 100644 lib/librte_graph/graph_debug.c create mode 100644 lib/librte_graph/graph_ops.c create mode 100644 lib/librte_graph/graph_populate.c create mode 100644 lib/librte_graph/graph_private.h create mode 100644 lib/librte_graph/graph_stats.c create mode 100644 lib/librte_graph/meson.build create mode 100644 lib/librte_graph/node.c create mode 100644 lib/librte_graph/rte_graph.h create mode 100644 lib/librte_graph/rte_graph_version.map create mode 100644 lib/librte_graph/rte_graph_worker.h create mode 100644 lib/librte_node/Makefile create mode 100644 lib/librte_node/ethdev_ctrl.c create mode 100644 lib/librte_node/ethdev_rx.c create mode 100644 lib/librte_node/ethdev_rx.h create mode 100644 lib/librte_node/ethdev_rx_priv.h create mode 100644 lib/librte_node/ethdev_tx.c create mode 100644 lib/librte_node/ethdev_tx_priv.h create mode 100644 lib/librte_node/ip4_lookup.c create mode 100644 lib/librte_node/ip4_lookup_priv.h create mode 100644 lib/librte_node/ip4_rewrite.c create mode 100644 lib/librte_node/ip4_rewrite_priv.h create mode 100644 lib/librte_node/log.c create mode 100644 lib/librte_node/meson.build create mode 100644 lib/librte_node/node_private.h create mode 100644 lib/librte_node/null.c create mode 100644 lib/librte_node/pkt_drop.c create mode 100644 lib/librte_node/rte_node_eth_api.h create mode 100644 lib/librte_node/rte_node_ip4_api.h create mode 100644 lib/librte_node/rte_node_version.map
Signature · 1 line
2.24.1
RFC PATCH 1/5 graph: introduce graph subsystem
From: Jerin Jacob <[email protected]>
Abstracting the data processing functions as “nodes” and “link” them together to create complex “graph” to enable reusable data processing functions has been identified as proven architecture.
Introducing the graph infrastructure for packet processing.
--- app/test/meson.build | 1 + config/common_base | 7 + config/rte_config.h | 4 + lib/Makefile | 2 + lib/librte_graph/Makefile | 28 ++ lib/librte_graph/graph.c | 578 +++++++++++++++++++++++++ lib/librte_graph/graph_debug.c | 81 ++++ lib/librte_graph/graph_ops.c | 163 +++++++ lib/librte_graph/graph_populate.c | 224 ++++++++++ lib/librte_graph/graph_private.h | 113 +++++ lib/librte_graph/graph_stats.c | 396 +++++++++++++++++ lib/librte_graph/meson.build | 11 + lib/librte_graph/node.c | 419 ++++++++++++++++++ lib/librte_graph/rte_graph.h | 277 ++++++++++++ lib/librte_graph/rte_graph_version.map | 46 ++ lib/librte_graph/rte_graph_worker.h | 280 ++++++++++++ lib/meson.build | 2 +- mk/rte.app.mk | 1 + 18 files changed, 2632 insertions(+), 1 deletion(-) create mode 100644 lib/librte_graph/Makefile create mode 100644 lib/librte_graph/graph.c create mode 100644 lib/librte_graph/graph_debug.c create mode 100644 lib/librte_graph/graph_ops.c create mode 100644 lib/librte_graph/graph_populate.c create mode 100644 lib/librte_graph/graph_private.h create mode 100644 lib/librte_graph/graph_stats.c create mode 100644 lib/librte_graph/meson.build create mode 100644 lib/librte_graph/node.c create mode 100644 lib/librte_graph/rte_graph.h create mode 100644 lib/librte_graph/rte_graph_version.map create mode 100644 lib/librte_graph/rte_graph_worker.h
app/test/meson.build +1 -0
@@ -160,6 +160,7 @@ test_deps = ['acl', 'ring', 'stack', 'timer' + 'graph', ] fast_test_names = [
config/common_base +7 -0
@@ -1070,6 +1070,13 @@ CONFIG_RTE_LIBRTE_BPF_ELF=n # CONFIG_RTE_LIBRTE_IPSEC=y +# +# Compile librte_graph +# +CONFIG_RTE_LIBRTE_GRAPH=y +CONFIG_RTE_GRAPH_BURST_SIZE=256 +CONFIG_RTE_LIBRTE_GRAPH_STATS=y +CONFIG_RTE_LIBRTE_GRAPH_DEBUG=n # # Compile the test application #
config/rte_config.h +4 -0
@@ -98,6 +98,10 @@/* KNI defines */ #define RTE_KNI_PREEMPT_DEFAULT 1 +/* rte_graph defines */ +#define RTE_GRAPH_BURST_SIZE 256 +#define RTE_LIBRTE_GRAPH_STATS 1 +/****** driver defines ********/ /* QuickAssist device */
lib/Makefile +2 -0
@@ -119,6 +119,8 @@ DEPDIRS-librte_telemetry := librte_eal librte_metrics librte_ethdev DIRS-$(CONFIG_RTE_LIBRTE_RCU) += librte_rcu DEPDIRS-librte_rcu := librte_eal +DIRS-$(CONFIG_RTE_LIBRTE_GRAPH) += librte_graph +DEPDIRS-librte_graph := librte_eal librte_mbuf ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni endif
lib/librte_graph/Makefile new file +28 -0
@@ -0,0 +1,28 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2020 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# library name +LIB = librte_graph.a + +CFLAGS += -O3 -DALLOW_EXPERIMENTAL_API +CFLAGS += $(WERROR_FLAGS) +LDLIBS += -lrte_eal + +EXPORT_MAP := rte_graph_version.map + +# all source are stored in SRCS-y +SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += node.c +SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += graph.c +SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += graph_ops.c +SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += graph_debug.c +SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += graph_stats.c +SRCS-$(CONFIG_RTE_LIBRTE_GRAPH) += graph_populate.c + +# install header files +SYMLINK-$(CONFIG_RTE_LIBRTE_GRAPH)-include += rte_graph.h +SYMLINK-$(CONFIG_RTE_LIBRTE_GRAPH)-include += rte_graph_worker.h + +include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_graph/graph.c new file +578 -0
578 lines not on this page · raw message
lib/librte_graph/graph_debug.c new file +81 -0
81 lines not on this page · raw message
lib/librte_graph/graph_ops.c new file +163 -0
163 lines not on this page · raw message
lib/librte_graph/graph_populate.c new file +224 -0
224 lines not on this page · raw message
lib/librte_graph/graph_private.h new file +113 -0
113 lines not on this page · raw message
lib/librte_graph/graph_stats.c new file +396 -0
396 lines not on this page · raw message
lib/librte_graph/meson.build new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2020 Marvell International Ltd. +# + +name = 'graph' + +sources = files('node.c', 'graph.c', 'graph_ops.c', 'graph_debug.c', 'graph_stats.c', 'graph_populate.c') +headers = files('rte_graph.h', 'rte_graph_worker.h') +allow_experimental_apis = true + +deps += ['eal']
lib/librte_graph/node.c new file +419 -0
419 lines not on this page · raw message
lib/librte_graph/rte_graph.h new file +277 -0
277 lines not on this page · raw message
lib/librte_graph/rte_graph_version.map new file +46 -0
46 lines not on this page · raw message
lib/librte_graph/rte_graph_worker.h new file +280 -0
280 lines not on this page · raw message
lib/meson.build +1 -1
@@ -30,7 +30,7 @@ libraries = [ # add pkt framework libs which use other libs from above 'port', 'table', 'pipeline', # flow_classify lib depends on pkt framework table lib - 'flow_classify', 'bpf', 'telemetry'] + 'flow_classify', 'bpf', 'graph', 'telemetry'] if is_windows libraries = ['kvargs','eal'] # only supported libraries for windows
mk/rte.app.mk +1 -0
@@ -98,6 +98,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched _LDLIBS-$(CONFIG_RTE_LIBRTE_RCU) += -lrte_rcu +_LDLIBS-$(CONFIG_RTE_LIBRTE_GRAPH) += -lrte_graph ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
Signature · 1 line
2.24.1
lib/librte_graph/graph.c line 280
Quoted 4 lines · On Fri, 31 Jan 2020 22:31:57 +0530 <[email protected]> wrote:
lib/librte_graph/graph.c new file +4
-0+/* Create graph object */ + graph =calloc (1 ,sizeof (*graph)); +if (graph ==NULL ) +set_err (ENOMEM , fail,"failed to calloc graph object" );
T
lib/librte_graph/graph.c line 280
Quoted 4 lines · On Fri, 31 Jan 2020 22:31:57 +0530 <[email protected]> wrote:
lib/librte_graph/graph.c new file +4
-0+/* Create graph object */ + graph =calloc (1 ,sizeof (*graph)); +if (graph ==NULL ) +set_err (ENOMEM , fail,"failed to calloc graph object" );
This won't be safe if used in primary/secondary process model. You would need to use rte_calloc etc to allow this.
Quoted 11 lines · Stephen Hemminger
lib/librte_graph/graph.c line 280
Quoted 4 lines · On Fri, 31 Jan 2020 22:31:57 +0530 <[email protected]> wrote:
lib/librte_graph/graph.c new file +4
-0+/* Create graph object */ + graph =calloc (1 ,sizeof (*graph)); +if (graph ==NULL ) +set_err (ENOMEM , fail,"failed to calloc graph object" );This won't be safe if used in primary/secondary process model. You would need to use
rte_callocetc to allow this.
That memory used only local housekeeping purposes. Down in the function, it creates a graph reel from
the memzone with all the required data for fast path. see graph_fp_mem_create()
workers/secondary process get the real fast path graph object through rte_graph_lookup() which
returns the "struct rte_graph *". Followed by invoking rte_graph_walk(struct rte_graph *graph)
for the graph walk.
struct rte_graph *rte_graph_lookup(const char *name)
{
const struct rte_memzone *mz;
struct rte_graph *rc = NULL;
mz = rte_memzone_lookup(name);
if (mz)
rc = mz->addr;
return graph_mem_fixup_secondray(rc);
}lib/librte_graph/graph_private.h line 39
Quoted 6 lines · On Fri, 31 Jan 2020 22:31:57 +0530 <[email protected]> wrote:
lib/librte_graph/graph_private.h new file +6
-0+ +#define set_err (err, where, fmt, ...) do { \ + graph_err(fmt, ##__VA_ARGS__); \ + rte_errno = err; \ + goto where; \ +} while (0)
I dislike this macro, it makes static analysis harder and requires the reader to know that the argument is a goto target. And since it is lower case, implies that it is a function. Usually macros are in upper case.
It makes the code smaller but a cost of being different which impacts the readability of the code.
Quoted 15 lines · Stephen Hemminger
lib/librte_graph/graph_private.h line 39
Quoted 6 lines · On Fri, 31 Jan 2020 22:31:57 +0530 <[email protected]> wrote:
lib/librte_graph/graph_private.h new file +6
-0+ +#define set_err (err, where, fmt, ...) do { \ + graph_err(fmt, ##__VA_ARGS__); \ + rte_errno = err; \ + goto where; \ +} while (0)I dislike this macro, it makes static analysis harder and requires the reader to know that the argument is a goto target. And since it is lower case, implies that it is a function. Usually macros are in upper case.
Quoted 2 lines
It makes the code smaller but a cost of being different which impacts the readability of the code.
I don't like macro either. That's the only case where I have used macro, Even in the fast path,
I did multiple rework to remove macro. Without that macro, that code bloats and will have a lot repeatable code. I have a preference in using _goto_ to have a unified exit to simply the stuff and therefor maintain the code. You could see the amount of verification done in rte_graph_create(). So, IMO, In this case, it is justified to use the macro.
Quoted 20 lines · Jerin Jacob
Quoted 15 lines · Stephen Hemminger
lib/librte_graph/graph_private.h line 39
Quoted 6 lines · On Fri, 31 Jan 2020 22:31:57 +0530 <[email protected]> wrote:
lib/librte_graph/graph_private.h new file +6
-0+ +#define set_err (err, where, fmt, ...) do { \ + graph_err(fmt, ##__VA_ARGS__); \ + rte_errno = err; \ + goto where; \ +} while (0)I dislike this macro, it makes static analysis harder and requires the reader to know that the argument is a goto target. And since it is lower case, implies that it is a function. Usually macros are in upper case.
Quoted 2 lines
It makes the code smaller but a cost of being different which impacts the readability of the code.
Quoted 8 lines
I don't like macro either. That's the only case where I have used macro, Even in the fast path,
I did multiple rework to remove macro. Without that macro, that code bloats and will have a lot repeatable code. I have a preference in using _goto_ to have a unified exit to simply the stuff and therefor maintain the code. You could see the amount of verification done inrte_graph_create(). So, IMO, In this case, it is justified to use the macro.
Hi Jerin,
Renaming it in uppercase and making clear there will be a jump could alleviate some concerns? Something like SET_ERR_JMP() maybe or SET_ERR_GOTO().
Quoted 31 lines · Gaetan Rivet
Quoted 20 lines · Jerin Jacob
Quoted 15 lines · Stephen Hemminger
lib/librte_graph/graph_private.h line 39
Quoted 6 lines · On Fri, 31 Jan 2020 22:31:57 +0530 <[email protected]> wrote:
lib/librte_graph/graph_private.h new file +6
-0+ +#define set_err (err, where, fmt, ...) do { \ + graph_err(fmt, ##__VA_ARGS__); \ + rte_errno = err; \ + goto where; \ +} while (0)I dislike this macro, it makes static analysis harder and requires the reader to know that the argument is a goto target. And since it is lower case, implies that it is a function. Usually macros are in upper case.
Quoted 2 lines
It makes the code smaller but a cost of being different which impacts the readability of the code.
Quoted 8 lines
I don't like macro either. That's the only case where I have used macro, Even in the fast path,
I did multiple rework to remove macro. Without that macro, that code bloats and will have a lot repeatable code. I have a preference in using _goto_ to have a unified exit to simply the stuff and therefor maintain the code. You could see the amount of verification done inrte_graph_create(). So, IMO, In this case, it is justified to use the macro.
Quoted 1 line
Hi Jerin,
Hi Gaetan,
Quoted 3 lines
Renaming it in uppercase and making clear there will be a jump could alleviate some concerns? Something like
SET_ERR_JMP()maybe orSET_ERR_GOTO().
OK. I will change to SET_ERR_JMP() in the next version.
RFC PATCH 2/5 node: add packet processing nodes
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
--- app/test/meson.build | 7 +- config/common_base | 6 + lib/Makefile | 4 + lib/librte_node/Makefile | 30 ++ lib/librte_node/ethdev_ctrl.c | 106 +++++ lib/librte_node/ethdev_rx.c | 218 +++++++++ lib/librte_node/ethdev_rx.h | 17 + lib/librte_node/ethdev_rx_priv.h | 45 ++ lib/librte_node/ethdev_tx.c | 74 +++ lib/librte_node/ethdev_tx_priv.h | 33 ++ lib/librte_node/ip4_lookup.c | 657 +++++++++++++++++++++++++++ lib/librte_node/ip4_lookup_priv.h | 17 + lib/librte_node/ip4_rewrite.c | 340 ++++++++++++++ lib/librte_node/ip4_rewrite_priv.h | 44 ++ lib/librte_node/log.c | 14 + lib/librte_node/meson.build | 8 + lib/librte_node/node_private.h | 61 +++ lib/librte_node/null.c | 23 + lib/librte_node/pkt_drop.c | 26 ++ lib/librte_node/rte_node_eth_api.h | 31 ++ lib/librte_node/rte_node_ip4_api.h | 33 ++ lib/librte_node/rte_node_version.map | 9 + lib/meson.build | 5 +- meson.build | 1 + mk/rte.app.mk | 1 + 25 files changed, 1807 insertions(+), 3 deletions(-) create mode 100644 lib/librte_node/Makefile create mode 100644 lib/librte_node/ethdev_ctrl.c create mode 100644 lib/librte_node/ethdev_rx.c create mode 100644 lib/librte_node/ethdev_rx.h create mode 100644 lib/librte_node/ethdev_rx_priv.h create mode 100644 lib/librte_node/ethdev_tx.c create mode 100644 lib/librte_node/ethdev_tx_priv.h create mode 100644 lib/librte_node/ip4_lookup.c create mode 100644 lib/librte_node/ip4_lookup_priv.h create mode 100644 lib/librte_node/ip4_rewrite.c create mode 100644 lib/librte_node/ip4_rewrite_priv.h create mode 100644 lib/librte_node/log.c create mode 100644 lib/librte_node/meson.build create mode 100644 lib/librte_node/node_private.h create mode 100644 lib/librte_node/null.c create mode 100644 lib/librte_node/pkt_drop.c create mode 100644 lib/librte_node/rte_node_eth_api.h create mode 100644 lib/librte_node/rte_node_ip4_api.h create mode 100644 lib/librte_node/rte_node_version.map
app/test/meson.build +5 -2
@@ -159,8 +159,9 @@ test_deps = ['acl', 'rib', 'ring', 'stack', - 'timer' + 'timer', 'graph', + 'node' ] fast_test_names = [
@@ -382,13 +383,15 @@ endforeach test_dep_objs += cc.find_library('execinfo', required: false) link_libs = [] +link_nodes = [] if get_option('default_library') == 'static' link_libs = dpdk_drivers + link_nodes = dpdk_graph_nodes endif dpdk_test = executable('dpdk-test', test_sources, - link_whole: link_libs, + link_whole: link_libs + link_nodes, dependencies: test_dep_objs, c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], install_rpath: driver_install_path,
config/common_base +6 -0
@@ -1077,6 +1077,12 @@ CONFIG_RTE_LIBRTE_GRAPH=y CONFIG_RTE_GRAPH_BURST_SIZE=256 CONFIG_RTE_LIBRTE_GRAPH_STATS=y CONFIG_RTE_LIBRTE_GRAPH_DEBUG=n +# +# Compile librte_node +# +CONFIG_RTE_LIBRTE_NODE=y +CONFIG_RTE_LIBRTE_NODE_DEBUG=n + # # Compile the test application #
lib/Makefile +4 -0
@@ -121,6 +121,10 @@ DEPDIRS-librte_rcu := librte_eal DIRS-$(CONFIG_RTE_LIBRTE_GRAPH) += librte_graph DEPDIRS-librte_graph := librte_eal librte_mbuf + +DIRS-$(CONFIG_RTE_LIBRTE_NODE) += librte_node +DEPDIRS-librte_node := librte_graph librte_lpm librte_ethdev librte_mbuf + ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni endif
lib/librte_node/Makefile new file +30 -0
@@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2020 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# library name +LIB = librte_node.a + +CFLAGS += -O3 -DALLOW_EXPERIMENTAL_API +CFLAGS += $(WERROR_FLAGS) +LDLIBS += -lrte_eal -lrte_graph -lrte_mbuf -lrte_lpm -lrte_ethdev -lrte_mempool + +EXPORT_MAP := rte_node_version.map + +# all source are stored in SRCS-y +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += null.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += log.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_tx.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ethdev_ctrl.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ip4_lookup.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += ip4_rewrite.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += pkt_drop.c + +# install header files +SYMLINK-$(CONFIG_RTE_LIBRTE_NODE)-include += rte_node_ip4_api.h +SYMLINK-$(CONFIG_RTE_LIBRTE_NODE)-include += rte_node_eth_api.h + +include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_node/ethdev_ctrl.c new file +106 -0
106 lines not on this page · raw message
lib/librte_node/ethdev_rx.c new file +218 -0
218 lines not on this page · raw message
lib/librte_node/ethdev_rx.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ +#ifndef __INCLUDE_ETHDEV_RX_H__ +#define __INCLUDE_ETHDEV_RX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_ETHDEV_RX_H__ */
lib/librte_node/ethdev_rx_priv.h new file +45 -0
45 lines not on this page · raw message
lib/librte_node/ethdev_tx.c new file +74 -0
74 lines not on this page · raw message
lib/librte_node/ethdev_tx_priv.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ +#ifndef __INCLUDE_ETHDEV_TX_PRIV_H__ +#define __INCLUDE_ETHDEV_TX_PRIV_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +enum ethdev_tx_next_nodes { +ETHDEV_TX_NEXT_PKT_DROP , +ETHDEV_TX_NEXT_MAX , +}; + +typedef struct ethdev_tx_node_ctx { +uint16_t port; +uint16_t queue; +}ethdev_tx_node_ctx_t ; + +struct ethdev_tx_node_main { +/* Tx nodes for each ethdev port */ +uint32_t nodes[RTE_MAX_ETHPORTS ]; +}; + +extern struct ethdev_tx_node_main ethdev_tx_main; +extern struct rte_node_register ethdev_tx_node_base; + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_ETHDEV_TX_PRIV_H__ */
lib/librte_node/ip4_lookup.c new file +657 -0
657 lines not on this page · raw message
lib/librte_node/ip4_lookup_priv.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ +#ifndef __INCLUDE_IP4_LOOKUP_PRIV_H__ +#define __INCLUDE_IP4_LOOKUP_PRIV_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rte_common.h> + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_IP4_LOOKUP_PRIV_H__ */
lib/librte_node/ip4_rewrite.c new file +340 -0
340 lines not on this page · raw message
lib/librte_node/ip4_rewrite_priv.h new file +44 -0
44 lines not on this page · raw message
lib/librte_node/log.c new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ + +#include "node_private.h" + +int rte_node_logtype; + +RTE_INIT (rte_node_init_log) +{ + rte_node_logtype =rte_log_register ("lib.node" ); +if (rte_node_logtype >=0 ) +rte_log_set_level (rte_node_logtype,RTE_LOG_INFO ); +}
lib/librte_node/meson.build new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2020 Marvell International Ltd. + +sources = files('null.c', 'log.c', 'ethdev_rx.c', 'ethdev_tx.c', 'ip4_lookup.c', + 'ip4_rewrite.c', 'pkt_drop.c', 'ethdev_ctrl.c') +headers = files('rte_node_ip4_api.h', 'rte_node_eth_api.h') +allow_experimental_apis = true +deps += ['graph', 'mbuf', 'lpm', 'ethdev', 'mempool', 'cryptodev']
lib/librte_node/node_private.h new file +61 -0
61 lines not on this page · raw message
lib/librte_node/null.c new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ + +#include <rte_graph.h> + +static uint16_t +null (struct rte_graph *graph,struct rte_node *node,void **objs, +uint16_t nb_objs) +{ +RTE_SET_USED (node); +RTE_SET_USED (objs); +RTE_SET_USED (graph); + +return nb_objs; +} + +static struct rte_node_register null_node = { + .name ="null" , + .process = null, +}; + +RTE_NODE_REGISTER (null_node);
lib/librte_node/pkt_drop.c new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ + +#include <rte_debug.h> +#include <rte_mbuf.h> +#include <rte_graph.h> + +static uint16_t +pkt_drop_process (struct rte_graph *graph,struct rte_node *node,void **objs, +uint16_t nb_objs) +{ +RTE_SET_USED (node); +RTE_SET_USED (graph); + +rte_pktmbuf_free_bulk ((struct rte_mbuf **)objs, nb_objs); + +return nb_objs; +} + +static struct rte_node_register pkt_drop_node = { + .process = pkt_drop_process, + .name ="pkt_drop" , +}; + +RTE_NODE_REGISTER (pkt_drop_node);
lib/librte_node/rte_node_eth_api.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ +#ifndef __INCLUDE_RTE_NODE_ETH_API_H__ +#define __INCLUDE_RTE_NODE_ETH_API_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdbool.h> +#include <rte_common.h> +#include <rte_mempool.h> +#include <rte_graph.h> + +struct rte_node_ethdev_config { +uint16_t port_id; +uint16_t num_rx_queues; +uint16_t num_tx_queues; +struct rte_mempool **mp; +uint16_t mp_count; +}; + +__rte_experimental int +rte_node_eth_config (struct rte_node_ethdev_config *cfg, +uint16_t cnt,uint16_t nb_graphs); +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_RTE_NODE_ETH_API_H__ */
lib/librte_node/rte_node_ip4_api.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2020 Marvell International Ltd. +*/ +#ifndef __INCLUDE_RTE_NODE_IP4_API_H__ +#define __INCLUDE_RTE_NODE_IP4_API_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* IP4_LOOKUP node defines */ +enum ip4_lookup_next_nodes { +IP4_LOOKUP_NEXT_REWRITE , +IP4_LOOKUP_NEXT_PKT_DROP , +IP4_LOOKUP_NEXT_MAX , +}; + +__rte_experimental +int rte_node_ip4_route_add(uint32_t ip, uint8_t depth, +uint16_t next_hop, +enum ip4_lookup_next_nodes next_node); + +__rte_experimental +int rte_node_ip4_rewrite_add(uint16_t next_hop, uint8_t *rewrite_data, +uint8_t rewrite_len,uint16_t dst_port); + + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_RTE_NODE_IP4_API_H__ */
lib/librte_node/rte_node_version.map new file +9 -0
@@ -0,0 +1,9 @@ +EXPERIMENTAL { + global: + + rte_node_eth_config; + rte_node_ip4_route_add; + rte_node_ip4_rewrite_add; + rte_node_logtype; + local: *; +};
lib/meson.build +4 -1
@@ -30,7 +30,7 @@ libraries = [ # add pkt framework libs which use other libs from above 'port', 'table', 'pipeline', # flow_classify lib depends on pkt framework table lib - 'flow_classify', 'bpf', 'graph', 'telemetry'] + 'flow_classify', 'bpf', 'graph', 'node', 'telemetry'] if is_windows libraries = ['kvargs','eal'] # only supported libraries for windows
@@ -182,6 +182,9 @@ foreach l:libraries dpdk_libraries = [shared_lib] + dpdk_libraries dpdk_static_libraries = [static_lib] + dpdk_static_libraries + if libname == 'rte_node' + dpdk_graph_nodes = [static_lib] + endif endif # sources.length() > 0 set_variable('shared_rte_' + name, shared_dep)
meson.build +1 -0
@@ -16,6 +16,7 @@ cc = meson.get_compiler('c') dpdk_conf = configuration_data() dpdk_libraries = [] dpdk_static_libraries = [] +dpdk_graph_nodes = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []
mk/rte.app.mk +1 -0
@@ -99,6 +99,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched _LDLIBS-$(CONFIG_RTE_LIBRTE_RCU) += -lrte_rcu _LDLIBS-$(CONFIG_RTE_LIBRTE_GRAPH) += -lrte_graph +_LDLIBS-$(CONFIG_RTE_LIBRTE_NODE) += -lrte_node ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni
Signature · 1 line
2.24.1
RFC PATCH 3/5 test: add graph functional tests
In reply to [email protected]From: Kiran Kumar K <[email protected]>
Example command to execute the test:
echo "graph_autotest" | sudo ./build/app/test/dpdk-test -c 0x30
--- app/test/Makefile | 4 + app/test/meson.build | 1 + app/test/test_graph.c | 820 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 825 insertions(+) create mode 100644 app/test/test_graph.c
app/test/Makefile +4 -0
@@ -220,6 +220,10 @@ SRCS-y += test_event_timer_adapter.c SRCS-y += test_event_crypto_adapter.c endif +ifeq ($(CONFIG_RTE_LIBRTE_GRAPH), y) +SRCS-y += test_graph.c +endif + ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) SRCS-y += test_rawdev.c endif
app/test/meson.build +1 -0
@@ -54,6 +54,7 @@ test_sources = files('commands.c', 'test_fib6_perf.c', 'test_func_reentrancy.c', 'test_flow_classify.c', + 'test_graph.c', 'test_hash.c', 'test_hash_functions.c', 'test_hash_multiwriter.c',
app/test/test_graph.c new file +820 -0
820 lines not on this page · raw message
Signature · 1 line
2.24.1
RFC PATCH 4/5 test: add graph performance test cases.
In reply to [email protected]From: Pavan Nikhilesh <[email protected]>
Example command to execute the test:
echo "graph_perf_autotest" | sudo ./build/app/test/dpdk-test -c 0x30
--- app/test/Makefile | 1 + app/test/meson.build | 1 + app/test/test_graph_perf.c | 888 +++++++++++++++++++++++++++++++++++++ 3 files changed, 890 insertions(+) create mode 100644 app/test/test_graph_perf.c
app/test/Makefile +1 -0
@@ -222,6 +222,7 @@ endif ifeq ($(CONFIG_RTE_LIBRTE_GRAPH), y) SRCS-y += test_graph.c +SRCS-y += test_graph_perf.c endif ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y)
app/test/meson.build +1 -0
@@ -55,6 +55,7 @@ test_sources = files('commands.c', 'test_func_reentrancy.c', 'test_flow_classify.c', 'test_graph.c', + 'test_graph_perf.c', 'test_hash.c', 'test_hash_functions.c', 'test_hash_multiwriter.c',
app/test/test_graph_perf.c new file +888 -0
888 lines not on this page · raw message
Signature · 1 line
2.24.1
RFC PATCH 5/5 example/l3fwd_graph: l3fwd using graph architecture
In reply to [email protected]From: Nithin Dabilpuram <[email protected]>
This example application showcase the l3fwd implementation using graph architecture.
The graphical topology representation of the l3fwd-graph is the following,
http://bit.ly/39UPPGm
--- examples/Makefile | 3 + examples/l3fwd-graph/Makefile | 58 ++ examples/l3fwd-graph/main.c | 1131 ++++++++++++++++++++++++++++++ examples/l3fwd-graph/meson.build | 13 + examples/meson.build | 6 +- 5 files changed, 1209 insertions(+), 2 deletions(-) create mode 100644 examples/l3fwd-graph/Makefile create mode 100644 examples/l3fwd-graph/main.c create mode 100644 examples/l3fwd-graph/meson.build
examples/Makefile +3 -0
@@ -51,6 +51,9 @@ DIRS-$(CONFIG_RTE_LIBRTE_ACL) += l3fwd-acl ifeq ($(CONFIG_RTE_LIBRTE_LPM)$(CONFIG_RTE_LIBRTE_HASH),yy) DIRS-$(CONFIG_RTE_LIBRTE_POWER) += l3fwd-power endif +ifeq ($(CONFIG_RTE_LIBRTE_GRAPH), y) +DIRS-y += l3fwd-graph +endif DIRS-y += link_status_interrupt DIRS-y += multi_process DIRS-y += ntb
examples/l3fwd-graph/Makefile new file +58 -0
58 lines not on this page · raw message
examples/l3fwd-graph/main.c new file +1131 -0
1,131 lines not on this page · raw message
examples/l3fwd-graph/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2020 Marvell International Ltd. + +# meson file, for building this example as part of a main DPDK build. +# +# To build this example as a standalone application with an already-installed +# DPDK instance, use 'make' + +deps += ['graph', 'eal', 'lpm', 'ethdev', 'node' ] +sources = files( + 'main.c' +) +allow_experimental_apis = true
examples/meson.build +4 -2
@@ -2,8 +2,10 @@ # Copyright(c) 2017-2019 Intel Corporation driver_libs = [] +node_libs = [] if get_option('default_library') == 'static' driver_libs = dpdk_drivers + node_libs = dpdk_graph_nodes endif execinfo = cc.find_library('execinfo', required: false)
@@ -23,7 +25,7 @@ all_examples = [ 'l2fwd', 'l2fwd-cat', 'l2fwd-event', 'l2fwd-crypto', 'l2fwd-jobstats', 'l2fwd-keepalive', 'l3fwd', - 'l3fwd-acl', 'l3fwd-power', + 'l3fwd-acl', 'l3fwd-power', 'l3fwd-graph', 'link_status_interrupt', 'multi_process/client_server_mp/mp_client', 'multi_process/client_server_mp/mp_server',
@@ -99,7 +101,7 @@ foreach example: examples endif executable('dpdk-' + name, sources, include_directories: includes, - link_whole: driver_libs, + link_whole: driver_libs + node_libs, link_args: dpdk_extra_ldflags, c_args: cflags, dependencies: dep_objs)
Signature · 1 line
2.24.1
Hi Jerin,
Much kudos on a huge contribution to the community.
Look forward to spend more time looking at it in the next few days.
I'll bite and ask the obvious questions - why would I use rte_graph over FD.io VPP?
Ray K
Quoted 571 lines · On 31/01/2020 17:01, [email protected] wrote:
From: Jerin Jacob <[email protected]>
This RFC is targeted for v20.05 release.
This RFC patch includes an implementation of graph architecture for packet processing using DPDK primitives.
Using graph traversal for packet processing is a proven architecture that has been implemented in various open source libraries.
Graph architecture for packet processing enables abstracting the data processing functions as “nodes” and “links” them together to create a complex “graph” to create reusable/modular data processing functions.
The RFC patch further includes performance enhancements and modularity to the DPDK as discussed in more detail below.
What this RFC patch contains:
-----------------------------
1) The API definition to "create" nodes and "link" together to create a "graph" for packet processing. See,lib/librte_graph/rte_graph.h2) The Fast path API definition for the graph walker and enqueue function used by the workers. See,
lib/librte_graph/rte_graph_worker.h3) Optimized SW implementation for (1) and (2). See,
lib/librte_graph/4) Test case to verify the graph infrastructure functionality See,
app/test/test_graph.c5) Performance test cases to evaluate the cost of graph walker and nodes enqueue fast-path function for various combinations.
See
app/test/test_graph_perf.c6) Packet processing
nodes(Null, Rx, Tx, Pkt drop, IPV4 rewrite, IPv4 lookup)using graph infrastructure. Seelib/librte_node/*7) An example application to showcase l3fwd
(functionality same as existing examples/l3fwd) using graph infrastructure and use packets processing nodes (item (6)). See examples/l3fwd-graph/.Performance
-----------
1) Graph walk and node enqueue overhead can be tested with performance test case application [1]
# If all packets go from a node to another node (we call it as "homerun") then it will be just a pointer swap for a burst of packets.
# In the worst case, a couple of handful cycles to move an object from a node to another node.2) Performance comparison with existing l3fwd (The complete static code with out any nodes) vs modular l3fwd-graph with 5 nodes
(ip4_lookup,ip4_rewrite,ethdev_tx,ethdev_rx,pkt_drop).
Here is graphical representation of the l3fwd-graph as Graphviz dot file:
http://bit.ly/39UPPGm# l3fwd-graph performance is -2.5% wrt static l3fwd.# We have simulated the similar test with existing
librte_pipelineapplication [4].ip_piplineapplication is -48.62% wrt static l3fwd.The above results are on octeontx2. It may vary on other platforms. The platforms with higher L1 and L2 caches will have further better performance.
Tested architectures:
--------------------
1) AArch64
2) X86Graph library Features
----------------------
1) Nodes as plugins
2) Support for out of tree nodes
3) Multi-process support.
4) Low overhead graph walk and node enqueue
5) Low overhead statistics collection infrastructure
6) Support to export the graph as a Graphviz dot file. Seerte_graph_export()
Example of exported graph: http://bit.ly/2PqbqOy
7) Allow having another graph walk implementation
in the future by segregating the fast path and slow path code.Advantages of Graph architecture:
---------------------------------1) Memory latency is the enemy for high-speed packet processing,
moving the similar packet processing code to a node will reduce
the I cache and D caches misses.
2) Exploits the probability that most packets will follow the same nodes in the graph.
3) Allow SIMD instructions for packet processing of the node.
4) The modular scheme allows having reusable nodes for the consumers.
5) The modular scheme allows us to abstract the vendor HW specific optimizations as a node.What is different than existing libpipeline library
---------------------------------------------------
At a very high level, libpipeline created to allow modular plugin interface. Based on our analysis the performance is better in the graph model. Check the details under the Performance section, Item (2).This
rte_graphimplementation has taken care of fixing some of the architecture/implementations limitations with libpipeline.1) Use cases like IP fragmentation, TCP ACK processing
(with new TCP data sent out in the same context)
have a problem asrte_pipeline_run()passes justpkt_maskof 64 bits to different tables and packet pointers are stored in the single array in structrte_pipeline_run.In Graph architecture, The node has complete control of how many packets are output to next node seamlessly.
2) Since pktmask is passed to different tables, it takes multiple for loops to extract pkts out of fragmented
pkts_mask. This makes it difficult to prefetch ahead a set of packets. This issue does not exist in Graph architecture.3) Every table have two/three function pointers unlike graph architecture that has a single function pointer for node.
4) The current libpipeline main fast-path function doesn't support tree-like topology where 64 packets can be redirected to 64 different tables. It is currently limited to table-based next table id instead of per-packet action based next table id. So in a typical case, we need to cascade tables and sequentially go through all the tables to reach the last table.
5)
pkt_masklimit is 64 bits which is the max burst size possible. The graph library supports up to 256.In short, both are significantly different architectures. Allowing the end-user to choose the model would be a more appropriate decision by keeping both in DPDK.
Why this RFC
------------
1) We believe, Graph architecture provides the best performance for reusable/modular packet processing framework.
Since DPDK does not have it, it is good to have it in DPDK.2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.3) The framework enables the protocol stack as use native mbuf for graph processing to avoid any conversion between the formats for better performance.
4) DPDK becomes the "goto library" for userspace HW acceleration. It is good to have native Graph packet processing library in DPDK.
5) Obviously, Our customers are interested in Graph library in DPDK :-)
Identified tweaking for better performance on different targets
---------------------------------------------------------------
1) Test with various burst size values (256, 128, 64, 32) usingCONFIG_RTE_GRAPH_BURST_SIZEconfig option.
Based on our testing, on x86 and arm64 servers, The sweet spot is 256 burst size. While on arm64 embedded SoCs, it is either 64 or 128.2) Disable node statistics (use
CONFIG_RTE_LIBRTE_GRAPH_STATSconfig option) if not needed.3) Use arm64 optimized memory copy for arm64 architecture by selecting
CONFIG_RTE_ARCH_ARM64_MEMCPY.Commands to run tests
---------------------[1]
perf test:
echo "graph_perf_autotest" | sudo ./build/app/test/dpdk-test -c0x30[2]
functionality test:
echo "graph_autotest" | sudo ./build/app/test/dpdk-test -c0x30[3]
l3fwd-graph:
./l3fwd-graph -c0x100-- -p0x3--config="(0, 0, 8)" -P[4]
# ./ip_pipeline --c 0xff0000 -- -s route.cliRoute.cli: (Copy paste to the shell to avoid dos format issues)
https://pastebin.com/raw/B4Ktx7TT
Next steps
-----------------------------
1) Feedback from the community on the library.
2) Collect the API requirements from the community.
3) Sending the next version by addressing the community initial. feedback and fixing the following identified "pending items".Pending items (Will be addressed in next revision)
-------------------------------------------------
1) Add documentation as a patch
2) Add Doxygen API documentation
3) Split the patches at a more logical level for a better review.
4) code cleanup
5) more optimizations in the nodes and graph infrastructure.Programming guide and API walk-through
--------------------------------------
# Anatomy of Node:
~~~~~~~~~~~~~~~~~
See the https://github.com/jerinjacobk/share/blob/master/Anatomy_of_a_node.svgThe above diagram depicts the anatomy of a node. The node is the basic building block of the graph framework.
A node consists of:
a)process():The callback function will be invoked by worker thread using
rte_graph_walk()function when there is data to be processed by the node. A graph node process the function usingprocess()and enqueue to next downstream node using rte_node_enqueue*() function.b) Context memory:
It is memory allocated by the library to store the node-specific context information. which will be used by
process(),init(),fini()callbacks.c)
init():The callback function which will be invoked by
rte_graph_create()on when a node gets attached to a graph.d)
fini():The callback function which will be invoked by
rte_graph_destroy()on when a node gets detached to a graph.e) Node name:
It is the name of the node. When a node registers to graph library, the library gives the ID as
rte_node_ttype. Both ID or Name shall be used lookup the node.rte_node_from_name(),rte_node_id_to_name()are the node lookup functions.f)
nb_edges:Number of downstream nodes connected to this node. The next_nodes[] stores the downstream nodes objects.
rte_node_edge_update()andrte_node_edge_shrink()functions shall be used to update the next_node[] objects. Consumers of the node APIs are free to update the next_node[] objects tillrte_graph_create()invoked.g) next_node[]:
The dynamic array to store the downstream nodes connected to this node.
# Node creation and registration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a) Node implementer creates the node by implementing ops and attributes of 'structrte_node_register'
b) The library registers the node by invokingRTE_NODE_REGISTERon library load using the constructor scheme.
The constructor scheme used here to support multi-process.# Link the Nodes to create the graph topology
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See the https://github.com/jerinjacobk/share/blob/master/Link_the_nodes.svgThe above diagram shows a graph topology after linking the N nodes.
Once nodes are available to the program, Application or node public API functions can links them together to create a complex packet processing graph.
There are multiple different types of strategies to link the nodes.
Method a) Provide the next_nodes[] at the node registration time.
See 'structrte_node_register::nb_edges'. This is a use case to address the static node scheme where one knows upfront the next_nodes[] of the node.Method b) Use
rte_node_edge_get(),rte_node_edge_update(),rte_node_edge_shrink()to Update the next_nodes[] links for the node dynamically.Method c) Use
rte_node_clone()to clone a already existing node.
Whenrte_node_clone()invoked, The library, would clone all the attributes of the node and creates a new one. The name for cloned node shall be "parent_node_name-user_provided_name". This method enables the use case of Rx and Tx nodes where multiple of those nodes need to be cloned based on the number of CPU available in the system. The cloned nodes will be identical, except the "context memory". Context memory will have information of port, queue pair incase of Rx and Tx ethdev nodes.# Create the graph object
~~~~~~~~~~~~~~~~~~~~~~~~~
Now that the nodes are linked, Its time to create a graph by including the required nodes. The application can provide a set of node patterns to form a graph object.
Thefnmatch()API used underneath for the pattern matching to include the required nodes.The
rte_graph_create()API shall be used to create the graph.Example of a graph object creation:
{"
ethdev_rx_0_0", ipv4-*, ethdev_tx_0_*"}In the above example, A graph object will be created with ethdev Rx node of port 0 and queue 0, all ipv4* nodes in the system, and ethdev tx node of port 0 with all queues.
# Multi core graph processing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In the current graph library implementation, specifically,
rte_graph_walk()and rte_node_enqueue* fast path API functions are designed to work on single-core to have better performance. The fast path API works on graph object, So the multi-core graph processing strategy would be to create graph object PER WORKER.# In fast path:
~~~~~~~~~~~~~~~Typical fast-path code looks like below, where the application gets the fast-path graph object through
rte_graph_lookup()on the worker thread and run therte_graph_walk()in a tight loop.struct
rte_graph*graph =rte_graph_lookup("worker0");while (!done) { rte_graph_walk(graph); }# Context update when graph walk in action
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The fast-path object for the node is
struct rte_node.It may be possible that in slow-path or after the graph walk-in action, the user needs to update the context of the node hence access to struct
rte_node* memory.
rte_graph_foreach_node(),rte_graph_node_get(),rte_graph_node_get_by_name()APIs can be used to to get the struct rte_node*.rte_graph_foreach_node()iterator function works on structrte_graph* fast-path graph object while others works on graph ID or name.# Get the node statistics using graph cluster
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The user may need to know the aggregate stats of the node across multiple graph objects. Especially the situation where each graph object bound to a worker thread.
Introduced a graph cluster object for statistics.
rte_graph_cluster_stats_create()shall be used for creating a graph cluster with multiple graph objects andrte_graph_cluster_stats_get()to get the aggregate node statistics.An example statistics output from
rte_graph_cluster_stats_get()+-----------+------------+-------------+---------------+------------+---------------+-----------+ |Node |calls |objs |realloc_count |objs/call |objs/sec(10E6) |cycles/call| +------------------------+-------------+---------------+------------+---------------+-----------+ |node0 |12977424 |3322220544 |5 |256.000 |3047.151872 |20.0000 | |node1 |12977653 |3322279168 |0 |256.000 |3047.210496 |17.0000 | |node2 |12977696 |3322290176 |0 |256.000 |3047.221504 |17.0000 | |node3 |12977734 |3322299904 |0 |256.000 |3047.231232 |17.0000 | |node4 |12977784 |3322312704 |1 |256.000 |3047.243776 |17.0000 | |node5 |12977825 |3322323200 |0 |256.000 |3047.254528 |17.0000 | +-----------+------------+-------------+---------------+------------+---------------+-----------+# Node writing guide lines
~~~~~~~~~~~~~~~~~~~~~~~~~~The
process()function of a node is fast-path function and that needs to be written carefully to achieve max performance.Broadly speaking, there are two different types of nodes.
1) First kind of nodes are those that have a fixed next_nodes[] for the complete burst (like
ethdev_rx,ethdev_tx) and it is simple to write.Process()function can move the obj burst to the next node either usingrte_node_next_stream_move()or usingrte_node_next_stream_get()andrte_node_next_stream_put().2) The second kind of such node is
intermediate nodesthat decide what is the next_node[] to send to on a per-packet basis. In these nodes,a) Firstly, there has to be the best possible packet processing logic.
b) Secondly, each packet needs to be queued to its next node.At least on some architectures, we get around ~10% more performance if we can avoid copying of packet pointers from one node to next as it is ~=
memcpy(BURST_SIZE x sizeof(void *))xNODE_COUNT.This can be avoided only in the case where all the packets are destined to the same next node. We call this as home run case and we use
rte_node_next_stream_move()to just move burst of object array by swapping the pointer. a.k.a move stream from one node to next node with least number of cycles.Example of intermediate node implementation with home run:
a) Start with speculation thatnext_node=ctx->next_node.
This could be thenext_nodeapplication used in the previous function call of this node.
b) Get thenext_nodestream array and space usingrte_node_next_stream_get(next_node, &space)
c) while space != 0 andn_pkts_left!= 0,
prefetch nextpkt_setand process currentpkt_setto find their next node
d) if all the next nodes of the currentpkt_setmatch speculated next node, just count them as successfullyspeculated(last_spec)till now and continue the loop without actually moving them to the next node.
else if there is a mismatch,
copy all thepkt_setpointers that werelast_specand
move the currentpkt_setto their respective next's nodes usingrte_enqueue_next_x1(). Also one of thenext_nodecan be updated as speculatednext_nodeif it is more probable. Also setlast_spec= 0
e) ifn_pkts_left!= 0 and space != 0
goto c) as there is space in the speculatednext_node.
f) iflast_spec==n_pkts_left,
then we successfully speculated all the packets to right next node. Just callrte_node_next_stream_move(node, next_node)to just move the stream/obj array to next node. This is home run where we avoided memcpy of buffer pointers to next node.
g) if space = 0 andn_pkts_left!= 0
goto b)
h) Update thectx->next_nodewith more probable next node.# In-tree node documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a)librte_node/ethdev_rx.c:
This node doesrte_eth_rx_burst()into stream buffer acquired usingrte_node_next_stream_get()and doesrte_node_next_stream_put(count)only when there are packets received. Eachrte_nodeworks on only on one rx port and queue that it gets fromnode->context.
For each (port X,rx_queueY), arte_nodeis cloned fromethdev_rx_base_nodeas "ethdev_rx-X-Y" inrte_node_eth_config()along with updatingnode->context. Each graph needs to be associated with a uniquerte_nodefor a (port,rx_queue).b)
librte_node/ethdev_tx.c:
This node doesrte_eth_tx_burst()for a burst of objs received by it. It sends the burst to a fixed Tx Port and Queue information fromnode->context. For each (port X), thisrte_nodeis cloned fromethdev_tx_node_baseas "ethdev_tx-X" inrte_node_eth_config()along with updatingnode->context.
Since each graph doesn't need more than one Txq, per port, a Txq is assigned based on graph id to eachrte_nodeinstance. Each graph needs to be associated with arte_nodefor each (port).c)
librte_node/pkt_drop.c:
This node frees all the objects that are passed to it.d)
librte_node/ip4_lookup.c:
This node is an intermediate node that does lpm lookup for the received
ipv4 packets and the result determines each packets next node.
a) On successful lpm lookup, the result contains thenex_nodeid and next-hop id with which the packet needs to be further processed.
b) On lpm lookup failure, objects are redirected topkt_dropnode.rte_node_ip4_route_add()is control path API to add ipv4 routes. To achieve home run, we userte_node_stream_move()as mentioned in above sections.e)
librte_node/ip4_rewrite.c:
This node gets packets fromip4_lookupnode with next-hop id for each packet is embedded in rte_node_mbuf_priv1(mbuf)->nh. This id is used to determine the L2 header to be written to the pkt before sending the pkt out to a particularethdev_txnode.rte_node_ip4_rewrite_add()is control path API to add next-hop info.Jerin Jacob (1):
graph: introduce graph subsystemKiran Kumar K (1):
test: add graph functional testsNithin Dabilpuram (2):
node: add packet processing nodes example/l3fwd_graph: l3fwd using graph architecturePavan Nikhilesh (1):
test: add graph performance test cases.app/test/Makefile | 5 + app/test/meson.build | 10 +- app/test/test_graph.c | 820 +++++++++++++++++ app/test/test_graph_perf.c | 888 +++++++++++++++++++ config/common_base | 13 + config/rte_config.h | 4 + examples/Makefile | 3 + examples/l3fwd-graph/Makefile | 58 ++ examples/l3fwd-graph/main.c | 1131 ++++++++++++++++++++++++ examples/l3fwd-graph/meson.build | 13 + examples/meson.build | 6 +- lib/Makefile | 6 + lib/librte_graph/Makefile | 28 + lib/librte_graph/graph.c | 578 ++++++++++++ lib/librte_graph/graph_debug.c | 81 ++ lib/librte_graph/graph_ops.c | 163 ++++ lib/librte_graph/graph_populate.c | 224 +++++ lib/librte_graph/graph_private.h | 113 +++ lib/librte_graph/graph_stats.c | 396 +++++++++ lib/librte_graph/meson.build | 11 + lib/librte_graph/node.c | 419 +++++++++ lib/librte_graph/rte_graph.h | 277 ++++++ lib/librte_graph/rte_graph_version.map | 46 + lib/librte_graph/rte_graph_worker.h | 280 ++++++ lib/librte_node/Makefile | 30 + lib/librte_node/ethdev_ctrl.c | 106 +++ lib/librte_node/ethdev_rx.c | 218 +++++ lib/librte_node/ethdev_rx.h | 17 + lib/librte_node/ethdev_rx_priv.h | 45 + lib/librte_node/ethdev_tx.c | 74 ++ lib/librte_node/ethdev_tx_priv.h | 33 + lib/librte_node/ip4_lookup.c | 657 ++++++++++++++ lib/librte_node/ip4_lookup_priv.h | 17 + lib/librte_node/ip4_rewrite.c | 340 +++++++ lib/librte_node/ip4_rewrite_priv.h | 44 + lib/librte_node/log.c | 14 + lib/librte_node/meson.build | 8 + lib/librte_node/node_private.h | 61 ++ lib/librte_node/null.c | 23 + lib/librte_node/pkt_drop.c | 26 + lib/librte_node/rte_node_eth_api.h | 31 + lib/librte_node/rte_node_ip4_api.h | 33 + lib/librte_node/rte_node_version.map | 9 + lib/meson.build | 5 +- meson.build | 1 + mk/rte.app.mk | 2 + 46 files changed, 7362 insertions(+), 5 deletions(-) create mode 100644 app/test/test_graph.c create mode 100644 app/test/test_graph_perf.c create mode 100644 examples/l3fwd-graph/Makefile create mode 100644 examples/l3fwd-graph/main.c create mode 100644 examples/l3fwd-graph/meson.build create mode 100644 lib/librte_graph/Makefile create mode 100644 lib/librte_graph/graph.c create mode 100644 lib/librte_graph/graph_debug.c create mode 100644 lib/librte_graph/graph_ops.c create mode 100644 lib/librte_graph/graph_populate.c create mode 100644 lib/librte_graph/graph_private.h create mode 100644 lib/librte_graph/graph_stats.c create mode 100644 lib/librte_graph/meson.build create mode 100644 lib/librte_graph/node.c create mode 100644 lib/librte_graph/rte_graph.h create mode 100644 lib/librte_graph/rte_graph_version.map create mode 100644 lib/librte_graph/rte_graph_worker.h create mode 100644 lib/librte_node/Makefile create mode 100644 lib/librte_node/ethdev_ctrl.c create mode 100644 lib/librte_node/ethdev_rx.c create mode 100644 lib/librte_node/ethdev_rx.h create mode 100644 lib/librte_node/ethdev_rx_priv.h create mode 100644 lib/librte_node/ethdev_tx.c create mode 100644 lib/librte_node/ethdev_tx_priv.h create mode 100644 lib/librte_node/ip4_lookup.c create mode 100644 lib/librte_node/ip4_lookup_priv.h create mode 100644 lib/librte_node/ip4_rewrite.c create mode 100644 lib/librte_node/ip4_rewrite_priv.h create mode 100644 lib/librte_node/log.c create mode 100644 lib/librte_node/meson.build create mode 100644 lib/librte_node/node_private.h create mode 100644 lib/librte_node/null.c create mode 100644 lib/librte_node/pkt_drop.c create mode 100644 lib/librte_node/rte_node_eth_api.h create mode 100644 lib/librte_node/rte_node_ip4_api.h create mode 100644 lib/librte_node/rte_node_version.map
Quoted 2 lines · Ray Kinsella
Hi Jerin,
Hi Ray,
Quoted 1 line
Much kudos on a huge contribution to the community.
All the authors of this patch set spend at least the last 3/4 months to bring this up RFC with performance data with an l3fwd-graph example application.
We hope it would be useful for DPDK community.
Quoted 1 line
Look forward to spend more time looking at it in the next few days.
That would be very helpful.
Quoted 2 lines
I'll bite and ask the obvious questions - why would I use
rte_graphover FD.io VPP?
I did not get the opportunity to work day to day on FD.io projects. My understanding of FD.io is very limited.
I do think, it is NOT one vs other. VPP is quite a mature project and they are pioneers in graph architecture.
VPP is an entirely separate framework by itself and provides an alternate data plane environment.
The objective of rte_graph is to add a graph subsystem to DPDK as a foundational element.
This will allow the DPDK community to use the powerfull graph architecture concept in a fundamental
way with purely DPDK based applications
That would boil down to:
1) Provision to use pure native mbuf based dpdk application with graph architecture. i.e
avoid the cost of packet format conversion for good.
2) Use rte_mempool, rte_flow, rte_tm, rte_cryptodev, rte_eventdev, rte_regexdev HW accelerated
API in the data plane application.
3) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor.
Going forward, We believe, API abstraction may not be enough abstract the difference in HW.
The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end-users to avoid writing capabilities based APIs and avoid vendor-specific fast path routines. So such vendor plugin can be part of dpdk to help both vendors and end-user of DPDK.
4) Provision for multiprocess support in graph architecture.
5) Contribute to dpdk.org
6) Use Linux coding standards.
7) Finally, one may consider using rte_graph, _if_ specific workload performs better in performance
in this model due to framework and/or the HW acceleration attached to it.
Quoted 3 lines
Ray K
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
I believe low-level aspects of the code can be taken care of from the v1 series onwards.
I am just wondering what would be an appropriate time for sending v1. If someone planning for reviewing at the top level,
I can wait until the review complete. Let us know if anyone planning to review?
If no other comment then I would like to request tech board approval for the library on 26/Feb meeting.
[1]
http://mails.dpdk.org/archives/dev/2020-January/156765.html
Quoted 62 lines · Jerin Jacob
Quoted 2 lines · Ray Kinsella
Hi Jerin,
Hi Ray,
Quoted 1 line
Much kudos on a huge contribution to the community.
All the authors of this patch set spend at least the last 3/4 months to bring this up RFC with performance data with an l3fwd-graph example application.
We hope it would be useful for DPDK community.Quoted 1 line
Look forward to spend more time looking at it in the next few days.
That would be very helpful.
Quoted 2 lines
I'll bite and ask the obvious questions - why would I use
rte_graphover FD.io VPP?I did not get the opportunity to work day to day on FD.io projects. My understanding of FD.io is very limited.
I do think, it is NOT one vs other. VPP is quite a mature project and they are pioneers in graph architecture.VPP is an entirely separate framework by itself and provides an alternate data plane environment.
The objective ofrte_graphis to add a graph subsystem to DPDK as a foundational element.
This will allow the DPDK community to use the powerfull graph architecture concept in a fundamental
way with purely DPDK based applicationsThat would boil down to:
1) Provision to use pure native mbuf based dpdk application with graph architecture. i.e
avoid the cost of packet format conversion for good.
2) Userte_mempool,rte_flow,rte_tm,rte_cryptodev,rte_eventdev,rte_regexdevHW accelerated
API in the data plane application.
3) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor.
Going forward, We believe, API abstraction may not be enough abstract the difference in HW.
The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end-users to avoid writing capabilities based APIs and avoid vendor-specific fast path routines. So such vendor plugin can be part of dpdk to help both vendors and end-user of DPDK.
4) Provision for multiprocess support in graph architecture.
5) Contribute to dpdk.org
6) Use Linux coding standards.
7) Finally, one may consider usingrte_graph, _if_ specific workload performs better in performance
in this model due to framework and/or the HW acceleration attached to it.Quoted 3 lines
Ray K
Hi Jerin,
17/02/2020 08:19, Jerin Jacob:
Quoted 5 lines
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
If we add rte_graph to DPDK, we will have 2 similar libraries.
I already proposed several times to move rte_pipeline in a separate repository for two reasons:
1/ it is acting at a higher API layer level
2/ there can be different solutions in this layer
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.
I believe it is time to move rte_pipeline (Packet Framework) in a separate repository, and welcome rte_graph as well in another separate repository.
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
Consuming the low-level API in different abstractions,
and building applications, should be done on top of dpdk.git.
Quoted 2 lines · Thomas Monjalon
Hi Jerin,
Hi Thomas,
Thanks for starting this discussion now. It is an interesting discussion. Some thoughts below.
We can decide based on community consensus and follow a single rule across the components.
Quoted 5 lines
17/02/2020 08:19, Jerin Jacob:
Quoted 3 lines
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Quoted 8 lines
Quoted 2 lines
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer level
We need to define what is the higher layer API. Is it processing beyond L2?
In the context of Graph library, it is a framework, not using any of the substem API
other than EAL and it is under lib/librte_graph.
Nodes library using graph and other subsystem components such as ethdev and it is under lib/lib_node/
Another interesting question would what would be an issue in DPDK supporting beyond L2. Or higher level protocols?
Quoted 1 line
2/ there can be different solutions in this layer
Is there any issue with that?
There is overlap with the distributor library and eventdev as well. ethdev and SW traffic manager libraries as well. That list goes on.
Quoted 7 lines
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.I believe it is time to move
rte_pipeline(Packet Framework) in a separate repository, and welcomerte_graphas well in another separate repository.
What would be gain out of this?
My concerns are:
# Like packet-gen, The new code will be filled with unnecessary DPDK version checks
and unnecessary compatibility issues.
# Anything is not in main dpdk repo, it is a second class citizen. # Customer has the pain to use two repos and two releases. Internally, it can be two different
repo but release needs to go through one repo.
If we are focusing ONLY on the driver API then how can DPDK grow further? If linux kernel
would be thought only have just the kernel and networking/storage as different repo it would
not have grown up?
What is the real concern? Maintenance?
Quoted 2 lines
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
The nodes can be vendor-specific to optimize the specific use cases. As I mentioned in the cover letter,
"
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.
"
Thoughts from other folks?
Quoted 4 lines
Consuming the low-level API in different abstractions, and building applications, should be done on top of dpdk.git.
Quoted 11 lines · Jerin Jacob
Quoted 2 lines · Thomas Monjalon
Hi Jerin,
Hi Thomas,
Thanks for starting this discussion now. It is an interesting discussion. Some thoughts below.
We can decide based on community consensus and follow a single rule across the components.
Thomas,
No feedback yet on the below questions.
If there no consensus in the email, I would like to propose this topic to the 26th Feb TB meeting.
Quoted 82 lines
Quoted 6 lines
17/02/2020 08:19, Jerin Jacob:
Quoted 3 lines
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Quoted 8 lines
Quoted 2 lines
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
In the context of Graph library, it is a framework, not using any of the substem API
other than EAL and it is underlib/librte_graph.
Nodes library using graph and other subsystem components such as ethdev and it is underlib/lib_node/Another interesting question would what would be an issue in DPDK supporting beyond L2. Or higher level protocols?
Quoted 1 line
2/ there can be different solutions in this layer
Is there any issue with that?
There is overlap with the distributor library and eventdev as well. ethdev and SW traffic manager libraries as well. That list goes on.Quoted 7 lines
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.I believe it is time to move
rte_pipeline(Packet Framework) in a separate repository, and welcomerte_graphas well in another separate repository.What would be gain out of this?
My concerns are:
# Like packet-gen, The new code will be filled with unnecessary DPDK version checks
and unnecessary compatibility issues.
# Anything is not in main dpdk repo, it is a second class citizen. # Customer has the pain to use two repos and two releases. Internally, it can be two different
repo but release needs to go through one repo.If we are focusing ONLY on the driver API then how can DPDK grow further? If linux kernel
would be thought only have just the kernel and networking/storage as different repo it would
not have grown up?What is the real concern? Maintenance?
Quoted 2 lines
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
The nodes can be vendor-specific to optimize the specific use cases. As I mentioned in the cover letter,
"
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.
"Thoughts from other folks?
Quoted 4 lines
Consuming the low-level API in different abstractions, and building applications, should be done on top of dpdk.git.
21/02/2020 11:30, Jerin Jacob:
Quoted 10 lines · Jerin Jacob
Quoted 5 lines · Thomas Monjalon
Thanks for starting this discussion now. It is an interesting discussion. Some thoughts below.
We can decide based on community consensus and follow a single rule across the components.Thomas,
No feedback yet on the below questions.
Indeed. I was waiting for opininons from others.
Quoted 2 lines
If there no consensus in the email, I would like to propose this topic to the 26th Feb TB meeting.
I gave my opinion below.
If a consensus cannot be reached, I agree with the request to the techboard.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
17/02/2020 08:19, Jerin Jacob:
Quoted 5 lines
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
Hardware devices can offload protocol processing higher than L2, so L2 does not look to be a good limit from my point of view.
Quoted 9 lines
Quoted 9 lines
In the context of Graph library, it is a framework, not using any of the substem API
other than EAL and it is underlib/librte_graph.
Nodes library using graph and other subsystem components such as ethdev and it is underlib/lib_node/Another interesting question would what would be an issue in DPDK supporting beyond L2. Or higher level protocols?
Definitely higher than L2 is OK in DPDK as long as it is related to hardware capabilities, not software stack (which can be a DPDK application).
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
2/ there can be different solutions in this layer
Is there any issue with that?
There is overlap with the distributor library and eventdev as well. ethdev and SW traffic manager libraries as well. That list goes on.
I don't know how much it is an issue.
But I think it shows that at least one implementation is not generic enough.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.I believe it is time to move
rte_pipeline(Packet Framework) in a separate repository, and welcomerte_graphas well in another separate repository.What would be gain out of this?
The gain is to be clear about what should be the focus for contributors working on the main DPDK repository.
What is expected to be maintained, tested, etc.
Quoted 9 lines
Quoted 9 lines
My concerns are:
# Like packet-gen, The new code will be filled with unnecessary DPDK version checks
and unnecessary compatibility issues.
# Anything is not in main dpdk repo, it is a second class citizen. # Customer has the pain to use two repos and two releases. Internally, it can be two different
repo but release needs to go through one repo.
Quoted 5 lines
Quoted 5 lines
If we are focusing ONLY on the driver API then how can DPDK grow further? If linux kernel
would be thought only have just the kernel and networking/storage as different repo it would
not have grown up?
Linux kernel is selecting what can enter in the focus or not. And I wonder what is the desire of extending/growing the scope of a library?
Quoted 21 lines
Quoted 21 lines
What is the real concern? Maintenance?
Quoted 2 lines
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
The nodes can be vendor-specific to optimize the specific use cases. As I mentioned in the cover letter,
"
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.
"Thoughts from other folks?
Quoted 2 lines
Consuming the low-level API in different abstractions, and building applications, should be done on top of dpdk.git.
Quoted 26 lines · Thomas Monjalon
21/02/2020 11:30, Jerin Jacob:
Quoted 9 lines · Jerin Jacob
Quoted 5 lines · Thomas Monjalon
Thanks for starting this discussion now. It is an interesting discussion. Some thoughts below.
We can decide based on community consensus and follow a single rule across the components.Thomas,
No feedback yet on the below questions.
Indeed. I was waiting for opininons from others.
Quoted 2 lines
If there no consensus in the email, I would like to propose this topic to the 26th Feb TB meeting.
I gave my opinion below.
If a consensus cannot be reached, I agree with the request to the techboard.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
17/02/2020 08:19, Jerin Jacob:
Quoted 5 lines
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
If we add
rte_graphto DPDK, we will have 2 similar libraries.
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
Hardware devices can offload protocol processing higher than L2, so L2 does not look to be a good limit from my point of view.
If you assume the capability of networking hardware will grow, and you want to unify different networking hardware with varying capabilities (and also include software-only implementations) under one API, then you might well end up growing DPDK into the software stack you mention below. Soft implementations of complex protocols will require operating system-like support services like timers, RCU, various lock-less data structures, deferred work mechanism, counter handling frameworks, control plane interfaces, etc. Coupling should always be avoided of course, but DPDK would inevitably no longer be a pick-and-choose smörgåsbord library - at least as long as the consumer wants to utilize this higher-layer functionality.
This would make DPDK more of a packet processing run-time or a special-purpose, networking operating system than the "a bunch of Ethernet drivers in user space" as it started out as.
I'm not saying that's a bad thing. In fact, I think it sounds like an interesting option, although also a very challenging one. From what I can see, DPDK has already set out along this route already. If this is a conscious decision or not, I don't know. Add to this, if Linux expands further with AF_XDP-like features, beyond simply packet I/O, it might not only try to take over DPDK's original concerns, but also more of the current ones.
Quoted 73 lines
Quoted 9 lines
Quoted 9 lines
In the context of Graph library, it is a framework, not using any of the substem API
other than EAL and it is underlib/librte_graph.
Nodes library using graph and other subsystem components such as ethdev and it is underlib/lib_node/Another interesting question would what would be an issue in DPDK supporting beyond L2. Or higher level protocols?
Definitely higher than L2 is OK in DPDK as long as it is related to hardware capabilities, not software stack (which can be a DPDK application).
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
2/ there can be different solutions in this layer
Is there any issue with that?
There is overlap with the distributor library and eventdev as well. ethdev and SW traffic manager libraries as well. That list goes on.I don't know how much it is an issue.
But I think it shows that at least one implementation is not generic enough.Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.I believe it is time to move
rte_pipeline(Packet Framework) in a separate repository, and welcomerte_graphas well in another separate repository.What would be gain out of this?
The gain is to be clear about what should be the focus for contributors working on the main DPDK repository.
What is expected to be maintained, tested, etc.Quoted 9 lines
Quoted 9 lines
My concerns are:
# Like packet-gen, The new code will be filled with unnecessary DPDK version checks
and unnecessary compatibility issues.
# Anything is not in main dpdk repo, it is a second class citizen. # Customer has the pain to use two repos and two releases. Internally, it can be two different
repo but release needs to go through one repo.Quoted 5 lines
Quoted 5 lines
If we are focusing ONLY on the driver API then how can DPDK grow further? If linux kernel
would be thought only have just the kernel and networking/storage as different repo it would
not have grown up?Linux kernel is selecting what can enter in the focus or not. And I wonder what is the desire of extending/growing the scope of a library?
Quoted 20 lines
Quoted 20 lines
What is the real concern? Maintenance?
Quoted 2 lines
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
The nodes can be vendor-specific to optimize the specific use cases. As I mentioned in the cover letter,
"
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.
"Thoughts from other folks?
Quoted 2 lines
Consuming the low-level API in different abstractions, and building applications, should be done on top of dpdk.git.
I can share a data-point with respect to constructing a reasonably functional network stack. Original work on the project which eventually became fd.io vpp started in 2002. I've worked on the vpp code base full-time for 18 years.
In terms of lines of code: the vpp graph subsystem is a minuscule fraction of the project as a whole. We've rewritten performance-critical bits of the vpp netstack multiple times.
FWIW... Dave
-----Original Message-----
From: Mattias Rönnblom <[email protected]>
Sent: Friday, February 21, 2020 10:39 AM
To: Thomas Monjalon <[email protected]>; Jerin Jacob <[email protected]>
Cc: Jerin Jacob <[email protected]>; Ray Kinsella <[email protected]>; dpdk-dev <[email protected]>; Prasun Kapoor <[email protected]>; Nithin Dabilpuram <[email protected]>; Kiran Kumar K <[email protected]>; Pavan Nikhilesh <[email protected]>; Narayana Prasad <[email protected]>; [email protected]; [email protected]; Honnappa Nagarahalli <[email protected]>; David Marchand <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Ajit Khaparde <[email protected]>; Ye, Xiaolong <[email protected]>; Raslan Darawsheh <[email protected]>; Maxime Coquelin <[email protected]>; Akhil Goyal <[email protected]>; Cristian Dumitrescu <[email protected]>; John McNamara <[email protected]>; Richardson, Bruce <[email protected]>; Anatoly Burakov <[email protected]>; Gavin Hu <[email protected]>; David Christensen <[email protected]>; Ananyev, Konstantin <[email protected]>; Pallavi Kadam <[email protected]>; Olivier Matz <[email protected]>; Gage Eads <[email protected]>; Rao, Nikhil <[email protected]>; Erik Gabriel Carrillo <[email protected]>; Hemant Agrawal <[email protected]>; Artem V. Andreev <[email protected]>; Stephen Hemminger <[email protected]>; Shahaf Shuler <[email protected]>; Wiles, Keith <[email protected]>; Jasvinder Singh <[email protected]>; Vladimir Medvedkin <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/5] graph: introduce graph subsystem
Quoted 26 lines · Thomas Monjalon
21/02/2020 11:30, Jerin Jacob:
Quoted 9 lines · Jerin Jacob
Quoted 5 lines · Thomas Monjalon
Thanks for starting this discussion now. It is an interesting discussion. Some thoughts below.
We can decide based on community consensus and follow a single rule across the components.Thomas,
No feedback yet on the below questions.
Indeed. I was waiting for opininons from others.
Quoted 2 lines
If there no consensus in the email, I would like to propose this topic to the 26th Feb TB meeting.
I gave my opinion below.
If a consensus cannot be reached, I agree with the request to the techboard.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
17/02/2020 08:19, Jerin Jacob:
Quoted 5 lines
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
If we add
rte_graphto DPDK, we will have 2 similar libraries.
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
Hardware devices can offload protocol processing higher than L2, so L2 does not look to be a good limit from my point of view.
If you assume the capability of networking hardware will grow, and you want to unify different networking hardware with varying capabilities (and also include software-only implementations) under one API, then you might well end up growing DPDK into the software stack you mention below. Soft implementations of complex protocols will require operating system-like support services like timers, RCU, various lock-less data structures, deferred work mechanism, counter handling frameworks, control plane interfaces, etc. Coupling should always be avoided of course, but DPDK would inevitably no longer be a pick-and-choose smörgåsbord library - at least as long as the consumer wants to utilize this higher-layer functionality.
This would make DPDK more of a packet processing run-time or a special-purpose, networking operating system than the "a bunch of Ethernet drivers in user space" as it started out as.
I'm not saying that's a bad thing. In fact, I think it sounds like an interesting option, although also a very challenging one. From what I can see, DPDK has already set out along this route already. If this is a conscious decision or not, I don't know. Add to this, if Linux expands further with AF_XDP-like features, beyond simply packet I/O, it might not only try to take over DPDK's original concerns, but also more of the current ones.
Quoted 69 lines
Quoted 8 lines
Quoted 8 lines
In the context of Graph library, it is a framework, not using any of the substem API other than EAL and it is under
lib/librte_graph. Nodes library using graph and other subsystem components such as ethdev and it is underlib/lib_node/Another interesting question would what would be an issue in DPDK supporting beyond L2. Or higher level protocols?
Definitely higher than L2 is OK in DPDK as long as it is related to hardware capabilities, not software stack (which can be a DPDK application).
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
2/ there can be different solutions in this layer
Is there any issue with that?
There is overlap with the distributor library and eventdev as well. ethdev and SW traffic manager libraries as well. That list goes on.I don't know how much it is an issue.
But I think it shows that at least one implementation is not generic enough.Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.I believe it is time to move
rte_pipeline(Packet Framework) in a separate repository, and welcomerte_graphas well in another separate repository.What would be gain out of this?
The gain is to be clear about what should be the focus for contributors working on the main DPDK repository. What is expected to be maintained, tested, etc.
Quoted 11 lines
Quoted 11 lines
My concerns are:
# Like packet-gen, The new code will be filled with unnecessary DPDK version checks and unnecessary compatibility issues.
# Anything is not in main dpdk repo, it is a second class citizen. # Customer has the pain to use two repos and two releases. Internally, it can be two different repo but release needs to go through one repo.If we are focusing ONLY on the driver API then how can DPDK grow further? If linux kernel would be thought only have just the kernel and networking/storage as different repo it would not have grown up?
Linux kernel is selecting what can enter in the focus or not. And I wonder what is the desire of extending/growing the scope of a library?
Quoted 20 lines
Quoted 20 lines
What is the real concern? Maintenance?
Quoted 2 lines
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
The nodes can be vendor-specific to optimize the specific use cases. As I mentioned in the cover letter,
"
2) Based on our experience, NPU HW accelerates are so different than
one vendor to another vendor. Going forward, We believe, API
abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed. This would help both the silicon vendors and DPDK end users.
"Thoughts from other folks?
Quoted 2 lines
Consuming the low-level API in different abstractions, and building applications, should be done on top of dpdk.git.
21/02/2020 16:53, [email protected]:
Quoted 3 lines
I can share a data-point with respect to constructing a reasonably functional network stack. Original work on the project which eventually became fd.io vpp started in 2002. I've worked on the vpp code base full-time for 18 years.
In terms of lines of code: the vpp graph subsystem is a minuscule fraction of the project as a whole. We've rewritten performance-critical bits of the vpp netstack multiple times.
Please could you elaborate?
It would be nice to read more about your thoughts and experience.
Quoted 9 lines · Thomas Monjalon
21/02/2020 11:30, Jerin Jacob:
Quoted 7 lines · Jerin Jacob
Quoted 5 lines · Thomas Monjalon
Thanks for starting this discussion now. It is an interesting discussion. Some thoughts below.
We can decide based on community consensus and follow a single rule across the components.
Quoted 5 lines
Quoted 3 lines
Thomas,
No feedback yet on the below questions.
Indeed. I was waiting for opininons from others.
Me too.
Quoted 6 lines
Quoted 3 lines
If there no consensus in the email, I would like to propose this topic to the 26th Feb TB meeting.
I gave my opinion below.
If a consensus cannot be reached, I agree with the request to the techboard.
OK.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
17/02/2020 08:19, Jerin Jacob:
Quoted 5 lines
I got initial comments from Ray and Stephen on this RFC[1]. Thanks for the comments.
Is anyone else planning to have an architecture level or API usage level review or any review of other top-level aspects?
If we add
rte_graphto DPDK, we will have 2 similar libraries.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
We need to define SIMD optimization(not HW specific to but architecture-specific)
treatment as well, as the graph and node library will have SIMD optimization as well.
In general, by the above policy enforced, we need to split DPDK like below, dpdk.git
----------librte_compressdevlibrte_bbdevlibrte_eventdevlibrte_pcilibrte_rawdevlibrte_eallibrte_securitylibrte_mempoollibrte_mbuflibrte_cryptodevlibrte_ethdev
other repo(s).
----------------librte_cmdlinelibrte_cfgfilelibrte_bitratestatslibrte_efdlibrte_latencystatslibrte_kvargslibrte_jobstatslibrte_gsolibrte_grolibrte_flow_classifylibrte_pipelinelibrte_netlibrte_metricslibrte_meterlibrte_memberlibrte_tablelibrte_stacklibrte_schedlibrte_riblibrte_reorderlibrte_rculibrte_powerlibrte_distributorlibrte_bpflibrte_ip_fraglibrte_hashlibrte_fiblibrte_timerlibrte_telemetrylibrte_portlibrte_pdumplibrte_knilibrte_acllibrte_vhostlibrte_ringlibrte_lpmlibrte_ipsec
Quoted 2 lines
Hardware devices can offload protocol processing higher than L2, so L2 does not look to be a good limit from my point of view.
The node may use HW specific optimization if needed.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
In the context of Graph library, it is a framework, not using any of the substem API
other than EAL and it is underlib/librte_graph.
Nodes library using graph and other subsystem components such as ethdev and it is underlib/lib_node/
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Another interesting question would what would be an issue in DPDK supporting beyond L2. Or higher level protocols?
Definitely higher than L2 is OK in DPDK as long as it is related to hardware capabilities, not software stack (which can be a DPDK application).
The software stack is a vague term. librte_ipsec could be a software stack.
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
2/ there can be different solutions in this layer
Is there any issue with that?
There is overlap with the distributor library and eventdev as well. ethdev and SW traffic manager libraries as well. That list goes on.I don't know how much it is an issue.
But I think it shows that at least one implementation is not generic enough.
I don't think, distributor lies there because of eventdev is not generic. In fact, SW traffic manager is hooked to ethdev as well. It can work as both.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
I believe it is time to move
rte_pipeline(Packet Framework) in a separate repository, and welcomerte_graphas well in another separate repository.What would be gain out of this?
The gain is to be clear about what should be the focus for contributors working on the main DPDK repository.
Not sure how it can defocus if there is another code in the repo. If that case, the Linux kernel is not focused at all.
Quoted 1 line
What is expected to be maintained, tested, etc.
We need to maintain and test other code in OTHER dpdk repo as well.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
My concerns are:
# Like packet-gen, The new code will be filled with unnecessary DPDK version checks
and unnecessary compatibility issues.
# Anything is not in main dpdk repo, it is a second class citizen. # Customer has the pain to use two repos and two releases. Internally, it can be two different
repo but release needs to go through one repo.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
If we are focusing ONLY on the driver API then how can DPDK grow further? If linux kernel
would be thought only have just the kernel and networking/storage as different repo it would
not have grown up?Linux kernel is selecting what can enter in the focus or not.
Sorry. This sentence is not very clear to me.
Quoted 1 line
And I wonder what is the desire of extending/growing the scope of a library?
If the HW/Arch accelerated packet processing in the scope of DPDK this library shall
come to that.
IMO, As long as there is maintainer, who can give pull request in time and contribute to
the technical decision of the specific library, I think, that should be enough to add in dpdk.git.
IMO, we can not get away from more contribution to dpdk. Assume, some set of library goto pulled out main dpdk.git for some reason. One can still make new releases say "dpdk-next" to including dpdk,git and various libraries. Is that something, we are looking to enable as an end solution for distros and/or
end-users.
Quoted 26 lines
Quoted 23 lines
Quoted 23 lines
What is the real concern? Maintenance?
Quoted 2 lines
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
The nodes can be vendor-specific to optimize the specific use cases. As I mentioned in the cover letter,
"
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.
"Thoughts from other folks?
Quoted 2 lines
Consuming the low-level API in different abstractions, and building applications, should be done on top of dpdk.git.
21/02/2020 16:56, Jerin Jacob:
Quoted 12 lines · Thomas Monjalon
Quoted 11 lines
21/02/2020 11:30, Jerin Jacob:
Quoted 9 lines · Jerin Jacob
Quoted 8 lines · Thomas Monjalon
Quoted 5 lines
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
Quoted 7 lines
Quoted 2 lines
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
We need to define SIMD optimization(not HW specific to but architecture-specific)
treatment as well, as the graph and node library will have SIMD optimization as well.
I think SIMD optimization is generic to any performance-related project, not specific to DPDK.
Quoted 46 lines
In general, by the above policy enforced, we need to split DPDK like below, dpdk.git
----------librte_compressdevlibrte_bbdevlibrte_eventdevlibrte_pcilibrte_rawdevlibrte_eallibrte_securitylibrte_mempoollibrte_mbuflibrte_cryptodevlibrte_ethdevother repo(s).
----------------librte_cmdlinelibrte_cfgfilelibrte_bitratestatslibrte_efdlibrte_latencystatslibrte_kvargslibrte_jobstatslibrte_gsolibrte_grolibrte_flow_classifylibrte_pipelinelibrte_netlibrte_metricslibrte_meterlibrte_memberlibrte_tablelibrte_stacklibrte_schedlibrte_riblibrte_reorderlibrte_rculibrte_powerlibrte_distributorlibrte_bpflibrte_ip_fraglibrte_hashlibrte_fiblibrte_timerlibrte_telemetry
Quoted 8 lines
librte_portlibrte_pdumplibrte_knilibrte_acllibrte_vhostlibrte_ringlibrte_lpmlibrte_ipsec
I think it is a fair conclusion of the scope I am arguing, yes.
Quoted 4 lines
Quoted 2 lines
Hardware devices can offload protocol processing higher than L2, so L2 does not look to be a good limit from my point of view.
The node may use HW specific optimization if needed.
That's an interesting argument.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
In the context of Graph library, it is a framework, not using any of the substem API
other than EAL and it is underlib/librte_graph.
Nodes library using graph and other subsystem components such as ethdev and it is underlib/lib_node/
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Another interesting question would what would be an issue in DPDK supporting beyond L2. Or higher level protocols?
Definitely higher than L2 is OK in DPDK as long as it is related to hardware capabilities, not software stack (which can be a DPDK application).
The software stack is a vague term.
librte_ipseccould be a software stack.
I agree.
Quoted 20 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
2/ there can be different solutions in this layer
Is there any issue with that?
There is overlap with the distributor library and eventdev as well. ethdev and SW traffic manager libraries as well. That list goes on.I don't know how much it is an issue.
But I think it shows that at least one implementation is not generic enough.I don't think, distributor lies there because of eventdev is not generic. In fact, SW traffic manager is hooked to ethdev as well. It can work as both.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
I think 1/ was commonly agreed in the community.
Now we see one more proof of the reason 2/.I believe it is time to move
rte_pipeline(Packet Framework) in a separate repository, and welcomerte_graphas well in another separate repository.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
What would be gain out of this?
The gain is to be clear about what should be the focus for contributors working on the main DPDK repository.
Not sure how it can defocus if there is another code in the repo. If that case, the Linux kernel is not focused at all.
I see your point.
Quoted 3 lines
Quoted 1 line
What is expected to be maintained, tested, etc.
We need to maintain and test other code in OTHER dpdk repo as well.
Yes but the ones responsible are not the same.
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 14 lines
My concerns are:
# Like packet-gen, The new code will be filled with unnecessary DPDK version checks
and unnecessary compatibility issues.
# Anything is not in main dpdk repo, it is a second class citizen. # Customer has the pain to use two repos and two releases. Internally, it can be two different
repo but release needs to go through one repo.If we are focusing ONLY on the driver API then how can DPDK grow further? If linux kernel
would be thought only have just the kernel and networking/storage as different repo it would
not have grown up?
Quoted 3 lines
Quoted 1 line
Linux kernel is selecting what can enter in the focus or not.
Sorry. This sentence is not very clear to me.
I mean not everything proposed to Linux community is merged.
Quoted 10 lines
Quoted 1 line
And I wonder what is the desire of extending/growing the scope of a library?
If the HW/Arch accelerated packet processing in the scope of DPDK this library shall
come to that.IMO, As long as there is maintainer, who can give pull request in time and contribute to
the technical decision of the specific library, I think, that should be enough to add in dpdk.git.
Yes, that's fair.
Quoted 29 lines
IMO, we can not get away from more contribution to dpdk. Assume, some set of library goto pulled out main dpdk.git for some reason. One can still make new releases say "dpdk-next" to including dpdk,git and various libraries. Is that something, we are looking to enable as an end solution for distros and/or
end-users.Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
What is the real concern? Maintenance?
Quoted 2 lines
I think the original DPDK repository should focus on low-level features which offer hardware offloads and optimizations.
The nodes can be vendor-specific to optimize the specific use cases. As I mentioned in the cover letter,
"
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed.
This would help both the silicon vendors and DPDK end users.
"Thoughts from other folks?
Quoted 2 lines
Consuming the low-level API in different abstractions, and building applications, should be done on top of dpdk.git.
Quoted 81 lines · Thomas Monjalon
21/02/2020 16:56, Jerin Jacob:
Quoted 12 lines · Thomas Monjalon
Quoted 11 lines
21/02/2020 11:30, Jerin Jacob:
Quoted 9 lines · Jerin Jacob
Quoted 8 lines · Thomas Monjalon
Quoted 5 lines
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
Quoted 7 lines
Quoted 2 lines
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
We need to define SIMD optimization(not HW specific to but architecture-specific)
treatment as well, as the graph and node library will have SIMD optimization as well.I think SIMD optimization is generic to any performance-related project, not specific to DPDK.
Quoted 46 lines
In general, by the above policy enforced, we need to split DPDK like below, dpdk.git
----------librte_compressdevlibrte_bbdevlibrte_eventdevlibrte_pcilibrte_rawdevlibrte_eallibrte_securitylibrte_mempoollibrte_mbuflibrte_cryptodevlibrte_ethdevother repo(s).
----------------librte_cmdlinelibrte_cfgfilelibrte_bitratestatslibrte_efdlibrte_latencystatslibrte_kvargslibrte_jobstatslibrte_gsolibrte_grolibrte_flow_classifylibrte_pipelinelibrte_netlibrte_metricslibrte_meterlibrte_memberlibrte_tablelibrte_stacklibrte_schedlibrte_riblibrte_reorderlibrte_rculibrte_powerlibrte_distributorlibrte_bpflibrte_ip_fraglibrte_hashlibrte_fiblibrte_timerlibrte_telemetryQuoted 8 lines
librte_portlibrte_pdumplibrte_knilibrte_acllibrte_vhostlibrte_ringlibrte_lpmlibrte_ipsec
Quoted 1 line
I think it is a fair conclusion of the scope I am arguing, yes.
OK. See below.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
What is expected to be maintained, tested, etc.
We need to maintain and test other code in OTHER dpdk repo as well.
Yes but the ones responsible are not the same.
I see your point. Can I interpret it as you would like to NOT take responsibility
of SW libraries(Items enumerated in the second list)?
I think, the main question would be, how it will deliver to distros and/or end-users
and what will be part of the dpdk release?
I can think of two options. Maybe distro folks have better view on this.
options 1:
- Split dpdk to dpdk-core.git, dpdk-algo.git etc based on the functionalities and maintainer's availability.
- Follow existing release cadence and deliver single release tarball with content from the above repos.
options 2:
- Introduce more subtrees(dpdk-next-algo.git etc) based on the functionalities and maintainer's availability.
- Follow existing release cadence and have a pull request to main dpdk.git just like Linux kernel or existing scheme of things.
I am for option 2.
NOTE: This new graph and node library, I would like to make its new subtree in the existing scheme of
things so that it will NOT be a burden for you to manage.
22/02/2020 10:05, Jerin Jacob:
Quoted 87 lines · Thomas Monjalon
Quoted 80 lines
21/02/2020 16:56, Jerin Jacob:
Quoted 12 lines · Thomas Monjalon
Quoted 11 lines
21/02/2020 11:30, Jerin Jacob:
Quoted 9 lines · Jerin Jacob
Quoted 8 lines · Thomas Monjalon
Quoted 5 lines
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
Quoted 7 lines
Quoted 2 lines
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
We need to define SIMD optimization(not HW specific to but architecture-specific)
treatment as well, as the graph and node library will have SIMD optimization as well.I think SIMD optimization is generic to any performance-related project, not specific to DPDK.
Quoted 46 lines
In general, by the above policy enforced, we need to split DPDK like below, dpdk.git
----------librte_compressdevlibrte_bbdevlibrte_eventdevlibrte_pcilibrte_rawdevlibrte_eallibrte_securitylibrte_mempoollibrte_mbuflibrte_cryptodevlibrte_ethdevother repo(s).
----------------librte_cmdlinelibrte_cfgfilelibrte_bitratestatslibrte_efdlibrte_latencystatslibrte_kvargslibrte_jobstatslibrte_gsolibrte_grolibrte_flow_classifylibrte_pipelinelibrte_netlibrte_metricslibrte_meterlibrte_memberlibrte_tablelibrte_stacklibrte_schedlibrte_riblibrte_reorderlibrte_rculibrte_powerlibrte_distributorlibrte_bpflibrte_ip_fraglibrte_hashlibrte_fiblibrte_timerlibrte_telemetryQuoted 8 lines
librte_portlibrte_pdumplibrte_knilibrte_acllibrte_vhostlibrte_ringlibrte_lpmlibrte_ipsecQuoted 1 line
I think it is a fair conclusion of the scope I am arguing, yes.
OK. See below.
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
What is expected to be maintained, tested, etc.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
We need to maintain and test other code in OTHER dpdk repo as well.
Yes but the ones responsible are not the same.
I see your point. Can I interpret it as you would like to NOT take responsibility
of SW libraries(Items enumerated in the second list)?
It's not only about me. This is a community decision.
Quoted 18 lines
I think, the main question would be, how it will deliver to distros and/or end-users
and what will be part of the dpdk release?I can think of two options. Maybe distro folks have better view on this.
options 1:
- Split dpdk to dpdk-core.git, dpdk-algo.git etc based on the functionalities and maintainer's availability.
- Follow existing release cadence and deliver single release tarball with content from the above repos.options 2:
- Introduce more subtrees(dpdk-next-algo.git etc) based on the functionalities and maintainer's availability.
- Follow existing release cadence and have a pull request to main dpdk.git just like Linux kernel or existing scheme of things.
Quoted 5 lines
I am for option 2.
NOTE: This new graph and node library, I would like to make its new subtree in the existing scheme of
things so that it will NOT be a burden for you to manage.
The option 2 is to make maintainers life easier. Keeping all libraries in the same repository allows to have an unique release and a central place for the apps and docs.
The option 1 may make contributors life easier if we consider
adding new libraries can make contributions harder in case of dependencies. The option 1 makes also repositories smaller, so maybe easier to approach. It makes easier to fully validate testing and quality of a repository. Having separate packages makes easier to select what is distributed and supported.
After years thinking about the scope of DPDK repository, I am still not sure which solution is best.
I really would like to see more opinions, thanks.
Quoted 91 lines · Thomas Monjalon
22/02/2020 10:05, Jerin Jacob:
Quoted 89 lines · Thomas Monjalon
Quoted 80 lines
21/02/2020 16:56, Jerin Jacob:
Quoted 12 lines · Thomas Monjalon
Quoted 11 lines
21/02/2020 11:30, Jerin Jacob:
Quoted 9 lines · Jerin Jacob
Quoted 8 lines · Thomas Monjalon
Quoted 5 lines
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
Quoted 7 lines
Quoted 2 lines
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
We need to define SIMD optimization(not HW specific to but architecture-specific)
treatment as well, as the graph and node library will have SIMD optimization as well.I think SIMD optimization is generic to any performance-related project, not specific to DPDK.
Quoted 46 lines
In general, by the above policy enforced, we need to split DPDK like below, dpdk.git
----------librte_compressdevlibrte_bbdevlibrte_eventdevlibrte_pcilibrte_rawdevlibrte_eallibrte_securitylibrte_mempoollibrte_mbuflibrte_cryptodevlibrte_ethdevother repo(s).
----------------librte_cmdlinelibrte_cfgfilelibrte_bitratestatslibrte_efdlibrte_latencystatslibrte_kvargslibrte_jobstatslibrte_gsolibrte_grolibrte_flow_classifylibrte_pipelinelibrte_netlibrte_metricslibrte_meterlibrte_memberlibrte_tablelibrte_stacklibrte_schedlibrte_riblibrte_reorderlibrte_rculibrte_powerlibrte_distributorlibrte_bpflibrte_ip_fraglibrte_hashlibrte_fiblibrte_timerlibrte_telemetryQuoted 8 lines
librte_portlibrte_pdumplibrte_knilibrte_acllibrte_vhostlibrte_ringlibrte_lpmlibrte_ipsecQuoted 1 line
I think it is a fair conclusion of the scope I am arguing, yes.
OK. See below.
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
What is expected to be maintained, tested, etc.
We need to maintain and test other code in OTHER dpdk repo as well.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Yes but the ones responsible are not the same.
I see your point. Can I interpret it as you would like to NOT take responsibility
of SW libraries(Items enumerated in the second list)?It's not only about me. This is a community decision.
OK. Let wait for community feedback.
Probably we discuss more in public TB meeting in 26th Feb.
Quoted 30 lines
Quoted 20 lines
I think, the main question would be, how it will deliver to distros and/or end-users
and what will be part of the dpdk release?I can think of two options. Maybe distro folks have better view on this.
options 1:
- Split dpdk to dpdk-core.git, dpdk-algo.git etc based on the functionalities and maintainer's availability.
- Follow existing release cadence and deliver single release tarball with content from the above repos.options 2:
- Introduce more subtrees(dpdk-next-algo.git etc) based on the functionalities and maintainer's availability.
- Follow existing release cadence and have a pull request to main dpdk.git just like Linux kernel or existing scheme of things.Quoted 5 lines
I am for option 2.
NOTE: This new graph and node library, I would like to make its new subtree in the existing scheme of
things so that it will NOT be a burden for you to manage.The option 2 is to make maintainers life easier. Keeping all libraries in the same repository allows to have an unique release and a central place for the apps and docs.
Quoted 5 lines
The option 1 may make contributors life easier if we consider
adding new libraries can make contributions harder in case of dependencies. The option 1 makes also repositories smaller, so maybe easier to approach. It makes easier to fully validate testing and quality of a repository. Having separate packages makes easier to select what is distributed and supported.
If the final dpdk release tarball looks same for option1 and option2 then I think,
option 1 is overhead to manage intra repo dependency.
I agree with Thomas, it is better to decide as a community what direction we need
to take and align existing and new libraries with that scheme.
Quoted 4 lines
After years thinking about the scope of DPDK repository, I am still not sure which solution is best.
I really would like to see more opinions, thanks.
Yes.
Quoted 2 lines
Quoted 139 lines · Jerin Jacob
Quoted 91 lines · Thomas Monjalon
22/02/2020 10:05, Jerin Jacob:
Quoted 89 lines · Thomas Monjalon
Quoted 80 lines
21/02/2020 16:56, Jerin Jacob:
Quoted 12 lines · Thomas Monjalon
Quoted 11 lines
21/02/2020 11:30, Jerin Jacob:
Quoted 9 lines · Jerin Jacob
Quoted 8 lines · Thomas Monjalon
Quoted 5 lines
If we add
rte_graphto DPDK, we will have 2 similar libraries.I already proposed several times to move
rte_pipelinein a separate repository for two reasons:
1/ it is acting at a higher API layer levelWe need to define what is the higher layer API. Is it processing beyond L2?
Quoted 7 lines
Quoted 2 lines
My opinion is that any API which is implemented differently for different hardware should be in DPDK.
We need to define SIMD optimization(not HW specific to but architecture-specific)
treatment as well, as the graph and node library will have SIMD optimization as well.I think SIMD optimization is generic to any performance-related project, not specific to DPDK.
Quoted 46 lines
In general, by the above policy enforced, we need to split DPDK like below, dpdk.git
----------librte_compressdevlibrte_bbdevlibrte_eventdevlibrte_pcilibrte_rawdevlibrte_eallibrte_securitylibrte_mempoollibrte_mbuflibrte_cryptodevlibrte_ethdevother repo(s).
----------------librte_cmdlinelibrte_cfgfilelibrte_bitratestatslibrte_efdlibrte_latencystatslibrte_kvargslibrte_jobstatslibrte_gsolibrte_grolibrte_flow_classifylibrte_pipelinelibrte_netlibrte_metricslibrte_meterlibrte_memberlibrte_tablelibrte_stacklibrte_schedlibrte_riblibrte_reorderlibrte_rculibrte_powerlibrte_distributorlibrte_bpflibrte_ip_fraglibrte_hashlibrte_fiblibrte_timerlibrte_telemetryQuoted 8 lines
librte_portlibrte_pdumplibrte_knilibrte_acllibrte_vhostlibrte_ringlibrte_lpmlibrte_ipsecQuoted 1 line
I think it is a fair conclusion of the scope I am arguing, yes.
OK. See below.
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
What is expected to be maintained, tested, etc.
We need to maintain and test other code in OTHER dpdk repo as well.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Yes but the ones responsible are not the same.
I see your point. Can I interpret it as you would like to NOT take responsibility
of SW libraries(Items enumerated in the second list)?It's not only about me. This is a community decision.
OK. Let wait for community feedback.
Probably we discuss more in public TB meeting in 26th Feb.Quoted 30 lines
Quoted 20 lines
I think, the main question would be, how it will deliver to distros and/or end-users
and what will be part of the dpdk release?I can think of two options. Maybe distro folks have better view on this.
options 1:
- Split dpdk to dpdk-core.git, dpdk-algo.git etc based on the functionalities and maintainer's availability.
- Follow existing release cadence and deliver single release tarball with content from the above repos.options 2:
- Introduce more subtrees(dpdk-next-algo.git etc) based on the functionalities and maintainer's availability.
- Follow existing release cadence and have a pull request to main dpdk.git just like Linux kernel or existing scheme of things.Quoted 5 lines
I am for option 2.
NOTE: This new graph and node library, I would like to make its new subtree in the existing scheme of
things so that it will NOT be a burden for you to manage.The option 2 is to make maintainers life easier. Keeping all libraries in the same repository allows to have an unique release and a central place for the apps and docs.
Quoted 5 lines
The option 1 may make contributors life easier if we consider
adding new libraries can make contributions harder in case of dependencies. The option 1 makes also repositories smaller, so maybe easier to approach. It makes easier to fully validate testing and quality of a repository. Having separate packages makes easier to select what is distributed and supported.
Quoted 8 lines
If the final dpdk release tarball looks same for option1 and option2 then I think,
option 1 is overhead to manage intra repo dependency.I agree with Thomas, it is better to decide as a community what direction we need
to take and align existing and new libraries with that scheme.
+1 to Option 2.
As Jerin points out, it has allowed other larger communities to scale effectively.
Quoted 10 lines
Quoted 5 lines
After years thinking about the scope of DPDK repository, I am still not sure which solution is best.
I really would like to see more opinions, thanks.Yes.
Quoted 2 lines
<snip>
Quoted 145 lines
From: Jerin Jacob <[email protected]>
This RFC is targeted for v20.05 release.
This RFC patch includes an implementation of graph architecture for packet processing using DPDK primitives.
Using graph traversal for packet processing is a proven architecture that has been implemented in various open source libraries.
Graph architecture for packet processing enables abstracting the data processing functions as “nodes” and “links” them together to create a complex “graph” to create reusable/modular data processing functions.
The RFC patch further includes performance enhancements and modularity to the DPDK as discussed in more detail below.
What this RFC patch contains:
-----------------------------
1) The API definition to "create" nodes and "link" together to create a "graph" for packet processing. See,lib/librte_graph/rte_graph.h2) The Fast path API definition for the graph walker and enqueue function used by the workers. See,
lib/librte_graph/rte_graph_worker.h3) Optimized SW implementation for (1) and (2). See,
lib/librte_graph/4) Test case to verify the graph infrastructure functionality See,
app/test/test_graph.c5) Performance test cases to evaluate the cost of graph walker and nodes enqueue fast-path function for various combinations.
See
app/test/test_graph_perf.c6) Packet processing
nodes(Null, Rx, Tx, Pkt drop, IPV4 rewrite, IPv4 lookup)using graph infrastructure. Seelib/librte_node/*7) An example application to showcase l3fwd (functionality same as existing examples/l3fwd) using graph infrastructure and use packets processing nodes (item (6)). See examples/l3fwd-graph/.
Performance
-----------
1) Graph walk and node enqueue overhead can be tested with performance test case application [1] # If all packets go from a node to another node (we call it as "homerun") then it will be just a pointer swap for a burst of packets. # In the worst case, a couple of handful cycles to move an object from a node to another node.2) Performance comparison with existing l3fwd (The complete static code with out any nodes) vs modular l3fwd-graph with 5 nodes (
ip4_lookup,ip4_rewrite,ethdev_tx,ethdev_rx,pkt_drop).
Here is graphical representation of the l3fwd-graph as Graphviz dot file:
http://bit.ly/39UPPGm# l3fwd-graph performance is -2.5% wrt static l3fwd.# We have simulated the similar test with existing
librte_pipelineapplication [4].ip_piplineapplication is -48.62% wrt static l3fwd.The above results are on octeontx2. It may vary on other platforms. The platforms with higher L1 and L2 caches will have further better performance.
Tested architectures:
--------------------
1) AArch64
2) X86Graph library Features
----------------------
1) Nodes as plugins
2) Support for out of tree nodes
3) Multi-process support.
4) Low overhead graph walk and node enqueue
5) Low overhead statistics collection infrastructure
6) Support to export the graph as a Graphviz dot file. Seerte_graph_export()
Example of exported graph: http://bit.ly/2PqbqOy
7) Allow having another graph walk implementation in the future by segregating the fast path and slow path code.Advantages of Graph architecture:
---------------------------------1) Memory latency is the enemy for high-speed packet processing, moving the similar packet processing code to a node will reduce the I cache and D caches misses.
2) Exploits the probability that most packets will follow the same nodes in the graph.
3) Allow SIMD instructions for packet processing of the node.
4) The modular scheme allows having reusable nodes for the consumers.
5) The modular scheme allows us to abstract the vendor HW specific optimizations as a node.What is different than existing libpipeline library
---------------------------------------------------
At a very high level, libpipeline created to allow modular plugin interface. Based on our analysis the performance is better in the graph model. Check the details under the Performance section, Item (2).This
rte_graphimplementation has taken care of fixing some of the architecture/implementations limitations with libpipeline.1) Use cases like IP fragmentation, TCP ACK processing (with new TCP data sent out in the same context) have a problem as
rte_pipeline_run()passes justpkt_maskof 64 bits to different tables and packet pointers are stored in the single array in structrte_pipeline_run.In Graph architecture, The node has complete control of how many packets are output to next node seamlessly.
2) Since pktmask is passed to different tables, it takes multiple for loops to extract pkts out of fragmented
pkts_mask. This makes it difficult to prefetch ahead a set of packets. This issue does not exist in Graph architecture.3) Every table have two/three function pointers unlike graph architecture that has a single function pointer for node.
4) The current libpipeline main fast-path function doesn't support tree-like topology where 64 packets can be redirected to 64 different tables. It is currently limited to table-based next table id instead of per-packet action based next table id. So in a typical case, we need to cascade tables and sequentially go through all the tables to reach the last table.
5)
pkt_masklimit is 64 bits which is the max burst size possible. The graph library supports up to 256.In short, both are significantly different architectures. Allowing the end-user to choose the model would be a more appropriate decision by keeping both in DPDK.
Why this RFC
------------
1) We believe, Graph architecture provides the best performance for reusable/modular packet processing framework.
Since DPDK does not have it, it is good to have it in DPDK.
Quoted 5 lines
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed. This would help both the silicon vendors and DPDK end users.
If you are proposing this as a new way to provide HW abstractions, then we will be restricting the application programming model to follow graph subsystem. IMO, the HW abstractions should be available irrespective of the programming model. Graph model of packet processing might not be applicable for all use cases.
Quoted 462 lines
3) The framework enables the protocol stack as use native mbuf for graph processing to avoid any conversion between the formats for better performance.
4) DPDK becomes the "goto library" for userspace HW acceleration. It is good to have native Graph packet processing library in DPDK.
5) Obviously, Our customers are interested in Graph library in DPDK :-)
Identified tweaking for better performance on different targets
---------------------------------------------------------------
1) Test with various burst size values (256, 128, 64, 32) usingCONFIG_RTE_GRAPH_BURST_SIZEconfig option.
Based on our testing, on x86 and arm64 servers, The sweet spot is 256 burst size.
While on arm64 embedded SoCs, it is either 64 or 128.2) Disable node statistics (use
CONFIG_RTE_LIBRTE_GRAPH_STATSconfig option) if not needed.3) Use arm64 optimized memory copy for arm64 architecture by selecting
CONFIG_RTE_ARCH_ARM64_MEMCPY.Commands to run tests
---------------------[1]
perf test:
echo "graph_perf_autotest" | sudo ./build/app/test/dpdk-test -c0x30[2]
functionality test:
echo "graph_autotest" | sudo ./build/app/test/dpdk-test -c0x30[3]
l3fwd-graph:
./l3fwd-graph -c0x100-- -p0x3--config="(0, 0, 8)" -P[4]
# ./ip_pipeline --c 0xff0000 -- -s route.cliRoute.cli: (Copy paste to the shell to avoid dos format issues)
https://pastebin.com/raw/B4Ktx7TT
Next steps
-----------------------------
1) Feedback from the community on the library.
2) Collect the API requirements from the community.
3) Sending the next version by addressing the community initial. feedback and fixing the following identified "pending items".Pending items (Will be addressed in next revision)
-------------------------------------------------
1) Add documentation as a patch
2) Add Doxygen API documentation
3) Split the patches at a more logical level for a better review.
4) code cleanup
5) more optimizations in the nodes and graph infrastructure.Programming guide and API walk-through
--------------------------------------
# Anatomy of Node:
~~~~~~~~~~~~~~~~~
See the
https://github.com/jerinjacobk/share/blob/master/Anatomy_of_a_node.svgThe above diagram depicts the anatomy of a node. The node is the basic building block of the graph framework.
A node consists of:
a)process():The callback function will be invoked by worker thread using
rte_graph_walk()function when there is data to be processed by the node. A graph node process the function usingprocess()and enqueue to next downstream node using rte_node_enqueue*() function.b) Context memory:
It is memory allocated by the library to store the node-specific context information. which will be used by
process(),init(),fini()callbacks.c)
init():The callback function which will be invoked by
rte_graph_create()on when a node gets attached to a graph.d)
fini():The callback function which will be invoked by
rte_graph_destroy()on when a node gets detached to a graph.e) Node name:
It is the name of the node. When a node registers to graph library, the library gives the ID as
rte_node_ttype. Both ID or Name shall be used lookup the node.rte_node_from_name(),rte_node_id_to_name()are the node lookup functions.f)
nb_edges:Number of downstream nodes connected to this node. The next_nodes[] stores the
downstream nodes objects.rte_node_edge_update()andrte_node_edge_shrink()
functions shall be used to update the next_node[] objects. Consumers of the node
APIs are free to update the next_node[] objects tillrte_graph_create()invoked.g) next_node[]:
The dynamic array to store the downstream nodes connected to this node.
# Node creation and registration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a) Node implementer creates the node by implementing ops and attributes of 'structrte_node_register'
b) The library registers the node by invokingRTE_NODE_REGISTERon library load
using the constructor scheme.
The constructor scheme used here to support multi-process.# Link the Nodes to create the graph topology
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See the
https://github.com/jerinjacobk/share/blob/master/Link_the_nodes.svgThe above diagram shows a graph topology after linking the N nodes.
Once nodes are available to the program, Application or node public API functions
can links them together to create a complex packet processing graph.There are multiple different types of strategies to link the nodes.
Method a) Provide the next_nodes[] at the node registration time. See 'struct
rte_node_register::nb_edges'. This is a use case to address the static
node scheme where one knows upfront the next_nodes[] of the node.Method b) Use
rte_node_edge_get(),rte_node_edge_update(),rte_node_edge_shrink()to
Update the next_nodes[] links for the node dynamically.Method c) Use
rte_node_clone()to clone a already existing node. Whenrte_node_clone()invoked, The library, would clone all the attributes of the node and creates a new one. The name for cloned node shall be "parent_node_name-user_provided_name". This method enables the use case of Rx and Tx
nodes where multiple of those nodes need to be cloned based on the number of CPU
available in the system. The cloned nodes will be identical, except the "context memory".
Context memory will have information of port, queue pair incase of Rx and Tx ethdev nodes.# Create the graph object
~~~~~~~~~~~~~~~~~~~~~~~~~
Now that the nodes are linked, Its time to create a graph by including the required nodes. The application can provide a set of node patterns to form a graph object.
Thefnmatch()API used underneath for the pattern matching to include the required nodes.The
rte_graph_create()API shall be used to create the graph.Example of a graph object creation:
{"
ethdev_rx_0_0", ipv4-*, ethdev_tx_0_*"}In the above example, A graph object will be created with ethdev Rx node of port 0 and queue 0, all ipv4* nodes in the system, and ethdev tx node of port 0 with all queues.
# Multi core graph processing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In the current graph library implementation, specifically,
rte_graph_walk()and rte_node_enqueue* fast path API functions are designed to work on single-core to have better performance. The fast path API works on graph object, So the multi-core graph processing strategy would be to create graph object PER WORKER.# In fast path:
~~~~~~~~~~~~~~~Typical fast-path code looks like below, where the application gets the fast-path graph object through
rte_graph_lookup()on the worker thread and run therte_graph_walk()in a tight loop.struct
rte_graph*graph =rte_graph_lookup("worker0");while (!done) { rte_graph_walk(graph); }# Context update when graph walk in action
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The fast-path object for the node is
struct rte_node.It may be possible that in slow-path or after the graph walk-in action, the user needs to update the context of the node hence access to struct
rte_node* memory.
rte_graph_foreach_node(),rte_graph_node_get(),rte_graph_node_get_by_name()
APIs can be used to to get the struct rte_node*.rte_graph_foreach_node()iterator
function works on structrte_graph* fast-path graph object while others works on graph ID or name.# Get the node statistics using graph cluster
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The user may need to know the aggregate stats of the node across multiple graph objects. Especially the situation where each graph object bound to a worker thread.
Introduced a graph cluster object for statistics.
rte_graph_cluster_stats_create()
shall be used for creating a graph cluster with multiple graph objects andrte_graph_cluster_stats_get()to get the aggregate node statistics.An example statistics output from
rte_graph_cluster_stats_get()+-----------+------------+-------------+---------------+------------+---------------+-----------+ |Node |calls |objs |realloc_count |objs/call |objs/sec(10E6) |cycles/call| +------------------------+-------------+---------------+------------+---------------+-----------+ |node0 |12977424 |3322220544 |5 |256.000 |3047.151872 |20.0000 | |node1 |12977653 |3322279168 |0 |256.000 |3047.210496 |17.0000 | |node2 |12977696 |3322290176 |0 |256.000 |3047.221504 |17.0000 | |node3 |12977734 |3322299904 |0 |256.000 |3047.231232 |17.0000 | |node4 |12977784 |3322312704 |1 |256.000 |3047.243776 |17.0000 | |node5 |12977825 |3322323200 |0 |256.000 |3047.254528 |17.0000 | +-----------+------------+-------------+---------------+------------+---------------+-----------+# Node writing guide lines
~~~~~~~~~~~~~~~~~~~~~~~~~~The
process()function of a node is fast-path function and that needs to be written
carefully to achieve max performance.Broadly speaking, there are two different types of nodes.
1) First kind of nodes are those that have a fixed next_nodes[] for the complete burst (like
ethdev_rx,ethdev_tx) and it is simple to write.Process()function can move the obj burst to the next node either usingrte_node_next_stream_move()or usingrte_node_next_stream_get()andrte_node_next_stream_put().2) The second kind of such node is
intermediate nodesthat decide what is the next_node[]
to send to on a per-packet basis. In these nodes,a) Firstly, there has to be the best possible packet processing logic.
b) Secondly, each packet needs to be queued to its next node.At least on some architectures, we get around ~10% more performance if we can avoid copying of
packet pointers from one node to next as it is ~=memcpy(BURST_SIZE x sizeof(void *))xNODE_COUNT.This can be avoided only in the case where all the packets are destined to the same
next node. We call this as home run case and we userte_node_next_stream_move()to
just move burst of object array by swapping the pointer. a.k.a move stream from one node to next node
with least number of cycles.Example of intermediate node implementation with home run:
a) Start with speculation thatnext_node=ctx->next_node.
This could be thenext_nodeapplication used in the previous function call of
this node.
b) Get thenext_nodestream array and space usingrte_node_next_stream_get(next_node, &space)
c) while space != 0 andn_pkts_left!= 0,
prefetch nextpkt_setand process currentpkt_setto find their next node
d) if all the next nodes of the currentpkt_setmatch speculated next node, just count them as successfullyspeculated(last_spec)till now and continue the loop without actually moving them to the next node. else if there is a mismatch,
copy all thepkt_setpointers that werelast_specand
move the currentpkt_setto their respective next's nodes usingrte_enqueue_next_x1(). Also one of thenext_nodecan be updated as speculatednext_nodeif it is more probable. Also setlast_spec= 0
e) ifn_pkts_left!= 0 and space != 0
goto c) as there is space in the speculatednext_node.
f) iflast_spec==n_pkts_left,
then we successfully speculated all the packets to right next node. Just callrte_node_next_stream_move(node, next_node)to just move the stream/obj array to next node. This is home run where we avoided memcpy of buffer pointers to next node.
g) if space = 0 andn_pkts_left!= 0
goto b)
h) Update thectx->next_nodewith more probable next node.# In-tree node documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a)librte_node/ethdev_rx.c:
This node doesrte_eth_rx_burst()into stream buffer acquired usingrte_node_next_stream_get()and doesrte_node_next_stream_put(count)only when there are packets received. Eachrte_nodeworks on only on one rx port and queue that it gets fromnode->context. For each (port X,rx_queueY), arte_nodeis cloned fromethdev_rx_base_node
as "ethdev_rx-X-Y" inrte_node_eth_config()along with updatingnode->context. Each graph needs to be associated with a uniquerte_nodefor a (port,rx_queue).b)
librte_node/ethdev_tx.c:
This node doesrte_eth_tx_burst()for a burst of objs received by it. It sends the burst to a fixed Tx Port and Queue information fromnode->context. For each (port X), thisrte_nodeis cloned fromethdev_tx_node_baseas "ethdev_tx-X" inrte_node_eth_config()along with updatingnode->context.
Since each graph doesn't need more than one Txq, per port, a Txq is assigned based on graph id to eachrte_nodeinstance. Each graph needs to be associated with arte_nodefor each (port).c)
librte_node/pkt_drop.c:
This node frees all the objects that are passed to it.d)
librte_node/ip4_lookup.c:
This node is an intermediate node that does lpm lookup for the received
ipv4 packets and the result determines each packets next node.
a) On successful lpm lookup, the result contains thenex_nodeid and next-hop id with which the packet needs to be further processed.
b) On lpm lookup failure, objects are redirected topkt_dropnode.rte_node_ip4_route_add()is control path API to add ipv4 routes. To achieve home run, we userte_node_stream_move()as mentioned in
above
sections.e)
librte_node/ip4_rewrite.c:
This node gets packets fromip4_lookupnode with next-hop id for each packet is embedded in rte_node_mbuf_priv1(mbuf)->nh. This id is used to determine the L2 header to be written to the pkt before sending the pkt out to a particularethdev_txnode.rte_node_ip4_rewrite_add()is control path API to add next-hop info.Jerin Jacob (1):
graph: introduce graph subsystemKiran Kumar K (1):
test: add graph functional testsNithin Dabilpuram (2):
node: add packet processing nodes example/l3fwd_graph: l3fwd using graph architecturePavan Nikhilesh (1):
test: add graph performance test cases.app/test/Makefile | 5 + app/test/meson.build | 10 +- app/test/test_graph.c | 820 +++++++++++++++++ app/test/test_graph_perf.c | 888 +++++++++++++++++++ config/common_base | 13 + config/rte_config.h | 4 + examples/Makefile | 3 + examples/l3fwd-graph/Makefile | 58 ++ examples/l3fwd-graph/main.c | 1131 ++++++++++++++++++++++++ examples/l3fwd-graph/meson.build | 13 + examples/meson.build | 6 +- lib/Makefile | 6 + lib/librte_graph/Makefile | 28 + lib/librte_graph/graph.c | 578 ++++++++++++ lib/librte_graph/graph_debug.c | 81 ++ lib/librte_graph/graph_ops.c | 163 ++++ lib/librte_graph/graph_populate.c | 224 +++++ lib/librte_graph/graph_private.h | 113 +++ lib/librte_graph/graph_stats.c | 396 +++++++++ lib/librte_graph/meson.build | 11 + lib/librte_graph/node.c | 419 +++++++++ lib/librte_graph/rte_graph.h | 277 ++++++ lib/librte_graph/rte_graph_version.map | 46 + lib/librte_graph/rte_graph_worker.h | 280 ++++++ lib/librte_node/Makefile | 30 + lib/librte_node/ethdev_ctrl.c | 106 +++ lib/librte_node/ethdev_rx.c | 218 +++++ lib/librte_node/ethdev_rx.h | 17 + lib/librte_node/ethdev_rx_priv.h | 45 + lib/librte_node/ethdev_tx.c | 74 ++ lib/librte_node/ethdev_tx_priv.h | 33 + lib/librte_node/ip4_lookup.c | 657 ++++++++++++++ lib/librte_node/ip4_lookup_priv.h | 17 + lib/librte_node/ip4_rewrite.c | 340 +++++++ lib/librte_node/ip4_rewrite_priv.h | 44 + lib/librte_node/log.c | 14 + lib/librte_node/meson.build | 8 + lib/librte_node/node_private.h | 61 ++ lib/librte_node/null.c | 23 + lib/librte_node/pkt_drop.c | 26 + lib/librte_node/rte_node_eth_api.h | 31 + lib/librte_node/rte_node_ip4_api.h | 33 + lib/librte_node/rte_node_version.map | 9 + lib/meson.build | 5 +- meson.build | 1 + mk/rte.app.mk | 2 + 46 files changed, 7362 insertions(+), 5 deletions(-) create mode 100644 app/test/test_graph.c create mode 100644 app/test/test_graph_perf.c create mode 100644 examples/l3fwd-graph/Makefile create mode 100644 examples/l3fwd-graph/main.c create mode 100644 examples/l3fwd-graph/meson.build create mode 100644 lib/librte_graph/Makefile create mode 100644 lib/librte_graph/graph.c create mode 100644 lib/librte_graph/graph_debug.c create mode 100644 lib/librte_graph/graph_ops.c create mode 100644 lib/librte_graph/graph_populate.c create mode 100644 lib/librte_graph/graph_private.h create mode 100644 lib/librte_graph/graph_stats.c create mode 100644 lib/librte_graph/meson.build create mode 100644 lib/librte_graph/node.c create mode 100644 lib/librte_graph/rte_graph.h create mode 100644 lib/librte_graph/rte_graph_version.map create mode 100644 lib/librte_graph/rte_graph_worker.h create mode 100644 lib/librte_node/Makefile create mode 100644 lib/librte_node/ethdev_ctrl.c create mode 100644 lib/librte_node/ethdev_rx.c create mode 100644 lib/librte_node/ethdev_rx.h create mode 100644 lib/librte_node/ethdev_rx_priv.h create mode 100644 lib/librte_node/ethdev_tx.c create mode 100644 lib/librte_node/ethdev_tx_priv.h create mode 100644 lib/librte_node/ip4_lookup.c create mode 100644 lib/librte_node/ip4_lookup_priv.h create mode 100644 lib/librte_node/ip4_rewrite.c create mode 100644 lib/librte_node/ip4_rewrite_priv.h create mode 100644 lib/librte_node/log.c create mode 100644 lib/librte_node/meson.build create mode 100644 lib/librte_node/node_private.h create mode 100644 lib/librte_node/null.c create mode 100644 lib/librte_node/pkt_drop.c create mode 100644 lib/librte_node/rte_node_eth_api.h create mode 100644 lib/librte_node/rte_node_ip4_api.h create mode 100644 lib/librte_node/rte_node_version.map--
2.24.1
Quoted 7 lines · Honnappa Nagarahalli
Quoted 5 lines
2) Based on our experience, NPU HW accelerates are so different than one vendor to another vendor. Going forward, We believe, API abstraction may not be enough abstract the difference in HW. The Vendor-specific nodes can abstract the HW differences and reuse generic the nodes as needed. This would help both the silicon vendors and DPDK end users.
If you are proposing this as a new way to provide HW abstractions, then we will be restricting the application programming model to follow graph subsystem. IMO, the HW abstractions should be available irrespective of the programming model. Graph model of packet processing might not be applicable for all use cases.
No, I am not proposing this is the new way to provide HW abstraction in DPDK. API based HW abstraction will continue as it was done earlier.