git: 89491b1edb34 - main - mlx5en: stop arbitrary limiting max wqe size

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 13 Mar 2025 16:03:23 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=89491b1edb3438ebce84e17fdb6c1acab35df601

commit 89491b1edb3438ebce84e17fdb6c1acab35df601
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-02-27 01:54:31 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-03-13 16:01:17 +0000

    mlx5en: stop arbitrary limiting max wqe size
    
    Since the times the driver accepts s/g receive buffers, there is no
    sense in trying to use pre-existing mbuf clusters sizes.  The only
    possible optimization is to use full page size if wqe size is greater
    than MCLBYTES.
    
    Reviewed by:    Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
    Sponsored by:   NVidia networking
    MFC after:      1 week
---
 sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index d69d2e433c9c..8b2acddb869a 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -2321,17 +2321,7 @@ mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs)
 
 	r = priv->params.hw_lro_en ? priv->params.lro_wqe_sz :
 	    MLX5E_SW2MB_MTU(if_getmtu(priv->ifp));
-	if (r > MJUM16BYTES)
-		return (-ENOMEM);
-
-	if (r > MJUM9BYTES)
-		r = MJUM16BYTES;
-	else if (r > MJUMPAGESIZE)
-		r = MJUM9BYTES;
-	else if (r > MCLBYTES)
-		r = MJUMPAGESIZE;
-	else
-		r = MCLBYTES;
+	r = r > MCLBYTES ? MJUMPAGESIZE : MCLBYTES;
 
 	/*
 	 * n + 1 must be a power of two, because stride size must be.