summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/main.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2017-11-09 15:57:11 +0100
committerXavier Simonart <xavier.simonart@intel.com>2017-11-15 19:05:17 +0100
commit4be177d0ef2813a20651d1a54991d25f3a66a090 (patch)
treea010ecadbb2654562b7c247e0f81a8c46b02a564 /VNFs/DPPD-PROX/main.c
parentc5dfa2ba7c21dac5ff6895f6e0fa2dc1dcc50cc1 (diff)
Add support for nop mode with l3 submode
The l3 submode was not supported in nop mode, as the nop mode uses some specific nop thread (and not generic). When L3 is specified, the nop mode must use the generic thread. In addition the l3 submode is implemented differently than other submodes. It is not supported through task_init structures (i.e. each task does not have to explicitely tell that it supports l3 submode). But this prevented to run both a nop with no submode and a nop with a l3 submode. Note that nop with l3 is usually not very useful - it handles arp (requests and response) but as nop, it does not swap IP addresses. So with a real switch, the packets transmitted will be received back... and l3 mode is usually mainly usefull when using a switch. However, there is at least one nop mode where l3 submode makes sense: when the nop does not transmit. In such cases, for instace used in conjunction with a gen l3, the nop receives all packets and forward the arp requests and responses to the master for handling. Change-Id: I992121db285ba25a11cbb494092a6afc6fe55a58 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/main.c')
-rw-r--r--VNFs/DPPD-PROX/main.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/VNFs/DPPD-PROX/main.c b/VNFs/DPPD-PROX/main.c
index 1c4dced9..2c362d6c 100644
--- a/VNFs/DPPD-PROX/main.c
+++ b/VNFs/DPPD-PROX/main.c
@@ -94,13 +94,15 @@ static void check_mixed_normal_pipeline(void)
int all_thread_nop = 1;
int generic = 0;
int pipeline = 0;
+ int l3 = 0;
for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) {
struct task_args *targ = &lconf->targs[task_id];
- all_thread_nop = all_thread_nop &&
+ l3 = !strcmp("l3", targ->sub_mode_str);
+ all_thread_nop = all_thread_nop && !l3 &&
targ->task_init->thread_x == thread_nop;
pipeline = pipeline || targ->task_init->thread_x == thread_pipeline;
- generic = generic || targ->task_init->thread_x == thread_generic;
+ generic = generic || targ->task_init->thread_x == thread_generic || l3;
}
PROX_PANIC(generic && pipeline, "Can't run both pipeline and normal thread on same core\n");
@@ -127,8 +129,8 @@ static void check_zero_rx(void)
static void check_missing_rx(void)
{
- struct lcore_cfg *lconf = NULL, *rx_lconf = NULL;
- struct task_args *targ, *rx_targ = NULL;
+ struct lcore_cfg *lconf = NULL, *rx_lconf = NULL, *tx_lconf = NULL;
+ struct task_args *targ, *rx_targ = NULL, *tx_targ = NULL;
struct prox_port_cfg *port;
uint8_t port_id, rx_port_id, ok;
@@ -143,8 +145,30 @@ static void check_missing_rx(void)
lconf = NULL;
while (core_targ_next(&lconf, &targ, 0) == 0) {
- if (strcmp(targ->task_init->sub_mode_str, "l3") != 0)
+ if (strcmp(targ->sub_mode_str, "l3") != 0)
continue;
+
+ // If the L3 sub_mode receives from a port, check that there is at least one core/task
+ // transmitting to this port in L3 sub_mode
+ for (uint8_t i = 0; i < targ->nb_rxports; ++i) {
+ rx_port_id = targ->rx_port_queue[i].port;
+ ok = 0;
+ tx_lconf = NULL;
+ while (core_targ_next(&tx_lconf, &tx_targ, 0) == 0) {
+ port = find_reachable_port(tx_targ);
+ if (port == NULL)
+ continue;
+ port_id = port - prox_port_cfg;
+ if ((rx_port_id == port_id) && (tx_targ->flags & TASK_ARG_L3)){
+ ok = 1;
+ break;
+ }
+ }
+ PROX_PANIC(ok == 0, "RX L3 sub mode for port %d on core %d task %d, but no core/task transmitting on that port\n", rx_port_id, lconf->id, targ->id);
+ }
+
+ // If the L3 sub_mode transmits to a port, check that there is at least one core/task
+ // receiving from that port in L3 sub_mode.
port = find_reachable_port(targ);
if (port == NULL)
continue;
@@ -155,7 +179,7 @@ static void check_missing_rx(void)
while (core_targ_next(&rx_lconf, &rx_targ, 0) == 0) {
for (uint8_t i = 0; i < rx_targ->nb_rxports; ++i) {
rx_port_id = rx_targ->rx_port_queue[i].port;
- if ((rx_port_id == port_id) && (rx_targ->task_init->flag_features & TASK_FEATURE_L3)){
+ if ((rx_port_id == port_id) && (rx_targ->flags & TASK_ARG_L3)){
ok = 1;
break;
}
@@ -522,7 +546,7 @@ static void init_rings(void)
lconf = NULL;
struct prox_port_cfg *port;
while (core_targ_next(&lconf, &starg, 1) == 0) {
- if ((starg->task_init) && (starg->task_init->flag_features & TASK_FEATURE_L3)) {
+ if ((starg->task_init) && (starg->flags & TASK_ARG_L3)) {
struct core_task ct;
ct.core = prox_cfg.master;
ct.task = 0;