From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78A07A0521; Thu, 23 Jul 2020 14:04:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3354A1C0C3; Thu, 23 Jul 2020 14:02:37 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id D62721BFDB for ; Thu, 23 Jul 2020 14:02:05 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (bgccx-dev-host-lnx35.bec.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 6D21A29ADB5; Thu, 23 Jul 2020 05:02:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 6D21A29ADB5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1595505725; bh=O19ukcb68t1huzXDJ0dKW9fwKuu4cdZvRRjlER5xB4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h82dR7AKY6pG405BtCA7Q3DUNIjG3h/15t5k5yGI/UZatrnCxz33/TS+lmdXxNXwu uRQLEpLNslr9CefsP8y91IRWxKtgsuVJqy29X8hIXElIMqp3hBdabJ/cw+JNKVAh6D SG4SZzyxI9xoeoQrcMHb+bqKhJYTYsi1eKs63n+Y= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Thu, 23 Jul 2020 17:26:32 +0530 Message-Id: <20200723115639.22357-14-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200723115639.22357-1-somnath.kotur@broadcom.com> References: <20200723111329.21855-1-somnath.kotur@broadcom.com> <20200723115639.22357-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH v2 13/20] net/bnxt: ulp mapper changes to use tbl search 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: Mike Baucom modified ulp mappper to use the new tf_search_tbl_entry API. When search before allocation is requested, mapper calls tc_search_tbl_entry with the alloc flag. - On HIT, the result and table index is returned. - On MISS, the table index is returned but the result is created and the table entry is set. - On REJECT, the flow request is rejected. Signed-off-by: Mike Baucom Reviewed-by: Kishore Padmanabha --- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 75 ++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index a071c07..4dee659 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -1764,9 +1764,10 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, struct ulp_blob data; uint64_t idx = 0; uint16_t tmplen; - uint32_t i, num_flds; + uint32_t i, num_flds, index, hit; int32_t rc = 0, trc = 0; struct tf_alloc_tbl_entry_parms aparms = { 0 }; + struct tf_search_tbl_entry_parms srchparms = { 0 }; struct tf_set_tbl_entry_parms sparms = { 0 }; struct tf_free_tbl_entry_parms free_parms = { 0 }; uint32_t tbl_scope_id; @@ -1868,33 +1869,59 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, return 0; /* success */ } + index = 0; + hit = 0; /* Perform the tf table allocation by filling the alloc params */ - aparms.dir = tbl->direction; - aparms.type = tbl->resource_type; - aparms.search_enable = tbl->srch_b4_alloc; - aparms.result = ulp_blob_data_get(&data, &tmplen); - aparms.result_sz_in_bytes = ULP_BITS_2_BYTE(tmplen); - aparms.tbl_scope_id = tbl_scope_id; - - /* All failures after the alloc succeeds require a free */ - rc = tf_alloc_tbl_entry(tfp, &aparms); - if (rc) { - BNXT_TF_DBG(ERR, "Alloc table[%d][%s] failed rc=%d\n", - aparms.type, - (aparms.dir == TF_DIR_RX) ? "RX" : "TX", - rc); - return rc; - } + if (tbl->srch_b4_alloc) { + memset(&srchparms, 0, sizeof(srchparms)); + srchparms.dir = tbl->direction; + srchparms.type = tbl->resource_type; + srchparms.alloc = 1; + srchparms.result = ulp_blob_data_get(&data, &tmplen); + srchparms.result_sz_in_bytes = ULP_BITS_2_BYTE(tmplen); + srchparms.tbl_scope_id = tbl_scope_id; + rc = tf_search_tbl_entry(tfp, &srchparms); + if (rc) { + BNXT_TF_DBG(ERR, "Alloc table[%s][%s] failed rc=%d\n", + tf_tbl_type_2_str(tbl->resource_type), + tf_dir_2_str(tbl->direction), rc); + return rc; + } + if (srchparms.search_status == REJECT) { + BNXT_TF_DBG(ERR, "Alloc table[%s][%s] rejected.\n", + tf_tbl_type_2_str(tbl->resource_type), + tf_dir_2_str(tbl->direction)); + return -ENOMEM; + } + index = srchparms.idx; + hit = srchparms.hit; + } else { + aparms.dir = tbl->direction; + aparms.type = tbl->resource_type; + aparms.search_enable = tbl->srch_b4_alloc; + aparms.result = ulp_blob_data_get(&data, &tmplen); + aparms.result_sz_in_bytes = ULP_BITS_2_BYTE(tmplen); + aparms.tbl_scope_id = tbl_scope_id; + /* All failures after the alloc succeeds require a free */ + rc = tf_alloc_tbl_entry(tfp, &aparms); + if (rc) { + BNXT_TF_DBG(ERR, "Alloc table[%s][%s] failed rc=%d\n", + tf_tbl_type_2_str(tbl->resource_type), + tf_dir_2_str(tbl->direction), rc); + return rc; + } + index = aparms.idx; + } /* * calculate the idx for the result record, for external EM the offset * needs to be shifted accordingly. If external non-inline table types * are used then need to revisit this logic. */ - if (aparms.type == TF_TBL_TYPE_EXT) - idx = TF_ACT_REC_OFFSET_2_PTR(aparms.idx); + if (tbl->resource_type == TF_TBL_TYPE_EXT) + idx = TF_ACT_REC_OFFSET_2_PTR(index); else - idx = aparms.idx; + idx = index; /* Always storing values in Regfile in BE */ idx = tfp_cpu_to_be_64(idx); @@ -1908,12 +1935,12 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, } /* Perform the tf table set by filling the set params */ - if (!tbl->srch_b4_alloc || !aparms.hit) { + if (!tbl->srch_b4_alloc || !hit) { 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 = aparms.idx; + sparms.idx = index; sparms.tbl_scope_id = tbl_scope_id; rc = tf_set_tbl_entry(tfp, &sparms); @@ -1933,7 +1960,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, fid_parms.resource_func = tbl->resource_func; fid_parms.resource_type = tbl->resource_type; fid_parms.resource_sub_type = tbl->resource_sub_type; - fid_parms.resource_hndl = aparms.idx; + fid_parms.resource_hndl = index; fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO; rc = ulp_flow_db_resource_add(parms->ulp_ctx, @@ -1960,7 +1987,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, */ free_parms.dir = tbl->direction; free_parms.type = tbl->resource_type; - free_parms.idx = aparms.idx; + free_parms.idx = index; free_parms.tbl_scope_id = tbl_scope_id; trc = tf_free_tbl_entry(tfp, &free_parms); -- 2.7.4