1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2014-2023 Broadcom
* All rights reserved.
*/
#ifndef _ULP_TEMPLATE_STRUCT_H_
#define _ULP_TEMPLATE_STRUCT_H_
#include <stdint.h>
#include "rte_ether.h"
#include "rte_icmp.h"
#include "rte_ip.h"
#include "rte_tcp.h"
#include "rte_udp.h"
#include "rte_esp.h"
#include "rte_sctp.h"
#include "rte_flow.h"
#include "tf_core.h"
#include "cfa_resources.h"
#include "cfa_types.h"
/* Number of fields for each protocol */
#define BNXT_ULP_PROTO_HDR_SVIF_NUM 2
#define BNXT_ULP_PROTO_HDR_ETH_NUM 3
#define BNXT_ULP_PROTO_HDR_S_VLAN_NUM 3
#define BNXT_ULP_PROTO_HDR_VLAN_NUM 6
#define BNXT_ULP_PROTO_HDR_IPV4_NUM 10
#define BNXT_ULP_PROTO_HDR_IPV6_NUM 8
#define BNXT_ULP_PROTO_HDR_UDP_NUM 4
#define BNXT_ULP_PROTO_HDR_TCP_NUM 9
#define BNXT_ULP_PROTO_HDR_VXLAN_NUM 4
#define BNXT_ULP_PROTO_HDR_VXLAN_GPE_NUM 5
#define BNXT_ULP_PROTO_HDR_GENEVE_NUM 4
#define BNXT_ULP_PROTO_HDR_GRE_NUM 2
#define BNXT_ULP_PROTO_HDR_GRE_KEY_NUM 1
#define BNXT_ULP_PROTO_HDR_ICMP_NUM 5
#define BNXT_ULP_PROTO_HDR_ECPRI_NUM 2
#define BNXT_ULP_PROTO_HDR_IPV6_EXT_NUM 1
#define BNXT_ULP_PROTO_HDR_SRV6_NUM 7
#define BNXT_ULP_PROTO_HDR_MPLS_NUM 2
#define BNXT_ULP_PROTO_HDR_MAX 128
#define BNXT_ULP_PROTO_HDR_ENCAP_MAX 64
#define BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX 1
/* Direction attributes */
#define BNXT_ULP_FLOW_ATTR_TRANSFER 0x1
#define BNXT_ULP_FLOW_ATTR_INGRESS 0x2
#define BNXT_ULP_FLOW_ATTR_EGRESS 0x4
struct ulp_rte_hdr_bitmap {
uint64_t bits;
};
struct ulp_rte_field_bitmap {
uint64_t bits;
};
/* Structure to store the protocol fields */
#define RTE_PARSER_FLOW_HDR_FIELD_SIZE 16
struct ulp_rte_hdr_field {
uint8_t spec[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
uint8_t mask[RTE_PARSER_FLOW_HDR_FIELD_SIZE];
uint32_t size;
};
struct ulp_rte_act_bitmap {
uint64_t bits;
};
/* Structure to hold the action property details. */
struct ulp_rte_act_prop {
uint8_t act_details[BNXT_ULP_ACT_PROP_IDX_LAST];
};
/* Structure to be used for passing all the parser functions */
struct ulp_rte_parser_params {
struct ulp_rte_hdr_bitmap hdr_bitmap;
struct ulp_rte_hdr_bitmap enc_hdr_bitmap;
struct ulp_rte_hdr_bitmap hdr_fp_bit;
struct ulp_rte_field_bitmap fld_bitmap;
struct ulp_rte_field_bitmap fld_s_bitmap;
struct ulp_rte_hdr_field hdr_field[BNXT_ULP_PROTO_HDR_MAX];
struct ulp_rte_hdr_field enc_field[BNXT_ULP_PROTO_HDR_ENCAP_MAX];
uint64_t comp_fld[BNXT_ULP_CF_IDX_LAST];
uint32_t field_idx;
struct ulp_rte_act_bitmap act_bitmap;
struct ulp_rte_act_prop act_prop;
uint32_t dir_attr;
uint32_t priority;
uint32_t fid;
uint32_t parent_flow;
uint32_t child_flow;
uint16_t func_id;
uint16_t port_id;
uint32_t class_id;
uint32_t act_tmpl;
struct bnxt_ulp_context *ulp_ctx;
uint32_t hdr_sig_id;
uint64_t flow_sig_id;
uint32_t flow_pattern_id;
uint32_t act_pattern_id;
uint8_t app_id;
uint8_t tun_idx;
uint16_t gre_cks_rsvd0_ver; /* GRE C, K, S bits and version */
uint16_t class_info_idx;
uint64_t wc_field_bitmap;
uint64_t cf_bitmap;
uint64_t exclude_field_bitmap;
};
/* Flow Parser Header Information Structure */
struct bnxt_ulp_rte_hdr_info {
enum bnxt_ulp_hdr_type hdr_type;
/* Flow Parser Protocol Header Function Prototype */
int (*proto_hdr_func)(const struct rte_flow_item *item_list,
struct ulp_rte_parser_params *params);
};
/* Flow Parser Header Information Structure Array defined in template source*/
extern struct bnxt_ulp_rte_hdr_info ulp_hdr_info[];
extern struct bnxt_ulp_rte_hdr_info ulp_vendor_hdr_info[];
/* Flow Parser Action Information Structure */
struct bnxt_ulp_rte_act_info {
enum bnxt_ulp_act_type act_type;
/* Flow Parser Protocol Action Function Prototype */
int32_t (*proto_act_func)
(const struct rte_flow_action *action_item,
struct ulp_rte_parser_params *params);
};
/* Flow Parser Action Information Structure Array defined in template source*/
extern struct bnxt_ulp_rte_act_info ulp_act_info[];
extern struct bnxt_ulp_rte_act_info ulp_vendor_act_info[];
/* Flow Matcher structures */
struct bnxt_ulp_header_match_info {
struct ulp_rte_hdr_bitmap hdr_bitmap;
uint32_t start_idx;
uint32_t num_entries;
uint32_t class_tmpl_id;
uint32_t act_vnic;
};
struct ulp_rte_bitmap {
uint64_t bits;
};
struct bnxt_ulp_class_match_info {
struct ulp_rte_bitmap hdr_sig;
struct ulp_rte_bitmap field_sig;
uint32_t class_hid;
uint32_t class_tid;
uint8_t act_vnic;
uint8_t wc_pri;
uint8_t app_sig;
uint32_t hdr_sig_id;
uint64_t flow_sig_id;
uint32_t flow_pattern_id;
uint8_t app_id;
struct ulp_rte_bitmap hdr_bitmap;
uint64_t field_man_bitmap;
uint64_t field_opt_bitmap;
uint64_t field_exclude_bitmap;
uint8_t field_list[BNXT_ULP_GLB_FIELD_TBL_SIZE + 1];
};
/* Flow Matcher templates Structure for class entries */
extern uint16_t ulp_class_sig_tbl[];
extern struct bnxt_ulp_class_match_info ulp_class_match_list[];
/* Flow Matcher Action structures */
struct bnxt_ulp_action_match_info {
struct ulp_rte_act_bitmap act_bitmap;
uint32_t act_tmpl_id;
};
struct bnxt_ulp_act_match_info {
struct ulp_rte_bitmap act_bitmap;
uint32_t act_tid;
};
/* Flow Matcher templates Structure for action entries */
extern uint16_t ulp_act_sig_tbl[];
extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
/* Device Specific Tables for mapper */
struct bnxt_ulp_mapper_cond_info {
enum bnxt_ulp_cond_opc cond_opcode;
uint64_t cond_operand;
};
struct bnxt_ulp_mapper_cond_list_info {
enum bnxt_ulp_cond_list_opc cond_list_opcode;
uint32_t cond_start_idx;
uint32_t cond_nums;
int32_t cond_true_goto;
int32_t cond_false_goto;
};
struct bnxt_ulp_mapper_func_info {
enum bnxt_ulp_func_opc func_opc;
enum bnxt_ulp_func_src func_src1;
enum bnxt_ulp_func_src func_src2;
uint64_t func_opr1;
uint64_t func_opr2;
uint16_t func_dst_opr;
uint32_t func_oper_size;
};
struct bnxt_ulp_template_device_tbls {
struct bnxt_ulp_mapper_tmpl_info *tmpl_list;
uint32_t tmpl_list_size;
struct bnxt_ulp_mapper_tbl_info *tbl_list;
uint32_t tbl_list_size;
struct bnxt_ulp_mapper_key_info *key_info_list;
uint32_t key_info_list_size;
struct bnxt_ulp_mapper_field_info *key_ext_list;
uint32_t key_ext_list_size;
struct bnxt_ulp_mapper_field_info *result_field_list;
uint32_t result_field_list_size;
struct bnxt_ulp_mapper_ident_info *ident_list;
uint32_t ident_list_size;
struct bnxt_ulp_mapper_cond_info *cond_list;
uint32_t cond_list_size;
struct bnxt_ulp_mapper_cond_list_info *cond_oper_list;
uint32_t cond_oper_list_size;
};
struct bnxt_ulp_dyn_size_map {
uint32_t slab_size;
enum tf_tbl_type tbl_type;
};
/* Device specific parameters */
struct bnxt_ulp_device_params {
uint8_t description[16];
enum bnxt_ulp_byte_order key_byte_order;
enum bnxt_ulp_byte_order result_byte_order;
enum bnxt_ulp_byte_order encap_byte_order;
enum bnxt_ulp_byte_order wc_key_byte_order;
enum bnxt_ulp_byte_order em_byte_order;
uint8_t encap_byte_swap;
uint8_t num_phy_ports;
uint32_t mark_db_lfid_entries;
uint64_t mark_db_gfid_entries;
uint64_t int_flow_db_num_entries;
uint64_t ext_flow_db_num_entries;
uint32_t flow_count_db_entries;
uint32_t fdb_parent_flow_entries;
uint32_t num_resources_per_flow;
uint32_t ext_cntr_table_type;
uint64_t byte_count_mask;
uint64_t packet_count_mask;
uint32_t byte_count_shift;
uint32_t packet_count_shift;
uint32_t wc_dynamic_pad_en;
uint32_t em_dynamic_pad_en;
uint32_t dynamic_sram_en;
uint32_t dyn_encap_list_size;
struct bnxt_ulp_dyn_size_map dyn_encap_sizes[5];
uint32_t dyn_modify_list_size;
struct bnxt_ulp_dyn_size_map dyn_modify_sizes[4];
uint16_t em_blk_size_bits;
uint16_t em_blk_align_bits;
uint16_t em_key_align_bytes;
uint16_t em_result_size_bits;
uint16_t wc_slice_width;
uint16_t wc_max_slices;
uint32_t wc_mode_list[4];
uint32_t wc_mod_list_max_size;
uint32_t wc_ctl_size_bits;
uint32_t dev_features;
const struct bnxt_ulp_generic_tbl_params *gen_tbl_params;
const struct bnxt_ulp_allocator_tbl_params *allocator_tbl_params;
const struct bnxt_ulp_template_device_tbls *dev_tbls;
};
/* Flow Mapper */
struct bnxt_ulp_mapper_tmpl_info {
uint32_t device_name;
uint32_t start_tbl_idx;
uint32_t num_tbls;
struct bnxt_ulp_mapper_cond_list_info reject_info;
};
struct bnxt_ulp_mapper_tbl_info {
enum bnxt_ulp_resource_func resource_func;
uint32_t resource_type; /* TF_ enum type */
enum bnxt_ulp_resource_sub_type resource_sub_type;
struct bnxt_ulp_mapper_cond_list_info execute_info;
struct bnxt_ulp_mapper_func_info func_info;
enum bnxt_ulp_cond_opc cond_opcode;
uint32_t cond_operand;
uint8_t direction;
enum bnxt_ulp_pri_opc pri_opcode;
uint32_t pri_operand;
/* conflict resolution opcode */
enum bnxt_ulp_accept_opc accept_opcode;
enum bnxt_ulp_critical_resource critical_resource;
/* Information for accessing the key in ulp_key_field_list */
uint32_t key_start_idx;
uint16_t key_bit_size;
uint16_t key_num_fields;
/* Information for accessing the partial key in ulp_key_field_list */
uint32_t partial_key_start_idx;
uint16_t partial_key_bit_size;
uint16_t partial_key_num_fields;
/* Size of the blob that holds the key */
uint16_t blob_key_bit_size;
uint16_t record_size;
/* Information for accessing the ulp_class_result_field_list */
uint32_t result_start_idx;
uint16_t result_bit_size;
uint16_t result_num_fields;
uint16_t encap_num_fields;
/* Information for accessing the ulp_ident_list */
uint32_t ident_start_idx;
uint16_t ident_nums;
enum bnxt_ulp_mark_db_opc mark_db_opcode;
/* Table opcode for table operations */
uint32_t tbl_opcode;
uint32_t tbl_operand;
enum bnxt_ulp_generic_tbl_lkup_type gen_tbl_lkup_type;
/* FDB table opcode */
enum bnxt_ulp_fdb_opc fdb_opcode;
uint32_t fdb_operand;
/* Manage ref_cnt via opcode for generic tables */
enum bnxt_ulp_ref_cnt_opc ref_cnt_opcode;
/* Shared session */
enum bnxt_ulp_session_type session_type;
enum cfa_track_type track_type;
/* Key recipes for generic templates */
enum bnxt_ulp_key_recipe_opc key_recipe_opcode;
uint32_t key_recipe_operand;
/* control table messages */
const char *false_message;
const char *true_message;
const char *description;
};
struct bnxt_ulp_mapper_field_info {
uint8_t description[64];
uint16_t field_bit_size;
enum bnxt_ulp_field_opc field_opc;
enum bnxt_ulp_field_src field_src1;
uint8_t field_opr1[16];
enum bnxt_ulp_field_src field_src2;
uint8_t field_opr2[16];
enum bnxt_ulp_field_src field_src3;
uint8_t field_opr3[16];
};
struct bnxt_ulp_mapper_key_info {
struct bnxt_ulp_mapper_field_info field_info_spec;
struct bnxt_ulp_mapper_field_info field_info_mask;
};
struct bnxt_ulp_mapper_ident_info {
uint8_t description[64];
uint32_t resource_func;
uint16_t ident_type;
uint16_t ident_bit_size;
uint16_t ident_bit_pos;
enum bnxt_ulp_rf_idx regfile_idx;
};
struct bnxt_ulp_glb_resource_info {
uint8_t app_id;
enum bnxt_ulp_device_id device_id;
enum tf_dir direction;
enum bnxt_ulp_session_type session_type;
enum bnxt_ulp_resource_func resource_func;
uint32_t resource_type; /* TF_ enum type */
enum bnxt_ulp_glb_rf_idx glb_regfile_index;
};
struct bnxt_ulp_resource_resv_info {
uint8_t app_id;
enum bnxt_ulp_device_id device_id;
enum tf_dir direction;
enum bnxt_ulp_session_type session_type;
enum bnxt_ulp_resource_func resource_func;
uint32_t resource_type; /* TF_ enum type */
uint32_t count;
};
struct bnxt_ulp_app_capabilities_info {
uint8_t app_id;
uint32_t default_priority;
uint32_t max_def_priority;
uint32_t min_flow_priority;
uint32_t max_flow_priority;
uint32_t vxlan_port;
uint32_t vxlan_ip_port;
uint32_t ecpri_udp_port;
enum bnxt_ulp_device_id device_id;
uint32_t upgrade_fw_update;
uint8_t ha_pool_id;
uint8_t ha_reg_state;
uint8_t ha_reg_cnt;
uint8_t tunnel_next_proto;
uint32_t flags;
uint32_t max_pools;
uint8_t em_multiplier;
uint32_t num_rx_flows;
uint32_t num_tx_flows;
uint16_t act_rx_max_sz;
uint16_t act_tx_max_sz;
uint16_t em_rx_key_max_sz;
uint16_t em_tx_key_max_sz;
uint32_t pbl_page_sz_in_bytes;
uint16_t num_key_recipes_per_dir;
uint64_t feature_bits;
uint64_t default_class_bits;
uint64_t default_act_bits;
};
struct bnxt_ulp_cache_tbl_params {
uint16_t num_entries;
};
struct bnxt_ulp_generic_tbl_params {
const char *name;
enum bnxt_ulp_gen_tbl_type gen_tbl_type;
uint16_t result_num_entries;
uint16_t result_num_bytes;
enum bnxt_ulp_byte_order result_byte_order;
uint32_t hash_tbl_entries;
uint16_t num_buckets;
uint16_t key_num_bytes;
uint16_t partial_key_num_bytes;
};
struct bnxt_ulp_allocator_tbl_params {
const char *name;
uint16_t num_entries;
};
struct bnxt_ulp_shared_act_info {
uint64_t act_bitmask;
};
/*
* Flow Mapper Static Data Externs:
* Access to the below static data should be done through access functions and
* directly throughout the code.
*/
/*
* The ulp_device_params is indexed by the dev_id.
* This table maintains the device specific parameters.
*/
extern struct bnxt_ulp_device_params ulp_device_params[];
/*
* The ulp_act_prop_map_table provides the mapping to index and size of action
* properties.
*/
extern uint32_t ulp_act_prop_map_table[];
/*
* The ulp_glb_resource_tbl provides the list of global resources that need to
* be initialized and where to store them.
*/
extern struct bnxt_ulp_glb_resource_info ulp_glb_resource_tbl[];
/*
* The ulp_app_glb_resource_tbl provides the list of shared resources required
* in the event that shared session is enabled.
*/
extern struct bnxt_ulp_glb_resource_info ulp_app_glb_resource_tbl[];
/*
* The ulp_resource_resv_list provides the list of tf resources required when
* calling tf_open.
*/
extern struct bnxt_ulp_resource_resv_info ulp_resource_resv_list[];
/*
* The ulp_app_resource_resv_list provides the list of tf resources required
* when calling tf_open.
*/
extern struct bnxt_ulp_resource_resv_info ulp_app_resource_resv_list[];
/*
* The_app_cap_info_list provides the list of ULP capabilities per app/device.
*/
extern struct bnxt_ulp_app_capabilities_info ulp_app_cap_info_list[];
/*
* The ulp_cache_tbl_parms table provides the sizes of the cache tables the
* mapper must dynamically allocate during initialization.
*/
extern struct bnxt_ulp_cache_tbl_params ulp_cache_tbl_params[];
/*
* The ulp_generic_tbl_parms table provides the sizes of the generic tables the
* mapper must dynamically allocate during initialization.
*/
extern struct bnxt_ulp_generic_tbl_params ulp_generic_tbl_params[];
/*
* The ulp_global template table is used to initialize default entries
* that could be reused by other templates.
*/
extern uint32_t ulp_glb_template_tbl[];
#endif /* _ULP_TEMPLATE_STRUCT_H_ */
|