net/bnxt: update RM with residual checker
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_mapper.c
index 94ba246..734db7c 100644 (file)
@@ -365,8 +365,8 @@ ulp_mapper_cache_res_type_get(struct ulp_flow_db_res_params *res,
 
 static int32_t
 ulp_mapper_cache_entry_free(struct bnxt_ulp_context *ulp,
-                          struct tf *tfp,
-                          struct ulp_flow_db_res_params *res)
+                           struct tf *tfp,
+                           struct ulp_flow_db_res_params *res)
 {
        struct bnxt_ulp_mapper_cache_entry *cache_entry;
        struct tf_free_identifier_parms ident_parms;
@@ -1074,9 +1074,12 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
                return -EINVAL;
        }
 
-       if (!ulp_blob_init(&key, tbl->key_bit_size, parms->order) ||
-           !ulp_blob_init(&mask, tbl->key_bit_size, parms->order) ||
-           !ulp_blob_init(&data, tbl->result_bit_size, parms->order)) {
+       if (!ulp_blob_init(&key, tbl->key_bit_size,
+                          parms->device_params->byte_order) ||
+           !ulp_blob_init(&mask, tbl->key_bit_size,
+                          parms->device_params->byte_order) ||
+           !ulp_blob_init(&data, tbl->result_bit_size,
+                          parms->device_params->byte_order)) {
                BNXT_TF_DBG(ERR, "blob inits failed.\n");
                return -EINVAL;
        }
@@ -1219,6 +1222,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
                        parms->cache_ptr->tcam_idx = aparms.idx;
                }
 
+               /* Mark action */
+               rc = ulp_mapper_mark_act_ptr_process(parms, tbl);
+               if (rc)
+                       goto error;
+
        } else {
                BNXT_TF_DBG(ERR, "Not supporting search before alloc now\n");
                rc = -EINVAL;
@@ -1283,6 +1291,7 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
        struct tf_insert_em_entry_parms iparms = { 0 };
        struct tf_delete_em_entry_parms free_parms = { 0 };
        int32_t trc;
+       enum bnxt_ulp_flow_mem_type mtype = parms->device_params->flow_mem_type;
        int32_t rc = 0;
 
        kflds = ulp_mapper_key_fields_get(tbl, &num_kflds);
@@ -1292,8 +1301,10 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
        }
 
        /* Initialize the key/result blobs */
-       if (!ulp_blob_init(&key, tbl->blob_key_bit_size, parms->order) ||
-           !ulp_blob_init(&data, tbl->result_bit_size, parms->order)) {
+       if (!ulp_blob_init(&key, tbl->blob_key_bit_size,
+                          parms->device_params->byte_order) ||
+           !ulp_blob_init(&data, tbl->result_bit_size,
+                          parms->device_params->byte_order)) {
                BNXT_TF_DBG(ERR, "blob inits failed.\n");
                return -EINVAL;
        }
@@ -1371,10 +1382,10 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
        }
 
        /* Mark action process */
-       if (parms->device_params->global_fid_enable &&
+       if (mtype == BNXT_ULP_FLOW_MEM_TYPE_EXT &&
            tbl->resource_type == TF_MEM_EXTERNAL)
                rc = ulp_mapper_mark_gfid_process(parms, tbl, iparms.flow_id);
-       else if (!parms->device_params->global_fid_enable &&
+       else if (mtype == BNXT_ULP_FLOW_MEM_TYPE_INT &&
                 tbl->resource_type == TF_MEM_INTERNAL)
                rc = ulp_mapper_mark_act_ptr_process(parms, tbl);
        if (rc) {
@@ -1620,7 +1631,8 @@ ulp_mapper_cache_tbl_process(struct bnxt_ulp_mapper_parms *parms,
                BNXT_TF_DBG(ERR, "Failed to get key fields\n");
                return -EINVAL;
        }
-       if (!ulp_blob_init(&key, tbl->key_bit_size, parms->order)) {
+       if (!ulp_blob_init(&key, tbl->key_bit_size,
+                          parms->device_params->byte_order)) {
                BNXT_TF_DBG(ERR, "Failed to alloc blob\n");
                return -EINVAL;
        }
@@ -2018,7 +2030,6 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
                       struct bnxt_ulp_mapper_create_parms *cparms,
                       uint32_t *flowid)
 {
-       struct bnxt_ulp_device_params *device_params;
        struct bnxt_ulp_mapper_parms parms;
        struct ulp_regfile regfile;
        int32_t  rc, trc;
@@ -2076,15 +2087,13 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
                return -EINVAL;
        }
 
-       /* Get the byte order for the further processing from device params */
-       device_params = bnxt_ulp_device_params_get(parms.dev_id);
-       if (!device_params) {
+       /* Get the device params, it will be used in later processing */
+       parms.device_params = bnxt_ulp_device_params_get(parms.dev_id);
+       if (!parms.device_params) {
                BNXT_TF_DBG(ERR, "No class tables for %d:%d\n",
                            parms.dev_id, parms.class_tid);
                return -EINVAL;
        }
-       parms.order = device_params->byte_order;
-       parms.encap_byte_swap = device_params->encap_byte_swap;
 
        /* initialize the registry file for further processing */
        if (!ulp_regfile_init(parms.regfile)) {