net/bnxt: update TruFlow core index table
[dpdk.git] / drivers / net / bnxt / tf_core / tf_device_p58.c
index b44648d..ce4d8c6 100644 (file)
@@ -10,6 +10,9 @@
 #include "tf_identifier.h"
 #include "tf_tbl.h"
 #include "tf_tcam.h"
+#ifdef TF_TCAM_SHARED
+#include "tf_tcam_shared.h"
+#endif /* TF_TCAM_SHARED */
 #include "tf_em.h"
 #include "tf_if_tbl.h"
 #include "tfp.h"
@@ -148,6 +151,47 @@ static int tf_dev_p58_word_align(uint16_t size)
        return ((((size) + 63) >> 6) * 8);
 }
 
+/**
+ * Device specific function that retrieves the increment
+ * required for certain table types in a shared session
+ *
+ * [in] tfp
+ * tf handle
+ *
+ * [in/out] parms
+ *   pointer to parms structure
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+static int tf_dev_p58_get_shared_tbl_increment(struct tf *tfp __rte_unused,
+                               struct tf_get_shared_tbl_increment_parms *parms)
+{
+       switch (parms->type) {
+       case TF_TBL_TYPE_FULL_ACT_RECORD:
+       case TF_TBL_TYPE_COMPACT_ACT_RECORD:
+       case TF_TBL_TYPE_ACT_ENCAP_8B:
+       case TF_TBL_TYPE_ACT_ENCAP_16B:
+       case TF_TBL_TYPE_ACT_ENCAP_32B:
+       case TF_TBL_TYPE_ACT_ENCAP_64B:
+       case TF_TBL_TYPE_ACT_SP_SMAC:
+       case TF_TBL_TYPE_ACT_SP_SMAC_IPV4:
+       case TF_TBL_TYPE_ACT_SP_SMAC_IPV6:
+       case TF_TBL_TYPE_ACT_STATS_64:
+       case TF_TBL_TYPE_ACT_MODIFY_IPV4:
+       case TF_TBL_TYPE_ACT_MODIFY_8B:
+       case TF_TBL_TYPE_ACT_MODIFY_16B:
+       case TF_TBL_TYPE_ACT_MODIFY_32B:
+       case TF_TBL_TYPE_ACT_MODIFY_64B:
+               parms->increment_cnt = 8;
+               break;
+       default:
+               parms->increment_cnt = 1;
+               break;
+       }
+       return 0;
+}
 
 #define TF_DEV_P58_BANK_SZ_64B 2048
 /**
@@ -190,8 +234,11 @@ static int tf_dev_p58_get_sram_tbl_info(struct tf *tfp __rte_unused,
        parms.hcapi_type = &hcapi_type;
 
        rc = tf_rm_get_hcapi_type(&parms);
-       if (rc)
-               return rc;
+       if (rc) {
+               *base = 0;
+               *shift = 0;
+               return 0;
+       }
 
        switch (hcapi_type) {
        case CFA_RESOURCE_TYPE_P58_SRAM_BANK_0:
@@ -227,25 +274,29 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
        .tf_dev_alloc_ident = NULL,
        .tf_dev_free_ident = NULL,
        .tf_dev_search_ident = NULL,
+       .tf_dev_get_ident_resc_info = NULL,
        .tf_dev_get_tbl_info = NULL,
        .tf_dev_alloc_ext_tbl = NULL,
        .tf_dev_alloc_tbl = NULL,
        .tf_dev_free_ext_tbl = NULL,
        .tf_dev_free_tbl = NULL,
-       .tf_dev_alloc_search_tbl = NULL,
        .tf_dev_set_tbl = NULL,
        .tf_dev_set_ext_tbl = NULL,
        .tf_dev_get_tbl = NULL,
        .tf_dev_get_bulk_tbl = NULL,
+       .tf_dev_get_shared_tbl_increment = tf_dev_p58_get_shared_tbl_increment,
+       .tf_dev_get_tbl_resc_info = NULL,
        .tf_dev_alloc_tcam = NULL,
        .tf_dev_free_tcam = NULL,
        .tf_dev_alloc_search_tcam = NULL,
        .tf_dev_set_tcam = NULL,
        .tf_dev_get_tcam = NULL,
+       .tf_dev_get_tcam_resc_info = NULL,
        .tf_dev_insert_int_em_entry = NULL,
        .tf_dev_delete_int_em_entry = NULL,
        .tf_dev_insert_ext_em_entry = NULL,
        .tf_dev_delete_ext_em_entry = NULL,
+       .tf_dev_get_em_resc_info = NULL,
        .tf_dev_alloc_tbl_scope = NULL,
        .tf_dev_map_tbl_scope = NULL,
        .tf_dev_map_parif = NULL,
@@ -268,25 +319,43 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
        .tf_dev_alloc_ident = tf_ident_alloc,
        .tf_dev_free_ident = tf_ident_free,
        .tf_dev_search_ident = tf_ident_search,
+       .tf_dev_get_ident_resc_info = tf_ident_get_resc_info,
        .tf_dev_get_tbl_info = tf_dev_p58_get_sram_tbl_info,
        .tf_dev_alloc_tbl = tf_tbl_alloc,
        .tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
        .tf_dev_free_tbl = tf_tbl_free,
        .tf_dev_free_ext_tbl = tf_tbl_ext_free,
-       .tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
        .tf_dev_set_tbl = tf_tbl_set,
        .tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
        .tf_dev_get_tbl = tf_tbl_get,
        .tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
+       .tf_dev_get_shared_tbl_increment = tf_dev_p58_get_shared_tbl_increment,
+       .tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
+#ifdef TF_TCAM_SHARED
+       .tf_dev_alloc_tcam = tf_tcam_shared_alloc,
+       .tf_dev_free_tcam = tf_tcam_shared_free,
+       .tf_dev_set_tcam = tf_tcam_shared_set,
+       .tf_dev_get_tcam = tf_tcam_shared_get,
+       .tf_dev_move_tcam = tf_tcam_shared_move_p58,
+       .tf_dev_clear_tcam = tf_tcam_shared_clear,
+#else /* !TF_TCAM_SHARED */
        .tf_dev_alloc_tcam = tf_tcam_alloc,
        .tf_dev_free_tcam = tf_tcam_free,
-       .tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
        .tf_dev_set_tcam = tf_tcam_set,
        .tf_dev_get_tcam = tf_tcam_get,
+#endif
+       .tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
+       .tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
        .tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
        .tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
+#if (TF_EM_ALLOC == 1)
+       .tf_dev_move_int_em_entry = tf_em_move_int_entry,
+#else
+       .tf_dev_move_int_em_entry = NULL,
+#endif
        .tf_dev_insert_ext_em_entry = NULL,
        .tf_dev_delete_ext_em_entry = NULL,
+       .tf_dev_get_em_resc_info = tf_em_get_resc_info,
        .tf_dev_alloc_tbl_scope = NULL,
        .tf_dev_map_tbl_scope = NULL,
        .tf_dev_map_parif = NULL,