From b00b4a81490f2d6f7c546f31098383ef12a13436 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Tue, 8 Mar 2016 09:50:48 +0800 Subject: [PATCH] netdev-dpdk: fix mbuf leaks mbufs could be chained (by the "next" field of rte_mbuf struct), when an mbuf is not big enough to hold a big packet, say when TSO is enabled. rte_pktmbuf_free_seg() frees the head mbuf only, leading mbuf leaks. This patch fix it by invoking the right API rte_pktmbuf_free(), to free all mbufs in the chain. Signed-off-by: Yuanhan Liu Signed-off-by: Daniele Di Proietto --- AUTHORS | 1 + lib/netdev-dpdk.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 0ba0f58b8..04b8cae61 100644 --- a/AUTHORS +++ b/AUTHORS @@ -226,6 +226,7 @@ YAMAMOTO Takashi yamamoto@midokura.com Yasuhito Takamiya yasuhito@gmail.com Yin Lin linyi@vmware.com Yu Zhiguo yuzg@cn.fujitsu.com +Yuanhan Liu yuanhan.liu@linux.intel.com ZhengLingyun konghuarukhr@163.com Zoltán Balogh zoltan.balogh@ericsson.com Zoltan Kiss zoltan.kiss@citrix.com diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 0233b3cf9..f40235492 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -396,7 +396,7 @@ free_dpdk_buf(struct dp_packet *p) { struct rte_mbuf *pkt = (struct rte_mbuf *) p; - rte_pktmbuf_free_seg(pkt); + rte_pktmbuf_free(pkt); } static void @@ -1089,7 +1089,7 @@ dpdk_queue_flush__(struct netdev_dpdk *dev, int qid) int i; for (i = nb_tx; i < txq->count; i++) { - rte_pktmbuf_free_seg(txq->burst_pkts[i]); + rte_pktmbuf_free(txq->burst_pkts[i]); } rte_spinlock_lock(&dev->stats_lock); dev->stats.tx_dropped += txq->count-nb_tx; -- 2.20.1