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 1093FA0563; Wed, 15 Apr 2020 16:50:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B605D1D8FD; Wed, 15 Apr 2020 16:50:31 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id CFDB91D8FC for ; Wed, 15 Apr 2020 16:50:30 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id n16so9608pgb.7 for ; Wed, 15 Apr 2020 07:50:30 -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=+4TBKjpD4n70gpUzf1nnwxnIIoTBR8tGdecKzVphtfE=; b=OendtaeJXNhj24US4xIQM7END6uYv+IPnZ4YaajpHJj9SbDUF5HohXh76a+LcwP2Bb 1B+HqpZjQySr3y+8pRGNWPIbE4SN4yc6+T9yoS5Z8nrCpZD48MHNCE1Kc9oxbEF9s5ye qTT2AOPYIGmcY5ccIlSFo0/xuVoIiuaOfRTW0= 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=+4TBKjpD4n70gpUzf1nnwxnIIoTBR8tGdecKzVphtfE=; b=GcHZH1ads99+PJ2BauyVHDuVl6zdqKSSagE6Sap53gjfK2LkrYWHqmXYamMzHReSDS 0LezuNpRmzkf4sbobYjQo0AOgO435DusLNybgulatSy+1QtvjMPt3WVEXnXqPnm5z/uK 47wZNIf9SLKXiLgsgsAseCP167TSCLFusrj++czJCgHbkoIL15ZwWmZsWOMY3x1G5h8M /IHZNpM86nBaBS1I5ZDQGD/2ZJAhpgtV/aubKwwvdqme1SNZT1ommOw0YoPy2qfrapxL eywReQ0t33Kgzq8b7AtUg02kC1ctY+8ku7aD4HPzbrWU5nbZO5G53ayYe9XSNS87ICzp ZDDA== X-Gm-Message-State: AGi0PuYOgy1UDZ2n/VjZ5dKf8CORuOUjpDyEcGj0B2yYDUOxqNkfI7VV gpsb1oUBfEB0DoUIwnQoPAKOlgqqLk70TlbsfwtvSTZpmMW+B1GbIQsVnVUCPgbQppnrlww8+Ma 9qc1WIjrUag2ep46Bob/f09QrnL4mDRXZ2bESWxqL6hgpXQqP0xw89J4rTM4ZJyWE95xj X-Google-Smtp-Source: APiQypLMwUkUI03HcSbXI6t8gUh1JMeYimgWyAovchOy8dlNh9KVHzVWt/z5OuVg4OYYixjQcMTyog== X-Received: by 2002:a65:428a:: with SMTP id j10mr26745087pgp.272.1586962229610; Wed, 15 Apr 2020 07:50:29 -0700 (PDT) Received: from S60.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 11sm13767969pfz.91.2020.04.15.07.50.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2020 07:50:29 -0700 (PDT) From: Venkat Duvvuru To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru Date: Wed, 15 Apr 2020 20:19:08 +0530 Message-Id: <1586962156-11179-4-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1586962156-11179-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1586962156-11179-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 03/11] net/bnxt: Added flow database resource iteration API 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 This API can be used to iterate individual resource functions in the flow database. Reviewed-by: Michael Baucom Signed-off-by: Kishore Padmanabha Signed-off-by: Venkat Duvvuru --- drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 66 ++++++++++++++++++++++++++++++++++- drivers/net/bnxt/tf_ulp/ulp_flow_db.h | 17 +++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index e99e94a..9e7f9f5 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -560,7 +560,71 @@ int32_t ulp_flow_db_fid_free(struct bnxt_ulp_context *ulp_ctxt, return 0; } -/** Get the flow database entry iteratively +/* + * Get the flow database entry details + * + * 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 + * nxt_idx [in/out] the index to the next entry + * params [out] The contents to be copied into params. + * + * returns 0 on success and negative on failure. + */ +int32_t ulp_flow_db_resource_get(struct bnxt_ulp_context *ulp_ctxt, + enum bnxt_ulp_flow_db_tables tbl_idx, + uint32_t fid, + uint32_t *nxt_idx, + 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 *nxt_resource, *fid_resource; + + 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 limits of fid */ + 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; + } + + if (!*nxt_idx) { + fid_resource = &flow_tbl->flow_resources[fid]; + ulp_flow_db_res_info_to_params(fid_resource, params); + ULP_FLOW_DB_RES_NXT_SET(*nxt_idx, + fid_resource->nxt_resource_idx); + } else { + nxt_resource = &flow_tbl->flow_resources[*nxt_idx]; + ulp_flow_db_res_info_to_params(nxt_resource, params); + *nxt_idx = 0; + ULP_FLOW_DB_RES_NXT_SET(*nxt_idx, + nxt_resource->nxt_resource_idx); + } + + /* all good, return success */ + return 0; +} + +/* + * Get the flow database entry iteratively * * flow_tbl [in] Ptr to flow table * fid [in/out] The index to the flow entry diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h index 5435415..5361dd0 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h @@ -143,6 +143,23 @@ int32_t ulp_flow_db_fid_free(struct bnxt_ulp_context *ulp_ctxt, uint32_t fid); /* + *Get the flow database entry details + * + * 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 + * nxt_idx [in/out] the index to the next entry + * params [out] The contents to be copied into params. + * + * returns 0 on success and negative on failure. + */ +int32_t ulp_flow_db_resource_get(struct bnxt_ulp_context *ulp_ctxt, + enum bnxt_ulp_flow_db_tables tbl_idx, + uint32_t fid, + uint32_t *nxt_idx, + struct ulp_flow_db_res_params *params); + +/* * Flush all flows in the flow database. * * ulp_ctxt [in] Ptr to ulp context -- 2.7.4