net/bnxt: enable wildcard match for ingress flows
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_gen_tbl.c
index 1dc634d..5279beb 100644 (file)
@@ -70,9 +70,9 @@ ulp_mapper_generic_tbl_list_init(struct bnxt_ulp_mapper_data *mapper_data)
                        entry->container.byte_data = &entry->mem_data[size];
                        entry->container.byte_order = tbl->result_byte_order;
                } else {
-                       BNXT_TF_DBG(ERR, "%s:Invalid gen table num of ent %d\n",
+                       BNXT_TF_DBG(DEBUG, "%s: Unused Gen tbl entry is %d\n",
                                    tbl->name, idx);
-                       return -EINVAL;
+                       /* return -EINVAL; */
                }
                if (tbl->hash_tbl_entries) {
                        cparams.key_size = tbl->key_num_bytes;
@@ -246,8 +246,28 @@ ulp_mapper_gen_tbl_entry_data_get(struct ulp_mapper_gen_tbl_entry *entry,
        return 0;
 }
 
-/*
- * Free the generic table list entry
+/* Free the generic table list entry
+ *
+ * ulp_ctx [in] - Pointer to the ulp context
+ * tbl_idx [in] - Index of the generic table
+ * ckey [in] - Key for the entry in the table
+ *
+ * returns 0 on success
+ */
+int32_t
+ulp_mapper_gen_tbl_entry_free(struct bnxt_ulp_context *ulp_ctx,
+                             uint32_t tbl_idx, uint32_t ckey)
+{
+       struct ulp_flow_db_res_params res;
+
+       res.direction = tbl_idx & 0x1;
+       res.resource_sub_type = tbl_idx >> 1;
+       res.resource_hndl = ckey;
+
+       return ulp_mapper_gen_tbl_res_free(ulp_ctx, &res);
+}
+
+/* Free the generic table list resource
  *
  * ulp_ctx [in] - Pointer to the ulp context
  * res [in] - Pointer to flow db resource entry
@@ -326,11 +346,15 @@ ulp_mapper_gen_tbl_res_free(struct bnxt_ulp_context *ulp_ctx,
                return -EINVAL;
        }
        fid = tfp_be_to_cpu_32(fid);
-
-       /* Destroy the flow associated with the shared flow id */
-       if (ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_RID,
-                                   fid))
-               BNXT_TF_DBG(ERR, "Error in deleting shared flow id %x\n", fid);
+       /* no need to del if fid is 0 since there is no associated resource */
+       if (fid) {
+               /* Destroy the flow associated with the shared flow id */
+               if (ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_RID,
+                                           fid))
+                       BNXT_TF_DBG(ERR,
+                                   "Error in deleting shared flow id %x\n",
+                                   fid);
+       }
 
        /* Delete the entry from the hash table */
        if (gen_tbl_list->hash_tbl)