rte_security.h(3)

πŸ’– NAME πŸ’–

rte_security.h β€” bestie, this is your one-stop shop for RTE Security Common Definitions, aka the header where DPDK keeps all the shiny security offload lore. You're reading it in the manual page rte_security.h(3), so pull up a chair, grab a boba, and let's get into it πŸ§‹βœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

First things first, you gotta pull in the goods:

#include <sys/types.h>
#include <rte_compat.h>
#include <rte_common.h>
#include <rte_crypto.h>
#include <rte_ip.h>
#include <rte_mbuf_dyn.h>

πŸŽ€ Data Structures πŸŽ€

okay so these are the structs living in here, in order, no skips:

  • struct rte_security_ipsec_tunnel_param
  • struct rte_security_ipsec_sa_options
  • struct rte_security_ipsec_lifetime
  • struct rte_security_ipsec_xform
  • struct rte_security_macsec_sa
  • struct rte_security_macsec_sc
  • struct rte_security_macsec_xform
  • struct rte_security_pdcp_xform
  • struct rte_security_docsis_xform
  • struct rte_security_tls_record_sess_options
  • struct rte_security_tls_record_lifetime
  • struct rte_security_tls_record_xform
  • struct rte_security_session_conf
  • struct rte_security_capability
  • struct rte_security_capability_idx

✨ Macros ✨

the preprocessor said "let me cook" and honestly? it ate:

#define RTE_SECURITY_IPSEC_TUNNEL_VERIFY_DST_ADDR   0x1
#define RTE_SEC_CTX_F_FAST_SET_MDATA   0x00000001
#define RTE_SECURITY_MACSEC_NUM_AN   4
#define RTE_SECURITY_MACSEC_SALT_LEN   12
#define RTE_SECURITY_MACSEC_VALIDATE_DISABLE   0
#define RTE_SECURITY_MACSEC_VALIDATE_NO_DISCARD   1
#define RTE_SECURITY_MACSEC_VALIDATE_STRICT   2
#define RTE_SECURITY_MACSEC_VALIDATE_NO_OP   3
#define RTE_SECURITY_TLS_1_2_IMP_NONCE_LEN   4
#define RTE_SECURITY_TLS_1_3_IMP_NONCE_LEN   12
#define RTE_SECURITY_DTLS_1_2_IMP_NONCE_LEN   4
#define RTE_SECURITY_PDCP_ORDERING_CAP   0x00000001
#define RTE_SECURITY_PDCP_DUP_DETECT_CAP   0x00000002
#define RTE_SECURITY_TX_OLOAD_NEED_MDATA   0x00000001
#define RTE_SECURITY_TX_HW_TRAILER_OFFLOAD   0x00000002
#define RTE_SECURITY_RX_HW_TRAILER_OFFLOAD   0x00010000

πŸ’… Typedefs πŸ’…

typedef uint64_t rte_security_dynfield_t
typedef struct rte_mbuf * rte_security_oop_dynfield_t

🌸 Enumerations 🌸

these are the enum vibes, and yes, I'm keeping the values exactly:

enum rte_security_ipsec_sa_mode { RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT =
    1, RTE_SECURITY_IPSEC_SA_MODE_TUNNEL }
enum rte_security_ipsec_sa_protocol { RTE_SECURITY_IPSEC_SA_PROTO_AH =
    1, RTE_SECURITY_IPSEC_SA_PROTO_ESP }
enum rte_security_ipsec_tunnel_type { RTE_SECURITY_IPSEC_TUNNEL_IPV4 =
    1, RTE_SECURITY_IPSEC_TUNNEL_IPV6 }
enum rte_security_ipsec_sa_direction { RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
    RTE_SECURITY_IPSEC_SA_DIR_INGRESS }
enum rte_security_macsec_direction { RTE_SECURITY_MACSEC_DIR_TX,
    RTE_SECURITY_MACSEC_DIR_RX }
enum rte_security_macsec_alg { RTE_SECURITY_MACSEC_ALG_GCM_128,
    RTE_SECURITY_MACSEC_ALG_GCM_256,
    RTE_SECURITY_MACSEC_ALG_GCM_XPN_128,
    RTE_SECURITY_MACSEC_ALG_GCM_XPN_256 }
enum rte_security_pdcp_domain { RTE_SECURITY_PDCP_MODE_CONTROL,
    RTE_SECURITY_PDCP_MODE_DATA, RTE_SECURITY_PDCP_MODE_SHORT_MAC }
enum rte_security_pdcp_direction { RTE_SECURITY_PDCP_UPLINK,
    RTE_SECURITY_PDCP_DOWNLINK }
enum rte_security_pdcp_sn_size { RTE_SECURITY_PDCP_SN_SIZE_5 = 5,
    RTE_SECURITY_PDCP_SN_SIZE_7 = 7, RTE_SECURITY_PDCP_SN_SIZE_12 = 12,
    RTE_SECURITY_PDCP_SN_SIZE_15 = 15, RTE_SECURITY_PDCP_SN_SIZE_18 = 18
    }
enum rte_security_docsis_direction { RTE_SECURITY_DOCSIS_UPLINK,
    RTE_SECURITY_DOCSIS_DOWNLINK }
enum rte_security_tls_version { RTE_SECURITY_VERSION_TLS_1_2,
    RTE_SECURITY_VERSION_TLS_1_3, RTE_SECURITY_VERSION_DTLS_1_2 }
enum rte_security_tls_sess_type { RTE_SECURITY_TLS_SESS_TYPE_READ,
    RTE_SECURITY_TLS_SESS_TYPE_WRITE }
enum rte_security_session_action_type { RTE_SECURITY_ACTION_TYPE_NONE,
    RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO,
    RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
    RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
    RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO }
enum rte_security_session_protocol { RTE_SECURITY_PROTOCOL_IPSEC = 1,
    RTE_SECURITY_PROTOCOL_MACSEC, RTE_SECURITY_PROTOCOL_PDCP,
    RTE_SECURITY_PROTOCOL_DOCSIS, RTE_SECURITY_PROTOCOL_TLS_RECORD }

πŸ‘‘ Functions πŸ‘‘

the whole function roster, verbatim, because we do NOT abbreviate here:

void * rte_security_session_create (void *instance, struct
    rte_security_session_conf *conf, struct rte_mempool *mp)
int rte_security_session_update (void *instance, void *sess, struct
    rte_security_session_conf *conf)
unsigned int rte_security_session_get_size (void *instance)
int rte_security_session_destroy (void *instance, void *sess)
int rte_security_macsec_sc_create (void *instance, struct
    rte_security_macsec_sc *conf)
int rte_security_macsec_sc_destroy (void *instance, uint16_t sc_id, enum
    rte_security_macsec_direction dir)
int rte_security_macsec_sa_create (void *instance, struct
    rte_security_macsec_sa *conf)
int rte_security_macsec_sa_destroy (void *instance, uint16_t sa_id, enum
    rte_security_macsec_direction dir)
static rte_security_dynfield_t * rte_security_dynfield (struct rte_mbuf
    *mbuf)
static __rte_experimental rte_security_oop_dynfield_t *
    rte_security_oop_dynfield (struct rte_mbuf *mbuf)
static bool rte_security_dynfield_is_registered (void)
static uint32_t rte_security_ctx_flags_get (void *ctx)
static void rte_security_ctx_flags_set (void *ctx, uint32_t flags)
static uint64_t rte_security_session_opaque_data_get (void *sess)
static void rte_security_session_opaque_data_set (void *sess, uint64_t
    opaque)
static uint64_t rte_security_session_fast_mdata_get (void *sess)
static void rte_security_session_fast_mdata_set (void *sess, uint64_t
    fdata)
int __rte_security_set_pkt_metadata (void *instance, void *sess, struct
    rte_mbuf *m, void *params)
static int rte_security_set_pkt_metadata (void *instance, void *sess,
    struct rte_mbuf *mb, void *params)
static int __rte_security_attach_session (struct rte_crypto_sym_op
    *sym_op, void *sess)
static int rte_security_attach_session (struct rte_crypto_op *op, void
    *sess)
int rte_security_session_stats_get (void *instance, void *sess, struct
    rte_security_stats *stats)
int rte_security_macsec_sa_stats_get (void *instance, uint16_t sa_id,
    enum rte_security_macsec_direction dir, struct
    rte_security_macsec_sa_stats *stats)
int rte_security_macsec_sc_stats_get (void *instance, uint16_t sc_id,
    enum rte_security_macsec_direction dir, struct
    rte_security_macsec_sc_stats *stats)
const struct rte_security_capability * rte_security_capabilities_get
    (void *instance)
const struct rte_security_capability * rte_security_capability_get (void
    *instance, struct rte_security_capability_idx *idx)
__rte_experimental int rte_security_rx_inject_configure (void *ctx,
    uint16_t port_id, bool enable)
__rte_experimental uint16_t rte_security_inb_pkt_rx_inject (void *ctx,
    struct rte_mbuf **pkts, void **sess, uint16_t nb_pkts)

⭐ Variables ⭐

two globals, just vibing:

int rte_security_dynfield_offset
int rte_security_oop_dynfield_offset

🌈 DETAILED DESCRIPTION 🌈

RTE Security Common Definitions

Definition in file rte_security.h.

periodt. that's the whole file description, it's giving "minimal but iconic" πŸ’…


πŸ“ MACRO DEFINITION DOCUMENTATION πŸ“

#define RTE_SECURITY_IPSEC_TUNNEL_VERIFY_DST_ADDR 0x1

IPSEC tunnel header verification mode.

This one controls how the outer IP header gets verified on inbound traffic, bestie.

Definition at line 56 of file rte_security.h.

#define RTE_SEC_CTX_F_FAST_SET_MDATA 0x00000001

Driver uses fast metadata update without using driver specific callback. For fast mdata, the mbuf dynamic field would be registered by the driver via rte_security_dynfield_register().

Definition at line 59 of file rte_security.h.

#define RTE_SECURITY_MACSEC_NUM_AN 4

Maximum number of association numbers for a secure channel.

Definition at line 345 of file rte_security.h.

#define RTE_SECURITY_MACSEC_SALT_LEN 12

Salt length for MACsec SA.

Definition at line 347 of file rte_security.h.

#define RTE_SECURITY_MACSEC_VALIDATE_DISABLE 0

Disable validation of MACsec frame.

Definition at line 418 of file rte_security.h.

#define RTE_SECURITY_MACSEC_VALIDATE_NO_DISCARD 1

Validate MACsec frame but do not discard invalid frame.

Definition at line 420 of file rte_security.h.

#define RTE_SECURITY_MACSEC_VALIDATE_STRICT 2

Validate MACsec frame and discard invalid frame.

Definition at line 422 of file rte_security.h.

#define RTE_SECURITY_MACSEC_VALIDATE_NO_OP 3

Do not perform any MACsec operation. literally none. it's on do-not-disturb mode πŸ™ˆ

Definition at line 424 of file rte_security.h.

#define RTE_SECURITY_TLS_1_2_IMP_NONCE_LEN 4

Implicit nonce length to be used with AEAD algos in TLS 1.2.

Definition at line 601 of file rte_security.h.

#define RTE_SECURITY_TLS_1_3_IMP_NONCE_LEN 12

Implicit nonce length to be used with AEAD algos in TLS 1.3.

Definition at line 603 of file rte_security.h.

#define RTE_SECURITY_DTLS_1_2_IMP_NONCE_LEN 4

Implicit nonce length to be used with AEAD algos in DTLS 1.2.

Definition at line 605 of file rte_security.h.

#define RTE_SECURITY_PDCP_ORDERING_CAP 0x00000001

Underlying Hardware/driver which support PDCP may or may not support packet ordering. Set RTE_SECURITY_PDCP_ORDERING_CAP if it supports it. If it is not set, the driver/HW assumes packets received are in order and it will be the application's responsibility to maintain ordering. so like… if you don't set it, that's on you fr fr

Definition at line 1340 of file rte_security.h.

#define RTE_SECURITY_PDCP_DUP_DETECT_CAP 0x00000002

Underlying Hardware/driver which support PDCP may or may not detect duplicate packet. Set RTE_SECURITY_PDCP_DUP_DETECT_CAP if it supports it. If it is not set, the driver/HW assumes there is no duplicate packet received.

Definition at line 1346 of file rte_security.h.

#define RTE_SECURITY_TX_OLOAD_NEED_MDATA 0x00000001

HW needs metadata update, see rte_security_set_pkt_metadata().

Definition at line 1348 of file rte_security.h.

#define RTE_SECURITY_TX_HW_TRAILER_OFFLOAD 0x00000002

HW constructs the trailer of packets. Transmitted packets will have the trailer added to them by hardware. The next protocol field will be based on the mbuf->inner_esp_next_proto field.

Definition at line 1352 of file rte_security.h.

#define RTE_SECURITY_RX_HW_TRAILER_OFFLOAD 0x00010000

HW removes the trailer of packets. Received packets have no trailer, the next protocol field is supplied in the mbuf->inner_esp_next_proto field. Inner packet is not modified.

Definition at line 1358 of file rte_security.h.

🧚 TYPEDEF DOCUMENTATION 🧚

typedef uint64_t rte_security_dynfield_t

Device-specific metadata field type.

Definition at line 915 of file rte_security.h.

typedef struct rte_mbuf* rte_security_oop_dynfield_t

Out-of-Place (OOP) processing field type.

Definition at line 920 of file rte_security.h.

okay pausing here because there's so much more coming β€” part 2 has the rest of the structs and functions and it's lowkey the main character of this manual page πŸ‘€πŸ’–

✨ ENUMERATION TYPE DOCUMENTATION ✨

okay bestie, this is the enum section and we are going through every single little constant. no skips, no summaries, periodt. πŸ’…


enum rte_security_ipsec_sa_mode

IPSec protocol mode β€” the mode vibe.

  • RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT β€” IPSec Transport mode
  • RTE_SECURITY_IPSEC_SA_MODE_TUNNEL β€” IPSec Tunnel mode

πŸ“Œ Definition at line 28 of file rte_security.h.


enum rte_security_ipsec_sa_protocol

IPSec Protocol β€” which protocol, bestie.

  • RTE_SECURITY_IPSEC_SA_PROTO_AH β€” AH protocol
  • RTE_SECURITY_IPSEC_SA_PROTO_ESP β€” ESP protocol

πŸ“Œ Definition at line 36 of file rte_security.h.


enum rte_security_ipsec_tunnel_type

IPSEC tunnel type β€” outer header energy.

  • RTE_SECURITY_IPSEC_TUNNEL_IPV4 β€” Outer header is IPv4
  • RTE_SECURITY_IPSEC_TUNNEL_IPV6 β€” Outer header is IPv6

πŸ“Œ Definition at line 44 of file rte_security.h.


enum rte_security_ipsec_sa_direction

IPSec security association direction β€” which way the SA is flowing.

  • RTE_SECURITY_IPSEC_SA_DIR_EGRESS β€” Encrypt and generate digest
  • RTE_SECURITY_IPSEC_SA_DIR_INGRESS β€” Verify digest and decrypt

πŸ“Œ Definition at line 265 of file rte_security.h.


enum rte_security_macsec_direction

MACSec packet flow direction β€” TX or RX, no in-between.

  • RTE_SECURITY_MACSEC_DIR_TX β€” Generate SecTag and encrypt/authenticate
  • RTE_SECURITY_MACSEC_DIR_RX β€” Remove SecTag and decrypt/verify

πŸ“Œ Definition at line 337 of file rte_security.h.


enum rte_security_macsec_alg

MACsec Supported Algorithm list as per IEEE Std 802.1AE.

  • RTE_SECURITY_MACSEC_ALG_GCM_128 β€” AES-GCM 128 bit block cipher
  • RTE_SECURITY_MACSEC_ALG_GCM_256 β€” AES-GCM 256 bit block cipher
  • RTE_SECURITY_MACSEC_ALG_GCM_XPN_128 β€” AES-GCM 128 bit block cipher with unique SSCI
  • RTE_SECURITY_MACSEC_ALG_GCM_XPN_256 β€” AES-GCM 256 bit block cipher with unique SSCI

πŸ“Œ Definition at line 410 of file rte_security.h.


enum rte_security_pdcp_domain

PDCP Mode of session β€” control plane, data plane, or short mac.

  • RTE_SECURITY_PDCP_MODE_CONTROL β€” PDCP control plane
  • RTE_SECURITY_PDCP_MODE_DATA β€” PDCP data plane
  • RTE_SECURITY_PDCP_MODE_SHORT_MAC β€” PDCP short mac

πŸ“Œ Definition at line 505 of file rte_security.h.


enum rte_security_pdcp_direction

PDCP Frame direction β€” up or down.

  • RTE_SECURITY_PDCP_UPLINK β€” Uplink
  • RTE_SECURITY_PDCP_DOWNLINK β€” Downlink

πŸ“Œ Definition at line 512 of file rte_security.h.


enum rte_security_pdcp_sn_size

PDCP Sequence Number Size selectors β€” the bit-width menu.

  • RTE_SECURITY_PDCP_SN_SIZE_5 β€” PDCP_SN_SIZE_5: 5bit sequence number
  • RTE_SECURITY_PDCP_SN_SIZE_7 β€” PDCP_SN_SIZE_7: 7bit sequence number
  • RTE_SECURITY_PDCP_SN_SIZE_12 β€” PDCP_SN_SIZE_12: 12bit sequence number
  • RTE_SECURITY_PDCP_SN_SIZE_15 β€” PDCP_SN_SIZE_15: 15bit sequence number
  • RTE_SECURITY_PDCP_SN_SIZE_18 β€” PDCP_SN_SIZE_18: 18bit sequence number

πŸ“Œ Definition at line 518 of file rte_security.h.


enum rte_security_docsis_direction

DOCSIS direction β€” uplink and downlink, with their little bullet babies.

  • RTE_SECURITY_DOCSIS_UPLINK β€” Uplink
    • Decryption, followed by CRC Verification
  • RTE_SECURITY_DOCSIS_DOWNLINK β€” Downlink
    • CRC Generation, followed by Encryption

πŸ“Œ Definition at line 579 of file rte_security.h.


enum rte_security_tls_version

TLS version β€” TLS 1.2, TLS 1.3, DTLS 1.2. slay.

  • RTE_SECURITY_VERSION_TLS_1_2 β€” TLS 1.2
  • RTE_SECURITY_VERSION_TLS_1_3 β€” TLS 1.3
  • RTE_SECURITY_VERSION_DTLS_1_2 β€” DTLS 1.2

πŸ“Œ Definition at line 608 of file rte_security.h.


enum rte_security_tls_sess_type

TLS session type β€” read or write, with the receipts.

  • RTE_SECURITY_TLS_SESS_TYPE_READ β€” Record read session
    • Decrypt & digest verification.
  • RTE_SECURITY_TLS_SESS_TYPE_WRITE β€” Record write session
    • Encrypt & digest generation.

πŸ“Œ Definition at line 615 of file rte_security.h.


enum rte_security_session_action_type

Security session action type. β€” the big action menu.

  • RTE_SECURITY_ACTION_TYPE_NONE β€” No security actions
  • RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO β€” Crypto processing for security protocol is processed inline during transmission
  • RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL β€” All security protocol processing is performed inline during transmission
  • RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL β€” All security protocol processing including crypto is performed on a lookaside accelerator
  • RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO β€” Similar to ACTION_TYPE_NONE but crypto processing for security protocol is processed synchronously by a CPU.

πŸ“Œ Definition at line 731 of file rte_security.h.


enum rte_security_session_protocol

Security session protocol definition β€” pick your protocol, bestie.

  • RTE_SECURITY_PROTOCOL_IPSEC β€” IPsec Protocol
  • RTE_SECURITY_PROTOCOL_MACSEC β€” MACSec Protocol
  • RTE_SECURITY_PROTOCOL_PDCP β€” PDCP Protocol
  • RTE_SECURITY_PROTOCOL_DOCSIS β€” DOCSIS Protocol
  • RTE_SECURITY_PROTOCOL_TLS_RECORD β€” TLS Record Protocol

πŸ“Œ Definition at line 755 of file rte_security.h.


✨ FUNCTION DOCUMENTATION ✨

these are the functions, bestie. signatures stay exactly as they are β€” no renaming, no merging, no inventing. πŸ’–


rte_security_session_create

void * rte_security_session_create (void * instance, struct
       rte_security_session_conf * conf, struct rte_mempool * mp)

Create security session as specified by the session configuration

Parameters

  • instance β€” security instance
  • conf β€” session configuration parameters
  • mp β€” mempool to allocate session objects from

Returns

  • On success, pointer to session
  • On failure, NULL

rte_security_session_update

int rte_security_session_update (void * instance, void * sess, struct
       rte_security_session_conf * conf)

Update security session as specified by the session configuration

Parameters

  • instance β€” security instance
  • sess β€” session to update parameters
  • conf β€” update configuration parameters

Returns

  • On success returns 0
  • On failure returns a negative errno value.

rte_security_session_get_size

unsigned int rte_security_session_get_size (void * instance)

Get the size of the security session data for a device.

Parameters

  • instance β€” security instance.

Returns

  • Size of the private data, if successful
  • 0 if device is invalid or does not support the operation.

rte_security_session_destroy

int rte_security_session_destroy (void * instance, void * sess)

Free security session header and the session private data and return it to its original mempool.

Parameters

  • instance β€” security instance
  • sess β€” security session to be freed

Returns

  • 0 if successful.
  • -EINVAL if session or context instance is NULL.
  • -EBUSY if not all device private data has been freed.
  • -ENOTSUP if destroying private data is not supported.
  • other negative values in case of freeing private data errors.

rte_security_macsec_sc_create

int rte_security_macsec_sc_create (void * instance, struct
       rte_security_macsec_sc * conf)

Create MACsec security channel (SC).

Parameters

  • instance β€” security instance
  • conf β€” MACsec SC configuration params

Returns

  • secure channel ID if successful.
  • -EINVAL if configuration params are invalid of instance is NULL.
  • -ENOTSUP if device does not support MACsec.
  • -ENOMEM if PMD is not capable to create more SC.
  • other negative value for other errors.

rte_security_macsec_sc_destroy

int rte_security_macsec_sc_destroy (void * instance, uint16_t sc_id, enum
       rte_security_macsec_direction dir)

Destroy MACsec security channel (SC).

Parameters

  • instance β€” security instance
  • sc_id β€” SC ID to be destroyed
  • dir β€” direction of the SC

Returns

  • 0 if successful.
  • -EINVAL if sc_id is invalid or instance is NULL.
  • -EBUSY if sc is being used by some session.

rte_security_macsec_sa_create

int rte_security_macsec_sa_create (void * instance, struct
       rte_security_macsec_sa * conf)

Create MACsec security association (SA).

Parameters

  • instance β€” security instance
  • conf β€” MACsec SA configuration params

Returns

  • positive SA ID if successful.
  • -EINVAL if configuration params are invalid of instance is NULL.
  • -ENOTSUP if device does not support MACsec.
  • -ENOMEM if PMD is not capable to create more SAs.
  • other negative value for other errors.

rte_security_macsec_sa_destroy

int rte_security_macsec_sa_destroy (void * instance, uint16_t sa_id, enum
       rte_security_macsec_direction dir)

Destroy MACsec security association (SA).

Parameters

  • instance β€” security instance
  • sa_id β€” SA ID to be destroyed
  • dir β€” direction of the SA

Returns

  • 0 if successful.
  • -EINVAL if sa_id is invalid or instance is NULL.
  • -EBUSY if sa is being used by some session.

rte_security_dynfield

rte_security_dynfield_t * rte_security_dynfield (struct rte_mbuf * mbuf)
       [inline],  [static]

Get pointer to mbuf field for device-specific metadata.

For performance reason, no check is done, the dynamic field may not be registered.

See also: rte_security_dynfield_is_registered

Parameters

  • mbuf β€” packet to access

Returns

  • pointer to mbuf field

πŸ“Œ Definition at line 937 of file rte_security.h.


rte_security_oop_dynfield

__rte_experimental rte_security_oop_dynfield_t * rte_security_oop_dynfield
       (struct rte_mbuf * mbuf) [inline],  [static]
Warning β€” EXPERIMENTAL: this API may change without prior notice

Get pointer to mbuf field for original mbuf pointer when Out-Of-Place(OOP) processing is enabled in security session.

Parameters

  • mbuf β€” packet to access

Returns

  • pointer to mbuf field

πŸ“Œ Definition at line 956 of file rte_security.h.


rte_security_dynfield_is_registered

bool rte_security_dynfield_is_registered (void ) [inline],  [static]

Check whether the dynamic field is registered.

Returns

  • true if rte_security_dynfield_register() has been called.

πŸ“Œ Definition at line 968 of file rte_security.h.


rte_security_ctx_flags_get

uint32_t rte_security_ctx_flags_get (void * ctx) [inline],  [static]

Get security flags from security instance.

πŸ“Œ Definition at line 978 of file rte_security.h.


rte_security_ctx_flags_set

void rte_security_ctx_flags_set (void * ctx, uint32_t flags) [inline],
       [static]

Set security flags in security instance.

πŸ“Œ Definition at line 987 of file rte_security.h.


rte_security_session_opaque_data_get

uint64_t rte_security_session_opaque_data_get (void * sess) [inline],
       [static]

Get opaque data from session handle

πŸ“Œ Definition at line 1000 of file rte_security.h.


rte_security_session_opaque_data_set

void rte_security_session_opaque_data_set (void * sess, uint64_t opaque)
       [inline],  [static]

Set opaque data in session handle

πŸ“Œ Definition at line 1009 of file rte_security.h.


rte_security_session_fast_mdata_get

uint64_t rte_security_session_fast_mdata_get (void * sess) [inline],
       [static]

Get fast mdata from session handle

πŸ“Œ Definition at line 1020 of file rte_security.h.


rte_security_session_fast_mdata_set

void rte_security_session_fast_mdata_set (void * sess, uint64_t fdata)
       [inline],  [static]

Set fast mdata in session handle

Definition at line 1029 of file rte_security.h. ✨

__rte_security_set_pkt_metadata πŸ’…

int __rte_security_set_pkt_metadata (void * instance, void * sess, struct rte_mbuf * m, void * params)

Okay so this one's whole job is to call the PMD-specific function pointer set_pkt_metadata(). That's it, that's the gig β€” it's the little bridge to whatever the driver wants to do. 🫢

rte_security_set_pkt_metadata πŸŽ€

int rte_security_set_pkt_metadata (void * instance, void * sess, struct rte_mbuf * mb, void * params) [inline],  [static]

Updates the buffer with device-specific defined metadata. Like, your mbuf gets the exact glow-up the device asked for. πŸ’–

Parameters

  • instance β€” security instance
  • sess β€” security session
  • mb β€” packet mbuf to set metadata on.
  • params β€” device-specific defined parameters required for metadata

Returns

  • On success, zero. βœ…
  • On failure, a negative value. 😭

Definition at line 1055 of file rte_security.h.


__rte_security_attach_session πŸ¦‹

int __rte_security_attach_session (struct rte_crypto_sym_op * sym_op, void * sess) [inline],  [static]

Attach a session to a symmetric crypto operation. Bestie, this is the attach moment, but for sym_op. ✨

Parameters

  • sym_op β€” crypto operation
  • sess β€” security session

Definition at line 1077 of file rte_security.h.


rte_security_attach_session 🌸

int rte_security_attach_session (struct rte_crypto_op * op, void * sess) [inline],  [static]

Attach a session to a crypto operation.

Real talk though: this API is needed only in the case of RTE_SECURITY_SESS_CRYPTO_PROTO_OFFLOAD. For other rte_security_session_action_type, ol_flags in rte_mbuf may be defined to perform security operations. So like… don't use it elsewhere, iykyk. πŸ’…

Parameters

  • op β€” crypto operation
  • sess β€” security session

Definition at line 1094 of file rte_security.h.


rte_security_session_stats_get πŸ“Š

int rte_security_session_stats_get (void * instance, void * sess, struct rte_security_stats * stats)

Get security session statistics. Numbers, numbers, we love to see them. πŸ‘‘

Parameters

  • instance β€” security instance
  • sess β€” security session. If security session is NULL then global (per security instance) statistics will be retrieved, if supported. Global statistics collection is not dependent on the per session statistics configuration. (Yes bestie, that means you can pull the global numbers even when per-session stats are configured off. πŸ’–)
  • stats β€” statistics

Returns

  • On success, return 0 βœ…
  • On failure, a negative value 😭

rte_security_macsec_sa_stats_get πŸ”

int rte_security_macsec_sa_stats_get (void * instance, uint16_t sa_id, enum rte_security_macsec_direction dir, struct rte_security_macsec_sa_stats * stats)

Get MACsec SA statistics. MACsec girlies, this one's for you. ✨

Parameters

  • instance β€” security instance
  • sa_id β€” SA ID for which stats are needed
  • dir β€” direction of the SA
  • stats β€” statistics

Returns

  • On success, return 0. βœ…
  • On failure, a negative value. 😭

rte_security_macsec_sc_stats_get 🧚

int rte_security_macsec_sc_stats_get (void * instance, uint16_t sc_id, enum rte_security_macsec_direction dir, struct rte_security_macsec_sc_stats * stats)

Get MACsec SC statistics. Same energy as the SA one but make it Secure Channel. πŸ’œ

Parameters

  • instance β€” security instance
  • sc_id β€” SC ID for which stats are needed
  • dir β€” direction of the SC
  • stats β€” SC statistics

Returns

  • On success, return 0. βœ…
  • On failure, a negative value. 😭

rte_security_capabilities_get 🌈

const struct rte_security_capability * rte_security_capabilities_get (void * instance)

Returns array of security instance capabilities. Capability check, but make it iconic. πŸ‘‘

Parameters

  • instance β€” Security instance.

Returns

  • Returns array of security capabilities. πŸŽ€
  • Return NULL if no capabilities available. πŸ’€

rte_security_capability_get ⭐

const struct rte_security_capability * rte_security_capability_get (void * instance, struct rte_security_capability_idx * idx)

Query if a specific capability is available on security instance. Vibe check, but for capabilities. πŸ¦‹

Parameters

  • instance β€” security instance.
  • idx β€” security capability index to match against

Returns

  • Returns pointer to security capability on match of capability index criteria. βœ…
  • Return NULL if the capability not matched on security instance. πŸ™ˆ

rte_security_rx_inject_configure πŸš€

__rte_experimental int rte_security_rx_inject_configure (void * ctx, uint16_t port_id, bool enable)
Warning πŸ’€ EXPERIMENTAL: this API may change, or be removed, without prior notice. Not me warning you twice β€” okay fine, once, but loudly.

Configure security device to inject packets to an ethdev port.

Okay so listen: this API must be called only when both the security device and the ethdev is in stopped state. And the security device needs to be configured before any packets are submitted to the rte_security_inb_pkt_rx_inject API. Order matters, bestie. Don't skip steps. 🫢

Parameters

  • ctx β€” Security ctx
  • 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 ethdev port. πŸ’€

See also

rte_security_inb_pkt_rx_inject


rte_security_inb_pkt_rx_inject 🌟

__rte_experimental uint16_t rte_security_inb_pkt_rx_inject (void * ctx, struct rte_mbuf ** pkts, void ** sess, uint16_t nb_pkts)
Warning πŸ’€ EXPERIMENTAL: this API may change, or be removed, without prior notice. She's experimental and she's thriving.

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. In case of ethdev loopback, application would be submitting packets to ethdev Tx queues and would be received as is from ethdev Rx queues. With Rx inject, packets would be received after security processing from ethdev Rx queues. ✨

With inline protocol offload capable ethdevs, Rx injection can be used to handle packets which failed the regular security Rx path. This can be due to cases such as outer fragmentation, in which case applications can reassemble the fragments and then subsequently submit for inbound processing and Rx injection, so that packets are received as regular security processed packets. 🧩

With lookaside protocol offload capable cryptodevs, Rx injection can be used to perform packet parsing after security processing. This would allow for re-classification after security protocol processing is done (ie, inner packet parsing). The ethdev queue on which the packet would be received would be based on rte_flow rules matching the packet after security processing. πŸŒ€

The security device which is injecting packets to ethdev Rx needs to be configured using rte_security_rx_inject_configure with enable flag set to true before any packets are submitted. Say it with me: configure first. 🫢

If hash.fdir.h field is set in mbuf, it would be treated as the value for MARK pattern for the subsequent rte_flow parsing. The packet would appear as if it is received from port field in mbuf.

Since the packet would be received back from ethdev Rx queues, it is expected that application retains/adds L2 header with the mbuf field l2_len reflecting the size of L2 header in the packet. πŸ‘‘

Parameters

  • ctx β€” Security ctx
  • 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 security sessions 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. (So like… if you get fewer back, that's the queues being full, not you being wrong. πŸ’–)

See also

rte_security_rx_inject_configure


πŸ“¦ Variable Documentation πŸ“¦

  • int rte_security_dynfield_offset [extern] β€” Dynamic mbuf field for device-specific metadata. πŸŽ€
  • int rte_security_oop_dynfield_offset [extern] β€” Dynamic mbuf field for pointer to original mbuf for OOP processing session. πŸ¦‹

✍️ Author ✍️

Generated automatically by Doxygen for DPDK from the source code. πŸ€– (Yes, the robots wrote this one, and she ate. πŸ’…)


And that's a wrap on rte_security.h(3), bestie β€” this whole page is from DPDK, Version 25.11.3. Thanks for reading all three parts, you absolute legend. Now go configure your security devices in the right order, protect those SA and SC stats, and slay. πŸ«ΆπŸ’–βœ¨πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from