DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] net/i40e: fix memory leaks
@ 2026-10-23 10:31 Anurag Mandal
  2026-10-23 10:31 ` [PATCH 1/2] net/i40e: fix floating VEB leak Anurag Mandal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anurag Mandal @ 2026-10-23 10:31 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Anurag Mandal

This series fixes few memory leaks in the i40e PMD:

1. When the main VSI was released, only the VSIs attached 
   to the floating VEB were released, not the VEB itself,
   leaking the VEB structure and its switch element. 
   This only affects setups with floating VEB enabled.

2. The flow director programming packet memzone was reserved
   at setup but never freed, so it leaked whenever the port 
   was closed.

Anurag Mandal (2):
  net/i40e: fix floating VEB leak
  net/i40e: fix FDIR memzone leak

 drivers/net/intel/i40e/i40e_ethdev.c | 1 +
 drivers/net/intel/i40e/i40e_ethdev.h | 1 +
 drivers/net/intel/i40e/i40e_fdir.c   | 4 ++++
 3 files changed, 6 insertions(+)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] net/i40e: fix floating VEB leak
  2026-10-23 10:31 [PATCH 0/2] net/i40e: fix memory leaks Anurag Mandal
@ 2026-10-23 10:31 ` Anurag Mandal
  2026-10-23 10:31 ` [PATCH 2/2] net/i40e: fix FDIR memzone leak Anurag Mandal
  2026-10-23 14:55 ` [PATCH 0/2] net/i40e: fix memory leaks Bruce Richardson
  2 siblings, 0 replies; 4+ messages in thread
From: Anurag Mandal @ 2026-10-23 10:31 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Anurag Mandal

With floating VEB enabled, i40e_vsi_release() releases the VSIs
attached to the floating VEB of the main VSI but not the floating
VEB itself, leaking the VEB structure and its switch element.

Release it once its VSIs are gone, as is already done for the
regular VEB.

Fixes: 440499cf5376 ("net/i40e: support floating VEB")

Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
---
 drivers/net/intel/i40e/i40e_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index e26a849764..9ca01ecd34 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -5329,6 +5329,7 @@ i40e_vsi_release(struct i40e_vsi *vsi)
 			if (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS)
 				return -1;
 		}
+		i40e_veb_release(vsi->floating_veb);
 	}
 
 	/* Remove all macvlan filters of the VSI */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net/i40e: fix FDIR memzone leak
  2026-10-23 10:31 [PATCH 0/2] net/i40e: fix memory leaks Anurag Mandal
  2026-10-23 10:31 ` [PATCH 1/2] net/i40e: fix floating VEB leak Anurag Mandal
@ 2026-10-23 10:31 ` Anurag Mandal
  2026-10-23 14:55 ` [PATCH 0/2] net/i40e: fix memory leaks Bruce Richardson
  2 siblings, 0 replies; 4+ messages in thread
From: Anurag Mandal @ 2026-10-23 10:31 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Anurag Mandal

The memzone holding the flow director programming packets is reserved
in i40e_fdir_setup() but never freed, as i40e_fdir_teardown() only
releases the FDIR queues and VSI.
It is therefore leaked when the port is closed.

Store the memzone pointer and free it on teardown.

Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: 71d35259ff67 ("i40e: tear down flow director")

Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
---
 drivers/net/intel/i40e/i40e_ethdev.h | 1 +
 drivers/net/intel/i40e/i40e_fdir.c   | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/intel/i40e/i40e_ethdev.h b/drivers/net/intel/i40e/i40e_ethdev.h
index 68bff99b5d..77f79fc7da 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.h
+++ b/drivers/net/intel/i40e/i40e_ethdev.h
@@ -790,6 +790,7 @@ struct i40e_fdir_info {
 	struct ci_rx_queue *rxq;
 	void *prg_pkt[I40E_FDIR_PRG_PKT_CNT];     /* memory for fdir program packet */
 	uint64_t dma_addr[I40E_FDIR_PRG_PKT_CNT]; /* physic address of packet memory*/
+	const struct rte_memzone *prg_mz;         /* memzone backing prg_pkt */
 	/*
 	 * txq available buffer counter, indicates how many available buffers
 	 * for fdir programming, initialized as I40E_FDIR_PRG_PKT_CNT
diff --git a/drivers/net/intel/i40e/i40e_fdir.c b/drivers/net/intel/i40e/i40e_fdir.c
index 71cab77e83..2464eb47c2 100644
--- a/drivers/net/intel/i40e/i40e_fdir.c
+++ b/drivers/net/intel/i40e/i40e_fdir.c
@@ -241,6 +241,8 @@ i40e_fdir_setup(struct i40e_pf *pf)
 			I40E_FDIR_PKT_LEN * i;
 	}
 
+	pf->fdir.prg_mz = mz;
+
 	pf->fdir.match_counter_index = I40E_COUNTER_INDEX_FDIR(hw->pf_id);
 
 	PMD_DRV_LOG(INFO, "FDIR setup successfully, with programming queue %u.",
@@ -297,6 +299,8 @@ i40e_fdir_teardown(struct i40e_pf *pf)
 	pf->fdir.rxq = NULL;
 	i40e_tx_queue_release(pf->fdir.txq);
 	pf->fdir.txq = NULL;
+	rte_memzone_free(pf->fdir.prg_mz);
+	pf->fdir.prg_mz = NULL;
 	i40e_vsi_release(vsi);
 	pf->fdir.fdir_vsi = NULL;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] net/i40e: fix memory leaks
  2026-10-23 10:31 [PATCH 0/2] net/i40e: fix memory leaks Anurag Mandal
  2026-10-23 10:31 ` [PATCH 1/2] net/i40e: fix floating VEB leak Anurag Mandal
  2026-10-23 10:31 ` [PATCH 2/2] net/i40e: fix FDIR memzone leak Anurag Mandal
@ 2026-10-23 14:55 ` Bruce Richardson
  2 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2026-10-23 14:55 UTC (permalink / raw)
  To: Anurag Mandal; +Cc: dev

On Fri, Oct 23, 2026 at 10:31:28AM +0000, Anurag Mandal wrote:
> This series fixes few memory leaks in the i40e PMD:
> 
> 1. When the main VSI was released, only the VSIs attached 
>    to the floating VEB were released, not the VEB itself,
>    leaking the VEB structure and its switch element. 
>    This only affects setups with floating VEB enabled.
> 
> 2. The flow director programming packet memzone was reserved
>    at setup but never freed, so it leaked whenever the port 
>    was closed.
> 
> Anurag Mandal (2):
>   net/i40e: fix floating VEB leak
>   net/i40e: fix FDIR memzone leak
> 
>  drivers/net/intel/i40e/i40e_ethdev.c | 1 +
>  drivers/net/intel/i40e/i40e_ethdev.h | 1 +
>  drivers/net/intel/i40e/i40e_fdir.c   | 4 ++++
>  3 files changed, 6 insertions(+)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Series applied to dpdk-next-net-intel,
Thanks,
/Bruce


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-23 14:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 10:31 [PATCH 0/2] net/i40e: fix memory leaks Anurag Mandal
2026-10-23 10:31 ` [PATCH 1/2] net/i40e: fix floating VEB leak Anurag Mandal
2026-10-23 10:31 ` [PATCH 2/2] net/i40e: fix FDIR memzone leak Anurag Mandal
2026-10-23 14:55 ` [PATCH 0/2] net/i40e: fix memory leaks Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox