summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/prox_args.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/prox_args.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/prox_args.c')
-rw-r--r--VNFs/DPPD-PROX/prox_args.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/VNFs/DPPD-PROX/prox_args.c b/VNFs/DPPD-PROX/prox_args.c
index 9e12eb68..cb0dcb31 100644
--- a/VNFs/DPPD-PROX/prox_args.c
+++ b/VNFs/DPPD-PROX/prox_args.c
@@ -137,6 +137,15 @@ static struct cfg_section core_cfg = {
.error = 0
};
+struct deferred_port {
+ struct task_args *targ;
+ char name[256];
+ uint8_t is_rx_port;
+};
+
+static struct deferred_port deferred_port[PROX_MAX_PORTS];
+static int n_deferred_ports = 0;
+
static void set_errf(const char *format, ...)
{
va_list ap;
@@ -901,7 +910,17 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
uint32_t ports[PROX_MAX_PORTS];
if(parse_port_name_list(ports, &n_if, PROX_MAX_PORTS, pkey)) {
- return -1;
+ // Port name not found, but could be a virtual device of a secondary process
+ // As DPDK not started yet, we can only check the config file to see whether we are a secondary process
+ if (rte_cfg.eal &&
+ (strstr(rte_cfg.eal, "secondary") || strstr(rte_cfg.eal, "auto")) &&
+ (n_deferred_ports < PROX_MAX_PORTS)) {
+ prox_strncpy(deferred_port[n_deferred_ports].name, pkey, sizeof(deferred_port[n_deferred_ports].name));
+ deferred_port[n_deferred_ports].is_rx_port = 0;
+ deferred_port[n_deferred_ports++].targ = targ;
+ return 0;
+ } else
+ return -1;
}
PROX_ASSERT(n_if-1 < PROX_MAX_PORTS);
@@ -1111,7 +1130,17 @@ static int get_core_cfg(unsigned sindex, char *str, void *data)
uint32_t n_if;
if (parse_port_name_list(vals, &n_if, PROX_MAX_PORTS, pkey)) {
- return -1;
+ // Port name not found, but could be a virtual device of a secondary process
+ // As DPDK not started yet, we can only check the config file to see whether we are a secondary process
+ if (rte_cfg.eal &&
+ (strstr(rte_cfg.eal, "secondary") || strstr(rte_cfg.eal, "auto")) &&
+ (n_deferred_ports < PROX_MAX_PORTS)) {
+ prox_strncpy(deferred_port[n_deferred_ports].name, pkey, sizeof(deferred_port[n_deferred_ports].name));
+ deferred_port[n_deferred_ports].is_rx_port = 1;
+ deferred_port[n_deferred_ports++].targ = targ;
+ return 0;
+ } else
+ return -1;
}
for (uint8_t i = 0; i < n_if; ++i) {
@@ -2171,5 +2200,20 @@ int prox_setup_rte(const char *prog_name)
return -1;
}
}
+ uint16_t port_id;
+ for (int i = 0; i < n_deferred_ports; i++) {
+ if (rte_eth_dev_get_port_by_name(deferred_port[i].name, &port_id) != 0) {
+ plog_err("Did not find port name %s used while reading %s\n", deferred_port[i].name, deferred_port[i].is_rx_port ? "rx port" : "tx_port");
+ return -1;
+ }
+ plog_info("\tport %s is port id %d\n", deferred_port[i].name, port_id);
+ if (deferred_port[i].is_rx_port) {
+ deferred_port[i].targ->rx_port_queue[0].port = port_id;
+ deferred_port[i].targ->nb_rxports = 1;
+ } else {
+ deferred_port[i].targ->tx_port_queue[0].port = port_id;
+ deferred_port[i].targ->nb_txports = 1;
+ }
+ }
return 0;
}