32 #include "flow_common.h"
39 #define MAX_ENTRIES 80
45 static struct doca_flow_port *
ports[3];
62 DOCA_LOG_INFO(
"Pipe user context %p: entries increased to %u", pipe_user_ctx, nr_entries);
79 void **new_entry_user_ctx)
83 DOCA_LOG_INFO(
"Pipe %p entry context %p (%u) relocated on queue %u",
108 struct doca_flow_pipe **pipe)
110 struct doca_flow_pipe_cfg *pipe_cfg;
120 memset(&match, 0,
sizeof(match));
123 memset(&
fwd, 0,
sizeof(
fwd));
158 DOCA_LOG_ERR(
"Failed to set doca_flow_pipe_cfg congestion_level_threshold: %s",
176 DOCA_LOG_ERR(
"Failed to set doca_flow_pipe_cfg queue (%u) exclusion: %s",
257 memset(&match, 0,
sizeof(match));
259 memset(&
fwd, 0,
sizeof(
fwd));
315 DOCA_LOG_INFO(
"Pipe %p successfully called resize operation", pipe);
317 DOCA_LOG_WARN(
"Pipe %p call to resize failed. rc=%d", pipe, rc);
332 DOCA_LOG_ERR(
"Failed to process entries on queue id %u: %s",
351 if (
entry_ctx[i].entry_status.nb_processed != 0)
402 op_str =
"CONGESTION_REACHED";
410 op_str =
"DESTROYED";
418 DOCA_LOG_INFO(
"Pipe %p received a %s operation callback. Errors encountered", pipe, op_str);
420 DOCA_LOG_INFO(
"Pipe %p successfully received a %s operation callback", pipe, op_str);
438 struct doca_flow_pipe *resizable_pipe;
455 memset(dev_arr, 0,
sizeof(
struct doca_dev *) *
nb_ports);
456 dev_arr[0] =
ctx->doca_dev[0];
static 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)
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 int congestion_reached_flag
static doca_error_t create_resizable_pipe(struct doca_flow_port *port, bool is_basic_pipe, uint16_t nb_queues, struct doca_flow_pipe **pipe)
static struct entry_ctx entry_ctx[MAX_ENTRIES]
static bool congestion_notified
static void pipe_process_cb(struct doca_flow_pipe *pipe, enum doca_flow_pipe_status status, enum doca_flow_pipe_op op, void *user_ctx)
static doca_error_t pipe_resize_sample_entry_relocate_cb(void *pipe_user_ctx, uint16_t pipe_queue, void *entry_user_ctx, void **new_entry_user_ctx)
static doca_flow_pipe_resize_nr_entries_changed_cb nr_entries_changed_cb
static doca_flow_pipe_resize_entry_relocate_cb entry_relocation_cb
static struct doca_flow_port * ports[3]
doca_error_t flow_pipe_resize(uint16_t nb_queues, struct flow_switch_ctx *ctx, bool is_basic_pipe)
static doca_error_t add_resizable_pipe_entries(struct doca_flow_pipe *pipe, int port_id, uint16_t nb_queues, bool is_basic_pipe)
DOCA_LOG_REGISTER(FLOW_PIPE_RESIZE)
static doca_error_t pipe_resize_sample_nr_entries_changed_cb(void *pipe_user_ctx, uint32_t nr_entries)
static bool resize_cb_received
static void remove_resizable_pipe_entries(void)
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
#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_TCP
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_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_error_t(* doca_flow_pipe_resize_entry_relocate_cb)(void *pipe_user_ctx, uint16_t pipe_queue, void *entry_user_ctx, void **new_entry_user_ctx)
doca flow pipe entry relocation callback.
doca_flow_pipe_op
doca flow pipe operation
DOCA_STABLE doca_error_t doca_flow_pipe_resize(struct doca_flow_pipe *pipe, uint8_t new_congestion_level, doca_flow_pipe_resize_nr_entries_changed_cb nr_entries_changed_cb, doca_flow_pipe_resize_entry_relocate_cb entry_relocation_cb)
Resize 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 doca_error_t doca_flow_pipe_cfg_set_user_ctx(struct doca_flow_pipe_cfg *cfg, void *user_ctx)
Set pipe's user context.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_congestion_level_threshold(struct doca_flow_pipe_cfg *cfg, uint8_t congestion_level_threshold)
Set pipe's congestion level threshold.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_is_resizable(struct doca_flow_pipe_cfg *cfg, bool is_resizable)
Set if the pipe supports the resize operation.
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_flow_pipe_status
doca flow pipe status
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_error_t(* doca_flow_pipe_resize_nr_entries_changed_cb)(void *pipe_user_ctx, uint32_t nr_entries)
doca flow pipe resize number of entries changed callback.
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_nr_entries(struct doca_flow_pipe_cfg *cfg, uint32_t nr_entries)
Set pipe's maximum number of flow rules.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_excluded_queue(struct doca_flow_pipe_cfg *cfg, uint16_t pipe_queue)
Set pipe_queue as excluded in the pipe.
@ DOCA_FLOW_PIPE_OP_DESTROYED
@ DOCA_FLOW_PIPE_OP_CONGESTION_REACHED
@ DOCA_FLOW_PIPE_OP_RESIZED
@ DOCA_FLOW_PIPE_STATUS_SUCCESS
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_WARN(format,...)
Generates a WARNING application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
uint16_t doca_be16_t
Declare DOCA endianity types.
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)
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)
#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 * pipe
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_header_format outer
doca monitor action configuration
user context struct that will be used in entries process callback
struct entries_status entry_status
static uint32_t actions_mem_size[FLOW_SWITCH_PORTS_MAX]
struct upf_accel_ctx * ctx