28 #include <rte_ethdev.h>
39 #define UPF_ACCEL_PSC_EXTENSION_CODE 0x85
41 #define UPF_ACCEL_BUILD_VNI(uint24_vni) (DOCA_HTOBE32((uint32_t)uint24_vni << 8))
46 struct doca_flow_pipe *pipe,
53 struct doca_flow_pipe_entry **
entry)
75 struct doca_flow_pipe_cfg *
cfg;
159 char *pipe_name =
"DROP_PIPE";
162 pipe_cfg->
name = pipe_name;
165 pipe_cfg->
match = &match;
167 pipe_cfg->
mon = &mon;
233 struct doca_flow_pipe **pipe)
240 .rss.outer_flags = outer_flags,
241 .rss.inner_flags = inner_flags,
249 char *pipe_name =
"TO_SW_PIPE";
253 pipe_cfg->
name = pipe_name;
256 pipe_cfg->
match = &match;
307 struct doca_flow_pipe **pipe)
317 char *pipe_name =
"TX_ROOT_PIPE";
320 pipe_cfg->
name = pipe_name;
323 pipe_cfg->
match = &match;
367 struct doca_flow_pipe **pipe)
371 .shared_counter.shared_counter_id = 0xffffffff,
383 .dst_ip = UINT32_MAX,
388 .udp.l4_port = {.src_port = RTE_BE16(RTE_GTPU_UDP_PORT - 2),
389 .dst_port = RTE_BE16(RTE_GTPU_UDP_PORT)}},
397 char *pipe_name =
"ENCAP_PIPE";
400 pipe_cfg->
name = pipe_name;
403 pipe_cfg->
match = &match;
405 pipe_cfg->
mon = &mon;
427 memcpy(&act_encap_5g, &act_encap_4g,
sizeof(act_encap_4g));
454 struct doca_flow_pipe **pipe)
463 .encap_cfg.is_l2 =
true,
472 .udp.l4_port.dst_port = RTE_BE16(RTE_VXLAN_DEFAULT_PORT)},
477 char *pipe_name =
"VXLAN_ENCAP_PIPE";
481 pipe_cfg->
name = pipe_name;
484 pipe_cfg->
match = &match;
529 struct doca_flow_pipe **pipe)
538 .field_op.dst.field_string =
"outer.ipv4.ttl"};
544 char *pipe_name =
"FAR_PIPE";
547 pipe_cfg->
name = pipe_name;
550 pipe_cfg->
match = &match;
594 struct doca_flow_pipe **pipe)
608 char *pipe_name =
"DECAP_PIPE";
611 pipe_cfg->
name = pipe_name;
614 pipe_cfg->
match = &match;
674 struct doca_flow_pipe *fwd_pipe,
675 struct doca_flow_pipe **pipe)
683 .decap_cfg.is_l2 =
true,
691 char *pipe_name =
"VXLAN_DECAP_PIPE";
694 pipe_cfg->
name = pipe_name;
697 pipe_cfg->
match = &match;
759 struct doca_flow_pipe *green_fwd_pipe,
760 struct doca_flow_pipe **pipe)
767 char *pipe_name =
"COLOR_MATCH_PIPE";
770 pipe_cfg->
name = pipe_name;
773 pipe_cfg->
match = &match;
836 struct doca_flow_pipe **
pipe)
839 .shared_meter.shared_meter_id = UINT32_MAX};
846 char *pipe_name =
"SHARED_METER_PIPE";
850 pipe_cfg->
name = pipe_name;
853 pipe_cfg->
match = &match;
855 pipe_cfg->
mon = &mon;
887 struct doca_flow_pipe *color_pipe_next_pipe)
893 DOCA_LOG_ERR(
"Meter chain cannot be created in ingress");
901 color_pipe_next_pipe,
949 struct doca_flow_pipe **pipe)
953 .tun = {.type =
DOCA_FLOW_TUN_GTPU, .gtp_teid = UINT32_MAX, .gtp_ext_psc_qfi = UINT8_MAX},
955 .ip4 = {.dst_ip = UINT32_MAX, .src_ip = UINT32_MAX, .next_proto = UINT8_MAX},
957 .udp.l4_port = {.dst_port = UINT16_MAX, .src_port = UINT16_MAX}}};
965 char *pipe_name =
"8T_PIPE";
968 pipe_cfg->
name = pipe_name;
971 pipe_cfg->
match = &match;
973 pipe_cfg->
mon = &mon;
999 struct doca_flow_pipe **pipe)
1005 .ip4 = {.dst_ip = UINT32_MAX, .src_ip = UINT32_MAX, .next_proto = UINT8_MAX},
1007 .udp.l4_port = {.dst_port = UINT16_MAX, .src_port = UINT16_MAX}}};
1015 char *pipe_name =
"7T_PIPE";
1018 pipe_cfg->
name = pipe_name;
1021 pipe_cfg->
match = &match;
1023 pipe_cfg->
mon = &mon;
1049 struct doca_flow_pipe **pipe)
1053 .ip4 = {.dst_ip = UINT32_MAX, .src_ip = UINT32_MAX, .next_proto = UINT8_MAX},
1055 .udp.l4_port = {.dst_port = UINT16_MAX, .src_port = UINT16_MAX}}};
1063 char *pipe_name =
"5T_PIPE";
1066 pipe_cfg->
name = pipe_name;
1069 pipe_cfg->
match = &match;
1071 pipe_cfg->
mon = &mon;
1097 struct doca_flow_pipe **pipe)
1106 char *pipe_name =
"EXTENDED_GTP_PIPE";
1109 pipe_cfg->
name = pipe_name;
1112 pipe_cfg->
match = &match;
1154 struct doca_flow_pipe **pipe)
1162 char *pipe_name =
"ULDL_PIPE";
1163 uint32_t fwd_pipe_idx;
1173 fwd_miss_ptr =
NULL;
1178 pipe_cfg->
name = pipe_name;
1181 pipe_cfg->
match = &match;
1224 struct doca_flow_pipe *fwd_pipe,
1225 struct doca_flow_pipe **pipe)
1233 char *pipe_name =
"ROOT_PIPE";
1236 pipe_cfg->
name = pipe_name;
1239 pipe_cfg->
match = &match;
1303 struct doca_flow_pipe *root_fwd_pipe;
1565 for (vxlan_idx = 0; vxlan_idx < num_vxlans; vxlan_idx++) {
1571 DOCA_LOG_ERR(
"Failed to add on port %u vxlan rules for vxlan idx %u: %s",
1591 DOCA_LOG_ERR(
"Failed to create rx pipeline in port %d: %s",
1599 DOCA_LOG_ERR(
"Failed to create tx pipeline in port %d: %s",
#define SET_MAC_ADDR(addr, a, b, c, d, e, f)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static struct doca_flow_fwd fwd_miss
static uint16_t * rss_queues
static struct doca_flow_actions actions
static struct doca_flow_fwd fwd
static struct doca_flow_match match_mask
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
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_NOT_SUPPORTED
#define DOCA_FLOW_VXLAN_DEFAULT_PORT
#define DOCA_FLOW_PROTO_UDP
#define DOCA_FLOW_ETHER_TYPE_IPV4
@ 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_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_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_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 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_STABLE doca_error_t doca_flow_pipe_cfg_set_domain(struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_domain domain)
Set pipe's domain.
@ DOCA_FLOW_RSS_HASH_FUNCTION_SYMMETRIC_TOEPLITZ
@ DOCA_FLOW_RESOURCE_TYPE_SHARED
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
@ DOCA_FLOW_PIPE_DOMAIN_EGRESS
@ DOCA_FLOW_PIPE_DOMAIN_DEFAULT
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
const struct ip_frag_config * cfg
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)
enum doca_flow_action_type type
doca flow actions information
struct doca_flow_resource_encap_cfg encap_cfg
struct doca_flow_header_format outer
enum doca_flow_resource_type encap_type
struct doca_flow_meta meta
enum doca_flow_resource_type decap_type
struct doca_flow_resource_decap_cfg decap_cfg
struct doca_flow_header_format outer
struct doca_flow_pipe * next_pipe
struct doca_flow_pipe * pipe
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_header_format inner
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
struct doca_flow_meta meta
doca monitor action configuration
enum doca_flow_resource_type counter_type
enum doca_flow_resource_type meter_type
struct doca_flow_header_eth eth
struct doca_flow_encap_action encap
enum doca_flow_tun_type type
uint8_t gtp_next_ext_hdr_type
struct doca_flow_action_descs ** action_desc_list
struct doca_flow_actions ** action_list
const char * vxlan_config_file_path
struct upf_accel_qers * qers
uint32_t hw_aging_time_sec
struct upf_accel_vxlans * vxlans
upf_accel_get_forwarding_port get_fwd_port
struct doca_flow_pipe * pipes[UPF_ACCEL_PORTS_MAX][UPF_ACCEL_PIPE_NUM]
uint32_t num_static_entries[UPF_ACCEL_PORTS_MAX]
struct doca_flow_port * ports[UPF_ACCEL_PORTS_MAX]
struct doca_flow_pipe_entry * drop_entries[UPF_ACCEL_DROP_NUM][UPF_ACCEL_NUM_DOMAINS]
struct upf_accel_entry_ctx static_entry_ctx[UPF_ACCEL_PORTS_MAX]
const struct upf_accel_config * upf_accel_cfg
struct doca_flow_fwd * fwd
enum doca_flow_pipe_domain domain
struct doca_flow_match * match
struct doca_flow_port * port
struct doca_flow_match * match_mask
struct doca_flow_monitor * mon
struct upf_accel_action_cfg actions
struct doca_flow_fwd * fwd_miss
enum upf_accel_port port_id
uint8_t mac[DOCA_FLOW_ETHER_ADDR_LEN]
struct upf_accel_vxlan arr_vxlans[]
#define UPF_ACCEL_SRC_MAC
#define UPF_ACCEL_META_PKT_DIR_UL
#define UPF_ACCEL_DST_MAC
static uint8_t upf_accel_drop_idx_get(struct upf_accel_pipe_cfg *pipe_cfg, enum upf_accel_pipe_drop_type drop_type)
#define UPF_ACCEL_MAX_NUM_PDR
static uint8_t upf_accel_domain_idx_get(enum upf_accel_port port_id, uint8_t domain)
#define UPF_ACCEL_META_PKT_DIR_DL
@ UPF_ACCEL_PIPE_TX_COLOR_MATCH_START
@ UPF_ACCEL_PIPE_DL_TO_SW
@ UPF_ACCEL_PIPE_TX_VXLAN_ENCAP
@ UPF_ACCEL_PIPE_TX_COUNTER
@ UPF_ACCEL_PIPE_RX_VXLAN_DECAP
@ UPF_ACCEL_PIPE_UL_TO_SW
@ UPF_ACCEL_PIPE_TX_SHARED_METERS_START
@ UPF_ACCEL_PIPE_TX_COLOR_MATCH_NO_MORE_METERS
#define UPF_ACCEL_FIXED_PORT_NONE
@ UPF_ACCEL_ENCAP_ACTION_NONE
@ UPF_ACCEL_ENCAP_ACTION_NUM
@ UPF_ACCEL_ENCAP_ACTION_5G
@ UPF_ACCEL_ENCAP_ACTION_4G
static doca_error_t upf_accel_pipe_shared_meter_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_far_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_root_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *fwd_pipe, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(UPF_ACCEL::PIPELINE)
doca_error_t upf_accel_pipeline_create(struct upf_accel_ctx *upf_accel_ctx)
#define UPF_ACCEL_PSC_EXTENSION_CODE
static doca_error_t upf_accel_pipe_ext_gtp_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_vxlan_insert(struct upf_accel_ctx *upf_accel_ctx, const struct upf_accel_vxlan *vxlan, enum upf_accel_port port_id)
#define UPF_ACCEL_BUILD_VNI(uint24_vni)
static doca_error_t upf_accel_pipe_drop_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, enum upf_accel_pipe_drop_type drop_type)
static doca_error_t upf_accel_pipe_7t_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
doca_error_t upf_accel_pipe_static_entry_add(struct upf_accel_ctx *upf_accel_ctx, enum upf_accel_port port_id, 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 *mon, const struct doca_flow_fwd *fwd, uint32_t flags, void *usr_ctx, struct doca_flow_pipe_entry **entry)
static doca_error_t upf_accel_pipe_uldl_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_drops_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg)
static doca_error_t upf_accel_pipe_5t_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_create(struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_8t_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_decap_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_vxlan_decap_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *fwd_pipe, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipeline_tx_create(struct upf_accel_ctx *upf_accel_ctx, enum upf_accel_port port_id)
static doca_error_t upf_accel_pipe_vxlan_encap_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_vxlan_rules_add(struct upf_accel_ctx *upf_accel_ctx)
static doca_error_t upf_accel_pipe_meter_chain_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *color_pipe_next_pipe)
static doca_error_t upf_accel_pipe_encap_counter_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_fwd *fwd, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_color_match_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *green_fwd_pipe, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipeline_rx_create(struct upf_accel_ctx *upf_accel_ctx, enum upf_accel_port port_id)
static doca_error_t upf_accel_pipe_tx_root_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_to_sw_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, bool is_ul, struct doca_flow_pipe **pipe)
#define UPF_ACCEL_MAX_NUM_CONNECTIONS
#define UPF_ACCEL_ENCAP_TTL
#define UPF_ACCEL_VERSION_IHL_IPV4
#define UPF_ACCEL_MAX_NUM_VNIS