+/* Number of connection tracking objects per pool: must be a power of 2. */
+#define MLX5_ASO_CT_ACTIONS_PER_POOL 64
+
+/* Generate incremental and unique CT index from pool and offset. */
+#define MLX5_MAKE_CT_IDX(pool, offset) \
+ ((pool) * MLX5_ASO_CT_ACTIONS_PER_POOL + (offset) + 1)
+
+/* ASO Conntrack state. */
+enum mlx5_aso_ct_state {
+ ASO_CONNTRACK_FREE, /* Inactive, in the free list. */
+ ASO_CONNTRACK_WAIT, /* WQE sent in the SQ. */
+ ASO_CONNTRACK_READY, /* CQE received w/o error. */
+ ASO_CONNTRACK_QUERY, /* WQE for query sent. */
+ ASO_CONNTRACK_MAX, /* Guard. */
+};
+
+/* Generic ASO connection tracking structure. */
+struct mlx5_aso_ct_action {
+ LIST_ENTRY(mlx5_aso_ct_action) next; /* Pointer to the next ASO CT. */
+ void *dr_action_orig; /* General action object for original dir. */
+ void *dr_action_rply; /* General action object for reply dir. */
+ uint32_t refcnt; /* Action used count in device flows. */
+ uint16_t offset; /* Offset of ASO CT in DevX objects bulk. */
+ uint16_t peer; /* The only peer port index could also use this CT. */
+ enum mlx5_aso_ct_state state; /* ASO CT state. */
+ bool is_original; /* The direction of the DR action to be used. */
+};
+
+/* CT action object state update. */
+#define MLX5_ASO_CT_UPDATE_STATE(c, s) \
+ __atomic_store_n(&((c)->state), (s), __ATOMIC_RELAXED)
+
+/* ASO connection tracking software pool definition. */
+struct mlx5_aso_ct_pool {
+ uint16_t index; /* Pool index in pools array. */
+ struct mlx5_devx_obj *devx_obj;
+ /* The first devx object in the bulk, used for freeing (not yet). */
+ struct mlx5_aso_ct_action actions[MLX5_ASO_CT_ACTIONS_PER_POOL];
+ /* CT action structures bulk. */
+};
+
+LIST_HEAD(aso_ct_list, mlx5_aso_ct_action);
+
+/* Pools management structure for ASO connection tracking pools. */
+struct mlx5_aso_ct_pools_mng {
+ struct mlx5_aso_ct_pool **pools;
+ uint16_t n; /* Total number of pools. */
+ uint16_t next; /* Number of pools in use, index of next free pool. */
+ rte_spinlock_t ct_sl; /* The ASO CT free list lock. */
+ rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */
+ struct aso_ct_list free_cts; /* Free ASO CT objects list. */
+ struct mlx5_aso_sq aso_sq; /* ASO queue objects. */
+};
+