DPDK  20.11.10
Data Structures | Typedefs | Functions | Variables
rte_cryptodev_pmd.h File Reference
#include <string.h>
#include <rte_config.h>
#include <rte_dev.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
#include <rte_log.h>
#include <rte_common.h>
#include "rte_crypto.h"
#include "rte_cryptodev.h"

Go to the source code of this file.

Data Structures

struct  rte_cryptodev_global
 
struct  rte_cryptodev_ops
 

Typedefs

typedef int(* cryptodev_configure_t) (struct rte_cryptodev *dev, struct rte_cryptodev_config *config)
 
typedef int(* cryptodev_start_t) (struct rte_cryptodev *dev)
 
typedef void(* cryptodev_stop_t) (struct rte_cryptodev *dev)
 
typedef int(* cryptodev_close_t) (struct rte_cryptodev *dev)
 
typedef void(* cryptodev_stats_get_t) (struct rte_cryptodev *dev, struct rte_cryptodev_stats *stats)
 
typedef void(* cryptodev_stats_reset_t) (struct rte_cryptodev *dev)
 
typedef void(* cryptodev_info_get_t) (struct rte_cryptodev *dev, struct rte_cryptodev_info *dev_info)
 
typedef int(* cryptodev_queue_pair_setup_t) (struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
 
typedef int(* cryptodev_queue_pair_release_t) (struct rte_cryptodev *dev, uint16_t qp_id)
 
typedef int(* cryptodev_sym_create_session_pool_t) (struct rte_cryptodev *dev, unsigned nb_objs, unsigned obj_cache_size, int socket_id)
 
typedef unsigned(* cryptodev_sym_get_session_private_size_t) (struct rte_cryptodev *dev)
 
typedef unsigned int(* cryptodev_asym_get_session_private_size_t) (struct rte_cryptodev *dev)
 
typedef int(* cryptodev_sym_configure_session_t) (struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform, struct rte_cryptodev_sym_session *session, struct rte_mempool *mp)
 
typedef int(* cryptodev_asym_configure_session_t) (struct rte_cryptodev *dev, struct rte_crypto_asym_xform *xform, struct rte_cryptodev_asym_session *session, struct rte_mempool *mp)
 
typedef void(* cryptodev_sym_free_session_t) (struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess)
 
typedef void(* cryptodev_asym_free_session_t) (struct rte_cryptodev *dev, struct rte_cryptodev_asym_session *sess)
 
typedef uint32_t(* cryptodev_sym_cpu_crypto_process_t) (struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs, struct rte_crypto_sym_vec *vec)
 
typedef int(* cryptodev_sym_get_raw_dp_ctx_size_t) (struct rte_cryptodev *dev)
 
typedef int(* cryptodev_sym_configure_raw_dp_ctx_t) (struct rte_cryptodev *dev, uint16_t qp_id, struct rte_crypto_raw_dp_ctx *ctx, enum rte_crypto_op_sess_type sess_type, union rte_cryptodev_session_ctx session_ctx, uint8_t is_update)
 

Functions

struct rte_cryptodevrte_cryptodev_pmd_get_dev (uint8_t dev_id)
 
struct rte_cryptodevrte_cryptodev_pmd_get_named_dev (const char *name)
 
unsigned int rte_cryptodev_pmd_is_valid_dev (uint8_t dev_id)
 
struct rte_cryptodevrte_cryptodev_pmd_allocate (const char *name, int socket_id)
 
int rte_cryptodev_pmd_release_device (struct rte_cryptodev *cryptodev)
 
void rte_cryptodev_pmd_callback_process (struct rte_cryptodev *dev, enum rte_cryptodev_event_type event)
 

Variables

struct rte_cryptodevrte_cryptodevs
 

Detailed Description

RTE Crypto PMD APIs

Note
These API are from crypto PMD only and user applications should not call them directly.

Definition in file rte_cryptodev_pmd.h.

Typedef Documentation

◆ cryptodev_configure_t

typedef int(* cryptodev_configure_t) (struct rte_cryptodev *dev, struct rte_cryptodev_config *config)

Definitions of all functions exported by a driver through the generic structure of type crypto_dev_ops supplied in the rte_cryptodev structure associated with a device. Function used to configure device.

Parameters
devCrypto device pointer
configCrypto device configurations
Returns
Returns 0 on success

Definition at line 128 of file rte_cryptodev_pmd.h.

◆ cryptodev_start_t

typedef int(* cryptodev_start_t) (struct rte_cryptodev *dev)

Function used to start a configured device.

Parameters
devCrypto device pointer
Returns
Returns 0 on success

Definition at line 138 of file rte_cryptodev_pmd.h.

◆ cryptodev_stop_t

typedef void(* cryptodev_stop_t) (struct rte_cryptodev *dev)

Function used to stop a configured device.

Parameters
devCrypto device pointer

Definition at line 145 of file rte_cryptodev_pmd.h.

◆ cryptodev_close_t

typedef int(* cryptodev_close_t) (struct rte_cryptodev *dev)

Function used to close a configured device.

Parameters
devCrypto device pointer
Returns
  • 0 on success.
  • EAGAIN if can't close as device is busy

Definition at line 155 of file rte_cryptodev_pmd.h.

◆ cryptodev_stats_get_t

typedef void(* cryptodev_stats_get_t) (struct rte_cryptodev *dev, struct rte_cryptodev_stats *stats)

Function used to get statistics of a device.

Parameters
devCrypto device pointer
statsPointer to crypto device stats structure to populate

Definition at line 164 of file rte_cryptodev_pmd.h.

◆ cryptodev_stats_reset_t

typedef void(* cryptodev_stats_reset_t) (struct rte_cryptodev *dev)

Function used to reset statistics of a device.

Parameters
devCrypto device pointer

Definition at line 173 of file rte_cryptodev_pmd.h.

◆ cryptodev_info_get_t

typedef void(* cryptodev_info_get_t) (struct rte_cryptodev *dev, struct rte_cryptodev_info *dev_info)

Function used to get specific information of a device.

Parameters
devCrypto device pointer
dev_infoPointer to infos structure to populate

Definition at line 182 of file rte_cryptodev_pmd.h.

◆ cryptodev_queue_pair_setup_t

typedef int(* cryptodev_queue_pair_setup_t) (struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)

Setup a queue pair for a device.

Parameters
devCrypto device pointer
qp_idQueue Pair Index
qp_confQueue configuration structure
socket_idSocket Index
Returns
Returns 0 on success.

Definition at line 195 of file rte_cryptodev_pmd.h.

◆ cryptodev_queue_pair_release_t

typedef int(* cryptodev_queue_pair_release_t) (struct rte_cryptodev *dev, uint16_t qp_id)

Release memory resources allocated by given queue pair.

Parameters
devCrypto device pointer
qp_idQueue Pair Index
Returns
  • 0 on success.
  • EAGAIN if can't close as device is busy

Definition at line 209 of file rte_cryptodev_pmd.h.

◆ cryptodev_sym_create_session_pool_t

typedef int(* cryptodev_sym_create_session_pool_t) (struct rte_cryptodev *dev, unsigned nb_objs, unsigned obj_cache_size, int socket_id)

Create a session mempool to allocate sessions from

Parameters
devCrypto device pointer
nb_objsnumber of sessions objects in mempool
obj_cache_sizel-core object cache size, see rte_ring_create
socket_idSocket Id to allocate mempool on.
Returns
  • On success returns a pointer to a rte_mempool
  • On failure returns a NULL pointer

Definition at line 224 of file rte_cryptodev_pmd.h.

◆ cryptodev_sym_get_session_private_size_t

typedef unsigned(* cryptodev_sym_get_session_private_size_t) (struct rte_cryptodev *dev)

Get the size of a cryptodev session

Parameters
devCrypto device pointer
Returns
  • On success returns the size of the session structure for device
  • On failure returns 0

Definition at line 238 of file rte_cryptodev_pmd.h.

◆ cryptodev_asym_get_session_private_size_t

typedef unsigned int(* cryptodev_asym_get_session_private_size_t) (struct rte_cryptodev *dev)

Get the size of a asymmetric cryptodev session

Parameters
devCrypto device pointer
Returns
  • On success returns the size of the session structure for device
  • On failure returns 0

Definition at line 249 of file rte_cryptodev_pmd.h.

◆ cryptodev_sym_configure_session_t

typedef int(* cryptodev_sym_configure_session_t) (struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform, struct rte_cryptodev_sym_session *session, struct rte_mempool *mp)

Configure a Crypto session on a device.

Parameters
devCrypto device pointer
xformSingle or chain of crypto xforms
sessionPointer to cryptodev's private session structure
mpMempool where the private session is allocated
Returns
  • Returns 0 if private session structure have been created successfully.
  • Returns -EINVAL if input parameters are invalid.
  • Returns -ENOTSUP if crypto device does not support the crypto transform.
  • Returns -ENOMEM if the private session could not be allocated.

Definition at line 266 of file rte_cryptodev_pmd.h.

◆ cryptodev_asym_configure_session_t

typedef int(* cryptodev_asym_configure_session_t) (struct rte_cryptodev *dev, struct rte_crypto_asym_xform *xform, struct rte_cryptodev_asym_session *session, struct rte_mempool *mp)

Configure a Crypto asymmetric session on a device.

Parameters
devCrypto device pointer
xformSingle or chain of crypto xforms
sessionPointer to cryptodev's private session structure
mpMempool where the private session is allocated
Returns
  • Returns 0 if private session structure have been created successfully.
  • Returns -EINVAL if input parameters are invalid.
  • Returns -ENOTSUP if crypto device does not support the crypto transform.
  • Returns -ENOMEM if the private session could not be allocated.

Definition at line 284 of file rte_cryptodev_pmd.h.

◆ cryptodev_sym_free_session_t

typedef void(* cryptodev_sym_free_session_t) (struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess)

Free driver private session data.

Parameters
devCrypto device pointer
sessCryptodev session structure

Definition at line 294 of file rte_cryptodev_pmd.h.

◆ cryptodev_asym_free_session_t

typedef void(* cryptodev_asym_free_session_t) (struct rte_cryptodev *dev, struct rte_cryptodev_asym_session *sess)

Free asymmetric session private data.

Parameters
devCrypto device pointer
sessCryptodev session structure

Definition at line 302 of file rte_cryptodev_pmd.h.

◆ cryptodev_sym_cpu_crypto_process_t

typedef uint32_t(* cryptodev_sym_cpu_crypto_process_t) (struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs, struct rte_crypto_sym_vec *vec)

Perform actual crypto processing (encrypt/digest or auth/decrypt) on user provided data.

Parameters
devCrypto device pointer
sessCryptodev session structure
ofsStart and stop offsets for auth and cipher operations
vecVectorized operation descriptor
Returns
  • Returns number of successfully processed packets.

Definition at line 318 of file rte_cryptodev_pmd.h.

◆ cryptodev_sym_get_raw_dp_ctx_size_t

typedef int(* cryptodev_sym_get_raw_dp_ctx_size_t) (struct rte_cryptodev *dev)

Typedef that the driver provided to get service context private date size.

Parameters
devCrypto device pointer.
Returns
  • On success return the size of the device's service context private data.
  • On failure return negative integer.

Definition at line 330 of file rte_cryptodev_pmd.h.

◆ cryptodev_sym_configure_raw_dp_ctx_t

typedef int(* cryptodev_sym_configure_raw_dp_ctx_t) (struct rte_cryptodev *dev, uint16_t qp_id, struct rte_crypto_raw_dp_ctx *ctx, enum rte_crypto_op_sess_type sess_type, union rte_cryptodev_session_ctx session_ctx, uint8_t is_update)

Typedef that the driver provided to configure raw data-path context.

Parameters
devCrypto device pointer.
qp_idCrypto device queue pair index.
ctxThe raw data-path context data.
sess_typesession type.
session_ctxSession context data. If NULL the driver shall only configure the drv_ctx_data in ctx buffer. Otherwise the driver shall only parse the session_ctx to set appropriate function pointers in ctx.
is_updateSet 0 if it is to initialize the ctx. Set 1 if ctx is initialized and only to update session context data.
Returns
  • On success return 0.
  • On failure return negative integer.

Definition at line 351 of file rte_cryptodev_pmd.h.

Function Documentation

◆ rte_cryptodev_pmd_get_dev()

struct rte_cryptodev* rte_cryptodev_pmd_get_dev ( uint8_t  dev_id)

Get the rte_cryptodev structure device pointer for the device. Assumes a valid device index.

Parameters
dev_idDevice ID value to select the device structure.
Returns
Examples:
examples/fips_validation/fips_dev_self_test.c, and examples/fips_validation/main.c.

◆ rte_cryptodev_pmd_get_named_dev()

struct rte_cryptodev* rte_cryptodev_pmd_get_named_dev ( const char *  name)

Get the rte_cryptodev structure device pointer for the named device.

Parameters
namedevice name to select the device structure.
Returns

◆ rte_cryptodev_pmd_is_valid_dev()

unsigned int rte_cryptodev_pmd_is_valid_dev ( uint8_t  dev_id)

Validate if the crypto device index is valid attached crypto device.

Parameters
dev_idCrypto device index.
Returns
  • If the device index is valid (1) or not (0).
Examples:
examples/fips_validation/main.c, and examples/ip_pipeline/cryptodev.c.

◆ rte_cryptodev_pmd_allocate()

struct rte_cryptodev* rte_cryptodev_pmd_allocate ( const char *  name,
int  socket_id 
)

Function for internal use by dummy drivers primarily, e.g. ring-based driver. Allocates a new cryptodev slot for an crypto device and returns the pointer to that slot for the driver to use.

Parameters
nameUnique identifier name for each device
socket_idSocket to allocate resources on.
Returns
  • Slot in the rte_dev_devices array for a new device;

◆ rte_cryptodev_pmd_release_device()

int rte_cryptodev_pmd_release_device ( struct rte_cryptodev cryptodev)

Function for internal use by dummy drivers primarily, e.g. ring-based driver. Release the specified cryptodev device.

Parameters
cryptodevThe cryptodev pointer is the address of the rte_cryptodev structure.
Returns
  • 0 on success, negative on error

◆ rte_cryptodev_pmd_callback_process()

void rte_cryptodev_pmd_callback_process ( struct rte_cryptodev dev,
enum rte_cryptodev_event_type  event 
)

Executes all the user application registered callbacks for the specific device.

  • Parameters
    devPointer to cryptodev struct
    eventCrypto device interrupt event type.

Variable Documentation

◆ rte_cryptodevs

struct rte_cryptodev* rte_cryptodevs

The pool of rte_cryptodev structures.