DPDK  17.11.10
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_AUTH_FAILED, RTE_CRYPTO_OP_STATUS_INVALID_SESSION,
  RTE_CRYPTO_OP_STATUS_INVALID_ARGS, RTE_CRYPTO_OP_STATUS_ERROR
}
 
enum  rte_crypto_op_sess_type { RTE_CRYPTO_OP_WITH_SESSION, RTE_CRYPTO_OP_SESSIONLESS, RTE_CRYPTO_OP_SECURITY_SESSION }
 

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_xformrte_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_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.

Crypto operation session type. This is used to specify whether a crypto operation has session structure attached for immutable parameters or if all operation information is included in the operation data structure.

Enumerator
RTE_CRYPTO_OP_WITH_SESSION 

Session based crypto operation

RTE_CRYPTO_OP_SESSIONLESS 

Session-less crypto operation

RTE_CRYPTO_OP_SECURITY_SESSION 

Security session crypto operation

Definition at line 87 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.

Definition at line 138 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 174 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 
)

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 219 of file rte_crypto.h.

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

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 247 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
  • nb_ops if the number of operations requested were allocated.
  • 0 if the requested number of ops are not available. None are allocated in this case.
Examples:
examples/l2fwd-crypto/main.c.

Definition at line 277 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 307 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 330 of file rte_crypto.h.

static struct rte_crypto_op* rte_crypto_sym_op_alloc_from_mbuf_priv_data ( struct rte_mbuf m)
static

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 348 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 
)
static

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 382 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 408 of file rte_crypto.h.