summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/task_init.c
diff options
context:
space:
mode:
authorPatrice Buriez <patrice.buriez@intel.com>2017-10-25 20:30:34 +0200
committerPatrice Buriez <patrice.buriez@intel.com>2017-10-25 20:30:34 +0200
commitf6abc2e6a02557e82ad0d1e5440653bb8884ecc8 (patch)
treeae36de03e9553cd55300771271576369c7484f9e /VNFs/DPPD-PROX/task_init.c
parent504e70cbb19a3e65b1704ee085cd079d26cf16f8 (diff)
Merge changes from PROX-v041
Change-Id: Ie6d4e7ce22c27967117a446626f5923643397812 Signed-off-by: Patrice Buriez <patrice.buriez@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/task_init.c')
-rw-r--r--VNFs/DPPD-PROX/task_init.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/VNFs/DPPD-PROX/task_init.c b/VNFs/DPPD-PROX/task_init.c
index 6d9c7b3..3af0db2 100644
--- a/VNFs/DPPD-PROX/task_init.c
+++ b/VNFs/DPPD-PROX/task_init.c
@@ -38,7 +38,7 @@ LIST_HEAD(,task_init) head;
void reg_task(struct task_init* t)
{
- PROX_PANIC(t->handle == NULL, "No handle function specified for task with name %d\n", t->mode);
+ // PROX_PANIC(t->handle == NULL, "No handle function specified for task with name %d\n", t->mode);
if (t->thread_x == NULL)
t->thread_x = thread_generic;
@@ -70,6 +70,11 @@ static int compare_strcmp(const void *a, const void *b)
return strcmp(*(const char * const *)a, *(const char * const *)b);
}
+int task_is_master(struct task_args *targ)
+{
+ return (targ->lconf->id == prox_cfg.master);
+}
+
void tasks_list(void)
{
struct task_init *cur_t;
@@ -169,13 +174,19 @@ static size_t init_rx_tx_rings_ports(struct task_args *targ, struct task_base *t
}
else {
if (targ->nb_rxports == 1) {
- tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw1_multi : rx_pkt_hw1;
+ if (targ->task_init->flag_features & TASK_FEATURE_L3)
+ tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw1_multi_l3 : rx_pkt_hw1_l3;
+ else
+ tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw1_multi : rx_pkt_hw1;
tbase->rx_params_hw1.rx_pq.port = targ->rx_port_queue[0].port;
tbase->rx_params_hw1.rx_pq.queue = targ->rx_port_queue[0].queue;
}
else {
PROX_ASSERT((targ->nb_rxports != 0) || (targ->task_init->flag_features & TASK_FEATURE_NO_RX));
- tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw_multi : rx_pkt_hw;
+ if (targ->task_init->flag_features & TASK_FEATURE_L3)
+ tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw_multi_l3 : rx_pkt_hw_l3;
+ else
+ tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw_multi : rx_pkt_hw;
tbase->rx_params_hw.nb_rxports = targ->nb_rxports;
tbase->rx_params_hw.rx_pq = (struct port_queue *)(((uint8_t *)tbase) + offset);
offset += sizeof(struct port_queue) * tbase->rx_params_hw.nb_rxports;
@@ -185,7 +196,10 @@ static size_t init_rx_tx_rings_ports(struct task_args *targ, struct task_base *t
}
if (rte_is_power_of_2(targ->nb_rxports)) {
- tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw_pow2_multi : rx_pkt_hw_pow2;
+ if (targ->task_init->flag_features & TASK_FEATURE_L3)
+ tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw_pow2_multi_l3 : rx_pkt_hw_pow2_l3;
+ else
+ tbase->rx_pkt = (targ->task_init->flag_features & TASK_FEATURE_MULTI_RX)? rx_pkt_hw_pow2_multi : rx_pkt_hw_pow2;
tbase->rx_params_hw.rxport_mask = targ->nb_rxports - 1;
}
}
@@ -336,6 +350,13 @@ struct task_base *init_task_struct(struct task_args *targ)
offset = init_rx_tx_rings_ports(targ, tbase, offset);
tbase->aux = (struct task_base_aux *)(((uint8_t *)tbase) + offset);
+ if ((targ->nb_txrings != 0) || (targ->nb_txports != 0)) {
+ if (targ->task_init->flag_features & TASK_FEATURE_L3) {
+ tbase->aux->tx_pkt_l2 = tbase->tx_pkt;
+ tbase->tx_pkt = tx_pkt_l3;
+ }
+ }
+
if (targ->task_init->flag_features & TASK_FEATURE_RX_ALL) {
task_base_add_rx_pkt_function(tbase, rx_pkt_all);
tbase->aux->all_mbufs = prox_zmalloc(MAX_RX_PKT_ALL * sizeof(* tbase->aux->all_mbufs), task_socket);
@@ -348,6 +369,15 @@ struct task_base *init_task_struct(struct task_args *targ)
tbase->handle_bulk = t->handle;
+ if (targ->task_init->flag_features & TASK_FEATURE_L3) {
+ plog_info("\tTask configured in L3 mode\n");
+ tbase->l3.ctrl_plane_ring = targ->ctrl_plane_ring;
+ }
+ if ((targ->nb_txrings != 0) || (targ->nb_txports != 0)) {
+ if (targ->task_init->flag_features & TASK_FEATURE_L3)
+ task_init_l3(tbase, targ);
+ }
+
targ->tbase = tbase;
if (t->init) {
t->init(tbase, targ);
@@ -372,8 +402,12 @@ struct task_base *init_task_struct(struct task_args *targ)
struct task_args *find_reachable_task_sending_to_port(struct task_args *from)
{
- if (!from->nb_txrings)
- return from;
+ if (!from->nb_txrings) {
+ if (from->tx_port_queue[0].port != OUT_DISCARD)
+ return from;
+ else
+ return NULL;
+ }
struct core_task ct;
struct task_args *dtarg, *ret;