xref: /dpdk/doc/guides/sample_app_ug/l2_forward_macsec.rst (revision 8750576fb2a9a067ffbcce4bab6481f3bfa47097)
1322ebca6SAkhil Goyal.. SPDX-License-Identifier: BSD-3-Clause
2322ebca6SAkhil Goyal   Copyright(C) 2023 Marvell.
3322ebca6SAkhil Goyal
4322ebca6SAkhil GoyalL2 Forwarding MACsec Sample Application
5322ebca6SAkhil Goyal=======================================
6322ebca6SAkhil Goyal
7*8750576fSNandini PersadThe L2 forwarding MACsec application is an example of packet processing
8*8750576fSNandini Persadusing the Data Plane Development Kit (DPDK) to encrypt/decrypt packets
9322ebca6SAkhil Goyalbased on rte_security MACsec sessions.
10322ebca6SAkhil Goyal
11322ebca6SAkhil GoyalOverview
12322ebca6SAkhil Goyal--------
13322ebca6SAkhil Goyal
14322ebca6SAkhil GoyalThe L2 forwarding MACsec application performs L2 forwarding for each packet
15322ebca6SAkhil Goyalthat is received on an Rx port after encrypting/decrypting the packets
16322ebca6SAkhil Goyalbased on rte_security sessions using inline protocol mode.
17322ebca6SAkhil Goyal
18*8750576fSNandini PersadThe destination port is the adjacent port from the enabled portmask
19322ebca6SAkhil Goyalif the first four ports are enabled (portmask ``0xf``),
20322ebca6SAkhil Goyalports 1 and 2 forward into each other, and ports 3 and 4 forward into each other.
21322ebca6SAkhil Goyal
22322ebca6SAkhil GoyalThis application can be used to benchmark performance using a traffic-generator.
23322ebca6SAkhil Goyal
24322ebca6SAkhil GoyalCompiling the Application
25322ebca6SAkhil Goyal-------------------------
26322ebca6SAkhil Goyal
27*8750576fSNandini PersadTo compile the sample application, see :doc:`compiling`.
28322ebca6SAkhil Goyal
29322ebca6SAkhil GoyalThe application is located in the ``l2fwd-macsec`` sub-directory.
30322ebca6SAkhil Goyal
31322ebca6SAkhil GoyalRunning the Application
32322ebca6SAkhil Goyal-----------------------
33322ebca6SAkhil Goyal
34322ebca6SAkhil GoyalThe application requires a number of command line options:
35322ebca6SAkhil Goyal
36322ebca6SAkhil Goyal.. code-block:: console
37322ebca6SAkhil Goyal
38322ebca6SAkhil Goyal   ./<build_dir>/examples/dpdk-l2fwd-macsec [EAL options] -- -p PORTMASK
39322ebca6SAkhil Goyal       [-q NQ]
40322ebca6SAkhil Goyal       --mcs-tx-portmask OUTBOUND_PORTMASK
41322ebca6SAkhil Goyal       --mcs-rx-portmask INBOUND_PORTMASK
42322ebca6SAkhil Goyal       --mcs-port-config '(port,src_mac,dst_mac)[,(port,src_mac,dst_mac)]'
43322ebca6SAkhil Goyal       [--portmap="(port, port)[,(port, port)]"]
44322ebca6SAkhil Goyal       [-T STAT_INTERVAL]
45322ebca6SAkhil Goyal
46322ebca6SAkhil Goyalwhere,
47322ebca6SAkhil Goyal
48322ebca6SAkhil Goyal``p PORTMASK``
49322ebca6SAkhil Goyal  Hexadecimal bitmask of the ports to configure.
50322ebca6SAkhil Goyal
51322ebca6SAkhil Goyal``q NQ``
52322ebca6SAkhil Goyal  Number of queues (=ports) per lcore (default is 1).
53322ebca6SAkhil Goyal
54322ebca6SAkhil Goyal``T STAT_INTERVAL``
55322ebca6SAkhil Goyal  Time interval in seconds for refreshing the stats (default is 1 sec).
56322ebca6SAkhil Goyal  Value 0 disables stats display.
57322ebca6SAkhil Goyal
58322ebca6SAkhil Goyal``--mcs-tx-portmask OUTBOUND_PORTMASK``
59322ebca6SAkhil Goyal  Hexadecimal bitmask of the ports to configure encryption flows.
60322ebca6SAkhil Goyal
61322ebca6SAkhil Goyal``--mcs-rx-portmask INBOUND_PORTMASK``
62322ebca6SAkhil Goyal  Hexadecimal bitmask of the ports to configure decryption flows.
63322ebca6SAkhil Goyal
64322ebca6SAkhil Goyal``--mcs-port-config '(port,src_mac,dst_mac)[,(port,src_mac,dst_mac)]'``
65322ebca6SAkhil Goyal  Source and destination MAC addresses of incoming packets
66322ebca6SAkhil Goyal  on a port for which MACsec processing is to be done.
67322ebca6SAkhil Goyal
68322ebca6SAkhil Goyal``--portmap="(port,port)[,(port,port)]"``
69322ebca6SAkhil Goyal  Forwarding ports mapping.
70322ebca6SAkhil Goyal
71322ebca6SAkhil GoyalTo run the application in Linux environment with 4 lcores,
72322ebca6SAkhil Goyal4 ports with 2 ports for outbound and 2 ports for outbound,
73322ebca6SAkhil Goyalissue the command:
74322ebca6SAkhil Goyal
75322ebca6SAkhil Goyal.. code-block:: console
76322ebca6SAkhil Goyal
77322ebca6SAkhil Goyal   $ ./<build_dir>/examples/dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 \
78322ebca6SAkhil Goyal       -a 0002:06:00.0 -a 0002:07:00.0 -c 0x1E -- -p 0xf                      \
79322ebca6SAkhil Goyal       --mcs-tx-portmask 0x5 --mcs-rx-portmask 0xA                            \
80322ebca6SAkhil Goyal       --mcs-port-config '(0,02:03:04:05:06:07,01:02:03:04:05:06),            \
81322ebca6SAkhil Goyal       (1,02:03:04:05:06:17,01:02:03:04:05:16),                               \
82322ebca6SAkhil Goyal       (2,02:03:04:05:06:27,01:02:03:04:05:26),                               \
83322ebca6SAkhil Goyal       (3,02:03:04:05:06:37,01:02:03:04:05:36)' -T 10
84322ebca6SAkhil Goyal
85322ebca6SAkhil GoyalTo run the application in Linux environment with 4 lcores, 4 ports,
86322ebca6SAkhil Goyalto forward Rx traffic of ports 0 & 1 on ports 2 & 3 respectively and vice versa,
87322ebca6SAkhil Goyalissue the command:
88322ebca6SAkhil Goyal
89322ebca6SAkhil Goyal.. code-block:: console
90322ebca6SAkhil Goyal
91322ebca6SAkhil Goyal   $ ./<build_dir>/examples/dpdk-l2fwd-macsec -a 0002:04:00.0 -a 0002:05:00.0 \
92322ebca6SAkhil Goyal       -a 0002:06:00.0 -a 0002:07:00.0 -c 0x1E -- -p 0xf                      \
93322ebca6SAkhil Goyal       --mcs-tx-portmask 0x5 --mcs-rx-portmask 0xA                            \
94322ebca6SAkhil Goyal       --mcs-port-config="(0,02:03:04:05:06:07,01:02:03:04:05:06),            \
95322ebca6SAkhil Goyal       (1,02:03:04:05:06:17,01:02:03:04:05:16),                               \
96322ebca6SAkhil Goyal       (2,02:03:04:05:06:27,01:02:03:04:05:26),                               \
97322ebca6SAkhil Goyal       (3,02:03:04:05:06:37,01:02:03:04:05:36)" -T 10                         \
98322ebca6SAkhil Goyal       --portmap="(0,2)(1,3)"
99322ebca6SAkhil Goyal
100322ebca6SAkhil GoyalRefer to the *DPDK Getting Started Guide* for general information on running applications
101322ebca6SAkhil Goyaland the Environment Abstraction Layer (EAL) options.
102