Home Home > GIT Browse
diff options
authorThomas Bogendoerfer <tbogendoerfer@suse.de>2019-11-05 14:08:48 +0100
committerThomas Bogendoerfer <tbogendoerfer@suse.de>2019-11-05 14:09:49 +0100
commit883e0b601226ff5433f9706dfcd0714d2aa61b2e (patch)
parent6798ea9f9de98305c0a5905b81f2aaed220d542e (diff)
net/mlx5e: Fix handling of compressed CQEs in case of low NAPI
budget (jsc#SLE-8464).
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.suse/net-mlx5e-Fix-handling-of-compressed-CQEs-in-case-of.patch b/patches.suse/net-mlx5e-Fix-handling-of-compressed-CQEs-in-case-of.patch
new file mode 100644
index 0000000000..fb03a15fb8
--- /dev/null
+++ b/patches.suse/net-mlx5e-Fix-handling-of-compressed-CQEs-in-case-of.patch
@@ -0,0 +1,55 @@
+From: Maxim Mikityanskiy <maximmi@mellanox.com>
+Date: Mon, 16 Sep 2019 14:54:20 +0300
+Subject: net/mlx5e: Fix handling of compressed CQEs in case of low NAPI budget
+Patch-mainline: v5.4-rc6
+Git-commit: 9df86bdb6746d7fcfc2fda715f7a7c3d0ddb2654
+References: jsc#SLE-8464
+When CQE compression is enabled, compressed CQEs use the following
+structure: a title is followed by one or many blocks, each containing 8
+mini CQEs (except the last, which may contain fewer mini CQEs).
+Due to NAPI budget restriction, a complete structure is not always
+parsed in one NAPI run, and some blocks with mini CQEs may be deferred
+to the next NAPI poll call - we have the mlx5e_decompress_cqes_cont call
+in the beginning of mlx5e_poll_rx_cq. However, if the budget is
+extremely low, some blocks may be left even after that, but the code
+that follows the mlx5e_decompress_cqes_cont call doesn't check it and
+assumes that a new CQE begins, which may not be the case. In such cases,
+random memory corruptions occur.
+An extremely low NAPI budget of 8 is used when busy_poll or busy_read is
+This commit adds a check to make sure that the previous compressed CQE
+has been completely parsed after mlx5e_decompress_cqes_cont, otherwise
+it prevents a new CQE from being fetched in the middle of a compressed
+This commit fixes random crashes in __build_skb, __page_pool_put_page
+and other not-related-directly places, that used to happen when both CQE
+compression and busy_poll/busy_read were enabled.
+Fixes: 7219ab34f184 ("net/mlx5e: CQE compression")
+Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
+Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+ drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+@@ -1386,8 +1386,11 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq
+ if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))
+ return 0;
+- if (rq->cqd.left)
++ if (rq->cqd.left) {
+ work_done += mlx5e_decompress_cqes_cont(rq, cqwq, 0, budget);
++ if (rq->cqd.left || work_done >= budget)
++ goto out;
++ }
+ cqe = mlx5_cqwq_get_cqe(cqwq);
+ if (!cqe) {
diff --git a/series.conf b/series.conf
index 7fbf92fdee..04fa8ff8a1 100644
--- a/series.conf
+++ b/series.conf
@@ -2878,6 +2878,7 @@
+ patches.suse/net-mlx5e-Fix-handling-of-compressed-CQEs-in-case-of.patch