Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2019 16:03:46 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r347741 - stable/12/sys/dev/mlx5/mlx5_en
Message-ID:  <201905161603.x4GG3kxq058460@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu May 16 16:03:46 2019
New Revision: 347741
URL: https://svnweb.freebsd.org/changeset/base/347741

Log:
  MFC r347277:
  Avoid leaking send queue mbufs during error recovery in mlx5en(4).
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu May 16 16:03:02 2019	(r347740)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu May 16 16:03:46 2019	(r347741)
@@ -1147,8 +1147,13 @@ mlx5e_free_sq_db(struct mlx5e_sq *sq)
 	int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
 	int x;
 
-	for (x = 0; x != wq_sz; x++)
+	for (x = 0; x != wq_sz; x++) {
+		if (sq->mbuf[x].mbuf != NULL) {
+			bus_dmamap_unload(sq->dma_tag, sq->mbuf[x].dma_map);
+			m_freem(sq->mbuf[x].mbuf);
+		}
 		bus_dmamap_destroy(sq->dma_tag, sq->mbuf[x].dma_map);
+	}
 	free(sq->mbuf, M_MLX5EN);
 }
 

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Thu May 16 16:03:02 2019	(r347740)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Thu May 16 16:03:46 2019	(r347741)
@@ -537,7 +537,7 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget)
 		for (x = 0; x != sq->cev_factor; x++) {
 			ci = sqcc & sq->wq.sz_m1;
 			mb = sq->mbuf[ci].mbuf;
-			sq->mbuf[ci].mbuf = NULL;	/* Safety clear */
+			sq->mbuf[ci].mbuf = NULL;
 
 			if (mb == NULL) {
 				if (sq->mbuf[ci].num_bytes == 0) {



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