git: 428331a8bf27 - stable/13 - mlx5en: Force all packets through the indirection table.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 08 Feb 2022 15:14:02 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=428331a8bf27862bb702261291cd805c99b4d249

commit 428331a8bf27862bb702261291cd805c99b4d249
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-08 15:08:53 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-08 15:08:53 +0000

    mlx5en: Force all packets through the indirection table.
    
    All packets must go through the indirection table, RQT,
    because it is not possible to modify the RQN of the TIR
    for direct dispatchment after it is created, typically
    when the link goes up and down.
    
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit 06c2bd1872d637da6042da7059eb2800f3cbe4de)
---
 sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 51 +++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 6a7e8ce606af..5d6bb78c4157 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -2910,37 +2910,32 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt, bool inner_vxla
 	if (inner_vxlan)
 		MLX5_SET(tirc, tirc, tunneled_offload_en, 1);
 
-	/* setup parameters for hashing TIR type, if any */
-	switch (tt) {
-	case MLX5E_TT_ANY:
-		MLX5_SET(tirc, tirc, disp_type,
-		    MLX5_TIRC_DISP_TYPE_DIRECT);
-		MLX5_SET(tirc, tirc, inline_rqn,
-		    priv->channel[0].rq.rqn);
-		break;
-	default:
-		MLX5_SET(tirc, tirc, disp_type,
-		    MLX5_TIRC_DISP_TYPE_INDIRECT);
-		MLX5_SET(tirc, tirc, indirect_table,
-		    priv->rqtn);
-		MLX5_SET(tirc, tirc, rx_hash_fn,
-		    MLX5_TIRC_RX_HASH_FN_HASH_TOEPLITZ);
-		hkey = (__be32 *) MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key);
-
-		CTASSERT(MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key) >=
-		    MLX5E_RSS_KEY_SIZE);
+	/*
+	 * All packets must go through the indirection table, RQT,
+	 * because it is not possible to modify the RQN of the TIR
+	 * for direct dispatchment after it is created, typically
+	 * when the link goes up and down.
+	 */
+	MLX5_SET(tirc, tirc, disp_type,
+	    MLX5_TIRC_DISP_TYPE_INDIRECT);
+	MLX5_SET(tirc, tirc, indirect_table,
+	    priv->rqtn);
+	MLX5_SET(tirc, tirc, rx_hash_fn,
+		 MLX5_TIRC_RX_HASH_FN_HASH_TOEPLITZ);
+	hkey = (__be32 *) MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key);
+
+	CTASSERT(MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key) >=
+		 MLX5E_RSS_KEY_SIZE);
 #ifdef RSS
-		/*
-		 * The FreeBSD RSS implementation does currently not
-		 * support symmetric Toeplitz hashes:
-		 */
-		MLX5_SET(tirc, tirc, rx_hash_symmetric, 0);
+	/*
+	 * The FreeBSD RSS implementation does currently not
+	 * support symmetric Toeplitz hashes:
+	 */
+	MLX5_SET(tirc, tirc, rx_hash_symmetric, 0);
 #else
-		MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
+	MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
 #endif
-		mlx5e_get_rss_key(hkey);
-		break;
-	}
+	mlx5e_get_rss_key(hkey);
 
 	switch (tt) {
 	case MLX5E_TT_IPV4_TCP: