From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9D921A052B; Wed, 29 Jul 2020 04:15:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BD904C93; Wed, 29 Jul 2020 04:15:00 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id E216737B7 for ; Wed, 29 Jul 2020 04:14:58 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yuvalav@mellanox.com) with SMTP; 29 Jul 2020 05:14:54 +0300 Received: from pegasus04.mtr.labs.mlnx (pegasus04.mtr.labs.mlnx [10.210.16.126]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 06T2Es5R031559; Wed, 29 Jul 2020 05:14:54 +0300 Received: from pegasus04.mtr.labs.mlnx (localhost [127.0.0.1]) by pegasus04.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id 06T2Estn151707; Wed, 29 Jul 2020 02:14:54 GMT Received: (from yuvalav@localhost) by pegasus04.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id 06T2ErxM151704; Wed, 29 Jul 2020 02:14:53 GMT From: Yuval Avnery To: Ori Kam Cc: thomas@monjalon.net, dev@dpdk.org, yuvalav@mellanox.com Date: Wed, 29 Jul 2020 02:14:51 +0000 Message-Id: <1595988891-151622-1-git-send-email-yuvalav@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH v2] regex/mlx5: fix sq free check on enqueue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Free sq check had a bug, causing jobs to overwrite. Fixes: 8740ba5fe57f ("regex/mlx5: add enqueue implementation") Signed-off-by: Yuval Avnery Acked-by: Ori Kam --- drivers/regex/mlx5/mlx5_regex_fastpath.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c index fc5a7fc..4385d85 100644 --- a/drivers/regex/mlx5/mlx5_regex_fastpath.c +++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c @@ -152,10 +152,7 @@ struct mlx5_regex_job { static inline int can_send(struct mlx5_regex_sq *sq) { - return unlikely(sq->ci > sq->pi) ? - MLX5_REGEX_MAX_WQE_INDEX + sq->pi - sq->ci < - sq_size_get(sq) : - sq->pi - sq->ci < sq_size_get(sq); + return ((uint16_t)(sq->pi - sq->ci) < sq_size_get(sq)); } static inline uint32_t -- 1.8.3.1