From: Mike Baucom Date: Wed, 15 Apr 2020 14:49:07 +0000 (+0530) Subject: net/bnxt: allow usage of more resources in flow DB X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5a640d00107a8a00a439e9c4109f61b1061c9eae;p=dpdk.git net/bnxt: allow usage of more resources in flow DB 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 --- diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index aed50785c8..e99e94ab7b 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; }