Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jul 2021 16:13:56 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0ebff67cab8b - stable/13 - mlx5en: Wait for all TLS connections to terminate when unloading driver.
Message-ID:  <202107261613.16QGDuNY006116@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=0ebff67cab8b78e73f7a166fcabad3244edf812f

commit 0ebff67cab8b78e73f7a166fcabad3244edf812f
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-06-16 13:01:58 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-07-26 16:04:33 +0000

    mlx5en: Wait for all TLS connections to terminate when unloading driver.
    
    The driver expects all TLS tags to be returned to the driver before
    it can free the UMA zone where the TLS tags reside.
    
    Reviewed by:    kib
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
    
    (cherry picked from commit 3a934ba7a30831dda104e9faad9412f9743c9bae)
---
 sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c |  2 +-
 sys/dev/mlx5/mlx5_en/mlx5_en_main.c   | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
index 3e63b9e660f1..1a92e5aa222a 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
@@ -288,7 +288,7 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp,
 
 	priv = ifp->if_softc;
 
-	if (priv->tls.init == 0)
+	if (priv->gone != 0 || priv->tls.init == 0)
 		return (EOPNOTSUPP);
 
 	/* allocate new tag from zone, if any */
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 02417f5f931c..d9860c24114b 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -4715,6 +4715,16 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv)
 		pause("W", hz);
 	}
 #endif
+
+#ifdef KERN_TLS
+	/* wait for all TLS tags to get freed */
+	while (priv->tls.init != 0 &&
+	    uma_zone_get_cur(priv->tls.zone) != 0)  {
+		mlx5_en_err(priv->ifp,
+		    "Waiting for all TLS connections to terminate\n");
+		pause("W", hz);
+	}
+#endif
 	/* wait for all unlimited send tags to complete */
 	mlx5e_priv_wait_for_completion(priv, mdev->priv.eq_table.num_comp_vectors);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107261613.16QGDuNY006116>