DPDK  17.05.2
Data Structures | Enumerations | Functions
rte_crypto.h File Reference
#include <rte_mbuf.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_common.h>
#include "rte_crypto_sym.h"

Go to the source code of this file.

Data Structures

struct  rte_crypto_op
struct  rte_crypto_op_pool_private

Enumerations

enum  rte_crypto_op_type { RTE_CRYPTO_OP_TYPE_UNDEFINED, RTE_CRYPTO_OP_TYPE_SYMMETRIC }
enum  rte_crypto_op_status {
  RTE_CRYPTO_OP_STATUS_SUCCESS, RTE_CRYPTO_OP_STATUS_NOT_PROCESSED, RTE_CRYPTO_OP_STATUS_ENQUEUED, RTE_CRYPTO_OP_STATUS_AUTH_FAILED,
  RTE_CRYPTO_OP_STATUS_INVALID_SESSION, RTE_CRYPTO_OP_STATUS_INVALID_ARGS, RTE_CRYPTO_OP_STATUS_ERROR
}

Functions

static void __rte_crypto_op_reset (struct rte_crypto_op *op, enum rte_crypto_op_type type)
static uint16_t __rte_crypto_op_get_priv_data_size (struct rte_mempool *mempool)
struct rte_mempoolrte_crypto_op_pool_create (const char *name, enum rte_crypto_op_type type, unsigned nb_elts, unsigned cache_size, uint16_t priv_size, int socket_id)
static int __rte_crypto_op_raw_bulk_alloc (struct rte_mempool *mempool, enum rte_crypto_op_type type, struct rte_crypto_op **ops, uint16_t nb_ops)
static struct rte_crypto_oprte_crypto_op_alloc (struct rte_mempool *mempool, enum rte_crypto_op_type type)
static unsigned rte_crypto_op_bulk_alloc (struct rte_mempool *mempool, enum rte_crypto_op_type type, struct rte_crypto_op **ops, uint16_t nb_ops)
static void * __rte_crypto_op_get_priv_data (struct rte_crypto_op *op, uint32_t size)
static void rte_crypto_op_free (struct rte_crypto_op *op)
static struct rte_crypto_oprte_crypto_sym_op_alloc_from_mbuf_priv_data (struct rte_mbuf *m)
static struct
rte_crypto_sym_xform
rte_crypto_op_sym_xforms_alloc (struct rte_crypto_op *op, uint8_t nb_xforms)
static int rte_crypto_op_attach_sym_session (struct rte_crypto_op *op, struct rte_cryptodev_sym_session *sess)

Detailed Description

RTE Cryptography Common Definitions

Definition in file rte_crypto.h.

Enumeration Type Documentation

Crypto operation types

Enumerator:
RTE_CRYPTO_OP_TYPE_UNDEFINED 

Undefined operation type

RTE_CRYPTO_OP_TYPE_SYMMETRIC 

Symmetric operation

Definition at line 56 of file rte_crypto.h.

Status of crypto operation

Enumerator:
RTE_CRYPTO_OP_STATUS_SUCCESS 

Operation completed successfully

RTE_CRYPTO_OP_STATUS_NOT_PROCESSED 

Operation has not yet been processed by a crypto device

RTE_CRYPTO_OP_STATUS_ENQUEUED 

Operation is enqueued on device

RTE_CRYPTO_OP_STATUS_AUTH_FAILED 

Authentication verification failed

RTE_CRYPTO_OP_STATUS_INVALID_SESSION 

Symmetric operation failed due to invalid session arguments, or if in session-less mode, failed to allocate private operation material.

RTE_CRYPTO_OP_STATUS_INVALID_ARGS 

Operation failed due to invalid arguments in request

RTE_CRYPTO_OP_STATUS_ERROR 

Error handling operation

Definition at line 64 of file rte_crypto.h.

Function Documentation

static void __rte_crypto_op_reset ( struct rte_crypto_op op,
enum rte_crypto_op_type  type 
)
inlinestatic

Reset the fields of a crypto operation to their default values.

Parameters
opThe crypto operation to be reset.
typeThe crypto operation type.

Symmetric operation structure starts after the end of the rte_crypto_op structure.

Definition at line 129 of file rte_crypto.h.

static uint16_t __rte_crypto_op_get_priv_data_size ( struct rte_mempool mempool)
inlinestatic

Returns the size of private data allocated with each rte_crypto_op object by the mempool

Parameters
mempoolrte_crypto_op mempool
Returns
private data size

Definition at line 171 of file rte_crypto.h.

struct rte_mempool* rte_crypto_op_pool_create ( const char *  name,
enum rte_crypto_op_type  type,
unsigned  nb_elts,
unsigned  cache_size,
uint16_t  priv_size,
int  socket_id 
)
read

Creates a crypto operation pool

Parameters
namepool name
typecrypto operation type, use RTE_CRYPTO_OP_TYPE_UNDEFINED for a pool which supports all operation types
nb_eltsnumber of elements in pool
cache_sizeNumber of elements to cache on lcore, see rte_mempool_create for further details about cache size
priv_sizeSize of private data to allocate with each operation
socket_idSocket to allocate memory on
Returns
  • On success pointer to mempool
  • On failure NULL
Examples:
examples/l2fwd-crypto/main.c.
static int __rte_crypto_op_raw_bulk_alloc ( struct rte_mempool mempool,
enum rte_crypto_op_type  type,
struct rte_crypto_op **  ops,
uint16_t  nb_ops 
)
inlinestatic

Bulk allocate raw element from mempool and return as crypto operations

Parameters
mempoolcrypto operation mempool.
typecrypto operation type.
opsArray to place allocated crypto operations
nb_opsNumber of crypto operations to allocate
Returns
  • On success returns number of ops allocated

Definition at line 216 of file rte_crypto.h.

static struct rte_crypto_op* rte_crypto_op_alloc ( struct rte_mempool mempool,
enum rte_crypto_op_type  type 
)
staticread

Allocate a crypto operation from a mempool with default parameters set

Parameters
mempoolcrypto operation mempool
typeoperation type to allocate
Returns
  • On success returns a valid rte_crypto_op structure
  • On failure returns NULL

Definition at line 244 of file rte_crypto.h.

static unsigned rte_crypto_op_bulk_alloc ( struct rte_mempool mempool,
enum rte_crypto_op_type  type,
struct rte_crypto_op **  ops,
uint16_t  nb_ops 
)
inlinestatic

Bulk allocate crypto operations from a mempool with default parameters set

Parameters
mempoolcrypto operation mempool
typeoperation type to allocate
opsArray to place allocated crypto operations
nb_opsNumber of crypto operations to allocate
Returns
  • On success returns a valid rte_crypto_op structure
  • On failure returns NULL
Examples:
examples/l2fwd-crypto/main.c.

Definition at line 273 of file rte_crypto.h.

static void* __rte_crypto_op_get_priv_data ( struct rte_crypto_op op,
uint32_t  size 
)
inlinestatic

Returns a pointer to the private data of a crypto operation if that operation has enough capacity for requested size.

Parameters
opcrypto operation.
sizesize of space requested in private data.
Returns
  • if sufficient space available returns pointer to start of private data
  • if insufficient space returns NULL

Definition at line 303 of file rte_crypto.h.

static void rte_crypto_op_free ( struct rte_crypto_op op)
inlinestatic

free crypto operation structure If operation has been allocate from a rte_mempool, then the operation will be returned to the mempool.

Parameters
opsymmetric crypto operation
Examples:
examples/l2fwd-crypto/main.c.

Definition at line 326 of file rte_crypto.h.

static struct rte_crypto_op* rte_crypto_sym_op_alloc_from_mbuf_priv_data ( struct rte_mbuf m)
staticread

Allocate a symmetric crypto operation in the private data of an mbuf.

Parameters
mmbuf which is associated with the crypto operation, the operation will be allocated in the private data of that mbuf.
Returns
  • On success returns a pointer to the crypto operation.
  • On failure returns NULL.

Definition at line 344 of file rte_crypto.h.

static struct rte_crypto_sym_xform* rte_crypto_op_sym_xforms_alloc ( struct rte_crypto_op op,
uint8_t  nb_xforms 
)
staticread

Allocate space for symmetric crypto xforms in the private data space of the crypto operation. This also defaults the crypto xform type and configures the chaining of the xforms in the crypto operation

Returns
  • On success returns pointer to first crypto xform in crypto operations chain
  • On failure returns NULL

Definition at line 378 of file rte_crypto.h.

static int rte_crypto_op_attach_sym_session ( struct rte_crypto_op op,
struct rte_cryptodev_sym_session sess 
)
inlinestatic

Attach a session to a crypto operation

Parameters
opcrypto operation, must be of type symmetric
sesscryptodev session
Examples:
examples/ipsec-secgw/ipsec.c, and examples/l2fwd-crypto/main.c.

Definition at line 404 of file rte_crypto.h.