Allow the flow db resources to be more effectively utilized.
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
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);
}
/* 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;
}