[dpdk-dev,4/5] l3fwd-power: fix a memory leak for non-ip packet

Message ID 1443159425-32502-5-git-send-email-shaopeng.he@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

He, Shaopeng Sept. 25, 2015, 5:37 a.m. UTC
  Previous l3fwd-power only processes IP and IPv6 packet, other
packet's mbuf is not released, and causes a memory leak.
This patch fixes this issue.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
---
 examples/l3fwd-power/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

De Lara Guarch, Pablo Sept. 25, 2015, 7:19 a.m. UTC | #1
Hi Shaopeng,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shaopeng He
> Sent: Friday, September 25, 2015 6:37 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 4/5] l3fwd-power: fix a memory leak for non-ip
> packet
> 
> Previous l3fwd-power only processes IP and IPv6 packet, other
> packet's mbuf is not released, and causes a memory leak.
> This patch fixes this issue.

Is this patch related to the rest of the patchset? Something where fm10k is involved?
Because it does not look like.

Thanks,
Pablo

> 
> Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
> ---
>  examples/l3fwd-power/main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index 8bb88ce..ecdff73 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -714,7 +714,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t
> portid,
>  		/* We don't currently handle IPv6 packets in LPM mode. */
>  		rte_pktmbuf_free(m);
>  #endif
> -	}
> +	} else
> +		rte_pktmbuf_free(m);
> 
>  }
> 
> --
> 1.9.3
  
He, Shaopeng Sept. 25, 2015, 9 a.m. UTC | #2
Hi, Pablo

> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Friday, September 25, 2015 3:19 PM
> To: He, Shaopeng; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH 4/5] l3fwd-power: fix a memory leak for
> non-ip packet
> 
> Hi Shaopeng,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shaopeng He
> > Sent: Friday, September 25, 2015 6:37 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH 4/5] l3fwd-power: fix a memory leak for
> > non-ip packet
> >
> > Previous l3fwd-power only processes IP and IPv6 packet, other packet's
> > mbuf is not released, and causes a memory leak.
> > This patch fixes this issue.
> 
> Is this patch related to the rest of the patchset? Something where fm10k is
> involved?
> Because it does not look like.

Thanks for the comments.

This bug almost happens every time with fm10k when testing this interrupt mode. 
But for other NIC cards, it rarely occurs. It is because of that right now only fm10k 
has the switch core, by that, other types of packets sneak into the testing. 
I include this bug-fixing in the patch set, hope that people can test this feature
more easily.

Thanks,
--Shaopeng
> 
> Thanks,
> Pablo
> 
> >
> > Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
> > ---
> >  examples/l3fwd-power/main.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-
> power/main.c
> > index 8bb88ce..ecdff73 100644
> > --- a/examples/l3fwd-power/main.c
> > +++ b/examples/l3fwd-power/main.c
> > @@ -714,7 +714,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t
> > portid,
> >  		/* We don't currently handle IPv6 packets in LPM mode. */
> >  		rte_pktmbuf_free(m);
> >  #endif
> > -	}
> > +	} else
> > +		rte_pktmbuf_free(m);
> >
> >  }
> >
> > --
> > 1.9.3
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 8bb88ce..ecdff73 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -714,7 +714,8 @@  l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,
 		/* We don't currently handle IPv6 packets in LPM mode. */
 		rte_pktmbuf_free(m);
 #endif
-	}
+	} else
+		rte_pktmbuf_free(m);
 
 }