Add all_rx_queues port flag to use all rx queues 18/70818/3
authorLuc Provoost <luc.provoost@intel.com>
Mon, 17 Aug 2020 12:53:11 +0000 (14:53 +0200)
committerXavier Simonart <xavier.simonart@intel.com>
Tue, 18 Aug 2020 09:13:35 +0000 (09:13 +0000)
In the port section of the PROX configuration file, a new parameter can
be added: all_rx_queues. The default is all_rx_queues=no.

When the rx port variable of a task is listing a port name, all rx
queues will be used when the all_rx_queues is set for that port.
If not set, only one queue of that port will be "consumed", each time
the port is referenced in the rx port variable.
When the all_rx_queues is set for a port, you should NOT reference that
port more than once in the rx port variables.

Change-Id: If9662b1ac07adeec9db88d2a25ca68aed0b9e213
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
VNFs/DPPD-PROX/main.c
VNFs/DPPD-PROX/prox_args.c
VNFs/DPPD-PROX/prox_port_cfg.h

index f6fa3e8..a863ffb 100644 (file)
@@ -315,6 +315,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->name);
+               }
+       }
+       // 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->name, 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->name, 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;
 
index d6bdf81..5af1931 100644 (file)
@@ -541,6 +541,13 @@ static int get_port_cfg(unsigned sindex, char *str, void *data)
        else if (STR_EQ(str, "tx desc")) {
                return parse_int(&cfg->n_txd, pkey);
        }
+       else if (STR_EQ(str, "all_rx_queues")) {
+               uint32_t val;
+               if (parse_bool(&val, pkey)) {
+                       return -1;
+               }
+               cfg->all_rx_queues = val;
+       }
        else if (STR_EQ(str, "promiscuous")) {
                uint32_t val;
                if (parse_bool(&val, pkey)) {
index 9d02599..f5929a7 100644 (file)
@@ -87,6 +87,7 @@ struct prox_port_cfg {
        uint32_t vlan_tag;
        uint8_t prefix;
        uint8_t is_vdev;
+    uint8_t all_rx_queues;
 };
 
 extern rte_atomic32_t lsc;