From patchwork Sat Apr 25 03:47:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkat Duvvuru X-Patchwork-Id: 69288 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 41471A00C2; Sat, 25 Apr 2020 05:49:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5D6A01C1C1; Sat, 25 Apr 2020 05:48:59 +0200 (CEST) Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by dpdk.org (Postfix) with ESMTP id 8CAB41C1B6 for ; Sat, 25 Apr 2020 05:48:56 +0200 (CEST) Received: by mail-ej1-f67.google.com with SMTP id rh22so9192631ejb.12 for ; Fri, 24 Apr 2020 20:48:56 -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; bh=m6JgszEX+Y2LRPugMN2xz0j+VSxOb1QNa9nfw/4u76w=; b=hZZUQkDmndssPgoJLTZb2MfcPWFgqTN5Th47zxLdHpGrzOo1sWt6rWgJRTQMYB/crP W5mWjB5FxU1fyLggTbPQSHW5tHh74JUsrDGHRE9EOW1ZZ3QEp2/FKn0YHs9nSAzrI7VK xhn8nGdNzS02XIs9ue2W7Fpu57dQ4Orf5SR8g= 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; bh=m6JgszEX+Y2LRPugMN2xz0j+VSxOb1QNa9nfw/4u76w=; b=cJDzDLkfgjJb4D+JTfpf6fc0KMHA39NPJNCLCLOEc+fl1Pqni8oNZK9xwNjmY6ueBs 7yGt+0c9GPPpJH6qrSxlnMhpbMAHBGv9jRsyON9TuX4k2Oe3WGjce4lQW/rfNVDi0WQc 93zRcpbT0MCHipyo/ld0ArjT6MbnY2cBs40wrIn27dr/A2LhvLgCX4poohlLzlg2PRbL sdBpVP5l3Sugzaksd91jJa0USfYqBOOirHRn1QoZBwvXS9U+xNTw9X6fNQyXXMxfutUY +HCdouAMnSuLyNEWGOhZHzO38XpPadXzb1Fal2+XjcFoGli39Vis/VQlrGGdez9ocW3I PVpQ== X-Gm-Message-State: AGi0PuYKwqJteSjlRpdey+rdskPTqYoM3VlGrPvC0a/aC0yraYcT3jmS zc5aOh43yL4Se5m2yBOmi7CajqomVM+Kmw0j+BRpIyZHdn/Mh8lbbK9Yc5/n+OL2WsE/pg/8GGt 3LujNqm3r+kqo+ewnMHDrXFXUhzox9Gl2enyvopNr7lP/jSAENvB8oZeQHW3KCvvIMpcK X-Google-Smtp-Source: APiQypJ+AGKDsje161EEWOo+p9vWJg2bcy4beohjZaLD8brhNLT56eB+rgpA4QeIAFG+TYcKR73Ckw== X-Received: by 2002:a17:906:f288:: with SMTP id gu8mr10583763ejb.281.1587786535997; Fri, 24 Apr 2020 20:48:55 -0700 (PDT) Received: from S60.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id ci6sm972012ejc.73.2020.04.24.20.48.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Apr 2020 20:48:55 -0700 (PDT) From: Venkat Duvvuru To: dev@dpdk.org Cc: Mike Baucom Date: Sat, 25 Apr 2020 09:17:24 +0530 Message-Id: <1587786446-35230-4-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587786446-35230-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1587786446-35230-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 3/5] net/bnxt: ulp modifications for handling actions/index tables 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 The ulp required changes to properly call the index table management routines and use the index for external memory indices. The ulp no longer has to account for stride as the tf_core returns the actual offset, not a 0 based index. Signed-off-by: Mike Baucom Reviewed-by: Kishore Padmanabha Reviewed-by: Venkat Duvvuru --- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index dc7b7ca..9ea6fdb 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -401,7 +401,7 @@ ulp_mapper_tcam_entry_free(struct bnxt_ulp_context *ulp __rte_unused, } static inline int32_t -ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp __rte_unused, +ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp, struct tf *tfp, struct ulp_flow_db_res_params *res) { @@ -411,6 +411,12 @@ ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp __rte_unused, .idx = (uint32_t)res->resource_hndl }; + /* + * Just set the table scope, it will be ignored if not necessary + * by the tf_free_tbl_entry + */ + bnxt_ulp_cntxt_tbl_scope_id_get(ulp, &fparms.tbl_scope_id); + return tf_free_tbl_entry(tfp, &fparms); } @@ -805,6 +811,9 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, int32_t rc = 0; int32_t trc; uint64_t idx; + uint32_t tbl_scope_id; + + bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id); /* Set the allocation parameters for the table*/ alloc_parms.dir = atbls->direction; @@ -812,6 +821,7 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, alloc_parms.search_enable = atbls->srch_b4_alloc; alloc_parms.result = ulp_blob_data_get(blob, &alloc_parms.result_sz_in_bytes); + alloc_parms.tbl_scope_id = tbl_scope_id; if (!alloc_parms.result) { BNXT_TF_DBG(ERR, "blob is not populated\n"); return -EINVAL; @@ -826,14 +836,10 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, } /* 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; + tmpidx = TF_ACT_REC_OFFSET_2_PTR(alloc_parms.idx); else tmpidx = alloc_parms.idx; @@ -863,10 +869,7 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, 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_parm.tbl_scope_id = tbl_scope_id; /* set the table entry */ rc = tf_set_tbl_entry(parms->tfp, &set_parm); @@ -1396,9 +1399,11 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, struct tf_alloc_tbl_entry_parms aparms = { 0 }; struct tf_set_tbl_entry_parms sparms = { 0 }; struct tf_free_tbl_entry_parms free_parms = { 0 }; - + uint32_t tbl_scope_id; struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx); + bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id); + if (!ulp_blob_init(&data, tbl->result_bit_size, parms->order)) { BNXT_TF_DBG(ERR, "Failed initial index table blob\n"); return -EINVAL; @@ -1427,6 +1432,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, aparms.search_enable = tbl->srch_b4_alloc; aparms.result = ulp_blob_data_get(&data, &tmplen); aparms.result_sz_in_bytes = ULP_SZ_BITS2BYTES(tbl->result_bit_size); + aparms.tbl_scope_id = tbl_scope_id; /* All failures after the alloc succeeds require a free */ rc = tf_alloc_tbl_entry(tfp, &aparms); @@ -1454,6 +1460,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, sparms.data_sz_in_bytes = ULP_SZ_BITS2BYTES(tbl->result_bit_size); sparms.idx = aparms.idx; + sparms.tbl_scope_id = tbl_scope_id; rc = tf_set_tbl_entry(tfp, &sparms); if (rc) { @@ -1494,6 +1501,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, free_parms.dir = tbl->direction; free_parms.type = tbl->table_type; free_parms.idx = aparms.idx; + free_parms.tbl_scope_id = tbl_scope_id; trc = tf_free_tbl_entry(tfp, &free_parms); if (trc)