26 #include <rte_ethdev.h>
34 #include "flow_common.h"
38 #define MAX_PORT_STR_LEN 128
39 #define DEFAULT_TIMEOUT_US (10000)
61 uint64_t fw_miss_pipe_id)
65 struct doca_flow_pipe *pipe;
67 uint16_t switch_mode_port_id = 0;
75 DOCA_LOG_ERR(
"Failed to find relevant fwd pipe id=%" PRIu64, fw_pipe_id);
83 DOCA_LOG_ERR(
"Failed to find relevant fwd_miss pipe id=%" PRIu64, fw_miss_pipe_id);
100 DOCA_LOG_INFO(
"Pipe created successfully with id: %" PRIu64, pipe_id);
126 struct doca_flow_pipe *pipe;
127 struct doca_flow_pipe_entry *
entry;
131 int num_of_entries = 1;
132 uint32_t hws_flag = flags;
139 DOCA_LOG_ERR(
"Failed to find relevant fwd pipe with id %" PRIu64, fw_pipe_id);
146 DOCA_LOG_ERR(
"Failed to find pipe with id %" PRIu64
" to add entry into", pipe_id);
151 DOCA_LOG_DBG(
"Batch insertion of pipe entries is not supported");
178 DOCA_LOG_INFO(
"Entry created successfully with id: %" PRIu64, entry_id);
202 struct doca_flow_pipe *pipe;
203 struct doca_flow_pipe_entry *
entry;
212 DOCA_LOG_ERR(
"Failed to find relevant fwd pipe id=%" PRIu64, fw_pipe_id);
219 DOCA_LOG_ERR(
"Failed to find relevant pipe id=%" PRIu64
" to add entry into", pipe_id);
242 DOCA_LOG_ERR(
"Flow Pipes Manager failed to add control pipe entry");
247 DOCA_LOG_INFO(
"Control pipe entry created successfully with id: %" PRIu64, entry_id);
257 struct doca_flow_pipe *pipe;
262 DOCA_LOG_ERR(
"Failed to find pipe id %" PRIu64
" to destroy", pipe_id);
277 static void pipe_rm_entry(uint16_t pipe_queue, uint64_t entry_id, uint32_t flags)
281 struct doca_flow_pipe_entry *
entry;
283 uint32_t hws_flag = flags;
288 DOCA_LOG_ERR(
"Failed to find entry id %" PRIu64
" to remove", entry_id);
293 DOCA_LOG_DBG(
"Batch insertion of pipe entries is not supported");
311 uint16_t switch_mode_port_id = 0;
315 if (port_id != switch_mode_port_id) {
332 struct doca_flow_pipe_entry *
entry;
338 DOCA_LOG_ERR(
"Failed to find entry id %" PRIu64
" to query on", entry_id);
355 uint16_t switch_mode_port_id = 0;
359 if (port_id != switch_mode_port_id) {
386 int nr_switch_manager_ports = 1;
387 int nr_entries = 10000;
388 const char *start_str;
394 if (
ctx->nb_ports != nr_switch_manager_ports) {
395 DOCA_LOG_ERR(
"Switch is allowed to run with one PF only");
402 start_str =
"switch,isolated,hws,expert";
404 start_str =
"switch,isolated,hws";
struct doca_flow_port * init_doca_flow(uint16_t port_id, uint8_t rxq_num)
static struct eth_l2_fwd_stats stats
static struct doca_flow_fwd fwd_miss
void set_pipe_control_add_entry(void(*action)(uint16_t, uint8_t, uint64_t, struct doca_flow_match *, struct doca_flow_match *, struct doca_flow_fwd *, uint64_t))
void set_pipe_destroy(void(*action)(uint64_t))
void set_query(void(*action)(uint64_t, struct doca_flow_resource_query *))
void set_pipe_add_entry(void(*action)(uint16_t, uint64_t, struct doca_flow_match *, struct doca_flow_actions *, struct doca_flow_monitor *, struct doca_flow_fwd *, uint64_t, uint32_t))
static struct doca_flow_actions actions
void set_port_pipes_flush(void(*action)(uint16_t))
void set_pipe_rm_entry(void(*action)(uint16_t, uint64_t, uint32_t))
void set_port_pipes_dump(void(*action)(uint16_t, FILE *))
void set_pipe_create(void(*action)(struct doca_flow_pipe_cfg *, uint16_t, struct doca_flow_fwd *, uint64_t, struct doca_flow_fwd *, uint64_t))
static struct doca_flow_monitor monitor
static struct doca_flow_fwd fwd
static struct doca_flow_match match_mask
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
doca_error_t pipes_manager_pipe_add_entry(struct flow_pipes_manager *manager, struct doca_flow_pipe_entry *entry, uint64_t pipe_id, uint64_t *entry_id)
doca_error_t pipes_manager_pipe_destroy(struct flow_pipes_manager *manager, uint64_t pipe_id)
doca_error_t pipes_manager_get_pipe(struct flow_pipes_manager *manager, uint64_t pipe_id, struct doca_flow_pipe **pipe)
doca_error_t create_pipes_manager(struct flow_pipes_manager **pipes_manager)
void destroy_pipes_manager(struct flow_pipes_manager *manager)
doca_error_t pipes_manager_pipe_create(struct flow_pipes_manager *manager, struct doca_flow_pipe *pipe, uint16_t port_id, uint64_t *pipe_id)
doca_error_t pipes_manager_get_entry(struct flow_pipes_manager *manager, uint64_t entry_id, struct doca_flow_pipe_entry **entry)
doca_error_t pipes_manager_pipe_rm_entry(struct flow_pipes_manager *manager, uint64_t entry_id)
doca_error_t pipes_manager_pipes_flush(struct flow_pipes_manager *manager, uint16_t port_id)
#define FLOW_SWITCH_PORTS_MAX
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_ERROR_INVALID_VALUE
@ DOCA_ERROR_INITIALIZATION
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_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_STABLE void doca_flow_port_pipes_flush(struct doca_flow_port *port)
Flush pipes of one port.
DOCA_STABLE void doca_flow_pipe_destroy(struct doca_flow_pipe *pipe)
Destroy one pipe.
DOCA_EXPERIMENTAL void doca_flow_port_pipes_dump(struct doca_flow_port *port, FILE *f)
Dump pipes of one port.
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 doca_error_t doca_flow_pipe_remove_entry(uint16_t pipe_queue, uint32_t flags, struct doca_flow_pipe_entry *entry)
Free one pipe entry.
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
DOCA_STABLE struct doca_flow_port * doca_flow_port_switch_get(const struct doca_flow_port *port)
Get doca flow switch port.
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.
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
#define DOCA_LOG_DBG(format,...)
Generates a DEBUG application log message.
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[])
#define SHARED_RESOURCE_NUM_VALUES
#define ACTIONS_MEM_SIZE(nr_queues, entries)
#define ARRAY_INIT(array, val)
struct application_port_config port_config
doca flow actions information
struct doca_flow_pipe * next_pipe
enum doca_flow_fwd_type type
doca flow matcher information
doca monitor action configuration
user context struct that will be used in entries process callback
static void pipe_rm_entry(uint16_t pipe_queue, uint64_t entry_id, uint32_t flags)
static struct flow_pipes_manager * pipes_manager
static void pipe_add_entry(uint16_t pipe_queue, uint64_t pipe_id, struct doca_flow_match *match, struct doca_flow_actions *actions, struct doca_flow_monitor *monitor, struct doca_flow_fwd *fwd, uint64_t fw_pipe_id, uint32_t flags)
static void flow_query(uint64_t entry_id, struct doca_flow_resource_query *stats)
doca_error_t switch_init(struct application_dpdk_config *app_dpdk_config, struct flow_switch_ctx *ctx)
static uint32_t actions_mem_size[FLOW_SWITCH_PORTS_MAX]
static void pipe_control_add_entry(uint16_t pipe_queue, uint8_t priority, uint64_t pipe_id, struct doca_flow_match *match, struct doca_flow_match *match_mask, struct doca_flow_fwd *fwd, uint64_t fw_pipe_id)
static void port_pipes_flush(uint16_t port_id)
static void pipe_create(struct doca_flow_pipe_cfg *cfg, uint16_t port_id, struct doca_flow_fwd *fwd, uint64_t fw_pipe_id, struct doca_flow_fwd *fwd_miss, uint64_t fw_miss_pipe_id)
#define DEFAULT_TIMEOUT_US
void switch_destroy(void)
static struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]
static void pipe_destroy(uint64_t pipe_id)
DOCA_LOG_REGISTER(SWITCH::Core)
static void register_actions_on_flow_parser(void)
static void port_pipes_dump(uint16_t port_id, FILE *fd)
struct upf_accel_ctx * ctx