xref: /dpdk/doc/guides/sample_app_ug/l2_forward_macsec.rst (revision 8750576fb2a9a067ffbcce4bab6481f3bfa47097)
1.. SPDX-License-Identifier: BSD-3-Clause
2   Copyright(C) 2023 Marvell.
3
4L2 Forwarding MACsec Sample Application
5=======================================
6
7The L2 forwarding MACsec application is an example of packet processing
8using the Data Plane Development Kit (DPDK) to encrypt/decrypt packets
9based on rte_security MACsec sessions.
10
11Overview
12--------
13
14The L2 forwarding MACsec application performs L2 forwarding for each packet
15that is received on an Rx port after encrypting/decrypting the packets
16based on rte_security sessions using inline protocol mode.
17
18The destination port is the adjacent port from the enabled portmask
19if the first four ports are enabled (portmask ``0xf``),
20ports 1 and 2 forward into each other, and ports 3 and 4 forward into each other.
21
22This application can be used to benchmark performance using a traffic-generator.
23
24Compiling the Application
25-------------------------
26
27To compile the sample application, see :doc:`compiling`.
28
29The application is located in the ``l2fwd-macsec`` sub-directory.
30
31Running the Application
32-----------------------
33
34The application requires a number of command line options:
35
36.. code-block:: console
37
38   ./<build_dir>/examples/dpdk-l2fwd-macsec [EAL options] -- -p PORTMASK
39       [-q NQ]
40       --mcs-tx-portmask OUTBOUND_PORTMASK
41       --mcs-rx-portmask INBOUND_PORTMASK
42       --mcs-port-config '(port,src_mac,dst_mac)[,(port,src_mac,dst_mac)]'
43       [--portmap="(port, port)[,(port, port)]"]
44       [-T STAT_INTERVAL]
45
46where,
47
48``p PORTMASK``
49  Hexadecimal bitmask of the ports to configure.
50
51``q NQ``
52  Number of queues (=ports) per lcore (default is 1).
53
54``T STAT_INTERVAL``
55  Time interval in seconds for refreshing the stats (default is 1 sec).
56  Value 0 disables stats display.
57
58``--mcs-tx-portmask OUTBOUND_PORTMASK``
59  Hexadecimal bitmask of the ports to configure encryption flows.
60
61``--mcs-rx-portmask INBOUND_PORTMASK``
62  Hexadecimal bitmask of the ports to configure decryption flows.
63
64``--mcs-port-config '(port,src_mac,dst_mac)[,(port,src_mac,dst_mac)]'``
65  Source and destination MAC addresses of incoming packets
66  on a port for which MACsec processing is to be done.
67
68``--portmap="(port,port)[,(port,port)]"``
69  Forwarding ports mapping.
70
71To run the application in Linux environment with 4 lcores,
724 ports with 2 ports for outbound and 2 ports for outbound,
73issue the command:
74
75.. code-block:: console
76
77   $ ./<build_dir>/examples/dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 \
78       -a 0002:06:00.0 -a 0002:07:00.0 -c 0x1E -- -p 0xf                      \
79       --mcs-tx-portmask 0x5 --mcs-rx-portmask 0xA                            \
80       --mcs-port-config '(0,02:03:04:05:06:07,01:02:03:04:05:06),            \
81       (1,02:03:04:05:06:17,01:02:03:04:05:16),                               \
82       (2,02:03:04:05:06:27,01:02:03:04:05:26),                               \
83       (3,02:03:04:05:06:37,01:02:03:04:05:36)' -T 10
84
85To run the application in Linux environment with 4 lcores, 4 ports,
86to forward Rx traffic of ports 0 & 1 on ports 2 & 3 respectively and vice versa,
87issue the command:
88
89.. code-block:: console
90
91   $ ./<build_dir>/examples/dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 \
92       -a 0002:06:00.0 -a 0002:07:00.0 -c 0x1E -- -p 0xf                      \
93       --mcs-tx-portmask 0x5 --mcs-rx-portmask 0xA                            \
94       --mcs-port-config="(0,02:03:04:05:06:07,01:02:03:04:05:06),            \
95       (1,02:03:04:05:06:17,01:02:03:04:05:16),                               \
96       (2,02:03:04:05:06:27,01:02:03:04:05:26),                               \
97       (3,02:03:04:05:06:37,01:02:03:04:05:36)" -T 10                         \
98       --portmap="(0,2)(1,3)"
99
100Refer to the *DPDK Getting Started Guide* for general information on running applications
101and the Environment Abstraction Layer (EAL) options.
102