---
name: "rte_security_driver.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_security_driver.h"
---

# rte\_security\_driver.h(3)

## NAME

rte\_security\_driver.h

## SYNOPSIS

`#include <rte_compat.h>`\
 `#include 'rte_security.h'`\

### Data Structures

struct **rte\_security\_ctx**\
 struct **rte\_security\_ops**\

### Macros

\#define **SECURITY\_GET\_SESS\_PRIV**(s)   	((void \*)(((struct rte\_security\_session \*)s)-\>driver\_priv\_data))\

### Typedefs

**typedef** int(\* **security\_session\_create\_t**) (void \*device, struct **rte\_security\_session\_conf** \*conf, struct rte\_security\_session \*sess)\
 **typedef** int(\* **security\_session\_destroy\_t**) (void \*device, struct rte\_security\_session \*sess)\
 **typedef** int(\* **security\_session\_update\_t**) (void \*device, struct rte\_security\_session \*sess, struct **rte\_security\_session\_conf** \*conf)\
 **typedef** int(\* **security\_macsec\_sc\_create\_t**) (void \*device, struct **rte\_security\_macsec\_sc** \*conf)\
 **typedef** int(\* **security\_macsec\_sc\_destroy\_t**) (void \*device, uint16\_t sc\_id, enum **rte\_security\_macsec\_direction** dir)\
 **typedef** int(\* **security\_macsec\_sa\_create\_t**) (void \*device, struct **rte\_security\_macsec\_sa** \*conf)\
 **typedef** int(\* **security\_macsec\_sa\_destroy\_t**) (void \*device, uint16\_t sa\_id, enum **rte\_security\_macsec\_direction** dir)\
 **typedef** unsigned int(\* **security\_session\_get\_size**) (void \*device)\
 **typedef** int(\* **security\_session\_stats\_get\_t**) (void \*device, struct rte\_security\_session \*sess, struct rte\_security\_stats \*stats)\
 **typedef** int(\* **security\_macsec\_sc\_stats\_get\_t**) (void \*device, uint16\_t sc\_id, enum **rte\_security\_macsec\_direction** dir, struct rte\_security\_macsec\_sc\_stats \*stats)\
 **typedef** int(\* **security\_macsec\_sa\_stats\_get\_t**) (void \*device, uint16\_t sa\_id, enum **rte\_security\_macsec\_direction** dir, struct rte\_security\_macsec\_sa\_stats \*stats)\
 **typedef** int(\* **security\_set\_pkt\_metadata\_t**) (void \*device, struct rte\_security\_session \*sess, struct **rte\_mbuf** \*mb, void \*params)\
 **typedef** const struct **rte\_security\_capability** \*(\* **security\_capabilities\_get\_t**) (void \*device)\
 **typedef** int(\* **security\_rx\_inject\_configure**) (void \*device, uint16\_t port\_id, bool enable)\
 **typedef** uint16\_t(\* **security\_inb\_pkt\_rx\_inject**) (void \*device, struct **rte\_mbuf** \*\*pkts, struct rte\_security\_session \*\*sess, uint16\_t nb\_pkts)\

## Detailed Description

RTE Security Common Definitions

Definition in file **rte\_security\_driver.h**.

## Macro Definition Documentation

### #define SECURITY\_GET\_SESS\_PRIV(s) ((void \*)(((struct rte\_security\_session \*)s)-\>driver\_priv\_data))

Helper macro to get driver private data

Definition at line **66** of file **rte\_security\_driver.h**.

## Typedef Documentation

### typedef int(\* security\_session\_create\_t) (void \*device, struct rte\_security\_session\_conf \*conf, struct rte\_security\_session \*sess)

Configure a security session on a device.

**Parameters**

*device* Crypto/eth device pointer \
 *conf* Security session configuration \
 *sess* Pointer to Security private session structure

**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.

Definition at line **83** of file **rte\_security\_driver.h**.

### typedef int(\* security\_session\_destroy\_t) (void \*device, struct rte\_security\_session \*sess)

Free driver private session data.

**Parameters**

*device* Crypto/eth device pointer \
 *sess* Security session structure

Definition at line **93** of file **rte\_security\_driver.h**.

### typedef int(\* security\_session\_update\_t) (void \*device, struct rte\_security\_session \*sess, struct rte\_security\_session\_conf \*conf)

Update driver private session data.

**Parameters**

*device* Crypto/eth device pointer \
 *sess* Pointer to Security private session structure \
 *conf* Security session configuration

**Returns**

- •

  Returns 0 if private session structure have been updated successfully.

- •

  Returns -EINVAL if input parameters are invalid.

- •

  Returns -ENOTSUP if crypto device does not support the crypto transform.

Definition at line **108** of file **rte\_security\_driver.h**.

### typedef int(\* security\_macsec\_sc\_create\_t) (void \*device, struct rte\_security\_macsec\_sc \*conf)

Configure a MACsec secure channel (SC) on a device.

**Parameters**

*device* Crypto/eth device pointer \
 *conf* MACsec SC configuration params

**Returns**

- •

  positive sc\_id if SC is created successfully.

- •

  \-EINVAL if input parameters are invalid.

- •

  \-ENOTSUP if device does not support MACsec.

- •

  \-ENOMEM if the SC cannot be created.

Definition at line **124** of file **rte\_security\_driver.h**.

### typedef int(\* security\_macsec\_sc\_destroy\_t) (void \*device, uint16\_t sc\_id, enum rte\_security\_macsec\_direction dir)

Free MACsec secure channel (SC).

**Parameters**

*device* Crypto/eth device pointer \
 *sc\_id* MACsec SC ID \
 *dir* Direction of SC

Definition at line **133** of file **rte\_security\_driver.h**.

### typedef int(\* security\_macsec\_sa\_create\_t) (void \*device, struct rte\_security\_macsec\_sa \*conf)

Configure a MACsec security Association (SA) on a device.

**Parameters**

*device* Crypto/eth device pointer \
 *conf* MACsec SA configuration params

**Returns**

- •

  positive sa\_id if SA is created successfully.

- •

  \-EINVAL if input parameters are invalid.

- •

  \-ENOTSUP if device does not support MACsec.

- •

  \-ENOMEM if the SA cannot be created.

Definition at line **148** of file **rte\_security\_driver.h**.

### typedef int(\* security\_macsec\_sa\_destroy\_t) (void \*device, uint16\_t sa\_id, enum rte\_security\_macsec\_direction dir)

Free MACsec security association (SA).

**Parameters**

*device* Crypto/eth device pointer \
 *sa\_id* MACsec SA ID \
 *dir* Direction of SA

Definition at line **157** of file **rte\_security\_driver.h**.

### typedef unsigned int(\* security\_session\_get\_size) (void \*device)

Get the size of a security session

**Parameters**

*device* Crypto/eth device pointer

**Returns**

- •

  On success returns the size of the session structure for device

- •

  On failure returns 0

Definition at line **169** of file **rte\_security\_driver.h**.

### typedef int(\* security\_session\_stats\_get\_t) (void \*device, struct rte\_security\_session \*sess, struct rte\_security\_stats \*stats)

Get stats from the PMD.

**Parameters**

*device* Crypto/eth device pointer \
 *sess* Pointer to Security private session structure \
 *stats* Security stats of the driver

**Returns**

- •

  Returns 0 if private session structure have been updated successfully.

- •

  Returns -EINVAL if session parameters are invalid.

Definition at line **182** of file **rte\_security\_driver.h**.

### typedef int(\* security\_macsec\_sc\_stats\_get\_t) (void \*device, uint16\_t sc\_id, enum rte\_security\_macsec\_direction dir, struct rte\_security\_macsec\_sc\_stats \*stats)

Get MACsec secure channel stats from the PMD.

**Parameters**

*device* Crypto/eth device pointer \
 *sc\_id* secure channel ID created by **rte\_security\_macsec\_sc\_create()** \
 *dir* direction of SC \
 *stats* SC stats of the driver

**Returns**

- •

  0 if success.

- •

  \-EINVAL if sc\_id or device is invalid.

Definition at line **198** of file **rte\_security\_driver.h**.

### typedef int(\* security\_macsec\_sa\_stats\_get\_t) (void \*device, uint16\_t sa\_id, enum rte\_security\_macsec\_direction dir, struct rte\_security\_macsec\_sa\_stats \*stats)

Get MACsec SA stats from the PMD.

**Parameters**

*device* Crypto/eth device pointer \
 *sa\_id* secure channel ID created by **rte\_security\_macsec\_sc\_create()** \
 *dir* direction of SA \
 *stats* SC stats of the driver

**Returns**

- •

  0 if success.

- •

  \-EINVAL if sa\_id or device is invalid.

Definition at line **214** of file **rte\_security\_driver.h**.

### typedef int(\* security\_set\_pkt\_metadata\_t) (void \*device, struct rte\_security\_session \*sess, struct rte\_mbuf \*mb, void \*params)

Update the mbuf with provided metadata.

**Parameters**

*device* Crypto/eth device pointer \
 *sess* Security session structure \
 *mb* Packet buffer \
 *params* Metadata

**Returns**

- •

  Returns 0 if metadata updated successfully.

- •

  Returns -ve value for errors.

Definition at line **243** of file **rte\_security\_driver.h**.

### typedef const struct rte\_security\_capability \*(\* security\_capabilities\_get\_t) (void \*device)

Get security capabilities of the device.

**Parameters**

*device* crypto/eth device pointer

**Returns**

- •

  Returns **rte\_security\_capability** pointer on success.

- •

  Returns NULL on error.

Definition at line **243** of file **rte\_security\_driver.h**.

### typedef int(\* security\_rx\_inject\_configure) (void \*device, uint16\_t port\_id, bool enable)

Configure security device to inject packets to an ethdev port.

**Parameters**

*device* Crypto/eth device pointer \
 *port\_id* Port identifier of the ethernet device to which packets need to be injected. \
 *enable* Flag to enable and disable connection between a security device and an ethdev port.

**Returns**

- •

  0 if successful.

- •

  \-EINVAL if context NULL or port\_id is invalid.

- •

  \-EBUSY if devices are not in stopped state.

- •

  \-ENOTSUP if security device does not support injecting to the ethdev port.

Definition at line **273** of file **rte\_security\_driver.h**.

### typedef uint16\_t(\* security\_inb\_pkt\_rx\_inject) (void \*device, struct rte\_mbuf \*\*pkts, struct rte\_security\_session \*\*sess, uint16\_t nb\_pkts)

Perform security processing of packets and inject the processed packet to ethdev Rx.

Rx inject would behave similarly to ethdev loopback but with the additional security processing.

**Parameters**

*device* Crypto/eth device pointer \
 *pkts* The address of an array of *nb\_pkts* pointers to **rte\_mbuf structures which contain the packets.** \
 *sess* **The address of an array of** *nb\_pkts* **pointers to** *rte\_security\_session* **structures corresponding to each packet.** \
 *nb\_pkts* **The maximum number of packets to process.**

**Returns**

**The number of packets successfully injected to ethdev Rx. The return value can be less than the value of the** *nb\_pkts* **parameter when the PMD internal queues have been filled up.**

**Definition at line 295 of file rte\_security\_driver.h.**

## Author

**Generated automatically by Doxygen for DPDK from the source code.**
