xref: /dpdk/doc/guides/prog_guide/eventdev/event_crypto_adapter.rst (revision 41dd9a6bc2d9c6e20e139ad713cc9d172572dd43)
1*41dd9a6bSDavid Young..  SPDX-License-Identifier: BSD-3-Clause
2*41dd9a6bSDavid Young    Copyright(c) 2018 Intel Corporation. All rights reserved.
3*41dd9a6bSDavid Young
4*41dd9a6bSDavid YoungEvent Crypto Adapter Library
5*41dd9a6bSDavid Young============================
6*41dd9a6bSDavid Young
7*41dd9a6bSDavid YoungThe DPDK :doc:`Eventdev library <eventdev>` provides event driven
8*41dd9a6bSDavid Youngprogramming model with features to schedule events.
9*41dd9a6bSDavid YoungThe :doc:`../cryptodev_lib` provides an interface to
10*41dd9a6bSDavid Youngthe crypto poll mode drivers which supports different crypto operations.
11*41dd9a6bSDavid YoungThe Event Crypto Adapter is one of the adapter which is intended to
12*41dd9a6bSDavid Youngbridge between the event device and the crypto device.
13*41dd9a6bSDavid Young
14*41dd9a6bSDavid YoungThe packet flow from crypto device to the event device can be accomplished
15*41dd9a6bSDavid Youngusing SW and HW based transfer mechanism.
16*41dd9a6bSDavid YoungThe Adapter queries an eventdev PMD to determine which mechanism to be used.
17*41dd9a6bSDavid YoungThe adapter uses an EAL service core function for SW based packet transfer
18*41dd9a6bSDavid Youngand uses the eventdev PMD functions to configure HW based packet transfer
19*41dd9a6bSDavid Youngbetween the crypto device and the event device. The crypto adapter uses a new
20*41dd9a6bSDavid Youngevent type called ``RTE_EVENT_TYPE_CRYPTODEV`` to indicate the event source.
21*41dd9a6bSDavid Young
22*41dd9a6bSDavid YoungThe application can choose to submit a crypto operation directly to
23*41dd9a6bSDavid Youngcrypto device or send it to the crypto adapter via eventdev based on
24*41dd9a6bSDavid YoungRTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability.
25*41dd9a6bSDavid YoungThe first mode is known as the event new(RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)
26*41dd9a6bSDavid Youngmode and the second as the event forward(RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD)
27*41dd9a6bSDavid Youngmode. The choice of mode can be specified while creating the adapter.
28*41dd9a6bSDavid YoungIn the former mode, it is an application responsibility to enable ingress
29*41dd9a6bSDavid Youngpacket ordering. In the latter mode, it is the adapter responsibility to
30*41dd9a6bSDavid Youngenable the ingress packet ordering.
31*41dd9a6bSDavid Young
32*41dd9a6bSDavid Young
33*41dd9a6bSDavid YoungAdapter Mode
34*41dd9a6bSDavid Young------------
35*41dd9a6bSDavid Young
36*41dd9a6bSDavid YoungRTE_EVENT_CRYPTO_ADAPTER_OP_NEW mode
37*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38*41dd9a6bSDavid Young
39*41dd9a6bSDavid YoungIn the RTE_EVENT_CRYPTO_ADAPTER_OP_NEW mode, application submits crypto
40*41dd9a6bSDavid Youngoperations directly to crypto device. The adapter then dequeues crypto
41*41dd9a6bSDavid Youngcompletions from crypto device and enqueues them as events to the event device.
42*41dd9a6bSDavid YoungThis mode does not ensure ingress ordering, if the application directly
43*41dd9a6bSDavid Youngenqueues to the cryptodev without going through crypto/atomic stage.
44*41dd9a6bSDavid YoungIn this mode, events dequeued from the adapter will be treated as new events.
45*41dd9a6bSDavid YoungThe application needs to specify event information (response information)
46*41dd9a6bSDavid Youngwhich is needed to enqueue an event after the crypto operation is completed.
47*41dd9a6bSDavid Young
48*41dd9a6bSDavid Young.. _figure_event_crypto_adapter_op_new:
49*41dd9a6bSDavid Young
50*41dd9a6bSDavid Young.. figure:: ../img/event_crypto_adapter_op_new.*
51*41dd9a6bSDavid Young
52*41dd9a6bSDavid Young   Working model of ``RTE_EVENT_CRYPTO_ADAPTER_OP_NEW`` mode
53*41dd9a6bSDavid Young
54*41dd9a6bSDavid Young
55*41dd9a6bSDavid YoungRTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode
56*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57*41dd9a6bSDavid Young
58*41dd9a6bSDavid YoungIn the ``RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD`` mode, if the event PMD and crypto
59*41dd9a6bSDavid YoungPMD supports internal event port
60*41dd9a6bSDavid Young(``RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD``), the application should
61*41dd9a6bSDavid Younguse ``rte_event_crypto_adapter_enqueue()`` API to enqueue crypto operations as
62*41dd9a6bSDavid Youngevents to crypto adapter. If not, application retrieves crypto adapter's event
63*41dd9a6bSDavid Youngport using ``rte_event_crypto_adapter_event_port_get()`` API, links its event
64*41dd9a6bSDavid Youngqueue to this port and starts enqueuing crypto operations as events to eventdev
65*41dd9a6bSDavid Youngusing ``rte_event_enqueue_burst()``. The adapter then dequeues the events and
66*41dd9a6bSDavid Youngsubmits the crypto operations to the cryptodev. After the crypto operation is
67*41dd9a6bSDavid Youngcomplete, the adapter enqueues events to the event device. The application can
68*41dd9a6bSDavid Younguse this mode when ingress packet ordering is needed. In this mode, events
69*41dd9a6bSDavid Youngdequeued from the adapter will be treated as forwarded events. The application
70*41dd9a6bSDavid Youngneeds to specify the cryptodev ID and queue pair ID (request information) needed
71*41dd9a6bSDavid Youngto enqueue a crypto operation in addition to the event information (response
72*41dd9a6bSDavid Younginformation) needed to enqueue an event after the crypto operation has
73*41dd9a6bSDavid Youngcompleted.
74*41dd9a6bSDavid Young
75*41dd9a6bSDavid Young.. _figure_event_crypto_adapter_op_forward:
76*41dd9a6bSDavid Young
77*41dd9a6bSDavid Young.. figure:: ../img/event_crypto_adapter_op_forward.*
78*41dd9a6bSDavid Young
79*41dd9a6bSDavid Young   Working model of ``RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD`` mode
80*41dd9a6bSDavid Young
81*41dd9a6bSDavid Young
82*41dd9a6bSDavid YoungAPI Overview
83*41dd9a6bSDavid Young------------
84*41dd9a6bSDavid Young
85*41dd9a6bSDavid YoungThis section has a brief introduction to the event crypto adapter APIs.
86*41dd9a6bSDavid YoungThe application is expected to create an adapter which is associated with
87*41dd9a6bSDavid Younga single eventdev, then add cryptodev and queue pair to the adapter instance.
88*41dd9a6bSDavid Young
89*41dd9a6bSDavid YoungCreate an adapter instance
90*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~
91*41dd9a6bSDavid Young
92*41dd9a6bSDavid YoungAn adapter instance is created using ``rte_event_crypto_adapter_create()``. This
93*41dd9a6bSDavid Youngfunction is called with event device to be associated with the adapter and port
94*41dd9a6bSDavid Youngconfiguration for the adapter to setup an event port(if the adapter needs to use
95*41dd9a6bSDavid Younga service function).
96*41dd9a6bSDavid Young
97*41dd9a6bSDavid YoungAdapter can be started in ``RTE_EVENT_CRYPTO_ADAPTER_OP_NEW`` or
98*41dd9a6bSDavid Young``RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD`` mode.
99*41dd9a6bSDavid Young
100*41dd9a6bSDavid Young.. code-block:: c
101*41dd9a6bSDavid Young
102*41dd9a6bSDavid Young        int err;
103*41dd9a6bSDavid Young        uint8_t dev_id, id;
104*41dd9a6bSDavid Young        struct rte_event_dev_info dev_info;
105*41dd9a6bSDavid Young        struct rte_event_port_conf conf;
106*41dd9a6bSDavid Young        enum rte_event_crypto_adapter_mode mode;
107*41dd9a6bSDavid Young
108*41dd9a6bSDavid Young        err = rte_event_dev_info_get(id, &dev_info);
109*41dd9a6bSDavid Young
110*41dd9a6bSDavid Young        conf.new_event_threshold = dev_info.max_num_events;
111*41dd9a6bSDavid Young        conf.dequeue_depth = dev_info.max_event_port_dequeue_depth;
112*41dd9a6bSDavid Young        conf.enqueue_depth = dev_info.max_event_port_enqueue_depth;
113*41dd9a6bSDavid Young	mode = RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD;
114*41dd9a6bSDavid Young        err = rte_event_crypto_adapter_create(id, dev_id, &conf, mode);
115*41dd9a6bSDavid Young
116*41dd9a6bSDavid YoungIf the application desires to have finer control of eventdev port allocation
117*41dd9a6bSDavid Youngand setup, it can use the ``rte_event_crypto_adapter_create_ext()`` function.
118*41dd9a6bSDavid YoungThe ``rte_event_crypto_adapter_create_ext()`` function is passed as a callback
119*41dd9a6bSDavid Youngfunction. The callback function is invoked if the adapter needs to use a
120*41dd9a6bSDavid Youngservice function and needs to create an event port for it. The callback is
121*41dd9a6bSDavid Youngexpected to fill the ``struct rte_event_crypto_adapter_conf`` structure
122*41dd9a6bSDavid Youngpassed to it.
123*41dd9a6bSDavid Young
124*41dd9a6bSDavid YoungIn the ``RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD`` mode, if the event PMD and crypto
125*41dd9a6bSDavid YoungPMD supports internal event port
126*41dd9a6bSDavid Young(``RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD``), events with crypto
127*41dd9a6bSDavid Youngoperations should be enqueued to the crypto adapter using
128*41dd9a6bSDavid Young``rte_event_crypto_adapter_enqueue()`` API. If not, the event port created by
129*41dd9a6bSDavid Youngthe adapter can be retrieved using ``rte_event_crypto_adapter_event_port_get()``
130*41dd9a6bSDavid YoungAPI. An application can use this event port to link with an event queue, on
131*41dd9a6bSDavid Youngwhich it enqueues events towards the crypto adapter using
132*41dd9a6bSDavid Young``rte_event_enqueue_burst()``.
133*41dd9a6bSDavid Young
134*41dd9a6bSDavid Young.. code-block:: c
135*41dd9a6bSDavid Young
136*41dd9a6bSDavid Young        uint8_t id, evdev_id, cdev_id, crypto_ev_port_id, app_qid;
137*41dd9a6bSDavid Young        struct rte_event ev;
138*41dd9a6bSDavid Young        uint32_t cap;
139*41dd9a6bSDavid Young        int ret;
140*41dd9a6bSDavid Young
141*41dd9a6bSDavid Young        // Fill in event info and update event_ptr with rte_crypto_op
142*41dd9a6bSDavid Young        memset(&ev, 0, sizeof(ev));
143*41dd9a6bSDavid Young        .
144*41dd9a6bSDavid Young        .
145*41dd9a6bSDavid Young        ev.event_ptr = op;
146*41dd9a6bSDavid Young
147*41dd9a6bSDavid Young        ret = rte_event_crypto_adapter_caps_get(evdev_id, cdev_id, &cap);
148*41dd9a6bSDavid Young        if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) {
149*41dd9a6bSDavid Young                ret = rte_event_crypto_adapter_enqueue(evdev_id, app_ev_port_id,
150*41dd9a6bSDavid Young                                                       ev, nb_events);
151*41dd9a6bSDavid Young        } else {
152*41dd9a6bSDavid Young                ret = rte_event_crypto_adapter_event_port_get(id,
153*41dd9a6bSDavid Young                                                        &crypto_ev_port_id);
154*41dd9a6bSDavid Young                ret = rte_event_queue_setup(evdev_id, app_qid, NULL);
155*41dd9a6bSDavid Young                ret = rte_event_port_link(evdev_id, crypto_ev_port_id, &app_qid,
156*41dd9a6bSDavid Young                                          NULL, 1);
157*41dd9a6bSDavid Young                ev.queue_id = app_qid;
158*41dd9a6bSDavid Young                ret = rte_event_enqueue_burst(evdev_id, app_ev_port_id, ev,
159*41dd9a6bSDavid Young                                              nb_events);
160*41dd9a6bSDavid Young        }
161*41dd9a6bSDavid Young
162*41dd9a6bSDavid YoungEvent device configuration for service based adapter
163*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164*41dd9a6bSDavid Young
165*41dd9a6bSDavid YoungWhen ``rte_event_crypto_adapter_create()`` is used for creating
166*41dd9a6bSDavid Youngadapter instance, ``rte_event_dev_config::nb_event_ports`` is
167*41dd9a6bSDavid Youngautomatically incremented, and event device is reconfigured
168*41dd9a6bSDavid Youngwith additional event port during service initialization.
169*41dd9a6bSDavid YoungThis event device reconfigure logic also increments the
170*41dd9a6bSDavid Young``rte_event_dev_config::nb_single_link_event_port_queues``
171*41dd9a6bSDavid Youngparameter if the adapter event port config is of type
172*41dd9a6bSDavid Young``RTE_EVENT_PORT_CFG_SINGLE_LINK``.
173*41dd9a6bSDavid Young
174*41dd9a6bSDavid YoungApplication no longer needs to configure the
175*41dd9a6bSDavid Youngevent device with ``rte_event_dev_config::nb_event_ports`` and
176*41dd9a6bSDavid Young``rte_event_dev_config::nb_single_link_event_port_queues``
177*41dd9a6bSDavid Youngparameters required for crypto adapter when the adapter is created
178*41dd9a6bSDavid Youngusing the above-mentioned API.
179*41dd9a6bSDavid Young
180*41dd9a6bSDavid YoungQuerying adapter capabilities
181*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
182*41dd9a6bSDavid Young
183*41dd9a6bSDavid YoungThe ``rte_event_crypto_adapter_caps_get()`` function allows
184*41dd9a6bSDavid Youngthe application to query the adapter capabilities for an eventdev and cryptodev
185*41dd9a6bSDavid Youngcombination. This API provides whether cryptodev and eventdev are connected using
186*41dd9a6bSDavid Younginternal HW port or not.
187*41dd9a6bSDavid Young
188*41dd9a6bSDavid Young.. code-block:: c
189*41dd9a6bSDavid Young
190*41dd9a6bSDavid Young        rte_event_crypto_adapter_caps_get(dev_id, cdev_id, &cap);
191*41dd9a6bSDavid Young
192*41dd9a6bSDavid YoungAdding queue pair to the adapter instance
193*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194*41dd9a6bSDavid Young
195*41dd9a6bSDavid YoungCryptodev device id and queue pair are created using cryptodev APIs.
196*41dd9a6bSDavid YoungFor more information see :doc:`here <../cryptodev_lib>`.
197*41dd9a6bSDavid Young
198*41dd9a6bSDavid Young.. code-block:: c
199*41dd9a6bSDavid Young
200*41dd9a6bSDavid Young        struct rte_cryptodev_config conf;
201*41dd9a6bSDavid Young        struct rte_cryptodev_qp_conf qp_conf;
202*41dd9a6bSDavid Young        uint8_t cdev_id = 0;
203*41dd9a6bSDavid Young        uint16_t qp_id = 0;
204*41dd9a6bSDavid Young
205*41dd9a6bSDavid Young        rte_cryptodev_configure(cdev_id, &conf);
206*41dd9a6bSDavid Young        rte_cryptodev_queue_pair_setup(cdev_id, qp_id, &qp_conf);
207*41dd9a6bSDavid Young
208*41dd9a6bSDavid YoungThese cryptodev id and queue pair are added to the instance using the
209*41dd9a6bSDavid Young``rte_event_crypto_adapter_queue_pair_add()`` API.
210*41dd9a6bSDavid YoungThe same is removed using ``rte_event_crypto_adapter_queue_pair_del()`` API.
211*41dd9a6bSDavid YoungIf HW supports RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND
212*41dd9a6bSDavid Youngcapability, event information must be passed to the add API.
213*41dd9a6bSDavid Young
214*41dd9a6bSDavid Young.. code-block:: c
215*41dd9a6bSDavid Young
216*41dd9a6bSDavid Young        uint32_t cap;
217*41dd9a6bSDavid Young        int ret;
218*41dd9a6bSDavid Young
219*41dd9a6bSDavid Young        ret = rte_event_crypto_adapter_caps_get(id, evdev, &cap);
220*41dd9a6bSDavid Young        if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) {
221*41dd9a6bSDavid Young                struct rte_event_crypto_adapter_queue_conf conf;
222*41dd9a6bSDavid Young
223*41dd9a6bSDavid Young                // Fill in conf.event information & pass it to add API
224*41dd9a6bSDavid Young                rte_event_crypto_adapter_queue_pair_add(id, cdev_id, qp_id, &conf);
225*41dd9a6bSDavid Young        } else
226*41dd9a6bSDavid Young                rte_event_crypto_adapter_queue_pair_add(id, cdev_id, qp_id, NULL);
227*41dd9a6bSDavid Young
228*41dd9a6bSDavid YoungConfigure the service function
229*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230*41dd9a6bSDavid Young
231*41dd9a6bSDavid YoungIf the adapter uses a service function, the application is required to assign
232*41dd9a6bSDavid Younga service core to the service function as show below.
233*41dd9a6bSDavid Young
234*41dd9a6bSDavid Young.. code-block:: c
235*41dd9a6bSDavid Young
236*41dd9a6bSDavid Young        uint32_t service_id;
237*41dd9a6bSDavid Young
238*41dd9a6bSDavid Young        if (rte_event_crypto_adapter_service_id_get(id, &service_id) == 0)
239*41dd9a6bSDavid Young                rte_service_map_lcore_set(service_id, CORE_ID);
240*41dd9a6bSDavid Young
241*41dd9a6bSDavid YoungSet event request/response information
242*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243*41dd9a6bSDavid Young
244*41dd9a6bSDavid YoungIn the RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode, the application needs
245*41dd9a6bSDavid Youngto specify the cryptodev ID and queue pair ID (request information) in
246*41dd9a6bSDavid Youngaddition to the event information (response information) needed to enqueue
247*41dd9a6bSDavid Youngan event after the crypto operation has completed. The request and response
248*41dd9a6bSDavid Younginformation are specified in the ``struct rte_crypto_op`` private data or
249*41dd9a6bSDavid Youngsession's private data.
250*41dd9a6bSDavid Young
251*41dd9a6bSDavid YoungIn the RTE_EVENT_CRYPTO_ADAPTER_OP_NEW mode, the application is required
252*41dd9a6bSDavid Youngto provide only the response information.
253*41dd9a6bSDavid Young
254*41dd9a6bSDavid YoungThe SW adapter or HW PMD uses ``rte_crypto_op::sess_type`` to
255*41dd9a6bSDavid Youngdecide whether request/response data is located in the crypto session/
256*41dd9a6bSDavid Youngcrypto security session or at an offset in the ``struct rte_crypto_op``.
257*41dd9a6bSDavid YoungThe ``rte_crypto_op::private_data_offset`` is used to locate the request/
258*41dd9a6bSDavid Youngresponse in the ``rte_crypto_op``.
259*41dd9a6bSDavid Young
260*41dd9a6bSDavid YoungFor crypto session, ``rte_cryptodev_sym_session_set_user_data()`` API
261*41dd9a6bSDavid Youngwill be used to set request/response data. The same data will be obtained
262*41dd9a6bSDavid Youngby ``rte_cryptodev_sym_session_get_user_data()`` API.  The
263*41dd9a6bSDavid YoungRTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA capability indicates
264*41dd9a6bSDavid Youngwhether HW or SW supports this feature.
265*41dd9a6bSDavid Young
266*41dd9a6bSDavid YoungFor security session, ``rte_security_session_set_private_data()`` API
267*41dd9a6bSDavid Youngwill be used to set request/response data. The same data will be obtained
268*41dd9a6bSDavid Youngby ``rte_security_session_get_private_data()`` API.
269*41dd9a6bSDavid Young
270*41dd9a6bSDavid YoungFor session-less it is mandatory to place the request/response data with
271*41dd9a6bSDavid Youngthe ``rte_crypto_op``.
272*41dd9a6bSDavid Young
273*41dd9a6bSDavid Young.. code-block:: c
274*41dd9a6bSDavid Young
275*41dd9a6bSDavid Young        union rte_event_crypto_metadata m_data;
276*41dd9a6bSDavid Young        struct rte_event ev;
277*41dd9a6bSDavid Young        struct rte_crypto_op *op;
278*41dd9a6bSDavid Young
279*41dd9a6bSDavid Young        /* Allocate & fill op structure */
280*41dd9a6bSDavid Young        op = rte_crypto_op_alloc();
281*41dd9a6bSDavid Young
282*41dd9a6bSDavid Young        memset(&m_data, 0, sizeof(m_data));
283*41dd9a6bSDavid Young        memset(&ev, 0, sizeof(ev));
284*41dd9a6bSDavid Young        /* Fill event information and update event_ptr to rte_crypto_op */
285*41dd9a6bSDavid Young        ev.event_ptr = op;
286*41dd9a6bSDavid Young
287*41dd9a6bSDavid Young        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
288*41dd9a6bSDavid Young                /* Copy response information */
289*41dd9a6bSDavid Young                rte_memcpy(&m_data.response_info, &ev, sizeof(ev));
290*41dd9a6bSDavid Young                /* Copy request information */
291*41dd9a6bSDavid Young                m_data.request_info.cdev_id = cdev_id;
292*41dd9a6bSDavid Young                m_data.request_info.queue_pair_id = qp_id;
293*41dd9a6bSDavid Young                /* Call set API to store private data information */
294*41dd9a6bSDavid Young                rte_cryptodev_sym_session_set_user_data(
295*41dd9a6bSDavid Young                        op->sym->session,
296*41dd9a6bSDavid Young                        &m_data,
297*41dd9a6bSDavid Young                        sizeof(m_data));
298*41dd9a6bSDavid Young        } if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
299*41dd9a6bSDavid Young                uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH +
300*41dd9a6bSDavid Young                               (sizeof(struct rte_crypto_sym_xform) * 2);
301*41dd9a6bSDavid Young                op->private_data_offset = len;
302*41dd9a6bSDavid Young                /* Copy response information */
303*41dd9a6bSDavid Young                rte_memcpy(&m_data.response_info, &ev, sizeof(ev));
304*41dd9a6bSDavid Young                /* Copy request information */
305*41dd9a6bSDavid Young                m_data.request_info.cdev_id = cdev_id;
306*41dd9a6bSDavid Young                m_data.request_info.queue_pair_id = qp_id;
307*41dd9a6bSDavid Young                /* Store private data information along with rte_crypto_op */
308*41dd9a6bSDavid Young                rte_memcpy(op + len, &m_data, sizeof(m_data));
309*41dd9a6bSDavid Young        }
310*41dd9a6bSDavid Young
311*41dd9a6bSDavid YoungEnable event vectorization
312*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~
313*41dd9a6bSDavid Young
314*41dd9a6bSDavid YoungThe event crypto adapter can aggregate outcoming crypto operations based on
315*41dd9a6bSDavid Youngprovided response information of ``rte_event_crypto_metadata::response_info``
316*41dd9a6bSDavid Youngand generate a ``rte_event`` containing ``rte_event_vector`` whose event type
317*41dd9a6bSDavid Youngis ``RTE_EVENT_TYPE_CRYPTODEV_VECTOR``.
318*41dd9a6bSDavid YoungTo enable vectorization application should set
319*41dd9a6bSDavid YoungRTE_EVENT_CRYPTO_ADAPTER_EVENT_VECTOR in
320*41dd9a6bSDavid Young``rte_event_crypto_adapter_queue_conf::flag`` and provide vector
321*41dd9a6bSDavid Youngconfiguration(size, mempool, etc.) with respect of
322*41dd9a6bSDavid Young``rte_event_crypto_adapter_vector_limits``, which could be obtained by calling
323*41dd9a6bSDavid Young``rte_event_crypto_adapter_vector_limits_get()``.
324*41dd9a6bSDavid Young
325*41dd9a6bSDavid YoungThe RTE_EVENT_CRYPTO_ADAPTER_CAP_EVENT_VECTOR capability indicates whether
326*41dd9a6bSDavid YoungPMD supports this feature.
327*41dd9a6bSDavid Young
328*41dd9a6bSDavid YoungStart the adapter instance
329*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~
330*41dd9a6bSDavid Young
331*41dd9a6bSDavid YoungThe application calls ``rte_event_crypto_adapter_start()`` to start the adapter.
332*41dd9a6bSDavid YoungThis function calls the start callbacks of the eventdev PMDs for hardware based
333*41dd9a6bSDavid Youngeventdev-cryptodev connections and ``rte_service_run_state_set()`` to enable the
334*41dd9a6bSDavid Youngservice function if one exists.
335*41dd9a6bSDavid Young
336*41dd9a6bSDavid Young.. code-block:: c
337*41dd9a6bSDavid Young
338*41dd9a6bSDavid Young        rte_event_crypto_adapter_start(id, mode);
339*41dd9a6bSDavid Young
340*41dd9a6bSDavid Young.. Note::
341*41dd9a6bSDavid Young
342*41dd9a6bSDavid Young         The eventdev to which the event_crypto_adapter is connected needs to
343*41dd9a6bSDavid Young         be started before calling rte_event_crypto_adapter_start().
344*41dd9a6bSDavid Young
345*41dd9a6bSDavid YoungGet adapter statistics
346*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~
347*41dd9a6bSDavid Young
348*41dd9a6bSDavid YoungThe  ``rte_event_crypto_adapter_stats_get()`` function reports counters defined
349*41dd9a6bSDavid Youngin struct ``rte_event_crypto_adapter_stats``. The received packet and
350*41dd9a6bSDavid Youngenqueued event counts are a sum of the counts from the eventdev PMD callbacks
351*41dd9a6bSDavid Youngif the callback is supported, and the counts maintained by the service function,
352*41dd9a6bSDavid Youngif one exists.
353*41dd9a6bSDavid Young
354*41dd9a6bSDavid YoungSet/Get adapter runtime configuration parameters
355*41dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356*41dd9a6bSDavid Young
357*41dd9a6bSDavid YoungThe runtime configuration parameters of adapter can be set/get using
358*41dd9a6bSDavid Young``rte_event_crypto_adapter_runtime_params_set()`` and
359*41dd9a6bSDavid Young``rte_event_crypto_adapter_runtime_params_get()`` respectively.
360*41dd9a6bSDavid YoungThe parameters that can be set/get are defined in
361*41dd9a6bSDavid Young``struct rte_event_crypto_adapter_runtime_params``.
362