diff mbox

[ovs-dev,3/4] dpif-netdev: Add rxq prioritization

Message ID 1500567047-9145-4-git-send-email-billy.o.mahony@intel.com
State Superseded
Headers show

Commit Message

Billy O'Mahony July 20, 2017, 4:10 p.m. UTC
If an rxq is marked as 'prioritized' then keep reading from this queue until
there are no packets available. Only then proceed to other queues.

Signed-off-by: Billy O'Mahony <billy.o.mahony@intel.com>
---
 lib/dpif-netdev.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index d35566f..3a67ce2 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -484,6 +484,7 @@  struct dp_netdev_pmd_cycles {
 struct polled_queue {
     struct netdev_rxq *rx;
     odp_port_t port_no;
+    uint8_t is_priority;
 };
 
 /* Contained by struct dp_netdev_pmd_thread's 'poll_list' member. */
@@ -3700,6 +3701,8 @@  pmd_load_queues_and_ports(struct dp_netdev_pmd_thread *pmd,
     HMAP_FOR_EACH (poll, node, &pmd->poll_list) {
         poll_list[i].rx = poll->rxq->rx;
         poll_list[i].port_no = poll->rxq->port->port_no;
+        poll_list[i].is_priority = \
+            (poll->rxq->rx->queue_id == poll->rxq->rx->netdev->priority_rxq);
         i++;
     }
 
@@ -3747,15 +3750,24 @@  reload:
         lc = UINT_MAX;
     }
 
+    unsigned int log_cnt = 0;
+    int streak_len;
+    const unsigned int MAX_STREAK_LEN = 100;
     cycles_count_start(pmd);
     for (;;) {
+        log_cnt++;
         for (i = 0; i < poll_cnt; i++) {
-            process_packets =
-                dp_netdev_process_rxq_port(pmd, poll_list[i].rx,
-                                           poll_list[i].port_no);
-            cycles_count_intermediate(pmd,
-                                      process_packets ? PMD_CYCLES_PROCESSING
-                                                      : PMD_CYCLES_IDLE);
+            streak_len = 0;
+            do {
+                process_packets =
+                    dp_netdev_process_rxq_port(pmd, poll_list[i].rx,
+                                               poll_list[i].port_no);
+                cycles_count_intermediate(pmd,
+                                   process_packets ? PMD_CYCLES_PROCESSING
+                                                   : PMD_CYCLES_IDLE);
+                streak_len++;
+            } while (process_packets && poll_list[i].is_priority &&
+                     streak_len < MAX_STREAK_LEN);
         }
 
         if (lc++ > 1024) {