- for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
- idx++)
- wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
- RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
- (MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
+ }
+}
+
+/*
+ * Initialize Send Queue used for ASO connection tracking.
+ *
+ * @param[in] sq
+ * ASO SQ to initialize.
+ */
+static void
+mlx5_aso_ct_init_sq(struct mlx5_aso_sq *sq)
+{
+ volatile struct mlx5_aso_wqe *restrict wqe;
+ int i;
+ int size = 1 << sq->log_desc_n;
+ uint64_t addr;
+
+ /* All the next fields state should stay constant. */
+ for (i = 0, wqe = &sq->sq_obj.aso_wqes[0]; i < size; ++i, ++wqe) {
+ wqe->general_cseg.sq_ds = rte_cpu_to_be_32((sq->sqn << 8) |
+ (sizeof(*wqe) >> 4));
+ /* One unique MR for the query data. */
+ wqe->aso_cseg.lkey = rte_cpu_to_be_32(sq->mr.lkey);
+ /* Magic number 64 represents the length of a ASO CT obj. */
+ addr = (uint64_t)((uintptr_t)sq->mr.addr + i * 64);
+ wqe->aso_cseg.va_h = rte_cpu_to_be_32((uint32_t)(addr >> 32));
+ wqe->aso_cseg.va_l_r = rte_cpu_to_be_32((uint32_t)addr | 1u);
+ /*
+ * The values of operand_masks are different for modify
+ * and query.
+ * And data_mask may be different for each modification. In
+ * query, it could be zero and ignored.
+ * CQE generation is always needed, in order to decide when
+ * it is available to create the flow or read the data.
+ */
+ wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
+ MLX5_COMP_MODE_OFFSET);