From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Wed, 11 Apr 2018 04:34:28 +0000 (-0700)
Subject: net/bonding: free mempool used in mode 6
X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b9c0dea24beb4b893e88d93c1b52481003ff8999;p=dpdk.git

net/bonding: free mempool used in mode 6

When creating bond device with mode6, dpdk will create
mempool for arp packets. If free the bond device and
create it with same name, there will be an error. Because
the mempool is not freed when destroying bond device.

Fixes: 06fe78b98ccd ("bond: add mode 6")
Fixes: ea0c20ea95fd ("apps: use helper to create mbuf pools")
Cc: stable@dpdk.org

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 8847d20c23..815e0e4c70 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3145,6 +3145,10 @@ bond_remove(struct rte_vdev_device *dev)
 	eth_dev->tx_pkt_burst = NULL;
 
 	internals = eth_dev->data->dev_private;
+	/* Try to release mempool used in mode6. If the bond
+	 * device is not mode6, free the NULL is not problem.
+	 */
+	rte_mempool_free(internals->mode6.mempool);
 	rte_bitmap_free(internals->vlan_filter_bmp);
 	rte_free(internals->vlan_filter_bmpmem);
 	rte_free(eth_dev->data->dev_private);