X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=doc%2Fguides%2Fprog_guide%2Fcryptodev_lib.rst;h=9b1cf8d49f33eb84909050e48501df24e6f45e74;hb=6cc51b1293ceac4a77d4bf7ac91a8bbd59e1f78c;hp=72129e4b702d5c0e408fad666358128b48f117a2;hpb=eb7eed345cea34859b3190a778e9e20d56492075;p=dpdk.git diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 72129e4b70..9b1cf8d49f 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -32,7 +32,7 @@ Physical Crypto devices are discovered during the PCI probe/enumeration of the EAL function which is executed at DPDK initialization, based on their PCI device identifier, each unique PCI BDF (bus/bridge, device, function). Specific physical Crypto devices, like other physical devices in DPDK -can be white-listed or black-listed using the EAL command line options. +can be listed using the EAL command line options. Virtual devices can be created by two mechanisms, either using the EAL command line options or from within the application using an EAL API directly. @@ -338,6 +338,50 @@ start of private data information. The offset is counted from the start of the rte_crypto_op including other crypto information such as the IVs (since there can be an IV also for authentication). +User callback APIs +~~~~~~~~~~~~~~~~~~ +The add APIs configures a user callback function to be called for each burst of crypto +ops received/sent on a given crypto device queue pair. The return value is a pointer +that can be used later to remove the callback using remove API. Application is expected +to register a callback function of type ``rte_cryptodev_callback_fn``. Multiple callback +functions can be added for a given queue pair. API does not restrict on maximum number of +callbacks. + +Callbacks registered by application would not survive ``rte_cryptodev_configure`` as it +reinitializes the callback list. It is user responsibility to remove all installed +callbacks before calling ``rte_cryptodev_configure`` to avoid possible memory leakage. + +So, the application is expected to add user callback after ``rte_cryptodev_configure``. +The callbacks can also be added at the runtime. These callbacks get executed when +``rte_cryptodev_enqueue_burst``/``rte_cryptodev_dequeue_burst`` is called. + +.. code-block:: c + + struct rte_cryptodev_cb * + rte_cryptodev_add_enq_callback(uint8_t dev_id, uint16_t qp_id, + rte_cryptodev_callback_fn cb_fn, + void *cb_arg); + + struct rte_cryptodev_cb * + rte_cryptodev_add_deq_callback(uint8_t dev_id, uint16_t qp_id, + rte_cryptodev_callback_fn cb_fn, + void *cb_arg); + + uint16_t (* rte_cryptodev_callback_fn)(uint16_t dev_id, uint16_t qp_id, + struct rte_crypto_op **ops, + uint16_t nb_ops, void *user_param); + +The remove API removes a callback function added by +``rte_cryptodev_add_enq_callback``/``rte_cryptodev_add_deq_callback``. + +.. code-block:: c + + int rte_cryptodev_remove_enq_callback(uint8_t dev_id, uint16_t qp_id, + struct rte_cryptodev_cb *cb); + + int rte_cryptodev_remove_deq_callback(uint8_t dev_id, uint16_t qp_id, + struct rte_cryptodev_cb *cb); + Enqueue / Dequeue Burst APIs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~