net/bnxt: use NAT IPv4 action
[dpdk.git] / drivers / net / bnxt / tf_core / tf_core.h
index 9e80426..67415ad 100644 (file)
@@ -162,7 +162,13 @@ enum tf_identifier_type {
         *  and can be used in WC TCAM or EM keys to virtualize further
         *  lookups.
         */
-       TF_IDENT_TYPE_L2_CTXT,
+       TF_IDENT_TYPE_L2_CTXT_HIGH,
+       /**
+        *  The L2 Context is returned from the L2 Ctxt TCAM lookup
+        *  and can be used in WC TCAM or EM keys to virtualize further
+        *  lookups.
+        */
+       TF_IDENT_TYPE_L2_CTXT_LOW,
        /**
         *  The WC profile func is returned from the L2 Ctxt TCAM lookup
         *  to enable virtualization of the profile TCAM.
@@ -222,9 +228,7 @@ enum tf_tbl_type {
        /** Wh+/SR Action Modify L4 Dest Port */
        TF_TBL_TYPE_ACT_MODIFY_DPORT,
        /** Wh+/SR Action Modify IPv4 Source */
-       TF_TBL_TYPE_ACT_MODIFY_IPV4_SRC,
-       /** Wh+/SR Action _Modify L4 Dest Port */
-       TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST,
+       TF_TBL_TYPE_ACT_MODIFY_IPV4,
        /** Meter Profiles */
        TF_TBL_TYPE_METER_PROF,
        /** Meter Instance */
@@ -270,7 +274,9 @@ enum tf_tbl_type {
  */
 enum tf_tcam_tbl_type {
        /** L2 Context TCAM */
-       TF_TCAM_TBL_TYPE_L2_CTXT_TCAM,
+       TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH,
+       /** L2 Context TCAM */
+       TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
        /** Profile TCAM */
        TF_TCAM_TBL_TYPE_PROF_TCAM,
        /** Wildcard TCAM */
@@ -695,9 +701,9 @@ struct tf_alloc_identifier_parms {
         */
        enum tf_identifier_type ident_type;
        /**
-        * [out] Identifier allocated
+        * [out] Allocated identifier
         */
-       uint16_t id;
+       uint32_t id;
 };
 
 /**
@@ -715,7 +721,38 @@ struct tf_free_identifier_parms {
        /**
         * [in] ID to free
         */
-       uint16_t id;
+       uint32_t id;
+       /**
+        * (experimental)
+        * [out] Current refcnt after free
+        */
+       uint32_t ref_cnt;
+};
+
+/**
+ * tf_search_identifier parameter definition (experimental)
+ */
+struct tf_search_identifier_parms {
+       /**
+        * [in]  receive or transmit direction
+        */
+       enum tf_dir dir;
+       /**
+        * [in] Identifier type
+        */
+       enum tf_identifier_type ident_type;
+       /**
+        * [in] Identifier data to search for
+        */
+       uint32_t search_id;
+       /**
+        * [out] Set if matching identifier found
+        */
+       bool hit;
+       /**
+        * [out] Current ref count after allocation
+        */
+       uint32_t ref_cnt;
 };
 
 /**
@@ -724,6 +761,9 @@ struct tf_free_identifier_parms {
  * TruFlow core will allocate a free id from the per identifier resource type
  * pool reserved for the session during tf_open().  No firmware is involved.
  *
+ * If shadow copy is enabled, the internal ref_cnt is set to 1 in the
+ * shadow table for a newly allocated resource.
+ *
  * Returns success or failure code.
  */
 int tf_alloc_identifier(struct tf *tfp,
@@ -736,11 +776,41 @@ int tf_alloc_identifier(struct tf *tfp,
  * reserved for the session.  No firmware is involved.  During tf_close, the
  * complete pool is returned to the firmware.
  *
+ * additional operation (experimental)
+ * Decrement reference count.  Only release resource once refcnt goes to 0 if
+ * shadow copy is enabled.
+ *
  * Returns success or failure code.
  */
 int tf_free_identifier(struct tf *tfp,
                       struct tf_free_identifier_parms *parms);
 
+/**
+ * Search identifier resource (experimental)
+ *
+ * If the shadow copy is enabled search_id is used to search for a matching
+ * entry in the shadow table.  The shadow table consists of an array of
+ * reference counts indexed by identifier.  If a matching entry is found hit is
+ * set to TRUE, refcnt is increased by 1 and returned.  Otherwise, hit is
+ * set to false and refcnt is set to 0.
+ *
+ * TODO: we may need a per table internal shadow copy enable flag to stage
+ * the shadow table implementation.  We do not need the shadow table for other
+ * tables at this time so we may only want to enable the identifier shadow.
+ *
+ * TODO: remove this pseudocode below added to show that if search fails
+ * we shouldn't allocate a new entry but return.
+ *
+ * identifier alloc (search_en=1)
+ * if (ident is allocated and ref_cnt >=1)
+ *      return ident - hit is set, incr refcnt
+ * else (not found)
+ *      return
+ *
+ */
+int tf_search_identifier(struct tf *tfp,
+                        struct tf_search_identifier_parms *parms);
+
 /**
  * @page dram_table DRAM Table Scope Interface
  *
@@ -1362,10 +1432,12 @@ struct tf_bulk_get_tbl_entry_parms {
 /**
  * Bulk get index table entry
  *
- * Used to retrieve a previous set index table entry.
+ * Used to retrieve a set of index table entries.
  *
- * Reads and compares with the shadow table copy (if enabled) (only
- * for internal objects).
+ * Entries within the range may not have been allocated using
+ * tf_alloc_tbl_entry() at the time of access. But the range must
+ * be within the bounds determined from tf_open_session() for the
+ * given table type.  Currently, this is only used for collecting statistics.
  *
  * Returns success or failure code. Failure will be returned if the
  * provided data buffer is too small for the data type requested.