net/bnxt: add core changes for EM and EEM lookups
[dpdk.git] / drivers / net / bnxt / tf_core / tf_tbl.h
index cb7ce9d..b175573 100644 (file)
@@ -7,46 +7,11 @@
 #define _TF_TBL_H_
 
 #include <stdint.h>
-#include "stack.h"
-
-enum tf_pg_tbl_lvl {
-       PT_LVL_0,
-       PT_LVL_1,
-       PT_LVL_2,
-       PT_LVL_MAX
-};
 
-enum tf_em_table_type {
-       KEY0_TABLE,
-       KEY1_TABLE,
-       RECORD_TABLE,
-       EFC_TABLE,
-       MAX_TABLE
-};
-
-struct tf_em_page_tbl {
-       uint32_t        pg_count;
-       uint32_t        pg_size;
-       void            **pg_va_tbl;
-       uint64_t        *pg_pa_tbl;
-};
+#include "tf_core.h"
+#include "stack.h"
 
-struct tf_em_table {
-       int                             type;
-       uint32_t                        num_entries;
-       uint16_t                        ctx_id;
-       uint32_t                        entry_size;
-       int                             num_lvl;
-       uint32_t                        page_cnt[PT_LVL_MAX];
-       uint64_t                        num_data_pages;
-       void                            *l0_addr;
-       uint64_t                        l0_dma_addr;
-       struct tf_em_page_tbl pg_tbl[PT_LVL_MAX];
-};
-
-struct tf_em_ctx_mem_info {
-       struct tf_em_table              em_tables[MAX_TABLE];
-};
+struct tf_session;
 
 /** table scope control block content */
 struct tf_em_caps {
@@ -70,44 +35,53 @@ struct tf_em_caps {
 struct tf_tbl_scope_cb {
        uint32_t tbl_scope_id;
        int index;
-       struct tf_em_ctx_mem_info  em_ctx_info[TF_DIR_MAX];
+       struct hcapi_cfa_em_ctx_mem_info  em_ctx_info[TF_DIR_MAX];
        struct tf_em_caps          em_caps[TF_DIR_MAX];
-       struct stack               ext_pool[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
-       uint32_t              *ext_pool_mem[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
+       struct stack               ext_act_pool[TF_DIR_MAX];
+       uint32_t                  *ext_act_pool_mem[TF_DIR_MAX];
 };
 
 /** Hardware Page sizes supported for EEM: 4K, 8K, 64K, 256K, 1M, 2M, 4M, 1G.
  * Round-down other page sizes to the lower hardware page size supported.
  */
-#define PAGE_SHIFT 22 /** 2M */
+#define TF_EM_PAGE_SIZE_4K 12
+#define TF_EM_PAGE_SIZE_8K 13
+#define TF_EM_PAGE_SIZE_64K 16
+#define TF_EM_PAGE_SIZE_256K 18
+#define TF_EM_PAGE_SIZE_1M 20
+#define TF_EM_PAGE_SIZE_2M 21
+#define TF_EM_PAGE_SIZE_4M 22
+#define TF_EM_PAGE_SIZE_1G 30
+
+/* Set page size */
+#define BNXT_TF_PAGE_SIZE TF_EM_PAGE_SIZE_2M
 
-#if (PAGE_SHIFT < 12)                          /** < 4K >> 4K */
-#define TF_EM_PAGE_SHIFT 12
+#if (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_4K)  /** 4K */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_4K
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4K
-#elif (PAGE_SHIFT <= 13)                       /** 4K, 8K */
-#define TF_EM_PAGE_SHIFT 13
+#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_8K)        /** 8K */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_8K
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_8K
-#elif (PAGE_SHIFT < 16)                                /** 16K, 32K >> 8K */
-#define TF_EM_PAGE_SHIFT 15
-#define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_32K
-#elif (PAGE_SHIFT <= 17)                       /** 64K, 128K >> 64K */
-#define TF_EM_PAGE_SHIFT 16
+#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_64K)       /** 64K */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_64K
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_64K
-#elif (PAGE_SHIFT <= 19)                       /** 256K, 512K >> 256K */
-#define TF_EM_PAGE_SHIFT 18
+#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_256K)      /** 256K */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_256K
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_256K
-#elif (PAGE_SHIFT <= 21)                       /** 1M */
-#define TF_EM_PAGE_SHIFT 20
+#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_1M)        /** 1M */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_1M
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1M
-#elif (PAGE_SHIFT <= 22)                       /** 2M, 4M */
-#define TF_EM_PAGE_SHIFT 21
+#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_2M)        /** 2M */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_2M
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_2M
-#elif (PAGE_SHIFT <= 29)                       /** 8M ... 512M >> 4M */
-#define TF_EM_PAGE_SHIFT 22
+#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_4M)        /** 4M */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_4M
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4M
-#else                                          /** >= 1G >> 1G */
-#define TF_EM_PAGE_SHIFT       30
+#elif (BNXT_TF_PAGE_SIZE == TF_EM_PAGE_SIZE_1G)        /** 1G */
+#define TF_EM_PAGE_SHIFT TF_EM_PAGE_SIZE_1G
 #define TF_EM_PAGE_SIZE_ENUM HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1G
+#else
+#error "Invalid Page Size specified. Please use a TF_EM_PAGE_SIZE_n define"
 #endif
 
 #define TF_EM_PAGE_SIZE        (1 << TF_EM_PAGE_SHIFT)