DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] regex/mlx5: fix sq free check on enqueue
@ 2020-07-28 17:54 Yuval Avnery
  2020-07-29  0:42 ` Yuval Avnery
  0 siblings, 1 reply; 2+ messages in thread
From: Yuval Avnery @ 2020-07-28 17:54 UTC (permalink / raw)
  To: Ori Kam; +Cc: thomas, dev, yuvalav

Free sq check had a bug, causing jobs to overwrite.

Fixes: 8740ba5fe57f ("regex/mlx5: add enqueue implementation")
Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
---
 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..8dfa72c 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 ((sq->ci - sq->pi) & (sq_size_get(sq) - 1)) != 1;
 }
 
 static inline uint32_t
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH v1] regex/mlx5: fix sq free check on enqueue
  2020-07-28 17:54 [dpdk-dev] [PATCH v1] regex/mlx5: fix sq free check on enqueue Yuval Avnery
@ 2020-07-29  0:42 ` Yuval Avnery
  0 siblings, 0 replies; 2+ messages in thread
From: Yuval Avnery @ 2020-07-29  0:42 UTC (permalink / raw)
  To: Yuval Avnery, Ori Kam; +Cc: Thomas Monjalon, dev

There is a bug here, will send another version

> -----Original Message-----
> From: Yuval Avnery <yuvalav@mellanox.com>
> Sent: Tuesday, July 28, 2020 10:55 AM
> To: Ori Kam <orika@mellanox.com>
> Cc: Thomas Monjalon <thomas@monjalon.net>; dev@dpdk.org; Yuval
> Avnery <yuvalav@mellanox.com>
> Subject: [PATCH v1] regex/mlx5: fix sq free check on enqueue
> 
> Free sq check had a bug, causing jobs to overwrite.
> 
> Fixes: 8740ba5fe57f ("regex/mlx5: add enqueue implementation")
> Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
> Acked-by: Ori Kam <orika@mellanox.com>
> ---
>  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..8dfa72c 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 ((sq->ci - sq->pi) & (sq_size_get(sq) - 1)) != 1;
>  }
> 
>  static inline uint32_t
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-29  0:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 17:54 [dpdk-dev] [PATCH v1] regex/mlx5: fix sq free check on enqueue Yuval Avnery
2020-07-29  0:42 ` Yuval Avnery

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git