NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_shared_mirror_sample.c File Reference
#include <string.h>
#include <unistd.h>
#include <rte_byteorder.h>
#include <rte_ethdev.h>
#include <doca_log.h>
#include <doca_flow.h>
#include "flow_common.h"
#include "flow_switch_common.h"
Include dependency graph for flow_shared_mirror_sample.c:

Go to the source code of this file.

Macros

#define SET_L4_PORT(layer, port, value)
 
#define SAMPLE_MIRROR_CONTROL_ENTRY_MAX   2
 
#define SAMPLE_MIRROR_ENTRY_MAX   4
 
#define SAMPLE_ENTRY_TOTAL   (SAMPLE_MIRROR_CONTROL_ENTRY_MAX + SAMPLE_MIRROR_ENTRY_MAX)
 

Functions

 DOCA_LOG_REGISTER (FLOW_SHARED_MIRROR)
 
static doca_error_t create_shared_mirror_pipe (struct doca_flow_port *port, enum doca_flow_l4_type_ext out_l4_type, struct doca_flow_fwd *fwd, bool match_src, uint32_t mirror_id, struct doca_flow_pipe **pipe)
 
static doca_error_t add_shared_mirror_pipe_entry (struct doca_flow_pipe *pipe, enum doca_flow_l4_type_ext out_l4_type, struct doca_flow_fwd *fwd, bool match_src, uint32_t shared_mirror_id, struct entries_status *status)
 
static doca_error_t create_control_pipe (struct doca_flow_port *port, struct doca_flow_pipe **pipe)
 
static doca_error_t add_control_pipe_entries (struct doca_flow_pipe *control_pipe, struct doca_flow_pipe *tcp_pipe, struct doca_flow_pipe *udp_pipe, struct entries_status *status)
 
doca_error_t flow_shared_mirror (int nb_ports, int nb_queues, struct flow_switch_ctx *ctx)
 

Variables

static struct doca_flow_pipe_entry * mirror_entries [SAMPLE_MIRROR_ENTRY_MAX]
 
static uint32_t mirror_idx = 0
 

Macro Definition Documentation

◆ SAMPLE_ENTRY_TOTAL

#define SAMPLE_ENTRY_TOTAL   (SAMPLE_MIRROR_CONTROL_ENTRY_MAX + SAMPLE_MIRROR_ENTRY_MAX)

Definition at line 50 of file flow_shared_mirror_sample.c.

◆ SAMPLE_MIRROR_CONTROL_ENTRY_MAX

#define SAMPLE_MIRROR_CONTROL_ENTRY_MAX   2

Definition at line 48 of file flow_shared_mirror_sample.c.

◆ SAMPLE_MIRROR_ENTRY_MAX

#define SAMPLE_MIRROR_ENTRY_MAX   4

Definition at line 49 of file flow_shared_mirror_sample.c.

◆ SET_L4_PORT

#define SET_L4_PORT (   layer,
  port,
  value 
)
Value:
do { \
if (match.layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_TCP) \
match.layer.tcp.l4_port.port = (value); \
else if (match.layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_UDP) \
match.layer.udp.l4_port.port = (value); \
} while (0)
@ DOCA_FLOW_L4_TYPE_EXT_TCP
@ DOCA_FLOW_L4_TYPE_EXT_UDP
type value

Definition at line 40 of file flow_shared_mirror_sample.c.

Function Documentation

◆ add_control_pipe_entries()

static doca_error_t add_control_pipe_entries ( struct doca_flow_pipe *  control_pipe,
struct doca_flow_pipe *  tcp_pipe,
struct doca_flow_pipe *  udp_pipe,
struct entries_status status 
)
static

Definition at line 226 of file flow_shared_mirror_sample.c.

◆ add_shared_mirror_pipe_entry()

static doca_error_t add_shared_mirror_pipe_entry ( struct doca_flow_pipe *  pipe,
enum doca_flow_l4_type_ext  out_l4_type,
struct doca_flow_fwd fwd,
bool  match_src,
uint32_t  shared_mirror_id,
struct entries_status status 
)
static

Definition at line 142 of file flow_shared_mirror_sample.c.

◆ create_control_pipe()

static doca_error_t create_control_pipe ( struct doca_flow_port *  port,
struct doca_flow_pipe **  pipe 
)
static

Definition at line 193 of file flow_shared_mirror_sample.c.

◆ create_shared_mirror_pipe()

static doca_error_t create_shared_mirror_pipe ( struct doca_flow_port *  port,
enum doca_flow_l4_type_ext  out_l4_type,
struct doca_flow_fwd fwd,
bool  match_src,
uint32_t  mirror_id,
struct doca_flow_pipe **  pipe 
)
static

Definition at line 66 of file flow_shared_mirror_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( FLOW_SHARED_MIRROR  )

◆ flow_shared_mirror()

doca_error_t flow_shared_mirror ( int  nb_ports,
int  nb_queues,
struct flow_switch_ctx ctx 
)

Definition at line 281 of file flow_shared_mirror_sample.c.

Variable Documentation

◆ mirror_entries

struct doca_flow_pipe_entry* mirror_entries[SAMPLE_MIRROR_ENTRY_MAX]
static

Definition at line 52 of file flow_shared_mirror_sample.c.

◆ mirror_idx

uint32_t mirror_idx = 0
static

Definition at line 53 of file flow_shared_mirror_sample.c.