summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs/DPPD-PROX/main.c')
-rw-r--r--VNFs/DPPD-PROX/main.c65
1 files changed, 55 insertions, 10 deletions
diff --git a/VNFs/DPPD-PROX/main.c b/VNFs/DPPD-PROX/main.c
index f6fa3e80..61abe6e6 100644
--- a/VNFs/DPPD-PROX/main.c
+++ b/VNFs/DPPD-PROX/main.c
@@ -54,6 +54,7 @@
#endif
uint8_t lb_nb_txrings = 0xff;
+extern const char *git_version;
struct rte_ring *ctrl_rings[RTE_MAX_LCORE*MAX_TASKS_PER_CORE];
static void __attribute__((noreturn)) prox_usage(const char *prgname)
@@ -115,7 +116,7 @@ static void check_mixed_normal_pipeline(void)
}
}
-static void check_zero_rx(void)
+static void check_no_rx(void)
{
struct lcore_cfg *lconf = NULL;
struct task_args *targ;
@@ -227,7 +228,7 @@ static void check_cfg_consistent(void)
{
check_nb_mbuf();
check_missing_rx();
- check_zero_rx();
+ check_no_rx();
check_mixed_normal_pipeline();
}
@@ -306,7 +307,7 @@ static void configure_if_tx_queues(struct task_args *targ, uint8_t socket)
}
#else
if (chain_flag_always_set(targ, TASK_FEATURE_TXQ_FLAGS_NOOFFLOADS)) {
- prox_port_cfg[if_port].requested_tx_offload &= ~(DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM);
+ prox_port_cfg[if_port].requested_tx_offload &= ~(RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_UDP_CKSUM);
}
#endif
}
@@ -315,6 +316,49 @@ static void configure_if_tx_queues(struct task_args *targ, uint8_t socket)
static void configure_if_rx_queues(struct task_args *targ, uint8_t socket)
{
struct prox_port_cfg *port;
+ uint8_t port_used_counter[PROX_MAX_PORTS] = {0};
+ bool multiple_port_reference = false;
+ uint8_t total_number_of_queues = 0;
+ // Check how many times a port is referenced for this task
+ for (uint8_t i = 0; i < targ->nb_rxports; i++) {
+ uint8_t if_port = targ->rx_port_queue[i].port;
+ port_used_counter[if_port]++;
+ if (port_used_counter[if_port] > 1) {
+ multiple_port_reference = true;
+ port = &prox_port_cfg[if_port];
+ PROX_PANIC((port->all_rx_queues), "Multiple queues defined in rx port, but all_rx_queues also set for port %s\n", port->names[0]);
+ }
+ }
+ // If only referenced once, it is possible that we want to use all queues
+ // Therefore we will check all_rx_queues for that port
+ if (!multiple_port_reference) {
+ for (uint8_t i = 0; i < PROX_MAX_PORTS; i++) {
+ uint8_t if_port = targ->rx_port_queue[i].port;
+ if (port_used_counter[if_port]) {
+ port = &prox_port_cfg[if_port];
+ if (port->all_rx_queues) {
+ port_used_counter[if_port] = port->max_rxq;
+ total_number_of_queues += port->max_rxq;
+ plog_info("\tall_rx_queues for Port %s: %u rx_queues will be applied\n", port->names[0], port_used_counter[if_port]);
+ }
+ }
+ }
+ }
+ if (total_number_of_queues) {
+ PROX_PANIC((total_number_of_queues > PROX_MAX_PORTS), "%u queues using the all_rx_queues. PROX_MAX_PORTS is set to %u\n", total_number_of_queues, PROX_MAX_PORTS);
+ uint8_t index = 0;
+ for (uint8_t i = 0; i < PROX_MAX_PORTS; i++) {
+ if (port_used_counter[i]) {
+ for (uint8_t j = 0; j < port_used_counter[i]; j++) {
+ targ->rx_port_queue[index].port = i;
+ index ++;
+ }
+ port = &prox_port_cfg[i];
+ plog_info("\t\tConfiguring task to use port %s with %u rx_queues\n", port->names[0], port_used_counter[i]);
+ }
+ }
+ targ->nb_rxports = index;
+ }
for (int i = 0; i < targ->nb_rxports; i++) {
uint8_t if_port = targ->rx_port_queue[i].port;
@@ -381,12 +425,12 @@ static void configure_tx_queue_flags(void)
prox_port_cfg[if_port].tx_conf.txq_flags |= ETH_TXQ_FLAGS_NOREFCOUNT;
}
#else
- /* Set the DEV_TX_OFFLOAD_MBUF_FAST_FREE flag if none of
+ /* Set the RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE flag if none of
the tasks up to the task transmitting to the port
use refcnt and per-queue all mbufs comes from the same mempool. */
if (chain_flag_never_set(targ, TASK_FEATURE_TXQ_FLAGS_REFCOUNT)) {
if (chain_flag_never_set(targ, TASK_FEATURE_TXQ_FLAGS_MULTIPLE_MEMPOOL))
- prox_port_cfg[if_port].requested_tx_offload |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+ prox_port_cfg[if_port].requested_tx_offload |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
}
#endif
}
@@ -411,7 +455,7 @@ static void configure_multi_segments(void)
#else
// We enable "multi segment" if at least one task requires it in the chain of tasks.
if (chain_flag_sometimes_set(targ, TASK_FEATURE_TXQ_FLAGS_MULTSEGS)) {
- prox_port_cfg[if_port].requested_tx_offload |= DEV_TX_OFFLOAD_MULTI_SEGS;
+ prox_port_cfg[if_port].requested_tx_offload |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
}
#endif
}
@@ -812,7 +856,7 @@ static void setup_mempool_for_rx_task(struct lcore_cfg *lconf, struct task_args
sprintf(name, "core_%u_task_%u_pool", lconf->id, targ->id);
}
- snprintf(memzone_name, sizeof(memzone_name)-1, "MP_%s", targ->pool_name);
+ snprintf(memzone_name, sizeof(memzone_name), "MP_%.*s", (int)(sizeof(memzone_name)-4), targ->pool_name);
mz = rte_memzone_lookup(memzone_name);
if (mz != NULL) {
@@ -947,10 +991,10 @@ static void setup_all_task_structs(void)
while(prox_core_next(&lcore_id, 1) == 0) {
lconf = &lcore_cfg[lcore_id];
- plog_info("\tInitializing struct for core %d with %d task\n", lcore_id, lconf->n_tasks_all);
+ plog_info("\t*** Initializing core %d (%d task) ***\n", lcore_id, lconf->n_tasks_all);
for (uint8_t task_id = 0; task_id < lconf->n_tasks_all; ++task_id) {
if (!task_is_master(&lconf->targs[task_id])) {
- plog_info("\tInitializing struct for core %d task %d\n", lcore_id, task_id);
+ plog_info("\t\tInitializing struct for core %d task %d\n", lcore_id, task_id);
lconf->targs[task_id].tmaster = tmaster;
lconf->tasks_all[task_id] = init_task_struct(&lconf->targs[task_id]);
}
@@ -1148,7 +1192,7 @@ static void set_term_env(void)
plog_info("\tncurses version = %d.%d (%s)\n", max_ver, min_ver, ncurses_version);
}
- if (((max_ver > 6) || ((max_ver == 6) && (min_ver >= 1))) && (strcmp(old_value, "xterm") == 0)) {
+ if ((old_value) && ((max_ver > 6) || ((max_ver == 6) && (min_ver >= 1))) && (strcmp(old_value, "xterm") == 0)) {
// On recent OSes such as RHEL 8.0, ncurses(6.1) introduced support
// for ECMA-48 repeat character control.
// Some terminal emulators use TERM=xterm but do not support this feature.
@@ -1175,6 +1219,7 @@ int main(int argc, char **argv)
plog_init(prox_cfg.log_name, prox_cfg.log_name_pid);
plog_info("=== " PROGRAM_NAME " %s ===\n", VERSION_STR());
plog_info("\tUsing DPDK %s\n", rte_version() + sizeof(RTE_VER_PREFIX));
+ plog_info("\tgit version %s\n", git_version);
set_term_env();
read_rdt_info();