ip_pipeline: refactoring
cover ip_pipeline: refactoring
Refactored the IP pipeline application. As result, the code base size (lines of code) reduces by ~60%.
1. Moved table actions into the librte_pipeline library. As result, the pre-fabricated pipelines from the application pipeline folder were removed. The flexibility is greatly improved, as now any action can be combined with any match (i.e. table type), which was not possible before.
2. Removed configuration file as the initialization method. Now all the pipelines are set up and assigned to threads through CLI commands for improved flexibility.
3. Replaced the local CLI with remote CLI. Any standard TCP client (e.g. telnet, netcat) can now connect to the app, send request as command string through the network and wait for the response string before pushing the next command. Results in better flexibility and automation.
Jasvinder Singh (37):
pipeline: add pipeline table action APIs
pipeline: get pipeline table action params
pipeline: add traffic metering action
pipeline: add traffic manager action
pipeline: add packet encapsulation action
pipeline: add nat action
pipeline: add ttl update action
pipeline: add statistics read action
pipeline: add timestamp action
ip_pipeline: rework and improvements
ip_pipeline: add cli interface
ip_pipeline: add mempool object for pipeline
ip_pipeline: add link object
ip_pipeline: add software queue object
ip_pipeline: add traffic manager object
ip_pipeline: add tap object
ip_pipeline: add kni object
ip_pipeline: add action profile object
ip_pipeline: add pipeline object
ip_pipeline: add threads
ip_pipeline: add thread runtime
ip_pipeline: add cli to enable and disable pipeline
ip_pipeline: add cli to enable and disable pipeline port
ip_pipeline: add cli to read pipeline port and table stats
ip_pipeline: add cli for pipeline table entries
ip_pipeline: add cli to delete pipeline table entry
ip_pipeline: add cli to read pipeline table entry stats
ip_pipeline: add cli to configure meter profile
ip_pipeline: add cli to read meter stats
ip_pipeline: add cli to update dscp table
ip_pipeline: add cli to read ttl stats
ip_pipeline: add l2fwd example
ip_pipeline: add KNI port example
ip_pipeline: add TAP port example
ip_pipeline: add route example
ip_pipeline: add firewall example
ip_pipeline: add flow classification example
doc/api/doxy-api-index.md | 1 +
examples/ip_pipeline/Makefile | 48 +-
examples/ip_pipeline/app.h | 1401 -------
examples/ip_pipeline/cli.c | 4261 ++++++++++++++++++++
examples/ip_pipeline/cli.h | 18 +
examples/ip_pipeline/common.h | 12 +
examples/ip_pipeline/config/action.cfg | 68 -
examples/ip_pipeline/config/action.sh | 119 -
examples/ip_pipeline/config/action.txt | 8 -
examples/ip_pipeline/config/diagram-generator.py | 317 --
.../ip_pipeline/config/edge_router_downstream.cfg | 97 -
.../ip_pipeline/config/edge_router_downstream.sh | 13 -
.../ip_pipeline/config/edge_router_upstream.cfg | 124 -
.../ip_pipeline/config/edge_router_upstream.sh | 33 -
examples/ip_pipeline/config/firewall.cfg | 68 -
examples/ip_pipeline/config/firewall.sh | 13 -
examples/ip_pipeline/config/firewall.txt | 9 -
examples/ip_pipeline/config/flow.cfg | 72 -
examples/ip_pipeline/config/flow.sh | 25 -
examples/ip_pipeline/config/flow.txt | 17 -
examples/ip_pipeline/config/ip_pipeline.cfg | 9 -
examples/ip_pipeline/config/ip_pipeline.sh | 5 -
examples/ip_pipeline/config/kni.cfg | 67 -
examples/ip_pipeline/config/l2fwd.cfg | 58 -
examples/ip_pipeline/config/l3fwd.cfg | 68 -
examples/ip_pipeline/config/l3fwd.sh | 33 -
examples/ip_pipeline/config/l3fwd_arp.cfg | 70 -
examples/ip_pipeline/config/l3fwd_arp.sh | 43 -
examples/ip_pipeline/config/network_layers.cfg | 227 --
examples/ip_pipeline/config/network_layers.sh | 79 -
.../ip_pipeline/config/pipeline-to-core-mapping.py | 906 -----
examples/ip_pipeline/config/tap.cfg | 64 -
examples/ip_pipeline/config/tm_profile.cfg | 105 -
examples/ip_pipeline/config_check.c | 488 ---
examples/ip_pipeline/config_parse.c | 3395 ----------------
examples/ip_pipeline/config_parse_tm.c | 419 --
examples/ip_pipeline/conn.c | 326 ++
examples/ip_pipeline/conn.h | 47 +
examples/ip_pipeline/cpu_core_map.c | 471 ---
examples/ip_pipeline/cpu_core_map.h | 40 -
examples/ip_pipeline/examples/firewall.cli | 59 +
examples/ip_pipeline/examples/flow.cli | 60 +
examples/ip_pipeline/examples/kni.cli | 69 +
examples/ip_pipeline/examples/l2fwd.cli | 53 +
examples/ip_pipeline/examples/route.cli | 60 +
examples/ip_pipeline/examples/tap.cli | 66 +
examples/ip_pipeline/{pipeline => }/hash_func.h | 3 +-
.../ip_pipeline/{pipeline => }/hash_func_arm64.h | 0
examples/ip_pipeline/init.c | 1927 ---------
examples/ip_pipeline/kni.c | 165 +
examples/ip_pipeline/kni.h | 44 +
examples/ip_pipeline/link.c | 268 ++
examples/ip_pipeline/link.h | 63 +
examples/ip_pipeline/main.c | 253 +-
examples/ip_pipeline/mempool.c | 81 +
examples/ip_pipeline/mempool.h | 40 +
examples/ip_pipeline/meson.build | 35 +-
examples/ip_pipeline/parser.c | 16 +-
examples/ip_pipeline/parser.h | 8 +
examples/ip_pipeline/pipeline.c | 930 +++++
examples/ip_pipeline/pipeline.h | 373 +-
.../ip_pipeline/pipeline/pipeline_actions_common.h | 202 -
examples/ip_pipeline/pipeline/pipeline_common_be.c | 176 -
examples/ip_pipeline/pipeline/pipeline_common_be.h | 134 -
examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1455 -------
examples/ip_pipeline/pipeline/pipeline_common_fe.h | 231 --
examples/ip_pipeline/pipeline/pipeline_firewall.c | 1421 -------
examples/ip_pipeline/pipeline/pipeline_firewall.h | 60 -
.../ip_pipeline/pipeline/pipeline_firewall_be.c | 856 ----
.../ip_pipeline/pipeline/pipeline_firewall_be.h | 147 -
.../ip_pipeline/pipeline/pipeline_flow_actions.c | 1286 ------
.../ip_pipeline/pipeline/pipeline_flow_actions.h | 60 -
.../pipeline/pipeline_flow_actions_be.c | 983 -----
.../pipeline/pipeline_flow_actions_be.h | 139 -
.../pipeline/pipeline_flow_classification.c | 1878 ---------
.../pipeline/pipeline_flow_classification.h | 106 -
.../pipeline/pipeline_flow_classification_be.c | 723 ----
.../pipeline/pipeline_flow_classification_be.h | 113 -
examples/ip_pipeline/pipeline/pipeline_master.c | 20 -
examples/ip_pipeline/pipeline/pipeline_master.h | 12 -
examples/ip_pipeline/pipeline/pipeline_master_be.c | 141 -
examples/ip_pipeline/pipeline/pipeline_master_be.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough.c | 45 -
.../ip_pipeline/pipeline/pipeline_passthrough.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough_be.c | 929 -----
.../ip_pipeline/pipeline/pipeline_passthrough_be.h | 44 -
examples/ip_pipeline/pipeline/pipeline_routing.c | 1613 --------
examples/ip_pipeline/pipeline/pipeline_routing.h | 71 -
.../ip_pipeline/pipeline/pipeline_routing_be.c | 1966 ---------
.../ip_pipeline/pipeline/pipeline_routing_be.h | 283 --
examples/ip_pipeline/pipeline_be.h | 322 --
examples/ip_pipeline/swq.c | 74 +
examples/ip_pipeline/swq.h | 37 +
examples/ip_pipeline/tap.c | 97 +
examples/ip_pipeline/tap.h | 29 +
examples/ip_pipeline/thread.c | 2484 +++++++++++-
examples/ip_pipeline/thread.h | 75 +-
examples/ip_pipeline/thread_fe.c | 457 ---
examples/ip_pipeline/thread_fe.h | 72 -
examples/ip_pipeline/tmgr.c | 227 ++
examples/ip_pipeline/tmgr.h | 70 +
lib/librte_pipeline/Makefile | 6 +-
lib/librte_pipeline/meson.build | 7 +-
lib/librte_pipeline/rte_pipeline_version.map | 21 +
lib/librte_pipeline/rte_table_action.c | 2084 ++++++++++
lib/librte_pipeline/rte_table_action.h | 853 ++++
106 files changed, 13032 insertions(+), 27218 deletions(-)
delete mode 100644 examples/ip_pipeline/app.h
create mode 100644 examples/ip_pipeline/cli.c
create mode 100644 examples/ip_pipeline/cli.h
create mode 100644 examples/ip_pipeline/common.h
delete mode 100644 examples/ip_pipeline/config/action.cfg
delete mode 100644 examples/ip_pipeline/config/action.sh
delete mode 100644 examples/ip_pipeline/config/action.txt
delete mode 100755 examples/ip_pipeline/config/diagram-generator.py
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.sh
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.sh
delete mode 100644 examples/ip_pipeline/config/firewall.cfg
delete mode 100644 examples/ip_pipeline/config/firewall.sh
delete mode 100644 examples/ip_pipeline/config/firewall.txt
delete mode 100644 examples/ip_pipeline/config/flow.cfg
delete mode 100644 examples/ip_pipeline/config/flow.sh
delete mode 100644 examples/ip_pipeline/config/flow.txt
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.sh
delete mode 100644 examples/ip_pipeline/config/kni.cfg
delete mode 100644 examples/ip_pipeline/config/l2fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.sh
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.sh
delete mode 100644 examples/ip_pipeline/config/network_layers.cfg
delete mode 100644 examples/ip_pipeline/config/network_layers.sh
delete mode 100755 examples/ip_pipeline/config/pipeline-to-core-mapping.py
delete mode 100644 examples/ip_pipeline/config/tap.cfg
delete mode 100644 examples/ip_pipeline/config/tm_profile.cfg
delete mode 100644 examples/ip_pipeline/config_check.c
delete mode 100644 examples/ip_pipeline/config_parse.c
delete mode 100644 examples/ip_pipeline/config_parse_tm.c
create mode 100644 examples/ip_pipeline/conn.c
create mode 100644 examples/ip_pipeline/conn.h
delete mode 100644 examples/ip_pipeline/cpu_core_map.c
delete mode 100644 examples/ip_pipeline/cpu_core_map.h
create mode 100644 examples/ip_pipeline/examples/firewall.cli
create mode 100644 examples/ip_pipeline/examples/flow.cli
create mode 100644 examples/ip_pipeline/examples/kni.cli
create mode 100644 examples/ip_pipeline/examples/l2fwd.cli
create mode 100644 examples/ip_pipeline/examples/route.cli
create mode 100644 examples/ip_pipeline/examples/tap.cli
rename examples/ip_pipeline/{pipeline => }/hash_func.h (99%)
rename examples/ip_pipeline/{pipeline => }/hash_func_arm64.h (100%)
delete mode 100644 examples/ip_pipeline/init.c
create mode 100644 examples/ip_pipeline/kni.c
create mode 100644 examples/ip_pipeline/kni.h
create mode 100644 examples/ip_pipeline/link.c
create mode 100644 examples/ip_pipeline/link.h
create mode 100644 examples/ip_pipeline/mempool.c
create mode 100644 examples/ip_pipeline/mempool.h
create mode 100644 examples/ip_pipeline/pipeline.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h
delete mode 100644 examples/ip_pipeline/pipeline_be.h
create mode 100644 examples/ip_pipeline/swq.c
create mode 100644 examples/ip_pipeline/swq.h
create mode 100644 examples/ip_pipeline/tap.c
create mode 100644 examples/ip_pipeline/tap.h
delete mode 100644 examples/ip_pipeline/thread_fe.c
delete mode 100644 examples/ip_pipeline/thread_fe.h
create mode 100644 examples/ip_pipeline/tmgr.c
create mode 100644 examples/ip_pipeline/tmgr.h
create mode 100644 lib/librte_pipeline/rte_table_action.c
create mode 100644 lib/librte_pipeline/rte_table_action.hSignature · 1 line
2.9.3
PATCH 1/37 pipeline: add pipeline table action APIs
This API provides a common set of actions for pipeline tables to speed up application development.
Each match-action rule added to a pipeline table has associated data that stores the action context. This data is input to the table action handler called for every input packet that hits the rule as part of the table lookup during the pipeline execution.
The pipeline library allows the user to define his own table actions by providing customized table action handlers (table lookup) and complete freedom of setting the rules and their data (table rule add/delete). While the user can still follow this process, this API is intended to provide a quicker development alternative for a set of predefined actions.
The typical steps to use this API are:
* Define a table action profile.
* Instantiate the table action profile to create table action objects.
* Use the table action object to generate the pipeline table action handlers (invoked by the pipeline table lookup operation).
* Use the table action object to generate the rule data (for the pipeline table rule add operation) based on given action parameters.
* Use the table action object to read action data (e.g. stats counters) for any given rule.
--- doc/api/doxy-api-index.md | 1 + lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 5 +- lib/librte_pipeline/rte_pipeline_version.map | 13 ++ lib/librte_pipeline/rte_table_action.c | 278 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 224 +++++++++++++++++++++ 6 files changed, 521 insertions(+), 3 deletions(-) create mode 100644 lib/librte_pipeline/rte_table_action.c create mode 100644 lib/librte_pipeline/rte_table_action.h
doc/api/doxy-api-index.md +1 -0
@@ -159,6 +159,7 @@ The public API headers are grouped by topics: [array] (@ref rte_table_array.h), [stub] (@ref rte_table_stub.h) * [pipeline] (@ref rte_pipeline.h) + [table_action].....(@ref rte_table_action.h) - **basic**: [approx fraction] (@ref rte_approx.h),
lib/librte_pipeline/Makefile +2 -1
@@ -21,8 +21,9 @@ LIBABIVER := 3 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += rte_table_action.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h +SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h rte_table_action.h include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/meson.build +3 -2
@@ -2,6 +2,7 @@ # Copyright(c) 2017 Intel Corporation version = 3 -sources = files('rte_pipeline.c') -headers = files('rte_pipeline.h') +allow_experimental_apis = true +sources = files('rte_pipeline.c', 'rte_table_action.c') +headers = files('rte_pipeline.h', 'rte_table_action.h') deps += ['port', 'table']
lib/librte_pipeline/rte_pipeline_version.map +13 -0
@@ -45,3 +45,16 @@ DPDK_16.04 { rte_pipeline_ah_packet_drop; } DPDK_2.2; + +EXPERIMENTAL { + global: + + rte_table_action_apply; + rte_table_action_create; + rte_table_action_free; + rte_table_action_profile_action_register; + rte_table_action_profile_create; + rte_table_action_profile_free; + rte_table_action_profile_freeze; + +} DPDK_16.04;
lib/librte_pipeline/rte_table_action.c new file +278 -0
279 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h new file +224 -0
224 lines not on this page · raw message
Signature · 1 line
2.9.3
v2 cover ip_pipeline: refactoring
Refactored the IP pipeline application. As result, the code base size (lines of code) reduces by ~60%.
1. Moved table actions into the librte_pipeline library. As result, the pre-fabricated pipelines from the application pipeline folder were removed. The flexibility is greatly improved, as now any action can be combined with any match (i.e. table type), which was not possible before.
2. Removed configuration file as the initialization method. Now all the pipelines are set up and assigned to threads through CLI commands for improved flexibility.
3. Replaced the local CLI with remote CLI. Any standard TCP client (e.g. telnet, netcat) can now connect to the app, send request as command string through the network and wait for the response string before pushing the next command. Results in better flexibility and automation.
v2:
- split the patch that removes the existing pipeline components into multiple patches.
- fix checkpatch errors.
Jasvinder Singh (44):
pipeline: add pipeline table action APIs
pipeline: get pipeline table action params
pipeline: add traffic metering action
pipeline: add traffic manager action
pipeline: add packet encapsulation action
pipeline: add nat action
pipeline: add ttl update action
pipeline: add statistics read action
pipeline: add timestamp action
ip_pipeline: remove passthrough pipeline
ip_pipeline: remove routing pipeline
ip_pipeline: remove flow classification pipeline
ip_pipeline: remove flow actions pipeline
ip_pipeline: remove firewall pipeline
ip_pipeline: remove master pipeline
ip_pipeline: remove config
ip_pipeline: rework and improvements
ip_pipeline: add cli interface
ip_pipeline: add mempool object for pipeline
ip_pipeline: add link object
ip_pipeline: add software queue object
ip_pipeline: add traffic manager object
ip_pipeline: add tap object
ip_pipeline: add kni object
ip_pipeline: add action profile object
ip_pipeline: add pipeline object
ip_pipeline: add threads
ip_pipeline: add thread runtime
ip_pipeline: add cli to enable and disable pipeline
ip_pipeline: add cli to enable and disable pipeline port
ip_pipeline: add cli to read pipeline port and table stats
ip_pipeline: add cli for pipeline table entries
ip_pipeline: add cli to delete pipeline table entry
ip_pipeline: add cli to read pipeline table entry stats
ip_pipeline: add cli to configure meter profile
ip_pipeline: add cli to read meter stats
ip_pipeline: add cli to update dscp table
ip_pipeline: add cli to read ttl stats
ip_pipeline: add l2fwd example
ip_pipeline: add KNI port example
ip_pipeline: add TAP port example
ip_pipeline: add route example
ip_pipeline: add firewall example
ip_pipeline: add flow classification example
doc/api/doxy-api-index.md | 1 +
examples/ip_pipeline/Makefile | 49 +-
examples/ip_pipeline/action.c | 165 +
examples/ip_pipeline/action.h | 44 +
examples/ip_pipeline/app.h | 1401 -------
examples/ip_pipeline/cli.c | 4261 ++++++++++++++++++++
examples/ip_pipeline/cli.h | 18 +
examples/ip_pipeline/common.h | 12 +
examples/ip_pipeline/config/action.cfg | 68 -
examples/ip_pipeline/config/action.sh | 119 -
examples/ip_pipeline/config/action.txt | 8 -
examples/ip_pipeline/config/diagram-generator.py | 317 --
.../ip_pipeline/config/edge_router_downstream.cfg | 97 -
.../ip_pipeline/config/edge_router_downstream.sh | 13 -
.../ip_pipeline/config/edge_router_upstream.cfg | 124 -
.../ip_pipeline/config/edge_router_upstream.sh | 33 -
examples/ip_pipeline/config/firewall.cfg | 68 -
examples/ip_pipeline/config/firewall.sh | 13 -
examples/ip_pipeline/config/firewall.txt | 9 -
examples/ip_pipeline/config/flow.cfg | 72 -
examples/ip_pipeline/config/flow.sh | 25 -
examples/ip_pipeline/config/flow.txt | 17 -
examples/ip_pipeline/config/ip_pipeline.cfg | 9 -
examples/ip_pipeline/config/ip_pipeline.sh | 5 -
examples/ip_pipeline/config/kni.cfg | 67 -
examples/ip_pipeline/config/l2fwd.cfg | 58 -
examples/ip_pipeline/config/l3fwd.cfg | 68 -
examples/ip_pipeline/config/l3fwd.sh | 33 -
examples/ip_pipeline/config/l3fwd_arp.cfg | 70 -
examples/ip_pipeline/config/l3fwd_arp.sh | 43 -
examples/ip_pipeline/config/network_layers.cfg | 227 --
examples/ip_pipeline/config/network_layers.sh | 79 -
.../ip_pipeline/config/pipeline-to-core-mapping.py | 906 -----
examples/ip_pipeline/config/tap.cfg | 64 -
examples/ip_pipeline/config/tm_profile.cfg | 105 -
examples/ip_pipeline/config_check.c | 488 ---
examples/ip_pipeline/config_parse.c | 3395 ----------------
examples/ip_pipeline/config_parse_tm.c | 419 --
examples/ip_pipeline/conn.c | 326 ++
examples/ip_pipeline/conn.h | 47 +
examples/ip_pipeline/cpu_core_map.c | 471 ---
examples/ip_pipeline/cpu_core_map.h | 40 -
examples/ip_pipeline/examples/firewall.cli | 59 +
examples/ip_pipeline/examples/flow.cli | 60 +
examples/ip_pipeline/examples/kni.cli | 69 +
examples/ip_pipeline/examples/l2fwd.cli | 53 +
examples/ip_pipeline/examples/route.cli | 60 +
examples/ip_pipeline/examples/tap.cli | 66 +
examples/ip_pipeline/{pipeline => }/hash_func.h | 3 +-
.../ip_pipeline/{pipeline => }/hash_func_arm64.h | 0
examples/ip_pipeline/init.c | 1927 ---------
examples/ip_pipeline/kni.c | 167 +
examples/ip_pipeline/kni.h | 44 +
examples/ip_pipeline/link.c | 268 ++
examples/ip_pipeline/link.h | 63 +
examples/ip_pipeline/main.c | 253 +-
examples/ip_pipeline/mempool.c | 81 +
examples/ip_pipeline/mempool.h | 40 +
examples/ip_pipeline/meson.build | 36 +-
examples/ip_pipeline/parser.c | 16 +-
examples/ip_pipeline/parser.h | 8 +
examples/ip_pipeline/pipeline.c | 930 +++++
examples/ip_pipeline/pipeline.h | 373 +-
.../ip_pipeline/pipeline/pipeline_actions_common.h | 202 -
examples/ip_pipeline/pipeline/pipeline_common_be.c | 176 -
examples/ip_pipeline/pipeline/pipeline_common_be.h | 134 -
examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1455 -------
examples/ip_pipeline/pipeline/pipeline_common_fe.h | 231 --
examples/ip_pipeline/pipeline/pipeline_firewall.c | 1421 -------
examples/ip_pipeline/pipeline/pipeline_firewall.h | 60 -
.../ip_pipeline/pipeline/pipeline_firewall_be.c | 856 ----
.../ip_pipeline/pipeline/pipeline_firewall_be.h | 147 -
.../ip_pipeline/pipeline/pipeline_flow_actions.c | 1286 ------
.../ip_pipeline/pipeline/pipeline_flow_actions.h | 60 -
.../pipeline/pipeline_flow_actions_be.c | 983 -----
.../pipeline/pipeline_flow_actions_be.h | 139 -
.../pipeline/pipeline_flow_classification.c | 1878 ---------
.../pipeline/pipeline_flow_classification.h | 106 -
.../pipeline/pipeline_flow_classification_be.c | 723 ----
.../pipeline/pipeline_flow_classification_be.h | 113 -
examples/ip_pipeline/pipeline/pipeline_master.c | 20 -
examples/ip_pipeline/pipeline/pipeline_master.h | 12 -
examples/ip_pipeline/pipeline/pipeline_master_be.c | 141 -
examples/ip_pipeline/pipeline/pipeline_master_be.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough.c | 45 -
.../ip_pipeline/pipeline/pipeline_passthrough.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough_be.c | 929 -----
.../ip_pipeline/pipeline/pipeline_passthrough_be.h | 44 -
examples/ip_pipeline/pipeline/pipeline_routing.c | 1613 --------
examples/ip_pipeline/pipeline/pipeline_routing.h | 71 -
.../ip_pipeline/pipeline/pipeline_routing_be.c | 1966 ---------
.../ip_pipeline/pipeline/pipeline_routing_be.h | 283 --
examples/ip_pipeline/pipeline_be.h | 322 --
examples/ip_pipeline/swq.c | 74 +
examples/ip_pipeline/swq.h | 37 +
examples/ip_pipeline/tap.c | 97 +
examples/ip_pipeline/tap.h | 29 +
examples/ip_pipeline/thread.c | 2485 +++++++++++-
examples/ip_pipeline/thread.h | 75 +-
examples/ip_pipeline/thread_fe.c | 457 ---
examples/ip_pipeline/thread_fe.h | 72 -
examples/ip_pipeline/tmgr.c | 227 ++
examples/ip_pipeline/tmgr.h | 70 +
lib/librte_pipeline/Makefile | 6 +-
lib/librte_pipeline/meson.build | 7 +-
lib/librte_pipeline/rte_pipeline_version.map | 21 +
lib/librte_pipeline/rte_table_action.c | 2086 ++++++++++
lib/librte_pipeline/rte_table_action.h | 853 ++++
108 files changed, 13248 insertions(+), 27218 deletions(-)
create mode 100644 examples/ip_pipeline/action.c
create mode 100644 examples/ip_pipeline/action.h
delete mode 100644 examples/ip_pipeline/app.h
create mode 100644 examples/ip_pipeline/cli.c
create mode 100644 examples/ip_pipeline/cli.h
create mode 100644 examples/ip_pipeline/common.h
delete mode 100644 examples/ip_pipeline/config/action.cfg
delete mode 100644 examples/ip_pipeline/config/action.sh
delete mode 100644 examples/ip_pipeline/config/action.txt
delete mode 100755 examples/ip_pipeline/config/diagram-generator.py
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.sh
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.sh
delete mode 100644 examples/ip_pipeline/config/firewall.cfg
delete mode 100644 examples/ip_pipeline/config/firewall.sh
delete mode 100644 examples/ip_pipeline/config/firewall.txt
delete mode 100644 examples/ip_pipeline/config/flow.cfg
delete mode 100644 examples/ip_pipeline/config/flow.sh
delete mode 100644 examples/ip_pipeline/config/flow.txt
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.sh
delete mode 100644 examples/ip_pipeline/config/kni.cfg
delete mode 100644 examples/ip_pipeline/config/l2fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.sh
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.sh
delete mode 100644 examples/ip_pipeline/config/network_layers.cfg
delete mode 100644 examples/ip_pipeline/config/network_layers.sh
delete mode 100755 examples/ip_pipeline/config/pipeline-to-core-mapping.py
delete mode 100644 examples/ip_pipeline/config/tap.cfg
delete mode 100644 examples/ip_pipeline/config/tm_profile.cfg
delete mode 100644 examples/ip_pipeline/config_check.c
delete mode 100644 examples/ip_pipeline/config_parse.c
delete mode 100644 examples/ip_pipeline/config_parse_tm.c
create mode 100644 examples/ip_pipeline/conn.c
create mode 100644 examples/ip_pipeline/conn.h
delete mode 100644 examples/ip_pipeline/cpu_core_map.c
delete mode 100644 examples/ip_pipeline/cpu_core_map.h
create mode 100644 examples/ip_pipeline/examples/firewall.cli
create mode 100644 examples/ip_pipeline/examples/flow.cli
create mode 100644 examples/ip_pipeline/examples/kni.cli
create mode 100644 examples/ip_pipeline/examples/l2fwd.cli
create mode 100644 examples/ip_pipeline/examples/route.cli
create mode 100644 examples/ip_pipeline/examples/tap.cli
rename examples/ip_pipeline/{pipeline => }/hash_func.h (99%)
rename examples/ip_pipeline/{pipeline => }/hash_func_arm64.h (100%)
delete mode 100644 examples/ip_pipeline/init.c
create mode 100644 examples/ip_pipeline/kni.c
create mode 100644 examples/ip_pipeline/kni.h
create mode 100644 examples/ip_pipeline/link.c
create mode 100644 examples/ip_pipeline/link.h
create mode 100644 examples/ip_pipeline/mempool.c
create mode 100644 examples/ip_pipeline/mempool.h
create mode 100644 examples/ip_pipeline/pipeline.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h
delete mode 100644 examples/ip_pipeline/pipeline_be.h
create mode 100644 examples/ip_pipeline/swq.c
create mode 100644 examples/ip_pipeline/swq.h
create mode 100644 examples/ip_pipeline/tap.c
create mode 100644 examples/ip_pipeline/tap.h
delete mode 100644 examples/ip_pipeline/thread_fe.c
delete mode 100644 examples/ip_pipeline/thread_fe.h
create mode 100644 examples/ip_pipeline/tmgr.c
create mode 100644 examples/ip_pipeline/tmgr.h
create mode 100644 lib/librte_pipeline/rte_table_action.c
create mode 100644 lib/librte_pipeline/rte_table_action.hSignature · 1 line
2.9.3
PATCH v2 1/44 pipeline: add pipeline table action APIs
This API provides a common set of actions for pipeline tables to speed up application development.
Each match-action rule added to a pipeline table has associated data that stores the action context. This data is input to the table action handler called for every input packet that hits the rule as part of the table lookup during the pipeline execution.
The pipeline library allows the user to define his own table actions by providing customized table action handlers (table lookup) and complete freedom of setting the rules and their data (table rule add/delete). While the user can still follow this process, this API is intended to provide a quicker development alternative for a set of predefined actions.
The typical steps to use this API are:
* Define a table action profile.
* Instantiate the table action profile to create table action objects.
* Use the table action object to generate the pipeline table action handlers (invoked by the pipeline table lookup operation).
* Use the table action object to generate the rule data (for the pipeline table rule add operation) based on given action parameters.
* Use the table action object to read action data (e.g. stats counters) for any given rule.
--- doc/api/doxy-api-index.md | 1 + lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 5 +- lib/librte_pipeline/rte_pipeline_version.map | 13 ++ lib/librte_pipeline/rte_table_action.c | 278 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 224 +++++++++++++++++++++ 6 files changed, 521 insertions(+), 3 deletions(-) create mode 100644 lib/librte_pipeline/rte_table_action.c create mode 100644 lib/librte_pipeline/rte_table_action.h
doc/api/doxy-api-index.md +1 -0
@@ -159,6 +159,7 @@ The public API headers are grouped by topics: [array] (@ref rte_table_array.h), [stub] (@ref rte_table_stub.h) * [pipeline] (@ref rte_pipeline.h) + [table_action].....(@ref rte_table_action.h) - **basic**: [approx fraction] (@ref rte_approx.h),
lib/librte_pipeline/Makefile +2 -1
@@ -21,8 +21,9 @@ LIBABIVER := 3 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += rte_table_action.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h +SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h rte_table_action.h include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/meson.build +3 -2
@@ -2,6 +2,7 @@ # Copyright(c) 2017 Intel Corporation version = 3 -sources = files('rte_pipeline.c') -headers = files('rte_pipeline.h') +allow_experimental_apis = true +sources = files('rte_pipeline.c', 'rte_table_action.c') +headers = files('rte_pipeline.h', 'rte_table_action.h') deps += ['port', 'table']
lib/librte_pipeline/rte_pipeline_version.map +13 -0
@@ -45,3 +45,16 @@ DPDK_16.04 { rte_pipeline_ah_packet_drop; } DPDK_2.2; + +EXPERIMENTAL { + global: + + rte_table_action_apply; + rte_table_action_create; + rte_table_action_free; + rte_table_action_profile_action_register; + rte_table_action_profile_create; + rte_table_action_profile_free; + rte_table_action_profile_freeze; + +} DPDK_16.04;
lib/librte_pipeline/rte_table_action.c new file +278 -0
279 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h new file +224 -0
224 lines not on this page · raw message
Signature · 1 line
2.9.3
v3 cover ip_pipeline: refactoring
Refactored the IP pipeline application. As result, the code base size (lines of code) reduces by ~60%.
1. Moved table actions into the librte_pipeline library. As result, the pre-fabricated pipelines from the application pipeline folder were removed. The flexibility is greatly improved, as now any action can be combined with any match (i.e. table type), which was not possible before.
2. Removed configuration file as the initialization method. Now all the pipelines are set up and assigned to threads through CLI commands for improved flexibility.
3. Replaced the local CLI with remote CLI. Any standard TCP client (e.g. telnet, netcat) can now connect to the app, send request as command string through the network and wait for the response string before pushing the next command. Results in better flexibility and automation.
v3:
- add IPv4, TCP/UDP checksum update for NAT action.
- add IPv4 Checksum update for TTL action.
- fix compilation warning
v2:
- split the patch that removes the existing pipeline components into multiple patches.
- fix checkpatch errors.
Jasvinder Singh (44):
pipeline: add pipeline table action APIs
pipeline: get pipeline table action params
pipeline: add traffic metering action
pipeline: add traffic manager action
pipeline: add packet encapsulation action
pipeline: add nat action
pipeline: add ttl update action
pipeline: add statistics read action
pipeline: add timestamp action
ip_pipeline: remove passthrough pipeline
ip_pipeline: remove routing pipeline
ip_pipeline: remove flow classification pipeline
ip_pipeline: remove flow actions pipeline
ip_pipeline: remove firewall pipeline
ip_pipeline: remove master pipeline
ip_pipeline: remove config
ip_pipeline: rework and improvements
ip_pipeline: add cli interface
ip_pipeline: add mempool object for pipeline
ip_pipeline: add link object
ip_pipeline: add software queue object
ip_pipeline: add traffic manager object
ip_pipeline: add tap object
ip_pipeline: add kni object
ip_pipeline: add action profile object
ip_pipeline: add pipeline object
ip_pipeline: add threads
ip_pipeline: add thread runtime
ip_pipeline: add cli to enable and disable pipeline
ip_pipeline: add cli to enable and disable pipeline port
ip_pipeline: add cli to read pipeline port and table stats
ip_pipeline: add cli for pipeline table entries
ip_pipeline: add cli to delete pipeline table entry
ip_pipeline: add cli to read pipeline table entry stats
ip_pipeline: add cli to configure meter profile
ip_pipeline: add cli to read meter stats
ip_pipeline: add cli to update dscp table
ip_pipeline: add cli to read ttl stats
ip_pipeline: add l2fwd example
ip_pipeline: add KNI port example
ip_pipeline: add TAP port example
ip_pipeline: add route example
ip_pipeline: add firewall example
ip_pipeline: add flow classification example
doc/api/doxy-api-index.md | 1 +
examples/ip_pipeline/Makefile | 49 +-
examples/ip_pipeline/action.c | 165 +
examples/ip_pipeline/action.h | 44 +
examples/ip_pipeline/app.h | 1401 -------
examples/ip_pipeline/cli.c | 4261 ++++++++++++++++++++
examples/ip_pipeline/cli.h | 18 +
examples/ip_pipeline/common.h | 12 +
examples/ip_pipeline/config/action.cfg | 68 -
examples/ip_pipeline/config/action.sh | 119 -
examples/ip_pipeline/config/action.txt | 8 -
examples/ip_pipeline/config/diagram-generator.py | 317 --
.../ip_pipeline/config/edge_router_downstream.cfg | 97 -
.../ip_pipeline/config/edge_router_downstream.sh | 13 -
.../ip_pipeline/config/edge_router_upstream.cfg | 124 -
.../ip_pipeline/config/edge_router_upstream.sh | 33 -
examples/ip_pipeline/config/firewall.cfg | 68 -
examples/ip_pipeline/config/firewall.sh | 13 -
examples/ip_pipeline/config/firewall.txt | 9 -
examples/ip_pipeline/config/flow.cfg | 72 -
examples/ip_pipeline/config/flow.sh | 25 -
examples/ip_pipeline/config/flow.txt | 17 -
examples/ip_pipeline/config/ip_pipeline.cfg | 9 -
examples/ip_pipeline/config/ip_pipeline.sh | 5 -
examples/ip_pipeline/config/kni.cfg | 67 -
examples/ip_pipeline/config/l2fwd.cfg | 58 -
examples/ip_pipeline/config/l3fwd.cfg | 68 -
examples/ip_pipeline/config/l3fwd.sh | 33 -
examples/ip_pipeline/config/l3fwd_arp.cfg | 70 -
examples/ip_pipeline/config/l3fwd_arp.sh | 43 -
examples/ip_pipeline/config/network_layers.cfg | 227 --
examples/ip_pipeline/config/network_layers.sh | 79 -
.../ip_pipeline/config/pipeline-to-core-mapping.py | 906 -----
examples/ip_pipeline/config/tap.cfg | 64 -
examples/ip_pipeline/config/tm_profile.cfg | 105 -
examples/ip_pipeline/config_check.c | 488 ---
examples/ip_pipeline/config_parse.c | 3395 ----------------
examples/ip_pipeline/config_parse_tm.c | 419 --
examples/ip_pipeline/conn.c | 326 ++
examples/ip_pipeline/conn.h | 47 +
examples/ip_pipeline/cpu_core_map.c | 471 ---
examples/ip_pipeline/cpu_core_map.h | 40 -
examples/ip_pipeline/examples/firewall.cli | 59 +
examples/ip_pipeline/examples/flow.cli | 60 +
examples/ip_pipeline/examples/kni.cli | 69 +
examples/ip_pipeline/examples/l2fwd.cli | 53 +
examples/ip_pipeline/examples/route.cli | 60 +
examples/ip_pipeline/examples/tap.cli | 66 +
examples/ip_pipeline/{pipeline => }/hash_func.h | 3 +-
.../ip_pipeline/{pipeline => }/hash_func_arm64.h | 0
examples/ip_pipeline/init.c | 1927 ---------
examples/ip_pipeline/kni.c | 167 +
examples/ip_pipeline/kni.h | 44 +
examples/ip_pipeline/link.c | 268 ++
examples/ip_pipeline/link.h | 63 +
examples/ip_pipeline/main.c | 253 +-
examples/ip_pipeline/mempool.c | 81 +
examples/ip_pipeline/mempool.h | 40 +
examples/ip_pipeline/meson.build | 35 +-
examples/ip_pipeline/parser.c | 16 +-
examples/ip_pipeline/parser.h | 8 +
examples/ip_pipeline/pipeline.c | 930 +++++
examples/ip_pipeline/pipeline.h | 373 +-
.../ip_pipeline/pipeline/pipeline_actions_common.h | 202 -
examples/ip_pipeline/pipeline/pipeline_common_be.c | 176 -
examples/ip_pipeline/pipeline/pipeline_common_be.h | 134 -
examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1455 -------
examples/ip_pipeline/pipeline/pipeline_common_fe.h | 231 --
examples/ip_pipeline/pipeline/pipeline_firewall.c | 1421 -------
examples/ip_pipeline/pipeline/pipeline_firewall.h | 60 -
.../ip_pipeline/pipeline/pipeline_firewall_be.c | 856 ----
.../ip_pipeline/pipeline/pipeline_firewall_be.h | 147 -
.../ip_pipeline/pipeline/pipeline_flow_actions.c | 1286 ------
.../ip_pipeline/pipeline/pipeline_flow_actions.h | 60 -
.../pipeline/pipeline_flow_actions_be.c | 983 -----
.../pipeline/pipeline_flow_actions_be.h | 139 -
.../pipeline/pipeline_flow_classification.c | 1878 ---------
.../pipeline/pipeline_flow_classification.h | 106 -
.../pipeline/pipeline_flow_classification_be.c | 723 ----
.../pipeline/pipeline_flow_classification_be.h | 113 -
examples/ip_pipeline/pipeline/pipeline_master.c | 20 -
examples/ip_pipeline/pipeline/pipeline_master.h | 12 -
examples/ip_pipeline/pipeline/pipeline_master_be.c | 141 -
examples/ip_pipeline/pipeline/pipeline_master_be.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough.c | 45 -
.../ip_pipeline/pipeline/pipeline_passthrough.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough_be.c | 929 -----
.../ip_pipeline/pipeline/pipeline_passthrough_be.h | 44 -
examples/ip_pipeline/pipeline/pipeline_routing.c | 1613 --------
examples/ip_pipeline/pipeline/pipeline_routing.h | 71 -
.../ip_pipeline/pipeline/pipeline_routing_be.c | 1966 ---------
.../ip_pipeline/pipeline/pipeline_routing_be.h | 283 --
examples/ip_pipeline/pipeline_be.h | 322 --
examples/ip_pipeline/swq.c | 74 +
examples/ip_pipeline/swq.h | 37 +
examples/ip_pipeline/tap.c | 97 +
examples/ip_pipeline/tap.h | 29 +
examples/ip_pipeline/thread.c | 2485 +++++++++++-
examples/ip_pipeline/thread.h | 75 +-
examples/ip_pipeline/thread_fe.c | 457 ---
examples/ip_pipeline/thread_fe.h | 72 -
examples/ip_pipeline/tmgr.c | 227 ++
examples/ip_pipeline/tmgr.h | 70 +
lib/librte_pipeline/Makefile | 6 +-
lib/librte_pipeline/meson.build | 7 +-
lib/librte_pipeline/rte_pipeline_version.map | 21 +
lib/librte_pipeline/rte_table_action.c | 2284 +++++++++++
lib/librte_pipeline/rte_table_action.h | 853 ++++
108 files changed, 13445 insertions(+), 27218 deletions(-)
create mode 100644 examples/ip_pipeline/action.c
create mode 100644 examples/ip_pipeline/action.h
delete mode 100644 examples/ip_pipeline/app.h
create mode 100644 examples/ip_pipeline/cli.c
create mode 100644 examples/ip_pipeline/cli.h
create mode 100644 examples/ip_pipeline/common.h
delete mode 100644 examples/ip_pipeline/config/action.cfg
delete mode 100644 examples/ip_pipeline/config/action.sh
delete mode 100644 examples/ip_pipeline/config/action.txt
delete mode 100755 examples/ip_pipeline/config/diagram-generator.py
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.sh
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.sh
delete mode 100644 examples/ip_pipeline/config/firewall.cfg
delete mode 100644 examples/ip_pipeline/config/firewall.sh
delete mode 100644 examples/ip_pipeline/config/firewall.txt
delete mode 100644 examples/ip_pipeline/config/flow.cfg
delete mode 100644 examples/ip_pipeline/config/flow.sh
delete mode 100644 examples/ip_pipeline/config/flow.txt
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.sh
delete mode 100644 examples/ip_pipeline/config/kni.cfg
delete mode 100644 examples/ip_pipeline/config/l2fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.sh
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.sh
delete mode 100644 examples/ip_pipeline/config/network_layers.cfg
delete mode 100644 examples/ip_pipeline/config/network_layers.sh
delete mode 100755 examples/ip_pipeline/config/pipeline-to-core-mapping.py
delete mode 100644 examples/ip_pipeline/config/tap.cfg
delete mode 100644 examples/ip_pipeline/config/tm_profile.cfg
delete mode 100644 examples/ip_pipeline/config_check.c
delete mode 100644 examples/ip_pipeline/config_parse.c
delete mode 100644 examples/ip_pipeline/config_parse_tm.c
create mode 100644 examples/ip_pipeline/conn.c
create mode 100644 examples/ip_pipeline/conn.h
delete mode 100644 examples/ip_pipeline/cpu_core_map.c
delete mode 100644 examples/ip_pipeline/cpu_core_map.h
create mode 100644 examples/ip_pipeline/examples/firewall.cli
create mode 100644 examples/ip_pipeline/examples/flow.cli
create mode 100644 examples/ip_pipeline/examples/kni.cli
create mode 100644 examples/ip_pipeline/examples/l2fwd.cli
create mode 100644 examples/ip_pipeline/examples/route.cli
create mode 100644 examples/ip_pipeline/examples/tap.cli
rename examples/ip_pipeline/{pipeline => }/hash_func.h (99%)
rename examples/ip_pipeline/{pipeline => }/hash_func_arm64.h (100%)
delete mode 100644 examples/ip_pipeline/init.c
create mode 100644 examples/ip_pipeline/kni.c
create mode 100644 examples/ip_pipeline/kni.h
create mode 100644 examples/ip_pipeline/link.c
create mode 100644 examples/ip_pipeline/link.h
create mode 100644 examples/ip_pipeline/mempool.c
create mode 100644 examples/ip_pipeline/mempool.h
create mode 100644 examples/ip_pipeline/pipeline.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h
delete mode 100644 examples/ip_pipeline/pipeline_be.h
create mode 100644 examples/ip_pipeline/swq.c
create mode 100644 examples/ip_pipeline/swq.h
create mode 100644 examples/ip_pipeline/tap.c
create mode 100644 examples/ip_pipeline/tap.h
delete mode 100644 examples/ip_pipeline/thread_fe.c
delete mode 100644 examples/ip_pipeline/thread_fe.h
create mode 100644 examples/ip_pipeline/tmgr.c
create mode 100644 examples/ip_pipeline/tmgr.h
create mode 100644 lib/librte_pipeline/rte_table_action.c
create mode 100644 lib/librte_pipeline/rte_table_action.hSignature · 1 line
2.9.3
PATCH v3 1/44 pipeline: add pipeline table action APIs
This API provides a common set of actions for pipeline tables to speed up application development.
Each match-action rule added to a pipeline table has associated data that stores the action context. This data is input to the table action handler called for every input packet that hits the rule as part of the table lookup during the pipeline execution.
The pipeline library allows the user to define his own table actions by providing customized table action handlers (table lookup) and complete freedom of setting the rules and their data (table rule add/delete). While the user can still follow this process, this API is intended to provide a quicker development alternative for a set of predefined actions.
The typical steps to use this API are:
* Define a table action profile.
* Instantiate the table action profile to create table action objects.
* Use the table action object to generate the pipeline table action handlers (invoked by the pipeline table lookup operation).
* Use the table action object to generate the rule data (for the pipeline table rule add operation) based on given action parameters.
* Use the table action object to read action data (e.g. stats counters) for any given rule.
--- doc/api/doxy-api-index.md | 1 + lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 5 +- lib/librte_pipeline/rte_pipeline_version.map | 13 ++ lib/librte_pipeline/rte_table_action.c | 279 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 224 +++++++++++++++++++++ 6 files changed, 522 insertions(+), 3 deletions(-) create mode 100644 lib/librte_pipeline/rte_table_action.c create mode 100644 lib/librte_pipeline/rte_table_action.h
doc/api/doxy-api-index.md +1 -0
@@ -159,6 +159,7 @@ The public API headers are grouped by topics: [array] (@ref rte_table_array.h), [stub] (@ref rte_table_stub.h) * [pipeline] (@ref rte_pipeline.h) + [table_action].....(@ref rte_table_action.h) - **basic**: [approx fraction] (@ref rte_approx.h),
lib/librte_pipeline/Makefile +2 -1
@@ -21,8 +21,9 @@ LIBABIVER := 3 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += rte_table_action.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h +SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h rte_table_action.h include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/meson.build +3 -2
@@ -2,6 +2,7 @@ # Copyright(c) 2017 Intel Corporation version = 3 -sources = files('rte_pipeline.c') -headers = files('rte_pipeline.h') +allow_experimental_apis = true +sources = files('rte_pipeline.c', 'rte_table_action.c') +headers = files('rte_pipeline.h', 'rte_table_action.h') deps += ['port', 'table']
lib/librte_pipeline/rte_pipeline_version.map +13 -0
@@ -45,3 +45,16 @@ DPDK_16.04 { rte_pipeline_ah_packet_drop; } DPDK_2.2; + +EXPERIMENTAL { + global: + + rte_table_action_apply; + rte_table_action_create; + rte_table_action_free; + rte_table_action_profile_action_register; + rte_table_action_profile_create; + rte_table_action_profile_free; + rte_table_action_profile_freeze; + +} DPDK_16.04;
lib/librte_pipeline/rte_table_action.c new file +279 -0
279 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h new file +224 -0
224 lines not on this page · raw message
Signature · 1 line
2.9.3
v3 cover ip_pipeline: refactoring
In reply to Jasvinder SinghRefactored the IP pipeline application. As result, the code base size (lines of code) reduces by ~60%.
1. Moved table actions into the librte_pipeline library. As result, the pre-fabricated pipelines from the application pipeline folder were removed. The flexibility is greatly improved, as now any action can be combined with any match (i.e. table type), which was not possible before.
2. Removed configuration file as the initialization method. Now all the pipelines are set up and assigned to threads through CLI commands for improved flexibility.
3. Replaced the local CLI with remote CLI. Any standard TCP client (e.g. telnet, netcat) can now connect to the app, send request as command string through the network and wait for the response string before pushing the next command. Results in better flexibility and automation.
v3:
- add IPv4, TCP/UDP checksum update for NAT action.
- add IPv4 Checksum update for TTL action.
- fix compilation warning
v2:
- split the patch that removes the existing pipeline components into multiple patches.
- fix checkpatch errors.
Jasvinder Singh (44):
pipeline: add pipeline table action APIs
pipeline: get pipeline table action params
pipeline: add traffic metering action
pipeline: add traffic manager action
pipeline: add packet encapsulation action
pipeline: add nat action
pipeline: add ttl update action
pipeline: add statistics read action
pipeline: add timestamp action
ip_pipeline: remove passthrough pipeline
ip_pipeline: remove routing pipeline
ip_pipeline: remove flow classification pipeline
ip_pipeline: remove flow actions pipeline
ip_pipeline: remove firewall pipeline
ip_pipeline: remove master pipeline
ip_pipeline: remove config
ip_pipeline: rework and improvements
ip_pipeline: add cli interface
ip_pipeline: add mempool object for pipeline
ip_pipeline: add link object
ip_pipeline: add software queue object
ip_pipeline: add traffic manager object
ip_pipeline: add tap object
ip_pipeline: add kni object
ip_pipeline: add action profile object
ip_pipeline: add pipeline object
ip_pipeline: add threads
ip_pipeline: add thread runtime
ip_pipeline: add cli to enable and disable pipeline
ip_pipeline: add cli to enable and disable pipeline port
ip_pipeline: add cli to read pipeline port and table stats
ip_pipeline: add cli for pipeline table entries
ip_pipeline: add cli to delete pipeline table entry
ip_pipeline: add cli to read pipeline table entry stats
ip_pipeline: add cli to configure meter profile
ip_pipeline: add cli to read meter stats
ip_pipeline: add cli to update dscp table
ip_pipeline: add cli to read ttl stats
ip_pipeline: add l2fwd example
ip_pipeline: add KNI port example
ip_pipeline: add TAP port example
ip_pipeline: add route example
ip_pipeline: add firewall example
ip_pipeline: add flow classification example
doc/api/doxy-api-index.md | 1 +
examples/ip_pipeline/Makefile | 49 +-
examples/ip_pipeline/action.c | 165 +
examples/ip_pipeline/action.h | 44 +
examples/ip_pipeline/app.h | 1401 -------
examples/ip_pipeline/cli.c | 4261 ++++++++++++++++++++
examples/ip_pipeline/cli.h | 18 +
examples/ip_pipeline/common.h | 12 +
examples/ip_pipeline/config/action.cfg | 68 -
examples/ip_pipeline/config/action.sh | 119 -
examples/ip_pipeline/config/action.txt | 8 -
examples/ip_pipeline/config/diagram-generator.py | 317 --
.../ip_pipeline/config/edge_router_downstream.cfg | 97 -
.../ip_pipeline/config/edge_router_downstream.sh | 13 -
.../ip_pipeline/config/edge_router_upstream.cfg | 124 -
.../ip_pipeline/config/edge_router_upstream.sh | 33 -
examples/ip_pipeline/config/firewall.cfg | 68 -
examples/ip_pipeline/config/firewall.sh | 13 -
examples/ip_pipeline/config/firewall.txt | 9 -
examples/ip_pipeline/config/flow.cfg | 72 -
examples/ip_pipeline/config/flow.sh | 25 -
examples/ip_pipeline/config/flow.txt | 17 -
examples/ip_pipeline/config/ip_pipeline.cfg | 9 -
examples/ip_pipeline/config/ip_pipeline.sh | 5 -
examples/ip_pipeline/config/kni.cfg | 67 -
examples/ip_pipeline/config/l2fwd.cfg | 58 -
examples/ip_pipeline/config/l3fwd.cfg | 68 -
examples/ip_pipeline/config/l3fwd.sh | 33 -
examples/ip_pipeline/config/l3fwd_arp.cfg | 70 -
examples/ip_pipeline/config/l3fwd_arp.sh | 43 -
examples/ip_pipeline/config/network_layers.cfg | 227 --
examples/ip_pipeline/config/network_layers.sh | 79 -
.../ip_pipeline/config/pipeline-to-core-mapping.py | 906 -----
examples/ip_pipeline/config/tap.cfg | 64 -
examples/ip_pipeline/config/tm_profile.cfg | 105 -
examples/ip_pipeline/config_check.c | 488 ---
examples/ip_pipeline/config_parse.c | 3395 ----------------
examples/ip_pipeline/config_parse_tm.c | 419 --
examples/ip_pipeline/conn.c | 326 ++
examples/ip_pipeline/conn.h | 47 +
examples/ip_pipeline/cpu_core_map.c | 471 ---
examples/ip_pipeline/cpu_core_map.h | 40 -
examples/ip_pipeline/examples/firewall.cli | 59 +
examples/ip_pipeline/examples/flow.cli | 60 +
examples/ip_pipeline/examples/kni.cli | 69 +
examples/ip_pipeline/examples/l2fwd.cli | 53 +
examples/ip_pipeline/examples/route.cli | 60 +
examples/ip_pipeline/examples/tap.cli | 66 +
examples/ip_pipeline/{pipeline => }/hash_func.h | 3 +-
.../ip_pipeline/{pipeline => }/hash_func_arm64.h | 0
examples/ip_pipeline/init.c | 1927 ---------
examples/ip_pipeline/kni.c | 167 +
examples/ip_pipeline/kni.h | 44 +
examples/ip_pipeline/link.c | 268 ++
examples/ip_pipeline/link.h | 63 +
examples/ip_pipeline/main.c | 253 +-
examples/ip_pipeline/mempool.c | 81 +
examples/ip_pipeline/mempool.h | 40 +
examples/ip_pipeline/meson.build | 35 +-
examples/ip_pipeline/parser.c | 16 +-
examples/ip_pipeline/parser.h | 8 +
examples/ip_pipeline/pipeline.c | 930 +++++
examples/ip_pipeline/pipeline.h | 373 +-
.../ip_pipeline/pipeline/pipeline_actions_common.h | 202 -
examples/ip_pipeline/pipeline/pipeline_common_be.c | 176 -
examples/ip_pipeline/pipeline/pipeline_common_be.h | 134 -
examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1455 -------
examples/ip_pipeline/pipeline/pipeline_common_fe.h | 231 --
examples/ip_pipeline/pipeline/pipeline_firewall.c | 1421 -------
examples/ip_pipeline/pipeline/pipeline_firewall.h | 60 -
.../ip_pipeline/pipeline/pipeline_firewall_be.c | 856 ----
.../ip_pipeline/pipeline/pipeline_firewall_be.h | 147 -
.../ip_pipeline/pipeline/pipeline_flow_actions.c | 1286 ------
.../ip_pipeline/pipeline/pipeline_flow_actions.h | 60 -
.../pipeline/pipeline_flow_actions_be.c | 983 -----
.../pipeline/pipeline_flow_actions_be.h | 139 -
.../pipeline/pipeline_flow_classification.c | 1878 ---------
.../pipeline/pipeline_flow_classification.h | 106 -
.../pipeline/pipeline_flow_classification_be.c | 723 ----
.../pipeline/pipeline_flow_classification_be.h | 113 -
examples/ip_pipeline/pipeline/pipeline_master.c | 20 -
examples/ip_pipeline/pipeline/pipeline_master.h | 12 -
examples/ip_pipeline/pipeline/pipeline_master_be.c | 141 -
examples/ip_pipeline/pipeline/pipeline_master_be.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough.c | 45 -
.../ip_pipeline/pipeline/pipeline_passthrough.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough_be.c | 929 -----
.../ip_pipeline/pipeline/pipeline_passthrough_be.h | 44 -
examples/ip_pipeline/pipeline/pipeline_routing.c | 1613 --------
examples/ip_pipeline/pipeline/pipeline_routing.h | 71 -
.../ip_pipeline/pipeline/pipeline_routing_be.c | 1966 ---------
.../ip_pipeline/pipeline/pipeline_routing_be.h | 283 --
examples/ip_pipeline/pipeline_be.h | 322 --
examples/ip_pipeline/swq.c | 74 +
examples/ip_pipeline/swq.h | 37 +
examples/ip_pipeline/tap.c | 97 +
examples/ip_pipeline/tap.h | 29 +
examples/ip_pipeline/thread.c | 2485 +++++++++++-
examples/ip_pipeline/thread.h | 75 +-
examples/ip_pipeline/thread_fe.c | 457 ---
examples/ip_pipeline/thread_fe.h | 72 -
examples/ip_pipeline/tmgr.c | 227 ++
examples/ip_pipeline/tmgr.h | 70 +
lib/librte_pipeline/Makefile | 6 +-
lib/librte_pipeline/meson.build | 7 +-
lib/librte_pipeline/rte_pipeline_version.map | 21 +
lib/librte_pipeline/rte_table_action.c | 2284 +++++++++++
lib/librte_pipeline/rte_table_action.h | 853 ++++
108 files changed, 13445 insertions(+), 27218 deletions(-)
create mode 100644 examples/ip_pipeline/action.c
create mode 100644 examples/ip_pipeline/action.h
delete mode 100644 examples/ip_pipeline/app.h
create mode 100644 examples/ip_pipeline/cli.c
create mode 100644 examples/ip_pipeline/cli.h
create mode 100644 examples/ip_pipeline/common.h
delete mode 100644 examples/ip_pipeline/config/action.cfg
delete mode 100644 examples/ip_pipeline/config/action.sh
delete mode 100644 examples/ip_pipeline/config/action.txt
delete mode 100755 examples/ip_pipeline/config/diagram-generator.py
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.sh
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.sh
delete mode 100644 examples/ip_pipeline/config/firewall.cfg
delete mode 100644 examples/ip_pipeline/config/firewall.sh
delete mode 100644 examples/ip_pipeline/config/firewall.txt
delete mode 100644 examples/ip_pipeline/config/flow.cfg
delete mode 100644 examples/ip_pipeline/config/flow.sh
delete mode 100644 examples/ip_pipeline/config/flow.txt
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.sh
delete mode 100644 examples/ip_pipeline/config/kni.cfg
delete mode 100644 examples/ip_pipeline/config/l2fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.sh
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.sh
delete mode 100644 examples/ip_pipeline/config/network_layers.cfg
delete mode 100644 examples/ip_pipeline/config/network_layers.sh
delete mode 100755 examples/ip_pipeline/config/pipeline-to-core-mapping.py
delete mode 100644 examples/ip_pipeline/config/tap.cfg
delete mode 100644 examples/ip_pipeline/config/tm_profile.cfg
delete mode 100644 examples/ip_pipeline/config_check.c
delete mode 100644 examples/ip_pipeline/config_parse.c
delete mode 100644 examples/ip_pipeline/config_parse_tm.c
create mode 100644 examples/ip_pipeline/conn.c
create mode 100644 examples/ip_pipeline/conn.h
delete mode 100644 examples/ip_pipeline/cpu_core_map.c
delete mode 100644 examples/ip_pipeline/cpu_core_map.h
create mode 100644 examples/ip_pipeline/examples/firewall.cli
create mode 100644 examples/ip_pipeline/examples/flow.cli
create mode 100644 examples/ip_pipeline/examples/kni.cli
create mode 100644 examples/ip_pipeline/examples/l2fwd.cli
create mode 100644 examples/ip_pipeline/examples/route.cli
create mode 100644 examples/ip_pipeline/examples/tap.cli
rename examples/ip_pipeline/{pipeline => }/hash_func.h (99%)
rename examples/ip_pipeline/{pipeline => }/hash_func_arm64.h (100%)
delete mode 100644 examples/ip_pipeline/init.c
create mode 100644 examples/ip_pipeline/kni.c
create mode 100644 examples/ip_pipeline/kni.h
create mode 100644 examples/ip_pipeline/link.c
create mode 100644 examples/ip_pipeline/link.h
create mode 100644 examples/ip_pipeline/mempool.c
create mode 100644 examples/ip_pipeline/mempool.h
create mode 100644 examples/ip_pipeline/pipeline.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h
delete mode 100644 examples/ip_pipeline/pipeline_be.h
create mode 100644 examples/ip_pipeline/swq.c
create mode 100644 examples/ip_pipeline/swq.h
create mode 100644 examples/ip_pipeline/tap.c
create mode 100644 examples/ip_pipeline/tap.h
delete mode 100644 examples/ip_pipeline/thread_fe.c
delete mode 100644 examples/ip_pipeline/thread_fe.h
create mode 100644 examples/ip_pipeline/tmgr.c
create mode 100644 examples/ip_pipeline/tmgr.h
create mode 100644 lib/librte_pipeline/rte_table_action.c
create mode 100644 lib/librte_pipeline/rte_table_action.hSignature · 1 line
2.9.3
PATCH v3 1/44 pipeline: add pipeline table action APIs
This API provides a common set of actions for pipeline tables to speed up application development.
Each match-action rule added to a pipeline table has associated data that stores the action context. This data is input to the table action handler called for every input packet that hits the rule as part of the table lookup during the pipeline execution.
The pipeline library allows the user to define his own table actions by providing customized table action handlers (table lookup) and complete freedom of setting the rules and their data (table rule add/delete). While the user can still follow this process, this API is intended to provide a quicker development alternative for a set of predefined actions.
The typical steps to use this API are:
* Define a table action profile.
* Instantiate the table action profile to create table action objects.
* Use the table action object to generate the pipeline table action handlers (invoked by the pipeline table lookup operation).
* Use the table action object to generate the rule data (for the pipeline table rule add operation) based on given action parameters.
* Use the table action object to read action data (e.g. stats counters) for any given rule.
--- doc/api/doxy-api-index.md | 1 + lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 5 +- lib/librte_pipeline/rte_pipeline_version.map | 13 ++ lib/librte_pipeline/rte_table_action.c | 279 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 224 +++++++++++++++++++++ 6 files changed, 522 insertions(+), 3 deletions(-) create mode 100644 lib/librte_pipeline/rte_table_action.c create mode 100644 lib/librte_pipeline/rte_table_action.h
doc/api/doxy-api-index.md +1 -0
@@ -159,6 +159,7 @@ The public API headers are grouped by topics: [array] (@ref rte_table_array.h), [stub] (@ref rte_table_stub.h) * [pipeline] (@ref rte_pipeline.h) + [table_action].....(@ref rte_table_action.h) - **basic**: [approx fraction] (@ref rte_approx.h),
lib/librte_pipeline/Makefile +2 -1
@@ -21,8 +21,9 @@ LIBABIVER := 3 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += rte_table_action.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h +SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h rte_table_action.h include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/meson.build +3 -2
@@ -2,6 +2,7 @@ # Copyright(c) 2017 Intel Corporation version = 3 -sources = files('rte_pipeline.c') -headers = files('rte_pipeline.h') +allow_experimental_apis = true +sources = files('rte_pipeline.c', 'rte_table_action.c') +headers = files('rte_pipeline.h', 'rte_table_action.h') deps += ['port', 'table']
lib/librte_pipeline/rte_pipeline_version.map +13 -0
@@ -45,3 +45,16 @@ DPDK_16.04 { rte_pipeline_ah_packet_drop; } DPDK_2.2; + +EXPERIMENTAL { + global: + + rte_table_action_apply; + rte_table_action_create; + rte_table_action_free; + rte_table_action_profile_action_register; + rte_table_action_profile_create; + rte_table_action_profile_free; + rte_table_action_profile_freeze; + +} DPDK_16.04;
lib/librte_pipeline/rte_table_action.c new file +279 -0
279 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h new file +224 -0
224 lines not on this page · raw message
Signature · 1 line
2.9.3
v4 cover ip_pipeline: refactoring
Refactored the IP pipeline application. As result, the code base size (lines of code) reduces by ~60%.
1. Moved table actions into the librte_pipeline library. As result, the pre-fabricated pipelines from the application pipeline folder were removed. The flexibility is greatly improved, as now any action can be combined with any match (i.e. table type), which was not possible before.
2. Removed configuration file as the initialization method. Now all the pipelines are set up and assigned to threads through CLI commands for improved flexibility.
3. Replaced the local CLI with remote CLI. Any standard TCP client (e.g. telnet, netcat) can now connect to the app, send request as command string through the network and wait for the response string before pushing the next command. Results in better flexibility and automation.
v4:
- add pipeline port action APIs.
- add load balance pipeline table action.
- add cli for adding bulk entries to pipeline table.
- add check to return error when pipeline is not enabled on the thread.
- add source and sink port params to cli
v3:
- add checksum update for TTL and NAT action
- fix build warning
v2:
- split the patch that removes the existing pipeline components into multiple patches.
- fix checkpatch errors.
Jasvinder Singh (49):
pipeline: add pipeline table action APIs
pipeline: get pipeline table action params
pipeline: add traffic metering action
pipeline: add traffic manager action
pipeline: add packet encapsulation action
pipeline: add nat action
pipeline: add ttl update action
pipeline: add statistics read action
pipeline: add timestamp action
pipeline: add load balance action
pipeline: add pipeline port in action APIs librte_table/acl: remove incorrect check
ip_pipeline: remove passthrough pipeline
ip_pipeline: remove routing pipeline
ip_pipeline: remove flow classification pipeline
ip_pipeline: remove flow actions pipeline
ip_pipeline: remove firewall pipeline
ip_pipeline: remove master pipeline
ip_pipeline: remove config
ip_pipeline: rework and improvements
ip_pipeline: add cli interface
ip_pipeline: add mempool object for pipeline
ip_pipeline: add link object
ip_pipeline: add software queue object
ip_pipeline: add traffic manager object
ip_pipeline: add tap object
ip_pipeline: add kni object
ip_pipeline: add action profile object
ip_pipeline: add pipeline object
ip_pipeline: add threads
ip_pipeline: add thread runtime
ip_pipeline: add cli to enable and disable pipeline
ip_pipeline: add cli to enable and disable pipeline port
ip_pipeline: add cli to read pipeline port and table stats
ip_pipeline: add cli for pipeline table entry
ip_pipeline: add cli to delete pipeline table entry
ip_pipeline: add cli for bulk entries to pipeline table
ip_pipeline: add cli to read pipeline table entry stats
ip_pipeline: add cli to configure meter profile
ip_pipeline: add cli to read meter stats
ip_pipeline: add cli to update dscp table
ip_pipeline: add cli to read ttl stats
ip_pipeline: add cli for load balance action
ip_pipeline: add l2fwd example
ip_pipeline: add KNI port example
ip_pipeline: add TAP port example
ip_pipeline: add route example
ip_pipeline: add firewall example
ip_pipeline: add flow classification example
doc/api/doxy-api-index.md | 1 +
examples/ip_pipeline/Makefile | 49 +-
examples/ip_pipeline/action.c | 289 ++
examples/ip_pipeline/action.h | 77 +
examples/ip_pipeline/app.h | 1401 ------
examples/ip_pipeline/cli.c | 4814 ++++++++++++++++++++
examples/ip_pipeline/cli.h | 18 +
examples/ip_pipeline/common.h | 12 +
examples/ip_pipeline/config/action.cfg | 68 -
examples/ip_pipeline/config/action.sh | 119 -
examples/ip_pipeline/config/action.txt | 8 -
examples/ip_pipeline/config/diagram-generator.py | 317 --
.../ip_pipeline/config/edge_router_downstream.cfg | 97 -
.../ip_pipeline/config/edge_router_downstream.sh | 13 -
.../ip_pipeline/config/edge_router_upstream.cfg | 124 -
.../ip_pipeline/config/edge_router_upstream.sh | 33 -
examples/ip_pipeline/config/firewall.cfg | 68 -
examples/ip_pipeline/config/firewall.sh | 13 -
examples/ip_pipeline/config/firewall.txt | 9 -
examples/ip_pipeline/config/flow.cfg | 72 -
examples/ip_pipeline/config/flow.sh | 25 -
examples/ip_pipeline/config/flow.txt | 17 -
examples/ip_pipeline/config/ip_pipeline.cfg | 9 -
examples/ip_pipeline/config/ip_pipeline.sh | 5 -
examples/ip_pipeline/config/kni.cfg | 67 -
examples/ip_pipeline/config/l2fwd.cfg | 58 -
examples/ip_pipeline/config/l3fwd.cfg | 68 -
examples/ip_pipeline/config/l3fwd.sh | 33 -
examples/ip_pipeline/config/l3fwd_arp.cfg | 70 -
examples/ip_pipeline/config/l3fwd_arp.sh | 43 -
examples/ip_pipeline/config/network_layers.cfg | 227 -
examples/ip_pipeline/config/network_layers.sh | 79 -
.../ip_pipeline/config/pipeline-to-core-mapping.py | 906 ----
examples/ip_pipeline/config/tap.cfg | 64 -
examples/ip_pipeline/config/tm_profile.cfg | 105 -
examples/ip_pipeline/config_check.c | 488 --
examples/ip_pipeline/config_parse.c | 3395 --------------
examples/ip_pipeline/config_parse_tm.c | 419 --
examples/ip_pipeline/conn.c | 326 ++
examples/ip_pipeline/conn.h | 47 +
examples/ip_pipeline/cpu_core_map.c | 471 --
examples/ip_pipeline/cpu_core_map.h | 40 -
examples/ip_pipeline/examples/firewall.cli | 59 +
examples/ip_pipeline/examples/flow.cli | 60 +
examples/ip_pipeline/examples/kni.cli | 69 +
examples/ip_pipeline/examples/l2fwd.cli | 51 +
examples/ip_pipeline/examples/route.cli | 60 +
examples/ip_pipeline/examples/tap.cli | 66 +
examples/ip_pipeline/{pipeline => }/hash_func.h | 3 +-
.../ip_pipeline/{pipeline => }/hash_func_arm64.h | 0
examples/ip_pipeline/init.c | 1927 --------
examples/ip_pipeline/kni.c | 167 +
examples/ip_pipeline/kni.h | 44 +
examples/ip_pipeline/link.c | 268 ++
examples/ip_pipeline/link.h | 63 +
examples/ip_pipeline/main.c | 259 +-
examples/ip_pipeline/mempool.c | 81 +
examples/ip_pipeline/mempool.h | 40 +
examples/ip_pipeline/meson.build | 35 +-
examples/ip_pipeline/parser.c | 16 +-
examples/ip_pipeline/parser.h | 8 +
examples/ip_pipeline/pipeline.c | 973 ++++
examples/ip_pipeline/pipeline.h | 389 +-
.../ip_pipeline/pipeline/pipeline_actions_common.h | 202 -
examples/ip_pipeline/pipeline/pipeline_common_be.c | 176 -
examples/ip_pipeline/pipeline/pipeline_common_be.h | 134 -
examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1455 ------
examples/ip_pipeline/pipeline/pipeline_common_fe.h | 231 -
examples/ip_pipeline/pipeline/pipeline_firewall.c | 1421 ------
examples/ip_pipeline/pipeline/pipeline_firewall.h | 60 -
.../ip_pipeline/pipeline/pipeline_firewall_be.c | 856 ----
.../ip_pipeline/pipeline/pipeline_firewall_be.h | 147 -
.../ip_pipeline/pipeline/pipeline_flow_actions.c | 1286 ------
.../ip_pipeline/pipeline/pipeline_flow_actions.h | 60 -
.../pipeline/pipeline_flow_actions_be.c | 983 ----
.../pipeline/pipeline_flow_actions_be.h | 139 -
.../pipeline/pipeline_flow_classification.c | 1878 --------
.../pipeline/pipeline_flow_classification.h | 106 -
.../pipeline/pipeline_flow_classification_be.c | 723 ---
.../pipeline/pipeline_flow_classification_be.h | 113 -
examples/ip_pipeline/pipeline/pipeline_master.c | 20 -
examples/ip_pipeline/pipeline/pipeline_master.h | 12 -
examples/ip_pipeline/pipeline/pipeline_master_be.c | 141 -
examples/ip_pipeline/pipeline/pipeline_master_be.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough.c | 45 -
.../ip_pipeline/pipeline/pipeline_passthrough.h | 12 -
.../ip_pipeline/pipeline/pipeline_passthrough_be.c | 929 ----
.../ip_pipeline/pipeline/pipeline_passthrough_be.h | 44 -
examples/ip_pipeline/pipeline/pipeline_routing.c | 1613 -------
examples/ip_pipeline/pipeline/pipeline_routing.h | 71 -
.../ip_pipeline/pipeline/pipeline_routing_be.c | 1966 --------
.../ip_pipeline/pipeline/pipeline_routing_be.h | 283 --
examples/ip_pipeline/pipeline_be.h | 322 --
examples/ip_pipeline/swq.c | 74 +
examples/ip_pipeline/swq.h | 37 +
examples/ip_pipeline/tap.c | 97 +
examples/ip_pipeline/tap.h | 29 +
examples/ip_pipeline/thread.c | 2796 +++++++++++-
examples/ip_pipeline/thread.h | 75 +-
examples/ip_pipeline/thread_fe.c | 457 --
examples/ip_pipeline/thread_fe.h | 72 -
examples/ip_pipeline/tmgr.c | 227 +
examples/ip_pipeline/tmgr.h | 70 +
lib/librte_pipeline/Makefile | 7 +-
lib/librte_pipeline/meson.build | 7 +-
lib/librte_pipeline/rte_pipeline_version.map | 29 +
lib/librte_pipeline/rte_port_in_action.c | 531 +++
lib/librte_pipeline/rte_port_in_action.h | 301 ++
lib/librte_pipeline/rte_table_action.c | 2386 ++++++++++
lib/librte_pipeline/rte_table_action.h | 905 ++++
lib/librte_table/rte_table_acl.c | 6 -
111 files changed, 15520 insertions(+), 27228 deletions(-)
create mode 100644 examples/ip_pipeline/action.c
create mode 100644 examples/ip_pipeline/action.h
delete mode 100644 examples/ip_pipeline/app.h
create mode 100644 examples/ip_pipeline/cli.c
create mode 100644 examples/ip_pipeline/cli.h
create mode 100644 examples/ip_pipeline/common.h
delete mode 100644 examples/ip_pipeline/config/action.cfg
delete mode 100644 examples/ip_pipeline/config/action.sh
delete mode 100644 examples/ip_pipeline/config/action.txt
delete mode 100755 examples/ip_pipeline/config/diagram-generator.py
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.sh
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.cfg
delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.sh
delete mode 100644 examples/ip_pipeline/config/firewall.cfg
delete mode 100644 examples/ip_pipeline/config/firewall.sh
delete mode 100644 examples/ip_pipeline/config/firewall.txt
delete mode 100644 examples/ip_pipeline/config/flow.cfg
delete mode 100644 examples/ip_pipeline/config/flow.sh
delete mode 100644 examples/ip_pipeline/config/flow.txt
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg
delete mode 100644 examples/ip_pipeline/config/ip_pipeline.sh
delete mode 100644 examples/ip_pipeline/config/kni.cfg
delete mode 100644 examples/ip_pipeline/config/l2fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd.sh
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.cfg
delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.sh
delete mode 100644 examples/ip_pipeline/config/network_layers.cfg
delete mode 100644 examples/ip_pipeline/config/network_layers.sh
delete mode 100755 examples/ip_pipeline/config/pipeline-to-core-mapping.py
delete mode 100644 examples/ip_pipeline/config/tap.cfg
delete mode 100644 examples/ip_pipeline/config/tm_profile.cfg
delete mode 100644 examples/ip_pipeline/config_check.c
delete mode 100644 examples/ip_pipeline/config_parse.c
delete mode 100644 examples/ip_pipeline/config_parse_tm.c
create mode 100644 examples/ip_pipeline/conn.c
create mode 100644 examples/ip_pipeline/conn.h
delete mode 100644 examples/ip_pipeline/cpu_core_map.c
delete mode 100644 examples/ip_pipeline/cpu_core_map.h
create mode 100644 examples/ip_pipeline/examples/firewall.cli
create mode 100644 examples/ip_pipeline/examples/flow.cli
create mode 100644 examples/ip_pipeline/examples/kni.cli
create mode 100644 examples/ip_pipeline/examples/l2fwd.cli
create mode 100644 examples/ip_pipeline/examples/route.cli
create mode 100644 examples/ip_pipeline/examples/tap.cli
rename examples/ip_pipeline/{pipeline => }/hash_func.h (99%)
rename examples/ip_pipeline/{pipeline => }/hash_func_arm64.h (100%)
delete mode 100644 examples/ip_pipeline/init.c
create mode 100644 examples/ip_pipeline/kni.c
create mode 100644 examples/ip_pipeline/kni.h
create mode 100644 examples/ip_pipeline/link.c
create mode 100644 examples/ip_pipeline/link.h
create mode 100644 examples/ip_pipeline/mempool.c
create mode 100644 examples/ip_pipeline/mempool.h
create mode 100644 examples/ip_pipeline/pipeline.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h
delete mode 100644 examples/ip_pipeline/pipeline_be.h
create mode 100644 examples/ip_pipeline/swq.c
create mode 100644 examples/ip_pipeline/swq.h
create mode 100644 examples/ip_pipeline/tap.c
create mode 100644 examples/ip_pipeline/tap.h
delete mode 100644 examples/ip_pipeline/thread_fe.c
delete mode 100644 examples/ip_pipeline/thread_fe.h
create mode 100644 examples/ip_pipeline/tmgr.c
create mode 100644 examples/ip_pipeline/tmgr.h
create mode 100644 lib/librte_pipeline/rte_port_in_action.c
create mode 100644 lib/librte_pipeline/rte_port_in_action.h
create mode 100644 lib/librte_pipeline/rte_table_action.c
create mode 100644 lib/librte_pipeline/rte_table_action.hSignature · 1 line
2.9.3
PATCH v4 1/49 pipeline: add pipeline table action APIs
This API provides a common set of actions for pipeline tables to speed up application development.
Each match-action rule added to a pipeline table has associated data that stores the action context. This data is input to the table action handler called for every input packet that hits the rule as part of the table lookup during the pipeline execution.
The pipeline library allows the user to define his own table actions by providing customized table action handlers (table lookup) and complete freedom of setting the rules and their data (table rule add/delete). While the user can still follow this process, this API is intended to provide a quicker development alternative for a set of predefined actions.
The typical steps to use this API are:
* Define a table action profile.
* Instantiate the table action profile to create table action objects.
* Use the table action object to generate the pipeline table action handlers (invoked by the pipeline table lookup operation).
* Use the table action object to generate the rule data (for the pipeline table rule add operation) based on given action parameters.
* Use the table action object to read action data (e.g. stats counters) for any given rule.
--- doc/api/doxy-api-index.md | 1 + lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 5 +- lib/librte_pipeline/rte_pipeline_version.map | 13 ++ lib/librte_pipeline/rte_table_action.c | 279 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 224 +++++++++++++++++++++ 6 files changed, 522 insertions(+), 3 deletions(-) create mode 100644 lib/librte_pipeline/rte_table_action.c create mode 100644 lib/librte_pipeline/rte_table_action.h
doc/api/doxy-api-index.md +1 -0
@@ -159,6 +159,7 @@ The public API headers are grouped by topics: [array] (@ref rte_table_array.h), [stub] (@ref rte_table_stub.h) * [pipeline] (@ref rte_pipeline.h) + [table_action].....(@ref rte_table_action.h) - **basic**: [approx fraction] (@ref rte_approx.h),
lib/librte_pipeline/Makefile +2 -1
@@ -21,8 +21,9 @@ LIBABIVER := 3 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += rte_table_action.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h +SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h rte_table_action.h include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/meson.build +3 -2
@@ -2,6 +2,7 @@ # Copyright(c) 2017 Intel Corporation version = 3 -sources = files('rte_pipeline.c') -headers = files('rte_pipeline.h') +allow_experimental_apis = true +sources = files('rte_pipeline.c', 'rte_table_action.c') +headers = files('rte_pipeline.h', 'rte_table_action.h') deps += ['port', 'table']
lib/librte_pipeline/rte_pipeline_version.map +13 -0
@@ -45,3 +45,16 @@ DPDK_16.04 { rte_pipeline_ah_packet_drop; } DPDK_2.2; + +EXPERIMENTAL { + global: + + rte_table_action_apply; + rte_table_action_create; + rte_table_action_free; + rte_table_action_profile_action_register; + rte_table_action_profile_create; + rte_table_action_profile_free; + rte_table_action_profile_freeze; + +} DPDK_16.04;
lib/librte_pipeline/rte_table_action.c new file +279 -0
279 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h new file +224 -0
224 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 2/49 pipeline: get pipeline table action params
In reply to Jasvinder SinghAdd API to specify action related parameters such as action handler, table entry data size, etc. for the pipeline table.
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 130 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 14 +++ 3 files changed, 145 insertions(+)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -56,5 +56,6 @@ EXPERIMENTAL { rte_table_action_profile_create; rte_table_action_profile_free; rte_table_action_profile_freeze; + rte_table_action_table_params_get; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +130 -0
136 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +14 -0
@@ -194,6 +194,20 @@ int __rte_experimental rte_table_action_free(struct rte_table_action *action);/** +* Table action table params get. +* +* @param[in] action +* Handle to table action object (needs to be valid). +* @param[inout] params +* Pipeline table parameters (needs to be pre-allocated). +* @return +* Zero on success, non-zero error code otherwise. +*/ +int __rte_experimental +rte_table_action_table_params_get (struct rte_table_action *action, +struct rte_pipeline_table_params *params); + +/** * Table action apply. * * @param[in] action
Signature · 1 line
2.9.3
PATCH v4 3/49 pipeline: add traffic metering action
In reply to Jasvinder SinghAdd traffic metering action implementation.
--- lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 2 +- lib/librte_pipeline/rte_pipeline_version.map | 4 + lib/librte_pipeline/rte_table_action.c | 640 ++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 248 +++++++++++ 5 files changed, 879 insertions(+), 18 deletions(-)
lib/librte_pipeline/Makefile +2 -1
@@ -8,10 +8,11 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pipeline.a +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_table -LDLIBS += -lrte_port +LDLIBS += -lrte_port -lrte_meter EXPORT_MAP := rte_pipeline_version.map
lib/librte_pipeline/meson.build +1 -1
@@ -5,4 +5,4 @@ version = 3 allow_experimental_apis = true sources = files('rte_pipeline.c', 'rte_table_action.c') headers = files('rte_pipeline.h', 'rte_table_action.h') -deps += ['port', 'table'] +deps += ['port', 'table', 'meter']
lib/librte_pipeline/rte_pipeline_version.map +4 -0
@@ -51,7 +51,11 @@ EXPERIMENTAL { rte_table_action_apply; rte_table_action_create; + rte_table_action_dscp_table_update; rte_table_action_free; + rte_table_action_meter_profile_add; + rte_table_action_meter_profile_delete; + rte_table_action_meter_read; rte_table_action_profile_action_register; rte_table_action_profile_create; rte_table_action_profile_free;
lib/librte_pipeline/rte_table_action.c +624 -16
741 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +248 -0
272 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 4/49 pipeline: add traffic manager action
In reply to Jasvinder SinghAdd implementation of traffic manager action.
--- lib/librte_pipeline/Makefile | 2 +- lib/librte_pipeline/meson.build | 2 +- lib/librte_pipeline/rte_table_action.c | 130 ++++++++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 24 ++++++ 4 files changed, 155 insertions(+), 3 deletions(-)
lib/librte_pipeline/Makefile +1 -1
@@ -12,7 +12,7 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_table -LDLIBS += -lrte_port -lrte_meter +LDLIBS += -lrte_port -lrte_meter -lrte_sched EXPORT_MAP := rte_pipeline_version.map
lib/librte_pipeline/meson.build +1 -1
@@ -5,4 +5,4 @@ version = 3 allow_experimental_apis = true sources = files('rte_pipeline.c', 'rte_table_action.c') headers = files('rte_pipeline.h', 'rte_table_action.h') -deps += ['port', 'table', 'meter'] +deps += ['port', 'table', 'meter', 'sched']
lib/librte_pipeline/rte_table_action.c +129 -1
196 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +24 -0
@@ -70,6 +70,9 @@ enum rte_table_action_type {/** Traffic Metering and Policing. */ RTE_TABLE_ACTION_MTR , + +/** Traffic Management. */ + RTE_TABLE_ACTION_TM, };/** Common action configuration (per table action profile). */
@@ -256,6 +259,27 @@ struct rte_table_action_mtr_counters { };/** +* RTE_TABLE_ACTION_TM +*/ +/** Traffic management action configuration (per table action profile). */ +struct rte_table_action_tm_config { +/** Number of subports per port. */ +uint32_t n_subports_per_port; + +/** Number of pipes per subport. */ +uint32_t n_pipes_per_subport; +}; + +/** Traffic management action parameters (per table rule). */ +struct rte_table_action_tm_params { +/** Subport ID. */ +uint32_t subport_id; + +/** Pipe ID. */ +uint32_t pipe_id; +}; + +/** * Table action profile. */ struct rte_table_action_profile ;
Signature · 1 line
2.9.3
PATCH v4 5/49 pipeline: add packet encapsulation action
In reply to Jasvinder SinghAdd implementation of different type of packet encap such as vlan, qinq, mpls, pppoe, etc.
--- lib/librte_pipeline/rte_table_action.c | 440 ++++++++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 129 ++++++++++ 2 files changed, 568 insertions(+), 1 deletion(-)
lib/librte_pipeline/rte_table_action.c +439 -1
@@ -9,8 +9,12 @@#include <rte_byteorder.h> #include <rte_cycles.h> #include <rte_malloc.h> +#include <rte_memcpy.h> +#include <rte_ether.h> #include <rte_ip.h> - +#include <rte_esp.h> +#include <rte_tcp.h> +#include <rte_udp.h> #include "rte_table_action.h"
@@ -366,6 +370,369 @@ pkt_work_tm(struct rte_mbuf *mbuf, }/** +* RTE_TABLE_ACTION_ENCAP +*/ +static int +encap_valid (enum rte_table_action_encap_type encap) +{ +switch (encap) { +case RTE_TABLE_ACTION_ENCAP_ETHER : +case RTE_TABLE_ACTION_ENCAP_VLAN : +case RTE_TABLE_ACTION_ENCAP_QINQ : +case RTE_TABLE_ACTION_ENCAP_MPLS : +case RTE_TABLE_ACTION_ENCAP_PPPOE : +return 1 ; +default : +return 0 ; + } +} + +static int +encap_cfg_check (struct rte_table_action_encap_config *encap) +{ +if ((encap->encap_mask ==0 ) || + (__builtin_popcountll (encap->encap_mask) !=1 )) +return -ENOTSUP ; + +return 0 ; +} + +struct encap_ether_data { +struct ether_hdr ether; +} __attribute__((__packed__ )); + +#define VLAN (pcp, dei, vid) \ + ((uint16_t)((((uint64_t)(pcp)) & 0x7LLU) << 13) | \ + ((((uint64_t)(dei)) & 0x1LLU) << 12) | \ + (((uint64_t)(vid)) & 0xFFFLLU)) \ + +struct encap_vlan_data { +struct ether_hdr ether; +struct vlan_hdr vlan; +} __attribute__((__packed__ )); + +struct encap_qinq_data { +struct ether_hdr ether; +struct vlan_hdr svlan; +struct vlan_hdr cvlan; +} __attribute__((__packed__ )); + +#define ETHER_TYPE_MPLS_UNICAST 0x8847 + +#define ETHER_TYPE_MPLS_MULTICAST 0x8848 + +#define MPLS (label, tc, s, ttl) \ + ((uint32_t)(((((uint64_t)(label)) & 0xFFFFFLLU) << 12) |\ + ((((uint64_t)(tc)) & 0x7LLU) << 9) | \ + ((((uint64_t)(s)) & 0x1LLU) << 8) | \ + (((uint64_t)(ttl)) & 0xFFLLU))) + +struct encap_mpls_data { +struct ether_hdr ether; +uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX ]; +uint32_t mpls_count; +} __attribute__((__packed__ )); + +#define ETHER_TYPE_PPPOE_SESSION 0x8864 + +#define PPP_PROTOCOL_IP 0x0021 + +struct pppoe_ppp_hdr { +uint16_t ver_type_code; +uint16_t session_id; +uint16_t length; +uint16_t protocol; +} __attribute__((__packed__ )); + +struct encap_pppoe_data { +struct ether_hdr ether; +struct pppoe_ppp_hdr pppoe_ppp; +} __attribute__((__packed__ )); + +static size_t +encap_data_size (struct rte_table_action_encap_config *encap) +{ +switch (encap->encap_mask) { +case 1LLU <<RTE_TABLE_ACTION_ENCAP_ETHER : +return sizeof (struct encap_ether_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_VLAN : +return sizeof (struct encap_vlan_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_QINQ : +return sizeof (struct encap_qinq_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_MPLS : +return sizeof (struct encap_mpls_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_PPPOE : +return sizeof (struct encap_pppoe_data ); + +default : +return 0 ; + } +} + +static int +encap_apply_check (struct rte_table_action_encap_params *p, +struct rte_table_action_encap_config *cfg) +{ +if ((encap_valid (p->type) ==0 ) || + ((cfg->encap_mask & (1LLU << p->type)) ==0 )) +return -EINVAL ; + +switch (p->type) { +case RTE_TABLE_ACTION_ENCAP_ETHER : +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_VLAN : +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_QINQ : +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_MPLS : +if ((p->mpls.mpls_count ==0 ) || + (p->mpls.mpls_count >RTE_TABLE_ACTION_MPLS_LABELS_MAX )) +return -EINVAL ; + +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_PPPOE : +return 0 ; + +default : +return -EINVAL ; + } +} + +static int +encap_ether_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_common_config *common_cfg) +{ +struct encap_ether_data *d = data; +uint16_t ethertype = (common_cfg->ip_version) ? + ETHER_TYPE_IPv4 : + ETHER_TYPE_IPv6; + +/* Ethernet */ +ether_addr_copy (&p->ether.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->ether.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ethertype); + +return 0 ; +} + +static int +encap_vlan_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_common_config *common_cfg) +{ +struct encap_vlan_data *d = data; +uint16_t ethertype = (common_cfg->ip_version) ? + ETHER_TYPE_IPv4 : + ETHER_TYPE_IPv6; + +/* Ethernet */ +ether_addr_copy (&p->vlan.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->vlan.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ETHER_TYPE_VLAN ); + +/* VLAN */ + d->vlan.vlan_tci =rte_htons (VLAN (p->vlan.vlan.pcp, + p->vlan.vlan.dei, + p->vlan.vlan.vid)); + d->vlan.eth_proto =rte_htons (ethertype); + +return 0 ; +} + +static int +encap_qinq_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_common_config *common_cfg) +{ +struct encap_qinq_data *d = data; +uint16_t ethertype = (common_cfg->ip_version) ? + ETHER_TYPE_IPv4 : + ETHER_TYPE_IPv6; + +/* Ethernet */ +ether_addr_copy (&p->qinq.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->qinq.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ETHER_TYPE_QINQ ); + +/* SVLAN */ + d->svlan.vlan_tci =rte_htons (VLAN (p->qinq.svlan.pcp, + p->qinq.svlan.dei, + p->qinq.svlan.vid)); + d->svlan.eth_proto =rte_htons (ETHER_TYPE_VLAN ); + +/* CVLAN */ + d->cvlan.vlan_tci =rte_htons (VLAN (p->qinq.cvlan.pcp, + p->qinq.cvlan.dei, + p->qinq.cvlan.vid)); + d->cvlan.eth_proto =rte_htons (ethertype); + +return 0 ; +} + +static int +encap_mpls_apply (void *data, +struct rte_table_action_encap_params *p) +{ +struct encap_mpls_data *d = data; +uint16_t ethertype = (p->mpls.unicast) ? +ETHER_TYPE_MPLS_UNICAST : +ETHER_TYPE_MPLS_MULTICAST ; +uint32_t i; + +/* Ethernet */ +ether_addr_copy (&p->mpls.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->mpls.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ethertype); + +/* MPLS */ +for (i =0 ; i < p->mpls.mpls_count -1 ; i++) + d->mpls[i] =rte_htonl (MPLS (p->mpls.mpls[i].label, + p->mpls.mpls[i].tc, +0 , + p->mpls.mpls[i].ttl)); + + d->mpls[i] =rte_htonl (MPLS (p->mpls.mpls[i].label, + p->mpls.mpls[i].tc, +1 , + p->mpls.mpls[i].ttl)); + + d->mpls_count = p->mpls.mpls_count; +return 0 ; +} + +static int +encap_pppoe_apply (void *data, +struct rte_table_action_encap_params *p) +{ +struct encap_pppoe_data *d = data; + +/* Ethernet */ +ether_addr_copy (&p->pppoe.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->pppoe.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ETHER_TYPE_PPPOE_SESSION ); + +/* PPPoE and PPP*/ + d->pppoe_ppp.ver_type_code =rte_htons (0x1100 ); + d->pppoe_ppp.session_id =rte_htons (p->pppoe.pppoe.session_id); + d->pppoe_ppp.length =0 ;/* not pre-computed */ + d->pppoe_ppp.protocol =rte_htons (PPP_PROTOCOL_IP ); + +return 0 ; +} + +static int +encap_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_encap_config *cfg, +struct rte_table_action_common_config *common_cfg) +{ +int status; + +/* Check input arguments */ + status =encap_apply_check (p, cfg); +if (status) +return status; + +switch (p->type) { +case RTE_TABLE_ACTION_ENCAP_ETHER : +return encap_ether_apply (data, p, common_cfg); + +case RTE_TABLE_ACTION_ENCAP_VLAN : +return encap_vlan_apply (data, p, common_cfg); + +case RTE_TABLE_ACTION_ENCAP_QINQ : +return encap_qinq_apply (data, p, common_cfg); + +case RTE_TABLE_ACTION_ENCAP_MPLS : +return encap_mpls_apply (data, p); + +case RTE_TABLE_ACTION_ENCAP_PPPOE : +return encap_pppoe_apply (data, p); + +default : +return -EINVAL ; + } +} + +static __rte_always_inline void * +encap (void *dst,const void *src,size_t n) +{ + dst = ((uint8_t *) dst) - n; +return rte_memcpy (dst, src, n); +} + +static __rte_always_inline void +pkt_work_encap (struct rte_mbuf *mbuf, +void *data, +struct rte_table_action_encap_config *cfg, +void *ip, +uint16_t total_length, +uint32_t ip_offset) +{ +switch (cfg->encap_mask) { +case 1LLU <<RTE_TABLE_ACTION_ENCAP_ETHER : +encap (ip, data,sizeof (struct encap_ether_data )); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_ether_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_ether_data ); +break ; + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_VLAN : +encap (ip, data,sizeof (struct encap_vlan_data )); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_vlan_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_vlan_data ); +break ; + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_QINQ : +encap (ip, data,sizeof (struct encap_qinq_data )); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_qinq_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_qinq_data ); +break ; + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_MPLS : + { +struct encap_mpls_data *mpls = data; +size_t size =sizeof (struct ether_hdr ) + + mpls->mpls_count *4 ; + +encap (ip, data, size); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + size); + mbuf->pkt_len = mbuf->data_len = total_length + size; +break ; + } + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_PPPOE : + { +struct encap_pppoe_data *pppoe = +encap (ip, data,sizeof (struct encap_pppoe_data )); + pppoe->pppoe_ppp.length =rte_htons (total_length +2 ); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_pppoe_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_pppoe_data ); +break ; + } + +default : +break ; + } +} + +/** * Action profile */ static int
@@ -375,6 +742,7 @@ action_valid(enum rte_table_action_type action)case RTE_TABLE_ACTION_FWD :case RTE_TABLE_ACTION_MTR :case RTE_TABLE_ACTION_TM : +case RTE_TABLE_ACTION_ENCAP :return 1 ;default :return 0 ;
@@ -389,6 +757,7 @@ struct ap_config {struct rte_table_action_common_config common;struct rte_table_action_mtr_config mtr;struct rte_table_action_tm_config tm; +struct rte_table_action_encap_config encap; }; static size_t
@@ -399,6 +768,8 @@ action_cfg_size(enum rte_table_action_type action)return sizeof (struct rte_table_action_mtr_config );case RTE_TABLE_ACTION_TM :return sizeof (struct rte_table_action_tm_config ); +case RTE_TABLE_ACTION_ENCAP : +return sizeof (struct rte_table_action_encap_config );default :return 0 ; }
@@ -415,6 +786,9 @@ action_cfg_get(struct ap_config *ap_config,case RTE_TABLE_ACTION_TM :return &ap_config->tm; +case RTE_TABLE_ACTION_ENCAP : +return &ap_config->encap; +default :return NULL ; }
@@ -452,6 +826,9 @@ action_data_size(enum rte_table_action_type action,case RTE_TABLE_ACTION_TM :return sizeof (struct tm_data ); +case RTE_TABLE_ACTION_ENCAP : +return encap_data_size (&ap_config->encap); +default :return 0 ; }
@@ -531,6 +908,10 @@ rte_table_action_profile_action_register(struct rte_table_action_profile *profil status =tm_cfg_check (action_config);break ; +case RTE_TABLE_ACTION_ENCAP : + status =encap_cfg_check (action_config); +break ; +default : status =0 ;break ;
@@ -653,6 +1034,12 @@ rte_table_action_apply(struct rte_table_action *action, action_params, &action->cfg.tm); +case RTE_TABLE_ACTION_ENCAP : +return encap_apply (action_data, + action_params, + &action->cfg.encap, + &action->cfg.common); +default :return -EINVAL ; }
@@ -870,6 +1257,18 @@ pkt_work(struct rte_mbuf *mbuf, dscp); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_ENCAP )) { +void *data = +action_data_get (table_entry, action,RTE_TABLE_ACTION_ENCAP ); + +pkt_work_encap (mbuf, + data, + &cfg->encap, + ip, + total_length, + ip_offset); + } +return drop_mask; }
@@ -1014,6 +1413,45 @@ pkt4_work(struct rte_mbuf **mbufs, dscp3); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_ENCAP )) { +void *data0 = +action_data_get (table_entry0, action,RTE_TABLE_ACTION_ENCAP ); +void *data1 = +action_data_get (table_entry1, action,RTE_TABLE_ACTION_ENCAP ); +void *data2 = +action_data_get (table_entry2, action,RTE_TABLE_ACTION_ENCAP ); +void *data3 = +action_data_get (table_entry3, action,RTE_TABLE_ACTION_ENCAP ); + +pkt_work_encap (mbuf0, + data0, + &cfg->encap, + ip0, + total_length0, + ip_offset); + +pkt_work_encap (mbuf1, + data1, + &cfg->encap, + ip1, + total_length1, + ip_offset); + +pkt_work_encap (mbuf2, + data2, + &cfg->encap, + ip2, + total_length2, + ip_offset); + +pkt_work_encap (mbuf3, + data3, + &cfg->encap, + ip3, + total_length3, + ip_offset); + } +return drop_mask0 | (drop_mask1 <<1 ) | (drop_mask2 << 2) |
lib/librte_pipeline/rte_table_action.h +129 -0
147 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 6/49 pipeline: add nat action
In reply to Jasvinder SinghAdd implementation of Network Address Translation(NAT) action.
--- lib/librte_pipeline/rte_table_action.c | 351 +++++++++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 39 ++++ 2 files changed, 390 insertions(+)
lib/librte_pipeline/rte_table_action.c +351 -0
@@ -733,6 +733,304 @@ pkt_work_encap(struct rte_mbuf *mbuf, }/** +* RTE_TABLE_ACTION_NAT +*/ +static int +nat_cfg_check (struct rte_table_action_nat_config *nat) +{ +if ((nat->proto !=0x06 ) && + (nat->proto !=0x11 )) +return -ENOTSUP ; + +return 0 ; +} + +struct nat_ipv4_data { +uint32_t addr; +uint16_t port; +} __attribute__((__packed__ )); + +struct nat_ipv6_data { +uint8_t addr[16 ]; +uint16_t port; +} __attribute__((__packed__ )); + +static size_t +nat_data_size(struct rte_table_action_nat_config *nat __rte_unused, +struct rte_table_action_common_config *common) +{ +int ip_version = common->ip_version; + +return (ip_version) ? +sizeof (struct nat_ipv4_data ) : +sizeof (struct nat_ipv6_data ); +} + +static int +nat_apply_check (struct rte_table_action_nat_params *p, +struct rte_table_action_common_config *cfg) +{ +if ((p->ip_version && (cfg->ip_version ==0 )) || + ((p->ip_version ==0 ) && cfg->ip_version)) +return -EINVAL ; + +return 0 ; +} + +static int +nat_apply (void *data, +struct rte_table_action_nat_params *p, +struct rte_table_action_common_config *cfg) +{ +int status; + +/* Check input arguments */ + status =nat_apply_check (p, cfg); +if (status) +return status; + +/* Apply */ +if (p->ip_version) { +struct nat_ipv4_data *d = data; + + d->addr =rte_htonl (p->addr.ipv4); + d->port =rte_htons (p->port); + }else { +struct nat_ipv6_data *d = data; + +memcpy (d->addr, p->addr.ipv6,sizeof (d->addr)); + d->port =rte_htons (p->port); + } + +return 0 ; +} + +static __rte_always_inline uint16_t +nat_ipv4_checksum_update (uint16_t cksum0, +uint32_t ip0, +uint32_t ip1) +{ +int32_t cksum1; + + cksum1 = cksum0; + cksum1 = ~cksum1 &0xFFFF ; + +/* Subtract ip0 (one's complement logic) */ + cksum1 -= (ip0 >>16 ) + (ip0 &0xFFFF ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +/* Add ip1 (one's complement logic) */ + cksum1 += (ip1 >>16 ) + (ip1 &0xFFFF ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +return (uint16_t )(~cksum1); +} + +static __rte_always_inline uint16_t +nat_ipv4_tcp_udp_checksum_update (uint16_t cksum0, +uint32_t ip0, +uint32_t ip1, +uint16_t port0, +uint16_t port1) +{ +int32_t cksum1; + + cksum1 = cksum0; + cksum1 = ~cksum1 &0xFFFF ; + +/* Subtract ip0 and port 0 (one's complement logic) */ + cksum1 -= (ip0 >>16 ) + (ip0 &0xFFFF ) + port0; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +/* Add ip1 and port1 (one's complement logic) */ + cksum1 += (ip1 >>16 ) + (ip1 &0xFFFF ) + port1; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +return (uint16_t )(~cksum1); +} + +static __rte_always_inline uint16_t +nat_ipv6_tcp_udp_checksum_update (uint16_t cksum0, +uint16_t *ip0, +uint16_t *ip1, +uint16_t port0, +uint16_t port1) +{ +int32_t cksum1; + + cksum1 = cksum0; + cksum1 = ~cksum1 &0xFFFF ; + +/* Subtract ip0 and port 0 (one's complement logic) */ + cksum1 -= ip0[0 ] + ip0[1 ] + ip0[2 ] + ip0[3 ] + + ip0[4 ] + ip0[5 ] + ip0[6 ] + ip0[7 ] + port0; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +/* Add ip1 and port1 (one's complement logic) */ + cksum1 += ip1[0 ] + ip1[1 ] + ip1[2 ] + ip1[3 ] + + ip1[4 ] + ip1[5 ] + ip1[6 ] + ip1[7 ] + port1; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +return (uint16_t )(~cksum1); +} + +static __rte_always_inline void +pkt_ipv4_work_nat (struct ipv4_hdr *ip, +struct nat_ipv4_data *data, +struct rte_table_action_nat_config *cfg) +{ +if (cfg->source_nat) { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t ip_cksum, tcp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->src_addr, + data->addr); + + tcp_cksum =nat_ipv4_tcp_udp_checksum_update (tcp->cksum, + ip->src_addr, + data->addr, + tcp->src_port, + data->port); + + ip->src_addr = data->addr; + ip->hdr_checksum = ip_cksum; + tcp->src_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t ip_cksum, udp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->src_addr, + data->addr); + + udp_cksum =nat_ipv4_tcp_udp_checksum_update (udp->dgram_cksum, + ip->src_addr, + data->addr, + udp->src_port, + data->port); + + ip->src_addr = data->addr; + ip->hdr_checksum = ip_cksum; + udp->src_port = data->port; +if (udp->dgram_cksum) + udp->dgram_cksum = udp_cksum; + } + }else { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t ip_cksum, tcp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->dst_addr, + data->addr); + + tcp_cksum =nat_ipv4_tcp_udp_checksum_update (tcp->cksum, + ip->dst_addr, + data->addr, + tcp->dst_port, + data->port); + + ip->dst_addr = data->addr; + ip->hdr_checksum = ip_cksum; + tcp->dst_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t ip_cksum, udp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->dst_addr, + data->addr); + + udp_cksum =nat_ipv4_tcp_udp_checksum_update (udp->dgram_cksum, + ip->dst_addr, + data->addr, + udp->dst_port, + data->port); + + ip->dst_addr = data->addr; + ip->hdr_checksum = ip_cksum; + udp->dst_port = data->port; +if (udp->dgram_cksum) + udp->dgram_cksum = udp_cksum; + } + } +} + +static __rte_always_inline void +pkt_ipv6_work_nat (struct ipv6_hdr *ip, +struct nat_ipv6_data *data, +struct rte_table_action_nat_config *cfg) +{ +if (cfg->source_nat) { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t tcp_cksum; + + tcp_cksum =nat_ipv6_tcp_udp_checksum_update (tcp->cksum, + (uint16_t *)ip->src_addr, + (uint16_t *)data->addr, + tcp->src_port, + data->port); + +rte_memcpy (ip->src_addr, data->addr,16 ); + tcp->src_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t udp_cksum; + + udp_cksum =nat_ipv6_tcp_udp_checksum_update (udp->dgram_cksum, + (uint16_t *)ip->src_addr, + (uint16_t *)data->addr, + udp->src_port, + data->port); + +rte_memcpy (ip->src_addr, data->addr,16 ); + udp->src_port = data->port; + udp->dgram_cksum = udp_cksum; + } + }else { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t tcp_cksum; + + tcp_cksum =nat_ipv6_tcp_udp_checksum_update (tcp->cksum, + (uint16_t *)ip->dst_addr, + (uint16_t *)data->addr, + tcp->dst_port, + data->port); + +rte_memcpy (ip->dst_addr, data->addr,16 ); + tcp->dst_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t udp_cksum; + + udp_cksum =nat_ipv6_tcp_udp_checksum_update (udp->dgram_cksum, + (uint16_t *)ip->dst_addr, + (uint16_t *)data->addr, + udp->dst_port, + data->port); + +rte_memcpy (ip->dst_addr, data->addr,16 ); + udp->dst_port = data->port; + udp->dgram_cksum = udp_cksum; + } + } +} + +/** * Action profile */ static int
@@ -743,6 +1041,7 @@ action_valid(enum rte_table_action_type action)case RTE_TABLE_ACTION_MTR :case RTE_TABLE_ACTION_TM :case RTE_TABLE_ACTION_ENCAP : +case RTE_TABLE_ACTION_NAT :return 1 ;default :return 0 ;
@@ -758,6 +1057,7 @@ struct ap_config {struct rte_table_action_mtr_config mtr;struct rte_table_action_tm_config tm;struct rte_table_action_encap_config encap; +struct rte_table_action_nat_config nat; }; static size_t
@@ -770,6 +1070,8 @@ action_cfg_size(enum rte_table_action_type action)return sizeof (struct rte_table_action_tm_config );case RTE_TABLE_ACTION_ENCAP :return sizeof (struct rte_table_action_encap_config ); +case RTE_TABLE_ACTION_NAT : +return sizeof (struct rte_table_action_nat_config );default :return 0 ; }
@@ -789,6 +1091,9 @@ action_cfg_get(struct ap_config *ap_config,case RTE_TABLE_ACTION_ENCAP :return &ap_config->encap; +case RTE_TABLE_ACTION_NAT : +return &ap_config->nat; +default :return NULL ; }
@@ -829,6 +1134,10 @@ action_data_size(enum rte_table_action_type action,case RTE_TABLE_ACTION_ENCAP :return encap_data_size (&ap_config->encap); +case RTE_TABLE_ACTION_NAT : +return nat_data_size (&ap_config->nat, + &ap_config->common); +default :return 0 ; }
@@ -912,6 +1221,10 @@ rte_table_action_profile_action_register(struct rte_table_action_profile *profil status =encap_cfg_check (action_config);break ; +case RTE_TABLE_ACTION_NAT : + status =nat_cfg_check (action_config); +break ; +default : status =0 ;break ;
@@ -1040,6 +1353,11 @@ rte_table_action_apply(struct rte_table_action *action, &action->cfg.encap, &action->cfg.common); +case RTE_TABLE_ACTION_NAT : +return nat_apply (action_data, + action_params, + &action->cfg.common); +default :return -EINVAL ; }
@@ -1269,6 +1587,16 @@ pkt_work(struct rte_mbuf *mbuf, ip_offset); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_NAT )) { +void *data = +action_data_get (table_entry, action,RTE_TABLE_ACTION_NAT ); + +if (cfg->common.ip_version) +pkt_ipv4_work_nat (ip, data, &cfg->nat); +else +pkt_ipv6_work_nat (ip, data, &cfg->nat); + } +return drop_mask; }
@@ -1452,6 +1780,29 @@ pkt4_work(struct rte_mbuf **mbufs, ip_offset); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_NAT )) { +void *data0 = +action_data_get (table_entry0, action,RTE_TABLE_ACTION_NAT ); +void *data1 = +action_data_get (table_entry1, action,RTE_TABLE_ACTION_NAT ); +void *data2 = +action_data_get (table_entry2, action,RTE_TABLE_ACTION_NAT ); +void *data3 = +action_data_get (table_entry3, action,RTE_TABLE_ACTION_NAT ); + +if (cfg->common.ip_version) { +pkt_ipv4_work_nat (ip0, data0, &cfg->nat); +pkt_ipv4_work_nat (ip1, data1, &cfg->nat); +pkt_ipv4_work_nat (ip2, data2, &cfg->nat); +pkt_ipv4_work_nat (ip3, data3, &cfg->nat); + }else { +pkt_ipv6_work_nat (ip0, data0, &cfg->nat); +pkt_ipv6_work_nat (ip1, data1, &cfg->nat); +pkt_ipv6_work_nat (ip2, data2, &cfg->nat); +pkt_ipv6_work_nat (ip3, data3, &cfg->nat); + } + } +return drop_mask0 | (drop_mask1 <<1 ) | (drop_mask2 << 2) |
lib/librte_pipeline/rte_table_action.h +39 -0
@@ -77,6 +77,9 @@ enum rte_table_action_type {/** Packet encapsulations. */ RTE_TABLE_ACTION_ENCAP , + +/** Network Address Translation (NAT). */ + RTE_TABLE_ACTION_NAT, };/** Common action configuration (per table action profile). */
@@ -409,6 +412,42 @@ struct rte_table_action_encap_params { };/** +* RTE_TABLE_ACTION_NAT +*/ +/** NAT action configuration (per table action profile). */ +struct rte_table_action_nat_config { +/** When non-zero, the IP source address and L4 protocol source port are +* translated. When zero, the IP destination address and L4 protocol +* destination port are translated. +*/ +int source_nat; + +/** Layer 4 protocol, for example TCP (0x06) or UDP (0x11). The checksum +* field is computed differently and placed at different header offset +* by each layer 4 protocol. +*/ +uint8_t proto; +}; + +/** NAT action parameters (per table rule). */ +struct rte_table_action_nat_params { +/** IP version for *addr*: non-zero for IPv4, zero for IPv6. */ +int ip_version; + +/** IP address. */ +union { +/** IPv4 address; only valid when *ip_version* is non-zero. */ +uint32_t ipv4; + +/** IPv6 address; only valid when *ip_version* is set to 0. */ +uint8_t ipv6[16 ]; + } addr; + +/** Port. */ +uint16_t port; +}; + +/** * Table action profile. */ struct rte_table_action_profile ;
Signature · 1 line
2.9.3
PATCH v4 7/49 pipeline: add ttl update action
In reply to Jasvinder SinghAdd implementation of ttl update action.
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 162 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 66 +++++++++++ 3 files changed, 229 insertions(+)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -61,5 +61,6 @@ EXPERIMENTAL { rte_table_action_profile_free; rte_table_action_profile_freeze; rte_table_action_table_params_get; + rte_table_action_ttl_read; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +162 -0
228 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +66 -0
84 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 8/49 pipeline: add statistics read action
In reply to Jasvinder SinghAdd implementation of stats read action
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 111 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 78 +++++++++++++++++++ 3 files changed, 190 insertions(+)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -61,6 +61,7 @@ EXPERIMENTAL { rte_table_action_profile_free; rte_table_action_profile_freeze; rte_table_action_table_params_get; + rte_table_action_stats_read; rte_table_action_ttl_read; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +111 -0
177 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +78 -0
96 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 9/49 pipeline: add timestamp action
In reply to Jasvinder SinghAdd implementation of timestamp action.
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 79 +++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 31 +++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -62,6 +62,7 @@ EXPERIMENTAL { rte_table_action_profile_freeze; rte_table_action_table_params_get; rte_table_action_stats_read; + rte_table_action_time_read; rte_table_action_ttl_read; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +78 -1
127 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +31 -0
@@ -86,6 +86,9 @@ enum rte_table_action_type {/** Statistics. */ RTE_TABLE_ACTION_STATS , + +/** Timestamp. */ + RTE_TABLE_ACTION_TIME, };/** Common action configuration (per table action profile). */
@@ -542,6 +545,15 @@ struct rte_table_action_stats_counters { };/** +* RTE_TABLE_ACTION_TIME +*/ +/** Timestamp action parameters (per table rule). */ +struct rte_table_action_time_params { +/** Initial timestamp value. Typically set to current time. */ +uint64_t time; +}; + +/** * Table action profile. */ struct rte_table_action_profile ;
@@ -815,6 +827,25 @@ rte_table_action_stats_read(struct rte_table_action *action,struct rte_table_action_stats_counters *stats, int clear); +/** +* Table action timestamp read. +* +* @param[in] action +* Handle to table action object (needs to be valid). +* @param[in] data +* Data byte array (typically table rule data) with timestamp action +* previously applied on it. +* @param[inout] timestamp +* Pre-allocated memory where the timestamp read from *data* is saved (has to +* be non-NULL). +* @return +* Zero on success, non-zero error code otherwise. +*/ +int __rte_experimental +rte_table_action_time_read (struct rte_table_action *action, +void *data, +uint64_t *timestamp); + #ifdef __cplusplus }#endif
Signature · 1 line
2.9.3
PATCH v4 10/49 pipeline: add load balance action
In reply to Jasvinder SinghAdd implementation of the load balance action.
--- lib/librte_pipeline/rte_table_action.c | 102 +++++++++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 52 +++++++++++++++++ 2 files changed, 154 insertions(+)
lib/librte_pipeline/rte_table_action.c +102 -0
@@ -45,6 +45,55 @@ fwd_apply(struct fwd_data *data, }/** +* RTE_TABLE_ACTION_LB +*/ +static int +lb_cfg_check (struct rte_table_action_lb_config *cfg) +{ +if ((cfg ==NULL ) || + (cfg->key_size <RTE_TABLE_ACTION_LB_KEY_SIZE_MIN ) || + (cfg->key_size >RTE_TABLE_ACTION_LB_KEY_SIZE_MAX ) || + (!rte_is_power_of_2 (cfg->key_size)) || + (cfg->f_hash ==NULL )) +return -1 ; + +return 0 ; +} + +struct lb_data { +uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE ]; +} __attribute__((__packed__ )); + +static int +lb_apply (struct lb_data *data, +struct rte_table_action_lb_params *p) +{ +memcpy (data->out, p->out,sizeof (data->out)); + +return 0 ; +} + +static __rte_always_inline void +pkt_work_lb (struct rte_mbuf *mbuf, +struct lb_data *data, +struct rte_table_action_lb_config *cfg) +{ +uint8_t *pkt_key =RTE_MBUF_METADATA_UINT8_PTR (mbuf, cfg->key_offset); +uint32_t *out =RTE_MBUF_METADATA_UINT32_PTR (mbuf, cfg->out_offset); +uint64_t digest, pos; +uint32_t out_val; + + digest = cfg->f_hash (pkt_key, + cfg->key_mask, + cfg->key_size, + cfg->seed); + pos = digest & (RTE_TABLE_ACTION_LB_TABLE_SIZE -1 ); + out_val = data->out[pos]; + + *out = out_val; +} + +/** * RTE_TABLE_ACTION_MTR */ static int
@@ -1178,6 +1227,7 @@ action_valid(enum rte_table_action_type action) {switch (action) {case RTE_TABLE_ACTION_FWD : +case RTE_TABLE_ACTION_LB :case RTE_TABLE_ACTION_MTR :case RTE_TABLE_ACTION_TM :case RTE_TABLE_ACTION_ENCAP :
@@ -1197,6 +1247,7 @@ action_valid(enum rte_table_action_type action)struct ap_config {uint64_t action_mask;struct rte_table_action_common_config common; +struct rte_table_action_lb_config lb;struct rte_table_action_mtr_config mtr;struct rte_table_action_tm_config tm;struct rte_table_action_encap_config encap;
@@ -1209,6 +1260,8 @@ static size_t action_cfg_size(enum rte_table_action_type action) {switch (action) { +case RTE_TABLE_ACTION_LB : +return sizeof (struct rte_table_action_lb_config );case RTE_TABLE_ACTION_MTR :return sizeof (struct rte_table_action_mtr_config );case RTE_TABLE_ACTION_TM :
@@ -1231,6 +1284,9 @@ action_cfg_get(struct ap_config *ap_config, enum rte_table_action_type type) {switch (type) { +case RTE_TABLE_ACTION_LB : +return &ap_config->lb; +case RTE_TABLE_ACTION_MTR :return &ap_config->mtr;
@@ -1280,6 +1336,9 @@ action_data_size(enum rte_table_action_type action,case RTE_TABLE_ACTION_FWD :return sizeof (struct fwd_data ); +case RTE_TABLE_ACTION_LB : +return sizeof (struct lb_data ); +case RTE_TABLE_ACTION_MTR :return mtr_data_size (&ap_config->mtr);
@@ -1373,6 +1432,10 @@ rte_table_action_profile_action_register(struct rte_table_action_profile *profilreturn -EINVAL ;switch (type) { +case RTE_TABLE_ACTION_LB : + status =lb_cfg_check (action_config); +break ; +case RTE_TABLE_ACTION_MTR : status =mtr_cfg_check (action_config);break ;
@@ -1507,6 +1570,10 @@ rte_table_action_apply(struct rte_table_action *action,return fwd_apply (action_data, action_params); +case RTE_TABLE_ACTION_LB : +return lb_apply (action_data, + action_params); +case RTE_TABLE_ACTION_MTR : return mtr_apply(action_data, action_params,
@@ -1822,6 +1889,14 @@ pkt_work(struct rte_mbuf *mbuf,rte_ntohs (hdr->payload_len) +sizeof (struct ipv6_hdr ); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_LB )) { +void *data = +action_data_get (table_entry, action,RTE_TABLE_ACTION_LB ); + +pkt_work_lb (mbuf, + data, + &cfg->lb); + }if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_MTR )) {void *data =action_data_get (table_entry, action,RTE_TABLE_ACTION_MTR );
@@ -1961,6 +2036,33 @@ pkt4_work(struct rte_mbuf **mbufs,rte_ntohs (hdr3->payload_len) +sizeof (struct ipv6_hdr ); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_LB )) { +void *data0 = +action_data_get (table_entry0, action,RTE_TABLE_ACTION_LB ); +void *data1 = +action_data_get (table_entry1, action,RTE_TABLE_ACTION_LB ); +void *data2 = +action_data_get (table_entry2, action,RTE_TABLE_ACTION_LB ); +void *data3 = +action_data_get (table_entry3, action,RTE_TABLE_ACTION_LB ); + +pkt_work_lb (mbuf0, + data0, + &cfg->lb); + +pkt_work_lb (mbuf1, + data1, + &cfg->lb); + +pkt_work_lb (mbuf2, + data2, + &cfg->lb); + +pkt_work_lb (mbuf3, + data3, + &cfg->lb); + } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_MTR )) {void *data0 =action_data_get (table_entry0, action,RTE_TABLE_ACTION_MTR );
lib/librte_pipeline/rte_table_action.h +52 -0
70 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 11/49 pipeline: add pipeline port in action APIs
In reply to Jasvinder SinghThis API provides a common set of actions for pipeline input ports to speed up application development.
Each pipeline input port can be assigned an action handler to be executed on every input packet during the pipeline execution.
The pipeline library allows the user to define his own input port actions by providing customized input port action handler. While the user can still follow this process, this API is intended to provide a quicker development alternative for a set of predefined actions.
The typical steps to use this API are:
* Define an input port action profile.
* Instantiate the input port action profile to create input port action objects.
* Use the input port action to generate the input port action handler invoked by the pipeline.
* Use the input port action object to generate the internal data structures used by the input port action handler based on given action parameters.
--- lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 4 +- lib/librte_pipeline/rte_pipeline_version.map | 8 + lib/librte_pipeline/rte_port_in_action.c | 531 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_port_in_action.h | 301 +++++++++++++++ 5 files changed, 844 insertions(+), 3 deletions(-) create mode 100644 lib/librte_pipeline/rte_port_in_action.c create mode 100644 lib/librte_pipeline/rte_port_in_action.h
lib/librte_pipeline/Makefile +2 -1
@@ -22,9 +22,10 @@ LIBABIVER := 3 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += rte_port_in_action.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += rte_table_action.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h rte_table_action.h +SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h rte_port_in_action.h rte_table_action.h include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/meson.build +2 -2
@@ -3,6 +3,6 @@ version = 3 allow_experimental_apis = true -sources = files('rte_pipeline.c', 'rte_table_action.c') -headers = files('rte_pipeline.h', 'rte_table_action.h') +sources = files('rte_pipeline.c', 'rte_port_in_action.c', 'rte_table_action.c') +headers = files('rte_pipeline.h', 'rte_port_in_action.h', 'rte_table_action.h') deps += ['port', 'table', 'meter', 'sched']
lib/librte_pipeline/rte_pipeline_version.map +8 -0
@@ -49,6 +49,14 @@ DPDK_16.04 { EXPERIMENTAL { global: + rte_port_in_action_apply; + rte_port_in_action_create; + rte_port_in_action_free; + rte_port_in_action_params_get; + rte_port_in_action_profile_action_register; + rte_port_in_action_profile_create; + rte_port_in_action_profile_free; + rte_port_in_action_profile_freeze; rte_table_action_apply; rte_table_action_create; rte_table_action_dscp_table_update;
lib/librte_pipeline/rte_port_in_action.c new file +531 -0
531 lines not on this page · raw message
lib/librte_pipeline/rte_port_in_action.h new file +301 -0
301 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 12/49 librte_table/acl: remove incorrect check
In reply to Jasvinder SinghRemove wrong check for table entry pointer.
--- lib/librte_table/rte_table_acl.c | 6 ------ 1 file changed, 6 deletions(-)
lib/librte_table/rte_table_acl.c +0 -6
@@ -472,12 +472,6 @@ rte_table_acl_entry_add_bulk(return -EINVAL ; } -if (entries_ptr[i] ==NULL ) { -RTE_LOG (ERR ,TABLE ,"%s: entries_ptr[%" PRIu32"] parameter is NULL\n" , - __func__, i); -return -EINVAL ; - } - rule = keys[i];if (rule->priority >RTE_ACL_MAX_PRIORITY ) {RTE_LOG (ERR ,TABLE ,"%s: Priority is too high\n" , __func__);
Signature · 1 line
2.9.3
PATCH v4 13/49 ip_pipeline: remove passthrough pipeline
In reply to Jasvinder Singhremove passthrough pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - .../ip_pipeline/pipeline/pipeline_passthrough.c | 45 - .../ip_pipeline/pipeline/pipeline_passthrough.h | 12 - .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 929 --------------------- .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 44 - 7 files changed, 1036 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -19,8 +19,6 @@ SRCS-y += pipeline_common_be.c SRCS-y += pipeline_common_fe.c SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c -SRCS-y += pipeline_passthrough_be.c -SRCS-y += pipeline_passthrough.c SRCS-y += pipeline_firewall_be.c SRCS-y += pipeline_firewall.c SRCS-y += pipeline_flow_classification_be.c
examples/ip_pipeline/init.c +0 -2
@@ -26,7 +26,6 @@#include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" -#include "pipeline_passthrough.h" #include "pipeline_firewall.h" #include "pipeline_flow_classification.h" #include "pipeline_flow_actions.h"
@@ -1822,7 +1821,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_passthrough);app_pipeline_type_register (app, &pipeline_flow_classification);app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall);
examples/ip_pipeline/meson.build +0 -2
@@ -29,8 +29,6 @@ sources = files( 'pipeline/pipeline_flow_classification.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', - 'pipeline/pipeline_passthrough_be.c', - 'pipeline/pipeline_passthrough.c', 'pipeline/pipeline_routing_be.c', 'pipeline/pipeline_routing.c', )
examples/ip_pipeline/pipeline/pipeline_passthrough.c deleted +0 -45
45 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough.h deleted +0 -12
@@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation -*/ - -#ifndef __INCLUDE_PIPELINE_PASSTHROUGH_H__ -#define __INCLUDE_PIPELINE_PASSTHROUGH_H__ - -#include "pipeline.h" - -extern struct pipeline_type pipeline_passthrough; - -#endif
examples/ip_pipeline/pipeline/pipeline_passthrough_be.c deleted +0 -929
929 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough_be.h deleted +0 -44
44 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 14/49 ip_pipeline: remove routing pipeline
In reply to Jasvinder SinghRemove routing pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - examples/ip_pipeline/pipeline/pipeline_routing.c | 1613 ---------------- examples/ip_pipeline/pipeline/pipeline_routing.h | 71 - .../ip_pipeline/pipeline/pipeline_routing_be.c | 1966 -------------------- .../ip_pipeline/pipeline/pipeline_routing_be.h | 283 --- 7 files changed, 3939 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -25,8 +25,6 @@ SRCS-y += pipeline_flow_classification_be.c SRCS-y += pipeline_flow_classification.c SRCS-y += pipeline_flow_actions_be.c SRCS-y += pipeline_flow_actions.c -SRCS-y += pipeline_routing_be.c -SRCS-y += pipeline_routing.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/ip_pipeline/init.c +0 -2
@@ -29,7 +29,6 @@#include "pipeline_firewall.h" #include "pipeline_flow_classification.h" #include "pipeline_flow_actions.h" -#include "pipeline_routing.h" #include "thread_fe.h" #define APP_NAME_SIZE 32
@@ -1824,7 +1823,6 @@ int app_init(struct app_params *app)app_pipeline_type_register (app, &pipeline_flow_classification);app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall); -app_pipeline_type_register (app, &pipeline_routing);app_init_pipelines (app);app_init_threads (app);
examples/ip_pipeline/meson.build +0 -2
@@ -29,6 +29,4 @@ sources = files( 'pipeline/pipeline_flow_classification.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', - 'pipeline/pipeline_routing_be.c', - 'pipeline/pipeline_routing.c', )
examples/ip_pipeline/pipeline/pipeline_routing.c deleted +0 -1613
1,613 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_routing.h deleted +0 -71
71 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_routing_be.c deleted +0 -1966
1,288 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_routing_be.h deleted +0 -283
283 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.9.3
Part of the diff is not shown here. View the raw message.
PATCH v4 15/49 ip_pipeline: remove flow classification pipeline
In reply to Jasvinder SinghRemove flow classification pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - .../pipeline/pipeline_flow_classification.c | 1878 -------------------- .../pipeline/pipeline_flow_classification.h | 106 -- .../pipeline/pipeline_flow_classification_be.c | 723 -------- .../pipeline/pipeline_flow_classification_be.h | 113 -- 7 files changed, 2826 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -21,8 +21,6 @@ SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c SRCS-y += pipeline_firewall_be.c SRCS-y += pipeline_firewall.c -SRCS-y += pipeline_flow_classification_be.c -SRCS-y += pipeline_flow_classification.c SRCS-y += pipeline_flow_actions_be.c SRCS-y += pipeline_flow_actions.c
examples/ip_pipeline/init.c +0 -2
@@ -27,7 +27,6 @@#include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_firewall.h" -#include "pipeline_flow_classification.h" #include "pipeline_flow_actions.h" #include "thread_fe.h"
@@ -1820,7 +1819,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_flow_classification);app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall);
examples/ip_pipeline/meson.build +0 -2
@@ -25,8 +25,6 @@ sources = files( 'pipeline/pipeline_firewall.c', 'pipeline/pipeline_flow_actions_be.c', 'pipeline/pipeline_flow_actions.c', - 'pipeline/pipeline_flow_classification_be.c', - 'pipeline/pipeline_flow_classification.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_flow_classification.c deleted +0 -1878
1,878 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_classification.h deleted +0 -106
106 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c deleted +0 -723
723 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h deleted +0 -113
113 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 16/49 ip_pipeline: remove flow actions pipeline
In reply to Jasvinder SinghRemove flow actions pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - .../ip_pipeline/pipeline/pipeline_flow_actions.c | 1286 -------------------- .../ip_pipeline/pipeline/pipeline_flow_actions.h | 60 - .../pipeline/pipeline_flow_actions_be.c | 983 --------------- .../pipeline/pipeline_flow_actions_be.h | 139 --- 7 files changed, 2474 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -21,8 +21,6 @@ SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c SRCS-y += pipeline_firewall_be.c SRCS-y += pipeline_firewall.c -SRCS-y += pipeline_flow_actions_be.c -SRCS-y += pipeline_flow_actions.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/ip_pipeline/init.c +0 -2
@@ -27,7 +27,6 @@#include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_firewall.h" -#include "pipeline_flow_actions.h" #include "thread_fe.h" #define APP_NAME_SIZE 32
@@ -1819,7 +1818,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall);app_init_pipelines (app);
examples/ip_pipeline/meson.build +0 -2
@@ -23,8 +23,6 @@ sources = files( 'pipeline/pipeline_common_fe.c', 'pipeline/pipeline_firewall_be.c', 'pipeline/pipeline_firewall.c', - 'pipeline/pipeline_flow_actions_be.c', - 'pipeline/pipeline_flow_actions.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_flow_actions.c deleted +0 -1286
1,286 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_actions.h deleted +0 -60
60 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c deleted +0 -983
983 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h deleted +0 -139
139 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 17/49 ip_pipeline: remove firewall pipeline
In reply to Jasvinder SinghRemove firewall pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - examples/ip_pipeline/pipeline/pipeline_firewall.c | 1421 -------------------- examples/ip_pipeline/pipeline/pipeline_firewall.h | 60 - .../ip_pipeline/pipeline/pipeline_firewall_be.c | 856 ------------ .../ip_pipeline/pipeline/pipeline_firewall_be.h | 147 -- 7 files changed, 2490 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -19,8 +19,6 @@ SRCS-y += pipeline_common_be.c SRCS-y += pipeline_common_fe.c SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c -SRCS-y += pipeline_firewall_be.c -SRCS-y += pipeline_firewall.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/ip_pipeline/init.c +0 -2
@@ -26,7 +26,6 @@#include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" -#include "pipeline_firewall.h" #include "thread_fe.h" #define APP_NAME_SIZE 32
@@ -1818,7 +1817,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_firewall);app_init_pipelines (app);app_init_threads (app);
examples/ip_pipeline/meson.build +0 -2
@@ -21,8 +21,6 @@ sources = files( 'thread_fe.c', 'pipeline/pipeline_common_be.c', 'pipeline/pipeline_common_fe.c', - 'pipeline/pipeline_firewall_be.c', - 'pipeline/pipeline_firewall.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_firewall.c deleted +0 -1421
1,421 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_firewall.h deleted +0 -60
60 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_firewall_be.c deleted +0 -856
856 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_firewall_be.h deleted +0 -147
147 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 18/49 ip_pipeline: remove master pipeline
In reply to Jasvinder Singhremove master pipeline.
---
examples/ip_pipeline/Makefile | 6 -
examples/ip_pipeline/app.h | 12 -
examples/ip_pipeline/{pipeline => }/hash_func.h | 3 +-
.../ip_pipeline/{pipeline => }/hash_func_arm64.h | 0
examples/ip_pipeline/init.c | 574 --------
examples/ip_pipeline/meson.build | 9 +-
.../ip_pipeline/pipeline/pipeline_actions_common.h | 202 ---
examples/ip_pipeline/pipeline/pipeline_common_be.c | 176 ---
examples/ip_pipeline/pipeline/pipeline_common_be.h | 134 --
examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1455 --------------------
examples/ip_pipeline/pipeline/pipeline_common_fe.h | 231 ----
examples/ip_pipeline/pipeline/pipeline_master.c | 20 -
examples/ip_pipeline/pipeline/pipeline_master.h | 12 -
examples/ip_pipeline/pipeline/pipeline_master_be.c | 141 --
examples/ip_pipeline/pipeline/pipeline_master_be.h | 12 -
examples/ip_pipeline/thread.c | 53 -
examples/ip_pipeline/thread_fe.c | 457 ------
examples/ip_pipeline/thread_fe.h | 72 -
18 files changed, 3 insertions(+), 3566 deletions(-)
rename examples/ip_pipeline/{pipeline => }/hash_func.h (99%)
rename examples/ip_pipeline/{pipeline => }/hash_func_arm64.h (100%)
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h
delete mode 100644 examples/ip_pipeline/thread_fe.c
delete mode 100644 examples/ip_pipeline/thread_fe.hexamples/ip_pipeline/Makefile +0 -6
@@ -12,14 +12,8 @@ SRCS-y += config_parse_tm.c SRCS-y += config_check.c SRCS-y += init.c SRCS-y += thread.c -SRCS-y += thread_fe.c SRCS-y += cpu_core_map.c -SRCS-y += pipeline_common_be.c -SRCS-y += pipeline_common_fe.c -SRCS-y += pipeline_master_be.c -SRCS-y += pipeline_master.c - # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0)
examples/ip_pipeline/app.h +0 -12
@@ -1359,10 +1359,6 @@ app_core_build_core_mask_string(struct app_params *app, char *mask_buffer) } } -void app_pipeline_params_get (struct app_params *app, -struct app_pipeline_params *p_in, -struct pipeline_params *p_out); -int app_config_init (struct app_params *app); int app_config_args(struct app_params *app,
@@ -1382,16 +1378,8 @@ int app_config_check(struct app_params *app);int app_init (struct app_params *app); -int app_post_init (struct app_params *app); -int app_thread (void *arg); -int app_pipeline_type_register (struct app_params *app, -struct pipeline_type *ptype); - -struct pipeline_type *app_pipeline_type_find (struct app_params *app, -char *name); -void app_link_up_internal (struct app_params *app,struct app_link_params *cp);
examples/ip_pipeline/hash_func.h renamed from examples/ip_pipeline/pipeline/hash_func.h +2 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation +* Copyright(c) 2010-2018 Intel Corporation */ +#ifndef __INCLUDE_HASH_FUNC_H__#define __INCLUDE_HASH_FUNC_H__
examples/ip_pipeline/hash_func_arm64.h renamed from examples/ip_pipeline/pipeline/hash_func_arm64.h +0 -0
examples/ip_pipeline/init.c +0 -574
591 lines not on this page · raw message
examples/ip_pipeline/meson.build +1 -8
@@ -6,9 +6,7 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -deps += ['cfgfile', 'pipeline', 'bus_pci'] -allow_experimental_apis = true -includes += include_directories('pipeline') +deps += ['cfgfile', 'bus_pci'] sources = files( 'config_check.c', 'config_parse.c',
@@ -18,9 +16,4 @@ sources = files( 'main.c', 'parser.c', 'thread.c', - 'thread_fe.c', - 'pipeline/pipeline_common_be.c', - 'pipeline/pipeline_common_fe.c', - 'pipeline/pipeline_master_be.c', - 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_actions_common.h deleted +0 -202
202 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_be.c deleted +0 -176
176 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_be.h deleted +0 -134
134 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_fe.c deleted +0 -1455
1,455 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_fe.h deleted +0 -231
231 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_master.c deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation -*/ - -#include "pipeline_master.h" -#include "pipeline_master_be.h" - -static struct pipeline_fe_ops pipeline_master_fe_ops = { - .f_init =NULL , - .f_post_init =NULL , - .f_free =NULL , - .f_track =NULL , - .cmds =NULL , -}; - -struct pipeline_type pipeline_master = { - .name ="MASTER" , - .be_ops = &pipeline_master_be_ops, - .fe_ops = &pipeline_master_fe_ops, -};
examples/ip_pipeline/pipeline/pipeline_master.h deleted +0 -12
@@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation -*/ - -#ifndef __INCLUDE_PIPELINE_MASTER_H__ -#define __INCLUDE_PIPELINE_MASTER_H__ - -#include "pipeline.h" - -extern struct pipeline_type pipeline_master; - -#endif
examples/ip_pipeline/pipeline/pipeline_master_be.c deleted +0 -141
112 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_master_be.h deleted +0 -12
Lines of this file are not shown. View the raw message.
examples/ip_pipeline/thread.c +0 -53
53 lines not on this page · raw message
examples/ip_pipeline/thread_fe.c deleted +0 -457
457 lines not on this page · raw message
examples/ip_pipeline/thread_fe.h deleted +0 -72
72 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.9.3
Part of the diff is not shown here. View the raw message.
PATCH v4 19/49 ip_pipeline: remove config
In reply to Jasvinder SinghRemove application configuration and script files.
--- examples/ip_pipeline/config/action.cfg | 68 -- examples/ip_pipeline/config/action.sh | 119 --- examples/ip_pipeline/config/action.txt | 8 - examples/ip_pipeline/config/diagram-generator.py | 317 ------- .../ip_pipeline/config/edge_router_downstream.cfg | 97 --- .../ip_pipeline/config/edge_router_downstream.sh | 13 - .../ip_pipeline/config/edge_router_upstream.cfg | 124 --- .../ip_pipeline/config/edge_router_upstream.sh | 33 - examples/ip_pipeline/config/firewall.cfg | 68 -- examples/ip_pipeline/config/firewall.sh | 13 - examples/ip_pipeline/config/firewall.txt | 9 - examples/ip_pipeline/config/flow.cfg | 72 -- examples/ip_pipeline/config/flow.sh | 25 - examples/ip_pipeline/config/flow.txt | 17 - examples/ip_pipeline/config/ip_pipeline.cfg | 9 - examples/ip_pipeline/config/ip_pipeline.sh | 5 - examples/ip_pipeline/config/kni.cfg | 67 -- examples/ip_pipeline/config/l2fwd.cfg | 58 -- examples/ip_pipeline/config/l3fwd.cfg | 68 -- examples/ip_pipeline/config/l3fwd.sh | 33 - examples/ip_pipeline/config/l3fwd_arp.cfg | 70 -- examples/ip_pipeline/config/l3fwd_arp.sh | 43 - examples/ip_pipeline/config/network_layers.cfg | 227 ------ examples/ip_pipeline/config/network_layers.sh | 79 -- .../ip_pipeline/config/pipeline-to-core-mapping.py | 906 --------------------- examples/ip_pipeline/config/tap.cfg | 64 -- examples/ip_pipeline/config/tm_profile.cfg | 105 --- 27 files changed, 2717 deletions(-) delete mode 100644 examples/ip_pipeline/config/action.cfg delete mode 100644 examples/ip_pipeline/config/action.sh delete mode 100644 examples/ip_pipeline/config/action.txt delete mode 100755 examples/ip_pipeline/config/diagram-generator.py delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.cfg delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.sh delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.cfg delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.sh delete mode 100644 examples/ip_pipeline/config/firewall.cfg delete mode 100644 examples/ip_pipeline/config/firewall.sh delete mode 100644 examples/ip_pipeline/config/firewall.txt delete mode 100644 examples/ip_pipeline/config/flow.cfg delete mode 100644 examples/ip_pipeline/config/flow.sh delete mode 100644 examples/ip_pipeline/config/flow.txt delete mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg delete mode 100644 examples/ip_pipeline/config/ip_pipeline.sh delete mode 100644 examples/ip_pipeline/config/kni.cfg delete mode 100644 examples/ip_pipeline/config/l2fwd.cfg delete mode 100644 examples/ip_pipeline/config/l3fwd.cfg delete mode 100644 examples/ip_pipeline/config/l3fwd.sh delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.cfg delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.sh delete mode 100644 examples/ip_pipeline/config/network_layers.cfg delete mode 100644 examples/ip_pipeline/config/network_layers.sh delete mode 100755 examples/ip_pipeline/config/pipeline-to-core-mapping.py delete mode 100644 examples/ip_pipeline/config/tap.cfg delete mode 100644 examples/ip_pipeline/config/tm_profile.cfg
examples/ip_pipeline/config/action.cfg deleted +0 -68
@@ -1,68 +0,0 @@ -; BSD LICENSE -; -; Copyright(c) 2016 Intel Corporation. All rights reserved. -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; * Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; * Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in -; the documentation and/or other materials provided with the -; distribution. -; * Neither the name of Intel Corporation nor the names of its -; contributors may be used to endorse or promote products derived -; from this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -; ________________ -; RXQ0.0 --->| |---> TXQ0.0 -; | | -; RXQ1.0 --->| |---> TXQ1.0 -; | Flow | -; RXQ2.0 --->| Actions |---> TXQ2.0 -; | | -; RXQ3.0 --->| |---> TXQ3.0 -; |________________| -; -; -; Input packet: Ethernet/IPv4 -; -; Packet buffer layout: -; # Field Name Offset (Bytes) Size (Bytes) -; 0 Mbuf 0 128 -; 1 Headroom 128 128 -; 2 Ethernet header 256 14 -; 3 IPv4 header 270 20 - -[EAL] -log_level = 0 - -[PIPELINE0] -type = MASTER -core = 0 - -[PIPELINE1] -type = FLOW_ACTIONS -core = 1 -pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 -pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 -n_flows = 65536 -n_meters_per_flow = 4 -flow_id_offset = 286; ipdaddr -ip_hdr_offset = 270 -color_offset = 128
examples/ip_pipeline/config/action.sh deleted +0 -119
119 lines not on this page · raw message
examples/ip_pipeline/config/action.txt deleted +0 -8
@@ -1,8 +0,0 @@ -# -# p <pipelineid> action flow bulk ./config/action.txt -# - -flow 0 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0 -flow 1 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 1 -flow 2 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 2 -flow 3 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 3
examples/ip_pipeline/config/diagram-generator.py deleted +0 -317
317 lines not on this page · raw message
examples/ip_pipeline/config/edge_router_downstream.cfg deleted +0 -97
97 lines not on this page · raw message
examples/ip_pipeline/config/edge_router_downstream.sh deleted +0 -13
@@ -1,13 +0,0 @@ -# -# run ./config/edge_router_downstream.sh -# - -################################################################################ -# Routing: Ether QinQ, ARP off -################################################################################ -p 1 route add default 4 #SINK0 -p 1 route add 0.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 qinq 256 257 -p 1 route add 0.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 qinq 258 259 -p 1 route add 0.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 qinq 260 261 -p 1 route add 0.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 qinq 262 263 -#p 1 route ls
examples/ip_pipeline/config/edge_router_upstream.cfg deleted +0 -124
124 lines not on this page · raw message
examples/ip_pipeline/config/edge_router_upstream.sh deleted +0 -33
@@ -1,33 +0,0 @@ -# -# run ./config/edge_router_upstream.sh -# - -################################################################################ -# Firewall -################################################################################ -p 1 firewall add default 4 #SINK0 -p 1 firewall add bulk ./config/edge_router_upstream_firewall.txt -#p 1 firewall ls - -################################################################################ -# Flow Classification -################################################################################ -p 3 flow add default 4 #SINK1 -p 3 flow add qinq bulk ./config/edge_router_upstream_flow.txt -#p 3 flow ls - -################################################################################ -# Flow Actions - Metering and Policing -################################################################################ -p 4 action flow bulk ./config/edge_router_upstream_action.txt -#p 4 action flow ls - -################################################################################ -# Routing: Ether MPLS, ARP off -################################################################################ -p 5 route add default 4 #SINK2 -p 5 route add 0.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 mpls 0:1 -p 5 route add 0.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 mpls 10:11 -p 5 route add 0.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 mpls 20:21 -p 5 route add 0.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 mpls 30:31 -#p 5 route ls
examples/ip_pipeline/config/firewall.cfg deleted +0 -68
68 lines not on this page · raw message
examples/ip_pipeline/config/firewall.sh deleted +0 -13
@@ -1,13 +0,0 @@ -# -# run ./config/firewall.sh -# - -p 1 firewall add default 4 #SINK0 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.0.0.0 10 0 65535 0 65535 6 0xF port 0 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.64.0.0 10 0 65535 0 65535 6 0xF port 1 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.128.0.0 10 0 65535 0 65535 6 0xF port 2 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.192.0.0 10 0 65535 0 65535 6 0xF port 3 - -#p 1 firewall add bulk ./config/firewall.txt - -p 1 firewall ls
examples/ip_pipeline/config/firewall.txt deleted +0 -9
@@ -1,9 +0,0 @@ -# -# p <pipelineid> firewall add bulk ./config/firewall.txt -# p <pipelineid> firewall del bulk ./config/firewall.txt -# - -priority 1 ipv4 0.0.0.0 0 100.0.0.0 10 0 65535 0 65535 6 0xF port 0 -priority 1 ipv4 0.0.0.0 0 100.64.0.0 10 0 65535 0 65535 6 0xF port 1 -priority 1 ipv4 0.0.0.0 0 100.128.0.0 10 0 65535 0 65535 6 0xF port 2 -priority 1 ipv4 0.0.0.0 0 100.192.0.0 10 0 65535 0 65535 6 0xF port 3
examples/ip_pipeline/config/flow.cfg deleted +0 -72
72 lines not on this page · raw message
examples/ip_pipeline/config/flow.sh deleted +0 -25
@@ -1,25 +0,0 @@ -# -# run ./config/flow.sh -# - -################################################################################ -# Flow classification (QinQ) -################################################################################ -#p 1 flow add default 4 #SINK0 -#p 1 flow add qinq 100 200 port 0 id 0 -#p 1 flow add qinq 101 201 port 1 id 1 -#p 1 flow add qinq 102 202 port 2 id 2 -#p 1 flow add qinq 103 203 port 3 id 3 - -#p 1 flow add qinq bulk ./config/flow.txt - -################################################################################ -# Flow classification (IPv4 5-tuple) -################################################################################ -p 1 flow add default 4 #SINK0 -p 1 flow add ipv4 100.0.0.10 200.0.0.10 100 200 6 port 0 id 0 -p 1 flow add ipv4 100.0.0.11 200.0.0.11 101 201 6 port 1 id 1 -p 1 flow add ipv4 100.0.0.12 200.0.0.12 102 202 6 port 2 id 2 -p 1 flow add ipv4 100.0.0.13 200.0.0.13 103 203 6 port 3 id 3 - -#p 1 flow add ipv4 bulk ./config/flow.txt
examples/ip_pipeline/config/flow.txt deleted +0 -17
@@ -1,17 +0,0 @@ -# -# p <pipelineid> flow add qinq bulk ./config/flow.txt -# - -#qinq 100 200 port 0 id 0 -#qinq 101 201 port 1 id 1 -#qinq 102 202 port 2 id 2 -#qinq 103 203 port 3 id 3 - -# -# p <pipelineid> flow add ipv4 bulk ./config/flow.txt -# - -ipv4 100.0.0.10 200.0.0.10 100 200 6 port 0 id 0 -ipv4 100.0.0.11 200.0.0.11 101 201 6 port 1 id 1 -ipv4 100.0.0.12 200.0.0.12 102 202 6 port 2 id 2 -ipv4 100.0.0.13 200.0.0.13 103 203 6 port 3 id 3
examples/ip_pipeline/config/ip_pipeline.cfg deleted +0 -9
@@ -1,9 +0,0 @@ -[PIPELINE0] -type = MASTER -core = 0 - -[PIPELINE1] -type = PASS-THROUGH -core = 1 -pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 -pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0
examples/ip_pipeline/config/ip_pipeline.sh deleted +0 -5
@@ -1,5 +0,0 @@ -# -#run config/ip_pipeline.sh -# - -p 1 ping
examples/ip_pipeline/config/kni.cfg deleted +0 -67
67 lines not on this page · raw message
examples/ip_pipeline/config/l2fwd.cfg deleted +0 -58
58 lines not on this page · raw message
examples/ip_pipeline/config/l3fwd.cfg deleted +0 -68
68 lines not on this page · raw message
examples/ip_pipeline/config/l3fwd.sh deleted +0 -33
@@ -1,33 +0,0 @@ -# -# run ./config/l3fwd.sh -# - -################################################################################ -# Routing: encap = ethernet, arp = off -################################################################################ -p 1 route add default 4 #SINK0 -p 1 route add 100.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 -p 1 route add 100.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 -p 1 route add 100.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 -p 1 route add 100.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 -p 1 route ls - -################################################################################ -# Routing: encap = ethernet_qinq, arp = off -################################################################################ -#p 1 route add default 4 #SINK0 -#p 1 route add 100.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 qinq 1000 2000 -#p 1 route add 100.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 qinq 1001 2001 -#p 1 route add 100.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 qinq 1002 2002 -#p 1 route add 100.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 qinq 1003 2003 -#p 1 route ls - -################################################################################ -# Routing: encap = ethernet_mpls, arp = off -################################################################################ -#p 1 route add default 4 #SINK0 -#p 1 route add 100.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 mpls 1000:2000 -#p 1 route add 100.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 mpls 1001:2001 -#p 1 route add 100.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 mpls 1002:2002 -#p 1 route add 100.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 mpls 1003:2003 -#p 1 route ls
examples/ip_pipeline/config/l3fwd_arp.cfg deleted +0 -70
70 lines not on this page · raw message
examples/ip_pipeline/config/l3fwd_arp.sh deleted +0 -43
43 lines not on this page · raw message
examples/ip_pipeline/config/network_layers.cfg deleted +0 -227
227 lines not on this page · raw message
examples/ip_pipeline/config/network_layers.sh deleted +0 -79
79 lines not on this page · raw message
examples/ip_pipeline/config/pipeline-to-core-mapping.py deleted +0 -906
906 lines not on this page · raw message
examples/ip_pipeline/config/tap.cfg deleted +0 -64
64 lines not on this page · raw message
examples/ip_pipeline/config/tm_profile.cfg deleted +0 -105
105 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 20/49 ip_pipeline: rework and improvements
In reply to Jasvinder SinghAll the actions associated with application pipelines tables and ports are now implemented using the new action APIs. Therefore, thousands of lines of code are eliminated from the application. The reduced code size is easier to maintain and extend.
--- examples/ip_pipeline/Makefile | 22 +- examples/ip_pipeline/app.h | 1389 ------------- examples/ip_pipeline/config_check.c | 488 ----- examples/ip_pipeline/config_parse.c | 3395 -------------------------------- examples/ip_pipeline/config_parse_tm.c | 419 ---- examples/ip_pipeline/cpu_core_map.c | 471 ----- examples/ip_pipeline/cpu_core_map.h | 40 - examples/ip_pipeline/init.c | 1343 ------------- examples/ip_pipeline/main.c | 36 +- examples/ip_pipeline/meson.build | 10 +- examples/ip_pipeline/parser.c | 16 +- examples/ip_pipeline/parser.h | 8 + examples/ip_pipeline/pipeline.h | 73 - examples/ip_pipeline/pipeline_be.h | 322 --- examples/ip_pipeline/thread.c | 240 --- examples/ip_pipeline/thread.h | 69 - 16 files changed, 37 insertions(+), 8304 deletions(-) delete mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/config_check.c delete mode 100644 examples/ip_pipeline/config_parse.c delete mode 100644 examples/ip_pipeline/config_parse_tm.c delete mode 100644 examples/ip_pipeline/cpu_core_map.c delete mode 100644 examples/ip_pipeline/cpu_core_map.h delete mode 100644 examples/ip_pipeline/init.c delete mode 100644 examples/ip_pipeline/pipeline.h delete mode 100644 examples/ip_pipeline/pipeline_be.h delete mode 100644 examples/ip_pipeline/thread.c delete mode 100644 examples/ip_pipeline/thread.h
examples/ip_pipeline/Makefile +6 -16
@@ -1,18 +1,13 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2014 Intel Corporation +# Copyright(c) 2010-2018 Intel Corporation # binary name APP = ip_pipeline # all source are stored in SRCS-y SRCS-y := main.c -SRCS-y += config_parse.c SRCS-y += parser.c -SRCS-y += config_parse_tm.c -SRCS-y += config_check.c -SRCS-y += init.c -SRCS-y += thread.c -SRCS-y += cpu_core_map.c +#SRCS-y += thread.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
@@ -30,9 +25,7 @@ CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) -VPATH += pipeline -CFLAGS += -I. -I./pipeline/ -CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -I. OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
@@ -59,21 +52,18 @@ ifeq ($(RTE_SDK),) $(error "Please define RTE_SDK environment variable") endif -VPATH += $(SRCDIR)/pipeline - # Default target, can be overridden by command line or environment RTE_TARGET ?= x86_64-native-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk -INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h)) +INC += $(sort $(wildcard *.h)) SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y) -CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline +CFLAGS += -I$(SRCDIR) CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable -CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += $(WERROR_FLAGS) include $(RTE_SDK)/mk/rte.extapp.mk
examples/ip_pipeline/app.h deleted +0 -1389
1,389 lines not on this page · raw message
examples/ip_pipeline/config_check.c deleted +0 -488
488 lines not on this page · raw message
examples/ip_pipeline/config_parse.c deleted +0 -3395
1,069 lines not on this page · raw message
examples/ip_pipeline/config_parse_tm.c deleted +0 -419
419 lines not on this page · raw message
examples/ip_pipeline/cpu_core_map.c deleted +0 -471
471 lines not on this page · raw message
examples/ip_pipeline/cpu_core_map.h deleted +0 -40
Lines of this file are not shown. View the raw message.
examples/ip_pipeline/init.c deleted +0 -1343
1,343 lines not on this page · raw message
examples/ip_pipeline/pipeline.h deleted +0 -73
73 lines not on this page · raw message
examples/ip_pipeline/pipeline_be.h deleted +0 -322
322 lines not on this page · raw message
examples/ip_pipeline/thread.c deleted +0 -240
240 lines not on this page · raw message
examples/ip_pipeline/thread.h deleted +0 -69
69 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.9.3
Part of the diff is not shown here. View the raw message.
PATCH v4 21/49 ip_pipeline: add cli interface
In reply to Jasvinder SinghCLI interface allowing connectivity with external agent(e.g. telnet, netcat, Python script, etc) is added to the application.
--- examples/ip_pipeline/Makefile | 4 +- examples/ip_pipeline/cli.c | 86 +++++++++++ examples/ip_pipeline/cli.h | 18 +++ examples/ip_pipeline/conn.c | 326 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/conn.h | 47 ++++++ examples/ip_pipeline/main.c | 151 +++++++++++++++++- examples/ip_pipeline/meson.build | 2 + 7 files changed, 632 insertions(+), 2 deletions(-) create mode 100644 examples/ip_pipeline/cli.c create mode 100644 examples/ip_pipeline/cli.h create mode 100644 examples/ip_pipeline/conn.c create mode 100644 examples/ip_pipeline/conn.h
examples/ip_pipeline/Makefile +3 -1
@@ -5,7 +5,9 @@ APP = ip_pipeline # all source are stored in SRCS-y -SRCS-y := main.c +SRCS-y := cli.c +SRCS-y += conn.c +SRCS-y += main.c SRCS-y += parser.c #SRCS-y += thread.c
examples/ip_pipeline/cli.c new file +86 -0
86 lines not on this page · raw message
examples/ip_pipeline/cli.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef __INCLUDE_CLI_H__ +#define __INCLUDE_CLI_H__ + +#include <stddef.h> + +void +cli_process (char *in,char *out,size_t out_size); + +int +cli_script_process (const char *file_name, +size_t msg_in_len_max, +size_t msg_out_len_max); + +#endif
examples/ip_pipeline/conn.c new file +326 -0
326 lines not on this page · raw message
examples/ip_pipeline/conn.h new file +47 -0
47 lines not on this page · raw message
examples/ip_pipeline/main.c +150 -1
170 lines not on this page · raw message
examples/ip_pipeline/meson.build +2 -0
@@ -8,6 +8,8 @@ deps += ['pipeline', 'bus_pci'] sources = files( + 'cli.c', + 'conn.c', 'main.c', 'parser.c', )
Signature · 1 line
2.9.3
PATCH v4 22/49 ip_pipeline: add mempool object for pipeline
In reply to Jasvinder SinghAdd mempool object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 109 ++++++++++++++++++++++++++++++++++++++- examples/ip_pipeline/common.h | 12 +++++ examples/ip_pipeline/main.c | 8 +++ examples/ip_pipeline/mempool.c | 81 +++++++++++++++++++++++++++++ examples/ip_pipeline/mempool.h | 40 ++++++++++++++ examples/ip_pipeline/meson.build | 1 + 7 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 examples/ip_pipeline/common.h create mode 100644 examples/ip_pipeline/mempool.c create mode 100644 examples/ip_pipeline/mempool.h
examples/ip_pipeline/Makefile +1 -0
@@ -8,6 +8,7 @@ APP = ip_pipeline SRCS-y := cli.c SRCS-y += conn.c SRCS-y += main.c +SRCS-y += mempool.c SRCS-y += parser.c #SRCS-y += thread.c
examples/ip_pipeline/cli.c +108 -1
126 lines not on this page · raw message
examples/ip_pipeline/common.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_COMMON_H_ +#define _INCLUDE_COMMON_H_ + +#ifndef NAME_SIZE +#define NAME_SIZE 64 +#endif + +#endif /* _INCLUDE_COMMON_H_ */
examples/ip_pipeline/main.c +8 -0
@@ -12,6 +12,7 @@#include "cli.h" #include "conn.h" +#include "mempool.h" static const char usage[] ="%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\n" ;
@@ -159,6 +160,13 @@ main(int argc, char **argv)return status; }; +/* Mempool */ + status =mempool_init (); +if (status) { +printf ("Error: Mempool initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/mempool.c new file +81 -0
81 lines not on this page · raw message
examples/ip_pipeline/mempool.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_MEMPOOL_H_ +#define _INCLUDE_MEMPOOL_H_ + +#include <stdint.h> +#include <sys/queue.h> + +#include <rte_mempool.h> + +#include "common.h" + +struct mempool { +TAILQ_ENTRY (mempool) node; +char name[NAME_SIZE ]; +struct rte_mempool *m; +uint32_t buffer_size; +}; + +TAILQ_HEAD (mempool_list, mempool); + +int +mempool_init (void ); + +struct mempool * +mempool_find (const char *name); + +struct mempool_params { +uint32_t buffer_size; +uint32_t pool_size; +uint32_t cache_size; +uint32_t cpu_id; +}; + +struct mempool * +mempool_create (const char *name,struct mempool_params *params); + +#endif /* _INCLUDE_MEMPOOL_H_ */
examples/ip_pipeline/meson.build +1 -0
@@ -11,5 +11,6 @@ sources = files( 'cli.c', 'conn.c', 'main.c', + 'mempool.c', 'parser.c', )
Signature · 1 line
2.9.3
PATCH v4 23/49 ip_pipeline: add link object
In reply to Jasvinder SinghAdd link object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 122 ++++++++++++++++++ examples/ip_pipeline/link.c | 268 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/link.h | 63 +++++++++ examples/ip_pipeline/main.c | 8 ++ examples/ip_pipeline/meson.build | 1 + 6 files changed, 463 insertions(+) create mode 100644 examples/ip_pipeline/link.c create mode 100644 examples/ip_pipeline/link.h
examples/ip_pipeline/Makefile +1 -0
@@ -7,6 +7,7 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-y := cli.c SRCS-y += conn.c +SRCS-y += link.c SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c
examples/ip_pipeline/cli.c +122 -0
140 lines not on this page · raw message
examples/ip_pipeline/link.c new file +268 -0
268 lines not on this page · raw message
examples/ip_pipeline/link.h new file +63 -0
63 lines not on this page · raw message
examples/ip_pipeline/main.c +8 -0
@@ -12,6 +12,7 @@#include "cli.h" #include "conn.h" +#include "link.h" #include "mempool.h" static const char usage[] =
@@ -167,6 +168,13 @@ main(int argc, char **argv)return status; } +/* Link */ + status =link_init (); +if (status) { +printf ("Error: Link initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -10,6 +10,7 @@ deps += ['pipeline', 'bus_pci'] sources = files( 'cli.c', 'conn.c', + 'link.c', 'main.c', 'mempool.c', 'parser.c',
Signature · 1 line
2.9.3
PATCH v4 24/49 ip_pipeline: add software queue object
In reply to Jasvinder SinghAdd swq object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 55 +++++++++++++++++++++++++++++ examples/ip_pipeline/main.c | 8 +++++ examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/swq.c | 74 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/swq.h | 37 ++++++++++++++++++++ 6 files changed, 176 insertions(+) create mode 100644 examples/ip_pipeline/swq.c create mode 100644 examples/ip_pipeline/swq.h
examples/ip_pipeline/Makefile +1 -0
@@ -11,6 +11,7 @@ SRCS-y += link.c SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c +SRCS-y += swq.c #SRCS-y += thread.c # Build using pkg-config variables if possible
examples/ip_pipeline/cli.c +55 -0
73 lines not on this page · raw message
examples/ip_pipeline/main.c +8 -0
@@ -14,6 +14,7 @@#include "conn.h" #include "link.h" #include "mempool.h" +#include "swq.h" static const char usage[] ="%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\n" ;
@@ -175,6 +176,13 @@ main(int argc, char **argv)return status; } +/* SWQ */ + status =swq_init (); +if (status) { +printf ("Error: SWQ initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -14,4 +14,5 @@ sources = files( 'main.c', 'mempool.c', 'parser.c', + 'swq.c', )
examples/ip_pipeline/swq.c new file +74 -0
74 lines not on this page · raw message
examples/ip_pipeline/swq.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_SWQ_H_ +#define _INCLUDE_SWQ_H_ + +#include <stdint.h> +#include <sys/queue.h> + +#include <rte_ring.h> + +#include "common.h" + +struct swq { +TAILQ_ENTRY (swq) node; +char name[NAME_SIZE ]; +struct rte_ring *r; +}; + +TAILQ_HEAD (swq_list, swq); + +int +swq_init (void ); + +struct swq * +swq_find (const char *name); + +struct swq_params { +uint32_t size; +uint32_t cpu_id; +}; + +struct swq * +swq_create (const char *name,struct swq_params *params); + +#endif /* _INCLUDE_SWQ_H_ */
Signature · 1 line
2.9.3
PATCH v4 25/49 ip_pipeline: add traffic manager object
In reply to Jasvinder SinghAdd traffic manager object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 360 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/main.c | 8 + examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/tmgr.c | 227 ++++++++++++++++++++++++ examples/ip_pipeline/tmgr.h | 70 ++++++++ 6 files changed, 667 insertions(+) create mode 100644 examples/ip_pipeline/tmgr.c create mode 100644 examples/ip_pipeline/tmgr.h
examples/ip_pipeline/Makefile +1 -0
@@ -12,6 +12,7 @@ SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c SRCS-y += swq.c +SRCS-y += tmgr.c #SRCS-y += thread.c # Build using pkg-config variables if possible
examples/ip_pipeline/cli.c +360 -0
378 lines not on this page · raw message
examples/ip_pipeline/main.c +8 -0
@@ -15,6 +15,7 @@#include "link.h" #include "mempool.h" #include "swq.h" +#include "tmgr.h" static const char usage[] ="%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\n" ;
@@ -183,6 +184,13 @@ main(int argc, char **argv)return status; } +/* Traffic Manager */ + status =tmgr_init (); +if (status) { +printf ("Error: TMGR initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -15,4 +15,5 @@ sources = files( 'mempool.c', 'parser.c', 'swq.c', + 'tmgr.c' )
examples/ip_pipeline/tmgr.c new file +227 -0
227 lines not on this page · raw message
examples/ip_pipeline/tmgr.h new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 26/49 ip_pipeline: add tap object
In reply to Jasvinder SinghAdd tap object implementation to the application
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 32 +++++++++++++ examples/ip_pipeline/main.c | 8 ++++ examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/tap.c | 97 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/tap.h | 29 ++++++++++++ 6 files changed, 168 insertions(+) create mode 100644 examples/ip_pipeline/tap.c create mode 100644 examples/ip_pipeline/tap.h
examples/ip_pipeline/Makefile +1 -0
@@ -12,6 +12,7 @@ SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c SRCS-y += swq.c +SRCS-y += tap.c SRCS-y += tmgr.c #SRCS-y += thread.c
examples/ip_pipeline/cli.c +32 -0
@@ -14,6 +14,7 @@#include "mempool.h" #include "parser.h" #include "swq.h" +#include "tap.h" #include "tmgr.h" #ifndef CMD_MAX_TOKENS
@@ -603,6 +604,32 @@ cmd_tmgr_subport_pipe(char **tokens, } } +/** +* tap <tap_name> +*/ +static void +cmd_tap (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *name; +struct tap *tap; + +if (n_tokens !=2 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + name = tokens[1 ]; + + tap =tap_create (name); +if (tap ==NULL ) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} +void cli_process (char *in,char *out,size_t out_size) {
@@ -671,6 +698,11 @@ cli_process(char *in, char *out, size_t out_size)return ; } +if (strcmp (tokens[0 ],"tap" ) ==0 ) { +cmd_tap (tokens, n_tokens, out, out_size); +return ; + } +snprintf (out, out_size,MSG_CMD_UNKNOWN , tokens[0 ]); }
examples/ip_pipeline/main.c +8 -0
@@ -15,6 +15,7 @@#include "link.h" #include "mempool.h" #include "swq.h" +#include "tap.h" #include "tmgr.h" static const char usage[] =
@@ -191,6 +192,13 @@ main(int argc, char **argv)return status; } +/* TAP */ + status =tap_init (); +if (status) { +printf ("Error: TAP initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -15,5 +15,6 @@ sources = files( 'mempool.c', 'parser.c', 'swq.c', + 'tap.c', 'tmgr.c' )
examples/ip_pipeline/tap.c new file +97 -0
97 lines not on this page · raw message
examples/ip_pipeline/tap.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_TAP_H_ +#define _INCLUDE_TAP_H_ + +#include <sys/queue.h> + +#include "common.h" + +struct tap { +TAILQ_ENTRY (tap) node; +char name[NAME_SIZE ]; +int fd; +}; + +TAILQ_HEAD (tap_list, tap); + +int +tap_init (void ); + +struct tap * +tap_find (const char *name); + +struct tap * +tap_create (const char *name); + +#endif /* _INCLUDE_TAP_H_ */
Signature · 1 line
2.9.3
PATCH v4 27/49 ip_pipeline: add kni object
In reply to Jasvinder SinghAdd kni object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 65 +++++++++++++++ examples/ip_pipeline/kni.c | 167 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/kni.h | 44 +++++++++++ examples/ip_pipeline/main.c | 10 +++ examples/ip_pipeline/meson.build | 1 + 6 files changed, 288 insertions(+) create mode 100644 examples/ip_pipeline/kni.c create mode 100644 examples/ip_pipeline/kni.h
examples/ip_pipeline/Makefile +1 -0
@@ -7,6 +7,7 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-y := cli.c SRCS-y += conn.c +SRCS-y += kni.c SRCS-y += link.c SRCS-y += main.c SRCS-y += mempool.c
examples/ip_pipeline/cli.c +65 -0
83 lines not on this page · raw message
examples/ip_pipeline/kni.c new file +167 -0
167 lines not on this page · raw message
examples/ip_pipeline/kni.h new file +44 -0
44 lines not on this page · raw message
examples/ip_pipeline/main.c +10 -0
@@ -12,6 +12,7 @@#include "cli.h" #include "conn.h" +#include "kni.h" #include "link.h" #include "mempool.h" #include "swq.h"
@@ -199,6 +200,13 @@ main(int argc, char **argv)return status; } +/* KNI */ + status =kni_init (); +if (status) { +printf ("Error: KNI initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
@@ -210,5 +218,7 @@ main(int argc, char **argv)conn_poll_for_conn (conn);conn_poll_for_msg (conn); + +kni_handle_request (); } }
examples/ip_pipeline/meson.build +1 -0
@@ -10,6 +10,7 @@ deps += ['pipeline', 'bus_pci'] sources = files( 'cli.c', 'conn.c', + 'kni.c', 'link.c', 'main.c', 'mempool.c',
Signature · 1 line
2.9.3
PATCH v4 28/49 ip_pipeline: add action profile object
In reply to Jasvinder SinghAdd action profile object implementation to the application.
--- examples/ip_pipeline/Makefile | 4 +- examples/ip_pipeline/action.c | 278 +++++++++++++++++++++++ examples/ip_pipeline/action.h | 76 +++++++ examples/ip_pipeline/cli.c | 477 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/cli.h | 2 + examples/ip_pipeline/main.c | 14 ++ examples/ip_pipeline/meson.build | 2 + 7 files changed, 852 insertions(+), 1 deletion(-) create mode 100644 examples/ip_pipeline/action.c create mode 100644 examples/ip_pipeline/action.h
examples/ip_pipeline/Makefile +3 -1
@@ -5,7 +5,8 @@ APP = ip_pipeline # all source are stored in SRCS-y -SRCS-y := cli.c +SRCS-y := action.c +SRCS-y += cli.c SRCS-y += conn.c SRCS-y += kni.c SRCS-y += link.c
@@ -69,6 +70,7 @@ INC += $(sort $(wildcard *.h)) SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y) +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -I$(SRCDIR) CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
examples/ip_pipeline/action.c new file +278 -0
278 lines not on this page · raw message
examples/ip_pipeline/action.h new file +76 -0
76 lines not on this page · raw message
examples/ip_pipeline/cli.c +477 -0
489 lines not on this page · raw message
examples/ip_pipeline/cli.h +2 -0
@@ -7,6 +7,8 @@#include <stddef.h> +#include "action.h" +void cli_process (char *in,char *out,size_t out_size);
examples/ip_pipeline/main.c +14 -0
@@ -207,6 +207,20 @@ main(int argc, char **argv)return status; } +/* Action */ + status =port_in_action_profile_init (); +if (status) { +printf ("Error: Input port action profile initialization failed (%d)\n" , status); +return status; + } + + status =table_action_profile_init (); +if (status) { +printf ("Error: Action profile initialization failed (%d)\n" , + status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +2 -0
@@ -7,7 +7,9 @@ # DPDK instance, use 'make' deps += ['pipeline', 'bus_pci'] +allow_experimental_apis = true sources = files( + 'action.c', 'cli.c', 'conn.c', 'kni.c',
Signature · 1 line
2.9.3
PATCH v4 29/49 ip_pipeline: add pipeline object
In reply to Jasvinder SinghAdd pipeline object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 819 ++++++++++++++++++++++++++++++++ examples/ip_pipeline/cli.h | 2 - examples/ip_pipeline/main.c | 8 + examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/pipeline.c | 973 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 272 +++++++++++ 7 files changed, 2074 insertions(+), 2 deletions(-) create mode 100644 examples/ip_pipeline/pipeline.c create mode 100644 examples/ip_pipeline/pipeline.h
examples/ip_pipeline/Makefile +1 -0
@@ -13,6 +13,7 @@ SRCS-y += link.c SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c +SRCS-y += pipeline.c SRCS-y += swq.c SRCS-y += tap.c SRCS-y += tmgr.c
examples/ip_pipeline/cli.c +819 -0
837 lines not on this page · raw message
examples/ip_pipeline/cli.h +0 -2
@@ -7,8 +7,6 @@#include <stddef.h> -#include "action.h" -void cli_process (char *in,char *out,size_t out_size);
examples/ip_pipeline/main.c +8 -0
@@ -15,6 +15,7 @@#include "kni.h" #include "link.h" #include "mempool.h" +#include "pipeline.h" #include "swq.h" #include "tap.h" #include "tmgr.h"
@@ -221,6 +222,13 @@ main(int argc, char **argv)return status; } +/* Pipeline */ + status =pipeline_init (); +if (status) { +printf ("Error: Pipeline initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -17,6 +17,7 @@ sources = files( 'main.c', 'mempool.c', 'parser.c', + 'pipeline.c', 'swq.c', 'tap.c', 'tmgr.c'
examples/ip_pipeline/pipeline.c new file +973 -0
973 lines not on this page · raw message
examples/ip_pipeline/pipeline.h new file +272 -0
272 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 30/49 ip_pipeline: add threads
In reply to Jasvinder SinghAdd threads data structure and initialisation functions to run the pipeline.
--- examples/ip_pipeline/Makefile | 2 +- examples/ip_pipeline/main.c | 8 ++ examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/thread.c | 156 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/thread.h | 13 ++++ 5 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 examples/ip_pipeline/thread.c create mode 100644 examples/ip_pipeline/thread.h
examples/ip_pipeline/Makefile +1 -1
@@ -16,8 +16,8 @@ SRCS-y += parser.c SRCS-y += pipeline.c SRCS-y += swq.c SRCS-y += tap.c +SRCS-y += thread.c SRCS-y += tmgr.c -#SRCS-y += thread.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/ip_pipeline/main.c +8 -0
@@ -18,6 +18,7 @@#include "pipeline.h" #include "swq.h" #include "tap.h" +#include "thread.h" #include "tmgr.h" static const char usage[] =
@@ -229,6 +230,13 @@ main(int argc, char **argv)return status; } +/* Thread */ + status =thread_init (); +if (status) { +printf ("Error: Thread initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -20,5 +20,6 @@ sources = files( 'pipeline.c', 'swq.c', 'tap.c', + 'thread.c', 'tmgr.c' )
examples/ip_pipeline/thread.c new file +156 -0
156 lines not on this page · raw message
examples/ip_pipeline/thread.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_THREAD_H_ +#define _INCLUDE_THREAD_H_ + +#include <stdint.h> + +int +thread_init (void ); + +#endif /* _INCLUDE_THREAD_H_ */
Signature · 1 line
2.9.3
PATCH v4 31/49 ip_pipeline: add thread runtime
In reply to Jasvinder SinghAdd runtime thread functions for the pipeline.
--- examples/ip_pipeline/main.c | 6 ++ examples/ip_pipeline/thread.c | 193 ++++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/thread.h | 3 + 3 files changed, 202 insertions(+)
examples/ip_pipeline/main.c +6 -0
@@ -8,6 +8,7 @@#include <unistd.h> #include <getopt.h> +#include <rte_launch.h> #include <rte_eal.h> #include "cli.h"
@@ -237,6 +238,11 @@ main(int argc, char **argv)return status; } +rte_eal_mp_remote_launch ( + thread_main, +NULL , +SKIP_MASTER ); +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/thread.c +193 -0
196 lines not on this page · raw message
examples/ip_pipeline/thread.h +3 -0
@@ -10,4 +10,7 @@int thread_init (void ); +int +thread_main (void *arg); +#endif /* _INCLUDE_THREAD_H_ */
Signature · 1 line
2.9.3
PATCH v4 32/49 ip_pipeline: add cli to enable and disable pipeline
In reply to Jasvinder SinghAdd commands to enable and disable the pipeline on the thread.
--- examples/ip_pipeline/cli.c | 102 +++++++++++++++++ examples/ip_pipeline/thread.c | 256 ++++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/thread.h | 8 ++ 3 files changed, 366 insertions(+)
examples/ip_pipeline/cli.c +102 -0
@@ -17,6 +17,7 @@#include "pipeline.h" #include "swq.h" #include "tap.h" +#include "thread.h" #include "tmgr.h" #ifndef CMD_MAX_TOKENS
@@ -1936,6 +1937,91 @@ cmd_pipeline_port_in_table(char **tokens, } } +/** +* thread <thread_id> pipeline <pipeline_name> enable +*/ +static void +cmd_thread_pipeline_enable (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *pipeline_name; +uint32_t thread_id; +int status; + +if (n_tokens !=5 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + +if (parser_read_uint32 (&thread_id, tokens[1 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"thread_id" ); +return ; + } + +if (strcmp (tokens[2 ],"pipeline" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"pipeline" ); +return ; + } + + pipeline_name = tokens[3 ]; + +if (strcmp (tokens[4 ],"enable" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"enable" ); +return ; + } + + status =thread_pipeline_enable (thread_id, pipeline_name); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL ,"thread pipeline enable" ); +return ; + } +} + +/** +* thread <thread_id> pipeline <pipeline_name> disable +*/ +static void +cmd_thread_pipeline_disable (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *pipeline_name; +uint32_t thread_id; +int status; + +if (n_tokens !=5 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + +if (parser_read_uint32 (&thread_id, tokens[1 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"thread_id" ); +return ; + } + +if (strcmp (tokens[2 ],"pipeline" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"pipeline" ); +return ; + } + + pipeline_name = tokens[3 ]; + +if (strcmp (tokens[4 ],"disable" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"disable" ); +return ; + } + + status =thread_pipeline_disable (thread_id, pipeline_name); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , +"thread pipeline disable" ); +return ; + } +} +void cli_process (char *in,char *out,size_t out_size) {
@@ -2064,6 +2150,22 @@ cli_process(char *in, char *out, size_t out_size) } } +if (strcmp (tokens[0 ],"thread" ) ==0 ) { +if ((n_tokens >=5 ) && + (strcmp (tokens[4 ],"enable" ) ==0 )) { +cmd_thread_pipeline_enable (tokens, n_tokens, + out, out_size); +return ; + } + +if ((n_tokens >=5 ) && + (strcmp (tokens[4 ],"disable" ) ==0 )) { +cmd_thread_pipeline_disable (tokens, n_tokens, + out, out_size); +return ; + } + } +snprintf (out, out_size,MSG_CMD_UNKNOWN , tokens[0 ]); }
examples/ip_pipeline/thread.c +256 -0
285 lines not on this page · raw message
examples/ip_pipeline/thread.h +8 -0
@@ -8,6 +8,14 @@#include <stdint.h> int +thread_pipeline_enable (uint32_t thread_id, +const char *pipeline_name); + +int +thread_pipeline_disable (uint32_t thread_id, +const char *pipeline_name); + +int thread_init (void );int
Signature · 1 line
2.9.3
PATCH v4 33/49 ip_pipeline: add cli to enable and disable pipeline port
In reply to Jasvinder SinghAdd commands to enable and disable the pipeline ports.
--- examples/ip_pipeline/cli.c | 112 +++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 8 ++ examples/ip_pipeline/thread.c | 165 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 284 insertions(+), 1 deletion(-)
examples/ip_pipeline/cli.c +112 -0
@@ -1938,6 +1938,100 @@ cmd_pipeline_port_in_table(char **tokens, }/** +* pipeline <pipeline_name> port in <port_id> enable +*/ +static void +cmd_pipeline_port_in_enable (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *pipeline_name; +uint32_t port_id; +int status; + +if (n_tokens !=6 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"port" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (strcmp (tokens[3 ],"in" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"in" ); +return ; + } + +if (parser_read_uint32 (&port_id, tokens[4 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"port_id" ); +return ; + } + +if (strcmp (tokens[5 ],"enable" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"enable" ); +return ; + } + + status =pipeline_port_in_enable (pipeline_name, port_id); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** +* pipeline <pipeline_name> port in <port_id> disable +*/ +static void +cmd_pipeline_port_in_disable (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *pipeline_name; +uint32_t port_id; +int status; + +if (n_tokens !=6 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"port" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (strcmp (tokens[3 ],"in" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"in" ); +return ; + } + +if (parser_read_uint32 (&port_id, tokens[4 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"port_id" ); +return ; + } + +if (strcmp (tokens[5 ],"disable" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"disable" ); +return ; + } + + status =pipeline_port_in_disable (pipeline_name, port_id); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -2148,6 +2242,24 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=6 ) && + (strcmp (tokens[2 ],"port" ) ==0 ) && + (strcmp (tokens[3 ],"in" ) ==0 ) && + (strcmp (tokens[5 ],"enable" ) ==0 )) { +cmd_pipeline_port_in_enable (tokens, n_tokens, + out, out_size); +return ; + } + +if ((n_tokens >=6 ) && + (strcmp (tokens[2 ],"port" ) ==0 ) && + (strcmp (tokens[3 ],"in" ) ==0 ) && + (strcmp (tokens[5 ],"disable" ) ==0 )) { +cmd_pipeline_port_in_disable (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +8 -0
@@ -269,4 +269,12 @@ struct table_rule_action { struct rte_table_action_time_params time; }; +int +pipeline_port_in_enable (const char *pipeline_name, +uint32_t port_id); + +int +pipeline_port_in_disable (const char *pipeline_name, +uint32_t port_id); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +164 -1
195 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 34/49 ip_pipeline: add cli to read pipeline port and table stats
In reply to Jasvinder SinghAdd commands to read the pipeline port in, port out and table stats.
--- examples/ip_pipeline/cli.c | 256 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 18 +++ examples/ip_pipeline/thread.c | 249 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 523 insertions(+)
examples/ip_pipeline/cli.c +256 -0
@@ -1938,6 +1938,83 @@ cmd_pipeline_port_in_table(char **tokens, }/** +* pipeline <pipeline_name> port in <port_id> stats read [clear] +*/ + +#define MSG_PIPELINE_PORT_IN_STATS \ + "Pkts in: %" PRIu64 "\n" \ + "Pkts dropped by AH: %" PRIu64 "\n" \ + "Pkts dropped by other: %" PRIu64 "\n" + +static void +cmd_pipeline_port_in_stats (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct rte_pipeline_port_in_stats stats; +char *pipeline_name; +uint32_t port_id; +int clear, status; + +if ((n_tokens !=7 ) && (n_tokens !=8 )) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"port" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (strcmp (tokens[3 ],"in" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"in" ); +return ; + } + +if (parser_read_uint32 (&port_id, tokens[4 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"port_id" ); +return ; + } + +if (strcmp (tokens[5 ],"stats" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"stats" ); +return ; + } + +if (strcmp (tokens[6 ],"read" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"read" ); +return ; + } + + clear =0 ; +if (n_tokens ==8 ) { +if (strcmp (tokens[7 ],"clear" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"clear" ); +return ; + } + + clear =1 ; + } + + status =pipeline_port_in_stats_read (pipeline_name, + port_id, + &stats, + clear); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } + +snprintf (out, out_size,MSG_PIPELINE_PORT_IN_STATS , + stats.stats.n_pkts_in, + stats.n_pkts_dropped_by_ah, + stats.stats.n_pkts_drop); +} + +/** * pipeline <pipeline_name> port in <port_id> enable */ static void
@@ -2032,6 +2109,159 @@ cmd_pipeline_port_in_disable(char **tokens, }/** +* pipeline <pipeline_name> port out <port_id> stats read [clear] +*/ +#define MSG_PIPELINE_PORT_OUT_STATS \ + "Pkts in: %" PRIu64 "\n" \ + "Pkts dropped by AH: %" PRIu64 "\n" \ + "Pkts dropped by other: %" PRIu64 "\n" + +static void +cmd_pipeline_port_out_stats (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct rte_pipeline_port_out_stats stats; +char *pipeline_name; +uint32_t port_id; +int clear, status; + +if ((n_tokens !=7 ) && (n_tokens !=8 )) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"port" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (strcmp (tokens[3 ],"out" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"out" ); +return ; + } + +if (parser_read_uint32 (&port_id, tokens[4 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"port_id" ); +return ; + } + +if (strcmp (tokens[5 ],"stats" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"stats" ); +return ; + } + +if (strcmp (tokens[6 ],"read" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"read" ); +return ; + } + + clear =0 ; +if (n_tokens ==8 ) { +if (strcmp (tokens[7 ],"clear" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"clear" ); +return ; + } + + clear =1 ; + } + + status =pipeline_port_out_stats_read (pipeline_name, + port_id, + &stats, + clear); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } + +snprintf (out, out_size,MSG_PIPELINE_PORT_OUT_STATS , + stats.stats.n_pkts_in, + stats.n_pkts_dropped_by_ah, + stats.stats.n_pkts_drop); +} + +/** +* pipeline <pipeline_name> table <table_id> stats read [clear] +*/ +#define MSG_PIPELINE_TABLE_STATS \ + "Pkts in: %" PRIu64 "\n" \ + "Pkts in with lookup miss: %" PRIu64 "\n" \ + "Pkts in with lookup hit dropped by AH: %" PRIu64 "\n" \ + "Pkts in with lookup hit dropped by others: %" PRIu64 "\n" \ + "Pkts in with lookup miss dropped by AH: %" PRIu64 "\n" \ + "Pkts in with lookup miss dropped by others: %" PRIu64 "\n" + +static void +cmd_pipeline_table_stats (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct rte_pipeline_table_stats stats; +char *pipeline_name; +uint32_t table_id; +int clear, status; + +if ((n_tokens !=6 ) && (n_tokens !=7 )) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"stats" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"stats" ); +return ; + } + +if (strcmp (tokens[5 ],"read" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"read" ); +return ; + } + + clear =0 ; +if (n_tokens ==7 ) { +if (strcmp (tokens[6 ],"clear" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"clear" ); +return ; + } + + clear =1 ; + } + + status =pipeline_table_stats_read (pipeline_name, + table_id, + &stats, + clear); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } + +snprintf (out, out_size,MSG_PIPELINE_TABLE_STATS , + stats.stats.n_pkts_in, + stats.stats.n_pkts_lookup_miss, + stats.n_pkts_dropped_by_lkp_hit_ah, + stats.n_pkts_dropped_lkp_hit, + stats.n_pkts_dropped_by_lkp_miss_ah, + stats.n_pkts_dropped_lkp_miss); +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -2246,6 +2476,15 @@ cli_process(char *in, char *out, size_t out_size)if ((n_tokens >=6 ) && (strcmp (tokens[2 ],"port" ) ==0 ) && (strcmp (tokens[3 ],"in" ) ==0 ) && + (strcmp (tokens[5 ],"stats" ) ==0 )) { +cmd_pipeline_port_in_stats (tokens, n_tokens, + out, out_size); +return ; + } + +if ((n_tokens >=6 ) && + (strcmp (tokens[2 ],"port" ) ==0 ) && + (strcmp (tokens[3 ],"in" ) ==0 ) && (strcmp (tokens[5 ],"enable" ) ==0 )) {cmd_pipeline_port_in_enable (tokens, n_tokens, out, out_size);
@@ -2260,6 +2499,23 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=6 ) && + (strcmp (tokens[2 ],"port" ) ==0 ) && + (strcmp (tokens[3 ],"out" ) ==0 ) && + (strcmp (tokens[5 ],"stats" ) ==0 )) { +cmd_pipeline_port_out_stats (tokens, n_tokens, + out, out_size); +return ; + } + +if ((n_tokens >=5 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"stats" ) ==0 )) { +cmd_pipeline_table_stats (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +18 -0
@@ -270,6 +270,12 @@ struct table_rule_action { };int +pipeline_port_in_stats_read (const char *pipeline_name, +uint32_t port_id, +struct rte_pipeline_port_in_stats *stats, +int clear); + +int pipeline_port_in_enable (const char *pipeline_name,uint32_t port_id);
@@ -277,4 +283,16 @@ int pipeline_port_in_disable(const char *pipeline_name, uint32_t port_id); +int +pipeline_port_out_stats_read (const char *pipeline_name, +uint32_t port_id, +struct rte_pipeline_port_out_stats *stats, +int clear); + +int +pipeline_table_stats_read (const char *pipeline_name, +uint32_t table_id, +struct rte_pipeline_table_stats *stats, +int clear); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +249 -0
304 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 35/49 ip_pipeline: add cli for pipeline table entry
In reply to Jasvinder SinghAdd commands to add pipeline table entries which contains match and action part.
--- examples/ip_pipeline/cli.c | 1295 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 13 + examples/ip_pipeline/thread.c | 751 +++++++++++++++++++++++ 3 files changed, 2059 insertions(+)
examples/ip_pipeline/cli.c +1295 -0
@@ -8,6 +8,7 @@#include <string.h> #include <rte_common.h> +#include <rte_cycles.h> #include "cli.h" #include "kni.h"
@@ -2262,6 +2263,1283 @@ cmd_pipeline_table_stats(char **tokens, }/** +* <match> ::= +* +* match +* acl +* priority <priority> +* ipv4 | ipv6 <sa> <sa_depth> <da> <da_depth> +* <sp0> <sp1> <dp0> <dp1> <proto> +* | array +* pos +* | hash +* raw <key> +* | ipv4_5tuple <sa> <da> <sp> <dp> <proto> +* | ipv6_5tuple <sa> <da> <sp> <dp> <proto> +* | ipv4_addr <addr> +* | ipv6_addr <addr> +* | qinq <svlan> <cvlan> +* | lpm +* ipv4 | ipv6 <addr> <depth> +*/ +struct pkt_key_qinq { +uint16_t ethertype_svlan; +uint16_t svlan; +uint16_t ethertype_cvlan; +uint16_t cvlan; +} __attribute__((__packed__ )); + +struct pkt_key_ipv4_5tuple { +uint8_t time_to_live; +uint8_t proto; +uint16_t hdr_checksum; +uint32_t sa; +uint32_t da; +uint16_t sp; +uint16_t dp; +} __attribute__((__packed__ )); + +struct pkt_key_ipv6_5tuple { +uint16_t payload_length; +uint8_t proto; +uint8_t hop_limit; +uint8_t sa[16 ]; +uint8_t da[16 ]; +uint16_t sp; +uint16_t dp; +} __attribute__((__packed__ )); + +struct pkt_key_ipv4_addr { +uint32_t addr; +} __attribute__((__packed__ )); + +struct pkt_key_ipv6_addr { +uint8_t addr[16 ]; +} __attribute__((__packed__ )); + +static uint32_t +parse_match (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +struct table_rule_match *m) +{ +memset (m,0 ,sizeof (*m)); + +if (n_tokens <2 ) +return 0 ; + +if (strcmp (tokens[0 ],"match" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"match" ); +return 0 ; + } + +if (strcmp (tokens[1 ],"acl" ) ==0 ) { +if (n_tokens <14 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return 0 ; + } + + m->match_type =TABLE_ACL ; + +if (strcmp (tokens[2 ],"priority" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"priority" ); +return 0 ; + } + +if (parser_read_uint32 (&m->match.acl.priority, + tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"priority" ); +return 0 ; + } + +if (strcmp (tokens[4 ],"ipv4" ) ==0 ) { +struct in_addr saddr, daddr; + + m->match.acl.ip_version =1 ; + +if (parse_ipv4_addr (tokens[5 ], &saddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sa" ); +return 0 ; + } + m->match.acl.ipv4.sa =rte_be_to_cpu_32 (saddr.s_addr); + +if (parse_ipv4_addr (tokens[7 ], &daddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"da" ); +return 0 ; + } + m->match.acl.ipv4.da =rte_be_to_cpu_32 (daddr.s_addr); + }else if (strcmp (tokens[4 ],"ipv6" ) ==0 ) { +struct in6_addr saddr, daddr; + + m->match.acl.ip_version =0 ; + +if (parse_ipv6_addr (tokens[5 ], &saddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sa" ); +return 0 ; + } +memcpy (m->match.acl.ipv6.sa, saddr.s6_addr,16 ); + +if (parse_ipv6_addr (tokens[7 ], &daddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"da" ); +return 0 ; + } +memcpy (m->match.acl.ipv6.da, daddr.s6_addr,16 ); + }else { +snprintf (out, out_size,MSG_ARG_NOT_FOUND , +"ipv4 or ipv6" ); +return 0 ; + } + +if (parser_read_uint32 (&m->match.acl.sa_depth, + tokens[6 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sa_depth" ); +return 0 ; + } + +if (parser_read_uint32 (&m->match.acl.da_depth, + tokens[8 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"da_depth" ); +return 0 ; + } + +if (parser_read_uint16 (&m->match.acl.sp0, tokens[9 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sp0" ); +return 0 ; + } + +if (parser_read_uint16 (&m->match.acl.sp1, tokens[10 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sp1" ); +return 0 ; + } + +if (parser_read_uint16 (&m->match.acl.dp0, tokens[11 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"dp0" ); +return 0 ; + } + +if (parser_read_uint16 (&m->match.acl.dp1, tokens[12 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"dp1" ); +return 0 ; + } + +if (parser_read_uint8 (&m->match.acl.proto, tokens[13 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"proto" ); +return 0 ; + } + + m->match.acl.proto_mask =0xff ; + +return 14 ; + }/* acl */ + +if (strcmp (tokens[1 ],"array" ) ==0 ) { +if (n_tokens <3 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return 0 ; + } + + m->match_type =TABLE_ARRAY ; + +if (parser_read_uint32 (&m->match.array.pos, tokens[2 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"pos" ); +return 0 ; + } + +return 3 ; + }/* array */ + +if (strcmp (tokens[1 ],"hash" ) ==0 ) { +if (n_tokens <3 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return 0 ; + } + + m->match_type =TABLE_HASH ; + +if (strcmp (tokens[2 ],"raw" ) ==0 ) { +uint32_t key_size =TABLE_RULE_MATCH_SIZE_MAX ; + +if (n_tokens <4 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , + tokens[0 ]); +return 0 ; + } + +if (parse_hex_string (tokens[3 ], + m->match.hash.key, &key_size) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"key" ); +return 0 ; + } + +return 4 ; + }/* hash raw */ + +if (strcmp (tokens[2 ],"ipv4_5tuple" ) ==0 ) { +struct pkt_key_ipv4_5tuple *ipv4 = + (struct pkt_key_ipv4_5tuple *) m->match.hash.key; +struct in_addr saddr, daddr; +uint16_t sp, dp; +uint8_t proto; + +if (n_tokens <8 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , + tokens[0 ]); +return 0 ; + } + +if (parse_ipv4_addr (tokens[3 ], &saddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sa" ); +return 0 ; + } + +if (parse_ipv4_addr (tokens[4 ], &daddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"da" ); +return 0 ; + } + +if (parser_read_uint16 (&sp, tokens[5 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sp" ); +return 0 ; + } + +if (parser_read_uint16 (&dp, tokens[6 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"dp" ); +return 0 ; + } + +if (parser_read_uint8 (&proto, tokens[7 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"proto" ); +return 0 ; + } + + ipv4->sa = saddr.s_addr; + ipv4->da = daddr.s_addr; + ipv4->sp =rte_cpu_to_be_16 (sp); + ipv4->dp =rte_cpu_to_be_16 (dp); + ipv4->proto = proto; + +return 8 ; + }/* hash ipv4_5tuple */ + +if (strcmp (tokens[2 ],"ipv6_5tuple" ) ==0 ) { +struct pkt_key_ipv6_5tuple *ipv6 = + (struct pkt_key_ipv6_5tuple *) m->match.hash.key; +struct in6_addr saddr, daddr; +uint16_t sp, dp; +uint8_t proto; + +if (n_tokens <8 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , + tokens[0 ]); +return 0 ; + } + +if (parse_ipv6_addr (tokens[3 ], &saddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sa" ); +return 0 ; + } + +if (parse_ipv6_addr (tokens[4 ], &daddr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"da" ); +return 0 ; + } + +if (parser_read_uint16 (&sp, tokens[5 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"sp" ); +return 0 ; + } + +if (parser_read_uint16 (&dp, tokens[6 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"dp" ); +return 0 ; + } + +if (parser_read_uint8 (&proto, tokens[7 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"proto" ); +return 0 ; + } + +memcpy (ipv6->sa, saddr.s6_addr,16 ); +memcpy (ipv6->da, daddr.s6_addr,16 ); + ipv6->sp =rte_cpu_to_be_16 (sp); + ipv6->dp =rte_cpu_to_be_16 (dp); + ipv6->proto = proto; + +return 8 ; + }/* hash ipv6_5tuple */ + +if (strcmp (tokens[2 ],"ipv4_addr" ) ==0 ) { +struct pkt_key_ipv4_addr *ipv4_addr = + (struct pkt_key_ipv4_addr *) m->match.hash.key; +struct in_addr addr; + +if (n_tokens <4 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , + tokens[0 ]); +return 0 ; + } + +if (parse_ipv4_addr (tokens[3 ], &addr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"addr" ); +return 0 ; + } + + ipv4_addr->addr = addr.s_addr; + +return 4 ; + }/* hash ipv4_addr */ + +if (strcmp (tokens[2 ],"ipv6_addr" ) ==0 ) { +struct pkt_key_ipv6_addr *ipv6_addr = + (struct pkt_key_ipv6_addr *) m->match.hash.key; +struct in6_addr addr; + +if (n_tokens <4 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , + tokens[0 ]); +return 0 ; + } + +if (parse_ipv6_addr (tokens[3 ], &addr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"addr" ); +return 0 ; + } + +memcpy (ipv6_addr->addr, addr.s6_addr,16 ); + +return 4 ; + }/* hash ipv6_5tuple */ + +if (strcmp (tokens[2 ],"qinq" ) ==0 ) { +struct pkt_key_qinq *qinq = + (struct pkt_key_qinq *) m->match.hash.key; +uint16_t svlan, cvlan; + +if (n_tokens <5 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , + tokens[0 ]); +return 0 ; + } + +if ((parser_read_uint16 (&svlan, tokens[3 ]) !=0 ) || + (svlan >0xFFF )) { +snprintf (out, out_size,MSG_ARG_INVALID , +"svlan" ); +return 0 ; + } + +if ((parser_read_uint16 (&cvlan, tokens[4 ]) !=0 ) || + (cvlan >0xFFF )) { +snprintf (out, out_size,MSG_ARG_INVALID , +"cvlan" ); +return 0 ; + } + + qinq->svlan =rte_cpu_to_be_16 (svlan); + qinq->cvlan =rte_cpu_to_be_16 (cvlan); + +return 5 ; + }/* hash qinq */ + +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return 0 ; + }/* hash */ + +if (strcmp (tokens[1 ],"lpm" ) ==0 ) { +if (n_tokens <5 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return 0 ; + } + + m->match_type =TABLE_LPM ; + +if (strcmp (tokens[2 ],"ipv4" ) ==0 ) { +struct in_addr addr; + + m->match.lpm.ip_version =1 ; + +if (parse_ipv4_addr (tokens[3 ], &addr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"addr" ); +return 0 ; + } + + m->match.lpm.ipv4 =rte_be_to_cpu_32 (addr.s_addr); + }else if (strcmp (tokens[2 ],"ipv6" ) ==0 ) { +struct in6_addr addr; + + m->match.lpm.ip_version =0 ; + +if (parse_ipv6_addr (tokens[3 ], &addr) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"addr" ); +return 0 ; + } + +memcpy (m->match.lpm.ipv6, addr.s6_addr,16 ); + }else { +snprintf (out, out_size,MSG_ARG_MISMATCH , +"ipv4 or ipv6" ); +return 0 ; + } + +if (parser_read_uint8 (&m->match.lpm.depth, tokens[4 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"depth" ); +return 0 ; + } + +return 5 ; + }/* lpm */ + +snprintf (out, out_size,MSG_ARG_MISMATCH , +"acl or array or hash or lpm" ); +return 0 ; +} + +/** +* table_action ::= +* +* action +* fwd +* drop +* | port <port_id> +* | meta +* | table <table_id> +* [balance <out0> ... <out7>] +* [meter +* tc0 meter <meter_profile_id> policer g <pa> y <pa> r <pa> +* [tc1 meter <meter_profile_id> policer g <pa> y <pa> r <pa> +* tc2 meter <meter_profile_id> policer g <pa> y <pa> r <pa> +* tc3 meter <meter_profile_id> policer g <pa> y <pa> r <pa>]] +* [tm subport <subport_id> pipe <pipe_id>] +* [encap +* ether <da> <sa> +* | vlan <da> <sa> <pcp> <dei> <vid> +* | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> +* | mpls unicast | multicast +* <da> <sa> +* label0 <label> <tc> <ttl> +* [label1 <label> <tc> <ttl> +* [label2 <label> <tc> <ttl> +* [label3 <label> <tc> <ttl>]]] +* | pppoe <da> <sa> <session_id>] +* [nat ipv4 | ipv6 <addr> <port>] +* [ttl dec | keep] +* [stats] +* [time] +* +* where: +* <pa> ::= g | y | r | drop +*/ +static uint32_t +parse_table_action_fwd (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +if ((n_tokens ==0 ) || (strcmp (tokens[0 ],"fwd" ) !=0 )) +return 0 ; + + tokens++; + n_tokens--; + +if (n_tokens && (strcmp (tokens[0 ],"drop" ) ==0 )) { + a->fwd.action =RTE_PIPELINE_ACTION_DROP ; + a->action_mask |=1 <<RTE_TABLE_ACTION_FWD ; +return 1 +1 ; + } + +if (n_tokens && (strcmp (tokens[0 ],"port" ) ==0 )) { +uint32_t id; + +if ((n_tokens <2 ) || +parser_read_uint32 (&id, tokens[1 ])) +return 0 ; + + a->fwd.action =RTE_PIPELINE_ACTION_PORT ; + a->fwd.id = id; + a->action_mask |=1 <<RTE_TABLE_ACTION_FWD ; +return 1 +2 ; + } + +if (n_tokens && (strcmp (tokens[0 ],"meta" ) ==0 )) { + a->fwd.action =RTE_PIPELINE_ACTION_PORT_META ; + a->action_mask |=1 <<RTE_TABLE_ACTION_FWD ; +return 1 +1 ; + } + +if (n_tokens && (strcmp (tokens[0 ],"table" ) ==0 )) { +uint32_t id; + +if ((n_tokens <2 ) || +parser_read_uint32 (&id, tokens[1 ])) +return 0 ; + + a->fwd.action =RTE_PIPELINE_ACTION_TABLE ; + a->fwd.id = id; + a->action_mask |=1 <<RTE_TABLE_ACTION_FWD ; +return 1 +2 ; + } + +return 0 ; +} + +static int +parse_policer_action (char *token,enum rte_table_action_policer *a) +{ +if (strcmp (token,"g" ) ==0 ) { + *a =RTE_TABLE_ACTION_POLICER_COLOR_GREEN ; +return 0 ; + } + +if (strcmp (token,"y" ) ==0 ) { + *a =RTE_TABLE_ACTION_POLICER_COLOR_YELLOW ; +return 0 ; + } + +if (strcmp (token,"r" ) ==0 ) { + *a =RTE_TABLE_ACTION_POLICER_COLOR_RED ; +return 0 ; + } + +if (strcmp (token,"drop" ) ==0 ) { + *a =RTE_TABLE_ACTION_POLICER_DROP ; +return 0 ; + } + +return -1 ; +} + +static uint32_t +parse_table_action_meter_tc (char **tokens, +uint32_t n_tokens, +struct rte_table_action_mtr_tc_params *mtr) +{ +if ((n_tokens <9 ) || +strcmp (tokens[0 ],"meter" ) || +parser_read_uint32 (&mtr->meter_profile_id, tokens[1 ]) || +strcmp (tokens[2 ],"policer" ) || +strcmp (tokens[3 ],"g" ) || +parse_policer_action (tokens[4 ], &mtr->policer[e_RTE_METER_GREEN]) || +strcmp (tokens[5 ],"y" ) || +parse_policer_action (tokens[6 ], &mtr->policer[e_RTE_METER_YELLOW]) || +strcmp (tokens[7 ],"r" ) || +parse_policer_action (tokens[8 ], &mtr->policer[e_RTE_METER_RED])) +return 0 ; + +return 9 ; +} + +static uint32_t +parse_table_action_meter (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +if ((n_tokens ==0 ) ||strcmp (tokens[0 ],"meter" )) +return 0 ; + + tokens++; + n_tokens--; + +if ((n_tokens <10 ) || +strcmp (tokens[0 ],"tc0" ) || + (parse_table_action_meter_tc (tokens +1 , + n_tokens -1 , + &a->mtr.mtr[0 ]) ==0 )) +return 0 ; + + tokens +=10 ; + n_tokens -=10 ; + +if ((n_tokens ==0 ) ||strcmp (tokens[0 ],"tc1" )) { + a->mtr.tc_mask =1 ; + a->action_mask |=1 <<RTE_TABLE_ACTION_MTR ; +return 1 +10 ; + } + +if ((n_tokens <30 ) || + (parse_table_action_meter_tc (tokens +1 , + n_tokens -1 , &a->mtr.mtr[1 ]) ==0 ) || +strcmp (tokens[10 ],"tc2" ) || + (parse_table_action_meter_tc (tokens +11 , + n_tokens -11 , &a->mtr.mtr[2 ]) ==0 ) || +strcmp (tokens[20 ],"tc3" ) || + (parse_table_action_meter_tc (tokens +21 , + n_tokens -21 , &a->mtr.mtr[3 ]) ==0 )) +return 0 ; + + a->mtr.tc_mask =0xF ; + a->action_mask |=1 <<RTE_TABLE_ACTION_MTR ; +return 1 +10 +3 *10 ; +} + +static uint32_t +parse_table_action_tm (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +uint32_t subport_id, pipe_id; + +if ((n_tokens <5 ) || +strcmp (tokens[0 ],"tm" ) || +strcmp (tokens[1 ],"subport" ) || +parser_read_uint32 (&subport_id, tokens[2 ]) || +strcmp (tokens[3 ],"pipe" ) || +parser_read_uint32 (&pipe_id, tokens[4 ])) +return 0 ; + + a->tm.subport_id = subport_id; + a->tm.pipe_id = pipe_id; + a->action_mask |=1 <<RTE_TABLE_ACTION_TM ; +return 5 ; +} + +static uint32_t +parse_table_action_encap (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +if ((n_tokens ==0 ) ||strcmp (tokens[0 ],"encap" )) +return 0 ; + + tokens++; + n_tokens--; + +/* ether */ +if (n_tokens && (strcmp (tokens[0 ],"ether" ) ==0 )) { +if ((n_tokens <3 ) || +parse_mac_addr (tokens[1 ], &a->encap.ether.ether.da) || +parse_mac_addr (tokens[2 ], &a->encap.ether.ether.sa)) +return 0 ; + + a->encap.type =RTE_TABLE_ACTION_ENCAP_ETHER ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +3 ; + } + +/* vlan */ +if (n_tokens && (strcmp (tokens[0 ],"vlan" ) ==0 )) { +uint32_t pcp, dei, vid; + +if ((n_tokens <6 ) || +parse_mac_addr (tokens[1 ], &a->encap.vlan.ether.da) || +parse_mac_addr (tokens[2 ], &a->encap.vlan.ether.sa) || +parser_read_uint32 (&pcp, tokens[3 ]) || + (pcp >0x7 ) || +parser_read_uint32 (&dei, tokens[4 ]) || + (dei >0x1 ) || +parser_read_uint32 (&vid, tokens[5 ]) || + (vid >0xFFF )) +return 0 ; + + a->encap.vlan.vlan.pcp = pcp &0x7 ; + a->encap.vlan.vlan.dei = dei &0x1 ; + a->encap.vlan.vlan.vid = vid &0xFFF ; + a->encap.type =RTE_TABLE_ACTION_ENCAP_VLAN ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +6 ; + } + +/* qinq */ +if (n_tokens && (strcmp (tokens[0 ],"qinq" ) ==0 )) { +uint32_t svlan_pcp, svlan_dei, svlan_vid; +uint32_t cvlan_pcp, cvlan_dei, cvlan_vid; + +if ((n_tokens <9 ) || +parse_mac_addr (tokens[1 ], &a->encap.qinq.ether.da) || +parse_mac_addr (tokens[2 ], &a->encap.qinq.ether.sa) || +parser_read_uint32 (&svlan_pcp, tokens[3 ]) || + (svlan_pcp >0x7 ) || +parser_read_uint32 (&svlan_dei, tokens[4 ]) || + (svlan_dei >0x1 ) || +parser_read_uint32 (&svlan_vid, tokens[5 ]) || + (svlan_vid >0xFFF ) || +parser_read_uint32 (&cvlan_pcp, tokens[6 ]) || + (cvlan_pcp >0x7 ) || +parser_read_uint32 (&cvlan_dei, tokens[7 ]) || + (cvlan_dei >0x1 ) || +parser_read_uint32 (&cvlan_vid, tokens[8 ]) || + (cvlan_vid >0xFFF )) +return 0 ; + + a->encap.qinq.svlan.pcp = svlan_pcp &0x7 ; + a->encap.qinq.svlan.dei = svlan_dei &0x1 ; + a->encap.qinq.svlan.vid = svlan_vid &0xFFF ; + a->encap.qinq.cvlan.pcp = cvlan_pcp &0x7 ; + a->encap.qinq.cvlan.dei = cvlan_dei &0x1 ; + a->encap.qinq.cvlan.vid = cvlan_vid &0xFFF ; + a->encap.type =RTE_TABLE_ACTION_ENCAP_QINQ ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +9 ; + } + +/* mpls */ +if (n_tokens && (strcmp (tokens[0 ],"mpls" ) ==0 )) { +uint32_t label, tc, ttl; + +if (n_tokens <8 ) +return 0 ; + +if (strcmp (tokens[1 ],"unicast" ) ==0 ) + a->encap.mpls.unicast =1 ; +else if (strcmp (tokens[1 ],"multicast" ) ==0 ) + a->encap.mpls.unicast =0 ; +else +return 0 ; + +if (parse_mac_addr (tokens[2 ], &a->encap.mpls.ether.da) || +parse_mac_addr (tokens[3 ], &a->encap.mpls.ether.sa) || +strcmp (tokens[4 ],"label0" ) || +parser_read_uint32 (&label, tokens[5 ]) || + (label >0xFFFFF ) || +parser_read_uint32 (&tc, tokens[6 ]) || + (tc >0x7 ) || +parser_read_uint32 (&ttl, tokens[7 ]) || + (ttl >0x3F )) +return 0 ; + + a->encap.mpls.mpls[0 ].label = label; + a->encap.mpls.mpls[0 ].tc = tc; + a->encap.mpls.mpls[0 ].ttl = ttl; + + tokens +=8 ; + n_tokens -=8 ; + +if ((n_tokens ==0 ) ||strcmp (tokens[0 ],"label1" )) { + a->encap.mpls.mpls_count =1 ; + a->encap.type =RTE_TABLE_ACTION_ENCAP_MPLS ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +8 ; + } + +if ((n_tokens <4 ) || +parser_read_uint32 (&label, tokens[1 ]) || + (label >0xFFFFF ) || +parser_read_uint32 (&tc, tokens[2 ]) || + (tc >0x7 ) || +parser_read_uint32 (&ttl, tokens[3 ]) || + (ttl >0x3F )) +return 0 ; + + a->encap.mpls.mpls[1 ].label = label; + a->encap.mpls.mpls[1 ].tc = tc; + a->encap.mpls.mpls[1 ].ttl = ttl; + + tokens +=4 ; + n_tokens -=4 ; + +if ((n_tokens ==0 ) ||strcmp (tokens[0 ],"label2" )) { + a->encap.mpls.mpls_count =2 ; + a->encap.type =RTE_TABLE_ACTION_ENCAP_MPLS ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +8 +4 ; + } + +if ((n_tokens <4 ) || +parser_read_uint32 (&label, tokens[1 ]) || + (label >0xFFFFF ) || +parser_read_uint32 (&tc, tokens[2 ]) || + (tc >0x7 ) || +parser_read_uint32 (&ttl, tokens[3 ]) || + (ttl >0x3F )) +return 0 ; + + a->encap.mpls.mpls[2 ].label = label; + a->encap.mpls.mpls[2 ].tc = tc; + a->encap.mpls.mpls[2 ].ttl = ttl; + + tokens +=4 ; + n_tokens -=4 ; + +if ((n_tokens ==0 ) ||strcmp (tokens[0 ],"label3" )) { + a->encap.mpls.mpls_count =3 ; + a->encap.type =RTE_TABLE_ACTION_ENCAP_MPLS ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +8 +4 +4 ; + } + +if ((n_tokens <4 ) || +parser_read_uint32 (&label, tokens[1 ]) || + (label >0xFFFFF ) || +parser_read_uint32 (&tc, tokens[2 ]) || + (tc >0x7 ) || +parser_read_uint32 (&ttl, tokens[3 ]) || + (ttl >0x3F )) +return 0 ; + + a->encap.mpls.mpls[3 ].label = label; + a->encap.mpls.mpls[3 ].tc = tc; + a->encap.mpls.mpls[3 ].ttl = ttl; + + a->encap.mpls.mpls_count =4 ; + a->encap.type =RTE_TABLE_ACTION_ENCAP_MPLS ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +8 +4 +4 +4 ; + } + +/* pppoe */ +if (n_tokens && (strcmp (tokens[0 ],"pppoe" ) ==0 )) { +if ((n_tokens <4 ) || +parse_mac_addr (tokens[1 ], &a->encap.pppoe.ether.da) || +parse_mac_addr (tokens[2 ], &a->encap.pppoe.ether.sa) || +parser_read_uint16 (&a->encap.pppoe.pppoe.session_id, + tokens[3 ])) +return 0 ; + + a->encap.type =RTE_TABLE_ACTION_ENCAP_PPPOE ; + a->action_mask |=1 <<RTE_TABLE_ACTION_ENCAP ; +return 1 +4 ; + } + +return 0 ; +} + +static uint32_t +parse_table_action_nat (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +if ((n_tokens <4 ) || +strcmp (tokens[0 ],"nat" )) +return 0 ; + +if (strcmp (tokens[1 ],"ipv4" ) ==0 ) { +struct in_addr addr; +uint16_t port; + +if (parse_ipv4_addr (tokens[2 ], &addr) || +parser_read_uint16 (&port, tokens[3 ])) +return 0 ; + + a->nat.ip_version =1 ; + a->nat.addr.ipv4 =rte_be_to_cpu_32 (addr.s_addr); + a->nat.port = port; + a->action_mask |=1 <<RTE_TABLE_ACTION_NAT ; +return 4 ; + } + +if (strcmp (tokens[1 ],"ipv6" ) ==0 ) { +struct in6_addr addr; +uint16_t port; + +if (parse_ipv6_addr (tokens[2 ], &addr) || +parser_read_uint16 (&port, tokens[3 ])) +return 0 ; + + a->nat.ip_version =0 ; +memcpy (a->nat.addr.ipv6, addr.s6_addr,16 ); + a->nat.port = port; + a->action_mask |=1 <<RTE_TABLE_ACTION_NAT ; +return 4 ; + } + +return 0 ; +} + +static uint32_t +parse_table_action_ttl (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +if ((n_tokens <2 ) || +strcmp (tokens[0 ],"ttl" )) +return 0 ; + +if (strcmp (tokens[1 ],"dec" ) ==0 ) + a->ttl.decrement =1 ; +else if (strcmp (tokens[1 ],"keep" ) ==0 ) + a->ttl.decrement =0 ; +else +return 0 ; + + a->action_mask |=1 <<RTE_TABLE_ACTION_TTL ; +return 2 ; +} + +static uint32_t +parse_table_action_stats (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +if ((n_tokens <1 ) || +strcmp (tokens[0 ],"stats" )) +return 0 ; + + a->stats.n_packets =0 ; + a->stats.n_bytes =0 ; + a->action_mask |=1 <<RTE_TABLE_ACTION_STATS ; +return 1 ; +} + +static uint32_t +parse_table_action_time (char **tokens, +uint32_t n_tokens, +struct table_rule_action *a) +{ +if ((n_tokens <1 ) || +strcmp (tokens[0 ],"time" )) +return 0 ; + + a->time.time =rte_rdtsc (); + a->action_mask |=1 <<RTE_TABLE_ACTION_TIME ; +return 1 ; +} + +static uint32_t +parse_table_action (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size, +struct table_rule_action *a) +{ +uint32_t n_tokens0 = n_tokens; + +memset (a,0 ,sizeof (*a)); + +if ((n_tokens <2 ) || +strcmp (tokens[0 ],"action" )) +return 0 ; + + tokens++; + n_tokens--; + +if (n_tokens && (strcmp (tokens[0 ],"fwd" ) ==0 )) { +uint32_t n; + + n =parse_table_action_fwd (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action fwd" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens && (strcmp (tokens[0 ],"meter" ) ==0 )) { +uint32_t n; + + n =parse_table_action_meter (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action meter" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens && (strcmp (tokens[0 ],"tm" ) ==0 )) { +uint32_t n; + + n =parse_table_action_tm (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action tm" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens && (strcmp (tokens[0 ],"encap" ) ==0 )) { +uint32_t n; + + n =parse_table_action_encap (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action encap" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens && (strcmp (tokens[0 ],"nat" ) ==0 )) { +uint32_t n; + + n =parse_table_action_nat (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action nat" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens && (strcmp (tokens[0 ],"ttl" ) ==0 )) { +uint32_t n; + + n =parse_table_action_ttl (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action ttl" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens && (strcmp (tokens[0 ],"stats" ) ==0 )) { +uint32_t n; + + n =parse_table_action_stats (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action stats" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens && (strcmp (tokens[0 ],"time" ) ==0 )) { +uint32_t n; + + n =parse_table_action_time (tokens, n_tokens, a); +if (n ==0 ) { +snprintf (out, out_size,MSG_ARG_INVALID , +"action time" ); +return 0 ; + } + + tokens += n; + n_tokens -= n; + } + +if (n_tokens0 - n_tokens ==1 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"action" ); +return 0 ; + } + +return n_tokens0 - n_tokens; +} + +/** +* pipeline <pipeline_name> table <table_id> rule add +* match <match> +* action <table_action> +*/ +static void +cmd_pipeline_table_rule_add (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct table_rule_match m; +struct table_rule_action a; +char *pipeline_name; +void *data; +uint32_t table_id, t0, n_tokens_parsed; +int status; + +if (n_tokens <8 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"table" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"rule" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"rule" ); +return ; + } + +if (strcmp (tokens[5 ],"add" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"add" ); +return ; + } + + t0 =6 ; + +/* match */ + n_tokens_parsed =parse_match (tokens + t0, + n_tokens - t0, + out, + out_size, + &m); +if (n_tokens_parsed ==0 ) +return ; + t0 += n_tokens_parsed; + +/* action */ + n_tokens_parsed =parse_table_action (tokens + t0, + n_tokens - t0, + out, + out_size, + &a); +if (n_tokens_parsed ==0 ) +return ; + t0 += n_tokens_parsed; + +if (t0 != n_tokens) { +snprintf (out, out_size,MSG_ARG_INVALID , tokens[0 ]); +return ; + } + + status =pipeline_table_rule_add (pipeline_name, table_id, + &m, &a, &data); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** +* pipeline <pipeline_name> table <table_id> rule add +* match +* default +* action +* fwd +* drop +* | port <port_id> +* | meta +* | table <table_id> +*/ +static void +cmd_pipeline_table_rule_add_default (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct table_rule_action action; +void *data; +char *pipeline_name; +uint32_t table_id; +int status; + +if ((n_tokens !=11 ) && (n_tokens !=12 )) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"table" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"rule" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"rule" ); +return ; + } + +if (strcmp (tokens[5 ],"add" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"add" ); +return ; + } + +if (strcmp (tokens[6 ],"match" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"match" ); +return ; + } + +if (strcmp (tokens[7 ],"default" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"default" ); +return ; + } + +if (strcmp (tokens[8 ],"action" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"action" ); +return ; + } + +if (strcmp (tokens[9 ],"fwd" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"fwd" ); +return ; + } + + action.action_mask =1 <<RTE_TABLE_ACTION_FWD ; + +if (strcmp (tokens[10 ],"drop" ) ==0 ) { +if (n_tokens !=11 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + action.fwd.action =RTE_PIPELINE_ACTION_DROP ; + }else if (strcmp (tokens[10 ],"port" ) ==0 ) { +uint32_t id; + +if (n_tokens !=12 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + +if (parser_read_uint32 (&id, tokens[11 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"port_id" ); +return ; + } + + action.fwd.action =RTE_PIPELINE_ACTION_PORT ; + action.fwd.id = id; + }else if (strcmp (tokens[10 ],"meta" ) ==0 ) { +if (n_tokens !=11 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + action.fwd.action =RTE_PIPELINE_ACTION_PORT_META ; + }else if (strcmp (tokens[10 ],"table" ) ==0 ) { +uint32_t id; + +if (n_tokens !=12 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + +if (parser_read_uint32 (&id, tokens[11 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + + action.fwd.action =RTE_PIPELINE_ACTION_TABLE ; + action.fwd.id = id; + }else { +snprintf (out, out_size,MSG_ARG_INVALID , +"drop or port or meta or table" ); +return ; + } + + status =pipeline_table_rule_add_default (pipeline_name, + table_id, + &action, + &data); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -2516,6 +3794,23 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=7 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"rule" ) ==0 ) && + (strcmp (tokens[5 ],"add" ) ==0 ) && + (strcmp (tokens[6 ],"match" ) ==0 )) { +if ((n_tokens >=8 ) && + (strcmp (tokens[7 ],"default" ) ==0 )) { +cmd_pipeline_table_rule_add_default (tokens, + n_tokens, out, out_size); +return ; + } + +cmd_pipeline_table_rule_add (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +13 -0
@@ -295,4 +295,17 @@ pipeline_table_stats_read(const char *pipeline_name,struct rte_pipeline_table_stats *stats, int clear); +int +pipeline_table_rule_add (const char *pipeline_name, +uint32_t table_id, +struct table_rule_match *match, +struct table_rule_action *action, +void **data); + +int +pipeline_table_rule_add_default (const char *pipeline_name, +uint32_t table_id, +struct table_rule_action *action, +void **data); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +751 -0
799 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 36/49 ip_pipeline: add cli to delete pipeline table entry
In reply to Jasvinder SinghAdd command to delete the pipeline table entry.
--- examples/ip_pipeline/cli.c | 145 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 9 +++ examples/ip_pipeline/thread.c | 142 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+)
examples/ip_pipeline/cli.c +145 -0
@@ -3540,6 +3540,134 @@ cmd_pipeline_table_rule_add_default(char **tokens, }/** +* pipeline <pipeline_name> table <table_id> rule delete +* match <match> +*/ +static void +cmd_pipeline_table_rule_delete (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct table_rule_match m; +char *pipeline_name; +uint32_t table_id, n_tokens_parsed, t0; +int status; + +if (n_tokens <8 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"table" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"rule" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"rule" ); +return ; + } + +if (strcmp (tokens[5 ],"delete" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"delete" ); +return ; + } + + t0 =6 ; + +/* match */ + n_tokens_parsed =parse_match (tokens + t0, + n_tokens - t0, + out, + out_size, + &m); +if (n_tokens_parsed ==0 ) +return ; + t0 += n_tokens_parsed; + +if (n_tokens != t0) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + status =pipeline_table_rule_delete (pipeline_name, + table_id, + &m); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** +* pipeline <pipeline_name> table <table_id> rule delete +* match +* default +*/ +static void +cmd_pipeline_table_rule_delete_default (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *pipeline_name; +uint32_t table_id; +int status; + +if (n_tokens !=8 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"table" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"rule" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"rule" ); +return ; + } + +if (strcmp (tokens[5 ],"delete" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"delete" ); +return ; + } + +if (strcmp (tokens[6 ],"match" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"match" ); +return ; + } + +if (strcmp (tokens[7 ],"default" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"default" ); +return ; + } + + status =pipeline_table_rule_delete_default (pipeline_name, + table_id); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -3811,6 +3939,23 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=7 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"rule" ) ==0 ) && + (strcmp (tokens[5 ],"delete" ) ==0 ) && + (strcmp (tokens[6 ],"match" ) ==0 )) { +if ((n_tokens >=8 ) && + (strcmp (tokens[7 ],"default" ) ==0 )) { +cmd_pipeline_table_rule_delete_default (tokens, + n_tokens, out, out_size); +return ; + } + +cmd_pipeline_table_rule_delete (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +9 -0
@@ -308,4 +308,13 @@ pipeline_table_rule_add_default(const char *pipeline_name,struct table_rule_action *action, void **data); +int +pipeline_table_rule_delete (const char *pipeline_name, +uint32_t table_id, +struct table_rule_match *match); + +int +pipeline_table_rule_delete_default (const char *pipeline_name, +uint32_t table_id); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +142 -0
178 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 37/49 ip_pipeline: add cli for bulk entries to pipeline table
In reply to Jasvinder SinghAdd cli for adding bulk entries to pipeline table.
--- examples/ip_pipeline/cli.c | 267 +++++++++++++++++++++++++++++++++++++-- examples/ip_pipeline/pipeline.h | 8 ++ examples/ip_pipeline/thread.c | 272 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 536 insertions(+), 11 deletions(-)
examples/ip_pipeline/cli.c +257 -10
@@ -25,16 +25,17 @@#define CMD_MAX_TOKENS 256#endif -#define MSG_OUT_OF_MEMORY "Not enough memory.\n" -#define MSG_CMD_UNKNOWN "Unknown command \"%s\".\n" -#define MSG_CMD_UNIMPLEM "Command \"%s\" not implemented.\n" -#define MSG_ARG_NOT_ENOUGH "Not enough arguments for command \"%s\".\n" -#define MSG_ARG_TOO_MANY "Too many arguments for command \"%s\".\n" -#define MSG_ARG_MISMATCH "Wrong number of arguments for command \"%s\".\n" -#define MSG_ARG_NOT_FOUND "Argument \"%s\" not found.\n" -#define MSG_ARG_INVALID "Invalid value for argument \"%s\".\n" -#define MSG_FILE_ERR "Error in file \"%s\" at line %u.\n" -#define MSG_CMD_FAIL "Command \"%s\" failed.\n" +#define MSG_OUT_OF_MEMORY "Not enough memory.\n" +#define MSG_CMD_UNKNOWN "Unknown command \"%s\".\n" +#define MSG_CMD_UNIMPLEM "Command \"%s\" not implemented.\n" +#define MSG_ARG_NOT_ENOUGH "Not enough arguments for command \"%s\".\n" +#define MSG_ARG_TOO_MANY "Too many arguments for command \"%s\".\n" +#define MSG_ARG_MISMATCH "Wrong number of arguments for command \"%s\".\n" +#define MSG_ARG_NOT_FOUND "Argument \"%s\" not found.\n" +#define MSG_ARG_INVALID "Invalid value for argument \"%s\".\n" +#define MSG_FILE_ERR "Error in file \"%s\" at line %u.\n" +#define MSG_FILE_NOT_ENOUGH "Not enough rules in file \"%s\".\n" +#define MSG_CMD_FAIL "Command \"%s\" failed.\n"static int is_comment (char *in)
@@ -3540,6 +3541,133 @@ cmd_pipeline_table_rule_add_default(char **tokens, }/** +* pipeline <pipeline_name> table <table_id> rule add bulk <file_name> <n_rules> +* +* File <file_name>: +* - line format: match <match> action <action> +*/ +static int +cli_rule_file_process (const char *file_name, +size_t line_len_max, +struct table_rule_match *m, +struct table_rule_action *a, +uint32_t *n_rules, +uint32_t *line_number, +char *out, +size_t out_size); + +static void +cmd_pipeline_table_rule_add_bulk (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct table_rule_match *match; +struct table_rule_action *action; +void **data; +char *pipeline_name, *file_name; +uint32_t table_id, n_rules, n_rules_parsed, line_number; +int status; + +if (n_tokens !=9 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"table" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"rule" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"rule" ); +return ; + } + +if (strcmp (tokens[5 ],"add" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"add" ); +return ; + } + +if (strcmp (tokens[6 ],"bulk" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"bulk" ); +return ; + } + + file_name = tokens[7 ]; + +if ((parser_read_uint32 (&n_rules, tokens[8 ]) !=0 ) || + (n_rules ==0 )) { +snprintf (out, out_size,MSG_ARG_INVALID ,"n_rules" ); +return ; + } + +/* Memory allocation. */ + match =calloc (n_rules,sizeof (struct table_rule_match )); + action =calloc (n_rules,sizeof (struct table_rule_action )); + data =calloc (n_rules,sizeof (void *)); +if ((match ==NULL ) || (action ==NULL ) || (data ==NULL )) { +snprintf (out, out_size,MSG_OUT_OF_MEMORY ); +free (data); +free (action); +free (match); +return ; + } + +/* Load rule file */ + n_rules_parsed = n_rules; + status =cli_rule_file_process (file_name, +1024 , + match, + action, + &n_rules_parsed, + &line_number, + out, + out_size); +if (status) { +snprintf (out, out_size,MSG_FILE_ERR , file_name, line_number); +free (data); +free (action); +free (match); +return ; + } +if (n_rules_parsed != n_rules) { +snprintf (out, out_size,MSG_FILE_NOT_ENOUGH , file_name); +free (data); +free (action); +free (match); +return ; + } + +/* Rule bulk add */ + status =pipeline_table_rule_add_bulk (pipeline_name, + table_id, + match, + action, + data, + &n_rules); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +free (data); +free (action); +free (match); +return ; + } + +/* Memory free */ +free (data); +free (action); +free (match); +} + +/** * pipeline <pipeline_name> table <table_id> rule delete * match <match> */
@@ -3943,6 +4071,16 @@ cli_process(char *in, char *out, size_t out_size)if ((n_tokens >=7 ) && (strcmp (tokens[2 ],"table" ) ==0 ) && (strcmp (tokens[4 ],"rule" ) ==0 ) && + (strcmp (tokens[5 ],"add" ) ==0 ) && + (strcmp (tokens[6 ],"bulk" ) ==0 )) { +cmd_pipeline_table_rule_add_bulk (tokens, + n_tokens, out, out_size); +return ; + } + +if ((n_tokens >=7 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"rule" ) ==0 ) && (strcmp (tokens[5 ],"delete" ) ==0 ) && (strcmp (tokens[6 ],"match" ) ==0 )) { if ((n_tokens >= 8) &&
@@ -4031,3 +4169,112 @@ cli_script_process(const char *file_name,free (msg_in);return 0 ; } + +static int +cli_rule_file_process (const char *file_name, +size_t line_len_max, +struct table_rule_match *m, +struct table_rule_action *a, +uint32_t *n_rules, +uint32_t *line_number, +char *out, +size_t out_size) +{ +FILE *f =NULL ; +char *line =NULL ; +uint32_t rule_id, line_id; +int status =0 ; + +/* Check input arguments */ +if ((file_name ==NULL ) || + (strlen (file_name) ==0 ) || + (line_len_max ==0 )) { + *line_number =0 ; +return -EINVAL ; + } + +/* Memory allocation */ + line =malloc (line_len_max +1 ); +if (line ==NULL ) { + *line_number =0 ; +return -ENOMEM ; + } + +/* Open file */ + f =fopen (file_name,"r" ); +if (f ==NULL ) { + *line_number =0 ; +free (line); +return -EIO ; + } + +/* Read file */ +for (line_id =1 , rule_id =0 ; rule_id < *n_rules; line_id++) { +char *tokens[CMD_MAX_TOKENS ]; +uint32_t n_tokens, n_tokens_parsed, t0; + +/* Read next line from file. */ +if (fgets (line, line_len_max +1 , f) ==NULL ) +break ; + +/* Comment. */ +if (is_comment (line)) +continue ; + +/* Parse line. */ + n_tokens =RTE_DIM (tokens); + status =parse_tokenize_string (line, tokens, &n_tokens); +if (status) { + status = -EINVAL ; +break ; + } + +/* Empty line. */ +if (n_tokens ==0 ) +continue ; + t0 =0 ; + +/* Rule match. */ + n_tokens_parsed =parse_match (tokens + t0, + n_tokens - t0, + out, + out_size, + &m[rule_id]); +if (n_tokens_parsed ==0 ) { + status = -EINVAL ; +break ; + } + t0 += n_tokens_parsed; + +/* Rule action. */ + n_tokens_parsed =parse_table_action (tokens + t0, + n_tokens - t0, + out, + out_size, + &a[rule_id]); +if (n_tokens_parsed ==0 ) { + status = -EINVAL ; +break ; + } + t0 += n_tokens_parsed; + +/* Line completed. */ +if (t0 < n_tokens) { + status = -EINVAL ; +break ; + } + +/* Increment rule count */ + rule_id++; + } + +/* Close file */ +fclose (f); + +/* Memory free */ +free (line); + + *n_rules = rule_id; + *line_number = line_id; +return status; +}
examples/ip_pipeline/pipeline.h +8 -0
@@ -303,6 +303,14 @@ pipeline_table_rule_add(const char *pipeline_name, void **data);int +pipeline_table_rule_add_bulk (const char *pipeline_name, +uint32_t table_id, +struct table_rule_match *match, +struct table_rule_action *action, +void **data, +uint32_t *n_rules); + +int pipeline_table_rule_add_default(const char *pipeline_name, uint32_t table_id, struct table_rule_action *action,
examples/ip_pipeline/thread.c +271 -1
322 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 38/49 ip_pipeline: add cli to read pipeline table entry stats
In reply to Jasvinder SinghAdd command to read the pipeline table entry stats.
--- examples/ip_pipeline/cli.c | 22 +++++++++++ examples/ip_pipeline/pipeline.h | 7 ++++ examples/ip_pipeline/thread.c | 85 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+)
examples/ip_pipeline/cli.c +22 -0
@@ -3796,6 +3796,18 @@ cmd_pipeline_table_rule_delete_default(char **tokens, }/** +* pipeline <pipeline_name> table <table_id> rule read stats [clear] +*/ +static void +cmd_pipeline_table_rule_stats_read (char **tokens, + uint32_t n_tokens __rte_unused, +char *out, +size_t out_size) +{ +snprintf (out, out_size,MSG_CMD_UNIMPLEM , tokens[0 ]); +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -4094,6 +4106,16 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=7 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"rule" ) ==0 ) && + (strcmp (tokens[5 ],"read" ) ==0 ) && + (strcmp (tokens[6 ],"stats" ) ==0 )) { +cmd_pipeline_table_rule_stats_read (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +7 -0
@@ -325,4 +325,11 @@ int pipeline_table_rule_delete_default(const char *pipeline_name, uint32_t table_id); +int +pipeline_table_rule_stats_read (const char *pipeline_name, +uint32_t table_id, +void *data, +struct rte_table_action_stats_counters *stats, +int clear); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +85 -0
133 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 39/49 ip_pipeline: add cli to configure meter profile
In reply to Jasvinder SinghAdd commands to configure the traffic meter profile.
--- examples/ip_pipeline/cli.c | 232 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 11 ++ examples/ip_pipeline/thread.c | 146 +++++++++++++++++++++++++ 3 files changed, 389 insertions(+)
examples/ip_pipeline/cli.c +232 -0
@@ -3808,6 +3808,218 @@ cmd_pipeline_table_rule_stats_read(char **tokens, }/** +* pipeline <pipeline_name> table <table_id> meter profile <meter_profile_id> +* add srtcm cir <cir> cbs <cbs> ebs <ebs> +* | trtcm cir <cir> pir <pir> cbs <cbs> pbs <pbs> +*/ +static void +cmd_pipeline_table_meter_profile_add (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct rte_table_action_meter_profile p; +char *pipeline_name; +uint32_t table_id, meter_profile_id; +int status; + +if (n_tokens <9 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"meter" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"meter" ); +return ; + } + +if (strcmp (tokens[5 ],"profile" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"profile" ); +return ; + } + +if (parser_read_uint32 (&meter_profile_id, tokens[6 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"meter_profile_id" ); +return ; + } + +if (strcmp (tokens[7 ],"add" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"add" ); +return ; + } + +if (strcmp (tokens[8 ],"srtcm" ) ==0 ) { +if (n_tokens !=15 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , + tokens[0 ]); +return ; + } + + p.alg =RTE_TABLE_ACTION_METER_SRTCM ; + +if (strcmp (tokens[9 ],"cir" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"cir" ); +return ; + } + +if (parser_read_uint64 (&p.srtcm.cir, tokens[10 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"cir" ); +return ; + } + +if (strcmp (tokens[11 ],"cbs" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"cbs" ); +return ; + } + +if (parser_read_uint64 (&p.srtcm.cbs, tokens[12 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"cbs" ); +return ; + } + +if (strcmp (tokens[13 ],"ebs" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"ebs" ); +return ; + } + +if (parser_read_uint64 (&p.srtcm.ebs, tokens[14 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"ebs" ); +return ; + } + }else if (strcmp (tokens[8 ],"trtcm" ) ==0 ) { +if (n_tokens !=17 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + p.alg =RTE_TABLE_ACTION_METER_TRTCM ; + +if (strcmp (tokens[9 ],"cir" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"cir" ); +return ; + } + +if (parser_read_uint64 (&p.trtcm.cir, tokens[10 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"cir" ); +return ; + } + +if (strcmp (tokens[11 ],"pir" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"pir" ); +return ; + } + +if (parser_read_uint64 (&p.trtcm.pir, tokens[12 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"pir" ); +return ; + } +if (strcmp (tokens[13 ],"cbs" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"cbs" ); +return ; + } + +if (parser_read_uint64 (&p.trtcm.cbs, tokens[14 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"cbs" ); +return ; + } + +if (strcmp (tokens[15 ],"pbs" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"pbs" ); +return ; + } + +if (parser_read_uint64 (&p.trtcm.pbs, tokens[16 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"pbs" ); +return ; + } + }else { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + status =pipeline_table_mtr_profile_add (pipeline_name, + table_id, + meter_profile_id, + &p); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** +* pipeline <pipeline_name> table <table_id> +* meter profile <meter_profile_id> delete +*/ +static void +cmd_pipeline_table_meter_profile_delete (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *pipeline_name; +uint32_t table_id, meter_profile_id; +int status; + +if (n_tokens !=8 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"meter" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"meter" ); +return ; + } + +if (strcmp (tokens[5 ],"profile" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"profile" ); +return ; + } + +if (parser_read_uint32 (&meter_profile_id, tokens[6 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"meter_profile_id" ); +return ; + } + +if (strcmp (tokens[7 ],"delete" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"delete" ); +return ; + } + + status =pipeline_table_mtr_profile_delete (pipeline_name, + table_id, + meter_profile_id); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -4116,6 +4328,26 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=8 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"meter" ) ==0 ) && + (strcmp (tokens[5 ],"profile" ) ==0 ) && + (strcmp (tokens[7 ],"add" ) ==0 )) { +cmd_pipeline_table_meter_profile_add (tokens, n_tokens, + out, out_size); +return ; + } + +if ((n_tokens >=8 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"meter" ) ==0 ) && + (strcmp (tokens[5 ],"profile" ) ==0 ) && + (strcmp (tokens[7 ],"delete" ) ==0 )) { +cmd_pipeline_table_meter_profile_delete (tokens, + n_tokens, out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +11 -0
@@ -332,4 +332,15 @@ pipeline_table_rule_stats_read(const char *pipeline_name,struct rte_table_action_stats_counters *stats, int clear); +int +pipeline_table_mtr_profile_add (const char *pipeline_name, +uint32_t table_id, +uint32_t meter_profile_id, +struct rte_table_action_meter_profile *profile); + +int +pipeline_table_mtr_profile_delete (const char *pipeline_name, +uint32_t table_id, +uint32_t meter_profile_id); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +146 -0
182 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 40/49 ip_pipeline: add cli to read meter stats
In reply to Jasvinder SinghAdd command to read traffic meter stats.
--- examples/ip_pipeline/cli.c | 22 ++++++++++ examples/ip_pipeline/pipeline.h | 8 ++++ examples/ip_pipeline/thread.c | 89 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+)
examples/ip_pipeline/cli.c +22 -0
@@ -4020,6 +4020,18 @@ cmd_pipeline_table_meter_profile_delete(char **tokens, }/** +* pipeline <pipeline_name> table <table_id> rule read meter [clear] +*/ +static void +cmd_pipeline_table_rule_meter_read (char **tokens, + uint32_t n_tokens __rte_unused, +char *out, +size_t out_size) +{ +snprintf (out, out_size,MSG_CMD_UNIMPLEM , tokens[0 ]); +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -4348,6 +4360,16 @@ cli_process(char *in, char *out, size_t out_size) n_tokens, out, out_size);return ; } + +if ((n_tokens >=7 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"rule" ) ==0 ) && + (strcmp (tokens[5 ],"read" ) ==0 ) && + (strcmp (tokens[6 ],"meter" ) ==0 )) { +cmd_pipeline_table_rule_meter_read (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +8 -0
@@ -343,4 +343,12 @@ pipeline_table_mtr_profile_delete(const char *pipeline_name,uint32_t table_id, uint32_t meter_profile_id); +int +pipeline_table_rule_mtr_read (const char *pipeline_name, +uint32_t table_id, +void *data, +uint32_t tc_mask, +struct rte_table_action_mtr_counters *stats, +int clear); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +89 -0
137 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 41/49 ip_pipeline: add cli to update dscp table
In reply to Jasvinder SinghAdd command to update the dscp table for traffic meter and traffic manager.
--- examples/ip_pipeline/cli.c | 154 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 6 ++ examples/ip_pipeline/thread.c | 78 ++++++++++++++++++++ 3 files changed, 238 insertions(+)
examples/ip_pipeline/cli.c +154 -0
@@ -4032,6 +4032,152 @@ cmd_pipeline_table_rule_meter_read(char **tokens, }/** +* pipeline <pipeline_name> table <table_id> dscp <file_name> +* +* File <file_name>: +* - exactly 64 lines +* - line format: <tc_id> <tc_queue_id> <color>, with <color> as: g | y | r +*/ +static int +load_dscp_table (struct rte_table_action_dscp_table *dscp_table, +const char *file_name, +uint32_t *line_number) +{ +FILE *f =NULL ; +uint32_t dscp, l; + +/* Check input arguments */ +if ((dscp_table ==NULL ) || + (file_name ==NULL ) || + (line_number ==NULL )) { +if (line_number) + *line_number =0 ; +return -EINVAL ; + } + +/* Open input file */ + f =fopen (file_name,"r" ); +if (f ==NULL ) { + *line_number =0 ; +return -EINVAL ; + } + +/* Read file */ +for (dscp =0 , l =1 ; ; l++) { +char line[64 ]; +char *tokens[3 ]; +enum rte_meter_color color; +uint32_t tc_id, tc_queue_id, n_tokens =RTE_DIM (tokens); + +if (fgets (line,sizeof (line), f) ==NULL ) +break ; + +if (is_comment (line)) +continue ; + +if (parse_tokenize_string (line, tokens, &n_tokens)) { + *line_number = l; +return -EINVAL ; + } + +if (n_tokens ==0 ) +continue ; + +if ((dscp >=RTE_DIM (dscp_table->entry)) || + (n_tokens !=RTE_DIM (tokens)) || +parser_read_uint32 (&tc_id, tokens[0 ]) || + (tc_id >=RTE_TABLE_ACTION_TC_MAX ) || +parser_read_uint32 (&tc_queue_id, tokens[1 ]) || + (tc_queue_id >=RTE_TABLE_ACTION_TC_QUEUE_MAX ) || + (strlen (tokens[2 ]) !=1 )) { + *line_number = l; +return -EINVAL ; + } + +switch (tokens[2 ][0 ]) { +case 'g' : +case 'G' : + color = e_RTE_METER_GREEN; +break ; + +case 'y' : +case 'Y' : + color = e_RTE_METER_YELLOW; +break ; + +case 'r' : +case 'R' : + color = e_RTE_METER_RED; +break ; + +default : + *line_number = l; +return -EINVAL ; + } + + dscp_table->entry[dscp].tc_id = tc_id; + dscp_table->entry[dscp].tc_queue_id = tc_queue_id; + dscp_table->entry[dscp].color = color; + dscp++; + } + +/* Close file */ +fclose (f); +return 0 ; +} + +static void +cmd_pipeline_table_dscp (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +struct rte_table_action_dscp_table dscp_table; +char *pipeline_name, *file_name; +uint32_t table_id, line_number; +int status; + +if (n_tokens !=6 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + pipeline_name = tokens[1 ]; + +if (strcmp (tokens[2 ],"table" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"port" ); +return ; + } + +if (parser_read_uint32 (&table_id, tokens[3 ]) !=0 ) { +snprintf (out, out_size,MSG_ARG_INVALID ,"table_id" ); +return ; + } + +if (strcmp (tokens[4 ],"dscp" ) !=0 ) { +snprintf (out, out_size,MSG_ARG_NOT_FOUND ,"dscp" ); +return ; + } + + file_name = tokens[5 ]; + + status =load_dscp_table (&dscp_table, file_name, &line_number); +if (status) { +snprintf (out, out_size,MSG_FILE_ERR , file_name, line_number); +return ; + } + + status =pipeline_table_dscp_table_update (pipeline_name, + table_id, +UINT64_MAX , + &dscp_table); +if (status) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -4370,6 +4516,14 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=5 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"dscp" ) ==0 )) { +cmd_pipeline_table_dscp (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +6 -0
@@ -351,4 +351,10 @@ pipeline_table_rule_mtr_read(const char *pipeline_name,struct rte_table_action_mtr_counters *stats, int clear); +int +pipeline_table_dscp_table_update (const char *pipeline_name, +uint32_t table_id, +uint64_t dscp_mask, +struct rte_table_action_dscp_table *dscp_table); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +78 -0
114 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 42/49 ip_pipeline: add cli to read ttl stats
In reply to Jasvinder SinghAdd command to read the ttl stats.
--- examples/ip_pipeline/cli.c | 22 +++++++++++ examples/ip_pipeline/pipeline.h | 7 ++++ examples/ip_pipeline/thread.c | 85 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+)
examples/ip_pipeline/cli.c +22 -0
@@ -4178,6 +4178,18 @@ cmd_pipeline_table_dscp(char **tokens, }/** +* pipeline <pipeline_name> table <table_id> rule read ttl [clear] +*/ +static void +cmd_pipeline_table_rule_ttl_read (char **tokens, + uint32_t n_tokens __rte_unused, +char *out, +size_t out_size) +{ +snprintf (out, out_size,MSG_CMD_UNIMPLEM , tokens[0 ]); +} + +/** * thread <thread_id> pipeline <pipeline_name> enable */ static void
@@ -4524,6 +4536,16 @@ cli_process(char *in, char *out, size_t out_size) out, out_size);return ; } + +if ((n_tokens >=7 ) && + (strcmp (tokens[2 ],"table" ) ==0 ) && + (strcmp (tokens[4 ],"rule" ) ==0 ) && + (strcmp (tokens[5 ],"read" ) ==0 ) && + (strcmp (tokens[6 ],"ttl" ) ==0 )) { +cmd_pipeline_table_rule_ttl_read (tokens, n_tokens, + out, out_size); +return ; + } }if (strcmp (tokens[0 ],"thread" ) ==0 ) {
examples/ip_pipeline/pipeline.h +7 -0
@@ -357,4 +357,11 @@ pipeline_table_dscp_table_update(const char *pipeline_name,uint64_t dscp_mask, struct rte_table_action_dscp_table *dscp_table); +int +pipeline_table_rule_ttl_read (const char *pipeline_name, +uint32_t table_id, +void *data, +struct rte_table_action_ttl_counters *stats, +int clear); +#endif /* _INCLUDE_PIPELINE_H_ */
examples/ip_pipeline/thread.c +85 -0
133 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 43/49 ip_pipeline: add cli for load balance action
In reply to Jasvinder SinghAdd command for load balance action.
--- examples/ip_pipeline/action.c | 11 ++++++ examples/ip_pipeline/action.h | 1 + examples/ip_pipeline/cli.c | 84 ++++++++++++++++++++++++++++++++++++++++- examples/ip_pipeline/pipeline.h | 1 + examples/ip_pipeline/thread.c | 22 +++++++++++ 5 files changed, 118 insertions(+), 1 deletion(-)
examples/ip_pipeline/action.c +11 -0
@@ -177,6 +177,17 @@ table_action_profile_create(const char *name, } } +if (params->action_mask & (1LLU <<RTE_TABLE_ACTION_LB )) { + status =rte_table_action_profile_action_register (ap, +RTE_TABLE_ACTION_LB , + ¶ms->lb); + +if (status) { +rte_table_action_profile_free (ap); +return NULL ; + } + } +if (params->action_mask & (1LLU <<RTE_TABLE_ACTION_MTR )) { status = rte_table_action_profile_action_register(ap, RTE_TABLE_ACTION_MTR,
examples/ip_pipeline/action.h +1 -0
@@ -46,6 +46,7 @@ port_in_action_profile_create(const char *name,struct table_action_profile_params {uint64_t action_mask;struct rte_table_action_common_config common; +struct rte_table_action_lb_config lb;struct rte_table_action_mtr_config mtr;struct rte_table_action_tm_config tm;struct rte_table_action_encap_config encap;
examples/ip_pipeline/cli.c +83 -1
114 lines not on this page · raw message
examples/ip_pipeline/pipeline.h +1 -0
@@ -260,6 +260,7 @@ struct table_rule_match {struct table_rule_action {uint64_t action_mask;struct rte_table_action_fwd_params fwd; +struct rte_table_action_lb_params lb;struct rte_table_action_mtr_params mtr;struct rte_table_action_tm_params tm;struct rte_table_action_encap_params encap;
examples/ip_pipeline/thread.c +22 -0
@@ -2031,6 +2031,18 @@ pipeline_msg_handle_table_rule_add(struct pipeline_data *p, } } +if (action->action_mask & (1LLU <<RTE_TABLE_ACTION_LB )) { + status =rte_table_action_apply (a, + data_in, +RTE_TABLE_ACTION_LB , + &action->lb); + +if (status) { + rsp->status =-1 ; +return rsp; + } + } +if (action->action_mask & (1LLU <<RTE_TABLE_ACTION_MTR )) { status = rte_table_action_apply(a, data_in,
@@ -2243,6 +2255,16 @@ pipeline_msg_handle_table_rule_add_bulk(struct pipeline_data *p, goto fail; } +if (act->action_mask & (1LLU <<RTE_TABLE_ACTION_LB )) { + status =rte_table_action_apply (a, + data_in, +RTE_TABLE_ACTION_LB , + &act->lb); + +if (status) + goto fail; + } +if (act->action_mask & (1LLU <<RTE_TABLE_ACTION_MTR )) { status = rte_table_action_apply(a, data_in,
Signature · 1 line
2.9.3
PATCH v4 44/49 ip_pipeline: add l2fwd example
In reply to Jasvinder SinghThis patch add the configuration file for l2fwd example. It includes commands to build the packet processing stage (pipeline), defining action, add rules to its table, etc.
--- examples/ip_pipeline/examples/l2fwd.cli | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 examples/ip_pipeline/examples/l2fwd.cli
examples/ip_pipeline/examples/l2fwd.cli new file +51 -0
@@ -0,0 +1,51 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2010-2018 Intel Corporation + +; The pipeline below implements a simple pass-through connection between the +; input ports to the output ports, as in this diagram: +; ________________ +; LINK0 RXQ0 --->|................|---> LINK1 TXQ0 +; | | +; LINK1 RXQ0 --->|................|---> LINK0 TXQ0 +; | PIPELINE0 | +; LINK2 RXQ0 --->|................|---> LINK3 TXQ0 +; | | +; LINK3 RXQ0 --->|................|---> LINK2 TXQ0 +; |________________| +; + +mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 + +link LINK0 dev 0000:02:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK1 dev 0000:02:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK2 dev 0000:06:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK3 dev 0000:06:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +pipeline PIPELINE0 period 10 offset_port_id 0 cpu 0 + +pipeline PIPELINE0 port in bsz 32 link LINK0 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK1 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK2 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK3 rxq 0 + +pipeline PIPELINE0 port out bsz 32 link LINK0 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK1 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK2 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK3 txq 0 + +pipeline PIPELINE0 table match stub +pipeline PIPELINE0 table match stub +pipeline PIPELINE0 table match stub +pipeline PIPELINE0 table match stub + +pipeline PIPELINE0 port in 0 table 0 +pipeline PIPELINE0 port in 1 table 1 +pipeline PIPELINE0 port in 2 table 2 +pipeline PIPELINE0 port in 3 table 3 + +thread 1 pipeline PIPELINE0 enable + +pipeline PIPELINE0 table 0 rule add match default action fwd port 1 +pipeline PIPELINE0 table 1 rule add match default action fwd port 0 +pipeline PIPELINE0 table 2 rule add match default action fwd port 3 +pipeline PIPELINE0 table 3 rule add match default action fwd port 2
Signature · 1 line
2.9.3
PATCH v4 45/49 ip_pipeline: add KNI port example
In reply to Jasvinder SinghAdd example to illustrate the pipeline functioning with KNI interface.
--- examples/ip_pipeline/examples/kni.cli | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 examples/ip_pipeline/examples/kni.cli
examples/ip_pipeline/examples/kni.cli new file +69 -0
@@ -0,0 +1,69 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2010-2018 Intel Corporation + +; _______________ ______________________ +; | | KNI0 | | +; LINK0 RXQ0 --->|...............|------->|--+ | +; | | KNI1 | | br0 | +; LINK1 TXQ0 <---|...............|<-------|<-+ | +; | | | Linux Kernel | +; | PIPELINE0 | | Network Stack | +; | | KNI1 | | +; LINK1 RXQ0 --->|...............|------->|--+ | +; | | KNI0 | | br0 | +; LINK0 TXQ0 <---|...............|<-------|<-+ | +; |_______________| |______________________| +; +; Insert Linux kernel KNI module: +; [Linux]$ insmod rte_kni.ko +; +; Configure Linux kernel bridge between KNI0 and KNI1 interfaces: +; [Linux]$ brctl addbr br0 +; [Linux]$ brctl addif br0 KNI0 +; [Linux]$ brctl addif br0 KNI1 +; [Linux]$ ifconfig br0 up +; [Linux]$ ifconfig KNI0 up +; [Linux]$ ifconfig KNI1 up +; +; Monitor packet forwarding performed by Linux kernel between KNI0 and KNI1: +; [Linux]$ tcpdump -i KNI0 +; [Linux]$ tcpdump -i KNI1 + +mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 + +link LINK0 dev 0000:02:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK1 dev 0000:02:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +kni KNI0 link LINK0 mempool MEMPOOL0 +kni KNI1 link LINK1 mempool MEMPOOL0 + +table action profile AP0 ipv4 offset 270 fwd + +pipeline PIPELINE0 period 10 offset_port_id 0 cpu 0 + +pipeline PIPELINE0 port in bsz 32 link LINK0 rxq 0 +pipeline PIPELINE0 port in bsz 32 kni KNI1 +pipeline PIPELINE0 port in bsz 32 link LINK1 rxq 0 +pipeline PIPELINE0 port in bsz 32 kni KNI0 + +pipeline PIPELINE0 port out bsz 32 kni KNI0 +pipeline PIPELINE0 port out bsz 32 link LINK1 txq 0 +pipeline PIPELINE0 port out bsz 32 kni KNI1 +pipeline PIPELINE0 port out bsz 32 link LINK0 txq 0 + +pipeline PIPELINE0 table match stub action AP0 +pipeline PIPELINE0 table match stub action AP0 +pipeline PIPELINE0 table match stub action AP0 +pipeline PIPELINE0 table match stub action AP0 + +pipeline PIPELINE0 port in 0 table 0 +pipeline PIPELINE0 port in 1 table 1 +pipeline PIPELINE0 port in 2 table 2 +pipeline PIPELINE0 port in 3 table 3 + +thread 1 pipeline PIPELINE0 enable + +pipeline PIPELINE0 table 0 rule add match default action fwd port 0 +pipeline PIPELINE0 table 1 rule add match default action fwd port 1 +pipeline PIPELINE0 table 2 rule add match default action fwd port 2 +pipeline PIPELINE0 table 3 rule add match default action fwd port 3
Signature · 1 line
2.9.3
PATCH v4 46/49 ip_pipeline: add TAP port example
In reply to Jasvinder SinghAdd example to illustrate the pipeline functioning with TAP interface.
--- examples/ip_pipeline/examples/tap.cli | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 examples/ip_pipeline/examples/tap.cli
examples/ip_pipeline/examples/tap.cli new file +66 -0
@@ -0,0 +1,66 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2010-2018 Intel Corporation + +; _______________ ______________________ +; | | TAP0 | | +; LINK0 RXQ0 --->|...............|------->|--+ | +; | | TAP1 | | br0 | +; LINK1 TXQ0 <---|...............|<-------|<-+ | +; | | | Linux Kernel | +; | PIPELINE0 | | Network Stack | +; | | TAP1 | | +; LINK1 RXQ0 --->|...............|------->|--+ | +; | | TAP0 | | br0 | +; LINK0 TXQ0 <---|...............|<-------|<-+ | +; |_______________| |______________________| +; +; Configure Linux kernel bridge between TAP0 and TAP1 interfaces: +; [Linux]$ brctl addbr br0 +; [Linux]$ brctl addif br0 TAP0 +; [Linux]$ brctl addif br0 TAP1 +; [Linux]$ ifconfig TAP0 up +; [Linux]$ ifconfig TAP1 up +; [Linux]$ ifconfig br0 up +; +; Monitor packet forwarding performed by Linux kernel between TAP0 and TAP1: +; [Linux]$ tcpdump -i TAP0 +; [Linux]$ tcpdump -i TAP1 + +mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 + +link LINK0 dev 0000:02:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK1 dev 0000:02:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +tap TAP0 +tap TAP1 + +table action profile AP0 ipv4 offset 270 fwd + +pipeline PIPELINE0 period 10 offset_port_id 0 cpu 0 + +pipeline PIPELINE0 port in bsz 32 link LINK0 rxq 0 +pipeline PIPELINE0 port in bsz 32 tap TAP1 mempool MEMPOOL0 mtu 1500 +pipeline PIPELINE0 port in bsz 32 link LINK1 rxq 0 +pipeline PIPELINE0 port in bsz 32 tap TAP0 mempool MEMPOOL0 mtu 1500 + +pipeline PIPELINE0 port out bsz 32 tap TAP0 +pipeline PIPELINE0 port out bsz 32 link LINK1 txq 0 +pipeline PIPELINE0 port out bsz 32 tap TAP1 +pipeline PIPELINE0 port out bsz 32 link LINK0 txq 0 + +pipeline PIPELINE0 table match stub action AP0 +pipeline PIPELINE0 table match stub action AP0 +pipeline PIPELINE0 table match stub action AP0 +pipeline PIPELINE0 table match stub action AP0 + +pipeline PIPELINE0 port in 0 table 0 +pipeline PIPELINE0 port in 1 table 1 +pipeline PIPELINE0 port in 2 table 2 +pipeline PIPELINE0 port in 3 table 3 + +thread 1 pipeline PIPELINE0 enable + +pipeline PIPELINE0 table 0 rule add match default action fwd port 0 +pipeline PIPELINE0 table 1 rule add match default action fwd port 1 +pipeline PIPELINE0 table 2 rule add match default action fwd port 2 +pipeline PIPELINE0 table 3 rule add match default action fwd port 3
Signature · 1 line
2.9.3
PATCH v4 47/49 ip_pipeline: add route example
In reply to Jasvinder SinghAdd example to built pipeline with LPM table to demonstrate layer 3 routing.
--- examples/ip_pipeline/examples/route.cli | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 examples/ip_pipeline/examples/route.cli
examples/ip_pipeline/examples/route.cli new file +60 -0
@@ -0,0 +1,60 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2010-2018 Intel Corporation + +; _______________ +; LINK0 RXQ0 --->| |---> LINK0 TXQ0 +; | | +; LINK1 RXQ0 --->| |---> LINK1 TXQ0 +; | Routing | +; LINK2 RXQ0 --->| |---> LINK2 TXQ0 +; | | +; LINK3 RXQ0 --->| |---> LINK3 TXQ0 +; |_______________| +; | +; +-----------> SINK0 (route miss) +; +; Input packet: Ethernet/IPv4 +; +; Packet buffer layout: +; # Field Name Offset (Bytes) Size (Bytes) +; 0 Mbuf 0 128 +; 1 Headroom 128 128 +; 2 Ethernet header 256 14 +; 3 IPv4 header 270 20 + +mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 + +link LINK0 dev 0000:02:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK1 dev 0000:02:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK2 dev 0000:06:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK3 dev 0000:06:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +table action profile AP0 ipv4 offset 270 fwd encap ether + +pipeline PIPELINE0 period 10 offset_port_id 0 cpu 0 + +pipeline PIPELINE0 port in bsz 32 link LINK0 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK1 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK2 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK3 rxq 0 + +pipeline PIPELINE0 port out bsz 32 link LINK0 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK1 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK2 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK3 txq 0 +pipeline PIPELINE0 port out bsz 32 sink + +pipeline PIPELINE0 table match lpm ipv4 offset 286 size 4K action AP0 + +pipeline PIPELINE0 port in 0 table 0 +pipeline PIPELINE0 port in 1 table 0 +pipeline PIPELINE0 port in 2 table 0 +pipeline PIPELINE0 port in 3 table 0 + +thread 1 pipeline PIPELINE0 enable + +pipeline PIPELINE0 table 0 rule add match default action fwd port 4 +pipeline PIPELINE0 table 0 rule add match lpm ipv4 100.0.0.0 10 action fwd port 0 encap ether a0:a1:a2:a3:a4:a5 00:01:02:03:04:05 +pipeline PIPELINE0 table 0 rule add match lpm ipv4 100.64.0.0 10 action fwd port 1 encap ether b0:b1:b2:b3:b4:b5 10:11:12:13:14:15 +pipeline PIPELINE0 table 0 rule add match lpm ipv4 100.128.0.0 10 action fwd port 2 encap ether c0:c1:c2:c3:c4:c5 20:21:22:23:24:25 +pipeline PIPELINE0 table 0 rule add match lpm ipv4 100.192.0.0 10 action fwd port 3 encap ether d0:d1:d2:d3:d4:d5 30:31:32:33:34:35
Signature · 1 line
2.9.3
PATCH v4 48/49 ip_pipeline: add firewall example
In reply to Jasvinder SinghAdd example to built pipeline with ACL table to demonstrate the firewall operation.
--- examples/ip_pipeline/examples/firewall.cli | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 examples/ip_pipeline/examples/firewall.cli
examples/ip_pipeline/examples/firewall.cli new file +59 -0
@@ -0,0 +1,59 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2010-2018 Intel Corporation + +; _______________ +; LINK0 RXQ0 --->| |---> LINK0 TXQ0 +; | | +; LINK1 RXQ0 --->| |---> LINK1 TXQ0 +; | Firewall | +; LINK2 RXQ0 --->| |---> LINK2 TXQ0 +; | | +; LINK3 RXQ0 --->| |---> LINK3 TXQ0 +; |_______________| +; | +; -+- +; +; Input packet: Ethernet/IPv4 +; +; Packet buffer layout: +; # Field Name Offset (Bytes) Size (Bytes) +; 0 Mbuf 0 128 +; 1 Headroom 128 128 +; 2 Ethernet header 256 14 +; 3 IPv4 header 270 20 + +mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 + +link LINK0 dev 0000:02:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK1 dev 0000:02:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK2 dev 0000:06:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK3 dev 0000:06:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +table action profile AP0 ipv4 offset 270 fwd + +pipeline PIPELINE0 period 10 offset_port_id 0 cpu 0 + +pipeline PIPELINE0 port in bsz 32 link LINK0 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK1 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK2 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK3 rxq 0 + +pipeline PIPELINE0 port out bsz 32 link LINK0 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK1 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK2 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK3 txq 0 + +pipeline PIPELINE0 table match acl ipv4 offset 270 size 4K action AP0 + +pipeline PIPELINE0 port in 0 table 0 +pipeline PIPELINE0 port in 1 table 0 +pipeline PIPELINE0 port in 2 table 0 +pipeline PIPELINE0 port in 3 table 0 + +thread 1 pipeline PIPELINE0 enable + +pipeline PIPELINE0 table 0 rule add match default action fwd drop +pipeline PIPELINE0 table 0 rule add match acl priority 0 ipv4 0.0.0.0 0 100.0.0.0 10 0 65535 0 65535 6 action fwd port 0 +pipeline PIPELINE0 table 0 rule add match acl priority 0 ipv4 0.0.0.0 0 100.64.0.0 10 0 65535 0 65535 6 action fwd port 1 +pipeline PIPELINE0 table 0 rule add match acl priority 0 ipv4 0.0.0.0 0 100.128.0.0 10 0 65535 0 65535 6 action fwd port 2 +pipeline PIPELINE0 table 0 rule add match acl priority 0 ipv4 0.0.0.0 0 100.192.0.0 10 0 65535 0 65535 6 action fwd port 3
Signature · 1 line
2.9.3
PATCH v4 49/49 ip_pipeline: add flow classification example
In reply to Jasvinder SinghAdd example to build pipeline with hash table to classify the ingress traffic.
--- examples/ip_pipeline/examples/flow.cli | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 examples/ip_pipeline/examples/flow.cli
examples/ip_pipeline/examples/flow.cli new file +60 -0
@@ -0,0 +1,60 @@ +; SPDX-License-Identifier: BSD-3-Clause +; Copyright(c) 2010-2018 Intel Corporation + +; ________________ +; LINK0 RXQ0 --->| |---> LINK0 TXQ0 +; | | +; LINK1 RXQ0 --->| |---> LINK1 TXQ0 +; | Flow | +; LINK2 RXQ0 --->| Classification |---> LINK2 TXQ0 +; | | +; LINK3 RXQ0 --->| |---> LINK3 TXQ0 +; |________________| +; | +; +-----------> SINK0 (flow lookup miss) +; +; Input packet: Ethernet/IPv4 +; +; Packet buffer layout: +; # Field Name Offset (Bytes) Size (Bytes) +; 0 Mbuf 0 128 +; 1 Headroom 128 128 +; 2 Ethernet header 256 14 +; 3 IPv4 header 270 20 + +mempool MEMPOOL0 buffer 2304 pool 32K cache 256 cpu 0 + +link LINK0 dev 0000:02:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK1 dev 0000:02:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK2 dev 0000:06:00.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on +link LINK3 dev 0000:06:00.1 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on + +table action profile AP0 ipv4 offset 270 fwd + +pipeline PIPELINE0 period 10 offset_port_id 0 cpu 0 + +pipeline PIPELINE0 port in bsz 32 link LINK0 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK1 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK2 rxq 0 +pipeline PIPELINE0 port in bsz 32 link LINK3 rxq 0 + +pipeline PIPELINE0 port out bsz 32 link LINK0 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK1 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK2 txq 0 +pipeline PIPELINE0 port out bsz 32 link LINK3 txq 0 +pipeline PIPELINE0 port out bsz 32 sink + +pipeline PIPELINE0 table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 65K action AP0 + +pipeline PIPELINE0 port in 0 table 0 +pipeline PIPELINE0 port in 1 table 0 +pipeline PIPELINE0 port in 2 table 0 +pipeline PIPELINE0 port in 3 table 0 + +thread 1 pipeline PIPELINE0 enable + +pipeline PIPELINE0 table 0 rule add match default action fwd port 4 +pipeline PIPELINE0 table 0 rule add match hash ipv4_5tuple 100.0.0.10 200.0.0.10 100 200 6 action fwd port 0 +pipeline PIPELINE0 table 0 rule add match hash ipv4_5tuple 100.0.0.11 200.0.0.11 101 201 6 action fwd port 1 +pipeline PIPELINE0 table 0 rule add match hash ipv4_5tuple 100.0.0.12 200.0.0.12 102 202 6 action fwd port 2 +pipeline PIPELINE0 table 0 rule add match hash ipv4_5tuple 100.0.0.13 200.0.0.13 103 203 6 action fwd port 3
Signature · 1 line
2.9.3
Dumitrescu, Cristian
AppliedQuoted 9 lines
-----Original Message-----
From: Singh, Jasvinder
Sent: Thursday, March 29, 2018 7:31 PM
To: [email protected]
Cc: Dumitrescu, Cristian <[email protected]>
Subject: [PATCH v4 00/49]ip_pipeline: refactoring
Quoted 4 lines
Refactored the IP pipeline application. As result, the code base size (lines of code) reduces by ~60%.
v4:
Applied to next-pipeline tree, thanks!
PATCH v3 2/44 pipeline: get pipeline table action params
In reply to Jasvinder SinghAdd API to specify action related parameters such as action handler, table entry data size, etc. for the pipeline table.
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 130 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 14 +++ 3 files changed, 145 insertions(+)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -56,5 +56,6 @@ EXPERIMENTAL { rte_table_action_profile_create; rte_table_action_profile_free; rte_table_action_profile_freeze; + rte_table_action_table_params_get; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +130 -0
136 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +14 -0
@@ -194,6 +194,20 @@ int __rte_experimental rte_table_action_free(struct rte_table_action *action);/** +* Table action table params get. +* +* @param[in] action +* Handle to table action object (needs to be valid). +* @param[inout] params +* Pipeline table parameters (needs to be pre-allocated). +* @return +* Zero on success, non-zero error code otherwise. +*/ +int __rte_experimental +rte_table_action_table_params_get (struct rte_table_action *action, +struct rte_pipeline_table_params *params); + +/** * Table action apply. * * @param[in] action
Signature · 1 line
2.9.3
PATCH v3 3/44 pipeline: add traffic metering action
In reply to Jasvinder SinghAdd traffic metering action implementation.
--- lib/librte_pipeline/Makefile | 3 +- lib/librte_pipeline/meson.build | 2 +- lib/librte_pipeline/rte_pipeline_version.map | 4 + lib/librte_pipeline/rte_table_action.c | 640 ++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 248 +++++++++++ 5 files changed, 879 insertions(+), 18 deletions(-)
lib/librte_pipeline/Makefile +2 -1
@@ -8,10 +8,11 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pipeline.a +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_table -LDLIBS += -lrte_port +LDLIBS += -lrte_port -lrte_meter EXPORT_MAP := rte_pipeline_version.map
lib/librte_pipeline/meson.build +1 -1
@@ -5,4 +5,4 @@ version = 3 allow_experimental_apis = true sources = files('rte_pipeline.c', 'rte_table_action.c') headers = files('rte_pipeline.h', 'rte_table_action.h') -deps += ['port', 'table'] +deps += ['port', 'table', 'meter']
lib/librte_pipeline/rte_pipeline_version.map +4 -0
@@ -51,7 +51,11 @@ EXPERIMENTAL { rte_table_action_apply; rte_table_action_create; + rte_table_action_dscp_table_update; rte_table_action_free; + rte_table_action_meter_profile_add; + rte_table_action_meter_profile_delete; + rte_table_action_meter_read; rte_table_action_profile_action_register; rte_table_action_profile_create; rte_table_action_profile_free;
lib/librte_pipeline/rte_table_action.c +624 -16
741 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +248 -0
272 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 4/44 pipeline: add traffic manager action
In reply to Jasvinder SinghAdd implementation of traffic manager action.
--- lib/librte_pipeline/Makefile | 2 +- lib/librte_pipeline/meson.build | 2 +- lib/librte_pipeline/rte_table_action.c | 130 ++++++++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 24 ++++++ 4 files changed, 155 insertions(+), 3 deletions(-)
lib/librte_pipeline/Makefile +1 -1
@@ -12,7 +12,7 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_table -LDLIBS += -lrte_port -lrte_meter +LDLIBS += -lrte_port -lrte_meter -lrte_sched EXPORT_MAP := rte_pipeline_version.map
lib/librte_pipeline/meson.build +1 -1
@@ -5,4 +5,4 @@ version = 3 allow_experimental_apis = true sources = files('rte_pipeline.c', 'rte_table_action.c') headers = files('rte_pipeline.h', 'rte_table_action.h') -deps += ['port', 'table', 'meter'] +deps += ['port', 'table', 'meter', 'sched']
lib/librte_pipeline/rte_table_action.c +129 -1
196 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +24 -0
@@ -70,6 +70,9 @@ enum rte_table_action_type {/** Traffic Metering and Policing. */ RTE_TABLE_ACTION_MTR , + +/** Traffic Management. */ + RTE_TABLE_ACTION_TM, };/** Common action configuration (per table action profile). */
@@ -256,6 +259,27 @@ struct rte_table_action_mtr_counters { };/** +* RTE_TABLE_ACTION_TM +*/ +/** Traffic management action configuration (per table action profile). */ +struct rte_table_action_tm_config { +/** Number of subports per port. */ +uint32_t n_subports_per_port; + +/** Number of pipes per subport. */ +uint32_t n_pipes_per_subport; +}; + +/** Traffic management action parameters (per table rule). */ +struct rte_table_action_tm_params { +/** Subport ID. */ +uint32_t subport_id; + +/** Pipe ID. */ +uint32_t pipe_id; +}; + +/** * Table action profile. */ struct rte_table_action_profile ;
Signature · 1 line
2.9.3
PATCH v3 5/44 pipeline: add packet encapsulation action
In reply to Jasvinder SinghAdd implementation of different type of packet encap such as vlan, qinq, mpls, pppoe, etc.
--- lib/librte_pipeline/rte_table_action.c | 440 ++++++++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 129 ++++++++++ 2 files changed, 568 insertions(+), 1 deletion(-)
lib/librte_pipeline/rte_table_action.c +439 -1
@@ -9,8 +9,12 @@#include <rte_byteorder.h> #include <rte_cycles.h> #include <rte_malloc.h> +#include <rte_memcpy.h> +#include <rte_ether.h> #include <rte_ip.h> - +#include <rte_esp.h> +#include <rte_tcp.h> +#include <rte_udp.h> #include "rte_table_action.h"
@@ -366,6 +370,369 @@ pkt_work_tm(struct rte_mbuf *mbuf, }/** +* RTE_TABLE_ACTION_ENCAP +*/ +static int +encap_valid (enum rte_table_action_encap_type encap) +{ +switch (encap) { +case RTE_TABLE_ACTION_ENCAP_ETHER : +case RTE_TABLE_ACTION_ENCAP_VLAN : +case RTE_TABLE_ACTION_ENCAP_QINQ : +case RTE_TABLE_ACTION_ENCAP_MPLS : +case RTE_TABLE_ACTION_ENCAP_PPPOE : +return 1 ; +default : +return 0 ; + } +} + +static int +encap_cfg_check (struct rte_table_action_encap_config *encap) +{ +if ((encap->encap_mask ==0 ) || + (__builtin_popcountll (encap->encap_mask) !=1 )) +return -ENOTSUP ; + +return 0 ; +} + +struct encap_ether_data { +struct ether_hdr ether; +} __attribute__((__packed__ )); + +#define VLAN (pcp, dei, vid) \ + ((uint16_t)((((uint64_t)(pcp)) & 0x7LLU) << 13) | \ + ((((uint64_t)(dei)) & 0x1LLU) << 12) | \ + (((uint64_t)(vid)) & 0xFFFLLU)) \ + +struct encap_vlan_data { +struct ether_hdr ether; +struct vlan_hdr vlan; +} __attribute__((__packed__ )); + +struct encap_qinq_data { +struct ether_hdr ether; +struct vlan_hdr svlan; +struct vlan_hdr cvlan; +} __attribute__((__packed__ )); + +#define ETHER_TYPE_MPLS_UNICAST 0x8847 + +#define ETHER_TYPE_MPLS_MULTICAST 0x8848 + +#define MPLS (label, tc, s, ttl) \ + ((uint32_t)(((((uint64_t)(label)) & 0xFFFFFLLU) << 12) |\ + ((((uint64_t)(tc)) & 0x7LLU) << 9) | \ + ((((uint64_t)(s)) & 0x1LLU) << 8) | \ + (((uint64_t)(ttl)) & 0xFFLLU))) + +struct encap_mpls_data { +struct ether_hdr ether; +uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX ]; +uint32_t mpls_count; +} __attribute__((__packed__ )); + +#define ETHER_TYPE_PPPOE_SESSION 0x8864 + +#define PPP_PROTOCOL_IP 0x0021 + +struct pppoe_ppp_hdr { +uint16_t ver_type_code; +uint16_t session_id; +uint16_t length; +uint16_t protocol; +} __attribute__((__packed__ )); + +struct encap_pppoe_data { +struct ether_hdr ether; +struct pppoe_ppp_hdr pppoe_ppp; +} __attribute__((__packed__ )); + +static size_t +encap_data_size (struct rte_table_action_encap_config *encap) +{ +switch (encap->encap_mask) { +case 1LLU <<RTE_TABLE_ACTION_ENCAP_ETHER : +return sizeof (struct encap_ether_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_VLAN : +return sizeof (struct encap_vlan_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_QINQ : +return sizeof (struct encap_qinq_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_MPLS : +return sizeof (struct encap_mpls_data ); + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_PPPOE : +return sizeof (struct encap_pppoe_data ); + +default : +return 0 ; + } +} + +static int +encap_apply_check (struct rte_table_action_encap_params *p, +struct rte_table_action_encap_config *cfg) +{ +if ((encap_valid (p->type) ==0 ) || + ((cfg->encap_mask & (1LLU << p->type)) ==0 )) +return -EINVAL ; + +switch (p->type) { +case RTE_TABLE_ACTION_ENCAP_ETHER : +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_VLAN : +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_QINQ : +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_MPLS : +if ((p->mpls.mpls_count ==0 ) || + (p->mpls.mpls_count >RTE_TABLE_ACTION_MPLS_LABELS_MAX )) +return -EINVAL ; + +return 0 ; + +case RTE_TABLE_ACTION_ENCAP_PPPOE : +return 0 ; + +default : +return -EINVAL ; + } +} + +static int +encap_ether_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_common_config *common_cfg) +{ +struct encap_ether_data *d = data; +uint16_t ethertype = (common_cfg->ip_version) ? + ETHER_TYPE_IPv4 : + ETHER_TYPE_IPv6; + +/* Ethernet */ +ether_addr_copy (&p->ether.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->ether.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ethertype); + +return 0 ; +} + +static int +encap_vlan_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_common_config *common_cfg) +{ +struct encap_vlan_data *d = data; +uint16_t ethertype = (common_cfg->ip_version) ? + ETHER_TYPE_IPv4 : + ETHER_TYPE_IPv6; + +/* Ethernet */ +ether_addr_copy (&p->vlan.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->vlan.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ETHER_TYPE_VLAN ); + +/* VLAN */ + d->vlan.vlan_tci =rte_htons (VLAN (p->vlan.vlan.pcp, + p->vlan.vlan.dei, + p->vlan.vlan.vid)); + d->vlan.eth_proto =rte_htons (ethertype); + +return 0 ; +} + +static int +encap_qinq_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_common_config *common_cfg) +{ +struct encap_qinq_data *d = data; +uint16_t ethertype = (common_cfg->ip_version) ? + ETHER_TYPE_IPv4 : + ETHER_TYPE_IPv6; + +/* Ethernet */ +ether_addr_copy (&p->qinq.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->qinq.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ETHER_TYPE_QINQ ); + +/* SVLAN */ + d->svlan.vlan_tci =rte_htons (VLAN (p->qinq.svlan.pcp, + p->qinq.svlan.dei, + p->qinq.svlan.vid)); + d->svlan.eth_proto =rte_htons (ETHER_TYPE_VLAN ); + +/* CVLAN */ + d->cvlan.vlan_tci =rte_htons (VLAN (p->qinq.cvlan.pcp, + p->qinq.cvlan.dei, + p->qinq.cvlan.vid)); + d->cvlan.eth_proto =rte_htons (ethertype); + +return 0 ; +} + +static int +encap_mpls_apply (void *data, +struct rte_table_action_encap_params *p) +{ +struct encap_mpls_data *d = data; +uint16_t ethertype = (p->mpls.unicast) ? +ETHER_TYPE_MPLS_UNICAST : +ETHER_TYPE_MPLS_MULTICAST ; +uint32_t i; + +/* Ethernet */ +ether_addr_copy (&p->mpls.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->mpls.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ethertype); + +/* MPLS */ +for (i =0 ; i < p->mpls.mpls_count -1 ; i++) + d->mpls[i] =rte_htonl (MPLS (p->mpls.mpls[i].label, + p->mpls.mpls[i].tc, +0 , + p->mpls.mpls[i].ttl)); + + d->mpls[i] =rte_htonl (MPLS (p->mpls.mpls[i].label, + p->mpls.mpls[i].tc, +1 , + p->mpls.mpls[i].ttl)); + + d->mpls_count = p->mpls.mpls_count; +return 0 ; +} + +static int +encap_pppoe_apply (void *data, +struct rte_table_action_encap_params *p) +{ +struct encap_pppoe_data *d = data; + +/* Ethernet */ +ether_addr_copy (&p->pppoe.ether.da, &d->ether.d_addr); +ether_addr_copy (&p->pppoe.ether.sa, &d->ether.s_addr); + d->ether.ether_type =rte_htons (ETHER_TYPE_PPPOE_SESSION ); + +/* PPPoE and PPP*/ + d->pppoe_ppp.ver_type_code =rte_htons (0x1100 ); + d->pppoe_ppp.session_id =rte_htons (p->pppoe.pppoe.session_id); + d->pppoe_ppp.length =0 ;/* not pre-computed */ + d->pppoe_ppp.protocol =rte_htons (PPP_PROTOCOL_IP ); + +return 0 ; +} + +static int +encap_apply (void *data, +struct rte_table_action_encap_params *p, +struct rte_table_action_encap_config *cfg, +struct rte_table_action_common_config *common_cfg) +{ +int status; + +/* Check input arguments */ + status =encap_apply_check (p, cfg); +if (status) +return status; + +switch (p->type) { +case RTE_TABLE_ACTION_ENCAP_ETHER : +return encap_ether_apply (data, p, common_cfg); + +case RTE_TABLE_ACTION_ENCAP_VLAN : +return encap_vlan_apply (data, p, common_cfg); + +case RTE_TABLE_ACTION_ENCAP_QINQ : +return encap_qinq_apply (data, p, common_cfg); + +case RTE_TABLE_ACTION_ENCAP_MPLS : +return encap_mpls_apply (data, p); + +case RTE_TABLE_ACTION_ENCAP_PPPOE : +return encap_pppoe_apply (data, p); + +default : +return -EINVAL ; + } +} + +static __rte_always_inline void * +encap (void *dst,const void *src,size_t n) +{ + dst = ((uint8_t *) dst) - n; +return rte_memcpy (dst, src, n); +} + +static __rte_always_inline void +pkt_work_encap (struct rte_mbuf *mbuf, +void *data, +struct rte_table_action_encap_config *cfg, +void *ip, +uint16_t total_length, +uint32_t ip_offset) +{ +switch (cfg->encap_mask) { +case 1LLU <<RTE_TABLE_ACTION_ENCAP_ETHER : +encap (ip, data,sizeof (struct encap_ether_data )); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_ether_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_ether_data ); +break ; + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_VLAN : +encap (ip, data,sizeof (struct encap_vlan_data )); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_vlan_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_vlan_data ); +break ; + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_QINQ : +encap (ip, data,sizeof (struct encap_qinq_data )); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_qinq_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_qinq_data ); +break ; + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_MPLS : + { +struct encap_mpls_data *mpls = data; +size_t size =sizeof (struct ether_hdr ) + + mpls->mpls_count *4 ; + +encap (ip, data, size); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + size); + mbuf->pkt_len = mbuf->data_len = total_length + size; +break ; + } + +case 1LLU <<RTE_TABLE_ACTION_ENCAP_PPPOE : + { +struct encap_pppoe_data *pppoe = +encap (ip, data,sizeof (struct encap_pppoe_data )); + pppoe->pppoe_ppp.length =rte_htons (total_length +2 ); + mbuf->data_off = ip_offset - (sizeof (struct rte_mbuf ) + +sizeof (struct encap_pppoe_data )); + mbuf->pkt_len = mbuf->data_len = total_length + +sizeof (struct encap_pppoe_data ); +break ; + } + +default : +break ; + } +} + +/** * Action profile */ static int
@@ -375,6 +742,7 @@ action_valid(enum rte_table_action_type action)case RTE_TABLE_ACTION_FWD :case RTE_TABLE_ACTION_MTR :case RTE_TABLE_ACTION_TM : +case RTE_TABLE_ACTION_ENCAP :return 1 ;default :return 0 ;
@@ -389,6 +757,7 @@ struct ap_config {struct rte_table_action_common_config common;struct rte_table_action_mtr_config mtr;struct rte_table_action_tm_config tm; +struct rte_table_action_encap_config encap; }; static size_t
@@ -399,6 +768,8 @@ action_cfg_size(enum rte_table_action_type action)return sizeof (struct rte_table_action_mtr_config );case RTE_TABLE_ACTION_TM :return sizeof (struct rte_table_action_tm_config ); +case RTE_TABLE_ACTION_ENCAP : +return sizeof (struct rte_table_action_encap_config );default :return 0 ; }
@@ -415,6 +786,9 @@ action_cfg_get(struct ap_config *ap_config,case RTE_TABLE_ACTION_TM :return &ap_config->tm; +case RTE_TABLE_ACTION_ENCAP : +return &ap_config->encap; +default :return NULL ; }
@@ -452,6 +826,9 @@ action_data_size(enum rte_table_action_type action,case RTE_TABLE_ACTION_TM :return sizeof (struct tm_data ); +case RTE_TABLE_ACTION_ENCAP : +return encap_data_size (&ap_config->encap); +default :return 0 ; }
@@ -531,6 +908,10 @@ rte_table_action_profile_action_register(struct rte_table_action_profile *profil status =tm_cfg_check (action_config);break ; +case RTE_TABLE_ACTION_ENCAP : + status =encap_cfg_check (action_config); +break ; +default : status =0 ;break ;
@@ -653,6 +1034,12 @@ rte_table_action_apply(struct rte_table_action *action, action_params, &action->cfg.tm); +case RTE_TABLE_ACTION_ENCAP : +return encap_apply (action_data, + action_params, + &action->cfg.encap, + &action->cfg.common); +default :return -EINVAL ; }
@@ -870,6 +1257,18 @@ pkt_work(struct rte_mbuf *mbuf, dscp); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_ENCAP )) { +void *data = +action_data_get (table_entry, action,RTE_TABLE_ACTION_ENCAP ); + +pkt_work_encap (mbuf, + data, + &cfg->encap, + ip, + total_length, + ip_offset); + } +return drop_mask; }
@@ -1014,6 +1413,45 @@ pkt4_work(struct rte_mbuf **mbufs, dscp3); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_ENCAP )) { +void *data0 = +action_data_get (table_entry0, action,RTE_TABLE_ACTION_ENCAP ); +void *data1 = +action_data_get (table_entry1, action,RTE_TABLE_ACTION_ENCAP ); +void *data2 = +action_data_get (table_entry2, action,RTE_TABLE_ACTION_ENCAP ); +void *data3 = +action_data_get (table_entry3, action,RTE_TABLE_ACTION_ENCAP ); + +pkt_work_encap (mbuf0, + data0, + &cfg->encap, + ip0, + total_length0, + ip_offset); + +pkt_work_encap (mbuf1, + data1, + &cfg->encap, + ip1, + total_length1, + ip_offset); + +pkt_work_encap (mbuf2, + data2, + &cfg->encap, + ip2, + total_length2, + ip_offset); + +pkt_work_encap (mbuf3, + data3, + &cfg->encap, + ip3, + total_length3, + ip_offset); + } +return drop_mask0 | (drop_mask1 <<1 ) | (drop_mask2 << 2) |
lib/librte_pipeline/rte_table_action.h +129 -0
147 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 6/44 pipeline: add nat action
In reply to Jasvinder SinghAdd implementation of Network Address Translation(NAT) action.
--- lib/librte_pipeline/rte_table_action.c | 351 +++++++++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 39 ++++ 2 files changed, 390 insertions(+)
lib/librte_pipeline/rte_table_action.c +351 -0
@@ -733,6 +733,304 @@ pkt_work_encap(struct rte_mbuf *mbuf, }/** +* RTE_TABLE_ACTION_NAT +*/ +static int +nat_cfg_check (struct rte_table_action_nat_config *nat) +{ +if ((nat->proto !=0x06 ) && + (nat->proto !=0x11 )) +return -ENOTSUP ; + +return 0 ; +} + +struct nat_ipv4_data { +uint32_t addr; +uint16_t port; +} __attribute__((__packed__ )); + +struct nat_ipv6_data { +uint8_t addr[16 ]; +uint16_t port; +} __attribute__((__packed__ )); + +static size_t +nat_data_size(struct rte_table_action_nat_config *nat __rte_unused, +struct rte_table_action_common_config *common) +{ +int ip_version = common->ip_version; + +return (ip_version) ? +sizeof (struct nat_ipv4_data ) : +sizeof (struct nat_ipv6_data ); +} + +static int +nat_apply_check (struct rte_table_action_nat_params *p, +struct rte_table_action_common_config *cfg) +{ +if ((p->ip_version && (cfg->ip_version ==0 )) || + ((p->ip_version ==0 ) && cfg->ip_version)) +return -EINVAL ; + +return 0 ; +} + +static int +nat_apply (void *data, +struct rte_table_action_nat_params *p, +struct rte_table_action_common_config *cfg) +{ +int status; + +/* Check input arguments */ + status =nat_apply_check (p, cfg); +if (status) +return status; + +/* Apply */ +if (p->ip_version) { +struct nat_ipv4_data *d = data; + + d->addr =rte_htonl (p->addr.ipv4); + d->port =rte_htons (p->port); + }else { +struct nat_ipv6_data *d = data; + +memcpy (d->addr, p->addr.ipv6,sizeof (d->addr)); + d->port =rte_htons (p->port); + } + +return 0 ; +} + +static __rte_always_inline uint16_t +nat_ipv4_checksum_update (uint16_t cksum0, +uint32_t ip0, +uint32_t ip1) +{ +int32_t cksum1; + + cksum1 = cksum0; + cksum1 = ~cksum1 &0xFFFF ; + +/* Subtract ip0 (one's complement logic) */ + cksum1 -= (ip0 >>16 ) + (ip0 &0xFFFF ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +/* Add ip1 (one's complement logic) */ + cksum1 += (ip1 >>16 ) + (ip1 &0xFFFF ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +return (uint16_t )(~cksum1); +} + +static __rte_always_inline uint16_t +nat_ipv4_tcp_udp_checksum_update (uint16_t cksum0, +uint32_t ip0, +uint32_t ip1, +uint16_t port0, +uint16_t port1) +{ +int32_t cksum1; + + cksum1 = cksum0; + cksum1 = ~cksum1 &0xFFFF ; + +/* Subtract ip0 and port 0 (one's complement logic) */ + cksum1 -= (ip0 >>16 ) + (ip0 &0xFFFF ) + port0; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +/* Add ip1 and port1 (one's complement logic) */ + cksum1 += (ip1 >>16 ) + (ip1 &0xFFFF ) + port1; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +return (uint16_t )(~cksum1); +} + +static __rte_always_inline uint16_t +nat_ipv6_tcp_udp_checksum_update (uint16_t cksum0, +uint16_t *ip0, +uint16_t *ip1, +uint16_t port0, +uint16_t port1) +{ +int32_t cksum1; + + cksum1 = cksum0; + cksum1 = ~cksum1 &0xFFFF ; + +/* Subtract ip0 and port 0 (one's complement logic) */ + cksum1 -= ip0[0 ] + ip0[1 ] + ip0[2 ] + ip0[3 ] + + ip0[4 ] + ip0[5 ] + ip0[6 ] + ip0[7 ] + port0; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +/* Add ip1 and port1 (one's complement logic) */ + cksum1 += ip1[0 ] + ip1[1 ] + ip1[2 ] + ip1[3 ] + + ip1[4 ] + ip1[5 ] + ip1[6 ] + ip1[7 ] + port1; + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + cksum1 = (cksum1 &0xFFFF ) + (cksum1 >>16 ); + +return (uint16_t )(~cksum1); +} + +static __rte_always_inline void +pkt_ipv4_work_nat (struct ipv4_hdr *ip, +struct nat_ipv4_data *data, +struct rte_table_action_nat_config *cfg) +{ +if (cfg->source_nat) { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t ip_cksum, tcp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->src_addr, + data->addr); + + tcp_cksum =nat_ipv4_tcp_udp_checksum_update (tcp->cksum, + ip->src_addr, + data->addr, + tcp->src_port, + data->port); + + ip->src_addr = data->addr; + ip->hdr_checksum = ip_cksum; + tcp->src_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t ip_cksum, udp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->src_addr, + data->addr); + + udp_cksum =nat_ipv4_tcp_udp_checksum_update (udp->dgram_cksum, + ip->src_addr, + data->addr, + udp->src_port, + data->port); + + ip->src_addr = data->addr; + ip->hdr_checksum = ip_cksum; + udp->src_port = data->port; +if (udp->dgram_cksum) + udp->dgram_cksum = udp_cksum; + } + }else { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t ip_cksum, tcp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->dst_addr, + data->addr); + + tcp_cksum =nat_ipv4_tcp_udp_checksum_update (tcp->cksum, + ip->dst_addr, + data->addr, + tcp->dst_port, + data->port); + + ip->dst_addr = data->addr; + ip->hdr_checksum = ip_cksum; + tcp->dst_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t ip_cksum, udp_cksum; + + ip_cksum =nat_ipv4_checksum_update (ip->hdr_checksum, + ip->dst_addr, + data->addr); + + udp_cksum =nat_ipv4_tcp_udp_checksum_update (udp->dgram_cksum, + ip->dst_addr, + data->addr, + udp->dst_port, + data->port); + + ip->dst_addr = data->addr; + ip->hdr_checksum = ip_cksum; + udp->dst_port = data->port; +if (udp->dgram_cksum) + udp->dgram_cksum = udp_cksum; + } + } +} + +static __rte_always_inline void +pkt_ipv6_work_nat (struct ipv6_hdr *ip, +struct nat_ipv6_data *data, +struct rte_table_action_nat_config *cfg) +{ +if (cfg->source_nat) { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t tcp_cksum; + + tcp_cksum =nat_ipv6_tcp_udp_checksum_update (tcp->cksum, + (uint16_t *)ip->src_addr, + (uint16_t *)data->addr, + tcp->src_port, + data->port); + +rte_memcpy (ip->src_addr, data->addr,16 ); + tcp->src_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t udp_cksum; + + udp_cksum =nat_ipv6_tcp_udp_checksum_update (udp->dgram_cksum, + (uint16_t *)ip->src_addr, + (uint16_t *)data->addr, + udp->src_port, + data->port); + +rte_memcpy (ip->src_addr, data->addr,16 ); + udp->src_port = data->port; + udp->dgram_cksum = udp_cksum; + } + }else { +if (cfg->proto ==0x6 ) { +struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1 ]; +uint16_t tcp_cksum; + + tcp_cksum =nat_ipv6_tcp_udp_checksum_update (tcp->cksum, + (uint16_t *)ip->dst_addr, + (uint16_t *)data->addr, + tcp->dst_port, + data->port); + +rte_memcpy (ip->dst_addr, data->addr,16 ); + tcp->dst_port = data->port; + tcp->cksum = tcp_cksum; + }else { +struct udp_hdr *udp = (struct udp_hdr *) &ip[1 ]; +uint16_t udp_cksum; + + udp_cksum =nat_ipv6_tcp_udp_checksum_update (udp->dgram_cksum, + (uint16_t *)ip->dst_addr, + (uint16_t *)data->addr, + udp->dst_port, + data->port); + +rte_memcpy (ip->dst_addr, data->addr,16 ); + udp->dst_port = data->port; + udp->dgram_cksum = udp_cksum; + } + } +} + +/** * Action profile */ static int
@@ -743,6 +1041,7 @@ action_valid(enum rte_table_action_type action)case RTE_TABLE_ACTION_MTR :case RTE_TABLE_ACTION_TM :case RTE_TABLE_ACTION_ENCAP : +case RTE_TABLE_ACTION_NAT :return 1 ;default :return 0 ;
@@ -758,6 +1057,7 @@ struct ap_config {struct rte_table_action_mtr_config mtr;struct rte_table_action_tm_config tm;struct rte_table_action_encap_config encap; +struct rte_table_action_nat_config nat; }; static size_t
@@ -770,6 +1070,8 @@ action_cfg_size(enum rte_table_action_type action)return sizeof (struct rte_table_action_tm_config );case RTE_TABLE_ACTION_ENCAP :return sizeof (struct rte_table_action_encap_config ); +case RTE_TABLE_ACTION_NAT : +return sizeof (struct rte_table_action_nat_config );default :return 0 ; }
@@ -789,6 +1091,9 @@ action_cfg_get(struct ap_config *ap_config,case RTE_TABLE_ACTION_ENCAP :return &ap_config->encap; +case RTE_TABLE_ACTION_NAT : +return &ap_config->nat; +default :return NULL ; }
@@ -829,6 +1134,10 @@ action_data_size(enum rte_table_action_type action,case RTE_TABLE_ACTION_ENCAP :return encap_data_size (&ap_config->encap); +case RTE_TABLE_ACTION_NAT : +return nat_data_size (&ap_config->nat, + &ap_config->common); +default :return 0 ; }
@@ -912,6 +1221,10 @@ rte_table_action_profile_action_register(struct rte_table_action_profile *profil status =encap_cfg_check (action_config);break ; +case RTE_TABLE_ACTION_NAT : + status =nat_cfg_check (action_config); +break ; +default : status =0 ;break ;
@@ -1040,6 +1353,11 @@ rte_table_action_apply(struct rte_table_action *action, &action->cfg.encap, &action->cfg.common); +case RTE_TABLE_ACTION_NAT : +return nat_apply (action_data, + action_params, + &action->cfg.common); +default :return -EINVAL ; }
@@ -1269,6 +1587,16 @@ pkt_work(struct rte_mbuf *mbuf, ip_offset); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_NAT )) { +void *data = +action_data_get (table_entry, action,RTE_TABLE_ACTION_NAT ); + +if (cfg->common.ip_version) +pkt_ipv4_work_nat (ip, data, &cfg->nat); +else +pkt_ipv6_work_nat (ip, data, &cfg->nat); + } +return drop_mask; }
@@ -1452,6 +1780,29 @@ pkt4_work(struct rte_mbuf **mbufs, ip_offset); } +if (cfg->action_mask & (1LLU <<RTE_TABLE_ACTION_NAT )) { +void *data0 = +action_data_get (table_entry0, action,RTE_TABLE_ACTION_NAT ); +void *data1 = +action_data_get (table_entry1, action,RTE_TABLE_ACTION_NAT ); +void *data2 = +action_data_get (table_entry2, action,RTE_TABLE_ACTION_NAT ); +void *data3 = +action_data_get (table_entry3, action,RTE_TABLE_ACTION_NAT ); + +if (cfg->common.ip_version) { +pkt_ipv4_work_nat (ip0, data0, &cfg->nat); +pkt_ipv4_work_nat (ip1, data1, &cfg->nat); +pkt_ipv4_work_nat (ip2, data2, &cfg->nat); +pkt_ipv4_work_nat (ip3, data3, &cfg->nat); + }else { +pkt_ipv6_work_nat (ip0, data0, &cfg->nat); +pkt_ipv6_work_nat (ip1, data1, &cfg->nat); +pkt_ipv6_work_nat (ip2, data2, &cfg->nat); +pkt_ipv6_work_nat (ip3, data3, &cfg->nat); + } + } +return drop_mask0 | (drop_mask1 <<1 ) | (drop_mask2 << 2) |
lib/librte_pipeline/rte_table_action.h +39 -0
@@ -77,6 +77,9 @@ enum rte_table_action_type {/** Packet encapsulations. */ RTE_TABLE_ACTION_ENCAP , + +/** Network Address Translation (NAT). */ + RTE_TABLE_ACTION_NAT, };/** Common action configuration (per table action profile). */
@@ -409,6 +412,42 @@ struct rte_table_action_encap_params { };/** +* RTE_TABLE_ACTION_NAT +*/ +/** NAT action configuration (per table action profile). */ +struct rte_table_action_nat_config { +/** When non-zero, the IP source address and L4 protocol source port are +* translated. When zero, the IP destination address and L4 protocol +* destination port are translated. +*/ +int source_nat; + +/** Layer 4 protocol, for example TCP (0x06) or UDP (0x11). The checksum +* field is computed differently and placed at different header offset +* by each layer 4 protocol. +*/ +uint8_t proto; +}; + +/** NAT action parameters (per table rule). */ +struct rte_table_action_nat_params { +/** IP version for *addr*: non-zero for IPv4, zero for IPv6. */ +int ip_version; + +/** IP address. */ +union { +/** IPv4 address; only valid when *ip_version* is non-zero. */ +uint32_t ipv4; + +/** IPv6 address; only valid when *ip_version* is set to 0. */ +uint8_t ipv6[16 ]; + } addr; + +/** Port. */ +uint16_t port; +}; + +/** * Table action profile. */ struct rte_table_action_profile ;
Signature · 1 line
2.9.3
PATCH v3 7/44 pipeline: add ttl update action
In reply to Jasvinder SinghAdd implementation of ttl update action.
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 162 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 66 +++++++++++ 3 files changed, 229 insertions(+)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -61,5 +61,6 @@ EXPERIMENTAL { rte_table_action_profile_free; rte_table_action_profile_freeze; rte_table_action_table_params_get; + rte_table_action_ttl_read; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +162 -0
228 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +66 -0
84 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 8/44 pipeline: add statistics read action
In reply to Jasvinder SinghAdd implementation of stats read action
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 111 +++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 78 +++++++++++++++++++ 3 files changed, 190 insertions(+)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -61,6 +61,7 @@ EXPERIMENTAL { rte_table_action_profile_free; rte_table_action_profile_freeze; rte_table_action_table_params_get; + rte_table_action_stats_read; rte_table_action_ttl_read; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +111 -0
177 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +78 -0
96 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 9/44 pipeline: add timestamp action
In reply to Jasvinder SinghAdd implementation of timestamp action.
--- lib/librte_pipeline/rte_pipeline_version.map | 1 + lib/librte_pipeline/rte_table_action.c | 79 +++++++++++++++++++++++++++- lib/librte_pipeline/rte_table_action.h | 31 +++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-)
lib/librte_pipeline/rte_pipeline_version.map +1 -0
@@ -62,6 +62,7 @@ EXPERIMENTAL { rte_table_action_profile_freeze; rte_table_action_table_params_get; rte_table_action_stats_read; + rte_table_action_time_read; rte_table_action_ttl_read; } DPDK_16.04;
lib/librte_pipeline/rte_table_action.c +78 -1
127 lines not on this page · raw message
lib/librte_pipeline/rte_table_action.h +31 -0
@@ -86,6 +86,9 @@ enum rte_table_action_type {/** Statistics. */ RTE_TABLE_ACTION_STATS , + +/** Timestamp. */ + RTE_TABLE_ACTION_TIME, };/** Common action configuration (per table action profile). */
@@ -542,6 +545,15 @@ struct rte_table_action_stats_counters { };/** +* RTE_TABLE_ACTION_TIME +*/ +/** Timestamp action parameters (per table rule). */ +struct rte_table_action_time_params { +/** Initial timestamp value. Typically set to current time. */ +uint64_t time; +}; + +/** * Table action profile. */ struct rte_table_action_profile ;
@@ -815,6 +827,25 @@ rte_table_action_stats_read(struct rte_table_action *action,struct rte_table_action_stats_counters *stats, int clear); +/** +* Table action timestamp read. +* +* @param[in] action +* Handle to table action object (needs to be valid). +* @param[in] data +* Data byte array (typically table rule data) with timestamp action +* previously applied on it. +* @param[inout] timestamp +* Pre-allocated memory where the timestamp read from *data* is saved (has to +* be non-NULL). +* @return +* Zero on success, non-zero error code otherwise. +*/ +int __rte_experimental +rte_table_action_time_read (struct rte_table_action *action, +void *data, +uint64_t *timestamp); + #ifdef __cplusplus }#endif
Signature · 1 line
2.9.3
PATCH v3 10/44 ip_pipeline: remove passthrough pipeline
In reply to Jasvinder Singhremove passthrough pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - .../ip_pipeline/pipeline/pipeline_passthrough.c | 45 - .../ip_pipeline/pipeline/pipeline_passthrough.h | 12 - .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 929 --------------------- .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 44 - 7 files changed, 1036 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -19,8 +19,6 @@ SRCS-y += pipeline_common_be.c SRCS-y += pipeline_common_fe.c SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c -SRCS-y += pipeline_passthrough_be.c -SRCS-y += pipeline_passthrough.c SRCS-y += pipeline_firewall_be.c SRCS-y += pipeline_firewall.c SRCS-y += pipeline_flow_classification_be.c
examples/ip_pipeline/init.c +0 -2
@@ -26,7 +26,6 @@#include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" -#include "pipeline_passthrough.h" #include "pipeline_firewall.h" #include "pipeline_flow_classification.h" #include "pipeline_flow_actions.h"
@@ -1822,7 +1821,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_passthrough);app_pipeline_type_register (app, &pipeline_flow_classification);app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall);
examples/ip_pipeline/meson.build +0 -2
@@ -29,8 +29,6 @@ sources = files( 'pipeline/pipeline_flow_classification.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', - 'pipeline/pipeline_passthrough_be.c', - 'pipeline/pipeline_passthrough.c', 'pipeline/pipeline_routing_be.c', 'pipeline/pipeline_routing.c', )
examples/ip_pipeline/pipeline/pipeline_passthrough.c deleted +0 -45
45 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough.h deleted +0 -12
@@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation -*/ - -#ifndef __INCLUDE_PIPELINE_PASSTHROUGH_H__ -#define __INCLUDE_PIPELINE_PASSTHROUGH_H__ - -#include "pipeline.h" - -extern struct pipeline_type pipeline_passthrough; - -#endif
examples/ip_pipeline/pipeline/pipeline_passthrough_be.c deleted +0 -929
929 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_passthrough_be.h deleted +0 -44
44 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 11/44 ip_pipeline: remove routing pipeline
In reply to Jasvinder SinghRemove routing pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - examples/ip_pipeline/pipeline/pipeline_routing.c | 1613 ---------------- examples/ip_pipeline/pipeline/pipeline_routing.h | 71 - .../ip_pipeline/pipeline/pipeline_routing_be.c | 1966 -------------------- .../ip_pipeline/pipeline/pipeline_routing_be.h | 283 --- 7 files changed, 3939 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -25,8 +25,6 @@ SRCS-y += pipeline_flow_classification_be.c SRCS-y += pipeline_flow_classification.c SRCS-y += pipeline_flow_actions_be.c SRCS-y += pipeline_flow_actions.c -SRCS-y += pipeline_routing_be.c -SRCS-y += pipeline_routing.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/ip_pipeline/init.c +0 -2
@@ -29,7 +29,6 @@#include "pipeline_firewall.h" #include "pipeline_flow_classification.h" #include "pipeline_flow_actions.h" -#include "pipeline_routing.h" #include "thread_fe.h" #define APP_NAME_SIZE 32
@@ -1824,7 +1823,6 @@ int app_init(struct app_params *app)app_pipeline_type_register (app, &pipeline_flow_classification);app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall); -app_pipeline_type_register (app, &pipeline_routing);app_init_pipelines (app);app_init_threads (app);
examples/ip_pipeline/meson.build +0 -2
@@ -29,6 +29,4 @@ sources = files( 'pipeline/pipeline_flow_classification.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', - 'pipeline/pipeline_routing_be.c', - 'pipeline/pipeline_routing.c', )
examples/ip_pipeline/pipeline/pipeline_routing.c deleted +0 -1613
1,613 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_routing.h deleted +0 -71
71 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_routing_be.c deleted +0 -1966
1,288 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_routing_be.h deleted +0 -283
283 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.9.3
Part of the diff is not shown here. View the raw message.
PATCH v3 12/44 ip_pipeline: remove flow classification pipeline
In reply to Jasvinder SinghRemove flow classification pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - .../pipeline/pipeline_flow_classification.c | 1878 -------------------- .../pipeline/pipeline_flow_classification.h | 106 -- .../pipeline/pipeline_flow_classification_be.c | 723 -------- .../pipeline/pipeline_flow_classification_be.h | 113 -- 7 files changed, 2826 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -21,8 +21,6 @@ SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c SRCS-y += pipeline_firewall_be.c SRCS-y += pipeline_firewall.c -SRCS-y += pipeline_flow_classification_be.c -SRCS-y += pipeline_flow_classification.c SRCS-y += pipeline_flow_actions_be.c SRCS-y += pipeline_flow_actions.c
examples/ip_pipeline/init.c +0 -2
@@ -27,7 +27,6 @@#include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_firewall.h" -#include "pipeline_flow_classification.h" #include "pipeline_flow_actions.h" #include "thread_fe.h"
@@ -1820,7 +1819,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_flow_classification);app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall);
examples/ip_pipeline/meson.build +0 -2
@@ -25,8 +25,6 @@ sources = files( 'pipeline/pipeline_firewall.c', 'pipeline/pipeline_flow_actions_be.c', 'pipeline/pipeline_flow_actions.c', - 'pipeline/pipeline_flow_classification_be.c', - 'pipeline/pipeline_flow_classification.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_flow_classification.c deleted +0 -1878
1,878 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_classification.h deleted +0 -106
106 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c deleted +0 -723
723 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h deleted +0 -113
113 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 13/44 ip_pipeline: remove flow actions pipeline
In reply to Jasvinder SinghRemove flow actions pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - .../ip_pipeline/pipeline/pipeline_flow_actions.c | 1286 -------------------- .../ip_pipeline/pipeline/pipeline_flow_actions.h | 60 - .../pipeline/pipeline_flow_actions_be.c | 983 --------------- .../pipeline/pipeline_flow_actions_be.h | 139 --- 7 files changed, 2474 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -21,8 +21,6 @@ SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c SRCS-y += pipeline_firewall_be.c SRCS-y += pipeline_firewall.c -SRCS-y += pipeline_flow_actions_be.c -SRCS-y += pipeline_flow_actions.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/ip_pipeline/init.c +0 -2
@@ -27,7 +27,6 @@#include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_firewall.h" -#include "pipeline_flow_actions.h" #include "thread_fe.h" #define APP_NAME_SIZE 32
@@ -1819,7 +1818,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_flow_actions);app_pipeline_type_register (app, &pipeline_firewall);app_init_pipelines (app);
examples/ip_pipeline/meson.build +0 -2
@@ -23,8 +23,6 @@ sources = files( 'pipeline/pipeline_common_fe.c', 'pipeline/pipeline_firewall_be.c', 'pipeline/pipeline_firewall.c', - 'pipeline/pipeline_flow_actions_be.c', - 'pipeline/pipeline_flow_actions.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_flow_actions.c deleted +0 -1286
1,286 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_actions.h deleted +0 -60
60 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_actions_be.c deleted +0 -983
983 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_flow_actions_be.h deleted +0 -139
139 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 14/44 ip_pipeline: remove firewall pipeline
In reply to Jasvinder SinghRemove firewall pipeline.
--- examples/ip_pipeline/Makefile | 2 - examples/ip_pipeline/init.c | 2 - examples/ip_pipeline/meson.build | 2 - examples/ip_pipeline/pipeline/pipeline_firewall.c | 1421 -------------------- examples/ip_pipeline/pipeline/pipeline_firewall.h | 60 - .../ip_pipeline/pipeline/pipeline_firewall_be.c | 856 ------------ .../ip_pipeline/pipeline/pipeline_firewall_be.h | 147 -- 7 files changed, 2490 deletions(-) delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c delete mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h
examples/ip_pipeline/Makefile +0 -2
@@ -19,8 +19,6 @@ SRCS-y += pipeline_common_be.c SRCS-y += pipeline_common_fe.c SRCS-y += pipeline_master_be.c SRCS-y += pipeline_master.c -SRCS-y += pipeline_firewall_be.c -SRCS-y += pipeline_firewall.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
examples/ip_pipeline/init.c +0 -2
@@ -26,7 +26,6 @@#include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" -#include "pipeline_firewall.h" #include "thread_fe.h" #define APP_NAME_SIZE 32
@@ -1818,7 +1817,6 @@ int app_init(struct app_params *app)app_pipeline_common_cmd_push (app);app_pipeline_thread_cmd_push (app);app_pipeline_type_register (app, &pipeline_master); -app_pipeline_type_register (app, &pipeline_firewall);app_init_pipelines (app);app_init_threads (app);
examples/ip_pipeline/meson.build +0 -2
@@ -21,8 +21,6 @@ sources = files( 'thread_fe.c', 'pipeline/pipeline_common_be.c', 'pipeline/pipeline_common_fe.c', - 'pipeline/pipeline_firewall_be.c', - 'pipeline/pipeline_firewall.c', 'pipeline/pipeline_master_be.c', 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_firewall.c deleted +0 -1421
1,421 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_firewall.h deleted +0 -60
60 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_firewall_be.c deleted +0 -856
856 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_firewall_be.h deleted +0 -147
147 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 15/44 ip_pipeline: remove master pipeline
In reply to Jasvinder Singhremove master pipeline.
---
examples/ip_pipeline/Makefile | 6 -
examples/ip_pipeline/app.h | 12 -
examples/ip_pipeline/{pipeline => }/hash_func.h | 3 +-
.../ip_pipeline/{pipeline => }/hash_func_arm64.h | 0
examples/ip_pipeline/init.c | 574 --------
examples/ip_pipeline/meson.build | 9 +-
.../ip_pipeline/pipeline/pipeline_actions_common.h | 202 ---
examples/ip_pipeline/pipeline/pipeline_common_be.c | 176 ---
examples/ip_pipeline/pipeline/pipeline_common_be.h | 134 --
examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1455 --------------------
examples/ip_pipeline/pipeline/pipeline_common_fe.h | 231 ----
examples/ip_pipeline/pipeline/pipeline_master.c | 20 -
examples/ip_pipeline/pipeline/pipeline_master.h | 12 -
examples/ip_pipeline/pipeline/pipeline_master_be.c | 141 --
examples/ip_pipeline/pipeline/pipeline_master_be.h | 12 -
examples/ip_pipeline/thread.c | 53 -
examples/ip_pipeline/thread_fe.c | 457 ------
examples/ip_pipeline/thread_fe.h | 72 -
18 files changed, 3 insertions(+), 3566 deletions(-)
rename examples/ip_pipeline/{pipeline => }/hash_func.h (99%)
rename examples/ip_pipeline/{pipeline => }/hash_func_arm64.h (100%)
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c
delete mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h
delete mode 100644 examples/ip_pipeline/thread_fe.c
delete mode 100644 examples/ip_pipeline/thread_fe.hexamples/ip_pipeline/Makefile +0 -6
@@ -12,14 +12,8 @@ SRCS-y += config_parse_tm.c SRCS-y += config_check.c SRCS-y += init.c SRCS-y += thread.c -SRCS-y += thread_fe.c SRCS-y += cpu_core_map.c -SRCS-y += pipeline_common_be.c -SRCS-y += pipeline_common_fe.c -SRCS-y += pipeline_master_be.c -SRCS-y += pipeline_master.c - # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0)
examples/ip_pipeline/app.h +0 -12
@@ -1359,10 +1359,6 @@ app_core_build_core_mask_string(struct app_params *app, char *mask_buffer) } } -void app_pipeline_params_get (struct app_params *app, -struct app_pipeline_params *p_in, -struct pipeline_params *p_out); -int app_config_init (struct app_params *app); int app_config_args(struct app_params *app,
@@ -1382,16 +1378,8 @@ int app_config_check(struct app_params *app);int app_init (struct app_params *app); -int app_post_init (struct app_params *app); -int app_thread (void *arg); -int app_pipeline_type_register (struct app_params *app, -struct pipeline_type *ptype); - -struct pipeline_type *app_pipeline_type_find (struct app_params *app, -char *name); -void app_link_up_internal (struct app_params *app,struct app_link_params *cp);
examples/ip_pipeline/hash_func.h renamed from examples/ip_pipeline/pipeline/hash_func.h +2 -1
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation +* Copyright(c) 2010-2018 Intel Corporation */ +#ifndef __INCLUDE_HASH_FUNC_H__#define __INCLUDE_HASH_FUNC_H__
examples/ip_pipeline/hash_func_arm64.h renamed from examples/ip_pipeline/pipeline/hash_func_arm64.h +0 -0
examples/ip_pipeline/init.c +0 -574
591 lines not on this page · raw message
examples/ip_pipeline/meson.build +1 -8
@@ -6,9 +6,7 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -deps += ['cfgfile', 'pipeline', 'bus_pci'] -allow_experimental_apis = true -includes += include_directories('pipeline') +deps += ['cfgfile', 'bus_pci'] sources = files( 'config_check.c', 'config_parse.c',
@@ -18,9 +16,4 @@ sources = files( 'main.c', 'parser.c', 'thread.c', - 'thread_fe.c', - 'pipeline/pipeline_common_be.c', - 'pipeline/pipeline_common_fe.c', - 'pipeline/pipeline_master_be.c', - 'pipeline/pipeline_master.c', )
examples/ip_pipeline/pipeline/pipeline_actions_common.h deleted +0 -202
202 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_be.c deleted +0 -176
176 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_be.h deleted +0 -134
134 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_fe.c deleted +0 -1455
1,455 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_common_fe.h deleted +0 -231
231 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_master.c deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation -*/ - -#include "pipeline_master.h" -#include "pipeline_master_be.h" - -static struct pipeline_fe_ops pipeline_master_fe_ops = { - .f_init =NULL , - .f_post_init =NULL , - .f_free =NULL , - .f_track =NULL , - .cmds =NULL , -}; - -struct pipeline_type pipeline_master = { - .name ="MASTER" , - .be_ops = &pipeline_master_be_ops, - .fe_ops = &pipeline_master_fe_ops, -};
examples/ip_pipeline/pipeline/pipeline_master.h deleted +0 -12
@@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2010-2015 Intel Corporation -*/ - -#ifndef __INCLUDE_PIPELINE_MASTER_H__ -#define __INCLUDE_PIPELINE_MASTER_H__ - -#include "pipeline.h" - -extern struct pipeline_type pipeline_master; - -#endif
examples/ip_pipeline/pipeline/pipeline_master_be.c deleted +0 -141
112 lines not on this page · raw message
examples/ip_pipeline/pipeline/pipeline_master_be.h deleted +0 -12
Lines of this file are not shown. View the raw message.
examples/ip_pipeline/thread.c +0 -53
53 lines not on this page · raw message
examples/ip_pipeline/thread_fe.c deleted +0 -457
457 lines not on this page · raw message
examples/ip_pipeline/thread_fe.h deleted +0 -72
72 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.9.3
Part of the diff is not shown here. View the raw message.
PATCH v3 16/44 ip_pipeline: remove config
In reply to Jasvinder SinghRemove application configuration and script files.
--- examples/ip_pipeline/config/action.cfg | 68 -- examples/ip_pipeline/config/action.sh | 119 --- examples/ip_pipeline/config/action.txt | 8 - examples/ip_pipeline/config/diagram-generator.py | 317 ------- .../ip_pipeline/config/edge_router_downstream.cfg | 97 --- .../ip_pipeline/config/edge_router_downstream.sh | 13 - .../ip_pipeline/config/edge_router_upstream.cfg | 124 --- .../ip_pipeline/config/edge_router_upstream.sh | 33 - examples/ip_pipeline/config/firewall.cfg | 68 -- examples/ip_pipeline/config/firewall.sh | 13 - examples/ip_pipeline/config/firewall.txt | 9 - examples/ip_pipeline/config/flow.cfg | 72 -- examples/ip_pipeline/config/flow.sh | 25 - examples/ip_pipeline/config/flow.txt | 17 - examples/ip_pipeline/config/ip_pipeline.cfg | 9 - examples/ip_pipeline/config/ip_pipeline.sh | 5 - examples/ip_pipeline/config/kni.cfg | 67 -- examples/ip_pipeline/config/l2fwd.cfg | 58 -- examples/ip_pipeline/config/l3fwd.cfg | 68 -- examples/ip_pipeline/config/l3fwd.sh | 33 - examples/ip_pipeline/config/l3fwd_arp.cfg | 70 -- examples/ip_pipeline/config/l3fwd_arp.sh | 43 - examples/ip_pipeline/config/network_layers.cfg | 227 ------ examples/ip_pipeline/config/network_layers.sh | 79 -- .../ip_pipeline/config/pipeline-to-core-mapping.py | 906 --------------------- examples/ip_pipeline/config/tap.cfg | 64 -- examples/ip_pipeline/config/tm_profile.cfg | 105 --- 27 files changed, 2717 deletions(-) delete mode 100644 examples/ip_pipeline/config/action.cfg delete mode 100644 examples/ip_pipeline/config/action.sh delete mode 100644 examples/ip_pipeline/config/action.txt delete mode 100755 examples/ip_pipeline/config/diagram-generator.py delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.cfg delete mode 100644 examples/ip_pipeline/config/edge_router_downstream.sh delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.cfg delete mode 100644 examples/ip_pipeline/config/edge_router_upstream.sh delete mode 100644 examples/ip_pipeline/config/firewall.cfg delete mode 100644 examples/ip_pipeline/config/firewall.sh delete mode 100644 examples/ip_pipeline/config/firewall.txt delete mode 100644 examples/ip_pipeline/config/flow.cfg delete mode 100644 examples/ip_pipeline/config/flow.sh delete mode 100644 examples/ip_pipeline/config/flow.txt delete mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg delete mode 100644 examples/ip_pipeline/config/ip_pipeline.sh delete mode 100644 examples/ip_pipeline/config/kni.cfg delete mode 100644 examples/ip_pipeline/config/l2fwd.cfg delete mode 100644 examples/ip_pipeline/config/l3fwd.cfg delete mode 100644 examples/ip_pipeline/config/l3fwd.sh delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.cfg delete mode 100644 examples/ip_pipeline/config/l3fwd_arp.sh delete mode 100644 examples/ip_pipeline/config/network_layers.cfg delete mode 100644 examples/ip_pipeline/config/network_layers.sh delete mode 100755 examples/ip_pipeline/config/pipeline-to-core-mapping.py delete mode 100644 examples/ip_pipeline/config/tap.cfg delete mode 100644 examples/ip_pipeline/config/tm_profile.cfg
examples/ip_pipeline/config/action.cfg deleted +0 -68
@@ -1,68 +0,0 @@ -; BSD LICENSE -; -; Copyright(c) 2016 Intel Corporation. All rights reserved. -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; * Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; * Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in -; the documentation and/or other materials provided with the -; distribution. -; * Neither the name of Intel Corporation nor the names of its -; contributors may be used to endorse or promote products derived -; from this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -; ________________ -; RXQ0.0 --->| |---> TXQ0.0 -; | | -; RXQ1.0 --->| |---> TXQ1.0 -; | Flow | -; RXQ2.0 --->| Actions |---> TXQ2.0 -; | | -; RXQ3.0 --->| |---> TXQ3.0 -; |________________| -; -; -; Input packet: Ethernet/IPv4 -; -; Packet buffer layout: -; # Field Name Offset (Bytes) Size (Bytes) -; 0 Mbuf 0 128 -; 1 Headroom 128 128 -; 2 Ethernet header 256 14 -; 3 IPv4 header 270 20 - -[EAL] -log_level = 0 - -[PIPELINE0] -type = MASTER -core = 0 - -[PIPELINE1] -type = FLOW_ACTIONS -core = 1 -pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 -pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 -n_flows = 65536 -n_meters_per_flow = 4 -flow_id_offset = 286; ipdaddr -ip_hdr_offset = 270 -color_offset = 128
examples/ip_pipeline/config/action.sh deleted +0 -119
119 lines not on this page · raw message
examples/ip_pipeline/config/action.txt deleted +0 -8
@@ -1,8 +0,0 @@ -# -# p <pipelineid> action flow bulk ./config/action.txt -# - -flow 0 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0 -flow 1 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 1 -flow 2 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 2 -flow 3 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 3
examples/ip_pipeline/config/diagram-generator.py deleted +0 -317
317 lines not on this page · raw message
examples/ip_pipeline/config/edge_router_downstream.cfg deleted +0 -97
97 lines not on this page · raw message
examples/ip_pipeline/config/edge_router_downstream.sh deleted +0 -13
@@ -1,13 +0,0 @@ -# -# run ./config/edge_router_downstream.sh -# - -################################################################################ -# Routing: Ether QinQ, ARP off -################################################################################ -p 1 route add default 4 #SINK0 -p 1 route add 0.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 qinq 256 257 -p 1 route add 0.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 qinq 258 259 -p 1 route add 0.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 qinq 260 261 -p 1 route add 0.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 qinq 262 263 -#p 1 route ls
examples/ip_pipeline/config/edge_router_upstream.cfg deleted +0 -124
124 lines not on this page · raw message
examples/ip_pipeline/config/edge_router_upstream.sh deleted +0 -33
@@ -1,33 +0,0 @@ -# -# run ./config/edge_router_upstream.sh -# - -################################################################################ -# Firewall -################################################################################ -p 1 firewall add default 4 #SINK0 -p 1 firewall add bulk ./config/edge_router_upstream_firewall.txt -#p 1 firewall ls - -################################################################################ -# Flow Classification -################################################################################ -p 3 flow add default 4 #SINK1 -p 3 flow add qinq bulk ./config/edge_router_upstream_flow.txt -#p 3 flow ls - -################################################################################ -# Flow Actions - Metering and Policing -################################################################################ -p 4 action flow bulk ./config/edge_router_upstream_action.txt -#p 4 action flow ls - -################################################################################ -# Routing: Ether MPLS, ARP off -################################################################################ -p 5 route add default 4 #SINK2 -p 5 route add 0.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 mpls 0:1 -p 5 route add 0.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 mpls 10:11 -p 5 route add 0.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 mpls 20:21 -p 5 route add 0.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 mpls 30:31 -#p 5 route ls
examples/ip_pipeline/config/firewall.cfg deleted +0 -68
68 lines not on this page · raw message
examples/ip_pipeline/config/firewall.sh deleted +0 -13
@@ -1,13 +0,0 @@ -# -# run ./config/firewall.sh -# - -p 1 firewall add default 4 #SINK0 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.0.0.0 10 0 65535 0 65535 6 0xF port 0 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.64.0.0 10 0 65535 0 65535 6 0xF port 1 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.128.0.0 10 0 65535 0 65535 6 0xF port 2 -p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.192.0.0 10 0 65535 0 65535 6 0xF port 3 - -#p 1 firewall add bulk ./config/firewall.txt - -p 1 firewall ls
examples/ip_pipeline/config/firewall.txt deleted +0 -9
@@ -1,9 +0,0 @@ -# -# p <pipelineid> firewall add bulk ./config/firewall.txt -# p <pipelineid> firewall del bulk ./config/firewall.txt -# - -priority 1 ipv4 0.0.0.0 0 100.0.0.0 10 0 65535 0 65535 6 0xF port 0 -priority 1 ipv4 0.0.0.0 0 100.64.0.0 10 0 65535 0 65535 6 0xF port 1 -priority 1 ipv4 0.0.0.0 0 100.128.0.0 10 0 65535 0 65535 6 0xF port 2 -priority 1 ipv4 0.0.0.0 0 100.192.0.0 10 0 65535 0 65535 6 0xF port 3
examples/ip_pipeline/config/flow.cfg deleted +0 -72
72 lines not on this page · raw message
examples/ip_pipeline/config/flow.sh deleted +0 -25
@@ -1,25 +0,0 @@ -# -# run ./config/flow.sh -# - -################################################################################ -# Flow classification (QinQ) -################################################################################ -#p 1 flow add default 4 #SINK0 -#p 1 flow add qinq 100 200 port 0 id 0 -#p 1 flow add qinq 101 201 port 1 id 1 -#p 1 flow add qinq 102 202 port 2 id 2 -#p 1 flow add qinq 103 203 port 3 id 3 - -#p 1 flow add qinq bulk ./config/flow.txt - -################################################################################ -# Flow classification (IPv4 5-tuple) -################################################################################ -p 1 flow add default 4 #SINK0 -p 1 flow add ipv4 100.0.0.10 200.0.0.10 100 200 6 port 0 id 0 -p 1 flow add ipv4 100.0.0.11 200.0.0.11 101 201 6 port 1 id 1 -p 1 flow add ipv4 100.0.0.12 200.0.0.12 102 202 6 port 2 id 2 -p 1 flow add ipv4 100.0.0.13 200.0.0.13 103 203 6 port 3 id 3 - -#p 1 flow add ipv4 bulk ./config/flow.txt
examples/ip_pipeline/config/flow.txt deleted +0 -17
@@ -1,17 +0,0 @@ -# -# p <pipelineid> flow add qinq bulk ./config/flow.txt -# - -#qinq 100 200 port 0 id 0 -#qinq 101 201 port 1 id 1 -#qinq 102 202 port 2 id 2 -#qinq 103 203 port 3 id 3 - -# -# p <pipelineid> flow add ipv4 bulk ./config/flow.txt -# - -ipv4 100.0.0.10 200.0.0.10 100 200 6 port 0 id 0 -ipv4 100.0.0.11 200.0.0.11 101 201 6 port 1 id 1 -ipv4 100.0.0.12 200.0.0.12 102 202 6 port 2 id 2 -ipv4 100.0.0.13 200.0.0.13 103 203 6 port 3 id 3
examples/ip_pipeline/config/ip_pipeline.cfg deleted +0 -9
@@ -1,9 +0,0 @@ -[PIPELINE0] -type = MASTER -core = 0 - -[PIPELINE1] -type = PASS-THROUGH -core = 1 -pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 -pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0
examples/ip_pipeline/config/ip_pipeline.sh deleted +0 -5
@@ -1,5 +0,0 @@ -# -#run config/ip_pipeline.sh -# - -p 1 ping
examples/ip_pipeline/config/kni.cfg deleted +0 -67
67 lines not on this page · raw message
examples/ip_pipeline/config/l2fwd.cfg deleted +0 -58
58 lines not on this page · raw message
examples/ip_pipeline/config/l3fwd.cfg deleted +0 -68
68 lines not on this page · raw message
examples/ip_pipeline/config/l3fwd.sh deleted +0 -33
@@ -1,33 +0,0 @@ -# -# run ./config/l3fwd.sh -# - -################################################################################ -# Routing: encap = ethernet, arp = off -################################################################################ -p 1 route add default 4 #SINK0 -p 1 route add 100.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 -p 1 route add 100.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 -p 1 route add 100.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 -p 1 route add 100.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 -p 1 route ls - -################################################################################ -# Routing: encap = ethernet_qinq, arp = off -################################################################################ -#p 1 route add default 4 #SINK0 -#p 1 route add 100.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 qinq 1000 2000 -#p 1 route add 100.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 qinq 1001 2001 -#p 1 route add 100.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 qinq 1002 2002 -#p 1 route add 100.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 qinq 1003 2003 -#p 1 route ls - -################################################################################ -# Routing: encap = ethernet_mpls, arp = off -################################################################################ -#p 1 route add default 4 #SINK0 -#p 1 route add 100.0.0.0 10 port 0 ether a0:b0:c0:d0:e0:f0 mpls 1000:2000 -#p 1 route add 100.64.0.0 10 port 1 ether a1:b1:c1:d1:e1:f1 mpls 1001:2001 -#p 1 route add 100.128.0.0 10 port 2 ether a2:b2:c2:d2:e2:f2 mpls 1002:2002 -#p 1 route add 100.192.0.0 10 port 3 ether a3:b3:c3:d3:e3:f3 mpls 1003:2003 -#p 1 route ls
examples/ip_pipeline/config/l3fwd_arp.cfg deleted +0 -70
70 lines not on this page · raw message
examples/ip_pipeline/config/l3fwd_arp.sh deleted +0 -43
43 lines not on this page · raw message
examples/ip_pipeline/config/network_layers.cfg deleted +0 -227
227 lines not on this page · raw message
examples/ip_pipeline/config/network_layers.sh deleted +0 -79
79 lines not on this page · raw message
examples/ip_pipeline/config/pipeline-to-core-mapping.py deleted +0 -906
906 lines not on this page · raw message
examples/ip_pipeline/config/tap.cfg deleted +0 -64
64 lines not on this page · raw message
examples/ip_pipeline/config/tm_profile.cfg deleted +0 -105
105 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 17/44 ip_pipeline: rework and improvements
In reply to Jasvinder SinghAll the actions associated with application pipelines tables and ports are now implemented using the new action APIs. Therefore, thousands of lines of code are eliminated from the application. The reduced code size is easier to maintain and extend.
--- examples/ip_pipeline/Makefile | 22 +- examples/ip_pipeline/app.h | 1389 ------------- examples/ip_pipeline/config_check.c | 488 ----- examples/ip_pipeline/config_parse.c | 3395 -------------------------------- examples/ip_pipeline/config_parse_tm.c | 419 ---- examples/ip_pipeline/cpu_core_map.c | 471 ----- examples/ip_pipeline/cpu_core_map.h | 40 - examples/ip_pipeline/init.c | 1343 ------------- examples/ip_pipeline/main.c | 36 +- examples/ip_pipeline/meson.build | 10 +- examples/ip_pipeline/parser.c | 16 +- examples/ip_pipeline/parser.h | 8 + examples/ip_pipeline/pipeline.h | 73 - examples/ip_pipeline/pipeline_be.h | 322 --- examples/ip_pipeline/thread.c | 240 --- examples/ip_pipeline/thread.h | 69 - 16 files changed, 37 insertions(+), 8304 deletions(-) delete mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/config_check.c delete mode 100644 examples/ip_pipeline/config_parse.c delete mode 100644 examples/ip_pipeline/config_parse_tm.c delete mode 100644 examples/ip_pipeline/cpu_core_map.c delete mode 100644 examples/ip_pipeline/cpu_core_map.h delete mode 100644 examples/ip_pipeline/init.c delete mode 100644 examples/ip_pipeline/pipeline.h delete mode 100644 examples/ip_pipeline/pipeline_be.h delete mode 100644 examples/ip_pipeline/thread.c delete mode 100644 examples/ip_pipeline/thread.h
examples/ip_pipeline/Makefile +6 -16
@@ -1,18 +1,13 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2014 Intel Corporation +# Copyright(c) 2010-2018 Intel Corporation # binary name APP = ip_pipeline # all source are stored in SRCS-y SRCS-y := main.c -SRCS-y += config_parse.c SRCS-y += parser.c -SRCS-y += config_parse_tm.c -SRCS-y += config_check.c -SRCS-y += init.c -SRCS-y += thread.c -SRCS-y += cpu_core_map.c +#SRCS-y += thread.c # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk)
@@ -30,9 +25,7 @@ CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) -VPATH += pipeline -CFLAGS += -I. -I./pipeline/ -CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -I. OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
@@ -59,21 +52,18 @@ ifeq ($(RTE_SDK),) $(error "Please define RTE_SDK environment variable") endif -VPATH += $(SRCDIR)/pipeline - # Default target, can be overridden by command line or environment RTE_TARGET ?= x86_64-native-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk -INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h)) +INC += $(sort $(wildcard *.h)) SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y) -CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline +CFLAGS += -I$(SRCDIR) CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable -CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += $(WERROR_FLAGS) include $(RTE_SDK)/mk/rte.extapp.mk
examples/ip_pipeline/app.h deleted +0 -1389
1,389 lines not on this page · raw message
examples/ip_pipeline/config_check.c deleted +0 -488
488 lines not on this page · raw message
examples/ip_pipeline/config_parse.c deleted +0 -3395
1,069 lines not on this page · raw message
examples/ip_pipeline/config_parse_tm.c deleted +0 -419
419 lines not on this page · raw message
examples/ip_pipeline/cpu_core_map.c deleted +0 -471
471 lines not on this page · raw message
examples/ip_pipeline/cpu_core_map.h deleted +0 -40
Lines of this file are not shown. View the raw message.
examples/ip_pipeline/init.c deleted +0 -1343
1,343 lines not on this page · raw message
examples/ip_pipeline/pipeline.h deleted +0 -73
73 lines not on this page · raw message
examples/ip_pipeline/pipeline_be.h deleted +0 -322
322 lines not on this page · raw message
examples/ip_pipeline/thread.c deleted +0 -240
240 lines not on this page · raw message
examples/ip_pipeline/thread.h deleted +0 -69
69 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.9.3
Part of the diff is not shown here. View the raw message.
PATCH v3 18/44 ip_pipeline: add cli interface
In reply to Jasvinder SinghCLI interface allowing connectivity with external agent(e.g. telnet, netcat, Python script, etc) is added to the application.
--- examples/ip_pipeline/Makefile | 4 +- examples/ip_pipeline/cli.c | 85 ++++++++++ examples/ip_pipeline/cli.h | 18 +++ examples/ip_pipeline/conn.c | 326 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/conn.h | 47 ++++++ examples/ip_pipeline/main.c | 151 +++++++++++++++++- examples/ip_pipeline/meson.build | 2 + 7 files changed, 631 insertions(+), 2 deletions(-) create mode 100644 examples/ip_pipeline/cli.c create mode 100644 examples/ip_pipeline/cli.h create mode 100644 examples/ip_pipeline/conn.c create mode 100644 examples/ip_pipeline/conn.h
examples/ip_pipeline/Makefile +3 -1
@@ -5,7 +5,9 @@ APP = ip_pipeline # all source are stored in SRCS-y -SRCS-y := main.c +SRCS-y := cli.c +SRCS-y += conn.c +SRCS-y += main.c SRCS-y += parser.c #SRCS-y += thread.c
examples/ip_pipeline/cli.c new file +85 -0
85 lines not on this page · raw message
examples/ip_pipeline/cli.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef __INCLUDE_CLI_H__ +#define __INCLUDE_CLI_H__ + +#include <stddef.h> + +void +cli_process (char *in,char *out,size_t out_size); + +int +cli_script_process (const char *file_name, +size_t msg_in_len_max, +size_t msg_out_len_max); + +#endif
examples/ip_pipeline/conn.c new file +326 -0
326 lines not on this page · raw message
examples/ip_pipeline/conn.h new file +47 -0
47 lines not on this page · raw message
examples/ip_pipeline/main.c +150 -1
170 lines not on this page · raw message
examples/ip_pipeline/meson.build +2 -0
@@ -8,6 +8,8 @@ deps += ['pipeline', 'bus_pci'] sources = files( + 'cli.c', + 'conn.c', 'main.c', 'parser.c', )
Signature · 1 line
2.9.3
PATCH v3 19/44 ip_pipeline: add mempool object for pipeline
In reply to Jasvinder SinghAdd mempool object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 109 ++++++++++++++++++++++++++++++++++++++- examples/ip_pipeline/common.h | 12 +++++ examples/ip_pipeline/main.c | 8 +++ examples/ip_pipeline/mempool.c | 81 +++++++++++++++++++++++++++++ examples/ip_pipeline/mempool.h | 40 ++++++++++++++ examples/ip_pipeline/meson.build | 1 + 7 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 examples/ip_pipeline/common.h create mode 100644 examples/ip_pipeline/mempool.c create mode 100644 examples/ip_pipeline/mempool.h
examples/ip_pipeline/Makefile +1 -0
@@ -8,6 +8,7 @@ APP = ip_pipeline SRCS-y := cli.c SRCS-y += conn.c SRCS-y += main.c +SRCS-y += mempool.c SRCS-y += parser.c #SRCS-y += thread.c
examples/ip_pipeline/cli.c +108 -1
126 lines not on this page · raw message
examples/ip_pipeline/common.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_COMMON_H_ +#define _INCLUDE_COMMON_H_ + +#ifndef NAME_SIZE +#define NAME_SIZE 64 +#endif + +#endif /* _INCLUDE_COMMON_H_ */
examples/ip_pipeline/main.c +8 -0
@@ -12,6 +12,7 @@#include "cli.h" #include "conn.h" +#include "mempool.h" static const char usage[] ="%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\n" ;
@@ -159,6 +160,13 @@ main(int argc, char **argv)return status; }; +/* Mempool */ + status =mempool_init (); +if (status) { +printf ("Error: Mempool initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/mempool.c new file +81 -0
81 lines not on this page · raw message
examples/ip_pipeline/mempool.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_MEMPOOL_H_ +#define _INCLUDE_MEMPOOL_H_ + +#include <stdint.h> +#include <sys/queue.h> + +#include <rte_mempool.h> + +#include "common.h" + +struct mempool { +TAILQ_ENTRY (mempool) node; +char name[NAME_SIZE ]; +struct rte_mempool *m; +uint32_t buffer_size; +}; + +TAILQ_HEAD (mempool_list, mempool); + +int +mempool_init (void ); + +struct mempool * +mempool_find (const char *name); + +struct mempool_params { +uint32_t buffer_size; +uint32_t pool_size; +uint32_t cache_size; +uint32_t cpu_id; +}; + +struct mempool * +mempool_create (const char *name,struct mempool_params *params); + +#endif /* _INCLUDE_MEMPOOL_H_ */
examples/ip_pipeline/meson.build +1 -0
@@ -11,5 +11,6 @@ sources = files( 'cli.c', 'conn.c', 'main.c', + 'mempool.c', 'parser.c', )
Signature · 1 line
2.9.3
PATCH v3 20/44 ip_pipeline: add link object
In reply to Jasvinder SinghAdd link object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 122 ++++++++++++++++++ examples/ip_pipeline/link.c | 268 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/link.h | 63 +++++++++ examples/ip_pipeline/main.c | 8 ++ examples/ip_pipeline/meson.build | 1 + 6 files changed, 463 insertions(+) create mode 100644 examples/ip_pipeline/link.c create mode 100644 examples/ip_pipeline/link.h
examples/ip_pipeline/Makefile +1 -0
@@ -7,6 +7,7 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-y := cli.c SRCS-y += conn.c +SRCS-y += link.c SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c
examples/ip_pipeline/cli.c +122 -0
140 lines not on this page · raw message
examples/ip_pipeline/link.c new file +268 -0
268 lines not on this page · raw message
examples/ip_pipeline/link.h new file +63 -0
63 lines not on this page · raw message
examples/ip_pipeline/main.c +8 -0
@@ -12,6 +12,7 @@#include "cli.h" #include "conn.h" +#include "link.h" #include "mempool.h" static const char usage[] =
@@ -167,6 +168,13 @@ main(int argc, char **argv)return status; } +/* Link */ + status =link_init (); +if (status) { +printf ("Error: Link initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -10,6 +10,7 @@ deps += ['pipeline', 'bus_pci'] sources = files( 'cli.c', 'conn.c', + 'link.c', 'main.c', 'mempool.c', 'parser.c',
Signature · 1 line
2.9.3
PATCH v3 21/44 ip_pipeline: add software queue object
In reply to Jasvinder SinghAdd swq object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 55 +++++++++++++++++++++++++++++ examples/ip_pipeline/main.c | 8 +++++ examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/swq.c | 74 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/swq.h | 37 ++++++++++++++++++++ 6 files changed, 176 insertions(+) create mode 100644 examples/ip_pipeline/swq.c create mode 100644 examples/ip_pipeline/swq.h
examples/ip_pipeline/Makefile +1 -0
@@ -11,6 +11,7 @@ SRCS-y += link.c SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c +SRCS-y += swq.c #SRCS-y += thread.c # Build using pkg-config variables if possible
examples/ip_pipeline/cli.c +55 -0
73 lines not on this page · raw message
examples/ip_pipeline/main.c +8 -0
@@ -14,6 +14,7 @@#include "conn.h" #include "link.h" #include "mempool.h" +#include "swq.h" static const char usage[] ="%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\n" ;
@@ -175,6 +176,13 @@ main(int argc, char **argv)return status; } +/* SWQ */ + status =swq_init (); +if (status) { +printf ("Error: SWQ initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -14,4 +14,5 @@ sources = files( 'main.c', 'mempool.c', 'parser.c', + 'swq.c', )
examples/ip_pipeline/swq.c new file +74 -0
74 lines not on this page · raw message
examples/ip_pipeline/swq.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_SWQ_H_ +#define _INCLUDE_SWQ_H_ + +#include <stdint.h> +#include <sys/queue.h> + +#include <rte_ring.h> + +#include "common.h" + +struct swq { +TAILQ_ENTRY (swq) node; +char name[NAME_SIZE ]; +struct rte_ring *r; +}; + +TAILQ_HEAD (swq_list, swq); + +int +swq_init (void ); + +struct swq * +swq_find (const char *name); + +struct swq_params { +uint32_t size; +uint32_t cpu_id; +}; + +struct swq * +swq_create (const char *name,struct swq_params *params); + +#endif /* _INCLUDE_SWQ_H_ */
Signature · 1 line
2.9.3
PATCH v3 22/44 ip_pipeline: add traffic manager object
In reply to Jasvinder SinghAdd traffic manager object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 360 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/main.c | 8 + examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/tmgr.c | 227 ++++++++++++++++++++++++ examples/ip_pipeline/tmgr.h | 70 ++++++++ 6 files changed, 667 insertions(+) create mode 100644 examples/ip_pipeline/tmgr.c create mode 100644 examples/ip_pipeline/tmgr.h
examples/ip_pipeline/Makefile +1 -0
@@ -12,6 +12,7 @@ SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c SRCS-y += swq.c +SRCS-y += tmgr.c #SRCS-y += thread.c # Build using pkg-config variables if possible
examples/ip_pipeline/cli.c +360 -0
378 lines not on this page · raw message
examples/ip_pipeline/main.c +8 -0
@@ -15,6 +15,7 @@#include "link.h" #include "mempool.h" #include "swq.h" +#include "tmgr.h" static const char usage[] ="%s EAL_ARGS -- [-h HOST] [-p PORT] [-s SCRIPT]\n" ;
@@ -183,6 +184,13 @@ main(int argc, char **argv)return status; } +/* Traffic Manager */ + status =tmgr_init (); +if (status) { +printf ("Error: TMGR initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -15,4 +15,5 @@ sources = files( 'mempool.c', 'parser.c', 'swq.c', + 'tmgr.c' )
examples/ip_pipeline/tmgr.c new file +227 -0
227 lines not on this page · raw message
examples/ip_pipeline/tmgr.h new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 23/44 ip_pipeline: add tap object
In reply to Jasvinder SinghAdd tap object implementation to the application
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 32 +++++++++++++ examples/ip_pipeline/main.c | 8 ++++ examples/ip_pipeline/meson.build | 1 + examples/ip_pipeline/tap.c | 97 ++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/tap.h | 29 ++++++++++++ 6 files changed, 168 insertions(+) create mode 100644 examples/ip_pipeline/tap.c create mode 100644 examples/ip_pipeline/tap.h
examples/ip_pipeline/Makefile +1 -0
@@ -12,6 +12,7 @@ SRCS-y += main.c SRCS-y += mempool.c SRCS-y += parser.c SRCS-y += swq.c +SRCS-y += tap.c SRCS-y += tmgr.c #SRCS-y += thread.c
examples/ip_pipeline/cli.c +32 -0
@@ -14,6 +14,7 @@#include "mempool.h" #include "parser.h" #include "swq.h" +#include "tap.h" #include "tmgr.h" #ifndef CMD_MAX_TOKENS
@@ -603,6 +604,32 @@ cmd_tmgr_subport_pipe(char **tokens, } } +/** +* tap <tap_name> +*/ +static void +cmd_tap (char **tokens, +uint32_t n_tokens, +char *out, +size_t out_size) +{ +char *name; +struct tap *tap; + +if (n_tokens !=2 ) { +snprintf (out, out_size,MSG_ARG_MISMATCH , tokens[0 ]); +return ; + } + + name = tokens[1 ]; + + tap =tap_create (name); +if (tap ==NULL ) { +snprintf (out, out_size,MSG_CMD_FAIL , tokens[0 ]); +return ; + } +} +void cli_process (char *in,char *out,size_t out_size) {
@@ -671,6 +698,11 @@ cli_process(char *in, char *out, size_t out_size)return ; } +if (strcmp (tokens[0 ],"tap" ) ==0 ) { +cmd_tap (tokens, n_tokens, out, out_size); +return ; + } +snprintf (out, out_size,MSG_CMD_UNKNOWN , tokens[0 ]); }
examples/ip_pipeline/main.c +8 -0
@@ -15,6 +15,7 @@#include "link.h" #include "mempool.h" #include "swq.h" +#include "tap.h" #include "tmgr.h" static const char usage[] =
@@ -191,6 +192,13 @@ main(int argc, char **argv)return status; } +/* TAP */ + status =tap_init (); +if (status) { +printf ("Error: TAP initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +1 -0
@@ -15,5 +15,6 @@ sources = files( 'mempool.c', 'parser.c', 'swq.c', + 'tap.c', 'tmgr.c' )
examples/ip_pipeline/tap.c new file +97 -0
97 lines not on this page · raw message
examples/ip_pipeline/tap.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2018 Intel Corporation +*/ + +#ifndef _INCLUDE_TAP_H_ +#define _INCLUDE_TAP_H_ + +#include <sys/queue.h> + +#include "common.h" + +struct tap { +TAILQ_ENTRY (tap) node; +char name[NAME_SIZE ]; +int fd; +}; + +TAILQ_HEAD (tap_list, tap); + +int +tap_init (void ); + +struct tap * +tap_find (const char *name); + +struct tap * +tap_create (const char *name); + +#endif /* _INCLUDE_TAP_H_ */
Signature · 1 line
2.9.3
PATCH v3 24/44 ip_pipeline: add kni object
In reply to Jasvinder SinghAdd kni object implementation to the application.
--- examples/ip_pipeline/Makefile | 1 + examples/ip_pipeline/cli.c | 65 +++++++++++++++ examples/ip_pipeline/kni.c | 167 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/kni.h | 44 +++++++++++ examples/ip_pipeline/main.c | 10 +++ examples/ip_pipeline/meson.build | 1 + 6 files changed, 288 insertions(+) create mode 100644 examples/ip_pipeline/kni.c create mode 100644 examples/ip_pipeline/kni.h
examples/ip_pipeline/Makefile +1 -0
@@ -7,6 +7,7 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-y := cli.c SRCS-y += conn.c +SRCS-y += kni.c SRCS-y += link.c SRCS-y += main.c SRCS-y += mempool.c
examples/ip_pipeline/cli.c +65 -0
83 lines not on this page · raw message
examples/ip_pipeline/kni.c new file +167 -0
167 lines not on this page · raw message
examples/ip_pipeline/kni.h new file +44 -0
44 lines not on this page · raw message
examples/ip_pipeline/main.c +10 -0
@@ -12,6 +12,7 @@#include "cli.h" #include "conn.h" +#include "kni.h" #include "link.h" #include "mempool.h" #include "swq.h"
@@ -199,6 +200,13 @@ main(int argc, char **argv)return status; } +/* KNI */ + status =kni_init (); +if (status) { +printf ("Error: KNI initialization failed (%d)\n" , status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
@@ -210,5 +218,7 @@ main(int argc, char **argv)conn_poll_for_conn (conn);conn_poll_for_msg (conn); + +kni_handle_request (); } }
examples/ip_pipeline/meson.build +1 -0
@@ -10,6 +10,7 @@ deps += ['pipeline', 'bus_pci'] sources = files( 'cli.c', 'conn.c', + 'kni.c', 'link.c', 'main.c', 'mempool.c',
Signature · 1 line
2.9.3
PATCH v3 25/44 ip_pipeline: add action profile object
In reply to Jasvinder SinghAdd action profile object implementation to the application.
--- examples/ip_pipeline/Makefile | 4 +- examples/ip_pipeline/action.c | 165 +++++++++++++++++++++ examples/ip_pipeline/action.h | 44 ++++++ examples/ip_pipeline/cli.c | 309 +++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/cli.h | 2 + examples/ip_pipeline/main.c | 8 + examples/ip_pipeline/meson.build | 2 + 7 files changed, 533 insertions(+), 1 deletion(-) create mode 100644 examples/ip_pipeline/action.c create mode 100644 examples/ip_pipeline/action.h
examples/ip_pipeline/Makefile +3 -1
@@ -5,7 +5,8 @@ APP = ip_pipeline # all source are stored in SRCS-y -SRCS-y := cli.c +SRCS-y := action.c +SRCS-y += cli.c SRCS-y += conn.c SRCS-y += kni.c SRCS-y += link.c
@@ -69,6 +70,7 @@ INC += $(sort $(wildcard *.h)) SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := $(SRCS-y) +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -I$(SRCDIR) CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
examples/ip_pipeline/action.c new file +165 -0
165 lines not on this page · raw message
examples/ip_pipeline/action.h new file +44 -0
44 lines not on this page · raw message
examples/ip_pipeline/cli.c +309 -0
321 lines not on this page · raw message
examples/ip_pipeline/cli.h +2 -0
@@ -7,6 +7,8 @@#include <stddef.h> +#include "action.h" +void cli_process (char *in,char *out,size_t out_size);
examples/ip_pipeline/main.c +8 -0
@@ -207,6 +207,14 @@ main(int argc, char **argv)return status; } +/* Action profile */ + status =table_action_profile_init (); +if (status) { +printf ("Error: Action profile initialization failed (%d)\n" , + status); +return status; + } +/* Script */ if (app.script_name) cli_script_process(app.script_name,
examples/ip_pipeline/meson.build +2 -0
@@ -7,7 +7,9 @@ # DPDK instance, use 'make' deps += ['pipeline', 'bus_pci'] +allow_experimental_apis = true sources = files( + 'action.c', 'cli.c', 'conn.c', 'kni.c',
Signature · 1 line
2.9.3