diff mbox

[2/2] linux-gen: dpdk: free used mempool when closing pktio device

Message ID 1471427961-17187-2-git-send-email-matias.elo@nokia.com
State Accepted
Commit 972fef8f7202cc90e14d83a217fa19999fac0489
Headers show

Commit Message

Elo, Matias (Nokia - FI/Espoo) Aug. 17, 2016, 9:59 a.m. UTC
DPDK 16.07 finally supports freeing memory pools.

Signed-off-by: Matias Elo <matias.elo@nokia.com>

---
 platform/linux-generic/pktio/dpdk.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

-- 
2.7.4

Comments

Bill Fischofer Aug. 19, 2016, 2:52 p.m. UTC | #1
On Wed, Aug 17, 2016 at 4:59 AM, Matias Elo <matias.elo@nokia.com> wrote:

> DPDK 16.07 finally supports freeing memory pools.

>

> Signed-off-by: Matias Elo <matias.elo@nokia.com>

>


Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>



> ---

>  platform/linux-generic/pktio/dpdk.c | 13 +++++--------

>  1 file changed, 5 insertions(+), 8 deletions(-)

>

> diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/

> pktio/dpdk.c

> index bf8b499..b45c9a8 100644

> --- a/platform/linux-generic/pktio/dpdk.c

> +++ b/platform/linux-generic/pktio/dpdk.c

> @@ -390,6 +390,8 @@ static int dpdk_close(pktio_entry_t *pktio_entry)

>         if (pktio_entry->s.state != PKTIO_STATE_OPENED)

>                 rte_eth_dev_close(pkt_dpdk->port_id);

>

> +       rte_mempool_free(pkt_dpdk->pkt_pool);

> +

>         return 0;

>  }

>

> @@ -650,14 +652,9 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,

>         else

>                 pkt_dpdk->min_rx_burst = 0;

>

> -       /* Look for previously opened packet pool */

> -       pkt_pool = rte_mempool_lookup(pkt_dpdk->pool_name);

> -       if (pkt_pool == NULL)

> -               pkt_pool = rte_pktmbuf_pool_create(pkt_dpdk->pool_name,

> -                                                  DPDK_NB_MBUF,

> -

> DPDK_MEMPOOL_CACHE_SIZE, 0,

> -                                                  DPDK_MBUF_BUF_SIZE,

> -                                                  rte_socket_id());

> +       pkt_pool = rte_pktmbuf_pool_create(pkt_dpdk->pool_name,

> DPDK_NB_MBUF,

> +                                          DPDK_MEMPOOL_CACHE_SIZE, 0,

> +                                          DPDK_MBUF_BUF_SIZE,

> rte_socket_id());

>         if (pkt_pool == NULL) {

>                 ODP_ERR("Cannot init mbuf packet pool\n");

>                 return -1;

> --

> 2.7.4

>

>
Maxim Uvarov Aug. 19, 2016, 6:46 p.m. UTC | #2
Merged,
Maxim.

On 08/19/16 17:52, Bill Fischofer wrote:
> On Wed, Aug 17, 2016 at 4:59 AM, Matias Elo <matias.elo@nokia.com> wrote:

>

>> DPDK 16.07 finally supports freeing memory pools.

>>

>> Signed-off-by: Matias Elo <matias.elo@nokia.com>

>>

> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>

>

>

>> ---

>>   platform/linux-generic/pktio/dpdk.c | 13 +++++--------

>>   1 file changed, 5 insertions(+), 8 deletions(-)

>>

>> diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/

>> pktio/dpdk.c

>> index bf8b499..b45c9a8 100644

>> --- a/platform/linux-generic/pktio/dpdk.c

>> +++ b/platform/linux-generic/pktio/dpdk.c

>> @@ -390,6 +390,8 @@ static int dpdk_close(pktio_entry_t *pktio_entry)

>>          if (pktio_entry->s.state != PKTIO_STATE_OPENED)

>>                  rte_eth_dev_close(pkt_dpdk->port_id);

>>

>> +       rte_mempool_free(pkt_dpdk->pkt_pool);

>> +

>>          return 0;

>>   }

>>

>> @@ -650,14 +652,9 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,

>>          else

>>                  pkt_dpdk->min_rx_burst = 0;

>>

>> -       /* Look for previously opened packet pool */

>> -       pkt_pool = rte_mempool_lookup(pkt_dpdk->pool_name);

>> -       if (pkt_pool == NULL)

>> -               pkt_pool = rte_pktmbuf_pool_create(pkt_dpdk->pool_name,

>> -                                                  DPDK_NB_MBUF,

>> -

>> DPDK_MEMPOOL_CACHE_SIZE, 0,

>> -                                                  DPDK_MBUF_BUF_SIZE,

>> -                                                  rte_socket_id());

>> +       pkt_pool = rte_pktmbuf_pool_create(pkt_dpdk->pool_name,

>> DPDK_NB_MBUF,

>> +                                          DPDK_MEMPOOL_CACHE_SIZE, 0,

>> +                                          DPDK_MBUF_BUF_SIZE,

>> rte_socket_id());

>>          if (pkt_pool == NULL) {

>>                  ODP_ERR("Cannot init mbuf packet pool\n");

>>                  return -1;

>> --

>> 2.7.4

>>

>>
diff mbox

Patch

diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index bf8b499..b45c9a8 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -390,6 +390,8 @@  static int dpdk_close(pktio_entry_t *pktio_entry)
 	if (pktio_entry->s.state != PKTIO_STATE_OPENED)
 		rte_eth_dev_close(pkt_dpdk->port_id);
 
+	rte_mempool_free(pkt_dpdk->pkt_pool);
+
 	return 0;
 }
 
@@ -650,14 +652,9 @@  static int dpdk_open(odp_pktio_t id ODP_UNUSED,
 	else
 		pkt_dpdk->min_rx_burst = 0;
 
-	/* Look for previously opened packet pool */
-	pkt_pool = rte_mempool_lookup(pkt_dpdk->pool_name);
-	if (pkt_pool == NULL)
-		pkt_pool = rte_pktmbuf_pool_create(pkt_dpdk->pool_name,
-						   DPDK_NB_MBUF,
-						   DPDK_MEMPOOL_CACHE_SIZE, 0,
-						   DPDK_MBUF_BUF_SIZE,
-						   rte_socket_id());
+	pkt_pool = rte_pktmbuf_pool_create(pkt_dpdk->pool_name, DPDK_NB_MBUF,
+					   DPDK_MEMPOOL_CACHE_SIZE, 0,
+					   DPDK_MBUF_BUF_SIZE, rte_socket_id());
 	if (pkt_pool == NULL) {
 		ODP_ERR("Cannot init mbuf packet pool\n");
 		return -1;