29 #include <rte_byteorder.h>
30 #include <rte_ethdev.h>
34 #include "flow_common.h"
40 #define SET_L4_PORT(layer, port, value) \
42 if (match.layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_TCP) \
43 match.layer.tcp.l4_port.port = (value); \
44 else if (match.layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_UDP) \
45 match.layer.udp.l4_port.port = (value); \
48 #define SAMPLE_MIRROR_CONTROL_ENTRY_MAX 2
49 #define SAMPLE_MIRROR_ENTRY_MAX 4
50 #define SAMPLE_ENTRY_TOTAL (SAMPLE_MIRROR_CONTROL_ENTRY_MAX + SAMPLE_MIRROR_ENTRY_MAX)
71 struct doca_flow_pipe **pipe)
76 struct doca_flow_pipe_cfg *pipe_cfg;
79 memset(&match, 0,
sizeof(match));
146 uint32_t shared_mirror_id,
152 struct doca_flow_pipe_entry *
entry;
161 memset(&match, 0,
sizeof(match));
195 struct doca_flow_pipe_cfg *pipe_cfg;
227 struct doca_flow_pipe *tcp_pipe,
228 struct doca_flow_pipe *udp_pipe,
241 uint8_t priority = 0;
288 struct doca_flow_pipe *tcp_pipe, *udp_pipe, *pipe;
289 uint32_t shared_mirror_ids[] = {1, 2};
309 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
310 dev_arr[0] =
ctx->doca_dev[0];
322 mirror_cfg.
target = ⌖
323 cfg.mirror_cfg = mirror_cfg;
325 memset(&status, 0,
sizeof(status));
339 cfg.mirror_cfg.fwd.port_id = 0;
362 shared_mirror_ids[1],
392 shared_mirror_ids[1],
402 memset(&
fwd, 0,
sizeof(
fwd));
411 shared_mirror_ids[0],
442 shared_mirror_ids[0],
struct doca_flow_port * init_doca_flow(uint16_t port_id, uint8_t rxq_num)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static struct doca_flow_actions actions
#define BE_IPV4_ADDR(a, b, c, d)
static struct doca_flow_monitor monitor
static struct doca_flow_fwd fwd
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
static struct doca_flow_pipe_entry * mirror_entries[SAMPLE_MIRROR_ENTRY_MAX]
static doca_error_t create_control_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe)
doca_error_t flow_shared_mirror(int nb_ports, int nb_queues, struct flow_switch_ctx *ctx)
static uint32_t mirror_idx
#define SAMPLE_ENTRY_TOTAL
#define SAMPLE_MIRROR_ENTRY_MAX
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)
#define SET_L4_PORT(layer, port, value)
#define SAMPLE_MIRROR_CONTROL_ENTRY_MAX
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_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)
DOCA_LOG_REGISTER(FLOW_SHARED_MIRROR)
#define DEFAULT_TIMEOUT_US
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
doca_flow_l4_type_ext
doca flow layer 4 packet extend type
@ DOCA_FLOW_L4_TYPE_EXT_TCP
@ DOCA_FLOW_L4_TYPE_EXT_UDP
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_destroy(struct doca_flow_pipe_cfg *cfg)
Destroy DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_create(struct doca_flow_pipe_cfg **cfg, struct doca_flow_port *port)
Create DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_entries_process(struct doca_flow_port *port, uint16_t pipe_queue, uint64_t timeout, uint32_t max_processed_entries)
Process entries in queue.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_match(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_match *match, const struct doca_flow_match *match_mask)
Set pipe's match and match mask.
DOCA_STABLE doca_error_t doca_flow_shared_resources_bind(enum doca_flow_shared_resource_type type, uint32_t *res_array, uint32_t res_array_len, void *bindable_obj)
Binds a bulk of shared resources to a bindable object.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_control_add_entry(uint16_t pipe_queue, uint32_t priority, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_match *match_mask, const struct doca_flow_match_condition *condition, const struct doca_flow_actions *actions, const struct doca_flow_actions *actions_mask, const struct doca_flow_action_descs *action_descs, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a control pipe.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_create(const struct doca_flow_pipe_cfg *cfg, const struct doca_flow_fwd *fwd, const struct doca_flow_fwd *fwd_miss, struct doca_flow_pipe **pipe)
Create one new pipe.
DOCA_EXPERIMENTAL doca_error_t doca_flow_shared_resource_set_cfg(enum doca_flow_shared_resource_type type, uint32_t id, struct doca_flow_shared_resource_cfg *cfg)
Configure a single shared resource.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_actions(struct doca_flow_pipe_cfg *cfg, struct doca_flow_actions *const *actions, struct doca_flow_actions *const *actions_masks, struct doca_flow_action_descs *const *action_descs, size_t nr_actions)
Set pipe's actions, actions mask and actions descriptor.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_monitor(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_monitor *monitor)
Set pipe's monitor.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_actions *actions, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, uint32_t flags, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a pipe.
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
doca_flow_l4_meta
doca flow l4 valid type for parser meta
DOCA_EXPERIMENTAL doca_error_t doca_flow_resource_query_entry(struct doca_flow_pipe_entry *entry, struct doca_flow_resource_query *query_stats)
Extract information about specific entry.
@ DOCA_FLOW_SHARED_RESOURCE_MIRROR
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
uint16_t doca_be16_t
Declare DOCA endianity types.
const struct ip_frag_config * cfg
doca_error_t stop_doca_flow_ports(int nb_ports, struct doca_flow_port *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[])
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)
#define SHARED_RESOURCE_NUM_VALUES
#define ACTIONS_MEM_SIZE(nr_queues, entries)
#define ARRAY_INIT(array, val)
doca flow actions information
struct doca_flow_pipe * next_pipe
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
doca monitor action configuration
uint32_t shared_mirror_id
enum doca_flow_resource_type counter_type
doca flow mirror resource configuration
struct doca_flow_mirror_target * target
struct doca_flow_resource_query::@115::@117 counter
doca flow shared resource configuration
user context struct that will be used in entries process callback
static uint32_t actions_mem_size[FLOW_SWITCH_PORTS_MAX]
static struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]
struct upf_accel_ctx * ctx