From patchwork Tue Jul 28 06:34:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 74912 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 0B94EA0521; Tue, 28 Jul 2020 08:37:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7FEC21C1B3; Tue, 28 Jul 2020 08:35:43 +0200 (CEST) Received: from mail-wr1-f98.google.com (mail-wr1-f98.google.com [209.85.221.98]) by dpdk.org (Postfix) with ESMTP id D293F1C122 for ; Tue, 28 Jul 2020 08:35:17 +0200 (CEST) Received: by mail-wr1-f98.google.com with SMTP id 88so17076590wrh.3 for ; Mon, 27 Jul 2020 23:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+8dpsFxwDYL4XhU+luIFm63o0JK5x98RGzdl1Cs2+1I=; b=d7KMszWgAGHcDTo/4Lg2FxrpgvrIk43wgbBzohKJI3LZgO46cYO6hEqJ6DDRLZorfr 90tXDZxKD+JeqMF4IkXuy7E3oWkJAKCbadNM/ZOM7nKalNl44VysbWnmJAFU5rMKDCq+ LAIc9rENf+qao+gyoL6DY8mSuHS3VZpGM31ro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+8dpsFxwDYL4XhU+luIFm63o0JK5x98RGzdl1Cs2+1I=; b=YxcTvvji1XAWQY7td1GixhsoVCYmi2SRoN+x7b2M+H/ViSihyM4ZcQlWM7NEwVy+Mh tE3sfmUBDmiA0h1V8R4AWZjvHb1ZpvnxcI+1df5TExSL8Zri7vOcZAfgWUYmbBMbRkRd Xzf2Lj5nA26dQGhjhDFIS5Sfg5pqHgnikbShyWaU//mFWYaDHiwcYk1MFf0OmVTjsOej SkXHRWxkKNOs1AHOPrKUJ3BqDLgAPbPE4DgYy0NZBpx4bsQaRArC2zFFZMMCLPIld/tU tqhlPhIKj+AQby+g4Nl0RQlMhwUr+qeaBxSTtEyYp/ew//8+vhVwgibjGzSNK0c1H4XE +piA== X-Gm-Message-State: AOAM532sy622bwAk02ZL54yJ6gCIqp3mp8StS/cu/JSgTLBC7SNRWFP/ WQeGMksJDUPAm8VRDLCmVUrh6RUNlYeGtT7BAgu1DEc1m3I+Y1GTZMopHELpObyCZgLvl3PGf9l sDT+ac1tJ6pSYmWEUcfhp2BlsiTMh0p70EHDpFbvWR4uGcX3erhXhrzdFojIjlWeANo0i25X9uC OWhQ== X-Google-Smtp-Source: ABdhPJyr5wXDn0nywUMUTD83EdBKo7B1eCfCBXYG6smV/K9XalQsO6rYMCVvtjTRomLXTnNSIHi38SoAex3l X-Received: by 2002:adf:c401:: with SMTP id v1mr22497232wrf.379.1595918117339; Mon, 27 Jul 2020 23:35:17 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp-relay.gmail.com with ESMTPS id r16sm30828wmh.29.2020.07.27.23.35.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2020 23:35:17 -0700 (PDT) X-Relaying-Domain: broadcom.com From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Mike Baucom , Kishore Padmanabha Date: Mon, 27 Jul 2020 23:34:30 -0700 Message-Id: <20200728063439.23114-14-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200728063439.23114-1-ajit.khaparde@broadcom.com> References: <20200728063439.23114-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 13/22] net/bnxt: modify ulp mapper 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 Reviewed-by: Ajit Khaparde --- 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 a071c0750..4dee65971 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);