27 #include <rte_byteorder.h>
55 if (entry_status ==
NULL)
65 uint32_t nr_shared_resources[])
73 uint32_t nr_shared_resources[],
74 struct doca_flow_definitions *defs)
82 uint32_t nr_shared_resources[],
85 struct doca_flow_definitions *defs)
87 struct doca_flow_cfg *flow_cfg;
99 for (qidx = 0; qidx < nb_queues; qidx++)
134 DOCA_LOG_ERR(
"Failed to set doca_flow_cfg doca_flow_entry_process_cb: %s",
148 DOCA_LOG_ERR(
"Failed to set doca_flow_cfg nr_shared_resources: %s",
186 struct doca_dev *dev,
188 struct doca_flow_port **port,
191 struct doca_flow_port_cfg *port_cfg;
203 goto destroy_port_cfg;
209 goto destroy_port_cfg;
215 goto destroy_port_cfg;
221 goto destroy_port_cfg;
227 goto destroy_port_cfg;
249 for (portid =
nb_ports - 1; portid >= 0; portid--) {
261 struct doca_flow_port *
ports[],
263 struct doca_dev *dev_arr[],
271 for (portid = 0; portid <
nb_ports; portid++) {
283 if (!is_hairpin || !portid || !(portid % 2))
288 DOCA_LOG_ERR(
"Failed to pair ports %u - %u", portid, portid ^ 1);
297 struct doca_flow_port *
ports[],
299 struct doca_dev *dev_arr[],
313 DOCA_LOG_ERR(
"Failed to set DOCA Flow pipe configurations, cfg=NULL");
354 DOCA_LOG_ERR(
"Failed to process %u entries, status is failure", nr_entries);
DOCA_LOG_REGISTER(IPSEC_SECURITY_GW::flow_common)
static uint16_t * rss_queues
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 struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
#define DEFAULT_TIMEOUT_US
#define DOCA_ERROR_PROPAGATE(r, t)
Save the first encountered doca_error_t.
enum doca_error doca_error_t
DOCA API return codes.
doca_error
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_flow_port_operation_state
Defines the operation states for a port instance.
DOCA_STABLE doca_error_t doca_flow_cfg_set_mode_args(struct doca_flow_cfg *cfg, const char *mode_args)
Set DOCA mode args.
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_STABLE doca_error_t doca_flow_pipe_cfg_set_name(struct doca_flow_pipe_cfg *cfg, const char *name)
Set pipe's name.
DOCA_EXPERIMENTAL doca_error_t doca_flow_port_pair(struct doca_flow_port *port, struct doca_flow_port *pair_port)
pair two doca flow ports.
DOCA_STABLE doca_error_t doca_flow_cfg_set_nr_meters(struct doca_flow_cfg *cfg, uint32_t nr_meters)
Set number of traffic meters to configure.
DOCA_EXPERIMENTAL doca_error_t doca_flow_port_start(const struct doca_flow_port_cfg *cfg, struct doca_flow_port **port)
Start a doca port.
doca_flow_entry_op
doca flow entry operation
DOCA_STABLE doca_error_t doca_flow_cfg_set_cb_entry_process(struct doca_flow_cfg *cfg, doca_flow_entry_process_cb cb)
Set callback for entry create/destroy.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_is_root(struct doca_flow_pipe_cfg *cfg, bool is_root)
Set if pipe is root or not.
DOCA_STABLE doca_error_t doca_flow_cfg_create(struct doca_flow_cfg **cfg)
Create DOCA Flow configuration struct.
doca_flow_pipe_type
doca flow pipe type
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_type(struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_type type)
Set pipe's type.
DOCA_EXPERIMENTAL doca_error_t doca_flow_init(struct doca_flow_cfg *cfg)
Initialize the doca flow.
DOCA_EXPERIMENTAL doca_error_t doca_flow_port_cfg_set_dev(struct doca_flow_port_cfg *cfg, struct doca_dev *dev)
Set port's device.
DOCA_STABLE doca_error_t doca_flow_cfg_set_nr_counters(struct doca_flow_cfg *cfg, uint32_t nr_counters)
Set number of counters to configure.
DOCA_STABLE doca_error_t doca_flow_cfg_set_cb_pipe_process(struct doca_flow_cfg *cfg, doca_flow_pipe_process_cb cb)
Set callback for pipe process completion.
DOCA_EXPERIMENTAL doca_error_t doca_flow_port_cfg_set_actions_mem_size(struct doca_flow_port_cfg *cfg, uint32_t size)
Set max memory size used by actions.
void(* doca_flow_pipe_process_cb)(struct doca_flow_pipe *pipe, enum doca_flow_pipe_status status, enum doca_flow_pipe_op op, void *user_ctx)
doca flow pipe process callback
DOCA_STABLE doca_error_t doca_flow_cfg_set_nr_shared_resource(struct doca_flow_cfg *cfg, uint32_t nr_shared_resource, enum doca_flow_shared_resource_type type)
Set number of shared resource.
DOCA_STABLE doca_error_t doca_flow_port_stop(struct doca_flow_port *port)
Stop a doca port.
DOCA_EXPERIMENTAL doca_error_t doca_flow_cfg_set_definitions(struct doca_flow_cfg *cfg, const struct doca_flow_definitions *defs)
Set the definition object.
doca_flow_entry_status
doca flow entry status
DOCA_EXPERIMENTAL doca_error_t doca_flow_port_cfg_set_port_id(struct doca_flow_port_cfg *cfg, uint16_t port_id)
Set the logical port ID.
DOCA_EXPERIMENTAL doca_error_t doca_flow_cfg_set_default_rss(struct doca_flow_cfg *cfg, const struct doca_flow_resource_rss_cfg *rss)
Set RSS global configuration.
DOCA_STABLE doca_error_t doca_flow_port_cfg_create(struct doca_flow_port_cfg **cfg)
Create DOCA Flow port configuration struct.
DOCA_STABLE doca_error_t doca_flow_port_cfg_destroy(struct doca_flow_port_cfg *cfg)
Destroy DOCA Flow port configuration struct.
DOCA_STABLE doca_error_t doca_flow_cfg_set_pipe_queues(struct doca_flow_cfg *cfg, uint16_t pipe_queues)
Set pipe queues.
void(* doca_flow_entry_process_cb)(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 flow entry process callback
DOCA_EXPERIMENTAL doca_error_t doca_flow_port_cfg_set_operation_state(struct doca_flow_port_cfg *cfg, enum doca_flow_port_operation_state state)
Set default rules operation state.
DOCA_STABLE doca_error_t doca_flow_cfg_destroy(struct doca_flow_cfg *cfg)
Destroy DOCA Flow configuration struct.
@ DOCA_FLOW_PORT_OPERATION_STATE_ACTIVE
@ DOCA_FLOW_ENTRY_STATUS_SUCCESS
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
const struct ip_frag_config * cfg
static doca_error_t create_doca_flow_port(int port_id, struct doca_dev *dev, enum doca_flow_port_operation_state state, struct doca_flow_port **port, uint32_t actions_mem_size)
doca_error_t flow_process_entries(struct doca_flow_port *port, struct entries_status *status, uint32_t nr_entries)
doca_error_t init_doca_flow(int nb_queues, const char *mode, struct flow_resources *resource, uint32_t nr_shared_resources[])
doca_error_t stop_doca_flow_ports(int nb_ports, struct doca_flow_port *ports[])
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)
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 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 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
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]