>From: O Mahony, Billy
>Sent: Thursday, August 17, 2017 3:24 PM
>To: [email protected]
>Cc: Kavanagh, Mark B <[email protected]>; O Mahony, Billy
><[email protected]>
>Subject: [PATCH v2 3/4] dpif-netdev: Add rxq prioritization
>
>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 <[email protected]>
>---
> lib/dpif-netdev.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
>diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
>index 9ce3456..d9f014d 100644
>--- a/lib/dpif-netdev.c
>+++ b/lib/dpif-netdev.c
>@@ -488,6 +488,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. */
>@@ -3801,6 +3802,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++;
>     }
>
>@@ -3849,15 +3852,24 @@ reload:
>         lc = UINT_MAX;
>     }
>
>+    unsigned int log_cnt = 0;

Is it unusual to declare variables mid-function like this?
I could be mistaken, but offhand I can't remember seeing other examples of it 
(I stand to be corrected, however!).

>+    int streak_len;

I'm not crazy about this name - maybe something like 'consecutive_polls' or 
something to that effect would be more descriptive?

>+    const unsigned int MAX_STREAK_LEN = 100;

The capitalization here implies that MAX_STREAK_LEN is a macro, which it's not. 
It should be, though.

>     cycles_count_start(pmd);
>     for (;;) {
>+        log_cnt++;

What's the purpose of this variable?

>         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) {
>--
>2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to