svn commit: r347741 - stable/12/sys/dev/mlx5/mlx5_en

Hans Petter Selasky hselasky at FreeBSD.org
Thu May 16 16:03:47 UTC 2019


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) {


More information about the svn-src-all mailing list