From: Bing Zhao <bingz@nvidia.com>
To: <dsosnowski@nvidia.com>, <viacheslavo@nvidia.com>, <dev@dpdk.org>,
<rasland@nvidia.com>
Cc: <orika@nvidia.com>, <suanmingm@nvidia.com>, <matan@nvidia.com>,
"Yevgeny Kliteynik" <kliteyn@nvidia.com>
Subject: [PATCH 1/4] net/mlx5/hws: fix state detection of queue full in polling
Date: Tue, 23 Jul 2024 11:15:19 +0300 [thread overview]
Message-ID: <20240723081522.1087433-2-bingz@nvidia.com> (raw)
In-Reply-To: <20240723081522.1087433-1-bingz@nvidia.com>
The sending queue (SQ) size of BWC API is not fixed and the same as
that of other HWS rule insertion SQs. When checking the queue full
state, the number of queue entries and the used entries should be
used instead of the macro "MLX5DR_BWC_MATCHER_REHASH_QUEUE_SZ".
Or else, when resizing the matcher and moving the rules, sometimes
it would fail incorrectly. For example, once a hiccup of generating
CQE happened, the polling of CQ exited directly without any retry.
Then there was no enough room for the next rule to be moved.
Using the correct state of a SQ will solve this issue, the polling
of associative CQ will continue until a new CQE is generated.
Fixes: 87026d2e6601 ("net/mlx5/hws: support backward-compatible API")
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_bwc.c | 4 +++-
drivers/net/mlx5/hws/mlx5dr_bwc.h | 1 -
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_bwc.c b/drivers/net/mlx5/hws/mlx5dr_bwc.c
index e0b6390ed9..9233452118 100644
--- a/drivers/net/mlx5/hws/mlx5dr_bwc.c
+++ b/drivers/net/mlx5/hws/mlx5dr_bwc.c
@@ -181,10 +181,10 @@ mlx5dr_bwc_queue_poll(struct mlx5dr_context *ctx,
uint32_t *pending_rules,
bool drain)
{
- bool queue_full = *pending_rules == MLX5DR_BWC_MATCHER_REHASH_QUEUE_SZ;
struct rte_flow_op_result comp[MLX5DR_BWC_MATCHER_REHASH_BURST_TH];
uint16_t burst_th = mlx5dr_bwc_get_burst_th(ctx, queue_id);
bool got_comp = *pending_rules >= burst_th;
+ bool queue_full;
int err = 0;
int ret;
int i;
@@ -193,6 +193,8 @@ mlx5dr_bwc_queue_poll(struct mlx5dr_context *ctx,
if (!got_comp && !drain)
return 0;
+ /* The FULL state of a SQ is always a subcondition of the original 'got_comp'. */
+ queue_full = mlx5dr_send_engine_full(&ctx->send_queue[queue_id]);
while (queue_full || ((got_comp || drain) && *pending_rules)) {
ret = mlx5dr_send_queue_poll(ctx, queue_id, comp, burst_th);
if (unlikely(ret < 0)) {
diff --git a/drivers/net/mlx5/hws/mlx5dr_bwc.h b/drivers/net/mlx5/hws/mlx5dr_bwc.h
index 648443861b..8c3f721ac2 100644
--- a/drivers/net/mlx5/hws/mlx5dr_bwc.h
+++ b/drivers/net/mlx5/hws/mlx5dr_bwc.h
@@ -9,7 +9,6 @@
#define MLX5DR_BWC_MATCHER_SIZE_LOG_STEP 1
#define MLX5DR_BWC_MATCHER_REHASH_PERCENT_TH 70
#define MLX5DR_BWC_MATCHER_REHASH_BURST_TH 32
-#define MLX5DR_BWC_MATCHER_REHASH_QUEUE_SZ 256
#define MLX5DR_BWC_MATCHER_ATTACH_AT_NUM 255
struct mlx5dr_bwc_matcher {
--
2.34.1
next prev parent reply other threads:[~2024-07-23 8:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 8:15 [PATCH 0/4] non-template fixes set Bing Zhao
2024-07-23 8:15 ` Bing Zhao [this message]
2024-07-23 8:15 ` [PATCH 2/4] net/mlx5: fix releasing order of compatible matcher Bing Zhao
2024-07-23 8:15 ` [PATCH 3/4] net/mlx5: fix matcher mask translation Bing Zhao
2024-07-23 8:15 ` [PATCH 4/4] net/mlx5: fix log error on non-template rule destroy Bing Zhao
2024-08-29 8:59 ` [PATCH 0/4] non-template fixes set Raslan Darawsheh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240723081522.1087433-2-bingz@nvidia.com \
--to=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=kliteyn@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@nvidia.com \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).