summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/main.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2020-03-24 00:31:13 +0100
committerXavier Simonart <xavier.simonart@intel.com>2020-05-29 23:40:28 +0200
commitc61fccde40dc6bb4a6ecd21c9d6dc8969df33400 (patch)
treeacdf0a31a6d1eea0e97f3ef6d1b70f4b97bc0dc0 /VNFs/DPPD-PROX/main.c
parent4359ac786cc49d0ce20f745def415d46fbba177d (diff)
Added support for secondary process & virtual devices
A virtual device can be created adding the following option on the eal field within the eal options section: --vdev=net_ring0 This will cause a new (virtual) dpdk port to be created. Such a device can then be used in a primary process as other DPDK devices i.e. a [port x] section must be defined in the configuration file For a secondary process, there is no need to add --vdev, but, of course --proc-type=secondary (or --proc-type=auto) must be set within the eal field. There are two ways to use such a virtual device in a secondary process 1) Using the DPDK port number. Note however that the DPDK port number of virtual devices in the secondary process might not start from 0 and might hence have to be guessed e.g. if using 2 virtual devices in primary process (--vdev=net_ring0 --vdev=net_ring1) the port_id will be 0 and 1 in primary process and 2 & 3 in secondary process. 2) Using the port name, as defined in --vdev in the primary process. In this way, no [port] section must be defined, and the virtual port names are directly used within the "rx port" and "tx port" configuration e.g.: rx port=net_ring0 tx port=net_ring1 Limitations =========== There seems to be a PROX leak causing DPDK port id to increase when restarting the secondary process (causing the secondary process configuration through port id more difficult). As the primary process configures the port (including the number of rx and tx queues) based on its config file, the secondary process can't setup its own queues. Simple configurations (such as using gen or lat in primary, and swap in secondary) work as PROX allocates a RX queue even in gen mode and a TX queue even in lat mode. Better configuration/support for secondary process should be designed. The use of dpdk port names is only supported by PROX within "rx port" and "tx port". It is not supported by other configuration fields such as "tx ports from routing table". The use of dpdk port names in "rx port" and "tx port" is limited to only 1 port. Change-Id: Iaa606625da471403713a21df79d3ded4bb91b91e Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/main.c')
-rw-r--r--VNFs/DPPD-PROX/main.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/VNFs/DPPD-PROX/main.c b/VNFs/DPPD-PROX/main.c
index d87561d0..1af49b7d 100644
--- a/VNFs/DPPD-PROX/main.c
+++ b/VNFs/DPPD-PROX/main.c
@@ -748,19 +748,21 @@ static void setup_mempools_unique_per_socket(void)
for (int i = 0 ; i < MAX_SOCKETS; i++) {
if (mbuf_count[i] != 0) {
sprintf(name, "socket_%u_pool", i);
- pool[i] = rte_mempool_create(name,
+ if ((pool[i] = rte_mempool_lookup(name)) == NULL) {
+ pool[i] = rte_mempool_create(name,
mbuf_count[i] - 1, mbuf_size[i],
nb_cache_mbuf[i],
sizeof(struct rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init, NULL,
prox_pktmbuf_init, NULL,
i, flags);
- PROX_PANIC(pool[i] == NULL, "\t\tError: cannot create mempool for socket %u\n", i);
- plog_info("\t\tMempool %p size = %u * %u cache %u, socket %d\n", pool[i],
- mbuf_count[i], mbuf_size[i], nb_cache_mbuf[i], i);
+ PROX_PANIC(pool[i] == NULL, "\t\tError: cannot create mempool for socket %u\n", i);
+ plog_info("\tMempool %p size = %u * %u cache %u, socket %d\n", pool[i],
+ mbuf_count[i], mbuf_size[i], nb_cache_mbuf[i], i);
- if (prox_cfg.flags & DSF_SHUFFLE) {
- shuffle_mempool(pool[i], mbuf_count[i]);
+ if (prox_cfg.flags & DSF_SHUFFLE) {
+ shuffle_mempool(pool[i], mbuf_count[i]);
+ }
}
}
}
@@ -775,7 +777,7 @@ static void setup_mempools_unique_per_socket(void)
targ->pool = pool[socket];
/* Set the number of mbuf to the number of the unique mempool, so that the used and free work */
targ->nb_mbuf = mbuf_count[socket];
- plog_info("\t\tMempool %p size = %u * %u cache %u, socket %d\n", targ->pool,
+ plog_info("\tMempool %p size = %u * %u cache %u, socket %d\n", targ->pool,
targ->nb_mbuf, mbuf_size[socket], targ->nb_cache_mbuf, socket);
}
}
@@ -797,7 +799,7 @@ static void setup_mempool_for_rx_task(struct lcore_cfg *lconf, struct task_args
PROX_ASSERT(targ->nb_mbuf != 0);
if (targ->pool_name[0] == '\0') {
- sprintf(name, "core_%u_port_%u_pool", lconf->id, targ->id);
+ sprintf(name, "core_%u_task_%u_pool", lconf->id, targ->id);
}
snprintf(memzone_name, sizeof(memzone_name)-1, "MP_%s", targ->pool_name);
@@ -830,7 +832,7 @@ static void setup_mempool_for_rx_task(struct lcore_cfg *lconf, struct task_args
receiving from if one core receives from multiple
ports, all the ports use the same mempool */
if (targ->pool == NULL) {
- plog_info("\t\tCreating mempool with name '%s'\n", name);
+ plog_info("\tCreating mempool with name '%s' on socket %d\n", name, socket);
targ->pool = rte_mempool_create(name,
targ->nb_mbuf - 1, targ->mbuf_size,
targ->nb_cache_mbuf,
@@ -841,9 +843,9 @@ static void setup_mempool_for_rx_task(struct lcore_cfg *lconf, struct task_args
}
PROX_PANIC(targ->pool == NULL,
- "\t\tError: cannot create mempool for core %u port %u: %s\n", lconf->id, targ->id, rte_strerror(rte_errno));
+ "\tError: cannot create mempool for core %u port %u: %s\n", lconf->id, targ->id, rte_strerror(rte_errno));
- plog_info("\t\tMempool %p size = %u * %u cache %u, socket %d\n", targ->pool,
+ plog_info("\tMempool %p size = %u * %u cache %u, socket %d\n", targ->pool,
targ->nb_mbuf, targ->mbuf_size, targ->nb_cache_mbuf, socket);
if (prox_cfg.flags & DSF_SHUFFLE) {
shuffle_mempool(targ->pool, targ->nb_mbuf);
@@ -1230,5 +1232,6 @@ int main(int argc, char **argv)
if (setup_prox(argc, argv) != 0)
return EXIT_FAILURE;
run(prox_cfg.flags);
+
return EXIT_SUCCESS;
}