regex/mlx5: fix support for group id
authorOri Kam <orika@nvidia.com>
Thu, 7 Jan 2021 16:57:09 +0000 (18:57 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 19 Jan 2021 17:04:33 +0000 (18:04 +0100)
In order to know which groups in the RegEx engine
should be used there is a need to check the req_flags.

This commit adds the missing check.

Fixes: 4d4e245ad637 ("regex/mlx5: support enqueue")
Cc: stable@dpdk.org
Signed-off-by: Ori Kam <orika@nvidia.com>
drivers/regex/mlx5/mlx5_regex_fastpath.c

index 3a0a218..35ebcd9 100644 (file)
@@ -105,7 +105,21 @@ prep_one(struct mlx5_regex_priv *priv, struct mlx5_regex_qp *qp,
 {
        size_t wqe_offset = (sq->pi & (sq_size_get(sq) - 1)) * MLX5_SEND_WQE_BB;
        uint32_t lkey;
-
+       uint16_t group0 = op->req_flags & RTE_REGEX_OPS_REQ_GROUP_ID0_VALID_F ?
+                               op->group_id0 : 0;
+       uint16_t group1 = op->req_flags & RTE_REGEX_OPS_REQ_GROUP_ID1_VALID_F ?
+                               op->group_id1 : 0;
+       uint16_t group2 = op->req_flags & RTE_REGEX_OPS_REQ_GROUP_ID2_VALID_F ?
+                               op->group_id2 : 0;
+       uint16_t group3 = op->req_flags & RTE_REGEX_OPS_REQ_GROUP_ID3_VALID_F ?
+                               op->group_id3 : 0;
+
+       /* For backward compatibility. */
+       if (!(op->req_flags & (RTE_REGEX_OPS_REQ_GROUP_ID0_VALID_F |
+                              RTE_REGEX_OPS_REQ_GROUP_ID1_VALID_F |
+                              RTE_REGEX_OPS_REQ_GROUP_ID2_VALID_F |
+                              RTE_REGEX_OPS_REQ_GROUP_ID3_VALID_F)))
+               group0 = op->group_id0;
        lkey = mlx5_mr_addr2mr_bh(priv->pd, 0,
                                  &priv->mr_scache, &qp->mr_ctrl,
                                  rte_pktmbuf_mtod(op->mbuf, uintptr_t),
@@ -116,9 +130,8 @@ prep_one(struct mlx5_regex_priv *priv, struct mlx5_regex_qp *qp,
        set_wqe_ctrl_seg((struct mlx5_wqe_ctrl_seg *)wqe, sq->pi,
                         MLX5_OPCODE_MMO, MLX5_OPC_MOD_MMO_REGEX,
                         sq->sq_obj.sq->id, 0, ds, 0, 0);
-       set_regex_ctrl_seg(wqe + 12, 0, op->group_id0, op->group_id1,
-                          op->group_id2,
-                          op->group_id3, 0);
+       set_regex_ctrl_seg(wqe + 12, 0, group0, group1, group2, group3,
+                          0);
        struct mlx5_wqe_data_seg *input_seg =
                (struct mlx5_wqe_data_seg *)(wqe +
                                             MLX5_REGEX_WQE_GATHER_OFFSET);