All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Moshe Shemesh <moshe@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net 3/9] net/mlx5e: RX, Verify MPWQE stride size is in range
Date: Thu, 13 Dec 2018 08:45:32 -0800	[thread overview]
Message-ID: <20181213164538.31436-4-saeedm@mellanox.com> (raw)
In-Reply-To: <20181213164538.31436-1-saeedm@mellanox.com>

From: Moshe Shemesh <moshe@mellanox.com>

Add check of MPWQE stride size is within range supported by HW. In case
calculated MPWQE stride size exceed range, linear SKB can't be used and
we should use non linear MPWQE instead.

Fixes: 619a8f2a42f1 ("net/mlx5e: Use linear SKB in Striding RQ")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 871313d6b34d..c17de6a990ff 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -128,6 +128,8 @@ static bool mlx5e_rx_is_linear_skb(struct mlx5_core_dev *mdev,
 	return !params->lro_en && frag_sz <= PAGE_SIZE;
 }
 
+#define MLX5_MAX_MPWQE_LOG_WQE_STRIDE_SZ ((BIT(__mlx5_bit_sz(wq, log_wqe_stride_size)) - 1) + \
+					  MLX5_MPWQE_LOG_STRIDE_SZ_BASE)
 static bool mlx5e_rx_mpwqe_is_linear_skb(struct mlx5_core_dev *mdev,
 					 struct mlx5e_params *params)
 {
@@ -138,6 +140,9 @@ static bool mlx5e_rx_mpwqe_is_linear_skb(struct mlx5_core_dev *mdev,
 	if (!mlx5e_rx_is_linear_skb(mdev, params))
 		return false;
 
+	if (order_base_2(frag_sz) > MLX5_MAX_MPWQE_LOG_WQE_STRIDE_SZ)
+		return false;
+
 	if (MLX5_CAP_GEN(mdev, ext_stride_num_range))
 		return true;
 
-- 
2.19.2

  parent reply	other threads:[~2018-12-13 16:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 16:45 [pull request][net 0/9] Mellanox, mlx5 fixes 2018-12-13 Saeed Mahameed
2018-12-13 16:45 ` [net 1/9] net/mlx5: E-Switch, Fix fdb cap bits swap Saeed Mahameed
2018-12-13 16:45 ` [net 2/9] net/mlx5e: Fix default amount of channels for VF representors Saeed Mahameed
2018-12-13 16:45 ` Saeed Mahameed [this message]
2018-12-13 16:45 ` [net 4/9] net/mlx5e: Err if asked to mirror a goto chain tc eswitch rule Saeed Mahameed
2018-12-13 16:45 ` [net 5/9] net/mlx5e: Avoid overriding the user provided priority for offloaded tc rules Saeed Mahameed
2018-12-13 16:45 ` [net 6/9] net/mlx5e: Properly initialize flow attributes for slow path eswitch rule deletion Saeed Mahameed
2018-12-13 16:45 ` [net 7/9] net/mlx5e: Avoid encap flows deletion attempt the 1st time a neigh is resolved Saeed Mahameed
2018-12-13 16:45 ` [net 8/9] net/mlx5e: Remove unused UDP GSO remaining counter Saeed Mahameed
2018-12-13 16:45 ` [net 9/9] net/mlx5e: Cancel DIM work on close SQ Saeed Mahameed
2018-12-14  3:32 ` [pull request][net 0/9] Mellanox, mlx5 fixes 2018-12-13 David Miller
2018-12-14 19:03   ` Saeed Mahameed

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=20181213164538.31436-4-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=moshe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.