NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_common.h File Reference
#include <rte_byteorder.h>
#include <rte_common.h>
#include <doca_flow.h>
#include <doca_dev.h>
Include dependency graph for flow_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  entries_status
 user context struct that will be used in entries process callback More...
 
struct  flow_resources
 

Macros

#define BE_IPV4_ADDR(a, b, c, d)   (RTE_BE32(((uint32_t)a << 24) + (b << 16) + (c << 8) + d)) /* create IPV4 address */
 
#define SET_IPV6_ADDR(addr, a, b, c, d)
 
#define SET_MAC_ADDR(addr, a, b, c, d, e, f)
 
#define BUILD_VNI(uint24_vni)   (RTE_BE32((uint32_t)uint24_vni << 8)) /* create VNI */
 
#define DEFAULT_TIMEOUT_US   (10000) /* default timeout for processing entries */
 
#define NB_ACTIONS_ARR   (1) /* default length for action array */
 
#define SHARED_RESOURCE_NUM_VALUES   (8) /* Number of doca_flow_shared_resource_type values */
 
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define MIN_ACTIONS_MEM_SIZE_PER_QUEUE   (256) /* Minimal actions memory size required per queue */
 
#define INITIAL_ACTIONS_MEM_SIZE   (2048) /* Needed when app creates a small number of entries */
 
#define ACTIONS_MEM_SIZE(nr_queues, entries)
 
#define ARRAY_DIM(a)   (sizeof(a) / sizeof((a)[0]))
 
#define ARRAY_INIT(array, val)
 
#define DEFS_REG_OPCODE(opcode_str, ___sname, ___field)
 

Functions

doca_error_t init_doca_flow (int nb_queues, const char *mode, struct flow_resources *resource, uint32_t nr_shared_resources[])
 
doca_error_t init_doca_flow_with_defs (int nb_queues, const char *mode, struct flow_resources *resource, uint32_t nr_shared_resources[], struct doca_flow_definitions *defs)
 
doca_error_t init_doca_flow_cb (int nb_queues, const char *mode, struct flow_resources *resource, uint32_t nr_shared_resources[], doca_flow_entry_process_cb cb, doca_flow_pipe_process_cb pipe_process_cb, struct doca_flow_definitions *defs)
 
doca_error_t init_doca_flow_ports (int nb_ports, struct doca_flow_port *ports[], bool is_hairpin, struct doca_dev *dev_arr[], uint32_t actions_mem_size[])
 
doca_error_t init_doca_flow_ports_with_op_state (int nb_ports, struct doca_flow_port *ports[], bool is_hairpin, struct doca_dev *dev_arr[], enum doca_flow_port_operation_state *states, uint32_t actions_mem_size[])
 
doca_error_t stop_doca_flow_ports (int nb_ports, struct doca_flow_port *ports[])
 
void check_for_valid_entry (struct doca_flow_pipe_entry *entry, uint16_t pipe_queue, enum doca_flow_entry_status status, enum doca_flow_entry_op op, void *user_ctx)
 
doca_error_t set_flow_pipe_cfg (struct doca_flow_pipe_cfg *cfg, const char *name, enum doca_flow_pipe_type type, bool is_root)
 
doca_error_t flow_process_entries (struct doca_flow_port *port, struct entries_status *status, uint32_t nr_entries)
 

Macro Definition Documentation

◆ ACTIONS_MEM_SIZE

#define ACTIONS_MEM_SIZE (   nr_queues,
  entries 
)
Value:
rte_align32pow2( \
(uint32_t)(nr_queues * MIN_ACTIONS_MEM_SIZE_PER_QUEUE + INITIAL_ACTIONS_MEM_SIZE))) /* Total \
actions \
memory size \
*/
static struct doca_flow_pipe_entry * entries[NB_ENTRIES]
#define DOCA_FLOW_MAX_ENTRY_ACTIONS_MEM_SIZE
meter mark color
Definition: doca_flow.h:264
#define MIN_ACTIONS_MEM_SIZE_PER_QUEUE
Definition: flow_common.h:64
#define INITIAL_ACTIONS_MEM_SIZE
Definition: flow_common.h:65
#define MAX(a, b)
Definition: flow_common.h:62

Definition at line 66 of file flow_common.h.

◆ ARRAY_DIM

#define ARRAY_DIM (   a)    (sizeof(a) / sizeof((a)[0]))

Definition at line 70 of file flow_common.h.

◆ ARRAY_INIT

#define ARRAY_INIT (   array,
  val 
)
Value:
do { \
for (size_t i = 0; i < ARRAY_DIM(array); i++) { \
array[i] = val; \
} \
} while (0)
#define ARRAY_DIM(a)
Definition: flow_common.h:70

Definition at line 71 of file flow_common.h.

◆ BE_IPV4_ADDR

#define BE_IPV4_ADDR (   a,
  b,
  c,
 
)    (RTE_BE32(((uint32_t)a << 24) + (b << 16) + (c << 8) + d)) /* create IPV4 address */

Definition at line 39 of file flow_common.h.

◆ BUILD_VNI

#define BUILD_VNI (   uint24_vni)    (RTE_BE32((uint32_t)uint24_vni << 8)) /* create VNI */

Definition at line 56 of file flow_common.h.

◆ DEFAULT_TIMEOUT_US

#define DEFAULT_TIMEOUT_US   (10000) /* default timeout for processing entries */

Definition at line 57 of file flow_common.h.

◆ DEFS_REG_OPCODE

#define DEFS_REG_OPCODE (   opcode_str,
  ___sname,
  ___field 
)
Value:
do { \
int rc; \
int __off = offsetof(struct ___sname, ___field); \
int __sz = sizeof(((struct ___sname *)0)->___field); \
\
rc = doca_flow_definitions_add_field(defs, opcode_str, __off, __sz); \
if (rc < 0) \
return rc; \
} while (0)
#define offsetof(t, d)
DOCA_EXPERIMENTAL doca_error_t doca_flow_definitions_add_field(struct doca_flow_definitions *defs, const char *field_opcode_str, uint32_t field_offset, uint32_t field_length)
Add a field to the definitions object.

Definition at line 77 of file flow_common.h.

◆ INITIAL_ACTIONS_MEM_SIZE

#define INITIAL_ACTIONS_MEM_SIZE   (2048) /* Needed when app creates a small number of entries */

Definition at line 65 of file flow_common.h.

◆ MAX

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 62 of file flow_common.h.

◆ MIN_ACTIONS_MEM_SIZE_PER_QUEUE

#define MIN_ACTIONS_MEM_SIZE_PER_QUEUE   (256) /* Minimal actions memory size required per queue */

Definition at line 64 of file flow_common.h.

◆ NB_ACTIONS_ARR

#define NB_ACTIONS_ARR   (1) /* default length for action array */

Definition at line 58 of file flow_common.h.

◆ SET_IPV6_ADDR

#define SET_IPV6_ADDR (   addr,
  a,
  b,
  c,
 
)
Value:
do { \
addr[0] = a & 0xffffffff; \
addr[1] = b & 0xffffffff; \
addr[2] = c & 0xffffffff; \
addr[3] = d & 0xffffffff; \
} while (0) /* create IPv6 address */

Definition at line 40 of file flow_common.h.

◆ SET_MAC_ADDR

#define SET_MAC_ADDR (   addr,
  a,
  b,
  c,
  d,
  e,
 
)
Value:
do { \
addr[0] = a & 0xff; \
addr[1] = b & 0xff; \
addr[2] = c & 0xff; \
addr[3] = d & 0xff; \
addr[4] = e & 0xff; \
addr[5] = f & 0xff; \
} while (0) /* create source mac address */

Definition at line 47 of file flow_common.h.

◆ SHARED_RESOURCE_NUM_VALUES

#define SHARED_RESOURCE_NUM_VALUES   (8) /* Number of doca_flow_shared_resource_type values */

Definition at line 59 of file flow_common.h.

Function Documentation

◆ check_for_valid_entry()

void check_for_valid_entry ( struct doca_flow_pipe_entry *  entry,
uint16_t  pipe_queue,
enum doca_flow_entry_status  status,
enum doca_flow_entry_op  op,
void *  user_ctx 
)

Definition at line 44 of file flow_common.c.

◆ flow_process_entries()

doca_error_t flow_process_entries ( struct doca_flow_port *  port,
struct entries_status status,
uint32_t  nr_entries 
)

Definition at line 338 of file flow_common.c.

◆ init_doca_flow()

doca_error_t init_doca_flow ( int  nb_queues,
const char *  mode,
struct flow_resources resource,
uint32_t  nr_shared_resources[] 
)

Definition at line 62 of file flow_common.c.

◆ init_doca_flow_cb()

doca_error_t init_doca_flow_cb ( int  nb_queues,
const char *  mode,
struct flow_resources resource,
uint32_t  nr_shared_resources[],
doca_flow_entry_process_cb  cb,
doca_flow_pipe_process_cb  pipe_process_cb,
struct doca_flow_definitions *  defs 
)

Definition at line 79 of file flow_common.c.

◆ init_doca_flow_ports()

doca_error_t init_doca_flow_ports ( int  nb_ports,
struct doca_flow_port *  ports[],
bool  is_hairpin,
struct doca_dev *  dev_arr[],
uint32_t  actions_mem_size[] 
)

Definition at line 296 of file flow_common.c.

◆ init_doca_flow_ports_with_op_state()

doca_error_t init_doca_flow_ports_with_op_state ( int  nb_ports,
struct doca_flow_port *  ports[],
bool  is_hairpin,
struct doca_dev *  dev_arr[],
enum doca_flow_port_operation_state states,
uint32_t  actions_mem_size[] 
)

Definition at line 260 of file flow_common.c.

◆ init_doca_flow_with_defs()

doca_error_t init_doca_flow_with_defs ( int  nb_queues,
const char *  mode,
struct flow_resources resource,
uint32_t  nr_shared_resources[],
struct doca_flow_definitions *  defs 
)

Definition at line 70 of file flow_common.c.

◆ set_flow_pipe_cfg()

doca_error_t set_flow_pipe_cfg ( struct doca_flow_pipe_cfg *  cfg,
const char *  name,
enum doca_flow_pipe_type  type,
bool  is_root 
)

Definition at line 305 of file flow_common.c.

◆ stop_doca_flow_ports()

doca_error_t stop_doca_flow_ports ( int  nb_ports,
struct doca_flow_port *  ports[] 
)

Definition at line 240 of file flow_common.c.