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 E7811A0597; Fri, 17 Apr 2020 18:19:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0131F1E9F5; Fri, 17 Apr 2020 18:19:32 +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 734DB1E9DE for ; Fri, 17 Apr 2020 18:19:26 +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 1365D30C1D1; Fri, 17 Apr 2020 09:08:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 1365D30C1D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1587139685; bh=Skf3cD4vLeBZLMhX/KEI0O4AeYfzUodeq6TLOLkVxt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iiq72UrW0hWJa65wJvhCt5W8QvhJzB1nibNH+FqTZgNoJEhvpjpszfpDy9/6aCAOH Z95ag+seT371LyWuKx6EQ5cyhtM3ZwkW3TPPfx2kvZL8Ug8qr7pjhs+c2bEVyLjpTg NGY6Qc60ASyCrfb1LnWa5wU56rpvewTXl0YqT/+0= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 45E4514008F; Fri, 17 Apr 2020 09:19:24 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Mike Baucom , Venkat Duvvuru , Kishore Padmanabha Date: Fri, 17 Apr 2020 09:19:10 -0700 Message-Id: <20200417161920.85858-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200417161920.85858-1-ajit.khaparde@broadcom.com> References: <1586962156-11179-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <20200417161920.85858-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 02/12] net/bnxt: allow usage of more resources in flow db 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 Allow the flow db resources to be more effectively utilized. Signed-off-by: Mike Baucom Signed-off-by: Venkat Duvvuru Reviewed-by: Kishore Padmanabha Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 6 +++++- 1 file changed, 5 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 aed50785c..e99e94ab7 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -331,6 +331,10 @@ int32_t ulp_flow_db_fid_alloc(struct bnxt_ulp_context *ulp_ctxt, BNXT_TF_DBG(ERR, "Flow database has reached max flows\n"); return -ENOMEM; } + if (flow_tbl->tail_index <= (flow_tbl->head_index + 1)) { + BNXT_TF_DBG(ERR, "Flow database has reached max resources\n"); + return -ENOMEM; + } *fid = flow_tbl->flow_tbl_stack[flow_tbl->head_index]; flow_tbl->head_index++; ulp_flow_db_active_flow_set(flow_tbl, *fid, 1); @@ -385,7 +389,7 @@ int32_t ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt, } /* check for max resource */ - if ((flow_tbl->num_flows + 1) >= flow_tbl->tail_index) { + if ((flow_tbl->head_index + 1) >= flow_tbl->tail_index) { BNXT_TF_DBG(ERR, "Flow db has reached max resources\n"); return -ENOMEM; } -- 2.21.1 (Apple Git-122.3)