X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=VNFs%2FDPPD-PROX%2Flconf.c;h=935bac5d3ad9cfcaca19c8404dc06f7cb3e3c893;hb=4da0effed52e73e23f73884af771d2aff1332efc;hp=88d8f4f9af81196885950783766678e758bafd17;hpb=cb94e0036256c6a3fb0aadb682a04d8ad30ddd2a;p=samplevnf.git diff --git a/VNFs/DPPD-PROX/lconf.c b/VNFs/DPPD-PROX/lconf.c index 88d8f4f9..935bac5d 100644 --- a/VNFs/DPPD-PROX/lconf.c +++ b/VNFs/DPPD-PROX/lconf.c @@ -198,6 +198,15 @@ int lconf_do_flags(struct lcore_cfg *lconf) struct task_base *t; int ret = 0; + if ((lconf->msg.type == LCONF_MSG_TRACE) && (lconf->tasks_all[lconf->msg.task_id]->tx_pkt == tx_pkt_drop_all)) { + /* We are asked to dump packets through command dump. + * This usually means map RX and TX packets before printing them. + * However we do not transmit the packets in this case => use the DUMP_RX function. + * This will prevent seeing the received packets also printed as TX[255] (= dropped) + */ + lconf->msg.type = LCONF_MSG_DUMP_RX; + } + switch (lconf->msg.type) { case LCONF_MSG_STOP: msg_stop(lconf); @@ -223,10 +232,17 @@ int lconf_do_flags(struct lcore_cfg *lconf) if (lconf->msg.type == LCONF_MSG_DUMP || lconf->msg.type == LCONF_MSG_DUMP_TX) { t->aux->task_rt_dump.n_print_tx = lconf->msg.val; - if (t->aux->tx_pkt_orig) - t->tx_pkt = t->aux->tx_pkt_orig; - t->aux->tx_pkt_orig = t->tx_pkt; - t->tx_pkt = tx_pkt_dump; + if (t->tx_pkt == tx_pkt_l3) { + if (t->aux->tx_pkt_orig) + t->aux->tx_pkt_l2 = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = t->aux->tx_pkt_l2; + t->aux->tx_pkt_l2 = tx_pkt_dump; + } else { + if (t->aux->tx_pkt_orig) + t->tx_pkt = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = t->tx_pkt; + t->tx_pkt = tx_pkt_dump; + } } } break; @@ -238,16 +254,30 @@ int lconf_do_flags(struct lcore_cfg *lconf) if (task_base_get_original_rx_pkt_function(t) != rx_pkt_dummy) { task_base_add_rx_pkt_function(t, rx_pkt_trace); - if (t->aux->tx_pkt_orig) - t->tx_pkt = t->aux->tx_pkt_orig; - t->aux->tx_pkt_orig = t->tx_pkt; - t->tx_pkt = tx_pkt_trace; + if (t->tx_pkt == tx_pkt_l3) { + if (t->aux->tx_pkt_orig) + t->aux->tx_pkt_l2 = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = t->aux->tx_pkt_l2; + t->aux->tx_pkt_l2 = tx_pkt_trace; + } else { + if (t->aux->tx_pkt_orig) + t->tx_pkt = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = t->tx_pkt; + t->tx_pkt = tx_pkt_trace; + } } else { t->aux->task_rt_dump.n_print_tx = lconf->msg.val; - if (t->aux->tx_pkt_orig) - t->tx_pkt = t->aux->tx_pkt_orig; - t->aux->tx_pkt_orig = t->tx_pkt; - t->tx_pkt = tx_pkt_dump; + if (t->tx_pkt == tx_pkt_l3) { + if (t->aux->tx_pkt_orig) + t->aux->tx_pkt_l2 = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = t->aux->tx_pkt_l2; + t->aux->tx_pkt_l2 = tx_pkt_dump; + } else { + if (t->aux->tx_pkt_orig) + t->tx_pkt = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = t->tx_pkt; + t->tx_pkt = tx_pkt_dump; + } } } break; @@ -263,8 +293,13 @@ int lconf_do_flags(struct lcore_cfg *lconf) for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) { t = lconf->tasks_all[task_id]; - t->aux->tx_pkt_orig = t->tx_pkt; - t->tx_pkt = tx_pkt_distr; + if (t->tx_pkt == tx_pkt_l3) { + t->aux->tx_pkt_orig = t->aux->tx_pkt_l2; + t->aux->tx_pkt_l2 = tx_pkt_distr; + } else { + t->aux->tx_pkt_orig = t->tx_pkt; + t->tx_pkt = tx_pkt_distr; + } memset(t->aux->tx_bucket, 0, sizeof(t->aux->tx_bucket)); lconf->flags |= LCONF_FLAG_TX_DISTR_ACTIVE; } @@ -280,8 +315,13 @@ int lconf_do_flags(struct lcore_cfg *lconf) for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) { t = lconf->tasks_all[task_id]; if (t->aux->tx_pkt_orig) { - t->tx_pkt = t->aux->tx_pkt_orig; - t->aux->tx_pkt_orig = NULL; + if (t->tx_pkt == tx_pkt_l3) { + t->aux->tx_pkt_l2 = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = NULL; + } else { + t->tx_pkt = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = NULL; + } lconf->flags &= ~LCONF_FLAG_TX_DISTR_ACTIVE; } } @@ -318,8 +358,13 @@ int lconf_do_flags(struct lcore_cfg *lconf) for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) { t = lconf->tasks_all[task_id]; - t->aux->tx_pkt_orig = t->tx_pkt; - t->tx_pkt = tx_pkt_bw; + if (t->tx_pkt == tx_pkt_l3) { + t->aux->tx_pkt_orig = t->aux->tx_pkt_l2; + t->aux->tx_pkt_l2 = tx_pkt_bw; + } else { + t->aux->tx_pkt_orig = t->tx_pkt; + t->tx_pkt = tx_pkt_bw; + } lconf->flags |= LCONF_FLAG_TX_BW_ACTIVE; } break; @@ -327,8 +372,13 @@ int lconf_do_flags(struct lcore_cfg *lconf) for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) { t = lconf->tasks_all[task_id]; if (t->aux->tx_pkt_orig) { - t->tx_pkt = t->aux->tx_pkt_orig; - t->aux->tx_pkt_orig = NULL; + if (t->tx_pkt == tx_pkt_l3) { + t->aux->tx_pkt_l2 = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = NULL; + } else { + t->tx_pkt = t->aux->tx_pkt_orig; + t->aux->tx_pkt_orig = NULL; + } lconf->flags &= ~LCONF_FLAG_TX_BW_ACTIVE; } }