net/ixgbe: check driver type in MACsec API
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_flow_db.h
index f6055a5..ebca849 100644 (file)
@@ -51,6 +51,8 @@ enum bnxt_ulp_flow_db_tables {
 /* Structure for the flow database resource information. */
 struct bnxt_ulp_flow_db {
        struct bnxt_ulp_flow_tbl        flow_tbl[BNXT_ULP_FLOW_TABLE_MAX];
+       uint16_t                        *func_id_tbl;
+       uint32_t                        func_id_tbl_size;
 };
 
 /* flow db resource params to add resources */
@@ -83,6 +85,21 @@ int32_t      ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt);
  */
 int32_t        ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt);
 
+/*
+ * Allocate the flow database entry
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * func_id [in] The function id of the device.Valid only for regular flows.
+ * fid [out] The index to the flow entry
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t ulp_flow_db_fid_alloc(struct bnxt_ulp_context *ulp_ctxt,
+                             enum bnxt_ulp_flow_db_tables tbl_idx,
+                             uint16_t func_id,
+                             uint32_t *fid);
+
 /*
  * Allocate the flow database entry.
  * The params->critical_resource has to be set to 0 to allocate a new resource.
@@ -99,4 +116,98 @@ int32_t     ulp_flow_db_resource_add(struct bnxt_ulp_context        *ulp_ctxt,
                                 uint32_t                       fid,
                                 struct ulp_flow_db_res_params  *params);
 
+/*
+ * Free the flow database entry.
+ * The params->critical_resource has to be set to 1 to free the first resource.
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ * params [in/out] The contents to be copied into params.
+ * Only the critical_resource needs to be set by the caller.
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t        ulp_flow_db_resource_del(struct bnxt_ulp_context        *ulp_ctxt,
+                                enum bnxt_ulp_flow_db_tables   tbl_idx,
+                                uint32_t                       fid,
+                                struct ulp_flow_db_res_params  *params);
+
+/*
+ * Free the flow database entry
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t        ulp_flow_db_fid_free(struct bnxt_ulp_context            *ulp_ctxt,
+                            enum bnxt_ulp_flow_db_tables       tbl_idx,
+                            uint32_t                           fid);
+
+/*
+ *Get the flow database entry details
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ * nxt_idx [in/out] the index to the next entry
+ * params [out] The contents to be copied into params.
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t        ulp_flow_db_resource_get(struct bnxt_ulp_context        *ulp_ctxt,
+                                enum bnxt_ulp_flow_db_tables   tbl_idx,
+                                uint32_t                       fid,
+                                uint32_t                       *nxt_idx,
+                                struct ulp_flow_db_res_params  *params);
+
+/*
+ * Flush all flows in the flow database.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * tbl_idx [in] The index to table
+ *
+ * returns 0 on success or negative number on failure
+ */
+int32_t        ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
+                               uint32_t                idx);
+
+/*
+ * Flush all flows in the flow database that belong to a device function.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * tbl_idx [in] The index to table
+ *
+ * returns 0 on success or negative number on failure
+ */
+int32_t
+ulp_flow_db_function_flow_flush(struct bnxt_ulp_context *ulp_ctx,
+                               uint16_t func_id);
+
+/*
+ * Flush all flows in the flow database that are associated with the session.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ *
+ * returns 0 on success or negative number on failure
+ */
+int32_t
+ulp_flow_db_session_flow_flush(struct bnxt_ulp_context *ulp_ctx);
+
+/*
+ * Check that flow id matches the function id or not
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * flow_db [in] Ptr to flow table
+ * func_id [in] The func_id to be set, for reset pass zero.
+ *
+ * returns true on success or false on failure
+ */
+bool
+ulp_flow_db_validate_flow_func(struct bnxt_ulp_context *ulp_ctx,
+                              uint32_t flow_id,
+                              uint32_t func_id);
+
 #endif /* _ULP_FLOW_DB_H_ */