Skip to contentSkip to conversation

octeontx2-pf: Fix memory leak during interface down

PATCH Superseded Suman Ghosh 2 participants 3 messages Nov 16, 2023 – Nov 17, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 octeontx2-pf: Fix memory leak during interface down

During 'ifconfig <netdev> down' one RSS memory was not getting freed. This patch fixes the same.

Fixes f12098ce9b43 ("octeontx2-pf: Clear RSS enable flag on interace down")
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +2 -0
index 91b99fd70361..ba95ac913274 100644
@@ -1934,6 +1934,8 @@ int otx2_stop(struct net_device *netdev)
 	/* Clear RSS enable flag */
 	rss = &pf->hw.rss_info;
 	rss->enable = false;
+	if (!netif_is_rxfh_configured(netdev))
+		kfree(rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]);
 
 	/* Cleanup Queue IRQ */
 	vec = pci_irq_vector(pf->pdev,
Signature · 1 line
2.25.1
reviewer
#1 lore raw
Quoted 5 lines · Suman Ghosh

During 'ifconfig <netdev> down' one RSS memory was not getting freed. This patch fixes the same.

Fixes f12098ce9b43 ("octeontx2-pf: Clear RSS enable flag on interace down")

Hi Suman,

I'm wondering if the fixes tag should refer to the commit that introduced the allocation that your patch is freeing.

Fixes 81a4362016e7 ("octeontx2-pf: Add RSS multi group support")
Quoted 20 lines
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +2 -0
index 91b99fd70361..ba95ac913274 100644
@@ -1934,6 +1934,8 @@ int otx2_stop(struct net_device *netdev)
 	/* Clear RSS enable flag */
 	rss = &pf->hw.rss_info;
 	rss->enable = false;
+	if (!netif_is_rxfh_configured(netdev))
+		kfree(rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]);
 
 	/* Cleanup Queue IRQ */
 	vec = pci_irq_vector(pf->pdev,
Signature · 1 line
2.25.1
#2 lore raw
Quoted 4 lines

Hi Suman,

I'm wondering if the fixes tag should refer to the commit that introduced the allocation that your patch is freeing.

[Suman] Yes, that make sense. I will update in v2.

Quoted 24 lines
Fixes 81a4362016e7 ("octeontx2-pf: Add RSS multi group support")
Quoted 21 lines
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +2 -1
index 91b99fd70361..ba95ac913274 100644
@@ -1934,6 +1934,8 @@ int otx2_stop(struct net_device *netdev)
 	/* Clear RSS enable flag */
 	rss = &pf->hw.rss_info;
 	rss->enable = false;
+	if (!netif_is_rxfh_configured(netdev))
+		kfree(rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]);
 
 	/* Cleanup Queue IRQ */
 	vec = pci_irq_vector(pf->pdev,
--

2.25.1