event/dlb2: add v2.5 sequence number management
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_mapper.c
index 27b4780..4e06ae9 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2020 Broadcom
+ * Copyright(c) 2014-2021 Broadcom
  * All rights reserved.
  */
 
@@ -2522,7 +2522,7 @@ ulp_mapper_tbls_process(struct bnxt_ulp_mapper_parms *parms, uint32_t tid)
        tbls = ulp_mapper_tbl_list_get(parms, tid, &num_tbls);
        if (!tbls || !num_tbls) {
                BNXT_TF_DBG(ERR, "No %s tables for %d:%d\n",
-                           (parms->tmpl_type = BNXT_ULP_TEMPLATE_TYPE_CLASS) ?
+                           (parms->tmpl_type == BNXT_ULP_TEMPLATE_TYPE_CLASS) ?
                            "class" : "action", parms->dev_id, tid);
                return -EINVAL;
        }
@@ -2569,7 +2569,7 @@ ulp_mapper_tbls_process(struct bnxt_ulp_mapper_parms *parms, uint32_t tid)
        return rc;
 error:
        BNXT_TF_DBG(ERR, "%s tables failed creation for %d:%d\n",
-                   (parms->tmpl_type = BNXT_ULP_TEMPLATE_TYPE_CLASS) ?
+                   (parms->tmpl_type == BNXT_ULP_TEMPLATE_TYPE_CLASS) ?
                    "class" : "action", parms->dev_id, tid);
        return rc;
 }
@@ -2723,15 +2723,9 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
                BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
                return -EINVAL;
        }
-       if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-               BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-               return -EINVAL;
-       }
 
        rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
-       bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
        return rc;
-
 }
 
 /* Function to handle the default global templates that are allocated during
@@ -2795,8 +2789,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
-                      struct bnxt_ulp_mapper_create_parms *cparms,
-                      uint32_t *flowid)
+                      struct bnxt_ulp_mapper_create_parms *cparms)
 {
        struct bnxt_ulp_mapper_parms parms;
        struct ulp_regfile regfile;
@@ -2821,6 +2814,8 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
        parms.flow_type = cparms->flow_type;
        parms.parent_flow = cparms->parent_flow;
        parms.parent_fid = cparms->parent_fid;
+       parms.fid = cparms->flow_id;
+       parms.tun_idx = cparms->tun_idx;
 
        /* Get the device id from the ulp context */
        if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
@@ -2861,26 +2856,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
                return -EINVAL;
        }
 
-       /* Protect flow creation */
-       if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-               BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-               return -EINVAL;
-       }
-
-       /* Allocate a Flow ID for attaching all resources for the flow to.
-        * Once allocated, all errors have to walk the list of resources and
-        * free each of them.
-        */
-       rc = ulp_flow_db_fid_alloc(ulp_ctx,
-                                  parms.flow_type,
-                                  cparms->func_id,
-                                  &parms.fid);
-       if (rc) {
-               BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
-               bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-               return rc;
-       }
-
+       /* Process the action template list from the selected action table*/
        if (parms.act_tid) {
                parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_ACTION;
                /* Process the action template tables */
@@ -2911,13 +2887,9 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
                        goto flow_error;
        }
 
-       *flowid = parms.fid;
-       bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-
        return rc;
 
 flow_error:
-       bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
        /* Free all resources that were allocated during flow creation */
        trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
                                      parms.fid);