[dpdk-dev,6/7,v2] bus/dpaa: check portal presence in the caller API
Checks
Commit Message
In the I/O path we were calling rte_dpaa_portal_init which
internally checks if a portal is affined to the core.
But this lead to calling of that non-static API in every call.
Instead check the portal affinity in the caller itself for
performance reasons
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
drivers/bus/dpaa/dpaa_bus.c | 26 ++++++--------------------
drivers/bus/dpaa/rte_bus_dpaa_version.map | 1 +
drivers/bus/dpaa/rte_dpaa_bus.h | 2 ++
drivers/mempool/dpaa/dpaa_mempool.c | 24 ++++++++++++++----------
drivers/net/dpaa/dpaa_ethdev.c | 10 ++++++----
drivers/net/dpaa/dpaa_rxtx.c | 20 ++++++++++++--------
6 files changed, 41 insertions(+), 42 deletions(-)
@@ -54,7 +54,7 @@
unsigned int dpaa_svr_family;
-RTE_DEFINE_PER_LCORE(bool, _dpaa_io);
+RTE_DEFINE_PER_LCORE(bool, dpaa_io);
RTE_DEFINE_PER_LCORE(struct dpaa_portal_dqrr, held_bufs);
static int
@@ -230,9 +230,7 @@
}
}
-/** XXX move this function into a separate file */
-static int
-_dpaa_portal_init(void *arg)
+int rte_dpaa_portal_init(void *arg)
{
cpu_set_t cpuset;
pthread_t id;
@@ -303,25 +301,13 @@
return ret;
}
- RTE_PER_LCORE(_dpaa_io) = true;
+ RTE_PER_LCORE(dpaa_io) = true;
DPAA_BUS_LOG(DEBUG, "QMAN thread initialized");
return 0;
}
-/*
- * rte_dpaa_portal_init - Wrapper over _dpaa_portal_init with thread level check
- * XXX Complete this
- */
-int rte_dpaa_portal_init(void *arg)
-{
- if (unlikely(!RTE_PER_LCORE(_dpaa_io)))
- return _dpaa_portal_init(arg);
-
- return 0;
-}
-
int
rte_dpaa_portal_fq_init(void *arg, struct qman_fq *fq)
{
@@ -329,8 +315,8 @@ int rte_dpaa_portal_init(void *arg)
u32 sdqcr;
struct qman_portal *qp;
- if (unlikely(!RTE_PER_LCORE(_dpaa_io)))
- _dpaa_portal_init(arg);
+ if (unlikely(!RTE_PER_LCORE(dpaa_io)))
+ rte_dpaa_portal_init(arg);
/* Initialise qman specific portals */
qp = fsl_qman_portal_create();
@@ -368,7 +354,7 @@ int rte_dpaa_portal_fq_close(struct qman_fq *fq)
rte_free(dpaa_io_portal);
dpaa_io_portal = NULL;
- RTE_PER_LCORE(_dpaa_io) = false;
+ RTE_PER_LCORE(dpaa_io) = false;
}
#define DPAA_DEV_PATH1 "/sys/devices/platform/soc/soc:fsl,dpaa"
@@ -70,6 +70,7 @@ DPDK_18.02 {
dpaa_logtype_eventdev;
dpaa_svr_family;
+ per_lcore_dpaa_io;
per_lcore_held_bufs;
qm_channel_pool1;
qman_alloc_cgrid_range;
@@ -31,6 +31,8 @@
extern unsigned int dpaa_svr_family;
+extern RTE_DEFINE_PER_LCORE(bool, dpaa_io);
+
struct rte_dpaa_device;
struct rte_dpaa_driver;
@@ -139,11 +139,13 @@
DPAA_MEMPOOL_DPDEBUG("Request to free %d buffers in bpid = %d",
n, bp_info->bpid);
- ret = rte_dpaa_portal_init((void *)0);
- if (ret) {
- DPAA_MEMPOOL_ERR("rte_dpaa_portal_init failed with ret: %d",
- ret);
- return 0;
+ if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+ ret = rte_dpaa_portal_init((void *)0);
+ if (ret) {
+ DPAA_MEMPOOL_ERR("rte_dpaa_portal_init failed with ret: %d",
+ ret);
+ return 0;
+ }
}
while (i < n) {
@@ -193,11 +195,13 @@
return -1;
}
- ret = rte_dpaa_portal_init((void *)0);
- if (ret) {
- DPAA_MEMPOOL_ERR("rte_dpaa_portal_init failed with ret: %d",
- ret);
- return -1;
+ if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+ ret = rte_dpaa_portal_init((void *)0);
+ if (ret) {
+ DPAA_MEMPOOL_ERR("rte_dpaa_portal_init failed with ret: %d",
+ ret);
+ return -1;
+ }
}
while (n < count) {
@@ -1331,10 +1331,12 @@ static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid)
is_global_init = 1;
}
- ret = rte_dpaa_portal_init((void *)1);
- if (ret) {
- DPAA_PMD_ERR("Unable to initialize portal");
- return ret;
+ if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+ ret = rte_dpaa_portal_init((void *)1);
+ if (ret) {
+ DPAA_PMD_ERR("Unable to initialize portal");
+ return ret;
+ }
}
eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
@@ -503,10 +503,12 @@ uint16_t dpaa_eth_queue_rx(void *q,
if (likely(fq->is_static))
return dpaa_eth_queue_portal_rx(fq, bufs, nb_bufs);
- ret = rte_dpaa_portal_init((void *)0);
- if (ret) {
- DPAA_PMD_ERR("Failure in affining portal");
- return 0;
+ if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+ ret = rte_dpaa_portal_init((void *)0);
+ if (ret) {
+ DPAA_PMD_ERR("Failure in affining portal");
+ return 0;
+ }
}
ret = qman_set_vdq(fq, (nb_bufs > DPAA_MAX_DEQUEUE_NUM_FRAMES) ?
@@ -777,10 +779,12 @@ static struct rte_mbuf *dpaa_get_dmable_mbuf(struct rte_mbuf *mbuf,
int ret;
uint32_t seqn, index, flags[DPAA_TX_BURST_SIZE] = {0};
- ret = rte_dpaa_portal_init((void *)0);
- if (ret) {
- DPAA_PMD_ERR("Failure in affining portal");
- return 0;
+ if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+ ret = rte_dpaa_portal_init((void *)0);
+ if (ret) {
+ DPAA_PMD_ERR("Failure in affining portal");
+ return 0;
+ }
}
DPAA_DP_LOG(DEBUG, "Transmitting %d buffers on queue: %p", nb_bufs, q);