DPDK  2.2.0
Data Structures | Enumerations | Functions
rte_mbuf_offload.h File Reference
#include <rte_mbuf.h>
#include <rte_crypto.h>

Go to the source code of this file.

Data Structures

struct  rte_mbuf_offload

Enumerations

enum  rte_mbuf_ol_op_type { RTE_PKTMBUF_OL_NOT_SPECIFIED = 0, RTE_PKTMBUF_OL_CRYPTO }

Functions

struct rte_mempoolrte_pktmbuf_offload_pool_create (const char *name, unsigned size, unsigned cache_size, uint16_t priv_size, int socket_id)
static uint16_t __rte_pktmbuf_offload_priv_size (struct rte_mempool *mpool)
static struct rte_mbuf_offloadrte_pktmbuf_offload_get (struct rte_mbuf *m, enum rte_mbuf_ol_op_type type)
static struct rte_mbuf_offloadrte_pktmbuf_offload_attach (struct rte_mbuf *m, struct rte_mbuf_offload *ol)
static void __rte_pktmbuf_offload_reset (struct rte_mbuf_offload *ol, enum rte_mbuf_ol_op_type type)
static struct rte_mbuf_offload__rte_pktmbuf_offload_raw_alloc (struct rte_mempool *mp)
static struct rte_mbuf_offloadrte_pktmbuf_offload_alloc (struct rte_mempool *mpool, enum rte_mbuf_ol_op_type type)
static void rte_pktmbuf_offload_free (struct rte_mbuf_offload *ol)
static void * __rte_pktmbuf_offload_check_priv_data_size (struct rte_mbuf_offload *ol, uint16_t size)
static struct rte_crypto_xformrte_pktmbuf_offload_alloc_crypto_xforms (struct rte_mbuf_offload *ol, unsigned nb_xforms)

Detailed Description

RTE mbuf offload

The rte_mbuf_offload library provides the ability to specify a device generic off-load operation independent of the current Rx/Tx Ethernet offloads supported within the rte_mbuf structure, and add supports for multiple off-load operations and offload device types.

The rte_mbuf_offload specifies the particular off-load operation type, such as a crypto operation, and provides a container for the operations parameter's inside the op union. These parameters are then used by the device which supports that operation to perform the specified offload.

This library provides an API to create pre-allocated mempool of offload operations, with supporting allocate and free functions. It also provides APIs for attaching an offload to a mbuf, as well as an API to retrieve a specified offload type from an mbuf offload chain.

Warning
EXPERIMENTAL: this API may change without prior notice

Definition in file rte_mbuf_offload.h.

Enumeration Type Documentation

packet mbuf offload operation types

Enumerator:
RTE_PKTMBUF_OL_NOT_SPECIFIED 

Off-load not specified

RTE_PKTMBUF_OL_CRYPTO 

Crypto offload operation

Definition at line 64 of file rte_mbuf_offload.h.

Function Documentation

struct rte_mempool* rte_pktmbuf_offload_pool_create ( const char *  name,
unsigned  size,
unsigned  cache_size,
uint16_t  priv_size,
int  socket_id 
)
read

Creates a mempool of rte_mbuf_offload objects

EXPERIMENTAL: this API file may change without prior notice

Parameters
namemempool name
sizenumber of objects in mempool
cache_sizecache size of objects for each core
priv_sizesize of private data to be allocated with each rte_mbuf_offload object
socket_idSocket on which to allocate mempool objects
Returns
  • On success returns a valid mempool of rte_mbuf_offload objects
  • On failure return NULL
Examples:
l2fwd-crypto/main.c.
static uint16_t __rte_pktmbuf_offload_priv_size ( struct rte_mempool mpool)
inlinestatic

Returns private data size allocated with each rte_mbuf_offload object by the mempool

Parameters
mpoolrte_mbuf_offload mempool
Returns
private data size

Definition at line 125 of file rte_mbuf_offload.h.

static struct rte_mbuf_offload* rte_pktmbuf_offload_get ( struct rte_mbuf m,
enum rte_mbuf_ol_op_type  type 
)
staticread

Get specified off-load operation type from mbuf.

Parameters
mpacket mbuf.
typeoffload operation type requested.
Returns

Definition at line 145 of file rte_mbuf_offload.h.

static struct rte_mbuf_offload* rte_pktmbuf_offload_attach ( struct rte_mbuf m,
struct rte_mbuf_offload ol 
)
staticread

Attach a rte_mbuf_offload to a mbuf. We only support a single offload of any one type in our chain of offloads.

Parameters
mpacket mbuf.
olrte_mbuf_offload strucutre to be attached
Returns
  • On success returns the pointer to the offload we just added
  • On failure returns NULL
Examples:
l2fwd-crypto/main.c.

Definition at line 168 of file rte_mbuf_offload.h.

static void __rte_pktmbuf_offload_reset ( struct rte_mbuf_offload ol,
enum rte_mbuf_ol_op_type  type 
)
inlinestatic

Rearms rte_mbuf_offload default parameters

Definition at line 187 of file rte_mbuf_offload.h.

static struct rte_mbuf_offload* __rte_pktmbuf_offload_raw_alloc ( struct rte_mempool mp)
staticread

Allocate rte_mbuf_offload from mempool

Definition at line 203 of file rte_mbuf_offload.h.

static struct rte_mbuf_offload* rte_pktmbuf_offload_alloc ( struct rte_mempool mpool,
enum rte_mbuf_ol_op_type  type 
)
staticread

Allocate a rte_mbuf_offload with a specified operation type from rte_mbuf_offload mempool

Parameters
mpoolrte_mbuf_offload mempool
typeoffload operation type
Returns
Examples:
l2fwd-crypto/main.c.

Definition at line 225 of file rte_mbuf_offload.h.

static void rte_pktmbuf_offload_free ( struct rte_mbuf_offload ol)
inlinestatic

free rte_mbuf_offload structure

Examples:
l2fwd-crypto/main.c.

Definition at line 240 of file rte_mbuf_offload.h.

static void* __rte_pktmbuf_offload_check_priv_data_size ( struct rte_mbuf_offload ol,
uint16_t  size 
)
inlinestatic

Checks if the private data of a rte_mbuf_offload has enough capacity for requested size

Returns
  • if sufficient space available returns pointer to start of private data
  • if insufficient space returns NULL

Definition at line 255 of file rte_mbuf_offload.h.

static struct rte_crypto_xform* rte_pktmbuf_offload_alloc_crypto_xforms ( struct rte_mbuf_offload ol,
unsigned  nb_xforms 
)
staticread

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

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

Definition at line 279 of file rte_mbuf_offload.h.