From: Mike Baucom Date: Wed, 15 Apr 2020 08:18:56 +0000 (+0530) Subject: net/bnxt: support process action tables X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=696843cc62ab8f67eebf3447db658c97cc6ddc5e;p=dpdk.git net/bnxt: support process action tables This patch processes the action template. Iterates through the list of action info templates and processes it. Signed-off-by: Mike Baucom Signed-off-by: Kishore Padmanabha Signed-off-by: Venkat Duvvuru Reviewed-by: Lance Richardson --- diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile index 4e0dea1194..f464d9eafb 100644 --- a/drivers/net/bnxt/Makefile +++ b/drivers/net/bnxt/Makefile @@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mark_mgr.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_flow_db.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_template_db.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_utils.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mapper.c # # Export include files diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index 3dd39c102e..6e73f25042 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -7,7 +7,68 @@ #include "bnxt.h" #include "bnxt_tf_common.h" #include "ulp_flow_db.h" +#include "ulp_utils.h" #include "ulp_template_struct.h" +#include "ulp_mapper.h" + +#define ULP_FLOW_DB_RES_DIR_BIT 31 +#define ULP_FLOW_DB_RES_DIR_MASK 0x80000000 +#define ULP_FLOW_DB_RES_FUNC_BITS 28 +#define ULP_FLOW_DB_RES_FUNC_MASK 0x70000000 +#define ULP_FLOW_DB_RES_NXT_MASK 0x0FFFFFFF + +/* Macro to copy the nxt_resource_idx */ +#define ULP_FLOW_DB_RES_NXT_SET(dst, src) {(dst) |= ((src) &\ + ULP_FLOW_DB_RES_NXT_MASK); } +#define ULP_FLOW_DB_RES_NXT_RESET(dst) ((dst) &= ~(ULP_FLOW_DB_RES_NXT_MASK)) + +/* + * Helper function to allocate the flow table and initialize + * is set.No validation being done in this function. + * + * flow_tbl [in] Ptr to flow table + * idx [in] The index to bit to be set or reset. + * + * returns 1 on set or 0 if not set. + */ +static int32_t +ulp_flow_db_active_flow_is_set(struct bnxt_ulp_flow_tbl *flow_tbl, + uint32_t idx) +{ + uint32_t active_index; + + active_index = idx / ULP_INDEX_BITMAP_SIZE; + return ULP_INDEX_BITMAP_GET(flow_tbl->active_flow_tbl[active_index], + idx); +} + +/* + * Helper function to copy the resource params to resource info + * No validation being done in this function. + * + * resource_info [out] Ptr to resource information + * params [in] The input params from the caller + * returns none + */ +static void +ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info, + struct ulp_flow_db_res_params *params) +{ + resource_info->nxt_resource_idx |= ((params->direction << + ULP_FLOW_DB_RES_DIR_BIT) & + ULP_FLOW_DB_RES_DIR_MASK); + resource_info->nxt_resource_idx |= ((params->resource_func << + ULP_FLOW_DB_RES_FUNC_BITS) & + ULP_FLOW_DB_RES_FUNC_MASK); + + if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) { + resource_info->resource_hndl = (uint32_t)params->resource_hndl; + resource_info->resource_type = params->resource_type; + + } else { + resource_info->resource_em_handle = params->resource_hndl; + } +} /* * Helper function to allocate the flow table and initialize @@ -185,3 +246,78 @@ int32_t ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt) return 0; } + +/* + * Allocate the flow database entry. + * The params->critical_resource has to be set to 0 to allocate a new resource. + * + * ulp_ctxt [in] Ptr to ulp_context + * tbl_idx [in] Specify it is regular or default flow + * fid [in] The index to the flow entry + * params [in] The contents to be copied into resource + * + * returns 0 on success and negative on failure. + */ +int32_t ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt, + enum bnxt_ulp_flow_db_tables tbl_idx, + uint32_t fid, + struct ulp_flow_db_res_params *params) +{ + struct bnxt_ulp_flow_db *flow_db; + struct bnxt_ulp_flow_tbl *flow_tbl; + struct ulp_fdb_resource_info *resource, *fid_resource; + uint32_t idx; + + flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt); + if (!flow_db) { + BNXT_TF_DBG(ERR, "Invalid Arguments\n"); + return -EINVAL; + } + + if (tbl_idx >= BNXT_ULP_FLOW_TABLE_MAX) { + BNXT_TF_DBG(ERR, "Invalid table index\n"); + return -EINVAL; + } + flow_tbl = &flow_db->flow_tbl[tbl_idx]; + + /* check for max flows */ + if (fid >= flow_tbl->num_flows || !fid) { + BNXT_TF_DBG(ERR, "Invalid flow index\n"); + return -EINVAL; + } + + /* check if the flow is active or not */ + if (!ulp_flow_db_active_flow_is_set(flow_tbl, fid)) { + BNXT_TF_DBG(ERR, "flow does not exist\n"); + return -EINVAL; + } + + /* check for max resource */ + if ((flow_tbl->num_flows + 1) >= flow_tbl->tail_index) { + BNXT_TF_DBG(ERR, "Flow db has reached max resources\n"); + return -ENOMEM; + } + fid_resource = &flow_tbl->flow_resources[fid]; + + if (!params->critical_resource) { + /* Not the critical_resource so allocate a resource */ + idx = flow_tbl->flow_tbl_stack[flow_tbl->tail_index]; + resource = &flow_tbl->flow_resources[idx]; + flow_tbl->tail_index--; + + /* Update the chain list of resource*/ + ULP_FLOW_DB_RES_NXT_SET(resource->nxt_resource_idx, + fid_resource->nxt_resource_idx); + /* update the contents */ + ulp_flow_db_res_params_to_info(resource, params); + ULP_FLOW_DB_RES_NXT_RESET(fid_resource->nxt_resource_idx); + ULP_FLOW_DB_RES_NXT_SET(fid_resource->nxt_resource_idx, + idx); + } else { + /* critical resource. Just update the fid resource */ + ulp_flow_db_res_params_to_info(fid_resource, params); + } + + /* all good, return success */ + return 0; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h index a2ee8fa2f4..f6055a56b9 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h @@ -53,6 +53,15 @@ struct bnxt_ulp_flow_db { struct bnxt_ulp_flow_tbl flow_tbl[BNXT_ULP_FLOW_TABLE_MAX]; }; +/* flow db resource params to add resources */ +struct ulp_flow_db_res_params { + enum tf_dir direction; + enum bnxt_ulp_resource_func resource_func; + uint64_t resource_hndl; + uint32_t resource_type; + uint32_t critical_resource; +}; + /* * Initialize the flow database. Memory is allocated in this * call and assigned to the flow database. @@ -74,4 +83,20 @@ int32_t ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt); */ int32_t ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt); +/* + * Allocate the flow database entry. + * The params->critical_resource has to be set to 0 to allocate a new resource. + * + * ulp_ctxt [in] Ptr to ulp_context + * tbl_idx [in] Specify it is regular or default flow + * fid [in] The index to the flow entry + * params [in] The contents to be copied into resource + * + * returns 0 on success and negative on failure. + */ +int32_t ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt, + enum bnxt_ulp_flow_db_tables tbl_idx, + uint32_t fid, + struct ulp_flow_db_res_params *params); + #endif /* _ULP_FLOW_DB_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c new file mode 100644 index 0000000000..e6e4e41b4a --- /dev/null +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -0,0 +1,364 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2014-2020 Broadcom + * All rights reserved. + */ + +#include +#include "bnxt.h" +#include "ulp_template_db.h" +#include "ulp_template_struct.h" +#include "bnxt_tf_common.h" +#include "ulp_utils.h" +#include "bnxt_ulp.h" +#include "tfp.h" +#include "tf_ext_flow_handle.h" +#include "ulp_mark_mgr.h" +#include "ulp_flow_db.h" +#include "ulp_mapper.h" + +int32_t +ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms); + +/* + * Get the size of the action property for a given index. + * + * idx [in] The index for the action property + * + * returns the size of the action property. + */ +static uint32_t +ulp_mapper_act_prop_size_get(uint32_t idx) +{ + if (idx >= BNXT_ULP_ACT_PROP_IDX_LAST) + return 0; + return ulp_act_prop_map_table[idx]; +} + +/* + * Get the list of result fields that implement the flow action + * + * tbl [in] A single table instance to get the results fields + * from num_flds [out] The number of data fields in the returned + * array + * returns array of data fields, or NULL on error + */ +static struct bnxt_ulp_mapper_result_field_info * +ulp_mapper_act_result_fields_get(struct bnxt_ulp_mapper_act_tbl_info *tbl, + uint32_t *num_rslt_flds, + uint32_t *num_encap_flds) +{ + uint32_t idx; + + if (!tbl || !num_rslt_flds || !num_encap_flds) + return NULL; + + idx = tbl->result_start_idx; + *num_rslt_flds = tbl->result_num_fields; + *num_encap_flds = tbl->encap_num_fields; + + /* NOTE: Need template to provide range checking define */ + return &ulp_act_result_field_list[idx]; +} + +static int32_t +ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms, + struct bnxt_ulp_mapper_result_field_info *fld, + struct ulp_blob *blob) +{ + uint16_t idx, size_idx; + uint8_t *val = NULL; + uint64_t regval; + uint32_t val_size = 0, field_size = 0; + + switch (fld->result_opcode) { + case BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT: + val = fld->result_operand; + if (!ulp_blob_push(blob, val, fld->field_bit_size)) { + BNXT_TF_DBG(ERR, "Failed to add field\n"); + return -EINVAL; + } + break; + case BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP: + if (!ulp_operand_read(fld->result_operand, + (uint8_t *)&idx, sizeof(uint16_t))) { + BNXT_TF_DBG(ERR, "operand read failed\n"); + return -EINVAL; + } + idx = tfp_be_to_cpu_16(idx); + + if (idx >= BNXT_ULP_ACT_PROP_IDX_LAST) { + BNXT_TF_DBG(ERR, "act_prop[%d] oob\n", idx); + return -EINVAL; + } + val = &parms->act_prop->act_details[idx]; + field_size = ulp_mapper_act_prop_size_get(idx); + if (fld->field_bit_size < ULP_BYTE_2_BITS(field_size)) { + field_size = field_size - + ((fld->field_bit_size + 7) / 8); + val += field_size; + } + if (!ulp_blob_push(blob, val, fld->field_bit_size)) { + BNXT_TF_DBG(ERR, "push field failed\n"); + return -EINVAL; + } + break; + case BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP_SZ: + if (!ulp_operand_read(fld->result_operand, + (uint8_t *)&idx, sizeof(uint16_t))) { + BNXT_TF_DBG(ERR, "operand read failed\n"); + return -EINVAL; + } + idx = tfp_be_to_cpu_16(idx); + + if (idx >= BNXT_ULP_ACT_PROP_IDX_LAST) { + BNXT_TF_DBG(ERR, "act_prop[%d] oob\n", idx); + return -EINVAL; + } + val = &parms->act_prop->act_details[idx]; + + /* get the size index next */ + if (!ulp_operand_read(&fld->result_operand[sizeof(uint16_t)], + (uint8_t *)&size_idx, sizeof(uint16_t))) { + BNXT_TF_DBG(ERR, "operand read failed\n"); + return -EINVAL; + } + size_idx = tfp_be_to_cpu_16(size_idx); + + if (size_idx >= BNXT_ULP_ACT_PROP_IDX_LAST) { + BNXT_TF_DBG(ERR, "act_prop[%d] oob\n", size_idx); + return -EINVAL; + } + memcpy(&val_size, &parms->act_prop->act_details[size_idx], + sizeof(uint32_t)); + val_size = tfp_be_to_cpu_32(val_size); + val_size = ULP_BYTE_2_BITS(val_size); + ulp_blob_push_encap(blob, val, val_size); + break; + case BNXT_ULP_RESULT_OPC_SET_TO_REGFILE: + if (!ulp_operand_read(fld->result_operand, + (uint8_t *)&idx, sizeof(uint16_t))) { + BNXT_TF_DBG(ERR, "operand read failed\n"); + return -EINVAL; + } + + idx = tfp_be_to_cpu_16(idx); + /* Uninitialized regfile entries return 0 */ + if (!ulp_regfile_read(parms->regfile, idx, ®val)) { + BNXT_TF_DBG(ERR, "regfile[%d] read oob\n", idx); + return -EINVAL; + } + + val = ulp_blob_push_64(blob, ®val, fld->field_bit_size); + if (!val) { + BNXT_TF_DBG(ERR, "push field failed\n"); + return -EINVAL; + } + break; + default: + return -EINVAL; + } + + return 0; +} + +/* Function to alloc action record and set the table. */ +static int32_t +ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, + struct ulp_blob *blob) +{ + struct ulp_flow_db_res_params fid_parms; + struct tf_alloc_tbl_entry_parms alloc_parms = { 0 }; + struct tf_free_tbl_entry_parms free_parms = { 0 }; + struct bnxt_ulp_mapper_act_tbl_info *atbls = parms->atbls; + int32_t rc = 0; + int32_t trc; + uint64_t idx; + + /* Set the allocation parameters for the table*/ + alloc_parms.dir = atbls->direction; + alloc_parms.type = atbls->table_type; + alloc_parms.search_enable = atbls->srch_b4_alloc; + alloc_parms.result = ulp_blob_data_get(blob, + &alloc_parms.result_sz_in_bytes); + if (!alloc_parms.result) { + BNXT_TF_DBG(ERR, "blob is not populated\n"); + return -EINVAL; + } + + rc = tf_alloc_tbl_entry(parms->tfp, &alloc_parms); + if (rc) { + BNXT_TF_DBG(ERR, "table type= [%d] dir = [%s] alloc failed\n", + alloc_parms.type, + (alloc_parms.dir == TF_DIR_RX) ? "RX" : "TX"); + return rc; + } + + /* Need to calculate the idx for the result record */ + /* + * TBD: Need to get the stride from tflib instead of having to + * understand the construction of the pointer + */ + uint64_t tmpidx = alloc_parms.idx; + + if (atbls->table_type == TF_TBL_TYPE_EXT) + tmpidx = (alloc_parms.idx * TF_ACTION_RECORD_SZ) >> 4; + else + tmpidx = alloc_parms.idx; + + idx = tfp_cpu_to_be_64(tmpidx); + + /* Store the allocated index for future use in the regfile */ + rc = ulp_regfile_write(parms->regfile, atbls->regfile_wr_idx, idx); + if (!rc) { + BNXT_TF_DBG(ERR, "regfile[%d] write failed\n", + atbls->regfile_wr_idx); + rc = -EINVAL; + goto error; + } + + /* + * The set_tbl_entry API if search is not enabled or searched entry + * is not found. + */ + if (!atbls->srch_b4_alloc || !alloc_parms.hit) { + struct tf_set_tbl_entry_parms set_parm = { 0 }; + uint16_t length; + + set_parm.dir = atbls->direction; + set_parm.type = atbls->table_type; + set_parm.idx = alloc_parms.idx; + set_parm.data = ulp_blob_data_get(blob, &length); + set_parm.data_sz_in_bytes = length / 8; + + if (set_parm.type == TF_TBL_TYPE_EXT) + bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, + &set_parm.tbl_scope_id); + else + set_parm.tbl_scope_id = 0; + + /* set the table entry */ + rc = tf_set_tbl_entry(parms->tfp, &set_parm); + if (rc) { + BNXT_TF_DBG(ERR, "table[%d][%s][%d] set failed\n", + set_parm.type, + (set_parm.dir == TF_DIR_RX) ? "RX" : "TX", + set_parm.idx); + goto error; + } + } + + /* Link the resource to the flow in the flow db */ + memset(&fid_parms, 0, sizeof(fid_parms)); + fid_parms.direction = atbls->direction; + fid_parms.resource_func = atbls->resource_func; + fid_parms.resource_type = atbls->table_type; + fid_parms.resource_hndl = alloc_parms.idx; + fid_parms.critical_resource = 0; + + rc = ulp_flow_db_resource_add(parms->ulp_ctx, + parms->tbl_idx, + parms->fid, + &fid_parms); + if (rc) { + BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n", + rc); + rc = -EINVAL; + goto error; + } + + return 0; +error: + + free_parms.dir = alloc_parms.dir; + free_parms.type = alloc_parms.type; + free_parms.idx = alloc_parms.idx; + + trc = tf_free_tbl_entry(parms->tfp, &free_parms); + if (trc) + BNXT_TF_DBG(ERR, "Failed to free table entry on failure\n"); + + return rc; +} + +/* + * Function to process the action Info. Iterate through the list + * action info templates and process it. + */ +static int32_t +ulp_mapper_action_info_process(struct bnxt_ulp_mapper_parms *parms, + struct bnxt_ulp_mapper_act_tbl_info *tbl) +{ + struct ulp_blob blob; + struct bnxt_ulp_mapper_result_field_info *flds, *fld; + uint32_t num_flds = 0; + uint32_t encap_flds = 0; + uint32_t i; + int32_t rc; + uint16_t bit_size; + + if (!tbl || !parms->act_prop || !parms->act_bitmap || !parms->regfile) + return -EINVAL; + + /* use the max size if encap is enabled */ + if (tbl->encap_num_fields) + bit_size = BNXT_ULP_FLMP_BLOB_SIZE_IN_BITS; + else + bit_size = tbl->result_bit_size; + if (!ulp_blob_init(&blob, bit_size, parms->order)) { + BNXT_TF_DBG(ERR, "action blob init failed\n"); + return -EINVAL; + } + + flds = ulp_mapper_act_result_fields_get(tbl, &num_flds, &encap_flds); + if (!flds || !num_flds) { + BNXT_TF_DBG(ERR, "Template undefined for action\n"); + return -EINVAL; + } + + for (i = 0; i < (num_flds + encap_flds); i++) { + fld = &flds[i]; + rc = ulp_mapper_result_field_process(parms, + fld, + &blob); + if (rc) { + BNXT_TF_DBG(ERR, "Action field failed\n"); + return rc; + } + /* set the swap index if 64 bit swap is enabled */ + if (parms->encap_byte_swap && encap_flds) { + if ((i + 1) == num_flds) + ulp_blob_encap_swap_idx_set(&blob); + /* if 64 bit swap is enabled perform the 64bit swap */ + if ((i + 1) == (num_flds + encap_flds)) + ulp_blob_perform_encap_swap(&blob); + } + } + + rc = ulp_mapper_action_alloc_and_set(parms, &blob); + return rc; +} + +/* + * Function to process the action template. Iterate through the list + * action info templates and process it. + */ +int32_t +ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms) +{ + uint32_t i; + int32_t rc = 0; + + if (!parms->atbls || !parms->num_atbls) { + BNXT_TF_DBG(ERR, "No action tables for template[%d][%d].\n", + parms->dev_id, parms->act_tid); + return -EINVAL; + } + + for (i = 0; i < parms->num_atbls; i++) { + rc = ulp_mapper_action_info_process(parms, &parms->atbls[i]); + if (rc) + return rc; + } + + return rc; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h new file mode 100644 index 0000000000..adbcec2b82 --- /dev/null +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2014-2019 Broadcom + * All rights reserved. + */ + +#ifndef _ULP_MAPPER_H_ +#define _ULP_MAPPER_H_ + +#include +#include +#include +#include +#include "ulp_template_db.h" +#include "ulp_template_struct.h" +#include "bnxt_ulp.h" +#include "ulp_utils.h" + +/* Internal Structure for passing the arguments around */ +struct bnxt_ulp_mapper_parms { + uint32_t dev_id; + enum bnxt_ulp_byte_order order; + uint32_t act_tid; + struct bnxt_ulp_mapper_act_tbl_info *atbls; + uint32_t num_atbls; + uint32_t class_tid; + struct bnxt_ulp_mapper_class_tbl_info *ctbls; + uint32_t num_ctbls; + struct ulp_rte_act_prop *act_prop; + struct ulp_rte_act_bitmap *act_bitmap; + struct ulp_rte_hdr_field *hdr_field; + struct ulp_regfile *regfile; + struct tf *tfp; + struct bnxt_ulp_context *ulp_ctx; + uint8_t encap_byte_swap; + uint32_t fid; + enum bnxt_ulp_flow_db_tables tbl_idx; +}; + +#endif /* _ULP_MAPPER_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c index 96706354e3..fc77800dde 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c @@ -11,6 +11,89 @@ #include "ulp_template_db.h" #include "ulp_template_struct.h" +uint32_t ulp_act_prop_map_table[] = { + [BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN_SZ] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN_SZ, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SZ] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SZ, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG_SZ] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG_SZ, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG_TYPE] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG_TYPE, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG_NUM] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG_NUM, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_L3_TYPE] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_L3_TYPE, + [BNXT_ULP_ACT_PROP_IDX_MPLS_POP_NUM] = + BNXT_ULP_ACT_PROP_SZ_MPLS_POP_NUM, + [BNXT_ULP_ACT_PROP_IDX_MPLS_PUSH_NUM] = + BNXT_ULP_ACT_PROP_SZ_MPLS_PUSH_NUM, + [BNXT_ULP_ACT_PROP_IDX_VNIC] = + BNXT_ULP_ACT_PROP_SZ_VNIC, + [BNXT_ULP_ACT_PROP_IDX_VPORT] = + BNXT_ULP_ACT_PROP_SZ_VPORT, + [BNXT_ULP_ACT_PROP_IDX_MARK] = + BNXT_ULP_ACT_PROP_SZ_MARK, + [BNXT_ULP_ACT_PROP_IDX_COUNT] = + BNXT_ULP_ACT_PROP_SZ_COUNT, + [BNXT_ULP_ACT_PROP_IDX_METER] = + BNXT_ULP_ACT_PROP_SZ_METER, + [BNXT_ULP_ACT_PROP_IDX_SET_MAC_SRC] = + BNXT_ULP_ACT_PROP_SZ_SET_MAC_SRC, + [BNXT_ULP_ACT_PROP_IDX_SET_MAC_DST] = + BNXT_ULP_ACT_PROP_SZ_SET_MAC_DST, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_VLAN] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_VLAN, + [BNXT_ULP_ACT_PROP_IDX_OF_SET_VLAN_PCP] = + BNXT_ULP_ACT_PROP_SZ_OF_SET_VLAN_PCP, + [BNXT_ULP_ACT_PROP_IDX_OF_SET_VLAN_VID] = + BNXT_ULP_ACT_PROP_SZ_OF_SET_VLAN_VID, + [BNXT_ULP_ACT_PROP_IDX_SET_IPV4_SRC] = + BNXT_ULP_ACT_PROP_SZ_SET_IPV4_SRC, + [BNXT_ULP_ACT_PROP_IDX_SET_IPV4_DST] = + BNXT_ULP_ACT_PROP_SZ_SET_IPV4_DST, + [BNXT_ULP_ACT_PROP_IDX_SET_IPV6_SRC] = + BNXT_ULP_ACT_PROP_SZ_SET_IPV6_SRC, + [BNXT_ULP_ACT_PROP_IDX_SET_IPV6_DST] = + BNXT_ULP_ACT_PROP_SZ_SET_IPV6_DST, + [BNXT_ULP_ACT_PROP_IDX_SET_TP_SRC] = + BNXT_ULP_ACT_PROP_SZ_SET_TP_SRC, + [BNXT_ULP_ACT_PROP_IDX_SET_TP_DST] = + BNXT_ULP_ACT_PROP_SZ_SET_TP_DST, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_0] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_0, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_1] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_1, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_2] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_2, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_3] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_3, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_4] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_4, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_5] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_5, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_6] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_6, + [BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_7] = + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_7, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_DMAC] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_L2_DMAC, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_SMAC] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_L2_SMAC, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_IP] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_IP, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SRC, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_UDP, + [BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN] = + BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN, + [BNXT_ULP_ACT_PROP_IDX_LAST] = + BNXT_ULP_ACT_PROP_SZ_LAST +}; + struct bnxt_ulp_device_params ulp_device_params[] = { [BNXT_ULP_DEVICE_ID_WH_PLUS] = { .global_fid_enable = BNXT_ULP_SYM_YES, @@ -25,3 +108,165 @@ struct bnxt_ulp_device_params ulp_device_params[] = { .num_resources_per_flow = 8 } }; + +struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[] = { + { + .field_bit_size = 14, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 8, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 11, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 10, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 16, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 10, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 16, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 10, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 4, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {BNXT_ULP_SYM_DECAP_FUNC_NONE, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 12, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP, + .result_operand = {(BNXT_ULP_ACT_PROP_IDX_VNIC >> 8) & 0xff, + BNXT_ULP_ACT_PROP_IDX_VNIC & 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 2, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + }, + { + .field_bit_size = 1, + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, + .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + } +}; diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h index 1eed8287c4..e52cc3f907 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h @@ -39,9 +39,113 @@ enum bnxt_ulp_regfile_index { BNXT_ULP_REGFILE_INDEX_LAST }; +enum bnxt_ulp_resource_func { + BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0, + BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 1, + BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 2, + BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 3, + BNXT_ULP_RESOURCE_FUNC_HW_FID = 4, + BNXT_ULP_RESOURCE_FUNC_LAST = 5 +}; + +enum bnxt_ulp_result_opc { + BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT = 0, + BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP = 1, + BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP_SZ = 2, + BNXT_ULP_RESULT_OPC_SET_TO_REGFILE = 3, + BNXT_ULP_RESULT_OPC_LAST = 4 +}; + enum bnxt_ulp_sym { + BNXT_ULP_SYM_DECAP_FUNC_NONE = 0, BNXT_ULP_SYM_LITTLE_ENDIAN = 1, BNXT_ULP_SYM_YES = 1 }; +enum bnxt_ulp_act_prop_sz { + BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN_SZ = 4, + BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SZ = 4, + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG_SZ = 4, + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG_TYPE = 4, + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG_NUM = 4, + BNXT_ULP_ACT_PROP_SZ_ENCAP_L3_TYPE = 4, + BNXT_ULP_ACT_PROP_SZ_MPLS_POP_NUM = 4, + BNXT_ULP_ACT_PROP_SZ_MPLS_PUSH_NUM = 4, + BNXT_ULP_ACT_PROP_SZ_VNIC = 4, + BNXT_ULP_ACT_PROP_SZ_VPORT = 4, + BNXT_ULP_ACT_PROP_SZ_MARK = 4, + BNXT_ULP_ACT_PROP_SZ_COUNT = 4, + BNXT_ULP_ACT_PROP_SZ_METER = 4, + BNXT_ULP_ACT_PROP_SZ_SET_MAC_SRC = 8, + BNXT_ULP_ACT_PROP_SZ_SET_MAC_DST = 8, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_VLAN = 4, + BNXT_ULP_ACT_PROP_SZ_OF_SET_VLAN_PCP = 4, + BNXT_ULP_ACT_PROP_SZ_OF_SET_VLAN_VID = 4, + BNXT_ULP_ACT_PROP_SZ_SET_IPV4_SRC = 4, + BNXT_ULP_ACT_PROP_SZ_SET_IPV4_DST = 4, + BNXT_ULP_ACT_PROP_SZ_SET_IPV6_SRC = 16, + BNXT_ULP_ACT_PROP_SZ_SET_IPV6_DST = 16, + BNXT_ULP_ACT_PROP_SZ_SET_TP_SRC = 4, + BNXT_ULP_ACT_PROP_SZ_SET_TP_DST = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_0 = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_1 = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_2 = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_3 = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_4 = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_5 = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_6 = 4, + BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_7 = 4, + BNXT_ULP_ACT_PROP_SZ_ENCAP_L2_DMAC = 6, + BNXT_ULP_ACT_PROP_SZ_ENCAP_L2_SMAC = 6, + BNXT_ULP_ACT_PROP_SZ_ENCAP_VTAG = 8, + BNXT_ULP_ACT_PROP_SZ_ENCAP_IP = 32, + BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SRC = 16, + BNXT_ULP_ACT_PROP_SZ_ENCAP_UDP = 4, + BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN = 32, + BNXT_ULP_ACT_PROP_SZ_LAST = 4 +}; + +enum bnxt_ulp_act_prop_idx { + BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN_SZ = 0, + BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SZ = 4, + BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG_SZ = 8, + BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG_TYPE = 12, + BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG_NUM = 16, + BNXT_ULP_ACT_PROP_IDX_ENCAP_L3_TYPE = 20, + BNXT_ULP_ACT_PROP_IDX_MPLS_POP_NUM = 24, + BNXT_ULP_ACT_PROP_IDX_MPLS_PUSH_NUM = 28, + BNXT_ULP_ACT_PROP_IDX_VNIC = 32, + BNXT_ULP_ACT_PROP_IDX_VPORT = 36, + BNXT_ULP_ACT_PROP_IDX_MARK = 40, + BNXT_ULP_ACT_PROP_IDX_COUNT = 44, + BNXT_ULP_ACT_PROP_IDX_METER = 48, + BNXT_ULP_ACT_PROP_IDX_SET_MAC_SRC = 52, + BNXT_ULP_ACT_PROP_IDX_SET_MAC_DST = 60, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_VLAN = 68, + BNXT_ULP_ACT_PROP_IDX_OF_SET_VLAN_PCP = 72, + BNXT_ULP_ACT_PROP_IDX_OF_SET_VLAN_VID = 76, + BNXT_ULP_ACT_PROP_IDX_SET_IPV4_SRC = 80, + BNXT_ULP_ACT_PROP_IDX_SET_IPV4_DST = 84, + BNXT_ULP_ACT_PROP_IDX_SET_IPV6_SRC = 88, + BNXT_ULP_ACT_PROP_IDX_SET_IPV6_DST = 104, + BNXT_ULP_ACT_PROP_IDX_SET_TP_SRC = 120, + BNXT_ULP_ACT_PROP_IDX_SET_TP_DST = 124, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_0 = 128, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_1 = 132, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_2 = 136, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_3 = 140, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_4 = 144, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_5 = 148, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_6 = 152, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_7 = 156, + BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_DMAC = 160, + BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_SMAC = 166, + BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG = 172, + BNXT_ULP_ACT_PROP_IDX_ENCAP_IP = 180, + BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 212, + BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 228, + BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 232, + BNXT_ULP_ACT_PROP_IDX_LAST = 264 +}; + #endif /* _ULP_TEMPLATE_DB_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h index 4b9d0b22cf..2b0a3d7126 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h @@ -17,7 +17,15 @@ #include "rte_flow.h" #include "tf_core.h" -/* Device specific parameters. */ +/* + * structure to hold the action property details + * It is a array of 128 bytes + */ +struct ulp_rte_act_prop { + uint8_t act_details[BNXT_ULP_ACT_PROP_IDX_LAST]; +}; + +/* Device specific parameters */ struct bnxt_ulp_device_params { uint8_t description[16]; uint32_t global_fid_enable; @@ -31,10 +39,44 @@ struct bnxt_ulp_device_params { uint32_t num_resources_per_flow; }; +struct bnxt_ulp_mapper_act_tbl_info { + enum bnxt_ulp_resource_func resource_func; + enum tf_tbl_type table_type; + uint8_t direction; + uint8_t srch_b4_alloc; + uint32_t result_start_idx; + uint16_t result_bit_size; + uint16_t encap_num_fields; + uint16_t result_num_fields; + + enum bnxt_ulp_regfile_index regfile_wr_idx; +}; + +struct bnxt_ulp_mapper_result_field_info { + uint8_t name[64]; + enum bnxt_ulp_result_opc result_opcode; + uint16_t field_bit_size; + uint8_t result_operand[16]; +}; + /* - * The ulp_device_params is indexed by the dev_id. - * This table maintains the device specific parameters. + * 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_data_field_list provides the instructions for creating an action + * record. It uses the same structure as the result list, but is only used for + * actions. + */ +extern +struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[]; + +/* + * The ulp_act_prop_map_table provides the mapping to index and size of action + * properties. + */ +extern uint32_t ulp_act_prop_map_table[]; + #endif /* _ULP_TEMPLATE_STRUCT_H_ */