summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/main.c
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2020-05-11 21:00:33 +0200
committerXavier Simonart <xavier.simonart@intel.com>2020-05-29 23:45:09 +0200
commitc871c361f9d69a93429ae385e7dbf21a46aa6857 (patch)
tree957ec8a53d2cd0a9b5676e163c22e8a3ae8f6f3e /VNFs/DPPD-PROX/main.c
parent7c4601f23c526b14a67674782b303663dfaa95af (diff)
Added initial support for NDP (IPv6)
Following messages are now handled by PROX - router_solicitation - neighbour_solicitation - router_advertisement - neighbour_advertisement The following parameters are supported (through the PROX config file) - sub mode=ndp This will enable handling of router and neighbour solicitation and advertisement. - local ipv6=xxxx:xxxx:xxxxx:xxxx:xxxx:xxxx:xxxx:xxxx This will configure the local IPv6 address of the port. This parameter is optional. If not specified, the local IPv6 will be calculated from the EUI. - global ipv6=xxxx:xxxx:xxxxx:xxxx:xxxx:xxxx:xxxx:xxxx This will configure the global IPv6 address of the port. This parameter is optional. If not specified, the global IPv6 will be calculated from the EUI and the router prefix received from the router. - ipv6 router=yes This will cause the core to behave as an IPv6 router i.e. it will generate Router Advertisement messages This is only useful in back to back cases, when no real IPv6 router is present in the setup. - router prefix=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx The router prefix usedin the router advertisement The prefix will be used by the node to build an IPv6 global address in cases none were configured. "Unsollicited NA" parameter has been added within the core/task section. If set to yes (Unsollicited NA=yes), then an unsollicited neighbour Advertisement is sent at startup A same core/task cannot support both l3 and ndp mode. Those messages will be generated or handled when submode is set to "ndp": - neighbour sollicitation - neighbour advertisement - router sollicitation - router advertisement An example configuration is provided: config/ipv6.cfg in which port 0 / core 1 plays the role of the generator and port 1 / core 2 plays the role of the swap. Change-Id: Id0ab32d384448b4cf767fb4a1c486fc023f4f395 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/main.c')
-rw-r--r--VNFs/DPPD-PROX/main.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/VNFs/DPPD-PROX/main.c b/VNFs/DPPD-PROX/main.c
index 1af49b7d..f6fa3e80 100644
--- a/VNFs/DPPD-PROX/main.c
+++ b/VNFs/DPPD-PROX/main.c
@@ -1,5 +1,5 @@
/*
-// Copyright (c) 2010-2017 Intel Corporation
+// Copyright (c) 2010-2020 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -155,7 +155,7 @@ static void check_missing_rx(void)
{
struct lcore_cfg *lconf = NULL, *rx_lconf = NULL, *tx_lconf = NULL;
struct task_args *targ, *rx_targ = NULL, *tx_targ = NULL;
- uint8_t port_id, rx_port_id, ok;
+ uint8_t port_id, rx_port_id, ok, l3, ndp;
while (core_targ_next(&lconf, &targ, 0) == 0) {
PROX_PANIC((targ->flags & TASK_ARG_RX_RING) && targ->rx_rings[0] == 0 && !targ->tx_opt_ring_task,
@@ -168,12 +168,17 @@ static void check_missing_rx(void)
lconf = NULL;
while (core_targ_next(&lconf, &targ, 0) == 0) {
- if (strcmp(targ->sub_mode_str, "l3") != 0)
+ l3 = ndp = 0;
+ if (strcmp(targ->sub_mode_str, "l3") == 0)
+ l3 = 1;
+ else if (strcmp(targ->sub_mode_str, "ndp") == 0)
+ ndp = 1;
+ else
continue;
- PROX_PANIC((targ->nb_rxports == 0) && (targ->nb_txports == 0), "L3 task must have a RX or a TX port\n");
- // 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
+ PROX_PANIC((targ->nb_rxports == 0) && (targ->nb_txports == 0), "L3/NDP task must have a RX or a TX port\n");
+ // If the L3/NDP sub_mode receives from a port, check that there is at least one core/task
+ // transmitting to this port in L3/NDP sub_mode
for (uint8_t i = 0; i < targ->nb_rxports; ++i) {
rx_port_id = targ->rx_port_queue[i].port;
ok = 0;
@@ -181,35 +186,40 @@ static void check_missing_rx(void)
while (core_targ_next(&tx_lconf, &tx_targ, 0) == 0) {
if ((port_id = tx_targ->tx_port_queue[0].port) == OUT_DISCARD)
continue;
- if ((rx_port_id == port_id) && (tx_targ->flags & TASK_ARG_L3)){
+ if ((rx_port_id == port_id) &&
+ ( ((tx_targ->flags & TASK_ARG_L3) && l3) ||
+ ((tx_targ->flags & TASK_ARG_NDP) && ndp) ) ) {
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);
+ PROX_PANIC(ok == 0, "RX %s sub mode for port %d on core %d task %d, but no core/task transmitting on that port\n", l3 ? "l3":"ndp", 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.
+ // If the L3/NDP sub_mode transmits to a port, check that there is at least one core/task
+ // receiving from that port in L3/NDP sub_mode.
if ((port_id = targ->tx_port_queue[0].port) == OUT_DISCARD)
continue;
rx_lconf = NULL;
ok = 0;
- plog_info("\tCore %d task %d transmitting to port %d in L3 mode\n", lconf->id, targ->id, port_id);
+ plog_info("\tCore %d task %d transmitting to port %d in %s submode\n", lconf->id, targ->id, port_id, l3 ? "l3":"ndp");
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->flags & TASK_ARG_L3)){
+ if ((rx_port_id == port_id) &&
+ ( ((rx_targ->flags & TASK_ARG_L3) && l3) ||
+ ((rx_targ->flags & TASK_ARG_NDP) && ndp) ) ){
ok = 1;
break;
}
}
if (ok == 1) {
- plog_info("\tCore %d task %d has found core %d task %d receiving from port %d\n", lconf->id, targ->id, rx_lconf->id, rx_targ->id, port_id);
+ plog_info("\tCore %d task %d has found core %d task %d receiving from port %d in %s submode\n", lconf->id, targ->id, rx_lconf->id, rx_targ->id, port_id,
+ ((rx_targ->flags & TASK_ARG_L3) && l3) ? "l3":"ndp");
break;
}
}
- PROX_PANIC(ok == 0, "L3 sub mode for port %d on core %d task %d, but no core/task receiving on that port\n", port_id, lconf->id, targ->id);
+ PROX_PANIC(ok == 0, "%s sub mode for port %d on core %d task %d, but no core/task receiving on that port\n", l3 ? "l3":"ndp", port_id, lconf->id, targ->id);
}
}
@@ -629,7 +639,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->flags & TASK_ARG_L3)) {
+ if ((starg->task_init) && (starg->flags & (TASK_ARG_L3|TASK_ARG_NDP))) {
struct core_task ct;
ct.core = prox_cfg.master;
ct.task = 0;
@@ -750,12 +760,12 @@ static void setup_mempools_unique_per_socket(void)
sprintf(name, "socket_%u_pool", i);
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);
+ 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("\tMempool %p size = %u * %u cache %u, socket %d\n", pool[i],
mbuf_count[i], mbuf_size[i], nb_cache_mbuf[i], i);