1.. SPDX-License-Identifier: BSD-3-Clause 2 Copyright 2017,2020 NXP 3 4 5 6Security Library 7================ 8 9The security library provides a framework for management and provisioning 10of security protocol operations offloaded to hardware based devices. The 11library defines generic APIs to create and free security sessions which can 12support full protocol offload as well as inline crypto operation with 13NIC or crypto devices. The framework currently only supports the IPsec, PDCP 14and DOCSIS protocols and associated operations, other protocols will be added 15in the future. 16 17Design Principles 18----------------- 19 20The security library provides an additional offload capability to an existing 21crypto device and/or ethernet device. 22 23.. code-block:: console 24 25 +---------------+ 26 | rte_security | 27 +---------------+ 28 \ / 29 +-----------+ +--------------+ 30 | NIC PMD | | CRYPTO PMD | 31 +-----------+ +--------------+ 32 33.. note:: 34 35 Currently, the security library does not support the case of multi-process. 36 It will be updated in the future releases. 37 38The supported offload types are explained in the sections below. 39 40Inline Crypto 41~~~~~~~~~~~~~ 42 43RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO: 44The crypto processing for security protocol (e.g. IPsec) is processed 45inline during receive and transmission on NIC port. The flow based 46security action should be configured on the port. 47 48Ingress Data path - The packet is decrypted in RX path and relevant 49crypto status is set in Rx descriptors. After the successful inline 50crypto processing the packet is presented to host as a regular Rx packet 51however all security protocol related headers are still attached to the 52packet. e.g. In case of IPsec, the IPsec tunnel headers (if any), 53ESP/AH headers will remain in the packet but the received packet 54contains the decrypted data where the encrypted data was when the packet 55arrived. The driver Rx path check the descriptors and based on the 56crypto status sets additional flags in the rte_mbuf.ol_flags field. 57 58.. note:: 59 60 The underlying device may not support crypto processing for all ingress packet 61 matching to a particular flow (e.g. fragmented packets), such packets will 62 be passed as encrypted packets. It is the responsibility of application to 63 process such encrypted packets using other crypto driver instance. 64 65Egress Data path - The software prepares the egress packet by adding 66relevant security protocol headers. Only the data will not be 67encrypted by the software. The driver will accordingly configure the 68tx descriptors. The hardware device will encrypt the data before sending the 69packet out. 70 71.. note:: 72 73 The underlying device may support post encryption TSO. 74 75.. code-block:: console 76 77 Egress Data Path 78 | 79 +--------|--------+ 80 | egress IPsec | 81 | | | 82 | +------V------+ | 83 | | SADB lookup | | 84 | +------|------+ | 85 | +------V------+ | 86 | | Tunnel | | <------ Add tunnel header to packet 87 | +------|------+ | 88 | +------V------+ | 89 | | ESP | | <------ Add ESP header without trailer to packet 90 | | | | <------ Mark packet to be offloaded, add trailer 91 | +------|------+ | meta-data to mbuf 92 +--------V--------+ 93 | 94 +--------V--------+ 95 | L2 Stack | 96 +--------|--------+ 97 | 98 +--------V--------+ 99 | | 100 | NIC PMD | <------ Set hw context for inline crypto offload 101 | | 102 +--------|--------+ 103 | 104 +--------|--------+ 105 | HW ACCELERATED | <------ Packet Encryption and 106 | NIC | Authentication happens inline 107 | | 108 +-----------------+ 109 110 111Inline protocol offload 112~~~~~~~~~~~~~~~~~~~~~~~ 113 114RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL: 115The crypto and protocol processing for security protocol (e.g. IPsec) 116is processed inline during receive and transmission. The flow based 117security action should be configured on the port. 118 119Ingress Data path - The packet is decrypted in the RX path and relevant 120crypto status is set in the Rx descriptors. After the successful inline 121crypto processing the packet is presented to the host as a regular Rx packet 122but all security protocol related headers are optionally removed from the 123packet. e.g. in the case of IPsec, the IPsec tunnel headers (if any), 124ESP/AH headers will be removed from the packet and the received packet 125will contains the decrypted packet only. The driver Rx path checks the 126descriptors and based on the crypto status sets additional flags in 127``rte_mbuf.ol_flags`` field. The driver would also set device-specific 128metadata in ``RTE_SECURITY_DYNFIELD_NAME`` field. 129This will allow the application to identify the security processing 130done on the packet. 131 132.. note:: 133 134 The underlying device in this case is stateful. It is expected that 135 the device shall support crypto processing for all kind of packets matching 136 to a given flow, this includes fragmented packets (post reassembly). 137 E.g. in case of IPsec the device may internally manage anti-replay etc. 138 It will provide a configuration option for anti-replay behavior i.e. to drop 139 the packets or pass them to driver with error flags set in the descriptor. 140 141Egress Data path - The software will send the plain packet without any 142security protocol headers added to the packet. The driver will configure 143the security index and other requirement in tx descriptors. 144The hardware device will do security processing on the packet that includes 145adding the relevant protocol headers and encrypting the data before sending 146the packet out. The software should make sure that the buffer 147has required head room and tail room for any protocol header addition. The 148software may also do early fragmentation if the resultant packet is expected 149to cross the MTU size. 150 151 152.. note:: 153 154 The underlying device will manage state information required for egress 155 processing. E.g. in case of IPsec, the seq number will be added to the 156 packet, however the device shall provide indication when the sequence number 157 is about to overflow. The underlying device may support post encryption TSO. 158 159.. code-block:: console 160 161 Egress Data Path 162 | 163 +--------|--------+ 164 | egress IPsec | 165 | | | 166 | +------V------+ | 167 | | SADB lookup | | 168 | +------|------+ | 169 | +------V------+ | 170 | | Desc | | <------ Mark packet to be offloaded 171 | +------|------+ | 172 +--------V--------+ 173 | 174 +--------V--------+ 175 | L2 Stack | 176 +--------|--------+ 177 | 178 +--------V--------+ 179 | | 180 | NIC PMD | <------ Set hw context for inline crypto offload 181 | | 182 +--------|--------+ 183 | 184 +--------|--------+ 185 | HW ACCELERATED | <------ Add tunnel, ESP header etc header to 186 | NIC | packet. Packet Encryption and 187 | | Authentication happens inline. 188 +-----------------+ 189 190 191Lookaside protocol offload 192~~~~~~~~~~~~~~~~~~~~~~~~~~ 193 194RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL: 195This extends librte_cryptodev to support the programming of IPsec 196Security Association (SA) as part of a crypto session creation including 197the definition. In addition to standard crypto processing, as defined by 198the cryptodev, the security protocol processing is also offloaded to the 199crypto device. 200 201Decryption: The packet is sent to the crypto device for security 202protocol processing. The device will decrypt the packet and it will also 203optionally remove additional security headers from the packet. 204E.g. in case of IPsec, IPsec tunnel headers (if any), ESP/AH headers 205will be removed from the packet and the decrypted packet may contain 206plain data only. 207 208.. note:: 209 210 In case of IPsec the device may internally manage anti-replay etc. 211 It will provide a configuration option for anti-replay behavior i.e. to drop 212 the packets or pass them to driver with error flags set in descriptor. 213 214Encryption: The software will submit the packet to cryptodev as usual 215for encryption, the hardware device in this case will also add the relevant 216security protocol header along with encrypting the packet. The software 217should make sure that the buffer has required head room and tail room 218for any protocol header addition. 219 220.. note:: 221 222 In the case of IPsec, the seq number will be added to the packet, 223 It shall provide an indication when the sequence number is about to 224 overflow. 225 226.. code-block:: console 227 228 Egress Data Path 229 | 230 +--------|--------+ 231 | egress IPsec | 232 | | | 233 | +------V------+ | 234 | | SADB lookup | | <------ SA maps to cryptodev session 235 | +------|------+ | 236 | +------|------+ | 237 | | \--------------------\ 238 | | Crypto | | | <- Crypto processing through 239 | | /----------------\ | inline crypto PMD 240 | +------|------+ | | | 241 +--------V--------+ | | 242 | | | 243 +--------V--------+ | | create <-- SA is added to hw 244 | L2 Stack | | | inline using existing create 245 +--------|--------+ | | session sym session APIs 246 | | | | 247 +--------V--------+ +---|---|----V---+ 248 | | | \---/ | | <--- Add tunnel, ESP header etc 249 | NIC PMD | | INLINE | | header to packet.Packet 250 | | | CRYPTO PMD | | Encryption/Decryption and 251 +--------|--------+ +----------------+ Authentication happens 252 | inline. 253 +--------|--------+ 254 | NIC | 255 +--------|--------+ 256 V 257 258PDCP Flow Diagram 259~~~~~~~~~~~~~~~~~ 260 261Based on 3GPP TS 36.323 Evolved Universal Terrestrial Radio Access (E-UTRA); 262Packet Data Convergence Protocol (PDCP) specification 263 264.. code-block:: c 265 266 Transmitting PDCP Entity Receiving PDCP Entity 267 | ^ 268 | +-----------|-----------+ 269 V | In order delivery and | 270 +---------|----------+ | Duplicate detection | 271 | Sequence Numbering | | (Data Plane only) | 272 +---------|----------+ +-----------|-----------+ 273 | | 274 +---------|----------+ +-----------|----------+ 275 | Header Compression*| | Header Decompression*| 276 | (Data-Plane only) | | (Data Plane only) | 277 +---------|----------+ +-----------|----------+ 278 | | 279 +---------|-----------+ +-----------|----------+ 280 | Integrity Protection| |Integrity Verification| 281 | (Control Plane only)| | (Control Plane only) | 282 +---------|-----------+ +-----------|----------+ 283 +---------|-----------+ +----------|----------+ 284 | Ciphering | | Deciphering | 285 +---------|-----------+ +----------|----------+ 286 +---------|-----------+ +----------|----------+ 287 | Add PDCP header | | Remove PDCP Header | 288 +---------|-----------+ +----------|----------+ 289 | | 290 +----------------->>----------------+ 291 292 293.. note:: 294 295 * Header Compression and decompression are not supported currently. 296 297Just like IPsec, in case of PDCP also header addition/deletion, cipher/ 298de-cipher, integrity protection/verification is done based on the action 299type chosen. 300 301DOCSIS Protocol 302~~~~~~~~~~~~~~~ 303 304The Data Over Cable Service Interface Specification (DOCSIS) support comprises 305the combination of encryption/decryption and CRC generation/verification, for 306use in a DOCSIS-MAC pipeline. 307 308.. code-block:: c 309 310 311 Downlink Uplink 312 -------- ------ 313 314 Ethernet frame Ethernet frame 315 from core network to core network 316 | ^ 317 ~ | 318 | ~ ----+ 319 V | | 320 +---------|----------+ +----------|---------+ | 321 | CRC generation | | CRC verification | | 322 +---------|----------+ +----------|---------+ | combined 323 | | > Crypto + CRC 324 +---------|----------+ +----------|---------+ | 325 | Encryption | | Decryption | | 326 +---------|----------+ +----------|---------+ | 327 | ^ | 328 ~ | ----+ 329 | ~ 330 V | 331 DOCSIS frame DOCSIS frame 332 to Cable Modem from Cable Modem 333 334The encryption/decryption is a combination of CBC and CFB modes using either AES 335or DES algorithms as specified in the DOCSIS Security Specification (from DPDK 336lib_rtecryptodev perspective, these are RTE_CRYPTO_CIPHER_AES_DOCSISBPI and 337RTE_CRYPTO_CIPHER_DES_DOCSISBPI). 338 339The CRC is Ethernet CRC-32 as specified in Ethernet/[ISO/IEC 8802-3]. 340 341.. note:: 342 343 * The offset and length of data for which CRC needs to be computed are 344 specified via the auth offset and length fields of the rte_crypto_sym_op. 345 * Other DOCSIS protocol functionality such as Header Checksum (HCS) 346 calculation may be added in the future. 347 348Device Features and Capabilities 349--------------------------------- 350 351Device Capabilities For Security Operations 352~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 354The device (crypto or ethernet) capabilities which support security operations, 355are defined by the security action type, security protocol, protocol 356capabilities and corresponding crypto capabilities for security. For the full 357scope of the Security capability see definition of rte_security_capability 358structure in the *DPDK API Reference*. 359 360.. code-block:: c 361 362 struct rte_security_capability; 363 364Each driver (crypto or ethernet) defines its own private array of capabilities 365for the operations it supports. Below is an example of the capabilities for a 366PMD which supports the IPsec and PDCP protocol. 367 368.. code-block:: c 369 370 static const struct rte_security_capability pmd_security_capabilities[] = { 371 { /* IPsec Lookaside Protocol offload ESP Tunnel Egress */ 372 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, 373 .protocol = RTE_SECURITY_PROTOCOL_IPSEC, 374 .ipsec = { 375 .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP, 376 .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL, 377 .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS, 378 .options = { 0 } 379 }, 380 .crypto_capabilities = pmd_capabilities 381 }, 382 { /* IPsec Lookaside Protocol offload ESP Tunnel Ingress */ 383 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, 384 .protocol = RTE_SECURITY_PROTOCOL_IPSEC, 385 .ipsec = { 386 .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP, 387 .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL, 388 .direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS, 389 .options = { 0 } 390 }, 391 .crypto_capabilities = pmd_capabilities 392 }, 393 { /* PDCP Lookaside Protocol offload Data Plane */ 394 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, 395 .protocol = RTE_SECURITY_PROTOCOL_PDCP, 396 .pdcp = { 397 .domain = RTE_SECURITY_PDCP_MODE_DATA, 398 .capa_flags = 0 399 }, 400 .crypto_capabilities = pmd_capabilities 401 }, 402 { /* PDCP Lookaside Protocol offload Control */ 403 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, 404 .protocol = RTE_SECURITY_PROTOCOL_PDCP, 405 .pdcp = { 406 .domain = RTE_SECURITY_PDCP_MODE_CONTROL, 407 .capa_flags = 0 408 }, 409 .crypto_capabilities = pmd_capabilities 410 }, 411 { 412 .action = RTE_SECURITY_ACTION_TYPE_NONE 413 } 414 }; 415 static const struct rte_cryptodev_capabilities pmd_capabilities[] = { 416 { /* SHA1 HMAC */ 417 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, 418 .sym = { 419 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, 420 .auth = { 421 .algo = RTE_CRYPTO_AUTH_SHA1_HMAC, 422 .block_size = 64, 423 .key_size = { 424 .min = 64, 425 .max = 64, 426 .increment = 0 427 }, 428 .digest_size = { 429 .min = 12, 430 .max = 12, 431 .increment = 0 432 }, 433 .aad_size = { 0 }, 434 .iv_size = { 0 } 435 } 436 } 437 }, 438 { /* AES CBC */ 439 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, 440 .sym = { 441 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, 442 .cipher = { 443 .algo = RTE_CRYPTO_CIPHER_AES_CBC, 444 .block_size = 16, 445 .key_size = { 446 .min = 16, 447 .max = 32, 448 .increment = 8 449 }, 450 .iv_size = { 451 .min = 16, 452 .max = 16, 453 .increment = 0 454 } 455 } 456 } 457 } 458 } 459 460Below is an example of the capabilities for a PMD which supports the DOCSIS 461protocol. 462 463.. code-block:: c 464 465 static const struct rte_security_capability pmd_security_capabilities[] = { 466 { /* DOCSIS Uplink */ 467 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, 468 .protocol = RTE_SECURITY_PROTOCOL_DOCSIS, 469 .docsis = { 470 .direction = RTE_SECURITY_DOCSIS_UPLINK 471 }, 472 .crypto_capabilities = pmd_capabilities 473 }, 474 { /* DOCSIS Downlink */ 475 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, 476 .protocol = RTE_SECURITY_PROTOCOL_DOCSIS, 477 .docsis = { 478 .direction = RTE_SECURITY_DOCSIS_DOWNLINK 479 }, 480 .crypto_capabilities = pmd_capabilities 481 }, 482 { 483 .action = RTE_SECURITY_ACTION_TYPE_NONE 484 } 485 }; 486 static const struct rte_cryptodev_capabilities pmd_capabilities[] = { 487 { /* AES DOCSIS BPI */ 488 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, 489 .sym = { 490 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, 491 .cipher = { 492 .algo = RTE_CRYPTO_CIPHER_AES_DOCSISBPI, 493 .block_size = 16, 494 .key_size = { 495 .min = 16, 496 .max = 32, 497 .increment = 16 498 }, 499 .iv_size = { 500 .min = 16, 501 .max = 16, 502 .increment = 0 503 } 504 } 505 } 506 }, 507 508 RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() 509 }; 510 511Capabilities Discovery 512~~~~~~~~~~~~~~~~~~~~~~ 513 514Discovering the features and capabilities of a driver (crypto/ethernet) 515is achieved through the ``rte_security_capabilities_get()`` function. 516 517.. code-block:: c 518 519 const struct rte_security_capability *rte_security_capabilities_get(uint16_t id); 520 521This allows the user to query a specific driver and get all device 522security capabilities. It returns an array of ``rte_security_capability`` structures 523which contains all the capabilities for that device. 524 525Security Session Create/Free 526~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 528Security Sessions are created to store the immutable fields of a particular Security 529Association for a particular protocol which is defined by a security session 530configuration structure which is used in the operation processing of a packet flow. 531Sessions are used to manage protocol specific information as well as crypto parameters. 532Security sessions cache this immutable data in a optimal way for the underlying PMD 533and this allows further acceleration of the offload of Crypto workloads. 534 535The Security framework provides APIs to create and free sessions for crypto/ethernet 536devices, where sessions are mempool objects. It is the application's responsibility 537to create and manage two session mempools - one for session and other for session 538private data. The private session data mempool object size should be able to 539accommodate the driver's private data of security session. The application can get 540the size of session private data using API ``rte_security_session_get_size``. 541And the session mempool object size should be enough to accommodate 542``rte_security_session``. 543 544Once the session mempools have been created, ``rte_security_session_create()`` 545is used to allocate and initialize a session for the required crypto/ethernet device. 546 547Session APIs need a parameter ``rte_security_ctx`` to identify the crypto/ethernet 548security ops. This parameter can be retrieved using the APIs 549``rte_cryptodev_get_sec_ctx()`` (for crypto device) or ``rte_eth_dev_get_sec_ctx`` 550(for ethernet port). 551 552Sessions already created can be updated with ``rte_security_session_update()``. 553 554When a session is no longer used, the user must call ``rte_security_session_destroy()`` 555to free the driver private session data and return the memory back to the mempool. 556 557For look aside protocol offload to hardware crypto device, the ``rte_crypto_op`` 558created by the application is attached to the security session by the API 559``rte_security_attach_session()``. 560 561For Inline Crypto and Inline protocol offload, device specific defined metadata is 562updated in the mbuf using ``rte_security_set_pkt_metadata()`` if 563``DEV_TX_OFFLOAD_SEC_NEED_MDATA`` is set. 564 565For inline protocol offloaded ingress traffic, the application can register a 566pointer, ``userdata`` , in the security session. When the packet is received, 567``rte_security_get_userdata()`` would return the userdata registered for the 568security session which processed the packet. 569 570.. note:: 571 572 In case of inline processed packets, ``RTE_SECURITY_DYNFIELD_NAME`` field 573 would be used by the driver to relay information on the security processing 574 associated with the packet. In ingress, the driver would set this in Rx 575 path while in egress, ``rte_security_set_pkt_metadata()`` would perform a 576 similar operation. The application is expected not to modify the field 577 when it has relevant info. For ingress, this device-specific 64 bit value 578 is required to derive other information (like userdata), required for 579 identifying the security processing done on the packet. 580 581Security session configuration 582~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 584Security Session configuration structure is defined as ``rte_security_session_conf`` 585 586.. code-block:: c 587 588 struct rte_security_session_conf { 589 enum rte_security_session_action_type action_type; 590 /**< Type of action to be performed on the session */ 591 enum rte_security_session_protocol protocol; 592 /**< Security protocol to be configured */ 593 union { 594 struct rte_security_ipsec_xform ipsec; 595 struct rte_security_macsec_xform macsec; 596 struct rte_security_pdcp_xform pdcp; 597 struct rte_security_docsis_xform docsis; 598 }; 599 /**< Configuration parameters for security session */ 600 struct rte_crypto_sym_xform *crypto_xform; 601 /**< Security Session Crypto Transformations */ 602 void *userdata; 603 /**< Application specific userdata to be saved with session */ 604 }; 605 606The configuration structure reuses the ``rte_crypto_sym_xform`` struct for crypto related 607configuration. The ``rte_security_session_action_type`` struct is used to specify whether the 608session is configured for Lookaside Protocol offload or Inline Crypto or Inline Protocol 609Offload. 610 611.. code-block:: c 612 613 enum rte_security_session_action_type { 614 RTE_SECURITY_ACTION_TYPE_NONE, 615 /**< No security actions */ 616 RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO, 617 /**< Crypto processing for security protocol is processed inline 618 * during transmission 619 */ 620 RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL, 621 /**< All security protocol processing is performed inline during 622 * transmission 623 */ 624 RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, 625 /**< All security protocol processing including crypto is performed 626 * on a lookaside accelerator 627 */ 628 RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO 629 /**< Similar to ACTION_TYPE_NONE but crypto processing for security 630 * protocol is processed synchronously by a CPU. 631 */ 632 }; 633 634The ``rte_security_session_protocol`` is defined as 635 636.. code-block:: c 637 638 enum rte_security_session_protocol { 639 RTE_SECURITY_PROTOCOL_IPSEC = 1, 640 /**< IPsec Protocol */ 641 RTE_SECURITY_PROTOCOL_MACSEC, 642 /**< MACSec Protocol */ 643 RTE_SECURITY_PROTOCOL_PDCP, 644 /**< PDCP Protocol */ 645 RTE_SECURITY_PROTOCOL_DOCSIS, 646 /**< DOCSIS Protocol */ 647 }; 648 649Currently the library defines configuration parameters for IPsec and PDCP only. 650For other protocols like MACSec, structures and enums are defined as place holders 651which will be updated in the future. 652 653IPsec related configuration parameters are defined in ``rte_security_ipsec_xform`` 654 655PDCP related configuration parameters are defined in ``rte_security_pdcp_xform`` 656 657DOCSIS related configuration parameters are defined in ``rte_security_docsis_xform`` 658 659 660Security API 661~~~~~~~~~~~~ 662 663The rte_security Library API is described in the *DPDK API Reference* document. 664 665Flow based Security Session 666~~~~~~~~~~~~~~~~~~~~~~~~~~~ 667 668In the case of NIC based offloads, the security session specified in the 669'rte_flow_action_security' must be created on the same port as the 670flow action that is being specified. 671 672The ingress/egress flow attribute should match that specified in the security 673session if the security session supports the definition of the direction. 674 675Multiple flows can be configured to use the same security session. For 676example if the security session specifies an egress IPsec SA, then multiple 677flows can be specified to that SA. In the case of an ingress IPsec SA then 678it is only valid to have a single flow to map to that security session. 679 680.. code-block:: console 681 682 Configuration Path 683 | 684 +--------|--------+ 685 | Add/Remove | 686 | IPsec SA | <------ Build security flow action of 687 | | | ipsec transform 688 |--------|--------| 689 | 690 +--------V--------+ 691 | Flow API | 692 +--------|--------+ 693 | 694 +--------V--------+ 695 | | 696 | NIC PMD | <------ Add/Remove SA to/from hw context 697 | | 698 +--------|--------+ 699 | 700 +--------|--------+ 701 | HW ACCELERATED | 702 | NIC | 703 | | 704 +--------|--------+ 705 706* Add/Delete SA flow: 707 To add a new inline SA construct a rte_flow_item for Ethernet + IP + ESP 708 using the SA selectors and the ``rte_crypto_ipsec_xform`` as the ``rte_flow_action``. 709 Note that any rte_flow_items may be empty, which means it is not checked. 710 711.. code-block:: console 712 713 In its most basic form, IPsec flow specification is as follows: 714 +-------+ +----------+ +--------+ +-----+ 715 | Eth | -> | IP4/6 | -> | ESP | -> | END | 716 +-------+ +----------+ +--------+ +-----+ 717 718 However, the API can represent, IPsec crypto offload with any encapsulation: 719 +-------+ +--------+ +-----+ 720 | Eth | -> ... -> | ESP | -> | END | 721 +-------+ +--------+ +-----+ 722