15630257fSFerruh Yigit.. SPDX-License-Identifier: BSD-3-Clause 25630257fSFerruh Yigit Copyright(c) 2016-2017 Intel Corporation. 36118acc2SLukasz Bartosik Copyright (C) 2020 Marvell International Ltd. 4d299106eSSergio Gonzalez Monroy 5d299106eSSergio Gonzalez MonroyIPsec Security Gateway Sample Application 6d299106eSSergio Gonzalez Monroy========================================= 7d299106eSSergio Gonzalez Monroy 8d299106eSSergio Gonzalez MonroyThe IPsec Security Gateway application is an example of a "real world" 9d299106eSSergio Gonzalez Monroyapplication using DPDK cryptodev framework. 10d299106eSSergio Gonzalez Monroy 11d299106eSSergio Gonzalez MonroyOverview 12d299106eSSergio Gonzalez Monroy-------- 13d299106eSSergio Gonzalez Monroy 14d299106eSSergio Gonzalez MonroyThe application demonstrates the implementation of a Security Gateway 15913154efSSergio Gonzalez Monroy(not IPsec compliant, see the Constraints section below) using DPDK based on RFC4301, 16d299106eSSergio Gonzalez MonroyRFC4303, RFC3602 and RFC2404. 17d299106eSSergio Gonzalez Monroy 18d299106eSSergio Gonzalez MonroyInternet Key Exchange (IKE) is not implemented, so only manual setting of 19d299106eSSergio Gonzalez MonroySecurity Policies and Security Associations is supported. 20d299106eSSergio Gonzalez Monroy 21d299106eSSergio Gonzalez MonroyThe Security Policies (SP) are implemented as ACL rules, the Security 22913154efSSergio Gonzalez MonroyAssociations (SA) are stored in a table and the routing is implemented 23d299106eSSergio Gonzalez Monroyusing LPM. 24d299106eSSergio Gonzalez Monroy 25913154efSSergio Gonzalez MonroyThe application classifies the ports as *Protected* and *Unprotected*. 26913154efSSergio Gonzalez MonroyThus, traffic received on an Unprotected or Protected port is consider 27d299106eSSergio Gonzalez MonroyInbound or Outbound respectively. 28d299106eSSergio Gonzalez Monroy 29d629b7b5SJohn McNamaraThe application also supports complete IPsec protocol offload to hardware 30d629b7b5SJohn McNamara(Look aside crypto accelerator or using ethernet device). It also support 31ec17993aSAkhil Goyalinline ipsec processing by the supported ethernet device during transmission. 32ec17993aSAkhil GoyalThese modes can be selected during the SA creation configuration. 33ec17993aSAkhil Goyal 34ec17993aSAkhil GoyalIn case of complete protocol offload, the processing of headers(ESP and outer 35ec17993aSAkhil GoyalIP header) is done by the hardware and the application does not need to 36ec17993aSAkhil Goyaladd/remove them during outbound/inbound processing. 37ec17993aSAkhil Goyal 383de3a041SAnoob JosephFor inline offloaded outbound traffic, the application will not do the LPM 393de3a041SAnoob Josephlookup for routing, as the port on which the packet has to be forwarded will be 403de3a041SAnoob Josephpart of the SA. Security parameters will be configured on that port only, and 413de3a041SAnoob Josephsending the packet on other ports could result in unencrypted packets being 423de3a041SAnoob Josephsent out. 433de3a041SAnoob Joseph 44913154efSSergio Gonzalez MonroyThe Path for IPsec Inbound traffic is: 45d299106eSSergio Gonzalez Monroy 46913154efSSergio Gonzalez Monroy* Read packets from the port. 47d299106eSSergio Gonzalez Monroy* Classify packets between IPv4 and ESP. 48913154efSSergio Gonzalez Monroy* Perform Inbound SA lookup for ESP packets based on their SPI. 49ec17993aSAkhil Goyal* Perform Verification/Decryption (Not needed in case of inline ipsec). 50ec17993aSAkhil Goyal* Remove ESP and outer IP header (Not needed in case of protocol offload). 51913154efSSergio Gonzalez Monroy* Inbound SP check using ACL of decrypted packets and any other IPv4 packets. 52913154efSSergio Gonzalez Monroy* Routing. 53913154efSSergio Gonzalez Monroy* Write packet to port. 54d299106eSSergio Gonzalez Monroy 55913154efSSergio Gonzalez MonroyThe Path for the IPsec Outbound traffic is: 56d299106eSSergio Gonzalez Monroy 57913154efSSergio Gonzalez Monroy* Read packets from the port. 58913154efSSergio Gonzalez Monroy* Perform Outbound SP check using ACL of all IPv4 traffic. 59913154efSSergio Gonzalez Monroy* Perform Outbound SA lookup for packets that need IPsec protection. 60ec17993aSAkhil Goyal* Add ESP and outer IP header (Not needed in case protocol offload). 61ec17993aSAkhil Goyal* Perform Encryption/Digest (Not needed in case of inline ipsec). 62913154efSSergio Gonzalez Monroy* Routing. 63913154efSSergio Gonzalez Monroy* Write packet to port. 64913154efSSergio Gonzalez Monroy 656118acc2SLukasz BartosikThe application supports two modes of operation: poll mode and event mode. 666118acc2SLukasz Bartosik 676118acc2SLukasz Bartosik* In the poll mode a core receives packets from statically configured list 686118acc2SLukasz Bartosik of eth ports and eth ports' queues. 696118acc2SLukasz Bartosik 706118acc2SLukasz Bartosik* In the event mode a core receives packets as events. After packet processing 716118acc2SLukasz Bartosik is done core submits them back as events to an event device. This enables 726118acc2SLukasz Bartosik multicore scaling and HW assisted scheduling by making use of the event device 736118acc2SLukasz Bartosik capabilities. The event mode configuration is predefined. All packets reaching 746118acc2SLukasz Bartosik given eth port will arrive at the same event queue. All event queues are mapped 756118acc2SLukasz Bartosik to all event ports. This allows all cores to receive traffic from all ports. 766118acc2SLukasz Bartosik Since the underlying event device might have varying capabilities, the worker 776118acc2SLukasz Bartosik threads can be drafted differently to maximize performance. For example, if an 786118acc2SLukasz Bartosik event device - eth device pair has Tx internal port, then application can call 796118acc2SLukasz Bartosik rte_event_eth_tx_adapter_enqueue() instead of regular rte_event_enqueue_burst(). 806118acc2SLukasz Bartosik So a thread which assumes that the device pair has internal port will not be the 816118acc2SLukasz Bartosik right solution for another pair. The infrastructure added for the event mode aims 826118acc2SLukasz Bartosik to help application to have multiple worker threads by maximizing performance from 836118acc2SLukasz Bartosik every type of event device without affecting existing paths/use cases. The worker 846118acc2SLukasz Bartosik to be used will be determined by the operating conditions and the underlying device 856938fc92SVolodymyr Fialko capabilities. 866938fc92SVolodymyr Fialko **Currently the application provides non-burst, internal port worker threads.** 876938fc92SVolodymyr Fialko It also provides infrastructure for non-internal port 886938fc92SVolodymyr Fialko however does not define any worker threads. 896118acc2SLukasz Bartosik 9086738ebeSSrujana Challa Event mode also supports event vectorization. The event devices, ethernet device 9186738ebeSSrujana Challa pairs which support the capability ``RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR`` can 9286738ebeSSrujana Challa aggregate packets based on flow characteristics and generate a ``rte_event`` 9386738ebeSSrujana Challa containing ``rte_event_vector``. 9486738ebeSSrujana Challa The aggregation size and timeout can be given using command line options vector-size 9586738ebeSSrujana Challa (default vector-size is 16) and vector-tmo (default vector-tmo is 102400ns). 9686738ebeSSrujana Challa By default event vectorization is disabled and it can be enabled using event-vector 9786738ebeSSrujana Challa option. 981d5078c6SVolodymyr Fialko For the event devices, crypto device pairs which support the capability 991d5078c6SVolodymyr Fialko ``RTE_EVENT_CRYPTO_ADAPTER_CAP_EVENT_VECTOR`` vector aggregation 1001d5078c6SVolodymyr Fialko could also be enable using event-vector option. 10186738ebeSSrujana Challa 1026118acc2SLukasz BartosikAdditionally the event mode introduces two submodes of processing packets: 1036118acc2SLukasz Bartosik 1046118acc2SLukasz Bartosik* Driver submode: This submode has bare minimum changes in the application to support 1056118acc2SLukasz Bartosik IPsec. There are no lookups, no routing done in the application. And for inline 1066118acc2SLukasz Bartosik protocol use case, the worker thread resembles l2fwd worker thread as the IPsec 1076118acc2SLukasz Bartosik processing is done entirely in HW. This mode can be used to benchmark the raw 1086118acc2SLukasz Bartosik performance of the HW. The driver submode is selected with --single-sa option 1099c30a6f3SHenry Nadeau (used also by poll mode). When --single-sa option is used in conjunction with event 1106118acc2SLukasz Bartosik mode then index passed to --single-sa is ignored. 1116118acc2SLukasz Bartosik 1126118acc2SLukasz Bartosik* App submode: This submode has all the features currently implemented with the 1136118acc2SLukasz Bartosik application (non librte_ipsec path). All the lookups, routing follows existing 1146118acc2SLukasz Bartosik methods and report numbers that can be compared against regular poll mode 1156118acc2SLukasz Bartosik benchmark numbers. 116d299106eSSergio Gonzalez Monroy 117d299106eSSergio Gonzalez MonroyConstraints 118d299106eSSergio Gonzalez Monroy----------- 119913154efSSergio Gonzalez Monroy 120913154efSSergio Gonzalez Monroy* No IPv6 options headers. 121913154efSSergio Gonzalez Monroy* No AH mode. 122923b5f27SGagandeep Singh* Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, DES-CBC, 123d05828acSGagandeep Singh HMAC-SHA1, HMAC-SHA256, AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, 124d05828acSGagandeep Singh CHACHA20_POLY1305 and NULL. 125913154efSSergio Gonzalez Monroy* Each SA must be handle by a unique lcore (*1 RX queue per port*). 126913154efSSergio Gonzalez Monroy 127d299106eSSergio Gonzalez MonroyCompiling the Application 128d299106eSSergio Gonzalez Monroy------------------------- 129d299106eSSergio Gonzalez Monroy 1307cacb056SHerakliusz LipiecTo compile the sample application see :doc:`compiling`. 131d299106eSSergio Gonzalez Monroy 13202dc5b7dSKonstantin AnanyevThe application is located in the ``ipsec-secgw`` sub-directory. 133d299106eSSergio Gonzalez Monroy 134913154efSSergio Gonzalez Monroy 135d299106eSSergio Gonzalez MonroyRunning the Application 136d299106eSSergio Gonzalez Monroy----------------------- 137d299106eSSergio Gonzalez Monroy 138913154efSSergio Gonzalez MonroyThe application has a number of command line options:: 139d299106eSSergio Gonzalez Monroy 140d299106eSSergio Gonzalez Monroy 141e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-ipsec-secgw [EAL options] -- 142bbabfe6eSRadu Nicolau -p PORTMASK -P -u PORTMASK -j FRAMESIZE 143376ba686SDavid Marchand -l -w REPLAY_WINDOW_SIZE -e -a 1442cf67788SVladimir Medvedkin -c SAD_CACHE_SIZE 14528008936SRadu Nicolau -t STATISTICS_INTERVAL 1466118acc2SLukasz Bartosik -s NUMBER_OF_MBUFS_IN_PACKET_POOL 1476118acc2SLukasz Bartosik -f CONFIG_FILE_PATH 1486118acc2SLukasz Bartosik --config (port,queue,lcore)[,(port,queue,lcore)] 149913154efSSergio Gonzalez Monroy --single-sa SAIDX 1506118acc2SLukasz Bartosik --cryptodev_mask MASK 1516118acc2SLukasz Bartosik --transfer-mode MODE 1526118acc2SLukasz Bartosik --event-schedule-type TYPE 15303128be4SKonstantin Ananyev --rxoffload MASK 15403128be4SKonstantin Ananyev --txoffload MASK 155b01d1cd2SKonstantin Ananyev --reassemble NUM 1566118acc2SLukasz Bartosik --mtu MTU 1576118acc2SLukasz Bartosik --frag-ttl FRAG_TTL_NS 1585401bdc1SVolodymyr Fialko --desc-nb NUMBER_OF_DESC 159d299106eSSergio Gonzalez Monroy 160913154efSSergio Gonzalez MonroyWhere: 161d299106eSSergio Gonzalez Monroy 162913154efSSergio Gonzalez Monroy* ``-p PORTMASK``: Hexadecimal bitmask of ports to configure. 163d299106eSSergio Gonzalez Monroy 164913154efSSergio Gonzalez Monroy* ``-P``: *optional*. Sets all ports to promiscuous mode so that packets are 165d299106eSSergio Gonzalez Monroy accepted regardless of the packet's Ethernet MAC destination address. 166d299106eSSergio Gonzalez Monroy Without this option, only packets with the Ethernet MAC destination address 167d299106eSSergio Gonzalez Monroy set to the Ethernet address of the port are accepted (default is enabled). 168d299106eSSergio Gonzalez Monroy 169913154efSSergio Gonzalez Monroy* ``-u PORTMASK``: hexadecimal bitmask of unprotected ports 170d299106eSSergio Gonzalez Monroy 171b01d1cd2SKonstantin Ananyev* ``-j FRAMESIZE``: *optional*. data buffer size (in bytes), 172b01d1cd2SKonstantin Ananyev in other words maximum data size for one segment. 173b01d1cd2SKonstantin Ananyev Packets with length bigger then FRAMESIZE still can be received, 174b01d1cd2SKonstantin Ananyev but will be segmented. 175b01d1cd2SKonstantin Ananyev Default value: RTE_MBUF_DEFAULT_BUF_SIZE (2176) 176b01d1cd2SKonstantin Ananyev Minimum value: RTE_MBUF_DEFAULT_BUF_SIZE (2176) 177b01d1cd2SKonstantin Ananyev Maximum value: UINT16_MAX (65535). 178bbabfe6eSRadu Nicolau 17902dc5b7dSKonstantin Ananyev* ``-l``: enables code-path that uses librte_ipsec. 18002dc5b7dSKonstantin Ananyev 181376ba686SDavid Marchand* ``-w REPLAY_WINDOW_SIZE``: specifies the IPsec sequence number replay window 18202dc5b7dSKonstantin Ananyev size for each Security Association (available only with librte_ipsec 18302dc5b7dSKonstantin Ananyev code path). 18402dc5b7dSKonstantin Ananyev 18502dc5b7dSKonstantin Ananyev* ``-e``: enables Security Association extended sequence number processing 18602dc5b7dSKonstantin Ananyev (available only with librte_ipsec code path). 18702dc5b7dSKonstantin Ananyev 188d629b7b5SJohn McNamara* ``-a``: enables Security Association sequence number atomic behavior 18902dc5b7dSKonstantin Ananyev (available only with librte_ipsec code path). 19002dc5b7dSKonstantin Ananyev 1912cf67788SVladimir Medvedkin* ``-c``: specifies the SAD cache size. Stores the most recent SA in a per 1922cf67788SVladimir Medvedkin lcore cache. Cache represents flat array containing SA's indexed by SPI. 1932cf67788SVladimir Medvedkin Zero value disables cache. 1942cf67788SVladimir Medvedkin Default value: 128. 1952cf67788SVladimir Medvedkin 19628008936SRadu Nicolau* ``-t``: specifies the statistics screen update interval in seconds. If set 19728008936SRadu Nicolau to zero or omitted statistics screen is disabled. 19828008936SRadu Nicolau Default value: 0. 19928008936SRadu Nicolau 2006118acc2SLukasz Bartosik* ``-s``: sets number of mbufs in packet pool, if not provided number of mbufs 2016118acc2SLukasz Bartosik will be calculated based on number of cores, eth ports and crypto queues. 202d299106eSSergio Gonzalez Monroy 2036118acc2SLukasz Bartosik* ``-f CONFIG_FILE_PATH``: the full path of text-based file containing all 2046118acc2SLukasz Bartosik configuration items for running the application (See Configuration file 2056118acc2SLukasz Bartosik syntax section below). ``-f CONFIG_FILE_PATH`` **must** be specified. 2066118acc2SLukasz Bartosik **ONLY** the UNIX format configuration file is accepted. 2076118acc2SLukasz Bartosik 2086118acc2SLukasz Bartosik* ``--config (port,queue,lcore)[,(port,queue,lcore)]``: in poll mode determines 2096118acc2SLukasz Bartosik which queues from which ports are mapped to which cores. In event mode this 2106118acc2SLukasz Bartosik option is not used as packets are dynamically scheduled to cores by HW. 2116118acc2SLukasz Bartosik 2126118acc2SLukasz Bartosik* ``--single-sa SAIDX``: in poll mode use a single SA for outbound traffic, 2136118acc2SLukasz Bartosik bypassing the SP on both Inbound and Outbound. This option is meant for 2146118acc2SLukasz Bartosik debugging/performance purposes. In event mode selects driver submode, SA index 2156118acc2SLukasz Bartosik value is ignored. 2166118acc2SLukasz Bartosik 2176118acc2SLukasz Bartosik* ``--cryptodev_mask MASK``: hexadecimal bitmask of the crypto devices 2186118acc2SLukasz Bartosik to configure. 2196118acc2SLukasz Bartosik 2206118acc2SLukasz Bartosik* ``--transfer-mode MODE``: sets operating mode of the application 2216118acc2SLukasz Bartosik "poll" : packet transfer via polling (default) 2226118acc2SLukasz Bartosik "event" : Packet transfer via event device 2236118acc2SLukasz Bartosik 2246118acc2SLukasz Bartosik* ``--event-schedule-type TYPE``: queue schedule type, applies only when 2256118acc2SLukasz Bartosik --transfer-mode is set to event. 2266118acc2SLukasz Bartosik "ordered" : Ordered (default) 2276118acc2SLukasz Bartosik "atomic" : Atomic 2286118acc2SLukasz Bartosik "parallel" : Parallel 2296118acc2SLukasz Bartosik When --event-schedule-type is set as RTE_SCHED_TYPE_ORDERED/ATOMIC, event 2306118acc2SLukasz Bartosik device will ensure the ordering. Ordering will be lost when tried in PARALLEL. 231d299106eSSergio Gonzalez Monroy 23203128be4SKonstantin Ananyev* ``--rxoffload MASK``: RX HW offload capabilities to enable/use on this port 233295968d1SFerruh Yigit (bitmask of RTE_ETH_RX_OFFLOAD_* values). It is an optional parameter and 23403128be4SKonstantin Ananyev allows user to disable some of the RX HW offload capabilities. 23503128be4SKonstantin Ananyev By default all HW RX offloads are enabled. 23603128be4SKonstantin Ananyev 23703128be4SKonstantin Ananyev* ``--txoffload MASK``: TX HW offload capabilities to enable/use on this port 238295968d1SFerruh Yigit (bitmask of RTE_ETH_TX_OFFLOAD_* values). It is an optional parameter and 23903128be4SKonstantin Ananyev allows user to disable some of the TX HW offload capabilities. 24003128be4SKonstantin Ananyev By default all HW TX offloads are enabled. 24103128be4SKonstantin Ananyev 2426118acc2SLukasz Bartosik* ``--reassemble NUM``: max number of entries in reassemble fragment table. 2436118acc2SLukasz Bartosik Zero value disables reassembly functionality. 2446118acc2SLukasz Bartosik Default value: 0. 2456118acc2SLukasz Bartosik 246b01d1cd2SKonstantin Ananyev* ``--mtu MTU``: MTU value (in bytes) on all attached ethernet ports. 247b01d1cd2SKonstantin Ananyev Outgoing packets with length bigger then MTU will be fragmented. 248b01d1cd2SKonstantin Ananyev Incoming packets with length bigger then MTU will be discarded. 249b01d1cd2SKonstantin Ananyev Default value: 1500. 250b01d1cd2SKonstantin Ananyev 251bba1db35SMarcin Smoczynski* ``--frag-ttl FRAG_TTL_NS``: fragment lifetime (in nanoseconds). 252bba1db35SMarcin Smoczynski If packet is not reassembled within this time, received fragments 253bba1db35SMarcin Smoczynski will be discarded. Fragment lifetime should be decreased when 254bba1db35SMarcin Smoczynski there is a high fragmented traffic loss in high bandwidth networks. 255f43d3dbbSDavid Marchand Should be lower for low number of reassembly buckets. 256bba1db35SMarcin Smoczynski Valid values: from 1 ns to 10 s. Default value: 10000000 (10 s). 257bba1db35SMarcin Smoczynski 25848a39871SNithin Dabilpuram* ``--per-port-pool``: Enable per ethdev port pktmbuf pool. 25948a39871SNithin Dabilpuram By default one packet mbuf pool per socket is created and configured 26048a39871SNithin Dabilpuram via Rx queue setup. 26148a39871SNithin Dabilpuram 26248a39871SNithin Dabilpuram* ``--vector-pool-sz``: Number of buffers in vector pool. 26348a39871SNithin Dabilpuram By default, vector pool size depeneds on packet pool size 26448a39871SNithin Dabilpuram and size of each vector. 265d299106eSSergio Gonzalez Monroy 2665401bdc1SVolodymyr Fialko* ``--desc-nb NUMBER_OF_DESC``: Number of descriptors per queue pair. 2675401bdc1SVolodymyr Fialko Default value: 2048. 2685401bdc1SVolodymyr Fialko 269d299106eSSergio Gonzalez MonroyThe mapping of lcores to port/queues is similar to other l3fwd applications. 270d299106eSSergio Gonzalez Monroy 2716118acc2SLukasz BartosikFor example, given the following command line to run application in poll mode:: 272d299106eSSergio Gonzalez Monroy 273e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-ipsec-secgw -l 20,21 -n 4 --socket-mem 0,2048 \ 27430883f3eSPablo de Lara --vdev "crypto_null" -- -p 0xf -P -u 0x3 \ 2750d547ed0SFan Zhang --config="(0,0,20),(1,0,20),(2,0,21),(3,0,21)" \ 2766118acc2SLukasz Bartosik -f /path/to/config_file --transfer-mode poll \ 277d299106eSSergio Gonzalez Monroy 2786118acc2SLukasz Bartosikwhere each option means: 279d299106eSSergio Gonzalez Monroy 280913154efSSergio Gonzalez Monroy* The ``-l`` option enables cores 20 and 21. 281d299106eSSergio Gonzalez Monroy 282913154efSSergio Gonzalez Monroy* The ``-n`` option sets memory 4 channels. 283d299106eSSergio Gonzalez Monroy 284913154efSSergio Gonzalez Monroy* The ``--socket-mem`` to use 2GB on socket 1. 285d299106eSSergio Gonzalez Monroy 28630883f3eSPablo de Lara* The ``--vdev "crypto_null"`` option creates virtual NULL cryptodev PMD. 287d299106eSSergio Gonzalez Monroy 288913154efSSergio Gonzalez Monroy* The ``-p`` option enables ports (detected) 0, 1, 2 and 3. 289d299106eSSergio Gonzalez Monroy 290913154efSSergio Gonzalez Monroy* The ``-P`` option enables promiscuous mode. 291d299106eSSergio Gonzalez Monroy 2926118acc2SLukasz Bartosik* The ``-u`` option sets ports 0 and 1 as unprotected, leaving 2 and 3 as protected. 293d299106eSSergio Gonzalez Monroy 294913154efSSergio Gonzalez Monroy* The ``--config`` option enables one queue per port with the following mapping: 295d299106eSSergio Gonzalez Monroy 296d299106eSSergio Gonzalez Monroy +----------+-----------+-----------+---------------------------------------+ 297d299106eSSergio Gonzalez Monroy | **Port** | **Queue** | **lcore** | **Description** | 298d299106eSSergio Gonzalez Monroy | | | | | 299d299106eSSergio Gonzalez Monroy +----------+-----------+-----------+---------------------------------------+ 300d299106eSSergio Gonzalez Monroy | 0 | 0 | 20 | Map queue 0 from port 0 to lcore 20. | 301d299106eSSergio Gonzalez Monroy | | | | | 302d299106eSSergio Gonzalez Monroy +----------+-----------+-----------+---------------------------------------+ 303d299106eSSergio Gonzalez Monroy | 1 | 0 | 20 | Map queue 0 from port 1 to lcore 20. | 304d299106eSSergio Gonzalez Monroy | | | | | 305d299106eSSergio Gonzalez Monroy +----------+-----------+-----------+---------------------------------------+ 306d299106eSSergio Gonzalez Monroy | 2 | 0 | 21 | Map queue 0 from port 2 to lcore 21. | 307d299106eSSergio Gonzalez Monroy | | | | | 308d299106eSSergio Gonzalez Monroy +----------+-----------+-----------+---------------------------------------+ 309d299106eSSergio Gonzalez Monroy | 3 | 0 | 21 | Map queue 0 from port 3 to lcore 21. | 310d299106eSSergio Gonzalez Monroy | | | | | 311d299106eSSergio Gonzalez Monroy +----------+-----------+-----------+---------------------------------------+ 312d299106eSSergio Gonzalez Monroy 3130d547ed0SFan Zhang* The ``-f /path/to/config_file`` option enables the application read and 3140d547ed0SFan Zhang parse the configuration file specified, and configures the application 3150d547ed0SFan Zhang with a given set of SP, SA and Routing entries accordingly. The syntax of 3160d547ed0SFan Zhang the configuration file will be explained below in more detail. Please 3170d547ed0SFan Zhang **note** the parser only accepts UNIX format text file. Other formats 3180d547ed0SFan Zhang such as DOS/MAC format will cause a parse error. 319d299106eSSergio Gonzalez Monroy 3206118acc2SLukasz Bartosik* The ``--transfer-mode`` option selects poll mode for processing packets. 3216118acc2SLukasz Bartosik 3226118acc2SLukasz BartosikSimilarly for example, given the following command line to run application in 3236118acc2SLukasz Bartosikevent app mode:: 3246118acc2SLukasz Bartosik 325e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-ipsec-secgw -c 0x3 -- -P -p 0x3 -u 0x1 \ 3266118acc2SLukasz Bartosik -f /path/to/config_file --transfer-mode event \ 32786738ebeSSrujana Challa --event-schedule-type parallel --event-vector --vector-size 32 \ 32886738ebeSSrujana Challa --vector-tmo 102400 \ 3296118acc2SLukasz Bartosik 3306118acc2SLukasz Bartosikwhere each option means: 3316118acc2SLukasz Bartosik 3326118acc2SLukasz Bartosik* The ``-c`` option selects cores 0 and 1 to run on. 3336118acc2SLukasz Bartosik 3346118acc2SLukasz Bartosik* The ``-P`` option enables promiscuous mode. 3356118acc2SLukasz Bartosik 3366118acc2SLukasz Bartosik* The ``-p`` option enables ports (detected) 0 and 1. 3376118acc2SLukasz Bartosik 3386118acc2SLukasz Bartosik* The ``-u`` option sets ports 0 as unprotected, leaving 1 as protected. 3396118acc2SLukasz Bartosik 3406118acc2SLukasz Bartosik* The ``-f /path/to/config_file`` option has the same behavior as in poll 3416118acc2SLukasz Bartosik mode example. 3426118acc2SLukasz Bartosik 3436118acc2SLukasz Bartosik* The ``--transfer-mode`` option selects event mode for processing packets. 3446118acc2SLukasz Bartosik 3456118acc2SLukasz Bartosik* The ``--event-schedule-type`` option selects parallel ordering of event queues. 3466118acc2SLukasz Bartosik 34786738ebeSSrujana Challa* The ``--event-vector`` option enables event vectorization. 34886738ebeSSrujana Challa 34986738ebeSSrujana Challa* The ``--vector-size`` option specifies max vector size. 35086738ebeSSrujana Challa 35186738ebeSSrujana Challa* The ``--vector-tmo`` option specifies max timeout in nanoseconds for vectorization. 35286738ebeSSrujana Challa 3536118acc2SLukasz Bartosik 354d299106eSSergio Gonzalez MonroyRefer to the *DPDK Getting Started Guide* for general information on running 355d299106eSSergio Gonzalez Monroyapplications and the Environment Abstraction Layer (EAL) options. 356d299106eSSergio Gonzalez Monroy 357d299106eSSergio Gonzalez MonroyThe application would do a best effort to "map" crypto devices to cores, with 358913154efSSergio Gonzalez Monroyhardware devices having priority. Basically, hardware devices if present would 359913154efSSergio Gonzalez Monroybe assigned to a core before software ones. 360d299106eSSergio Gonzalez MonroyThis means that if the application is using a single core and both hardware 361d299106eSSergio Gonzalez Monroyand software crypto devices are detected, hardware devices will be used. 362d299106eSSergio Gonzalez Monroy 3638d257235SJohn McNamaraA way to achieve the case where you want to force the use of virtual crypto 364db27370bSStephen Hemmingerdevices is to only use the Ethernet devices needed (via the allow flag) 365db27370bSStephen Hemmingerand therefore implicitly blocking all hardware crypto devices. 366d299106eSSergio Gonzalez Monroy 367d299106eSSergio Gonzalez MonroyFor example, something like the following command line: 368d299106eSSergio Gonzalez Monroy 369d299106eSSergio Gonzalez Monroy.. code-block:: console 370d299106eSSergio Gonzalez Monroy 371e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-ipsec-secgw -l 20,21 -n 4 --socket-mem 0,2048 \ 372db27370bSStephen Hemminger -a 81:00.0 -a 81:00.1 -a 81:00.2 -a 81:00.3 \ 37330883f3eSPablo de Lara --vdev "crypto_aesni_mb" --vdev "crypto_null" \ 374913154efSSergio Gonzalez Monroy -- \ 375913154efSSergio Gonzalez Monroy -p 0xf -P -u 0x3 --config="(0,0,20),(1,0,20),(2,0,21),(3,0,21)" \ 3760d547ed0SFan Zhang -f sample.cfg 377d299106eSSergio Gonzalez Monroy 378913154efSSergio Gonzalez Monroy 379d299106eSSergio Gonzalez MonroyConfigurations 380d299106eSSergio Gonzalez Monroy-------------- 381d299106eSSergio Gonzalez Monroy 3820d547ed0SFan ZhangThe following sections provide the syntax of configurations to initialize 3838e693616SAnoob Josephyour SP, SA, Routing, Flow and Neighbour tables. 3840d547ed0SFan ZhangConfigurations shall be specified in the configuration file to be passed to 3850d547ed0SFan Zhangthe application. The file is then parsed by the application. The successful 3860d547ed0SFan Zhangparsing will result in the appropriate rules being applied to the tables 3870d547ed0SFan Zhangaccordingly. 388913154efSSergio Gonzalez Monroy 389d299106eSSergio Gonzalez Monroy 3900d547ed0SFan ZhangConfiguration File Syntax 39102dc5b7dSKonstantin Ananyev~~~~~~~~~~~~~~~~~~~~~~~~~ 392d299106eSSergio Gonzalez Monroy 393d299106eSSergio Gonzalez MonroyAs mention in the overview, the Security Policies are ACL rules. 3940d547ed0SFan ZhangThe application parsers the rules specified in the configuration file and 3950d547ed0SFan Zhangpasses them to the ACL table, and replicates them per socket in use. 396d299106eSSergio Gonzalez Monroy 3970d547ed0SFan ZhangFollowing are the configuration file syntax. 398d299106eSSergio Gonzalez Monroy 3990d547ed0SFan ZhangGeneral rule syntax 4000d547ed0SFan Zhang^^^^^^^^^^^^^^^^^^^ 401d299106eSSergio Gonzalez Monroy 4020d547ed0SFan ZhangThe parse treats one line in the configuration file as one configuration 4030d547ed0SFan Zhangitem (unless the line concatenation symbol exists). Every configuration 4048e693616SAnoob Josephitem shall follow the syntax of either SP, SA, Routing, Flow or Neighbour 4057622291bSKonstantin Ananyevrules specified below. 406d299106eSSergio Gonzalez Monroy 4070d547ed0SFan ZhangThe configuration parser supports the following special symbols: 408d299106eSSergio Gonzalez Monroy 4090d547ed0SFan Zhang * Comment symbol **#**. Any character from this symbol to the end of 4100d547ed0SFan Zhang line is treated as comment and will not be parsed. 411d299106eSSergio Gonzalez Monroy 4120d547ed0SFan Zhang * Line concatenation symbol **\\**. This symbol shall be placed in the end 4130d547ed0SFan Zhang of the line to be concatenated to the line below. Multiple lines' 4140d547ed0SFan Zhang concatenation is supported. 415d299106eSSergio Gonzalez Monroy 416d299106eSSergio Gonzalez Monroy 4170d547ed0SFan ZhangSP rule syntax 4180d547ed0SFan Zhang^^^^^^^^^^^^^^ 419d299106eSSergio Gonzalez Monroy 4200d547ed0SFan ZhangThe SP rule syntax is shown as follows: 421d299106eSSergio Gonzalez Monroy 4220d547ed0SFan Zhang.. code-block:: console 423d299106eSSergio Gonzalez Monroy 4240d547ed0SFan Zhang sp <ip_ver> <dir> esp <action> <priority> <src_ip> <dst_ip> 4250d547ed0SFan Zhang <proto> <sport> <dport> 426d299106eSSergio Gonzalez Monroy 427d299106eSSergio Gonzalez Monroy 4280d547ed0SFan Zhangwhere each options means: 429d299106eSSergio Gonzalez Monroy 4300d547ed0SFan Zhang``<ip_ver>`` 431d299106eSSergio Gonzalez Monroy 4320d547ed0SFan Zhang * IP protocol version 433d299106eSSergio Gonzalez Monroy 4340d547ed0SFan Zhang * Optional: No 435913154efSSergio Gonzalez Monroy 4360d547ed0SFan Zhang * Available options: 437d299106eSSergio Gonzalez Monroy 4380d547ed0SFan Zhang * *ipv4*: IP protocol version 4 4390d547ed0SFan Zhang * *ipv6*: IP protocol version 6 440d299106eSSergio Gonzalez Monroy 4410d547ed0SFan Zhang``<dir>`` 442913154efSSergio Gonzalez Monroy 4430d547ed0SFan Zhang * The traffic direction 444d299106eSSergio Gonzalez Monroy 4450d547ed0SFan Zhang * Optional: No 4460d547ed0SFan Zhang 4470d547ed0SFan Zhang * Available options: 4480d547ed0SFan Zhang 4490d547ed0SFan Zhang * *in*: inbound traffic 4500d547ed0SFan Zhang * *out*: outbound traffic 4510d547ed0SFan Zhang 4520d547ed0SFan Zhang``<action>`` 4530d547ed0SFan Zhang 4540d547ed0SFan Zhang * IPsec action 4550d547ed0SFan Zhang 4560d547ed0SFan Zhang * Optional: No 4570d547ed0SFan Zhang 4580d547ed0SFan Zhang * Available options: 4590d547ed0SFan Zhang 4600d547ed0SFan Zhang * *protect <SA_idx>*: the specified traffic is protected by SA rule 4610d547ed0SFan Zhang with id SA_idx 4624f823975SThomas Monjalon * *bypass*: the specified traffic is bypassed 4630d547ed0SFan Zhang * *discard*: the specified traffic is discarded 4640d547ed0SFan Zhang 4650d547ed0SFan Zhang``<priority>`` 4660d547ed0SFan Zhang 4670d547ed0SFan Zhang * Rule priority 4680d547ed0SFan Zhang 4690d547ed0SFan Zhang * Optional: Yes, default priority 0 will be used 4700d547ed0SFan Zhang 4710d547ed0SFan Zhang * Syntax: *pri <id>* 4720d547ed0SFan Zhang 4730d547ed0SFan Zhang``<src_ip>`` 4740d547ed0SFan Zhang 4750d547ed0SFan Zhang * The source IP address and mask 4760d547ed0SFan Zhang 4770d547ed0SFan Zhang * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used 4780d547ed0SFan Zhang 4790d547ed0SFan Zhang * Syntax: 4800d547ed0SFan Zhang 4810d547ed0SFan Zhang * *src X.X.X.X/Y* for IPv4 4820d547ed0SFan Zhang * *src XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6 4830d547ed0SFan Zhang 4840d547ed0SFan Zhang``<dst_ip>`` 4850d547ed0SFan Zhang 4860d547ed0SFan Zhang * The destination IP address and mask 4870d547ed0SFan Zhang 4880d547ed0SFan Zhang * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used 4890d547ed0SFan Zhang 4900d547ed0SFan Zhang * Syntax: 4910d547ed0SFan Zhang 4920d547ed0SFan Zhang * *dst X.X.X.X/Y* for IPv4 4930d547ed0SFan Zhang * *dst XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6 4940d547ed0SFan Zhang 4950d547ed0SFan Zhang``<proto>`` 4960d547ed0SFan Zhang 4970d547ed0SFan Zhang * The protocol start and end range 4980d547ed0SFan Zhang 4990d547ed0SFan Zhang * Optional: yes, default range of 0 to 0 will be used 5000d547ed0SFan Zhang 5010d547ed0SFan Zhang * Syntax: *proto X:Y* 5020d547ed0SFan Zhang 5030d547ed0SFan Zhang``<sport>`` 5040d547ed0SFan Zhang 5050d547ed0SFan Zhang * The source port start and end range 5060d547ed0SFan Zhang 5070d547ed0SFan Zhang * Optional: yes, default range of 0 to 0 will be used 5080d547ed0SFan Zhang 5090d547ed0SFan Zhang * Syntax: *sport X:Y* 5100d547ed0SFan Zhang 5110d547ed0SFan Zhang``<dport>`` 5120d547ed0SFan Zhang 5130d547ed0SFan Zhang * The destination port start and end range 5140d547ed0SFan Zhang 5150d547ed0SFan Zhang * Optional: yes, default range of 0 to 0 will be used 5160d547ed0SFan Zhang 5170d547ed0SFan Zhang * Syntax: *dport X:Y* 5180d547ed0SFan Zhang 5190d547ed0SFan ZhangExample SP rules: 5200d547ed0SFan Zhang 5210d547ed0SFan Zhang.. code-block:: console 5220d547ed0SFan Zhang 5230d547ed0SFan Zhang sp ipv4 out esp protect 105 pri 1 dst 192.168.115.0/24 sport 0:65535 \ 5240d547ed0SFan Zhang dport 0:65535 5250d547ed0SFan Zhang 5260d547ed0SFan Zhang sp ipv6 in esp bypass pri 1 dst 0000:0000:0000:0000:5555:5555:\ 5270d547ed0SFan Zhang 0000:0000/96 sport 0:65535 dport 0:65535 5280d547ed0SFan Zhang 5290d547ed0SFan Zhang 5300d547ed0SFan ZhangSA rule syntax 5310d547ed0SFan Zhang^^^^^^^^^^^^^^ 5320d547ed0SFan Zhang 5330d547ed0SFan ZhangThe successfully parsed SA rules will be stored in an array table. 5340d547ed0SFan Zhang 5350d547ed0SFan ZhangThe SA rule syntax is shown as follows: 5360d547ed0SFan Zhang 5370d547ed0SFan Zhang.. code-block:: console 5380d547ed0SFan Zhang 5390d547ed0SFan Zhang sa <dir> <spi> <cipher_algo> <cipher_key> <auth_algo> <auth_key> 540ba66534fSMarcin Smoczynski <mode> <src_ip> <dst_ip> <action_type> <port_id> <fallback> 541d8d51d4fSRahul Bhansali <flow-direction> <port_id> <queue_id> <udp-encap> <reassembly_en> 5420d547ed0SFan Zhang 5430d547ed0SFan Zhangwhere each options means: 5440d547ed0SFan Zhang 5450d547ed0SFan Zhang``<dir>`` 5460d547ed0SFan Zhang 5470d547ed0SFan Zhang * The traffic direction 5480d547ed0SFan Zhang 5490d547ed0SFan Zhang * Optional: No 5500d547ed0SFan Zhang 5510d547ed0SFan Zhang * Available options: 5520d547ed0SFan Zhang 5530d547ed0SFan Zhang * *in*: inbound traffic 5540d547ed0SFan Zhang * *out*: outbound traffic 5550d547ed0SFan Zhang 5560d547ed0SFan Zhang``<spi>`` 5570d547ed0SFan Zhang 5580d547ed0SFan Zhang * The SPI number 5590d547ed0SFan Zhang 5600d547ed0SFan Zhang * Optional: No 5610d547ed0SFan Zhang 5620d547ed0SFan Zhang * Syntax: unsigned integer number 5630d547ed0SFan Zhang 5640d547ed0SFan Zhang``<cipher_algo>`` 5650d547ed0SFan Zhang 5660d547ed0SFan Zhang * Cipher algorithm 5670d547ed0SFan Zhang 568501e9c22SPablo de Lara * Optional: Yes, unless <aead_algo> is not used 5690d547ed0SFan Zhang 5700d547ed0SFan Zhang * Available options: 5710d547ed0SFan Zhang 5720d547ed0SFan Zhang * *null*: NULL algorithm 5730d547ed0SFan Zhang * *aes-128-cbc*: AES-CBC 128-bit algorithm 574a8af994bSAnoob Joseph * *aes-192-cbc*: AES-CBC 192-bit algorithm 575fa908884SAnoob Joseph * *aes-256-cbc*: AES-CBC 256-bit algorithm 5764470c22dSSergio Gonzalez Monroy * *aes-128-ctr*: AES-CTR 128-bit algorithm 5771bc489caSHemant Agrawal * *3des-cbc*: 3DES-CBC 192-bit algorithm 578923b5f27SGagandeep Singh * *des-cbc*: DES-CBC 64-bit algorithm 5790d547ed0SFan Zhang 5800d547ed0SFan Zhang * Syntax: *cipher_algo <your algorithm>* 5810d547ed0SFan Zhang 5820d547ed0SFan Zhang``<cipher_key>`` 5830d547ed0SFan Zhang 5840d547ed0SFan Zhang * Cipher key, NOT available when 'null' algorithm is used 5850d547ed0SFan Zhang 586501e9c22SPablo de Lara * Optional: Yes, unless <aead_algo> is not used. 587501e9c22SPablo de Lara Must be followed by <cipher_algo> option 5880d547ed0SFan Zhang 5890d547ed0SFan Zhang * Syntax: Hexadecimal bytes (0x0-0xFF) concatenate by colon symbol ':'. 5900d547ed0SFan Zhang The number of bytes should be as same as the specified cipher algorithm 5910d547ed0SFan Zhang key size. 5920d547ed0SFan Zhang 5930d547ed0SFan Zhang For example: *cipher_key A1:B2:C3:D4:A1:B2:C3:D4:A1:B2:C3:D4: 5940d547ed0SFan Zhang A1:B2:C3:D4* 5950d547ed0SFan Zhang 5960d547ed0SFan Zhang``<auth_algo>`` 5970d547ed0SFan Zhang 5980d547ed0SFan Zhang * Authentication algorithm 5990d547ed0SFan Zhang 600501e9c22SPablo de Lara * Optional: Yes, unless <aead_algo> is not used 6010d547ed0SFan Zhang 6020d547ed0SFan Zhang * Available options: 6030d547ed0SFan Zhang 6040d547ed0SFan Zhang * *null*: NULL algorithm 6050d547ed0SFan Zhang * *sha1-hmac*: HMAC SHA1 algorithm 606d05828acSGagandeep Singh * *sha256-hmac*: HMAC SHA256 algorithm 607923b5f27SGagandeep Singh * *aes-xcbc-mac*: AES XCBC MAC algorithm 6080d547ed0SFan Zhang 6090d547ed0SFan Zhang``<auth_key>`` 6100d547ed0SFan Zhang 611a9121c40SSergio Gonzalez Monroy * Authentication key, NOT available when 'null' or 'aes-128-gcm' algorithm 612a9121c40SSergio Gonzalez Monroy is used. 6130d547ed0SFan Zhang 614501e9c22SPablo de Lara * Optional: Yes, unless <aead_algo> is not used. 615501e9c22SPablo de Lara Must be followed by <auth_algo> option 6160d547ed0SFan Zhang 6170d547ed0SFan Zhang * Syntax: Hexadecimal bytes (0x0-0xFF) concatenate by colon symbol ':'. 6180d547ed0SFan Zhang The number of bytes should be as same as the specified authentication 6190d547ed0SFan Zhang algorithm key size. 6200d547ed0SFan Zhang 6210d547ed0SFan Zhang For example: *auth_key A1:B2:C3:D4:A1:B2:C3:D4:A1:B2:C3:D4:A1:B2:C3:D4: 6220d547ed0SFan Zhang A1:B2:C3:D4* 6230d547ed0SFan Zhang 624501e9c22SPablo de Lara``<aead_algo>`` 625501e9c22SPablo de Lara 626501e9c22SPablo de Lara * AEAD algorithm 627501e9c22SPablo de Lara 628501e9c22SPablo de Lara * Optional: Yes, unless <cipher_algo> and <auth_algo> are not used 629501e9c22SPablo de Lara 630b79e4c00SPablo de Lara * Available options: 631b79e4c00SPablo de Lara 632b79e4c00SPablo de Lara * *aes-128-gcm*: AES-GCM 128-bit algorithm 633a8af994bSAnoob Joseph * *aes-192-gcm*: AES-GCM 192-bit algorithm 634a8af994bSAnoob Joseph * *aes-256-gcm*: AES-GCM 256-bit algorithm 635b79e4c00SPablo de Lara 636501e9c22SPablo de Lara * Syntax: *cipher_algo <your algorithm>* 637501e9c22SPablo de Lara 638501e9c22SPablo de Lara``<aead_key>`` 639501e9c22SPablo de Lara 640501e9c22SPablo de Lara * Cipher key, NOT available when 'null' algorithm is used 641501e9c22SPablo de Lara 642501e9c22SPablo de Lara * Optional: Yes, unless <cipher_algo> and <auth_algo> are not used. 643501e9c22SPablo de Lara Must be followed by <aead_algo> option 644501e9c22SPablo de Lara 645501e9c22SPablo de Lara * Syntax: Hexadecimal bytes (0x0-0xFF) concatenate by colon symbol ':'. 646a8af994bSAnoob Joseph Last 4 bytes of the provided key will be used as 'salt' and so, the 647a8af994bSAnoob Joseph number of bytes should be same as the sum of specified AEAD algorithm 648a8af994bSAnoob Joseph key size and salt size (4 bytes). 649501e9c22SPablo de Lara 650501e9c22SPablo de Lara For example: *aead_key A1:B2:C3:D4:A1:B2:C3:D4:A1:B2:C3:D4: 651a8af994bSAnoob Joseph A1:B2:C3:D4:A1:B2:C3:D4* 652501e9c22SPablo de Lara 6530d547ed0SFan Zhang``<mode>`` 6540d547ed0SFan Zhang 6550d547ed0SFan Zhang * The operation mode 6560d547ed0SFan Zhang 6570d547ed0SFan Zhang * Optional: No 6580d547ed0SFan Zhang 6590d547ed0SFan Zhang * Available options: 6600d547ed0SFan Zhang 6610d547ed0SFan Zhang * *ipv4-tunnel*: Tunnel mode for IPv4 packets 6620d547ed0SFan Zhang * *ipv6-tunnel*: Tunnel mode for IPv6 packets 6630d547ed0SFan Zhang * *transport*: transport mode 6640d547ed0SFan Zhang 6650d547ed0SFan Zhang * Syntax: mode XXX 6660d547ed0SFan Zhang 6670d547ed0SFan Zhang``<src_ip>`` 6680d547ed0SFan Zhang 6690d547ed0SFan Zhang * The source IP address. This option is not available when 6700d547ed0SFan Zhang transport mode is used 6710d547ed0SFan Zhang 6720d547ed0SFan Zhang * Optional: Yes, default address 0.0.0.0 will be used 6730d547ed0SFan Zhang 6740d547ed0SFan Zhang * Syntax: 6750d547ed0SFan Zhang 6760d547ed0SFan Zhang * *src X.X.X.X* for IPv4 6770d547ed0SFan Zhang * *src XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX* for IPv6 6780d547ed0SFan Zhang 6790d547ed0SFan Zhang``<dst_ip>`` 6800d547ed0SFan Zhang 6810d547ed0SFan Zhang * The destination IP address. This option is not available when 6820d547ed0SFan Zhang transport mode is used 6830d547ed0SFan Zhang 6840d547ed0SFan Zhang * Optional: Yes, default address 0.0.0.0 will be used 6850d547ed0SFan Zhang 6860d547ed0SFan Zhang * Syntax: 6870d547ed0SFan Zhang 6880d547ed0SFan Zhang * *dst X.X.X.X* for IPv4 6890d547ed0SFan Zhang * *dst XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX* for IPv6 6900d547ed0SFan Zhang 691ec17993aSAkhil Goyal``<type>`` 692ec17993aSAkhil Goyal 693ec17993aSAkhil Goyal * Action type to specify the security action. This option specify 694ec17993aSAkhil Goyal the SA to be performed with look aside protocol offload to HW 695ec17993aSAkhil Goyal accelerator or protocol offload on ethernet device or inline 696ec17993aSAkhil Goyal crypto processing on the ethernet device during transmission. 697ec17993aSAkhil Goyal 698ec17993aSAkhil Goyal * Optional: Yes, default type *no-offload* 699ec17993aSAkhil Goyal 700ec17993aSAkhil Goyal * Available options: 701ec17993aSAkhil Goyal 702ec17993aSAkhil Goyal * *lookaside-protocol-offload*: look aside protocol offload to HW accelerator 703ec17993aSAkhil Goyal * *inline-protocol-offload*: inline protocol offload on ethernet device 704ec17993aSAkhil Goyal * *inline-crypto-offload*: inline crypto processing on ethernet device 705ec17993aSAkhil Goyal * *no-offload*: no offloading to hardware 706ec17993aSAkhil Goyal 707ec17993aSAkhil Goyal ``<port_id>`` 708ec17993aSAkhil Goyal 709ec17993aSAkhil Goyal * Port/device ID of the ethernet/crypto accelerator for which the SA is 7103de3a041SAnoob Joseph configured. For *inline-crypto-offload* and *inline-protocol-offload*, this 7113de3a041SAnoob Joseph port will be used for routing. The routing table will not be referred in 7123de3a041SAnoob Joseph this case. 713ec17993aSAkhil Goyal 714ec17993aSAkhil Goyal * Optional: No, if *type* is not *no-offload* 715ec17993aSAkhil Goyal 716ec17993aSAkhil Goyal * Syntax: 717ec17993aSAkhil Goyal 718ec17993aSAkhil Goyal * *port_id X* X is a valid device number in decimal 719ec17993aSAkhil Goyal 720ba66534fSMarcin Smoczynski ``<fallback>`` 721ba66534fSMarcin Smoczynski 722ba66534fSMarcin Smoczynski * Action type for ingress IPsec packets that inline processor failed to 723ba66534fSMarcin Smoczynski process. Only a combination of *inline-crypto-offload* as a primary 724ba66534fSMarcin Smoczynski session and *lookaside-none* as a fall-back session is supported at the 725ba66534fSMarcin Smoczynski moment. 726ba66534fSMarcin Smoczynski 727ba66534fSMarcin Smoczynski If used in conjunction with IPsec window, its width needs be increased 728ba66534fSMarcin Smoczynski due to different processing times of inline and lookaside modes which 729ba66534fSMarcin Smoczynski results in packet reordering. 730ba66534fSMarcin Smoczynski 731ba66534fSMarcin Smoczynski * Optional: Yes. 732ba66534fSMarcin Smoczynski 733ba66534fSMarcin Smoczynski * Available options: 734ba66534fSMarcin Smoczynski 735ba66534fSMarcin Smoczynski * *lookaside-none*: use automatically chosen cryptodev to process packets 736ba66534fSMarcin Smoczynski 737ba66534fSMarcin Smoczynski * Syntax: 738ba66534fSMarcin Smoczynski 739ba66534fSMarcin Smoczynski * *fallback lookaside-none* 740ec17993aSAkhil Goyal 7416738c0a9SPraveen Shetty``<flow-direction>`` 7426738c0a9SPraveen Shetty 7436738c0a9SPraveen Shetty * Option for redirecting a specific inbound ipsec flow of a port to a specific 7446738c0a9SPraveen Shetty queue of that port. 7456738c0a9SPraveen Shetty 7466738c0a9SPraveen Shetty * Optional: Yes. 7476738c0a9SPraveen Shetty 7486738c0a9SPraveen Shetty * Available options: 7496738c0a9SPraveen Shetty 7506738c0a9SPraveen Shetty * *port_id*: Port ID of the NIC for which the SA is configured. 7516738c0a9SPraveen Shetty * *queue_id*: Queue ID to which traffic should be redirected. 7526738c0a9SPraveen Shetty 7539a1cc8f1STejasree Kondoj ``<udp-encap>`` 7549a1cc8f1STejasree Kondoj 7559a1cc8f1STejasree Kondoj * Option to enable IPsec UDP encapsulation for NAT Traversal. 7569ae86b4cSRadu Nicolau Only *lookaside-protocol-offload* and *inline-crypto-offload* modes are 7579ae86b4cSRadu Nicolau supported at the moment. 7589a1cc8f1STejasree Kondoj 7599a1cc8f1STejasree Kondoj * Optional: Yes, it is disabled by default 7609a1cc8f1STejasree Kondoj 7619a1cc8f1STejasree Kondoj * Syntax: 7629a1cc8f1STejasree Kondoj 7639a1cc8f1STejasree Kondoj * *udp-encap* 7649a1cc8f1STejasree Kondoj 765a7f32947SRadu Nicolau ``<mss>`` 766a7f32947SRadu Nicolau 767a7f32947SRadu Nicolau * Maximum segment size for TSO offload, available for egress SAs only. 768*6b8f212dSVladimir Medvedkin Currently only supports TCP/IP. 769a7f32947SRadu Nicolau 770a7f32947SRadu Nicolau * Optional: Yes, TSO offload not set by default 771a7f32947SRadu Nicolau 772a7f32947SRadu Nicolau * Syntax: 773a7f32947SRadu Nicolau 774a7f32947SRadu Nicolau * *mss N* N is the segment size in bytes 775a7f32947SRadu Nicolau 776a7f32947SRadu Nicolau 7773e7b7dd8SRadu Nicolau``<telemetry>`` 7783e7b7dd8SRadu Nicolau 7793e7b7dd8SRadu Nicolau * Option to enable per SA telemetry. 7803e7b7dd8SRadu Nicolau Currently only supported with IPsec library path. 7813e7b7dd8SRadu Nicolau 7823e7b7dd8SRadu Nicolau * Optional: Yes, it is disabled by default 7833e7b7dd8SRadu Nicolau 7843e7b7dd8SRadu Nicolau * Syntax: 7853e7b7dd8SRadu Nicolau 7863e7b7dd8SRadu Nicolau * *telemetry* 7873e7b7dd8SRadu Nicolau 788560029d5SRadu Nicolau ``<esn>`` 789560029d5SRadu Nicolau 790560029d5SRadu Nicolau * Enable ESN and set the initial ESN value. 791560029d5SRadu Nicolau 792560029d5SRadu Nicolau * Optional: Yes, ESN not enabled by default 793560029d5SRadu Nicolau 794560029d5SRadu Nicolau * Syntax: 795560029d5SRadu Nicolau 796560029d5SRadu Nicolau * *esn N* N is the initial ESN value 797560029d5SRadu Nicolau 798d8d51d4fSRahul Bhansali ``<reassembly_en>`` 799d8d51d4fSRahul Bhansali 800d8d51d4fSRahul Bhansali * Option to enable HW reassembly per SA. 801d8d51d4fSRahul Bhansali 802d8d51d4fSRahul Bhansali * Optional: Yes, it is disabled by default 803d8d51d4fSRahul Bhansali 804d8d51d4fSRahul Bhansali * Syntax: 805d8d51d4fSRahul Bhansali 806d8d51d4fSRahul Bhansali * *reassembly_en* 807d8d51d4fSRahul Bhansali 8080d547ed0SFan ZhangExample SA rules: 8090d547ed0SFan Zhang 8100d547ed0SFan Zhang.. code-block:: console 8110d547ed0SFan Zhang 8120d547ed0SFan Zhang sa out 5 cipher_algo null auth_algo null mode ipv4-tunnel \ 8130d547ed0SFan Zhang src 172.16.1.5 dst 172.16.2.5 8140d547ed0SFan Zhang 8150d547ed0SFan Zhang sa out 25 cipher_algo aes-128-cbc \ 8160d547ed0SFan Zhang cipher_key c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3 \ 8170d547ed0SFan Zhang auth_algo sha1-hmac \ 8180d547ed0SFan Zhang auth_key c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3:c3 \ 8190d547ed0SFan Zhang mode ipv6-tunnel \ 8200d547ed0SFan Zhang src 1111:1111:1111:1111:1111:1111:1111:5555 \ 8210d547ed0SFan Zhang dst 2222:2222:2222:2222:2222:2222:2222:5555 8220d547ed0SFan Zhang 823b79e4c00SPablo de Lara sa in 105 aead_algo aes-128-gcm \ 824b79e4c00SPablo de Lara aead_key de:ad:be:ef:de:ad:be:ef:de:ad:be:ef:de:ad:be:ef:de:ad:be:ef \ 825a9121c40SSergio Gonzalez Monroy mode ipv4-tunnel src 172.16.2.5 dst 172.16.1.5 8260d547ed0SFan Zhang 827ec17993aSAkhil Goyal sa out 5 cipher_algo aes-128-cbc cipher_key 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 \ 828ec17993aSAkhil Goyal auth_algo sha1-hmac auth_key 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 \ 829ec17993aSAkhil Goyal mode ipv4-tunnel src 172.16.1.5 dst 172.16.2.5 \ 830ec17993aSAkhil Goyal type lookaside-protocol-offload port_id 4 831ec17993aSAkhil Goyal 83202dc5b7dSKonstantin Ananyev sa in 35 aead_algo aes-128-gcm \ 83302dc5b7dSKonstantin Ananyev aead_key de:ad:be:ef:de:ad:be:ef:de:ad:be:ef:de:ad:be:ef:de:ad:be:ef \ 83402dc5b7dSKonstantin Ananyev mode ipv4-tunnel src 172.16.2.5 dst 172.16.1.5 \ 83502dc5b7dSKonstantin Ananyev type inline-crypto-offload port_id 0 83602dc5b7dSKonstantin Ananyev 8376738c0a9SPraveen Shetty sa in 117 cipher_algo null auth_algo null mode ipv4-tunnel src 172.16.2.7 \ 8386738c0a9SPraveen Shetty dst 172.16.1.7 flow-direction 0 2 8396738c0a9SPraveen Shetty 8400d547ed0SFan ZhangRouting rule syntax 8410d547ed0SFan Zhang^^^^^^^^^^^^^^^^^^^ 8420d547ed0SFan Zhang 8430d547ed0SFan ZhangThe Routing rule syntax is shown as follows: 8440d547ed0SFan Zhang 8450d547ed0SFan Zhang.. code-block:: console 8460d547ed0SFan Zhang 8470d547ed0SFan Zhang rt <ip_ver> <src_ip> <dst_ip> <port> 8480d547ed0SFan Zhang 8490d547ed0SFan Zhang 8500d547ed0SFan Zhangwhere each options means: 8510d547ed0SFan Zhang 8520d547ed0SFan Zhang``<ip_ver>`` 8530d547ed0SFan Zhang 8540d547ed0SFan Zhang * IP protocol version 8550d547ed0SFan Zhang 8560d547ed0SFan Zhang * Optional: No 8570d547ed0SFan Zhang 8580d547ed0SFan Zhang * Available options: 8590d547ed0SFan Zhang 8600d547ed0SFan Zhang * *ipv4*: IP protocol version 4 8610d547ed0SFan Zhang * *ipv6*: IP protocol version 6 8620d547ed0SFan Zhang 8630d547ed0SFan Zhang``<src_ip>`` 8640d547ed0SFan Zhang 8650d547ed0SFan Zhang * The source IP address and mask 8660d547ed0SFan Zhang 8670d547ed0SFan Zhang * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used 8680d547ed0SFan Zhang 8690d547ed0SFan Zhang * Syntax: 8700d547ed0SFan Zhang 8710d547ed0SFan Zhang * *src X.X.X.X/Y* for IPv4 8720d547ed0SFan Zhang * *src XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6 8730d547ed0SFan Zhang 8740d547ed0SFan Zhang``<dst_ip>`` 8750d547ed0SFan Zhang 8760d547ed0SFan Zhang * The destination IP address and mask 8770d547ed0SFan Zhang 8780d547ed0SFan Zhang * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used 8790d547ed0SFan Zhang 8800d547ed0SFan Zhang * Syntax: 8810d547ed0SFan Zhang 8820d547ed0SFan Zhang * *dst X.X.X.X/Y* for IPv4 8830d547ed0SFan Zhang * *dst XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6 8840d547ed0SFan Zhang 8850d547ed0SFan Zhang``<port>`` 8860d547ed0SFan Zhang 8870d547ed0SFan Zhang * The traffic output port id 8880d547ed0SFan Zhang 8890d547ed0SFan Zhang * Optional: yes, default output port 0 will be used 8900d547ed0SFan Zhang 8910d547ed0SFan Zhang * Syntax: *port X* 8920d547ed0SFan Zhang 8930d547ed0SFan ZhangExample SP rules: 8940d547ed0SFan Zhang 8950d547ed0SFan Zhang.. code-block:: console 8960d547ed0SFan Zhang 8970d547ed0SFan Zhang rt ipv4 dst 172.16.1.5/32 port 0 8980d547ed0SFan Zhang 8990d547ed0SFan Zhang rt ipv6 dst 1111:1111:1111:1111:1111:1111:1111:5555/116 port 0 9007622291bSKonstantin Ananyev 9018e693616SAnoob JosephFlow rule syntax 9028e693616SAnoob Joseph^^^^^^^^^^^^^^^^ 9038e693616SAnoob Joseph 9048e693616SAnoob JosephFlow rule enables the usage of hardware classification capabilities to match specific 9058e693616SAnoob Josephingress traffic and redirect the packets to the specified queue. This feature is 9068e693616SAnoob Josephoptional and relies on hardware ``rte_flow`` support. 9078e693616SAnoob Joseph 9088e693616SAnoob JosephThe flow rule syntax is shown as follows: 9098e693616SAnoob Joseph 9108e693616SAnoob Joseph.. code-block:: console 9118e693616SAnoob Joseph 912b3a4baf8SSatheesh Paul flow <mark> <eth> <ip_ver> <src_ip> <dst_ip> <port> <queue> \ 913b3a4baf8SSatheesh Paul <count> <security> <set_mark> 9148e693616SAnoob Joseph 9158e693616SAnoob Josephwhere each options means: 9168e693616SAnoob Joseph 917b3a4baf8SSatheesh Paul``<mark>`` 918b3a4baf8SSatheesh Paul 919b3a4baf8SSatheesh Paul * Set RTE_FLOW_ITEM_TYPE_MARK pattern item in the flow rule with the given 920b3a4baf8SSatheesh Paul mark value. This option can be used to match an arbitrary integer value 921b3a4baf8SSatheesh Paul which was set using the RTE_FLOW_ACTION_TYPE_MARK action (see ``<set_mark>``) 922b3a4baf8SSatheesh Paul in a previously matched rule. 923b3a4baf8SSatheesh Paul 924b3a4baf8SSatheesh Paul * Optional: Yes, this pattern is not set by default. 925b3a4baf8SSatheesh Paul 926b3a4baf8SSatheesh Paul * Syntax: *mark X* 927b3a4baf8SSatheesh Paul 928b3a4baf8SSatheesh Paul``<eth>`` 929b3a4baf8SSatheesh Paul 930b3a4baf8SSatheesh Paul * Set RTE_FLOW_ITEM_TYPE_ETH pattern item. This matches all ethernet packets. 931b3a4baf8SSatheesh Paul 932b3a4baf8SSatheesh Paul * Optional: Yes, this pattern is not set by default. 933b3a4baf8SSatheesh Paul 934b3a4baf8SSatheesh Paul * Syntax: *eth* 935b3a4baf8SSatheesh Paul 9368e693616SAnoob Joseph``<ip_ver>`` 9378e693616SAnoob Joseph 9388e693616SAnoob Joseph * IP protocol version 9398e693616SAnoob Joseph 940b3a4baf8SSatheesh Paul * Optional: Yes, this pattern is not set by default. 9418e693616SAnoob Joseph 9428e693616SAnoob Joseph * Available options: 9438e693616SAnoob Joseph 9448e693616SAnoob Joseph * *ipv4*: IP protocol version 4 9458e693616SAnoob Joseph * *ipv6*: IP protocol version 6 9468e693616SAnoob Joseph 9478e693616SAnoob Joseph``<src_ip>`` 9488e693616SAnoob Joseph 9498e693616SAnoob Joseph * The source IP address and mask 9508e693616SAnoob Joseph 9518e693616SAnoob Joseph * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used 9528e693616SAnoob Joseph 9538e693616SAnoob Joseph * Syntax: 9548e693616SAnoob Joseph 9558e693616SAnoob Joseph * *src X.X.X.X/Y* for IPv4 9568e693616SAnoob Joseph * *src XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6 9578e693616SAnoob Joseph 9588e693616SAnoob Joseph``<dst_ip>`` 9598e693616SAnoob Joseph 9608e693616SAnoob Joseph * The destination IP address and mask 9618e693616SAnoob Joseph 9628e693616SAnoob Joseph * Optional: Yes, default address 0.0.0.0 and mask of 0 will be used 9638e693616SAnoob Joseph 9648e693616SAnoob Joseph * Syntax: 9658e693616SAnoob Joseph 9668e693616SAnoob Joseph * *dst X.X.X.X/Y* for IPv4 9678e693616SAnoob Joseph * *dst XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX/Y* for IPv6 9688e693616SAnoob Joseph 9698e693616SAnoob Joseph``<port>`` 9708e693616SAnoob Joseph 9718e693616SAnoob Joseph * The traffic input port id 9728e693616SAnoob Joseph 9738e693616SAnoob Joseph * Optional: yes, default input port 0 will be used 9748e693616SAnoob Joseph 9758e693616SAnoob Joseph * Syntax: *port X* 9768e693616SAnoob Joseph 9778e693616SAnoob Joseph``<queue>`` 9788e693616SAnoob Joseph 9798e693616SAnoob Joseph * The traffic input queue id 9808e693616SAnoob Joseph 9818e693616SAnoob Joseph * Optional: yes, default input queue 0 will be used 9828e693616SAnoob Joseph 9838e693616SAnoob Joseph * Syntax: *queue X* 9848e693616SAnoob Joseph 985b3a4baf8SSatheesh Paul``<count>`` 986b3a4baf8SSatheesh Paul 987b3a4baf8SSatheesh Paul * Set RTE_FLOW_ACTION_TYPE_COUNT action. 988b3a4baf8SSatheesh Paul 989b3a4baf8SSatheesh Paul * Optional: yes, this action is not set by default. 990b3a4baf8SSatheesh Paul 991b3a4baf8SSatheesh Paul * Syntax: *count* 992b3a4baf8SSatheesh Paul 993b3a4baf8SSatheesh Paul``<security>`` 994b3a4baf8SSatheesh Paul 995b3a4baf8SSatheesh Paul * Set RTE_FLOW_ITEM_TYPE_ESP pattern and RTE_FLOW_ACTION_TYPE_SECURITY action. 996b3a4baf8SSatheesh Paul 997b3a4baf8SSatheesh Paul * Optional: yes, this pattern and action are not set by default. 998b3a4baf8SSatheesh Paul 999b3a4baf8SSatheesh Paul * Syntax: *security* 1000b3a4baf8SSatheesh Paul 1001b3a4baf8SSatheesh Paul``<set_mark>`` 1002b3a4baf8SSatheesh Paul 1003b3a4baf8SSatheesh Paul * Set RTE_FLOW_ACTION_TYPE_MARK action in the flow rule with the given mark 1004b3a4baf8SSatheesh Paul value. This option can be used to set the given integer value(mark) to 1005b3a4baf8SSatheesh Paul packets and set RTE_MBUF_F_RX_FDIR and RTE_MBUF_F_RX_FDIR_ID mbuf flags. 1006b3a4baf8SSatheesh Paul 1007b3a4baf8SSatheesh Paul * Optional: yes, this action is not set by default. 1008b3a4baf8SSatheesh Paul 1009b3a4baf8SSatheesh Paul * Syntax: *set_mark X* 1010b3a4baf8SSatheesh Paul 10118e693616SAnoob JosephExample flow rules: 10128e693616SAnoob Joseph 10138e693616SAnoob Joseph.. code-block:: console 10148e693616SAnoob Joseph 10158e693616SAnoob Joseph flow ipv4 dst 172.16.1.5/32 port 0 queue 0 10168e693616SAnoob Joseph 10178e693616SAnoob Joseph flow ipv6 dst 1111:1111:1111:1111:1111:1111:1111:5555/116 port 1 queue 0 10188e693616SAnoob Joseph 1019b3a4baf8SSatheesh Paul flow mark 123 ipv4 dst 192.168.0.0/16 port 0 queue 0 count 1020b3a4baf8SSatheesh Paul 1021b3a4baf8SSatheesh Paul flow eth ipv4 dst 192.168.0.0/16 port 0 queue 0 count 1022b3a4baf8SSatheesh Paul 1023b3a4baf8SSatheesh Paul flow ipv4 dst 192.168.0.0/16 port 0 queue 0 count 1024b3a4baf8SSatheesh Paul 1025b3a4baf8SSatheesh Paul flow ipv4 dst 192.168.0.0/16 port 0 queue 0 1026b3a4baf8SSatheesh Paul 1027b3a4baf8SSatheesh Paul flow port 0 security set_mark 123 1028b3a4baf8SSatheesh Paul 1029b3a4baf8SSatheesh Paul flow ipv4 dst 1.1.0.0/16 port 0 count set_mark 123 security 1030b3a4baf8SSatheesh Paul 10318e693616SAnoob Joseph 10327622291bSKonstantin AnanyevNeighbour rule syntax 10337622291bSKonstantin Ananyev^^^^^^^^^^^^^^^^^^^^^ 10347622291bSKonstantin Ananyev 10357622291bSKonstantin AnanyevThe Neighbour rule syntax is shown as follows: 10367622291bSKonstantin Ananyev 10377622291bSKonstantin Ananyev.. code-block:: console 10387622291bSKonstantin Ananyev 10397622291bSKonstantin Ananyev neigh <port> <dst_mac> 10407622291bSKonstantin Ananyev 10417622291bSKonstantin Ananyev 10427622291bSKonstantin Ananyevwhere each options means: 10437622291bSKonstantin Ananyev 10447622291bSKonstantin Ananyev``<port>`` 10457622291bSKonstantin Ananyev 10467622291bSKonstantin Ananyev * The output port id 10477622291bSKonstantin Ananyev 10487622291bSKonstantin Ananyev * Optional: No 10497622291bSKonstantin Ananyev 10507622291bSKonstantin Ananyev * Syntax: *port X* 10517622291bSKonstantin Ananyev 10527622291bSKonstantin Ananyev``<dst_mac>`` 10537622291bSKonstantin Ananyev 10547622291bSKonstantin Ananyev * The destination ethernet address to use for that port 10557622291bSKonstantin Ananyev 10567622291bSKonstantin Ananyev * Optional: No 10577622291bSKonstantin Ananyev 10587622291bSKonstantin Ananyev * Syntax: 10597622291bSKonstantin Ananyev 10607622291bSKonstantin Ananyev * XX:XX:XX:XX:XX:XX 10617622291bSKonstantin Ananyev 10627622291bSKonstantin AnanyevExample Neighbour rules: 10637622291bSKonstantin Ananyev 10647622291bSKonstantin Ananyev.. code-block:: console 10657622291bSKonstantin Ananyev 10667622291bSKonstantin Ananyev neigh port 0 DE:AD:BE:EF:01:02 106702dc5b7dSKonstantin Ananyev 106802dc5b7dSKonstantin AnanyevTest directory 106902dc5b7dSKonstantin Ananyev-------------- 107002dc5b7dSKonstantin Ananyev 107102dc5b7dSKonstantin AnanyevThe test directory contains scripts for testing the various encryption 107202dc5b7dSKonstantin Ananyevalgorithms. 107302dc5b7dSKonstantin Ananyev 107402dc5b7dSKonstantin AnanyevThe purpose of the scripts is to automate ipsec-secgw testing 107502dc5b7dSKonstantin Ananyevusing another system running linux as a DUT. 107602dc5b7dSKonstantin Ananyev 107702dc5b7dSKonstantin AnanyevThe user must setup the following environment variables: 107802dc5b7dSKonstantin Ananyev 107902dc5b7dSKonstantin Ananyev* ``SGW_PATH``: path to the ipsec-secgw binary to test. 108002dc5b7dSKonstantin Ananyev 108102dc5b7dSKonstantin Ananyev* ``REMOTE_HOST``: IP address/hostname of the DUT. 108202dc5b7dSKonstantin Ananyev 108302dc5b7dSKonstantin Ananyev* ``REMOTE_IFACE``: interface name for the test-port on the DUT. 108402dc5b7dSKonstantin Ananyev 1085db27370bSStephen Hemminger* ``ETH_DEV``: ethernet device to be used on the SUT by DPDK ('-a <pci-id>') 108602dc5b7dSKonstantin Ananyev 108702dc5b7dSKonstantin AnanyevAlso the user can optionally setup: 108802dc5b7dSKonstantin Ananyev 108902dc5b7dSKonstantin Ananyev* ``SGW_LCORE``: lcore to run ipsec-secgw on (default value is 0) 109002dc5b7dSKonstantin Ananyev 1091db27370bSStephen Hemminger* ``CRYPTO_DEV``: crypto device to be used ('-a <pci-id>'). If none specified 109202dc5b7dSKonstantin Ananyev appropriate vdevs will be created by the script 109302dc5b7dSKonstantin Ananyev 10949dbc4e21SMariusz DrostScripts can be used for multiple test scenarios. To check all available 10959dbc4e21SMariusz Drostoptions run: 10969dbc4e21SMariusz Drost 10979dbc4e21SMariusz Drost.. code-block:: console 10989dbc4e21SMariusz Drost 10999dbc4e21SMariusz Drost /bin/bash run_test.sh -h 1100403e9d91SMarcin Smoczynski 110102dc5b7dSKonstantin AnanyevNote that most of the tests require the appropriate crypto PMD/device to be 110202dc5b7dSKonstantin Ananyevavailable. 110302dc5b7dSKonstantin Ananyev 110402dc5b7dSKonstantin AnanyevServer configuration 110502dc5b7dSKonstantin Ananyev~~~~~~~~~~~~~~~~~~~~ 110602dc5b7dSKonstantin Ananyev 110702dc5b7dSKonstantin AnanyevTwo servers are required for the tests, SUT and DUT. 110802dc5b7dSKonstantin Ananyev 110902dc5b7dSKonstantin AnanyevMake sure the user from the SUT can ssh to the DUT without entering the password. 111002dc5b7dSKonstantin AnanyevTo enable this feature keys must be setup on the DUT. 111102dc5b7dSKonstantin Ananyev 111202dc5b7dSKonstantin Ananyev``ssh-keygen`` will make a private & public key pair on the SUT. 111302dc5b7dSKonstantin Ananyev 111402dc5b7dSKonstantin Ananyev``ssh-copy-id`` <user name>@<target host name> on the SUT will copy the public 111502dc5b7dSKonstantin Ananyevkey to the DUT. It will ask for credentials so that it can upload the public key. 111602dc5b7dSKonstantin Ananyev 111702dc5b7dSKonstantin AnanyevThe SUT and DUT are connected through at least 2 NIC ports. 111802dc5b7dSKonstantin Ananyev 111902dc5b7dSKonstantin AnanyevOne NIC port is expected to be managed by linux on both machines and will be 112002dc5b7dSKonstantin Ananyevused as a control path. 112102dc5b7dSKonstantin Ananyev 112202dc5b7dSKonstantin AnanyevThe second NIC port (test-port) should be bound to DPDK on the SUT, and should 112302dc5b7dSKonstantin Ananyevbe managed by linux on the DUT. 112402dc5b7dSKonstantin Ananyev 112502dc5b7dSKonstantin AnanyevThe script starts ``ipsec-secgw`` with 2 NIC devices: ``test-port`` and 112602dc5b7dSKonstantin Ananyev``tap vdev``. 112702dc5b7dSKonstantin Ananyev 112802dc5b7dSKonstantin AnanyevIt then configures the local tap interface and the remote interface and IPsec 112902dc5b7dSKonstantin Ananyevpolicies in the following way: 113002dc5b7dSKonstantin Ananyev 113102dc5b7dSKonstantin AnanyevTraffic going over the test-port in both directions has to be protected by IPsec. 113202dc5b7dSKonstantin Ananyev 113302dc5b7dSKonstantin AnanyevTraffic going over the TAP port in both directions does not have to be protected. 113402dc5b7dSKonstantin Ananyev 113502dc5b7dSKonstantin Ananyevi.e: 113602dc5b7dSKonstantin Ananyev 113702dc5b7dSKonstantin AnanyevDUT OS(NIC1)--(IPsec)-->(NIC1)ipsec-secgw(TAP)--(plain)-->(TAP)SUT OS 113802dc5b7dSKonstantin Ananyev 113902dc5b7dSKonstantin AnanyevSUT OS(TAP)--(plain)-->(TAP)psec-secgw(NIC1)--(IPsec)-->(NIC1)DUT OS 114002dc5b7dSKonstantin Ananyev 1141d629b7b5SJohn McNamaraIt then tries to perform some data transfer using the scheme described above. 114202dc5b7dSKonstantin Ananyev 11439dbc4e21SMariusz DrostUsage 114402dc5b7dSKonstantin Ananyev~~~~~ 114502dc5b7dSKonstantin Ananyev 11469dbc4e21SMariusz DrostIn the ipsec-secgw/test directory run 114702dc5b7dSKonstantin Ananyev 11489dbc4e21SMariusz Drost/bin/bash run_test.sh <options> <ipsec_mode> 114902dc5b7dSKonstantin Ananyev 11509dbc4e21SMariusz DrostAvailable options: 115102dc5b7dSKonstantin Ananyev 11529dbc4e21SMariusz Drost* ``-4`` Perform tests with use of IPv4. One or both [-46] options needs to be 11539dbc4e21SMariusz Drost selected. 115402dc5b7dSKonstantin Ananyev 11559dbc4e21SMariusz Drost* ``-6`` Perform tests with use of IPv6. One or both [-46] options needs to be 11569dbc4e21SMariusz Drost selected. 115702dc5b7dSKonstantin Ananyev 11589dbc4e21SMariusz Drost* ``-m`` Add IPSec tunnel mixed IP version tests - outer IP version different 11599dbc4e21SMariusz Drost than inner. Inner IP version will match selected option [-46]. 11609dbc4e21SMariusz Drost 11619dbc4e21SMariusz Drost* ``-i`` Run tests in inline mode. Regular tests will not be invoked. 11629dbc4e21SMariusz Drost 11639dbc4e21SMariusz Drost* ``-f`` Run tests for fallback mechanism. Regular tests will not be invoked. 11649dbc4e21SMariusz Drost 11659dbc4e21SMariusz Drost* ``-l`` Run tests in legacy mode only. It cannot be used with options [-fsc]. 11669dbc4e21SMariusz Drost On default library mode is used. 11679dbc4e21SMariusz Drost 11689dbc4e21SMariusz Drost* ``-s`` Run all tests with reassembly support. On default only tests for 11699dbc4e21SMariusz Drost fallback mechanism use reassembly support. 11709dbc4e21SMariusz Drost 11719dbc4e21SMariusz Drost* ``-c`` Run tests with use of cpu-crypto. For inline tests it will not be 11729dbc4e21SMariusz Drost applied. On default lookaside-none is used. 11739dbc4e21SMariusz Drost 11749dbc4e21SMariusz Drost* ``-p`` Perform packet validation tests. Option [-46] is not required. 11759dbc4e21SMariusz Drost 11769dbc4e21SMariusz Drost* ``-h`` Show usage. 11779dbc4e21SMariusz Drost 11789dbc4e21SMariusz DrostIf <ipsec_mode> is specified, only tests for that mode will be invoked. For the 11799dbc4e21SMariusz Drostlist of available modes please refer to run_test.sh. 1180