199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2018 Intel Corporation. 399a2dd95SBruce Richardson * All rights reserved. 499a2dd95SBruce Richardson */ 599a2dd95SBruce Richardson 699a2dd95SBruce Richardson #ifndef _RTE_EVENT_CRYPTO_ADAPTER_ 799a2dd95SBruce Richardson #define _RTE_EVENT_CRYPTO_ADAPTER_ 899a2dd95SBruce Richardson 999a2dd95SBruce Richardson /** 1099a2dd95SBruce Richardson * @file 1199a2dd95SBruce Richardson * 1299a2dd95SBruce Richardson * RTE Event crypto adapter 1399a2dd95SBruce Richardson * 1499a2dd95SBruce Richardson * Eventdev library provides couple of adapters to bridge between various 1599a2dd95SBruce Richardson * components for providing new event source. The event crypto adapter is 1699a2dd95SBruce Richardson * one of those adapters which is intended to bridge between event devices 1799a2dd95SBruce Richardson * and crypto devices. 1899a2dd95SBruce Richardson * 1999a2dd95SBruce Richardson * The crypto adapter adds support to enqueue/dequeue crypto operations to/ 2099a2dd95SBruce Richardson * from event device. The packet flow between crypto device and the event 2199a2dd95SBruce Richardson * device can be accomplished using both SW and HW based transfer mechanisms. 2299a2dd95SBruce Richardson * The adapter uses an EAL service core function for SW based packet transfer 2399a2dd95SBruce Richardson * and uses the eventdev PMD functions to configure HW based packet transfer 2499a2dd95SBruce Richardson * between the crypto device and the event device. 2599a2dd95SBruce Richardson * 2699a2dd95SBruce Richardson * The application can choose to submit a crypto operation directly to 2799a2dd95SBruce Richardson * crypto device or send it to the crypto adapter via eventdev based on 2899a2dd95SBruce Richardson * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability. 2999a2dd95SBruce Richardson * The first mode is known as the event new(RTE_EVENT_CRYPTO_ADAPTER_OP_NEW) 3099a2dd95SBruce Richardson * mode and the second as the event forward(RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD) 3199a2dd95SBruce Richardson * mode. The choice of mode can be specified while creating the adapter. 3299a2dd95SBruce Richardson * In the former mode, it is an application responsibility to enable ingress 3399a2dd95SBruce Richardson * packet ordering. In the latter mode, it is the adapter responsibility to 3499a2dd95SBruce Richardson * enable the ingress packet ordering. 3599a2dd95SBruce Richardson * 3699a2dd95SBruce Richardson * 3799a2dd95SBruce Richardson * Working model of RTE_EVENT_CRYPTO_ADAPTER_OP_NEW mode: 3899a2dd95SBruce Richardson * 3999a2dd95SBruce Richardson * +--------------+ +--------------+ 4099a2dd95SBruce Richardson * | | | Crypto stage | 4199a2dd95SBruce Richardson * | Application |---[2]-->| + enqueue to | 4299a2dd95SBruce Richardson * | | | cryptodev | 4399a2dd95SBruce Richardson * +--------------+ +--------------+ 4499a2dd95SBruce Richardson * ^ ^ | 4599a2dd95SBruce Richardson * | | [3] 4699a2dd95SBruce Richardson * [6] [1] | 4799a2dd95SBruce Richardson * | | | 4899a2dd95SBruce Richardson * +--------------+ | 4999a2dd95SBruce Richardson * | | | 5099a2dd95SBruce Richardson * | Event device | | 5199a2dd95SBruce Richardson * | | | 5299a2dd95SBruce Richardson * +--------------+ | 5399a2dd95SBruce Richardson * ^ | 5499a2dd95SBruce Richardson * | | 5599a2dd95SBruce Richardson * [5] | 5699a2dd95SBruce Richardson * | v 5799a2dd95SBruce Richardson * +--------------+ +--------------+ 5899a2dd95SBruce Richardson * | | | | 5999a2dd95SBruce Richardson * |Crypto adapter|<--[4]---| Cryptodev | 6099a2dd95SBruce Richardson * | | | | 6199a2dd95SBruce Richardson * +--------------+ +--------------+ 6299a2dd95SBruce Richardson * 6399a2dd95SBruce Richardson * 6499a2dd95SBruce Richardson * [1] Application dequeues events from the previous stage. 6599a2dd95SBruce Richardson * [2] Application prepares the crypto operations. 6699a2dd95SBruce Richardson * [3] Crypto operations are submitted to cryptodev by application. 6799a2dd95SBruce Richardson * [4] Crypto adapter dequeues crypto completions from cryptodev. 6899a2dd95SBruce Richardson * [5] Crypto adapter enqueues events to the eventdev. 6999a2dd95SBruce Richardson * [6] Application dequeues from eventdev and prepare for further 7099a2dd95SBruce Richardson * processing. 7199a2dd95SBruce Richardson * 7299a2dd95SBruce Richardson * In the RTE_EVENT_CRYPTO_ADAPTER_OP_NEW mode, application submits crypto 7399a2dd95SBruce Richardson * operations directly to crypto device. The adapter then dequeues crypto 7499a2dd95SBruce Richardson * completions from crypto device and enqueue events to the event device. 7599a2dd95SBruce Richardson * This mode does not ensure ingress ordering, if the application directly 7699a2dd95SBruce Richardson * enqueues to cryptodev without going through crypto/atomic stage i.e. 7799a2dd95SBruce Richardson * removing item [1] and [2]. 7899a2dd95SBruce Richardson * Events dequeued from the adapter will be treated as new events. 7999a2dd95SBruce Richardson * In this mode, application needs to specify event information (response 8099a2dd95SBruce Richardson * information) which is needed to enqueue an event after the crypto operation 8199a2dd95SBruce Richardson * is completed. 8299a2dd95SBruce Richardson * 8399a2dd95SBruce Richardson * 8499a2dd95SBruce Richardson * Working model of RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode: 8599a2dd95SBruce Richardson * 8699a2dd95SBruce Richardson * +--------------+ +--------------+ 8799a2dd95SBruce Richardson * --[1]-->| |---[2]-->| Application | 8899a2dd95SBruce Richardson * | Event device | | in | 8999a2dd95SBruce Richardson * <--[8]--| |<--[3]---| Ordered stage| 9099a2dd95SBruce Richardson * +--------------+ +--------------+ 9199a2dd95SBruce Richardson * ^ | 9299a2dd95SBruce Richardson * | [4] 9399a2dd95SBruce Richardson * [7] | 9499a2dd95SBruce Richardson * | v 9599a2dd95SBruce Richardson * +----------------+ +--------------+ 9699a2dd95SBruce Richardson * | |--[5]->| | 9799a2dd95SBruce Richardson * | Crypto adapter | | Cryptodev | 9899a2dd95SBruce Richardson * | |<-[6]--| | 9999a2dd95SBruce Richardson * +----------------+ +--------------+ 10099a2dd95SBruce Richardson * 10199a2dd95SBruce Richardson * 10299a2dd95SBruce Richardson * [1] Events from the previous stage. 10399a2dd95SBruce Richardson * [2] Application in ordered stage dequeues events from eventdev. 10499a2dd95SBruce Richardson * [3] Application enqueues crypto operations as events to eventdev. 10599a2dd95SBruce Richardson * [4] Crypto adapter dequeues event from eventdev. 10699a2dd95SBruce Richardson * [5] Crypto adapter submits crypto operations to cryptodev 10799a2dd95SBruce Richardson * (Atomic stage). 10899a2dd95SBruce Richardson * [6] Crypto adapter dequeues crypto completions from cryptodev 10999a2dd95SBruce Richardson * [7] Crypto adapter enqueues events to the eventdev 11099a2dd95SBruce Richardson * [8] Events to the next stage 11199a2dd95SBruce Richardson * 11299a2dd95SBruce Richardson * In the RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode, if HW supports 11399a2dd95SBruce Richardson * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability the application 11499a2dd95SBruce Richardson * can directly submit the crypto operations to the cryptodev. 11599a2dd95SBruce Richardson * If not, application retrieves crypto adapter's event port using 11699a2dd95SBruce Richardson * rte_event_crypto_adapter_event_port_get() API. Then, links its event 11799a2dd95SBruce Richardson * queue to this port and starts enqueuing crypto operations as events 11899a2dd95SBruce Richardson * to the eventdev. The adapter then dequeues the events and submits the 11999a2dd95SBruce Richardson * crypto operations to the cryptodev. After the crypto completions, the 12099a2dd95SBruce Richardson * adapter enqueues events to the event device. 12199a2dd95SBruce Richardson * Application can use this mode, when ingress packet ordering is needed. 12299a2dd95SBruce Richardson * Events dequeued from the adapter will be treated as forwarded events. 12399a2dd95SBruce Richardson * In this mode, the application needs to specify the cryptodev ID 12499a2dd95SBruce Richardson * and queue pair ID (request information) needed to enqueue a crypto 12599a2dd95SBruce Richardson * operation in addition to the event information (response information) 12699a2dd95SBruce Richardson * needed to enqueue an event after the crypto operation has completed. 12799a2dd95SBruce Richardson * 12899a2dd95SBruce Richardson * 12999a2dd95SBruce Richardson * The event crypto adapter provides common APIs to configure the packet flow 13099a2dd95SBruce Richardson * from the crypto device to event devices for both SW and HW based transfers. 13199a2dd95SBruce Richardson * The crypto event adapter's functions are: 13299a2dd95SBruce Richardson * - rte_event_crypto_adapter_create_ext() 13399a2dd95SBruce Richardson * - rte_event_crypto_adapter_create() 13499a2dd95SBruce Richardson * - rte_event_crypto_adapter_free() 13599a2dd95SBruce Richardson * - rte_event_crypto_adapter_queue_pair_add() 13699a2dd95SBruce Richardson * - rte_event_crypto_adapter_queue_pair_del() 13799a2dd95SBruce Richardson * - rte_event_crypto_adapter_start() 13899a2dd95SBruce Richardson * - rte_event_crypto_adapter_stop() 13999a2dd95SBruce Richardson * - rte_event_crypto_adapter_stats_get() 14099a2dd95SBruce Richardson * - rte_event_crypto_adapter_stats_reset() 14104ed18cdSNaga Harish K S V * - rte_event_crypto_adapter_runtime_params_get() 14204ed18cdSNaga Harish K S V * - rte_event_crypto_adapter_runtime_params_init() 14304ed18cdSNaga Harish K S V * - rte_event_crypto_adapter_runtime_params_set() 14499a2dd95SBruce Richardson 14599a2dd95SBruce Richardson * The application creates an instance using rte_event_crypto_adapter_create() 14699a2dd95SBruce Richardson * or rte_event_crypto_adapter_create_ext(). 14799a2dd95SBruce Richardson * 14899a2dd95SBruce Richardson * Cryptodev queue pair addition/deletion is done using the 14999a2dd95SBruce Richardson * rte_event_crypto_adapter_queue_pair_xxx() APIs. If HW supports 15099a2dd95SBruce Richardson * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND capability, event 15199a2dd95SBruce Richardson * information must be passed to the add API. 15299a2dd95SBruce Richardson * 15399a2dd95SBruce Richardson * The SW adapter or HW PMD uses rte_crypto_op::sess_type to decide whether 15499a2dd95SBruce Richardson * request/response(private) data is located in the crypto/security session 15599a2dd95SBruce Richardson * or at an offset in the rte_crypto_op. 15699a2dd95SBruce Richardson * 15799a2dd95SBruce Richardson * For session-based operations, the set and get API provides a mechanism for 15899a2dd95SBruce Richardson * an application to store and retrieve the data information stored 15999a2dd95SBruce Richardson * along with the crypto session. 16099a2dd95SBruce Richardson * The RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA capability indicates 16199a2dd95SBruce Richardson * whether HW or SW supports this feature. 16299a2dd95SBruce Richardson * 16399a2dd95SBruce Richardson * For session-less mode, the adapter gets the private data information placed 16499a2dd95SBruce Richardson * along with the ``struct rte_crypto_op``. 16599a2dd95SBruce Richardson * The rte_crypto_op::private_data_offset provides an offset to locate the 16699a2dd95SBruce Richardson * request/response information in the rte_crypto_op. This offset is counted 16799a2dd95SBruce Richardson * from the start of the rte_crypto_op including initialization vector (IV). 16899a2dd95SBruce Richardson */ 16999a2dd95SBruce Richardson 17099a2dd95SBruce Richardson #include <stdint.h> 17199a2dd95SBruce Richardson 17299a2dd95SBruce Richardson #include "rte_eventdev.h" 17399a2dd95SBruce Richardson 174*719834a6SMattias Rönnblom #ifdef __cplusplus 175*719834a6SMattias Rönnblom extern "C" { 176*719834a6SMattias Rönnblom #endif 177*719834a6SMattias Rönnblom 17899a2dd95SBruce Richardson /** 17999a2dd95SBruce Richardson * Crypto event adapter mode 18099a2dd95SBruce Richardson */ 18199a2dd95SBruce Richardson enum rte_event_crypto_adapter_mode { 18299a2dd95SBruce Richardson RTE_EVENT_CRYPTO_ADAPTER_OP_NEW, 18399a2dd95SBruce Richardson /**< Start the crypto adapter in event new mode. 18499a2dd95SBruce Richardson * @see RTE_EVENT_OP_NEW. 18599a2dd95SBruce Richardson * Application submits crypto operations to the cryptodev. 18699a2dd95SBruce Richardson * Adapter only dequeues the crypto completions from cryptodev 18799a2dd95SBruce Richardson * and enqueue events to the eventdev. 18899a2dd95SBruce Richardson */ 18999a2dd95SBruce Richardson RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD, 19099a2dd95SBruce Richardson /**< Start the crypto adapter in event forward mode. 19199a2dd95SBruce Richardson * @see RTE_EVENT_OP_FORWARD. 19299a2dd95SBruce Richardson * Application submits crypto requests as events to the crypto 19399a2dd95SBruce Richardson * adapter or crypto device based on 19499a2dd95SBruce Richardson * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability. 19599a2dd95SBruce Richardson * Crypto completions are enqueued back to the eventdev by 19699a2dd95SBruce Richardson * crypto adapter. 19799a2dd95SBruce Richardson */ 19899a2dd95SBruce Richardson }; 19999a2dd95SBruce Richardson 20099a2dd95SBruce Richardson /** 20199a2dd95SBruce Richardson * Crypto event request structure will be filled by application to 20299a2dd95SBruce Richardson * provide event request information to the adapter. 20399a2dd95SBruce Richardson */ 20499a2dd95SBruce Richardson struct rte_event_crypto_request { 20599a2dd95SBruce Richardson uint8_t resv[8]; 20699a2dd95SBruce Richardson /**< Overlaps with first 8 bytes of struct rte_event 20799a2dd95SBruce Richardson * that encode the response event information. Application 20899a2dd95SBruce Richardson * is expected to fill in struct rte_event response_info. 20999a2dd95SBruce Richardson */ 21099a2dd95SBruce Richardson uint16_t cdev_id; 21199a2dd95SBruce Richardson /**< cryptodev ID to be used */ 21299a2dd95SBruce Richardson uint16_t queue_pair_id; 21399a2dd95SBruce Richardson /**< cryptodev queue pair ID to be used */ 21499a2dd95SBruce Richardson uint32_t resv1; 21599a2dd95SBruce Richardson /**< Reserved bits */ 21699a2dd95SBruce Richardson }; 21799a2dd95SBruce Richardson 21899a2dd95SBruce Richardson /** 21999a2dd95SBruce Richardson * Crypto event metadata structure will be filled by application 22099a2dd95SBruce Richardson * to provide crypto request and event response information. 22199a2dd95SBruce Richardson * 22299a2dd95SBruce Richardson * If crypto events are enqueued using a HW mechanism, the cryptodev 22399a2dd95SBruce Richardson * PMD will use the event response information to set up the event 22499a2dd95SBruce Richardson * that is enqueued back to eventdev after completion of the crypto 22599a2dd95SBruce Richardson * operation. If the transfer is done by SW, event response information 22699a2dd95SBruce Richardson * will be used by the adapter. 22799a2dd95SBruce Richardson */ 22899a2dd95SBruce Richardson union rte_event_crypto_metadata { 22999a2dd95SBruce Richardson struct rte_event_crypto_request request_info; 23099a2dd95SBruce Richardson /**< Request information to be filled in by application 23199a2dd95SBruce Richardson * for RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode. 232dd451ad1SShijith Thotton * First 8 bytes of request_info is reserved for response_info. 23399a2dd95SBruce Richardson */ 23499a2dd95SBruce Richardson struct rte_event response_info; 23599a2dd95SBruce Richardson /**< Response information to be filled in by application 23699a2dd95SBruce Richardson * for RTE_EVENT_CRYPTO_ADAPTER_OP_NEW and 23799a2dd95SBruce Richardson * RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode. 23899a2dd95SBruce Richardson */ 23999a2dd95SBruce Richardson }; 24099a2dd95SBruce Richardson 24199a2dd95SBruce Richardson /** 24299a2dd95SBruce Richardson * Adapter configuration structure that the adapter configuration callback 24399a2dd95SBruce Richardson * function is expected to fill out 24499a2dd95SBruce Richardson * @see rte_event_crypto_adapter_conf_cb 24599a2dd95SBruce Richardson */ 24699a2dd95SBruce Richardson struct rte_event_crypto_adapter_conf { 24799a2dd95SBruce Richardson uint8_t event_port_id; 24899a2dd95SBruce Richardson /**< Event port identifier, the adapter enqueues events to this 24999a2dd95SBruce Richardson * port and dequeues crypto request events in 25099a2dd95SBruce Richardson * RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode. 25199a2dd95SBruce Richardson */ 25299a2dd95SBruce Richardson uint32_t max_nb; 25399a2dd95SBruce Richardson /**< The adapter can return early if it has processed at least 25499a2dd95SBruce Richardson * max_nb crypto ops. This isn't treated as a requirement; batching 25599a2dd95SBruce Richardson * may cause the adapter to process more than max_nb crypto ops. 25699a2dd95SBruce Richardson */ 25799a2dd95SBruce Richardson }; 25899a2dd95SBruce Richardson 25904ed18cdSNaga Harish K S V /** 26004ed18cdSNaga Harish K S V * Adapter runtime configuration parameters 26104ed18cdSNaga Harish K S V */ 26204ed18cdSNaga Harish K S V struct rte_event_crypto_adapter_runtime_params { 26304ed18cdSNaga Harish K S V uint32_t max_nb; 26404ed18cdSNaga Harish K S V /**< The adapter can return early if it has processed at least 26504ed18cdSNaga Harish K S V * max_nb crypto ops. This isn't treated as a requirement; batching 26604ed18cdSNaga Harish K S V * may cause the adapter to process more than max_nb crypto ops. 26704ed18cdSNaga Harish K S V * 26804ed18cdSNaga Harish K S V * rte_event_crypto_adapter_create() configures the 26904ed18cdSNaga Harish K S V * adapter with default value of max_nb. 27004ed18cdSNaga Harish K S V * rte_event_crypto_adapter_create_ext() configures the adapter with 27104ed18cdSNaga Harish K S V * user provided value of max_nb through 27204ed18cdSNaga Harish K S V * rte_event_crypto_adapter_conf::max_nb parameter. 27304ed18cdSNaga Harish K S V * rte_event_cryptoadapter_runtime_params_set() allows to re-configure 27404ed18cdSNaga Harish K S V * max_nb during runtime (after adding at least one queue pair) 27504ed18cdSNaga Harish K S V * 27604ed18cdSNaga Harish K S V * This is valid for the devices without 27704ed18cdSNaga Harish K S V * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD or 27804ed18cdSNaga Harish K S V * RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW capability. 27904ed18cdSNaga Harish K S V */ 28004ed18cdSNaga Harish K S V uint32_t rsvd[15]; 28104ed18cdSNaga Harish K S V /**< Reserved fields for future expansion */ 28204ed18cdSNaga Harish K S V }; 28304ed18cdSNaga Harish K S V 284c1749bc5SVolodymyr Fialko #define RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 0x1 285c1749bc5SVolodymyr Fialko /**< This flag indicates that crypto operations processed on the crypto 286c1749bc5SVolodymyr Fialko * adapter need to be vectorized 287c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::flags 288c1749bc5SVolodymyr Fialko */ 289c1749bc5SVolodymyr Fialko 290c1749bc5SVolodymyr Fialko /** 291c1749bc5SVolodymyr Fialko * Adapter queue configuration structure 292c1749bc5SVolodymyr Fialko */ 293c1749bc5SVolodymyr Fialko struct rte_event_crypto_adapter_queue_conf { 294c1749bc5SVolodymyr Fialko uint32_t flags; 295c1749bc5SVolodymyr Fialko /**< Flags for handling crypto operations 296c1749bc5SVolodymyr Fialko * @see RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR 297c1749bc5SVolodymyr Fialko */ 298c1749bc5SVolodymyr Fialko struct rte_event ev; 299c1749bc5SVolodymyr Fialko /**< If HW supports cryptodev queue pair to event queue binding, 300c1749bc5SVolodymyr Fialko * application is expected to fill in event information. 301c1749bc5SVolodymyr Fialko * @see RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND 302c1749bc5SVolodymyr Fialko */ 303c1749bc5SVolodymyr Fialko uint16_t vector_sz; 304c1749bc5SVolodymyr Fialko /**< Indicates the maximum number for crypto operations to combine and 305c1749bc5SVolodymyr Fialko * form a vector. 306c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_vector_limits::min_sz 307c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_vector_limits::max_sz 308c1749bc5SVolodymyr Fialko * Valid when RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR flag is set in 309c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::flags 310c1749bc5SVolodymyr Fialko */ 311c1749bc5SVolodymyr Fialko uint64_t vector_timeout_ns; 312c1749bc5SVolodymyr Fialko /**< 313c1749bc5SVolodymyr Fialko * Indicates the maximum number of nanoseconds to wait for aggregating 314c1749bc5SVolodymyr Fialko * crypto operations. Should be within vectorization limits of the 315c1749bc5SVolodymyr Fialko * adapter 316c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_vector_limits::min_timeout_ns 317c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_vector_limits::max_timeout_ns 318c1749bc5SVolodymyr Fialko * Valid when RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR flag is set in 319c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::flags 320c1749bc5SVolodymyr Fialko */ 321c1749bc5SVolodymyr Fialko struct rte_mempool *vector_mp; 322c1749bc5SVolodymyr Fialko /**< Indicates the mempool that should be used for allocating 323c1749bc5SVolodymyr Fialko * rte_event_vector container. 324c1749bc5SVolodymyr Fialko * Should be created by using `rte_event_vector_pool_create`. 325c1749bc5SVolodymyr Fialko * Valid when RTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR flag is set in 326c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::flags. 327c1749bc5SVolodymyr Fialko */ 328c1749bc5SVolodymyr Fialko }; 329c1749bc5SVolodymyr Fialko 330c1749bc5SVolodymyr Fialko /** 331c1749bc5SVolodymyr Fialko * A structure used to retrieve event crypto adapter vector limits. 332c1749bc5SVolodymyr Fialko */ 333c1749bc5SVolodymyr Fialko struct rte_event_crypto_adapter_vector_limits { 334c1749bc5SVolodymyr Fialko uint16_t min_sz; 335c1749bc5SVolodymyr Fialko /**< Minimum vector limit configurable. 336c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::vector_sz 337c1749bc5SVolodymyr Fialko */ 338c1749bc5SVolodymyr Fialko uint16_t max_sz; 339c1749bc5SVolodymyr Fialko /**< Maximum vector limit configurable. 340c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::vector_sz 341c1749bc5SVolodymyr Fialko */ 342c1749bc5SVolodymyr Fialko uint8_t log2_sz; 343c1749bc5SVolodymyr Fialko /**< True if the size configured should be in log2. 344c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::vector_sz 345c1749bc5SVolodymyr Fialko */ 346c1749bc5SVolodymyr Fialko uint64_t min_timeout_ns; 347c1749bc5SVolodymyr Fialko /**< Minimum vector timeout configurable. 348c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::vector_timeout_ns 349c1749bc5SVolodymyr Fialko */ 350c1749bc5SVolodymyr Fialko uint64_t max_timeout_ns; 351c1749bc5SVolodymyr Fialko /**< Maximum vector timeout configurable. 352c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_queue_conf::vector_timeout_ns 353c1749bc5SVolodymyr Fialko */ 354c1749bc5SVolodymyr Fialko }; 355c1749bc5SVolodymyr Fialko 35699a2dd95SBruce Richardson /** 35799a2dd95SBruce Richardson * Function type used for adapter configuration callback. The callback is 35899a2dd95SBruce Richardson * used to fill in members of the struct rte_event_crypto_adapter_conf, this 35999a2dd95SBruce Richardson * callback is invoked when creating a SW service for packet transfer from 36099a2dd95SBruce Richardson * cryptodev queue pair to the event device. The SW service is created within 36199a2dd95SBruce Richardson * the rte_event_crypto_adapter_queue_pair_add() function if SW based packet 36299a2dd95SBruce Richardson * transfers from cryptodev queue pair to the event device are required. 36399a2dd95SBruce Richardson * 36499a2dd95SBruce Richardson * @param id 36599a2dd95SBruce Richardson * Adapter identifier. 36699a2dd95SBruce Richardson * 36799a2dd95SBruce Richardson * @param dev_id 36899a2dd95SBruce Richardson * Event device identifier. 36999a2dd95SBruce Richardson * 37099a2dd95SBruce Richardson * @param conf 37199a2dd95SBruce Richardson * Structure that needs to be populated by this callback. 37299a2dd95SBruce Richardson * 37399a2dd95SBruce Richardson * @param arg 37499a2dd95SBruce Richardson * Argument to the callback. This is the same as the conf_arg passed to the 37599a2dd95SBruce Richardson * rte_event_crypto_adapter_create_ext(). 37699a2dd95SBruce Richardson */ 37799a2dd95SBruce Richardson typedef int (*rte_event_crypto_adapter_conf_cb) (uint8_t id, uint8_t dev_id, 37899a2dd95SBruce Richardson struct rte_event_crypto_adapter_conf *conf, 37999a2dd95SBruce Richardson void *arg); 38099a2dd95SBruce Richardson 38199a2dd95SBruce Richardson /** 38299a2dd95SBruce Richardson * A structure used to retrieve statistics for an event crypto adapter 38399a2dd95SBruce Richardson * instance. 38499a2dd95SBruce Richardson */ 38599a2dd95SBruce Richardson 38699a2dd95SBruce Richardson struct rte_event_crypto_adapter_stats { 38799a2dd95SBruce Richardson uint64_t event_poll_count; 38899a2dd95SBruce Richardson /**< Event port poll count */ 38999a2dd95SBruce Richardson uint64_t event_deq_count; 39099a2dd95SBruce Richardson /**< Event dequeue count */ 39199a2dd95SBruce Richardson uint64_t crypto_enq_count; 39299a2dd95SBruce Richardson /**< Cryptodev enqueue count */ 39399a2dd95SBruce Richardson uint64_t crypto_enq_fail; 39499a2dd95SBruce Richardson /**< Cryptodev enqueue failed count */ 39599a2dd95SBruce Richardson uint64_t crypto_deq_count; 39699a2dd95SBruce Richardson /**< Cryptodev dequeue count */ 39799a2dd95SBruce Richardson uint64_t event_enq_count; 39899a2dd95SBruce Richardson /**< Event enqueue count */ 39999a2dd95SBruce Richardson uint64_t event_enq_retry_count; 40099a2dd95SBruce Richardson /**< Event enqueue retry count */ 40199a2dd95SBruce Richardson uint64_t event_enq_fail_count; 40299a2dd95SBruce Richardson /**< Event enqueue fail count */ 40399a2dd95SBruce Richardson }; 40499a2dd95SBruce Richardson 40599a2dd95SBruce Richardson /** 40699a2dd95SBruce Richardson * Create a new event crypto adapter with the specified identifier. 40799a2dd95SBruce Richardson * 40899a2dd95SBruce Richardson * @param id 40999a2dd95SBruce Richardson * Adapter identifier. 41099a2dd95SBruce Richardson * 41199a2dd95SBruce Richardson * @param dev_id 41299a2dd95SBruce Richardson * Event device identifier. 41399a2dd95SBruce Richardson * 41499a2dd95SBruce Richardson * @param conf_cb 41599a2dd95SBruce Richardson * Callback function that fills in members of a 41699a2dd95SBruce Richardson * struct rte_event_crypto_adapter_conf struct passed into 41799a2dd95SBruce Richardson * it. 41899a2dd95SBruce Richardson * 41999a2dd95SBruce Richardson * @param mode 42099a2dd95SBruce Richardson * Flag to indicate the mode of the adapter. 42199a2dd95SBruce Richardson * @see rte_event_crypto_adapter_mode 42299a2dd95SBruce Richardson * 42399a2dd95SBruce Richardson * @param conf_arg 42499a2dd95SBruce Richardson * Argument that is passed to the conf_cb function. 42599a2dd95SBruce Richardson * 42699a2dd95SBruce Richardson * @return 42799a2dd95SBruce Richardson * - 0: Success 42899a2dd95SBruce Richardson * - <0: Error code on failure 42999a2dd95SBruce Richardson */ 43099a2dd95SBruce Richardson int 43199a2dd95SBruce Richardson rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id, 43299a2dd95SBruce Richardson rte_event_crypto_adapter_conf_cb conf_cb, 43399a2dd95SBruce Richardson enum rte_event_crypto_adapter_mode mode, 43499a2dd95SBruce Richardson void *conf_arg); 43599a2dd95SBruce Richardson 43699a2dd95SBruce Richardson /** 43799a2dd95SBruce Richardson * Create a new event crypto adapter with the specified identifier. 43899a2dd95SBruce Richardson * This function uses an internal configuration function that creates an event 43999a2dd95SBruce Richardson * port. This default function reconfigures the event device with an 44099a2dd95SBruce Richardson * additional event port and set up the event port using the port_config 44199a2dd95SBruce Richardson * parameter passed into this function. In case the application needs more 44299a2dd95SBruce Richardson * control in configuration of the service, it should use the 44399a2dd95SBruce Richardson * rte_event_crypto_adapter_create_ext() version. 44499a2dd95SBruce Richardson * 445e55d9dcaSNaga Harish K S V * When this API is used for creating adapter instance, 446e55d9dcaSNaga Harish K S V * ``rte_event_dev_config::nb_event_ports`` is automatically incremented, 447e55d9dcaSNaga Harish K S V * and the event device is reconfigured with additional event port during 448e55d9dcaSNaga Harish K S V * service initialization. This event device reconfigure logic also increments 449e55d9dcaSNaga Harish K S V * the ``rte_event_dev_config::nb_single_link_event_port_queues`` 450e55d9dcaSNaga Harish K S V * parameter if the adapter event port config is of type 451e55d9dcaSNaga Harish K S V * ``RTE_EVENT_PORT_CFG_SINGLE_LINK``. 452e55d9dcaSNaga Harish K S V * 453e55d9dcaSNaga Harish K S V * Application no longer needs to account for 454e55d9dcaSNaga Harish K S V * ``rte_event_dev_config::nb_event_ports`` and 455e55d9dcaSNaga Harish K S V * ``rte_event_dev_config::nb_single_link_event_port_queues`` 456e55d9dcaSNaga Harish K S V * parameters required for crypto adapter in event device configuration 457e55d9dcaSNaga Harish K S V * when the adapter is created with this API. 458e55d9dcaSNaga Harish K S V * 45999a2dd95SBruce Richardson * @param id 46099a2dd95SBruce Richardson * Adapter identifier. 46199a2dd95SBruce Richardson * 46299a2dd95SBruce Richardson * @param dev_id 46399a2dd95SBruce Richardson * Event device identifier. 46499a2dd95SBruce Richardson * 46599a2dd95SBruce Richardson * @param port_config 46699a2dd95SBruce Richardson * Argument of type *rte_event_port_conf* that is passed to the conf_cb 46799a2dd95SBruce Richardson * function. 46899a2dd95SBruce Richardson * 46999a2dd95SBruce Richardson * @param mode 47099a2dd95SBruce Richardson * Flag to indicate the mode of the adapter. 47199a2dd95SBruce Richardson * @see rte_event_crypto_adapter_mode 47299a2dd95SBruce Richardson * 47399a2dd95SBruce Richardson * @return 47499a2dd95SBruce Richardson * - 0: Success 47599a2dd95SBruce Richardson * - <0: Error code on failure 47699a2dd95SBruce Richardson */ 47799a2dd95SBruce Richardson int 47899a2dd95SBruce Richardson rte_event_crypto_adapter_create(uint8_t id, uint8_t dev_id, 47999a2dd95SBruce Richardson struct rte_event_port_conf *port_config, 48099a2dd95SBruce Richardson enum rte_event_crypto_adapter_mode mode); 48199a2dd95SBruce Richardson 48299a2dd95SBruce Richardson /** 48399a2dd95SBruce Richardson * Free an event crypto adapter 48499a2dd95SBruce Richardson * 48599a2dd95SBruce Richardson * @param id 48699a2dd95SBruce Richardson * Adapter identifier. 48799a2dd95SBruce Richardson * 48899a2dd95SBruce Richardson * @return 48999a2dd95SBruce Richardson * - 0: Success 49099a2dd95SBruce Richardson * - <0: Error code on failure, If the adapter still has queue pairs 49199a2dd95SBruce Richardson * added to it, the function returns -EBUSY. 49299a2dd95SBruce Richardson */ 49399a2dd95SBruce Richardson int 49499a2dd95SBruce Richardson rte_event_crypto_adapter_free(uint8_t id); 49599a2dd95SBruce Richardson 49699a2dd95SBruce Richardson /** 49799a2dd95SBruce Richardson * Add a queue pair to an event crypto adapter. 49899a2dd95SBruce Richardson * 49999a2dd95SBruce Richardson * @param id 50099a2dd95SBruce Richardson * Adapter identifier. 50199a2dd95SBruce Richardson * 50299a2dd95SBruce Richardson * @param cdev_id 50399a2dd95SBruce Richardson * Cryptodev identifier. 50499a2dd95SBruce Richardson * 50599a2dd95SBruce Richardson * @param queue_pair_id 50699a2dd95SBruce Richardson * Cryptodev queue pair identifier. If queue_pair_id is set -1, 50799a2dd95SBruce Richardson * adapter adds all the pre configured queue pairs to the instance. 50899a2dd95SBruce Richardson * 509c1749bc5SVolodymyr Fialko * @param conf 510c1749bc5SVolodymyr Fialko * Additional configuration structure of type 511c1749bc5SVolodymyr Fialko * *rte_event_crypto_adapter_queue_conf* 51299a2dd95SBruce Richardson * 51399a2dd95SBruce Richardson * @return 51499a2dd95SBruce Richardson * - 0: Success, queue pair added correctly. 51599a2dd95SBruce Richardson * - <0: Error code on failure. 51699a2dd95SBruce Richardson */ 51799a2dd95SBruce Richardson int 51899a2dd95SBruce Richardson rte_event_crypto_adapter_queue_pair_add(uint8_t id, 51999a2dd95SBruce Richardson uint8_t cdev_id, 52099a2dd95SBruce Richardson int32_t queue_pair_id, 521c1749bc5SVolodymyr Fialko const struct rte_event_crypto_adapter_queue_conf *conf); 52299a2dd95SBruce Richardson 52399a2dd95SBruce Richardson /** 52499a2dd95SBruce Richardson * Delete a queue pair from an event crypto adapter. 52599a2dd95SBruce Richardson * 52699a2dd95SBruce Richardson * @param id 52799a2dd95SBruce Richardson * Adapter identifier. 52899a2dd95SBruce Richardson * 52999a2dd95SBruce Richardson * @param cdev_id 53099a2dd95SBruce Richardson * Cryptodev identifier. 53199a2dd95SBruce Richardson * 53299a2dd95SBruce Richardson * @param queue_pair_id 53399a2dd95SBruce Richardson * Cryptodev queue pair identifier. 53499a2dd95SBruce Richardson * 53599a2dd95SBruce Richardson * @return 53699a2dd95SBruce Richardson * - 0: Success, queue pair deleted successfully. 53799a2dd95SBruce Richardson * - <0: Error code on failure. 53899a2dd95SBruce Richardson */ 53999a2dd95SBruce Richardson int 54099a2dd95SBruce Richardson rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id, 54199a2dd95SBruce Richardson int32_t queue_pair_id); 54299a2dd95SBruce Richardson 54399a2dd95SBruce Richardson /** 54499a2dd95SBruce Richardson * Start event crypto adapter 54599a2dd95SBruce Richardson * 54699a2dd95SBruce Richardson * @param id 54799a2dd95SBruce Richardson * Adapter identifier. 54899a2dd95SBruce Richardson * 54999a2dd95SBruce Richardson * 55099a2dd95SBruce Richardson * @return 55199a2dd95SBruce Richardson * - 0: Success, adapter started successfully. 55299a2dd95SBruce Richardson * - <0: Error code on failure. 55399a2dd95SBruce Richardson * 55499a2dd95SBruce Richardson * @note 555e3f128dbSShijith Thotton * The eventdev and cryptodev to which the event_crypto_adapter is connected 556e3f128dbSShijith Thotton * needs to be started before calling rte_event_crypto_adapter_start(). 55799a2dd95SBruce Richardson */ 55899a2dd95SBruce Richardson int 55999a2dd95SBruce Richardson rte_event_crypto_adapter_start(uint8_t id); 56099a2dd95SBruce Richardson 56199a2dd95SBruce Richardson /** 56299a2dd95SBruce Richardson * Stop event crypto adapter 56399a2dd95SBruce Richardson * 56499a2dd95SBruce Richardson * @param id 56599a2dd95SBruce Richardson * Adapter identifier. 56699a2dd95SBruce Richardson * 56799a2dd95SBruce Richardson * @return 56899a2dd95SBruce Richardson * - 0: Success, adapter stopped successfully. 56999a2dd95SBruce Richardson * - <0: Error code on failure. 57099a2dd95SBruce Richardson */ 57199a2dd95SBruce Richardson int 57299a2dd95SBruce Richardson rte_event_crypto_adapter_stop(uint8_t id); 57399a2dd95SBruce Richardson 57499a2dd95SBruce Richardson /** 57599a2dd95SBruce Richardson * Retrieve statistics for an adapter 57699a2dd95SBruce Richardson * 57799a2dd95SBruce Richardson * @param id 57899a2dd95SBruce Richardson * Adapter identifier. 57999a2dd95SBruce Richardson * 58099a2dd95SBruce Richardson * @param [out] stats 58199a2dd95SBruce Richardson * A pointer to structure used to retrieve statistics for an adapter. 58299a2dd95SBruce Richardson * 58399a2dd95SBruce Richardson * @return 58499a2dd95SBruce Richardson * - 0: Success, retrieved successfully. 58599a2dd95SBruce Richardson * - <0: Error code on failure. 58699a2dd95SBruce Richardson */ 58799a2dd95SBruce Richardson int 58899a2dd95SBruce Richardson rte_event_crypto_adapter_stats_get(uint8_t id, 58999a2dd95SBruce Richardson struct rte_event_crypto_adapter_stats *stats); 59099a2dd95SBruce Richardson 59199a2dd95SBruce Richardson /** 59299a2dd95SBruce Richardson * Reset statistics for an adapter. 59399a2dd95SBruce Richardson * 59499a2dd95SBruce Richardson * @param id 59599a2dd95SBruce Richardson * Adapter identifier. 59699a2dd95SBruce Richardson * 59799a2dd95SBruce Richardson * @return 59899a2dd95SBruce Richardson * - 0: Success, statistics reset successfully. 59999a2dd95SBruce Richardson * - <0: Error code on failure. 60099a2dd95SBruce Richardson */ 60199a2dd95SBruce Richardson int 60299a2dd95SBruce Richardson rte_event_crypto_adapter_stats_reset(uint8_t id); 60399a2dd95SBruce Richardson 60499a2dd95SBruce Richardson /** 60599a2dd95SBruce Richardson * Retrieve the service ID of an adapter. If the adapter doesn't use 60699a2dd95SBruce Richardson * a rte_service function, this function returns -ESRCH. 60799a2dd95SBruce Richardson * 60899a2dd95SBruce Richardson * @param id 60999a2dd95SBruce Richardson * Adapter identifier. 61099a2dd95SBruce Richardson * 61199a2dd95SBruce Richardson * @param [out] service_id 61299a2dd95SBruce Richardson * A pointer to a uint32_t, to be filled in with the service id. 61399a2dd95SBruce Richardson * 61499a2dd95SBruce Richardson * @return 61599a2dd95SBruce Richardson * - 0: Success 61699a2dd95SBruce Richardson * - <0: Error code on failure, if the adapter doesn't use a rte_service 61799a2dd95SBruce Richardson * function, this function returns -ESRCH. 61899a2dd95SBruce Richardson */ 61999a2dd95SBruce Richardson int 62099a2dd95SBruce Richardson rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id); 62199a2dd95SBruce Richardson 62299a2dd95SBruce Richardson /** 62399a2dd95SBruce Richardson * Retrieve the event port of an adapter. 62499a2dd95SBruce Richardson * 62599a2dd95SBruce Richardson * @param id 62699a2dd95SBruce Richardson * Adapter identifier. 62799a2dd95SBruce Richardson * 62899a2dd95SBruce Richardson * @param [out] event_port_id 62999a2dd95SBruce Richardson * Application links its event queue to this adapter port which is used 63099a2dd95SBruce Richardson * in RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode. 63199a2dd95SBruce Richardson * 63299a2dd95SBruce Richardson * @return 63399a2dd95SBruce Richardson * - 0: Success 63499a2dd95SBruce Richardson * - <0: Error code on failure. 63599a2dd95SBruce Richardson */ 63699a2dd95SBruce Richardson int 63799a2dd95SBruce Richardson rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id); 63899a2dd95SBruce Richardson 63999a2dd95SBruce Richardson /** 64004ed18cdSNaga Harish K S V * Initialize the adapter runtime configuration parameters 64104ed18cdSNaga Harish K S V * 64204ed18cdSNaga Harish K S V * @param params 64304ed18cdSNaga Harish K S V * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params 64404ed18cdSNaga Harish K S V * 64504ed18cdSNaga Harish K S V * @return 64604ed18cdSNaga Harish K S V * - 0: Success 64704ed18cdSNaga Harish K S V * - <0: Error code on failure 64804ed18cdSNaga Harish K S V */ 64904ed18cdSNaga Harish K S V __rte_experimental 65004ed18cdSNaga Harish K S V int 65104ed18cdSNaga Harish K S V rte_event_crypto_adapter_runtime_params_init( 65204ed18cdSNaga Harish K S V struct rte_event_crypto_adapter_runtime_params *params); 65304ed18cdSNaga Harish K S V 65404ed18cdSNaga Harish K S V /** 65504ed18cdSNaga Harish K S V * Set the adapter runtime configuration parameters 65604ed18cdSNaga Harish K S V * 65704ed18cdSNaga Harish K S V * @param id 65804ed18cdSNaga Harish K S V * Adapter identifier 65904ed18cdSNaga Harish K S V * 66004ed18cdSNaga Harish K S V * @param params 66104ed18cdSNaga Harish K S V * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params 66204ed18cdSNaga Harish K S V * with configuration parameter values. The reserved fields of this structure 66304ed18cdSNaga Harish K S V * must be initialized to zero and the valid fields need to be set appropriately. 66404ed18cdSNaga Harish K S V * This struct can be initialized using 66504ed18cdSNaga Harish K S V * rte_event_crypto_adapter_runtime_params_init() API to default values or 66604ed18cdSNaga Harish K S V * application may reset this struct and update required fields. 66704ed18cdSNaga Harish K S V * 66804ed18cdSNaga Harish K S V * @return 66904ed18cdSNaga Harish K S V * - 0: Success 67004ed18cdSNaga Harish K S V * - <0: Error code on failure 67104ed18cdSNaga Harish K S V */ 67204ed18cdSNaga Harish K S V __rte_experimental 67304ed18cdSNaga Harish K S V int 67404ed18cdSNaga Harish K S V rte_event_crypto_adapter_runtime_params_set(uint8_t id, 67504ed18cdSNaga Harish K S V struct rte_event_crypto_adapter_runtime_params *params); 67604ed18cdSNaga Harish K S V 67704ed18cdSNaga Harish K S V /** 67804ed18cdSNaga Harish K S V * Get the adapter runtime configuration parameters 67904ed18cdSNaga Harish K S V * 68004ed18cdSNaga Harish K S V * @param id 68104ed18cdSNaga Harish K S V * Adapter identifier 68204ed18cdSNaga Harish K S V * 68304ed18cdSNaga Harish K S V * @param[out] params 68404ed18cdSNaga Harish K S V * A pointer to structure of type struct rte_event_crypto_adapter_runtime_params 68504ed18cdSNaga Harish K S V * containing valid adapter parameters when return value is 0. 68604ed18cdSNaga Harish K S V * 68704ed18cdSNaga Harish K S V * @return 68804ed18cdSNaga Harish K S V * - 0: Success 68904ed18cdSNaga Harish K S V * - <0: Error code on failure 69004ed18cdSNaga Harish K S V */ 69104ed18cdSNaga Harish K S V __rte_experimental 69204ed18cdSNaga Harish K S V int 69304ed18cdSNaga Harish K S V rte_event_crypto_adapter_runtime_params_get(uint8_t id, 69404ed18cdSNaga Harish K S V struct rte_event_crypto_adapter_runtime_params *params); 69504ed18cdSNaga Harish K S V 69604ed18cdSNaga Harish K S V /** 697c1749bc5SVolodymyr Fialko * Retrieve vector limits for a given event dev and crypto dev pair. 698c1749bc5SVolodymyr Fialko * @see rte_event_crypto_adapter_vector_limits 699c1749bc5SVolodymyr Fialko * 700c1749bc5SVolodymyr Fialko * @param dev_id 701c1749bc5SVolodymyr Fialko * Event device identifier. 702c1749bc5SVolodymyr Fialko * @param cdev_id 703c1749bc5SVolodymyr Fialko * Crypto device identifier. 704c1749bc5SVolodymyr Fialko * @param [out] limits 705c1749bc5SVolodymyr Fialko * A pointer to rte_event_crypto_adapter_vector_limits structure that has to 706c1749bc5SVolodymyr Fialko * be filled. 707c1749bc5SVolodymyr Fialko * 708c1749bc5SVolodymyr Fialko * @return 709c1749bc5SVolodymyr Fialko * - 0: Success. 710c1749bc5SVolodymyr Fialko * - <0: Error code on failure. 711c1749bc5SVolodymyr Fialko */ 712c1749bc5SVolodymyr Fialko int rte_event_crypto_adapter_vector_limits_get( 713c1749bc5SVolodymyr Fialko uint8_t dev_id, uint16_t cdev_id, 714c1749bc5SVolodymyr Fialko struct rte_event_crypto_adapter_vector_limits *limits); 715c1749bc5SVolodymyr Fialko 716c1749bc5SVolodymyr Fialko /** 71799a2dd95SBruce Richardson * Enqueue a burst of crypto operations as event objects supplied in *rte_event* 71899a2dd95SBruce Richardson * structure on an event crypto adapter designated by its event *dev_id* through 71999a2dd95SBruce Richardson * the event port specified by *port_id*. This function is supported if the 72099a2dd95SBruce Richardson * eventdev PMD has the #RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD 72199a2dd95SBruce Richardson * capability flag set. 72299a2dd95SBruce Richardson * 72399a2dd95SBruce Richardson * The *nb_events* parameter is the number of event objects to enqueue which are 72499a2dd95SBruce Richardson * supplied in the *ev* array of *rte_event* structure. 72599a2dd95SBruce Richardson * 72699a2dd95SBruce Richardson * The rte_event_crypto_adapter_enqueue() function returns the number of 72799a2dd95SBruce Richardson * event objects it actually enqueued. A return value equal to *nb_events* 72899a2dd95SBruce Richardson * means that all event objects have been enqueued. 72999a2dd95SBruce Richardson * 73099a2dd95SBruce Richardson * @param dev_id 73199a2dd95SBruce Richardson * The identifier of the device. 73299a2dd95SBruce Richardson * @param port_id 73399a2dd95SBruce Richardson * The identifier of the event port. 73499a2dd95SBruce Richardson * @param ev 73599a2dd95SBruce Richardson * Points to an array of *nb_events* objects of type *rte_event* structure 73699a2dd95SBruce Richardson * which contain the event object enqueue operations to be processed. 73799a2dd95SBruce Richardson * @param nb_events 73899a2dd95SBruce Richardson * The number of event objects to enqueue, typically number of 73999a2dd95SBruce Richardson * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...) 74099a2dd95SBruce Richardson * available for this port. 74199a2dd95SBruce Richardson * 74299a2dd95SBruce Richardson * @return 74399a2dd95SBruce Richardson * The number of event objects actually enqueued on the event device. The 74499a2dd95SBruce Richardson * return value can be less than the value of the *nb_events* parameter when 74599a2dd95SBruce Richardson * the event devices queue is full or if invalid parameters are specified in a 74699a2dd95SBruce Richardson * *rte_event*. If the return value is less than *nb_events*, the remaining 74799a2dd95SBruce Richardson * events at the end of ev[] are not consumed and the caller has to take care 74899a2dd95SBruce Richardson * of them, and rte_errno is set accordingly. Possible errno values include: 74999a2dd95SBruce Richardson * - EINVAL The port ID is invalid, device ID is invalid, an event's queue 75099a2dd95SBruce Richardson * ID is invalid, or an event's sched type doesn't match the 75199a2dd95SBruce Richardson * capabilities of the destination queue. 75299a2dd95SBruce Richardson * - ENOSPC The event port was backpressured and unable to enqueue 75399a2dd95SBruce Richardson * one or more events. This error code is only applicable to 75499a2dd95SBruce Richardson * closed systems. 75599a2dd95SBruce Richardson */ 75699a2dd95SBruce Richardson static inline uint16_t 75799a2dd95SBruce Richardson rte_event_crypto_adapter_enqueue(uint8_t dev_id, 75899a2dd95SBruce Richardson uint8_t port_id, 75999a2dd95SBruce Richardson struct rte_event ev[], 76099a2dd95SBruce Richardson uint16_t nb_events) 76199a2dd95SBruce Richardson { 762052e25d9SPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 763052e25d9SPavan Nikhilesh void *port; 76499a2dd95SBruce Richardson 765052e25d9SPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 766052e25d9SPavan Nikhilesh port = fp_ops->data[port_id]; 76799a2dd95SBruce Richardson #ifdef RTE_LIBRTE_EVENTDEV_DEBUG 768052e25d9SPavan Nikhilesh if (dev_id >= RTE_EVENT_MAX_DEVS || 769052e25d9SPavan Nikhilesh port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) { 770052e25d9SPavan Nikhilesh rte_errno = EINVAL; 771052e25d9SPavan Nikhilesh return 0; 772052e25d9SPavan Nikhilesh } 77399a2dd95SBruce Richardson 774052e25d9SPavan Nikhilesh if (port == NULL) { 77599a2dd95SBruce Richardson rte_errno = EINVAL; 77699a2dd95SBruce Richardson return 0; 77799a2dd95SBruce Richardson } 77899a2dd95SBruce Richardson #endif 77999a2dd95SBruce Richardson rte_eventdev_trace_crypto_adapter_enqueue(dev_id, port_id, ev, 78099a2dd95SBruce Richardson nb_events); 78199a2dd95SBruce Richardson 782052e25d9SPavan Nikhilesh return fp_ops->ca_enqueue(port, ev, nb_events); 78399a2dd95SBruce Richardson } 78499a2dd95SBruce Richardson 78599a2dd95SBruce Richardson #ifdef __cplusplus 78699a2dd95SBruce Richardson } 78799a2dd95SBruce Richardson #endif 78899a2dd95SBruce Richardson #endif /* _RTE_EVENT_CRYPTO_ADAPTER_ */ 789