From 072cb4a870ab950990504468838482d43e0936b5 Mon Sep 17 00:00:00 2001 From: Mike Baucom Date: Fri, 17 Apr 2020 08:53:24 -0700 Subject: [PATCH] net/bnxt: add default identifiers to ULP mapper - Added ulp_mapper_init/deinit to allocate/deallocate mapper data for storing the default identifiers - Modified the template_db to include the new opcode for accessing the default ids. - Modified the result and key field builders to use the new opcode for writing the default ids into blobs Reviewed-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde Signed-off-by: Mike Baucom Signed-off-by: Venkat Duvvuru --- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 34 +++ drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 10 + drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 8 +- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 251 +++++++++++++++++- drivers/net/bnxt/tf_ulp/ulp_mapper.h | 22 +- drivers/net/bnxt/tf_ulp/ulp_template_db.c | 35 +-- drivers/net/bnxt/tf_ulp/ulp_template_db.h | 25 +- drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 11 + 8 files changed, 364 insertions(+), 32 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index c67da6d762..202b4a529b 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -19,6 +19,7 @@ #include "ulp_template_struct.h" #include "ulp_mark_mgr.h" #include "ulp_flow_db.h" +#include "ulp_mapper.h" /* Linked list of all TF sessions. */ STAILQ_HEAD(, bnxt_ulp_session_state) bnxt_ulp_session_list = @@ -485,6 +486,12 @@ bnxt_ulp_init(struct bnxt *bp) goto jump_to_error; } + rc = ulp_mapper_init(&bp->ulp_ctx); + if (rc) { + BNXT_TF_DBG(ERR, "Failed to initialize ulp mapper\n"); + goto jump_to_error; + } + return rc; jump_to_error: @@ -529,6 +536,9 @@ bnxt_ulp_deinit(struct bnxt *bp) /* Delete the Mark database */ ulp_mark_db_deinit(&bp->ulp_ctx); + /* cleanup the ulp mapper */ + ulp_mapper_deinit(&bp->ulp_ctx); + /* Delete the ulp context and tf session */ ulp_ctx_detach(bp, session); @@ -689,3 +699,27 @@ bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev) } return &bp->ulp_ctx; } + +int32_t +bnxt_ulp_cntxt_ptr2_mapper_data_set(struct bnxt_ulp_context *ulp_ctx, + void *mapper_data) +{ + if (!ulp_ctx || !ulp_ctx->cfg_data) { + BNXT_TF_DBG(ERR, "Invalid ulp context data\n"); + return -EINVAL; + } + + ulp_ctx->cfg_data->mapper_data = mapper_data; + return 0; +} + +void * +bnxt_ulp_cntxt_ptr2_mapper_data_get(struct bnxt_ulp_context *ulp_ctx) +{ + if (!ulp_ctx || !ulp_ctx->cfg_data) { + BNXT_TF_DBG(ERR, "Invalid ulp context data\n"); + return NULL; + } + + return ulp_ctx->cfg_data->mapper_data; +} diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h index b3e9e960d7..d2ca178575 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h @@ -18,6 +18,7 @@ struct bnxt_ulp_data { uint32_t dev_id; /* Hardware device id */ uint32_t ref_cnt; struct bnxt_ulp_flow_db *flow_db; + void *mapper_data; }; struct bnxt_ulp_context { @@ -107,4 +108,13 @@ bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context *ulp_ctx); struct bnxt_ulp_context * bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev); +/* Function to add the ulp mapper data to the ulp context */ +int32_t +bnxt_ulp_cntxt_ptr2_mapper_data_set(struct bnxt_ulp_context *ulp_ctx, + void *mapper_data); + +/* Function to get the ulp mapper data from the ulp context */ +void * +bnxt_ulp_cntxt_ptr2_mapper_data_get(struct bnxt_ulp_context *ulp_ctx); + #endif /* _BNXT_ULP_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c index f0c812cedc..7783f85d9a 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c @@ -110,7 +110,6 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, goto parse_error; ret = ulp_matcher_pattern_match(¶ms, &class_id); - if (ret != BNXT_TF_RC_SUCCESS) goto parse_error; @@ -126,11 +125,10 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, mapper_cparms.class_tid = class_id; mapper_cparms.act_tid = act_tmpl; mapper_cparms.func_id = bnxt_get_fw_func_id(dev->data->port_id); + mapper_cparms.dir = params.dir; - /* call the ulp mapper to create the flow in the hardware */ - ret = ulp_mapper_flow_create(ulp_ctx, - &mapper_cparms, - &fid); + /* Call the ulp mapper to create the flow in the hardware. */ + ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms, &fid); if (!ret) { flow_id = (struct rte_flow *)((uintptr_t)fid); return flow_id; diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 94899c0050..56e67002d5 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -4,6 +4,7 @@ */ #include +#include #include "bnxt.h" #include "ulp_template_db.h" #include "ulp_template_struct.h" @@ -16,6 +17,55 @@ #include "ulp_flow_db.h" #include "ulp_mapper.h" +static struct bnxt_ulp_def_ident_info * +ulp_mapper_def_ident_info_list_get(uint32_t *num_entries) +{ + if (!num_entries) + return NULL; + *num_entries = BNXT_ULP_DEF_IDENT_INFO_TBL_MAX_SZ; + return ulp_def_ident_tbl; +} + +/* + * Read a default identifier from the mapper regfile. + * + * The regval is always returned in big-endian. + * + * returns 0 on success + */ +static int32_t +ulp_mapper_def_regfile_read(struct bnxt_ulp_mapper_data *mapper_data, + enum tf_dir dir, + uint16_t idx, + uint64_t *regval) +{ + if (!mapper_data || !regval || + dir >= TF_DIR_MAX || idx >= BNXT_ULP_DEF_REGFILE_INDEX_LAST) + return -EINVAL; + *regval = mapper_data->dflt_ids[dir][idx].ident; + return 0; +} + +/* + * Write a default identifier to the mapper regfile + * + * The regval value must be in big-endian. + * + * return 0 on success. + */ +static int32_t +ulp_mapper_def_regfile_write(struct bnxt_ulp_mapper_data *mapper_data, + enum tf_dir dir, + uint16_t idx, + uint64_t regval) +{ + if (!mapper_data || dir >= TF_DIR_MAX || + idx >= BNXT_ULP_DEF_REGFILE_INDEX_LAST) + return -EINVAL; + mapper_data->dflt_ids[dir][idx].ident = regval; + return 0; +} + /* * Get the size of the action property for a given index. * @@ -364,6 +414,7 @@ error: static int32_t ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms, + enum tf_dir dir, struct bnxt_ulp_mapper_result_field_info *fld, struct ulp_blob *blob, const char *name) @@ -458,6 +509,27 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms, return -EINVAL; } break; + case BNXT_ULP_RESULT_OPC_SET_TO_DEF_REGFILE: + if (!ulp_operand_read(fld->result_operand, + (uint8_t *)&idx, + sizeof(uint16_t))) { + BNXT_TF_DBG(ERR, "%s key operand read failed.\n", name); + return -EINVAL; + } + idx = tfp_be_to_cpu_16(idx); + if (ulp_mapper_def_regfile_read(parms->mapper_data, + dir, + idx, ®val)) { + BNXT_TF_DBG(ERR, "%s regfile[%d] read failed.\n", + name, idx); + return -EINVAL; + } + val = ulp_blob_push_64(blob, ®val, fld->field_bit_size); + if (!val) { + BNXT_TF_DBG(ERR, "%s push to key blob failed\n", name); + return -EINVAL; + } + break; default: return -EINVAL; } @@ -467,12 +539,13 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms, /* Function to alloc action record and set the table. */ static int32_t ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms, + enum tf_dir dir, struct bnxt_ulp_mapper_class_key_field_info *f, struct ulp_blob *blob, uint8_t is_key, const char *name) { - uint64_t regval; + uint64_t val64; uint16_t idx, bitlen; uint32_t opcode; uint8_t *operand; @@ -541,17 +614,38 @@ ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms, } idx = tfp_be_to_cpu_16(idx); - if (!ulp_regfile_read(regfile, idx, ®val)) { + if (!ulp_regfile_read(regfile, idx, &val64)) { BNXT_TF_DBG(ERR, "%s regfile[%d] read failed.\n", name, idx); return -EINVAL; } - val = ulp_blob_push_64(blob, ®val, bitlen); + val = ulp_blob_push_64(blob, &val64, bitlen); + if (!val) { + BNXT_TF_DBG(ERR, "%s push to key blob failed\n", name); + return -EINVAL; + } + break; + case BNXT_ULP_SPEC_OPC_SET_TO_DEF_REGFILE: + if (!ulp_operand_read(operand, (uint8_t *)&idx, + sizeof(uint16_t))) { + BNXT_TF_DBG(ERR, "%s key operand read failed.\n", name); + return -EINVAL; + } + idx = tfp_be_to_cpu_16(idx); + if (ulp_mapper_def_regfile_read(parms->mapper_data, + dir, + idx, &val64)) { + BNXT_TF_DBG(ERR, "%s regfile[%d] read failed.\n", + name, idx); + return -EINVAL; + } + val = ulp_blob_push_64(blob, &val64, bitlen); if (!val) { BNXT_TF_DBG(ERR, "%s push to key blob failed\n", name); return -EINVAL; } + break; default: break; } @@ -716,6 +810,7 @@ ulp_mapper_action_info_process(struct bnxt_ulp_mapper_parms *parms, for (i = 0; i < (num_flds + encap_flds); i++) { fld = &flds[i]; rc = ulp_mapper_result_field_process(parms, + tbl->direction, fld, &blob, "Action"); @@ -779,7 +874,8 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms, */ for (i = 0; i < num_kflds; i++) { /* Setup the key */ - rc = ulp_mapper_keymask_field_process(parms, &kflds[i], + rc = ulp_mapper_keymask_field_process(parms, tbl->direction, + &kflds[i], &key, 1, "TCAM Key"); if (rc) { BNXT_TF_DBG(ERR, "Key field set failed.\n"); @@ -787,7 +883,8 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms, } /* Setup the mask */ - rc = ulp_mapper_keymask_field_process(parms, &kflds[i], + rc = ulp_mapper_keymask_field_process(parms, tbl->direction, + &kflds[i], &mask, 0, "TCAM Mask"); if (rc) { BNXT_TF_DBG(ERR, "Mask field set failed.\n"); @@ -854,6 +951,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms, for (i = 0; i < num_dflds; i++) { rc = ulp_mapper_result_field_process(parms, + tbl->direction, &dflds[i], &data, "TCAM Result"); @@ -958,7 +1056,8 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms, /* create the key */ for (i = 0; i < num_kflds; i++) { /* Setup the key */ - rc = ulp_mapper_keymask_field_process(parms, &kflds[i], + rc = ulp_mapper_keymask_field_process(parms, tbl->direction, + &kflds[i], &key, 1, "EM Key"); if (rc) { BNXT_TF_DBG(ERR, "Key field set failed.\n"); @@ -984,6 +1083,7 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms, fld = &dflds[i]; rc = ulp_mapper_result_field_process(parms, + tbl->direction, fld, &data, "EM Result"); @@ -1134,6 +1234,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, for (i = 0; i < num_flds; i++) { rc = ulp_mapper_result_field_process(parms, + tbl->direction, &flds[i], &data, "Indexed Result"); @@ -1436,6 +1537,17 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, return -EINVAL; } + /* + * Get the mapper data for dynamic mapper data such as default + * ids. + */ + parms.mapper_data = (struct bnxt_ulp_mapper_data *) + bnxt_ulp_cntxt_ptr2_mapper_data_get(ulp_ctx); + if (!parms.mapper_data) { + BNXT_TF_DBG(ERR, "Failed to get the ulp mapper data\n"); + return -EINVAL; + } + /* Get the action table entry from device id and act context id */ parms.act_tid = cparms->act_tid; parms.atbls = ulp_mapper_action_tbl_list_get(parms.dev_id, @@ -1515,3 +1627,130 @@ flow_error: return rc; } + +int32_t +ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx) +{ + struct tf_alloc_identifier_parms iparms; + struct bnxt_ulp_mapper_data *data; + struct bnxt_ulp_def_ident_info *dflt_ids; + uint32_t i, num_dflt_ids, reg_idx; + uint64_t regval; + struct tf *tfp; + int32_t rc; + + if (!ulp_ctx) + return -EINVAL; + + tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx); + if (!tfp) + return -EINVAL; + + data = rte_zmalloc("ulp_mapper_data", + sizeof(struct bnxt_ulp_mapper_data), 0); + if (!data) { + BNXT_TF_DBG(ERR, "Failed to allocate the mapper data\n"); + return -ENOMEM; + } + + if (bnxt_ulp_cntxt_ptr2_mapper_data_set(ulp_ctx, data)) { + BNXT_TF_DBG(ERR, "Failed to set mapper data in context\n"); + /* Don't call deinit since the prof_func wasn't allocated. */ + rte_free(data); + return -ENOMEM; + } + + /* Allocate the default ids. */ + dflt_ids = ulp_mapper_def_ident_info_list_get(&num_dflt_ids); + for (i = 0; i < num_dflt_ids; i++) { + iparms.ident_type = dflt_ids[i].ident_type; + iparms.dir = dflt_ids[i].direction; + + rc = tf_alloc_identifier(tfp, &iparms); + if (rc) { + BNXT_TF_DBG(ERR, "Failed to alloc dflt " + "identifier [%s][%d]\n", + (iparms.dir == TF_DIR_RX) ? "RX" : "TX", + iparms.ident_type); + goto error; + } + reg_idx = dflt_ids[i].def_regfile_index; + /* All regfile entries are stored as 64bit big-endian values. */ + regval = tfp_cpu_to_be_64((uint64_t)iparms.id); + if (ulp_mapper_def_regfile_write(data, + iparms.dir, + reg_idx, + regval)) { + BNXT_TF_DBG(ERR, "Failed to write to default " + "regfile.\n"); + goto error; + } + } + + return 0; +error: + /* Ignore the return code in favor of returning the original error. */ + ulp_mapper_deinit(ulp_ctx); + return rc; +} + +void +ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx) +{ + struct tf_free_identifier_parms free_parms; + struct bnxt_ulp_def_ident_info *dflt_ids; + struct bnxt_ulp_mapper_data *data; + uint32_t i, num_dflt_ids, reg_idx; + enum tf_dir dir; + uint64_t regval; + struct tf *tfp; + + if (!ulp_ctx) { + BNXT_TF_DBG(ERR, + "Failed to acquire ulp context, so data may " + "not be released.\n"); + return; + } + + data = (struct bnxt_ulp_mapper_data *) + bnxt_ulp_cntxt_ptr2_mapper_data_get(ulp_ctx); + if (!data) { + /* Go ahead and return since there is no allocated data. */ + BNXT_TF_DBG(ERR, "No data appears to have been allocated.\n"); + return; + } + + tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx); + if (!tfp) { + BNXT_TF_DBG(ERR, "Failed to acquire tfp.\n"); + /* Free the mapper data regardless of errors. */ + goto free_mapper_data; + } + + /* Free the default prof func ids per direction. */ + dflt_ids = ulp_mapper_def_ident_info_list_get(&num_dflt_ids); + for (i = 0; i < num_dflt_ids; i++) { + reg_idx = dflt_ids[i].def_regfile_index; + dir = dflt_ids[i].direction; + free_parms.ident_type = dflt_ids[i].ident_type; + free_parms.dir = dir; + if (ulp_mapper_def_regfile_read(data, dir, reg_idx, ®val)) { + BNXT_TF_DBG(ERR, "Failed to read def regfile to free " + "identifier.\n"); + continue; + } + /* + * All regfile entries are stored as 64bit big-endian. Need + * to convert the value to cpu before calling tf. + */ + regval = tfp_be_to_cpu_64(regval); + free_parms.id = (uint16_t)regval; + /* Ignore errors and free the remaining identifiers. */ + tf_free_identifier(tfp, &free_parms); + } + +free_mapper_data: + rte_free(data); + /* Reset the data pointer within the ulp_ctx. */ + bnxt_ulp_cntxt_ptr2_mapper_data_set(ulp_ctx, NULL); +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h index 2fa6ffce20..fb47f1c279 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h @@ -6,10 +6,10 @@ #ifndef _ULP_MAPPER_H_ #define _ULP_MAPPER_H_ -#include #include #include #include +#include "tf_core.h" #include "ulp_template_db.h" #include "ulp_template_struct.h" #include "bnxt_ulp.h" @@ -17,6 +17,16 @@ #define ULP_SZ_BITS2BYTES(x) (((x) + 7) / 8) +struct bnxt_ulp_mapper_def_id_entry { + enum tf_identifier_type ident_type; + uint64_t ident; +}; + +struct bnxt_ulp_mapper_data { + struct bnxt_ulp_mapper_def_id_entry + dflt_ids[TF_DIR_MAX][BNXT_ULP_DEF_IDENT_INFO_TBL_MAX_SZ]; +}; + /* Internal Structure for passing the arguments around */ struct bnxt_ulp_mapper_parms { uint32_t dev_id; @@ -36,6 +46,7 @@ struct bnxt_ulp_mapper_parms { uint8_t encap_byte_swap; uint32_t fid; enum bnxt_ulp_flow_db_tables tbl_idx; + struct bnxt_ulp_mapper_data *mapper_data; }; struct bnxt_ulp_mapper_create_parms { @@ -47,8 +58,17 @@ struct bnxt_ulp_mapper_create_parms { uint32_t class_tid; uint32_t act_tid; uint16_t func_id; + enum ulp_direction_type dir; }; +/* Function to initialize any dynamic mapper data. */ +int32_t +ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx); + +/* Function to release all dynamic mapper data. */ +void +ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx); + /* * Function to handle the mapping of the Flow to be compatible * with the underlying hardware. diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c index 25a558a4e0..cd3f65f7a0 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c @@ -297,6 +297,15 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = { } }; +struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] = { + [0] = { + .ident_type = TF_IDENT_TYPE_PROF_FUNC, + .def_regfile_index = + BNXT_ULP_DEF_REGFILE_INDEX_DEF_PROF_FUNC_ID, + .direction = TF_DIR_RX + } +}; + struct bnxt_ulp_device_params ulp_device_params[] = { [BNXT_ULP_DEVICE_ID_WH_PLUS] = { .global_fid_enable = BNXT_ULP_SYM_YES, @@ -577,7 +586,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = { .result_bit_size = 64, .result_num_fields = 13, .ident_start_idx = 0, - .ident_nums = 2, + .ident_nums = 1, .mark_enable = BNXT_ULP_MARK_ENABLE_NO, .critical_resource = 0, .regfile_wr_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED @@ -595,7 +604,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = { .result_start_idx = 13, .result_bit_size = 38, .result_num_fields = 8, - .ident_start_idx = 2, + .ident_start_idx = 1, .ident_nums = 1, .mark_enable = BNXT_ULP_MARK_ENABLE_NO, .critical_resource = 0, @@ -614,6 +623,7 @@ struct bnxt_ulp_mapper_class_tbl_info ulp_class_tbl_list[] = { .result_start_idx = 21, .result_bit_size = 64, .result_num_fields = 9, + .ident_start_idx = 2, .ident_nums = 0, .mark_enable = BNXT_ULP_MARK_ENABLE_YES, .critical_resource = 1, @@ -1088,9 +1098,10 @@ struct bnxt_ulp_mapper_class_key_field_info ulp_class_key_field_list[] = { .mask_opcode = BNXT_ULP_MASK_OPC_SET_TO_CONSTANT, .mask_operand = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - .spec_opcode = BNXT_ULP_SPEC_OPC_SET_TO_REGFILE, - .spec_operand = {(BNXT_ULP_REGFILE_INDEX_PROF_FUNC_ID_0 >> 8) & 0xff, - BNXT_ULP_REGFILE_INDEX_PROF_FUNC_ID_0 & 0xff, + .spec_opcode = BNXT_ULP_SPEC_OPC_SET_TO_DEF_REGFILE, + .spec_operand = { + (BNXT_ULP_DEF_REGFILE_INDEX_DEF_PROF_FUNC_ID >> 8) & 0xff, + BNXT_ULP_DEF_REGFILE_INDEX_DEF_PROF_FUNC_ID & 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, @@ -1256,9 +1267,10 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_result_field_list[] = { }, { .field_bit_size = 7, - .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_REGFILE, - .result_operand = {(BNXT_ULP_REGFILE_INDEX_PROF_FUNC_ID_0 >> 8) & 0xff, - BNXT_ULP_REGFILE_INDEX_PROF_FUNC_ID_0 & 0xff, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_DEF_REGFILE, + .result_operand = { + (BNXT_ULP_DEF_REGFILE_INDEX_DEF_PROF_FUNC_ID >> 8) & 0xff, + BNXT_ULP_DEF_REGFILE_INDEX_DEF_PROF_FUNC_ID & 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, @@ -1441,13 +1453,6 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_result_field_list[] = { }; struct bnxt_ulp_mapper_ident_info ulp_ident_list[] = { - { - .resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER, - .ident_type = TF_IDENT_TYPE_PROF_FUNC, - .regfile_wr_idx = BNXT_ULP_REGFILE_INDEX_PROF_FUNC_ID_0, - .ident_bit_size = 7, - .ident_bit_pos = 47 - }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER, .ident_type = TF_IDENT_TYPE_L2_CTXT, diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h index 94d4253150..cf4ff9f39b 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h @@ -28,6 +28,7 @@ #define BNXT_ULP_ACT_HID_SHFTR 0 #define BNXT_ULP_ACT_HID_SHFTL 23 #define BNXT_ULP_ACT_HID_MASK 255 +#define BNXT_ULP_DEF_IDENT_INFO_TBL_MAX_SZ 1 enum bnxt_ulp_action_bit { BNXT_ULP_ACTION_BIT_MARK = 0x0000000000000001, @@ -112,6 +113,11 @@ enum bnxt_ulp_chf_idx { BNXT_ULP_CHF_IDX_LAST = 14 }; +enum bnxt_ulp_def_regfile_index { + BNXT_ULP_DEF_REGFILE_INDEX_DEF_PROF_FUNC_ID = 0, + BNXT_ULP_DEF_REGFILE_INDEX_LAST = 1 +}; + enum bnxt_ulp_device_id { BNXT_ULP_DEVICE_ID_WH_PLUS = 0, BNXT_ULP_DEVICE_ID_THOR = 1, @@ -120,6 +126,12 @@ enum bnxt_ulp_device_id { BNXT_ULP_DEVICE_ID_LAST = 4 }; +enum bnxt_ulp_direction { + BNXT_ULP_DIRECTION_INGRESS = 0, + BNXT_ULP_DIRECTION_EGRESS = 1, + BNXT_ULP_DIRECTION_LAST = 2 +}; + enum bnxt_ulp_hdr_type { BNXT_ULP_HDR_TYPE_NOT_SUPPORTED = 0, BNXT_ULP_HDR_TYPE_SUPPORTED = 1, @@ -137,8 +149,9 @@ enum bnxt_ulp_mask_opc { BNXT_ULP_MASK_OPC_SET_TO_CONSTANT = 0, BNXT_ULP_MASK_OPC_SET_TO_HDR_FIELD = 1, BNXT_ULP_MASK_OPC_SET_TO_REGFILE = 2, - BNXT_ULP_MASK_OPC_ADD_PAD = 3, - BNXT_ULP_MASK_OPC_LAST = 4 + BNXT_ULP_MASK_OPC_SET_TO_DEF_REGFILE = 3, + BNXT_ULP_MASK_OPC_ADD_PAD = 4, + BNXT_ULP_MASK_OPC_LAST = 5 }; enum bnxt_ulp_match_type { @@ -193,7 +206,8 @@ enum bnxt_ulp_result_opc { BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP = 1, BNXT_ULP_RESULT_OPC_SET_TO_ENCAP_ACT_PROP_SZ = 2, BNXT_ULP_RESULT_OPC_SET_TO_REGFILE = 3, - BNXT_ULP_RESULT_OPC_LAST = 4 + BNXT_ULP_RESULT_OPC_SET_TO_DEF_REGFILE = 4, + BNXT_ULP_RESULT_OPC_LAST = 5 }; enum bnxt_ulp_search_before_alloc { @@ -206,8 +220,9 @@ enum bnxt_ulp_spec_opc { BNXT_ULP_SPEC_OPC_SET_TO_CONSTANT = 0, BNXT_ULP_SPEC_OPC_SET_TO_HDR_FIELD = 1, BNXT_ULP_SPEC_OPC_SET_TO_REGFILE = 2, - BNXT_ULP_SPEC_OPC_ADD_PAD = 3, - BNXT_ULP_SPEC_OPC_LAST = 4 + BNXT_ULP_SPEC_OPC_SET_TO_DEF_REGFILE = 3, + BNXT_ULP_SPEC_OPC_ADD_PAD = 4, + BNXT_ULP_SPEC_OPC_LAST = 5 }; enum bnxt_ulp_encap_vtag_encoding { diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h index c2d3ccb3ef..476d5b9bb3 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h @@ -222,6 +222,12 @@ struct bnxt_ulp_mapper_ident_info { enum bnxt_ulp_regfile_index regfile_wr_idx; }; +struct bnxt_ulp_def_ident_info { + enum tf_dir direction; + enum tf_identifier_type ident_type; + enum bnxt_ulp_def_regfile_index def_regfile_index; +}; + /* * Flow Mapper Static Data Externs: * Access to the below static data should be done through access functions and @@ -285,4 +291,9 @@ extern struct bnxt_ulp_mapper_ident_info ulp_ident_list[]; */ extern uint32_t ulp_act_prop_map_table[]; +/* + * The ulp_def_ident_tbl provides the list of default identifiers that need to + * be initialized and where to store them. + */ +extern struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[]; #endif /* _ULP_TEMPLATE_STRUCT_H_ */ -- 2.20.1