From: Olivier Matz Date: Wed, 18 May 2016 11:04:44 +0000 (+0200) Subject: mempool: replace physical address by a memzone pointer X-Git-Tag: spdx-start~6878 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1a6bbb8b6fcab760afd8df3902f70c14b7347c95;p=dpdk.git mempool: replace physical address by a memzone pointer Storing the pointer to the memzone instead of the physical address provides more information than just the physical address: for instance, the memzone flags. Moreover, keeping the memzone pointer will allow us to free the mempool (this is done later in the series). Signed-off-by: Olivier Matz --- diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 88c57803cb..891458af11 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -725,7 +725,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, /* init the mempool structure */ memset(mp, 0, sizeof(*mp)); snprintf(mp->name, sizeof(mp->name), "%s", name); - mp->phys_addr = mz->phys_addr; + mp->mz = mz; mp->socket_id = socket_id; mp->size = n; mp->flags = flags; @@ -993,7 +993,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp) fprintf(f, "mempool <%s>@%p\n", mp->name, mp); fprintf(f, " flags=%x\n", mp->flags); fprintf(f, " ring=<%s>@%p\n", mp->ring->name, mp->ring); - fprintf(f, " phys_addr=0x%" PRIx64 "\n", mp->phys_addr); + fprintf(f, " phys_addr=0x%" PRIx64 "\n", mp->mz->phys_addr); fprintf(f, " nb_mem_chunks=%u\n", mp->nb_mem_chunks); fprintf(f, " size=%"PRIu32"\n", mp->size); fprintf(f, " populated_size=%"PRIu32"\n", mp->populated_size); diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index e0aa6988af..13bd56be72 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -204,7 +204,7 @@ struct rte_mempool_memhdr { struct rte_mempool { char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */ struct rte_ring *ring; /**< Ring to store objects. */ - phys_addr_t phys_addr; /**< Phys. addr. of mempool struct. */ + const struct rte_memzone *mz; /**< Memzone where pool is allocated */ int flags; /**< Flags of the mempool. */ int socket_id; /**< Socket id passed at mempool creation. */ uint32_t size; /**< Max size of the mempool. */