From patchwork Thu Jul 2 04:11:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 72756 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89F01A0523; Thu, 2 Jul 2020 06:19:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B81F61D700; Thu, 2 Jul 2020 06:12:41 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 394771C1A2 for ; Thu, 2 Jul 2020 06:11:50 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 7FE0B30C0D1; Wed, 1 Jul 2020 21:11:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 7FE0B30C0D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1593663109; bh=qPm4qDIF2Nqja/qAACYlcZw2HOxP7c1O+EC/6/+BKwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUpPBSwBge/DKLyQ5OXzQEGlr7v8lEn23wF5rjqGg5D0//angC3nu8jVzNeKiKvn4 37sWtdQ9eISqoL7bLEblDsT0bYzVcSVw6fI/oDt2KA+7VXDdLUmrzAWMxll3XYyy8n x/AhUmw2i9mg+ttTAMJdQT3ZE0KJucSNDc99CrF8= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id E426114008B; Wed, 1 Jul 2020 21:11:48 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru , Somnath Kotur Date: Wed, 1 Jul 2020 21:11:19 -0700 Message-Id: <20200702041134.43198-37-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200702041134.43198-1-ajit.khaparde@broadcom.com> References: <1f5421dc-0453-6dc8-09c2-ddfff6eb4888@intel.com> <20200702041134.43198-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 36/51] net/bnxt: add index opcode and operand to mapper table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kishore Padmanabha Extended the regfile and computed field operations to a common index opcode operation and added globlal resource operations are also part of the index opcode operation. Signed-off-by: Kishore Padmanabha Signed-off-by: Venkat Duvvuru Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 56 ++++++++++++++++--- drivers/net/bnxt/tf_ulp/ulp_template_db_act.c | 9 ++- .../net/bnxt/tf_ulp/ulp_template_db_class.c | 45 +++++---------- .../net/bnxt/tf_ulp/ulp_template_db_enum.h | 8 +++ drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 4 +- 5 files changed, 80 insertions(+), 42 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 42bb98557..7b3b3d698 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -1443,7 +1443,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, struct bnxt_ulp_mapper_result_field_info *flds; struct ulp_flow_db_res_params fid_parms; struct ulp_blob data; - uint64_t idx; + uint64_t idx = 0; uint16_t tmplen; uint32_t i, num_flds; int32_t rc = 0, trc = 0; @@ -1516,6 +1516,42 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, #endif } + /* + * Check for index opcode, if it is Global then + * no need to allocate the table, just set the table + * and exit since it is not maintained in the flow db. + */ + if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_GLOBAL) { + /* get the index from index operand */ + if (tbl->index_operand < BNXT_ULP_GLB_REGFILE_INDEX_LAST && + ulp_mapper_glb_resource_read(parms->mapper_data, + tbl->direction, + tbl->index_operand, + &idx)) { + BNXT_TF_DBG(ERR, "Glbl regfile[%d] read failed.\n", + tbl->index_operand); + return -EINVAL; + } + /* set the Tf index table */ + sparms.dir = tbl->direction; + sparms.type = tbl->resource_type; + sparms.data = ulp_blob_data_get(&data, &tmplen); + sparms.data_sz_in_bytes = ULP_BITS_2_BYTE(tmplen); + sparms.idx = tfp_be_to_cpu_64(idx); + sparms.tbl_scope_id = tbl_scope_id; + + rc = tf_set_tbl_entry(tfp, &sparms); + if (rc) { + BNXT_TF_DBG(ERR, + "Glbl Set table[%d][%s][%d] failed rc=%d\n", + sparms.type, + (sparms.dir == TF_DIR_RX) ? "RX" : "TX", + sparms.idx, + rc); + return rc; + } + return 0; /* success */ + } /* Perform the tf table allocation by filling the alloc params */ aparms.dir = tbl->direction; aparms.type = tbl->resource_type; @@ -1546,11 +1582,13 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, /* Always storing values in Regfile in BE */ idx = tfp_cpu_to_be_64(idx); - rc = ulp_regfile_write(parms->regfile, tbl->regfile_idx, idx); - if (!rc) { - BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n", - tbl->regfile_idx); - goto error; + if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_ALLOCATE) { + rc = ulp_regfile_write(parms->regfile, tbl->index_operand, idx); + if (!rc) { + BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n", + tbl->index_operand); + goto error; + } } /* Perform the tf table set by filling the set params */ @@ -1815,7 +1853,11 @@ ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms, } /* Get the index details from computed field */ - idx = ULP_COMP_FLD_IDX_RD(parms, tbl->comp_field_idx); + if (tbl->index_opcode != BNXT_ULP_INDEX_OPCODE_COMP_FIELD) { + BNXT_TF_DBG(ERR, "Invalid tbl index opcode\n"); + return -EINVAL; + } + idx = ULP_COMP_FLD_IDX_RD(parms, tbl->index_operand); /* Perform the tf table set by filling the set params */ iftbl_params.dir = tbl->direction; diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c index 8af23eff1..9b14fa0bd 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c @@ -76,7 +76,8 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = { .result_bit_size = 128, .result_num_fields = 26, .encap_num_fields = 0, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, + .index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE, + .index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP }, { @@ -90,7 +91,8 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = { .result_bit_size = 128, .result_num_fields = 26, .encap_num_fields = 0, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, + .index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE, + .index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP }, { @@ -104,7 +106,8 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = { .result_bit_size = 128, .result_num_fields = 26, .encap_num_fields = 12, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, + .index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE, + .index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP } }; diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c index e773afd60..d4c7bfa4d 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c @@ -113,8 +113,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 0, .ident_nums = 1, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE, @@ -135,8 +134,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 1, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE, @@ -157,8 +155,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 1, .ident_nums = 1, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE, @@ -179,8 +176,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 2, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE, @@ -201,8 +197,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 2, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_SET_IF_MARK_ACTION, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE, @@ -223,8 +218,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 2, .ident_nums = 1, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE, @@ -245,8 +239,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 3, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE, @@ -267,8 +260,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 3, .ident_nums = 1, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE, @@ -289,8 +281,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 4, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE, @@ -311,8 +302,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 4, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_SET_IF_MARK_ACTION, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE, @@ -333,8 +323,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 4, .ident_nums = 1, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_SET_IF_MARK_ACTION, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE, @@ -355,8 +344,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 5, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE, @@ -377,8 +365,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 5, .ident_nums = 1, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE, @@ -399,8 +386,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 6, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE, @@ -421,8 +407,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .ident_start_idx = 6, .ident_nums = 0, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_SET_IF_MARK_ACTION, - .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED + .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES } }; diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h index 66343b918..0215a5dde 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h @@ -161,6 +161,14 @@ enum bnxt_ulp_hdr_type { BNXT_ULP_HDR_TYPE_LAST = 3 }; +enum bnxt_ulp_index_opcode { + BNXT_ULP_INDEX_OPCODE_NOT_USED = 0, + BNXT_ULP_INDEX_OPCODE_ALLOCATE = 1, + BNXT_ULP_INDEX_OPCODE_GLOBAL = 2, + BNXT_ULP_INDEX_OPCODE_COMP_FIELD = 3, + BNXT_ULP_INDEX_OPCODE_LAST = 4 +}; + enum bnxt_ulp_mapper_opc { BNXT_ULP_MAPPER_OPC_SET_TO_CONSTANT = 0, BNXT_ULP_MAPPER_OPC_SET_TO_HDR_FIELD = 1, diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h index 1188223aa..a3ddd33fd 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h @@ -182,9 +182,9 @@ struct bnxt_ulp_mapper_tbl_info { uint32_t ident_start_idx; uint16_t ident_nums; - enum bnxt_ulp_regfile_index regfile_idx; enum bnxt_ulp_mark_db_opcode mark_db_opcode; - uint32_t comp_field_idx; + enum bnxt_ulp_index_opcode index_opcode; + uint32_t index_operand; }; struct bnxt_ulp_mapper_class_key_field_info {