git: 3a934ba7a308 - main - mlx5en: Wait for all TLS connections to terminate when unloading driver.

Hans Petter Selasky hselasky at FreeBSD.org
Mon Jul 12 13:10:04 UTC 2021


The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=3a934ba7a30831dda104e9faad9412f9743c9bae

commit 3a934ba7a30831dda104e9faad9412f9743c9bae
Author:     Hans Petter Selasky <hselasky at FreeBSD.org>
AuthorDate: 2021-06-16 13:01:58 +0000
Commit:     Hans Petter Selasky <hselasky at FreeBSD.org>
CommitDate: 2021-07-12 12:22:34 +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.
    
    MFC after:      1 week
    Reviewed by:    kib
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 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);
 


More information about the dev-commits-src-all mailing list