33 #define DPDK_ADDITIONAL_ARG 2
47 const char *dev_pci_addr = (
char *)param;
53 DOCA_LOG_ERR(
"Entered device PCI address exceeding the maximum size of %d",
59 strncpy(
cfg->ct_dev_pci_addr[
cfg->n_ports++], dev_pci_addr,
len + 1);
64 #define FNV1A_32_OFFSET (uint32_t)2166136261
65 #define FNV1A_32_PRIME (uint32_t)16777619
76 const uint8_t *bytes = (
const uint8_t *)buf;
79 for (i = 0; i <
len; i++) {
80 hash ^= (uint32_t)bytes[i];
91 struct doca_argp_param *dev_pci_addr_param;
116 uint32_t nb_arm_queues,
117 uint32_t nb_ctrl_queues,
118 uint32_t nb_user_actions,
120 uint32_t nb_ipv4_sessions,
121 uint32_t nb_ipv6_sessions,
122 uint32_t dup_filter_sz,
130 struct doca_flow_ct_cfg *ct_cfg;
133 if (o_zone_mask ==
NULL || o_modify_mask ==
NULL) {
136 }
else if (r_zone_mask ==
NULL || r_modify_mask ==
NULL) {
171 memcpy(argv, dpdk_argv,
sizeof(argv[0]) * argc);
173 argv[argc++] =
"pci:00:00.0";
228 struct doca_flow_pipe *fwd_pipe,
230 struct doca_flow_pipe **pipe)
234 struct doca_flow_pipe_cfg *pipe_cfg;
237 memset(&
fwd, 0,
sizeof(
fwd));
263 memset(&match, 0,
sizeof(match));
308 memset(&match, 0,
sizeof(match));
360 memset(&match, 0,
sizeof(match));
400 DOCA_LOG_ERR(
"Expecting room is bigger than default queue depth");
408 DOCA_LOG_ERR(
"Failed to process entries, status is not success");
struct rte_eth_dev_info dev_info
doca_error_t dpdk_init(int argc, char **argv)
uint32_t flow_ct_hash_6tuple(const struct doca_flow_ct_match *match, doca_be32_t zone_field, bool is_ipv6)
doca_error_t flow_ct_dpdk_init(int argc, char **dpdk_argv)
static doca_error_t pci_addr_callback(void *param, void *config)
doca_error_t init_doca_flow_ct(uint32_t flags, uint32_t nb_arm_queues, uint32_t nb_ctrl_queues, uint32_t nb_user_actions, doca_flow_ct_entry_finalize_cb entry_finalize_cb, uint32_t nb_ipv4_sessions, uint32_t nb_ipv6_sessions, uint32_t dup_filter_sz, bool o_match_inner, struct doca_flow_meta *o_zone_mask, struct doca_flow_meta *o_modify_mask, bool r_match_inner, struct doca_flow_meta *r_zone_mask, struct doca_flow_meta *r_modify_mask)
DOCA_LOG_REGISTER(FLOW_CT_COMMON)
doca_error_t flow_ct_capable(struct doca_devinfo *dev_info)
doca_error_t flow_ct_register_params(void)
static uint32_t fnv1a_32bit_hash(const void *buf, size_t len, uint32_t hash)
doca_error_t create_ct_root_pipe(struct doca_flow_port *port, bool is_ipv4, bool is_ipv6, enum doca_flow_l4_meta l4_type, struct doca_flow_pipe *fwd_pipe, struct entries_status *status, struct doca_flow_pipe **pipe)
doca_error_t flow_ct_queue_reserve(struct doca_flow_port *port, uint16_t ct_queue, struct entries_status *status, uint32_t room)
#define DPDK_ADDITIONAL_ARG
void cleanup_procedure(struct doca_flow_pipe *ct_pipe, int nb_ports, struct doca_flow_port *ports[])
#define CT_DEFAULT_QUEUE_DEPTH
static void entry_finalize_cb(struct doca_flow_pipe *pipe, void *entry, uint16_t ct_queue, void *usr_ctx)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
#define BE_IPV4_ADDR(a, b, c, d)
static struct doca_flow_fwd fwd
#define DEFAULT_TIMEOUT_US
#define DOCA_BE32_GET(_m, _f)
DOCA_EXPERIMENTAL void doca_argp_param_set_description(struct doca_argp_param *param, const char *description)
Set the description of the program param, used during program usage.
DOCA_EXPERIMENTAL void doca_argp_param_set_long_name(struct doca_argp_param *param, const char *name)
Set the long name of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_callback(struct doca_argp_param *param, doca_argp_param_cb_t callback)
Set the callback function of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_mandatory(struct doca_argp_param *param)
Mark the program param as mandatory.
DOCA_EXPERIMENTAL doca_error_t doca_argp_param_create(struct doca_argp_param **param)
Create new program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_type(struct doca_argp_param *param, enum doca_argp_type type)
Set the type of the param arguments.
DOCA_EXPERIMENTAL void doca_argp_param_set_short_name(struct doca_argp_param *param, const char *name)
Set the short name of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_register_param(struct doca_argp_param *input_param)
Register a program flag.
DOCA_EXPERIMENTAL void doca_argp_param_set_multiplicity(struct doca_argp_param *param)
Mark the program param as supporting multiple appearances.
#define DOCA_DEVINFO_PCI_ADDR_SIZE
Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_name(doca_error_t error)
Returns the string representation of an error code name.
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_EXPERIMENTAL doca_error_t doca_flow_ct_entries_process(struct doca_flow_port *port, uint16_t pipe_queue, uint32_t min_room, uint32_t max_processed_entries, uint32_t *queue_room)
Process CT entries in queue.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_direction(struct doca_flow_ct_cfg *cfg, bool direction, bool match_inner, struct doca_flow_meta *zone_match_mask, struct doca_flow_meta *meta_modify_mask)
Set CT configuration origin and reply direction.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_create(struct doca_flow_ct_cfg **cfg)
Create CT configuration.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_flags(struct doca_flow_ct_cfg *cfg, uint32_t flags)
Set CT flags.
void(* doca_flow_ct_entry_finalize_cb)(struct doca_flow_pipe *pipe, void *entry, uint16_t queue, void *usr_ctx)
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_user_actions(struct doca_flow_ct_cfg *cfg, uint32_t n_user_actions)
Set number of user actions.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_ctrl_queues(struct doca_flow_ct_cfg *cfg, uint32_t n_ctrl_queues)
Set number of control queues.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_queues(struct doca_flow_ct_cfg *cfg, uint32_t n_queues)
Set number of hardware queues.
DOCA_EXPERIMENTAL void doca_flow_ct_destroy(void)
Destroy the doca flow ct.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_dup_filter_size(struct doca_flow_ct_cfg *cfg, uint32_t dup_filter_sz)
Set Number of connections to cache in duplication filter.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cap_is_dev_supported(const struct doca_devinfo *devinfo)
Check if doca device supported by CT.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_aging_core(struct doca_flow_ct_cfg *cfg, uint32_t aging_core)
Set core ID to run aging thread on.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_init(const struct doca_flow_ct_cfg *cfg)
Initialize the doca flow ct.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_connections(struct doca_flow_ct_cfg *cfg, uint32_t n_ipv4, uint32_t n_ipv6, uint32_t n_total)
Set number of ARM sessions.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_entry_finalize_cb(struct doca_flow_ct_cfg *cfg, doca_flow_ct_entry_finalize_cb entry_finalize_cb)
Set entry finalize callback to query connection final stats.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_destroy(struct doca_flow_ct_cfg *cfg)
Destroy CT configuration.
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_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_pipe_destroy(struct doca_flow_pipe *pipe)
Destroy one pipe.
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
doca_flow_l4_meta
doca flow l4 valid type for parser meta
#define DOCA_LOG_ERR(format,...)
Generates an ERROR 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 set_flow_pipe_cfg(struct doca_flow_pipe_cfg *cfg, const char *name, enum doca_flow_pipe_type type, bool is_root)
struct doca_flow_header_l4_port l4_port
struct doca_flow_header_l4_port l4_port
doca flow CT match pattern
struct doca_flow_ct_match4 ipv4
struct doca_flow_ct_match6 ipv6
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
user context struct that will be used in entries process callback
static struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]