git: 06c2bd1872d6 - main - mlx5en: Force all packets through the indirection table.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 01 Feb 2022 15:24:25 UTC
The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=06c2bd1872d637da6042da7059eb2800f3cbe4de

commit 06c2bd1872d637da6042da7059eb2800f3cbe4de
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-01 15:20:11 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-01 15:21:15 +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.
    
    MFC after:      1 week
    Sponsored by:   NVIDIA Networking
---
 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 cc7a5dc76131..aa54567ce4ab 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -2918,37 +2918,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: