examples/l2fwd-macsec: add MACsec forwarding application
PATCH 1/1 examples/l2fwd-macsec: add MACsec forwarding application
Added a new application based on l2fwd to demonstrate inline protocol offload MACsec performance using rte_security APIs.
Example command:
./dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 -c 0x6 -- -p 0x3 \
--mcs-tx-portmask 0x1 --mcs-rx-portmask 0x2 --mcs-port-config \
'(0,02:03:04:05:06:07,01:02:03:04:05:06),(1,02:03:04:05:06:17,01:02:03:04:05:16)'
--- .../sample_app_ug/l2_forward_macsec.rst | 106 ++ examples/l2fwd-macsec/Makefile | 52 + examples/l2fwd-macsec/main.c | 1570 +++++++++++++++++ examples/l2fwd-macsec/meson.build | 13 + examples/meson.build | 1 + 5 files changed, 1742 insertions(+) create mode 100644 doc/guides/sample_app_ug/l2_forward_macsec.rst create mode 100644 examples/l2fwd-macsec/Makefile create mode 100644 examples/l2fwd-macsec/main.c create mode 100644 examples/l2fwd-macsec/meson.build
doc/guides/sample_app_ug/l2_forward_macsec.rst new file +106 -0
@@ -0,0 +1,106 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(C) 2023 Marvell. + +.. _l2_fwd_macsec_app: + +L2 Forwarding MACsec Sample Application +======================================= + +The L2 Forwarding MACsec application is a simple example of packet processing using +the Data Plane Development Kit (DPDK) which encrypt/decrypt packets based on +rte_security MACsec sessions. + +Overview +-------- + +The L2 Forwarding MACsec application performs L2 forwarding for each packet that is +received on an RX_PORT after encrypting/decrypting the packets based on rte_security +sessions using inline protocol mode. +The destination port is the adjacent port from the enabled portmask, that is, +if the first four ports are enabled (portmask 0xf), +ports 1 and 2 forward into each other, and ports 3 and 4 forward into each other. + +This application can be used to benchmark performance using a traffic-generator, +as shown in the :numref:`figure_l2_fwd_benchmark_setup`. + +.. _figure_l2_fwd_benchmark_setup: + +.. figure:: img/l2_fwd_benchmark_setup.* + + Performance Benchmark Setup (Basic Environment) + +.. _l2_fwd_vf_setup: + +Compiling the Application +------------------------- + +To compile the sample application see :doc:`compiling`. + +The application is located in the ``l2fwd-macsec`` sub-directory. + +Running the Application +----------------------- + +The application requires a number of command line options: + +.. code-block:: console + + ./<build_dir>/examples/dpdk-l2fwd-macsec [EAL options] -- -p PORTMASK + [-q NQ] + --mcs-tx-portmask OUTBOUND_PORTMASK + --mcs-rx-portmask INBOUND_PORTMASK + --mcs-port-config '(port,src_mac,dst_mac)[,(port,src_mac,dst_mac)]' + [--portmap="(port, port)[,(port, port)]"] + [-T STAT_INTERVAL] + +where, + +* ``p PORTMASK``: A hexadecimal bitmask of the ports to configure + +* ``q NQ``: A number of queues (=ports) per lcore (default is 1) + +* ``T STAT_INTERVAL``: Time interval in seconds for refreshing the stats(default is 1 sec). + Value 0 disables stats display. + +* ``--mcs-tx-portmask OUTBOUND_PORTMASK``: A hexadecimal bitmask of the ports + to configure encryption flows. + +* ``--mcs-rx-portmask INBOUND_PORTMASK``: A hexadecimal bitmask of the ports + to configure decryption flows. + +* ``--mcs-port-config '(port,src_mac,dst_mac)[,(port,src_mac,dst_mac)]'``: + Configures the source and destination MAC addresses of incoming packets + on a port for which MACsec processing is to be done. + +* ``--portmap="(port,port)[,(port,port)]"``: Determines forwarding ports mapping. + +To run the application in linux environment with 4 lcores, 4 ports with +2 ports for outbound and 2 ports for outbound, issue the command: + +.. code-block:: console + + $ ./<build_dir>/examples/dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 \ + -a 0002:06:00.0 -a 0002:07:00.0 -c 0x1E -- -p 0xf \ + --mcs-tx-portmask 0x5 --mcs-rx-portmask 0xA \ + --mcs-port-config '(0,02:03:04:05:06:07,01:02:03:04:05:06), \ + (1,02:03:04:05:06:17,01:02:03:04:05:16), \ + (2,02:03:04:05:06:27,01:02:03:04:05:26), \ + (3,02:03:04:05:06:37,01:02:03:04:05:36)' -T 10 + +To run the application in linux environment with 4 lcores, 4 ports, +to forward RX traffic of ports 0 & 1 on ports 2 & 3 respectively and +vice versa, issue the command: + +.. code-block:: console + + $ ./<build_dir>/examples/dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 \ + -a 0002:06:00.0 -a 0002:07:00.0 -c 0x1E -- -p 0xf \ + --mcs-tx-portmask 0x5 --mcs-rx-portmask 0xA \ + --mcs-port-config="(0,02:03:04:05:06:07,01:02:03:04:05:06), \ + (1,02:03:04:05:06:17,01:02:03:04:05:16), \ + (2,02:03:04:05:06:27,01:02:03:04:05:26), \ + (3,02:03:04:05:06:37,01:02:03:04:05:36)" -T 10 \ + --portmap="(0,2)(1,3)" + +Refer to the *DPDK Getting Started Guide* for general information on running applications +and the Environment Abstraction Layer (EAL) options.
examples/l2fwd-macsec/Makefile new file +52 -0
52 lines not on this page · raw message
examples/l2fwd-macsec/main.c new file +1570 -0
1,570 lines not on this page · raw message
examples/l2fwd-macsec/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2023 Marvell. + +# meson file, for building this example as part of a main DPDK build. +# +# To build this example as a standalone application with an already-installed +# DPDK instance, use 'make' + +deps += ['security'] +allow_experimental_apis = true +sources = files( + 'main.c', +)
examples/meson.build +1 -0
@@ -30,6 +30,7 @@ all_examples = [ 'l2fwd-event', 'l2fwd-jobstats', 'l2fwd-keepalive', + 'l2fwd-macsec', 'l3fwd', 'l3fwd-graph', 'l3fwd-power',
Signature · 1 line
2.25.1
PATCH v2 1/1 examples/l2fwd-macsec: add MACsec forwarding application
Added a new application based on l2fwd to demonstrate inline protocol offload MACsec performance using rte_security APIs.
Example command:
./dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 -c 0x6 -- -p 0x3 \
--mcs-tx-portmask 0x1 --mcs-rx-portmask 0x2 --mcs-port-config \
'(0,02:03:04:05:06:07,01:02:03:04:05:06),(1,02:03:04:05:06:17,01:02:03:04:05:16)'
---
Changes in v2:
- fixed CentOS compilation
- fixed documentation and added release notes.
doc/guides/rel_notes/release_23_11.rst | 5 + doc/guides/sample_app_ug/index.rst | 1 + .../sample_app_ug/l2_forward_macsec.rst | 97 + examples/l2fwd-macsec/Makefile | 52 + examples/l2fwd-macsec/main.c | 1570 +++++++++++++++++ examples/l2fwd-macsec/meson.build | 13 + examples/meson.build | 1 + 7 files changed, 1739 insertions(+) create mode 100644 doc/guides/sample_app_ug/l2_forward_macsec.rst create mode 100644 examples/l2fwd-macsec/Makefile create mode 100644 examples/l2fwd-macsec/main.c create mode 100644 examples/l2fwd-macsec/meson.build
doc/guides/rel_notes/release_23_11.rst +5 -0
@@ -248,6 +248,11 @@ New Features Added dispatcher library which purpose is to help decouple different parts (modules) of an eventdev-based application. +* **Added layer 2 MACsec forwarding example application.** + + Added a new example layer 2 forwarding application to benchmark + MACsec encryption/decryption using rte_security based inline sessions. + Removed Items -------------
doc/guides/sample_app_ug/index.rst +1 -0
@@ -26,6 +26,7 @@ Sample Applications User Guides l2_forward_real_virtual l2_forward_event l2_forward_cat + l2_forward_macsec l3_forward l3_forward_graph l3_forward_power_man
doc/guides/sample_app_ug/l2_forward_macsec.rst new file +97 -0
97 lines not on this page · raw message
examples/l2fwd-macsec/Makefile new file +52 -0
52 lines not on this page · raw message
examples/l2fwd-macsec/main.c new file +1570 -0
1,570 lines not on this page · raw message
examples/l2fwd-macsec/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2023 Marvell. + +# meson file, for building this example as part of a main DPDK build. +# +# To build this example as a standalone application with an already-installed +# DPDK instance, use 'make' + +deps += ['security'] +allow_experimental_apis = true +sources = files( + 'main.c', +)
examples/meson.build +1 -0
@@ -29,6 +29,7 @@ all_examples = [ 'l2fwd-event', 'l2fwd-jobstats', 'l2fwd-keepalive', + 'l2fwd-macsec', 'l3fwd', 'l3fwd-graph', 'l3fwd-power',
Signature · 1 line
2.25.1
PATCH v3 1/1 examples/l2fwd-macsec: add MACsec forwarding application
Added a new application based on l2fwd to demonstrate inline protocol offload MACsec performance using rte_security APIs.
Example command:
./dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 -c 0x6 -- -p 0x3 \
--mcs-tx-portmask 0x1 --mcs-rx-portmask 0x2 --mcs-port-config \
'(0,02:03:04:05:06:07,01:02:03:04:05:06), \
(1,02:03:04:05:06:17,01:02:03:04:05:16)'
---
Changes in v3:
- updated MAINTAINERS
- fixed checkpatch
Changes in v2:
- fixed CentOS compilation
- fixed documentation and added release notes.
MAINTAINERS | 5 + doc/guides/rel_notes/release_23_11.rst | 5 + doc/guides/sample_app_ug/index.rst | 1 + .../sample_app_ug/l2_forward_macsec.rst | 97 + examples/l2fwd-macsec/Makefile | 52 + examples/l2fwd-macsec/main.c | 1570 +++++++++++++++++ examples/l2fwd-macsec/meson.build | 13 + examples/meson.build | 1 + 8 files changed, 1744 insertions(+) create mode 100644 doc/guides/sample_app_ug/l2_forward_macsec.rst create mode 100644 examples/l2fwd-macsec/Makefile create mode 100644 examples/l2fwd-macsec/main.c create mode 100644 examples/l2fwd-macsec/meson.build
MAINTAINERS +5 -0
@@ -1869,6 +1869,11 @@ T: git://dpdk.org/next/dpdk-next-eventdev F: examples/l2fwd-event/ F: doc/guides/sample_app_ug/l2_forward_event.rst +L2 forwarding with MACsec example +M: Akhil Goyal <[email protected]> +F: doc/guides/sample_app_ug/l2_forward_macsec.rst +F: examples/l2fwd-macsec/ + L3 forwarding example F: examples/l3fwd/ F: doc/guides/sample_app_ug/l3_forward.rst
doc/guides/rel_notes/release_23_11.rst +5 -0
@@ -249,6 +249,11 @@ New Features Added dispatcher library which purpose is to help decouple different parts (modules) of an eventdev-based application. +* **Added layer 2 MACsec forwarding example application.** + + Added a new example layer 2 forwarding application to benchmark + MACsec encryption/decryption using rte_security based inline sessions. + Removed Items -------------
doc/guides/sample_app_ug/index.rst +1 -0
@@ -26,6 +26,7 @@ Sample Applications User Guides l2_forward_real_virtual l2_forward_event l2_forward_cat + l2_forward_macsec l3_forward l3_forward_graph l3_forward_power_man
doc/guides/sample_app_ug/l2_forward_macsec.rst new file +97 -0
97 lines not on this page · raw message
examples/l2fwd-macsec/Makefile new file +52 -0
52 lines not on this page · raw message
examples/l2fwd-macsec/main.c new file +1570 -0
1,570 lines not on this page · raw message
examples/l2fwd-macsec/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2023 Marvell. + +# meson file, for building this example as part of a main DPDK build. +# +# To build this example as a standalone application with an already-installed +# DPDK instance, use 'make' + +deps += ['security'] +allow_experimental_apis = true +sources = files( + 'main.c', +)
examples/meson.build +1 -0
@@ -29,6 +29,7 @@ all_examples = [ 'l2fwd-event', 'l2fwd-jobstats', 'l2fwd-keepalive', + 'l2fwd-macsec', 'l3fwd', 'l3fwd-graph', 'l3fwd-power',
Signature · 1 line
2.25.1
PATCH v4 1/1 examples/l2fwd-macsec: add MACsec forwarding application
Added a new application based on l2fwd to demonstrate inline protocol offload MACsec performance using rte_security APIs.
Example command:
./dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 -c 0x6 -- -p 0x3 \
--mcs-tx-portmask 0x1 --mcs-rx-portmask 0x2 --mcs-port-config \
'(0,02:03:04:05:06:07,01:02:03:04:05:06), \
(1,02:03:04:05:06:17,01:02:03:04:05:16)'
---
Changes in v4:
- rebased and fixed format specifier.
Changes in v3:
- updated MAINTAINERS
- fixed checkpatch
Changes in v2:
- fixed CentOS compilation
- fixed documentation and added release notes.
MAINTAINERS | 5 + doc/guides/rel_notes/release_23_11.rst | 5 + doc/guides/sample_app_ug/index.rst | 1 + .../sample_app_ug/l2_forward_macsec.rst | 97 + examples/l2fwd-macsec/Makefile | 52 + examples/l2fwd-macsec/main.c | 1570 +++++++++++++++++ examples/l2fwd-macsec/meson.build | 13 + examples/meson.build | 1 + 8 files changed, 1744 insertions(+) create mode 100644 doc/guides/sample_app_ug/l2_forward_macsec.rst create mode 100644 examples/l2fwd-macsec/Makefile create mode 100644 examples/l2fwd-macsec/main.c create mode 100644 examples/l2fwd-macsec/meson.build
MAINTAINERS +5 -0
@@ -1885,6 +1885,11 @@ T: git://dpdk.org/next/dpdk-next-eventdev F: examples/l2fwd-event/ F: doc/guides/sample_app_ug/l2_forward_event.rst +L2 forwarding with MACsec example +M: Akhil Goyal <[email protected]> +F: doc/guides/sample_app_ug/l2_forward_macsec.rst +F: examples/l2fwd-macsec/ + L3 forwarding example F: examples/l3fwd/ F: doc/guides/sample_app_ug/l3_forward.rst
doc/guides/rel_notes/release_23_11.rst +5 -0
@@ -301,6 +301,11 @@ New Features Application provides a framework so that each use case can be added via a file. Each CLI will further be translated into a graph representing the use case. +* **Added layer 2 MACsec forwarding example application.** + + Added a new example layer 2 forwarding application to benchmark + MACsec encryption/decryption using rte_security based inline sessions. + Removed Items -------------
doc/guides/sample_app_ug/index.rst +1 -0
@@ -26,6 +26,7 @@ Sample Applications User Guides l2_forward_real_virtual l2_forward_event l2_forward_cat + l2_forward_macsec l3_forward l3_forward_graph l3_forward_power_man
doc/guides/sample_app_ug/l2_forward_macsec.rst new file +97 -0
97 lines not on this page · raw message
examples/l2fwd-macsec/Makefile new file +52 -0
52 lines not on this page · raw message
examples/l2fwd-macsec/main.c new file +1570 -0
1,570 lines not on this page · raw message
examples/l2fwd-macsec/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2023 Marvell. + +# meson file, for building this example as part of a main DPDK build. +# +# To build this example as a standalone application with an already-installed +# DPDK instance, use 'make' + +deps += ['security'] +allow_experimental_apis = true +sources = files( + 'main.c', +)
examples/meson.build +1 -0
@@ -29,6 +29,7 @@ all_examples = [ 'l2fwd-event', 'l2fwd-jobstats', 'l2fwd-keepalive', + 'l2fwd-macsec', 'l3fwd', 'l3fwd-graph', 'l3fwd-power',
Signature · 1 line
2.25.1
Hi Akhil,
09/11/2023 22:01, Akhil Goyal:
Quoted 2 lines
Added a new application based on l2fwd to demonstrate inline protocol offload MACsec performance using
rte_securityAPIs.
In general we try to avoid adding a new example application. Does this one has been discussed already with the techboard? We need a good justification for an exception.
Why not merging it in l2fwd-crypto?
Quoted 11 lines
Hi Akhil,
09/11/2023 22:01, Akhil Goyal:
Quoted 2 lines
Added a new application based on l2fwd to demonstrate inline protocol offload MACsec performance using
rte_securityAPIs.In general we try to avoid adding a new example application. Does this one has been discussed already with the techboard? We need a good justification for an exception.
Why not merging it in l2fwd-crypto?
L2fwd-crypto is based on rte_crypto sessions and
l2fwd-macsec is based on rte_security session.
We have application for IPsec, and adding a new one for MACsec is also fine in my opinion. We can add more MACsec protocol stuff in the new application in future.
The goal is to have a full-fledged MACsec application like ipsec-secgw.
But while adding in l2fwd-crypto will limit us from adding protocol stuff in it. L2fwd-crypto is a very basic benchmarking application with no
Protocol stuff/checks to get maximum raw crypto performance.
Adding MACsec in it would corrupt its basic nature.
The application is not discussed in techboard
but the patch is there on ML for more than 3 months with no comments. If we have objections, we can push it for next release or else it would be good to add it in current release only.
The patch is pushed to crypto tree for now as we have RC3 deadline today. You may remove the patch while pulling on main.