Message ID | 1513333483-4372-3-git-send-email-hemant.agrawal@nxp.com |
---|---|
State | New |
Headers | show |
Series | Dynamic HW Mempool Detection Support | expand |
-----Original Message----- > Date: Fri, 15 Dec 2017 15:54:43 +0530 > From: Hemant Agrawal <hemant.agrawal@nxp.com> > To: olivier.matz@6wind.com, santosh.shukla@caviumnetworks.com > CC: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 2/2] dpaa2: register dpaa2 mempool ops as active > mempool > X-Mailer: git-send-email 2.7.4 > > Detect if the DPAA2 mempool objects are present and they can > serve as default mempool. > > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> > --- > config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 - > drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 6 ++++++ > drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 ++ > drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 2 +- > 4 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc > index 91f4993..703e8b3 100644 > --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc > +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc > @@ -53,7 +53,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n > # Compile Support Libraries for DPAA2 > # > CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y > -CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2" > CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n > > # > diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c > index 334e1f5..5a6f292 100644 > --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c > +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c > @@ -64,6 +64,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, > { > struct dpaa2_dpbp_dev *dpbp_node; > int ret; > + static int active_pool; > > /* Allocate DPAA2 dpbp handle */ > dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0); > @@ -100,6 +101,11 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, > > RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id); > > + if (!active_pool) { I think, this global variable can be avoided. Why it needs to be under active_pool?
On 12/18/2017 2:27 PM, Jerin Jacob wrote: ...<snip> >> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c >> index 334e1f5..5a6f292 100644 >> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c >> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c >> @@ -64,6 +64,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, >> { >> struct dpaa2_dpbp_dev *dpbp_node; >> int ret; >> + static int active_pool; >> >> /* Allocate DPAA2 dpbp handle */ >> dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0); >> @@ -100,6 +101,11 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, >> >> RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id); >> >> + if (!active_pool) { > > I think, this global variable can be avoided. Why it needs to be under > active_pool? > This code register the active pool when it physically detect a instance of hw mempool on bus. There can be more than one objects of dpaa2 mempool. Yes! we can do avoid it as the current registration code proposal will not allow re-registration.
diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc index 91f4993..703e8b3 100644 --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc @@ -53,7 +53,6 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n # Compile Support Libraries for DPAA2 # CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y -CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2" CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n # diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c index 334e1f5..5a6f292 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c @@ -64,6 +64,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, { struct dpaa2_dpbp_dev *dpbp_node; int ret; + static int active_pool; /* Allocate DPAA2 dpbp handle */ dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0); @@ -100,6 +101,11 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id); + if (!active_pool) { + rte_pktmbuf_reg_active_mempool_ops(DPAA2_MEMPOOL_OPS_NAME); + active_pool = 1; + } + return 0; } diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index c1b842f..2b0e871 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -70,6 +70,8 @@ /* Maximum release/acquire from QBMAN */ #define DPAA2_MBUF_MAX_ACQ_REL 7 +#define DPAA2_MEMPOOL_OPS_NAME "dpaa2" + #define MAX_BPID 256 #define DPAA2_MBUF_HW_ANNOTATION 64 #define DPAA2_FD_PTA_SIZE 0 diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 8bcbaa8..17c7d62 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -380,7 +380,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp) } struct rte_mempool_ops dpaa2_mpool_ops = { - .name = "dpaa2", + .name = DPAA2_MEMPOOL_OPS_NAME, .alloc = rte_hw_mbuf_create_pool, .free = rte_hw_mbuf_free_pool, .enqueue = rte_hw_mbuf_free_bulk,
Detect if the DPAA2 mempool objects are present and they can serve as default mempool. Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- config/defconfig_arm64-dpaa2-linuxapp-gcc | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 6 ++++++ drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 ++ drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) -- 2.7.4