net/bnxt: support EEM system memory
[dpdk.git] / drivers / net / bnxt / tf_core / tf_em.h
index 39a2163..0890261 100644 (file)
@@ -16,6 +16,9 @@
 
 #include "hcapi/hcapi_cfa_defs.h"
 
+#define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
+#define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
+
 #define TF_HW_EM_KEY_MAX_SIZE 52
 #define TF_EM_KEY_RECORD_SIZE 64
 
 #error "Invalid Page Size specified. Please use a TF_EM_PAGE_SIZE_n define"
 #endif
 
+/*
+ * System memory always uses 4K pages
+ */
+#ifdef TF_USE_SYSTEM_MEM
+#define TF_EM_PAGE_SIZE (1 << TF_EM_PAGE_SIZE_4K)
+#define TF_EM_PAGE_ALIGNMENT (1 << TF_EM_PAGE_SIZE_4K)
+#else
 #define TF_EM_PAGE_SIZE        (1 << TF_EM_PAGE_SHIFT)
 #define TF_EM_PAGE_ALIGNMENT (1 << TF_EM_PAGE_SHIFT)
+#endif
 
 /*
  * Used to build GFID:
@@ -168,39 +179,6 @@ struct tf_em_cfg_parms {
  * @ref tf_em_ext_common_alloc
  */
 
-/**
- * Allocates EEM Table scope
- *
- * [in] tfp
- *   Pointer to TruFlow handle
- *
- * [in] parms
- *   Pointer to input parameters
- *
- * Returns:
- *   0       - Success
- *   -EINVAL - Parameter error
- *   -ENOMEM - Out of memory
- */
-int tf_alloc_eem_tbl_scope(struct tf *tfp,
-                          struct tf_alloc_tbl_scope_parms *parms);
-
-/**
- * Free's EEM Table scope control block
- *
- * [in] tfp
- *   Pointer to TruFlow handle
- *
- * [in] parms
- *   Pointer to input parameters
- *
- * Returns:
- *   0       - Success
- *   -EINVAL - Parameter error
- */
-int tf_free_eem_tbl_scope_cb(struct tf *tfp,
-                            struct tf_free_tbl_scope_parms *parms);
-
 /**
  * Insert record in to internal EM table
  *
@@ -374,8 +352,8 @@ int tf_em_ext_common_unbind(struct tf *tfp);
  *   0       - Success
  *   -EINVAL - Parameter error
  */
-int tf_em_ext_host_alloc(struct tf *tfp,
-                        struct tf_alloc_tbl_scope_parms *parms);
+int tf_em_ext_alloc(struct tf *tfp,
+                   struct tf_alloc_tbl_scope_parms *parms);
 
 /**
  * Free for external EEM using host memory
@@ -390,40 +368,8 @@ int tf_em_ext_host_alloc(struct tf *tfp,
  *   0       - Success
  *   -EINVAL - Parameter error
  */
-int tf_em_ext_host_free(struct tf *tfp,
-                       struct tf_free_tbl_scope_parms *parms);
-
-/**
- * Alloc for external EEM using system memory
- *
- * [in] tfp
- *   Pointer to TruFlow handle
- *
- * [in] parms
- *   Pointer to input parameters
- *
- * Returns:
- *   0       - Success
- *   -EINVAL - Parameter error
- */
-int tf_em_ext_system_alloc(struct tf *tfp,
-                          struct tf_alloc_tbl_scope_parms *parms);
-
-/**
- * Free for external EEM using system memory
- *
- * [in] tfp
- *   Pointer to TruFlow handle
- *
- * [in] parms
- *   Pointer to input parameters
- *
- * Returns:
- *   0       - Success
- *   -EINVAL - Parameter error
- */
-int tf_em_ext_system_free(struct tf *tfp,
-                         struct tf_free_tbl_scope_parms *parms);
+int tf_em_ext_free(struct tf *tfp,
+                  struct tf_free_tbl_scope_parms *parms);
 
 /**
  * Common free for external EEM using host or system memory
@@ -510,8 +456,8 @@ tf_tbl_ext_free(struct tf *tfp,
  *   - (0) if successful.
  *   - (-EINVAL) on failure.
  */
-int tf_tbl_ext_set(struct tf *tfp,
-                  struct tf_tbl_set_parms *parms);
+int tf_tbl_ext_common_set(struct tf *tfp,
+                         struct tf_tbl_set_parms *parms);
 
 /**
  * Sets the specified external table type element.
@@ -529,26 +475,11 @@ int tf_tbl_ext_set(struct tf *tfp,
  *   - (0) if successful.
  *   - (-EINVAL) on failure.
  */
-int tf_tbl_ext_host_set(struct tf *tfp,
-                       struct tf_tbl_set_parms *parms);
+int tf_tbl_ext_set(struct tf *tfp,
+                  struct tf_tbl_set_parms *parms);
 
-/**
- * Sets the specified external table type element.
- *
- * This API sets the specified element data by invoking the
- * firmware.
- *
- * [in] tfp
- *   Pointer to TF handle
- *
- * [in] parms
- *   Pointer to table set parameters
- *
- * Returns
- *   - (0) if successful.
- *   - (-EINVAL) on failure.
- */
-int tf_tbl_ext_system_set(struct tf *tfp,
-                         struct tf_tbl_set_parms *parms);
+int
+tf_em_ext_system_bind(struct tf *tfp,
+                     struct tf_em_cfg_parms *parms);
 
 #endif /* _TF_EM_H_ */