cycles_count_intermediate is used to count the cycles used for a pmd.
With some small additions we can also use it to count the cycles used
for processing an rxq.

Signed-off-by: Kevin Traynor <[email protected]>
---
 lib/dpif-netdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index d2a02af..b94c397 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3048,4 +3048,5 @@ cycles_count_end(struct dp_netdev_pmd_thread *pmd,
 static inline void
 cycles_count_intermediate(struct dp_netdev_pmd_thread *pmd,
+                          struct dp_netdev_rxq *rxq,
                           enum pmd_cycles_counter_type type)
     OVS_NO_THREAD_SAFETY_ANALYSIS
@@ -3056,4 +3057,7 @@ cycles_count_intermediate(struct dp_netdev_pmd_thread 
*pmd,
 
     non_atomic_ullong_add(&pmd->cycles.n[type], interval);
+    if (rxq && (type == PMD_CYCLES_PROCESSING)) {
+        non_atomic_ullong_add(&rxq->cyc_curr, interval);
+    }
 }
 
@@ -3590,5 +3594,5 @@ dpif_netdev_run(struct dpif *dpif)
                                                    port->rxqs[i].rx,
                                                    port->port_no);
-                    cycles_count_intermediate(non_pmd, process_packets ?
+                    cycles_count_intermediate(non_pmd, NULL, process_packets ?
                                                        PMD_CYCLES_PROCESSING
                                                      : PMD_CYCLES_IDLE);
@@ -3754,5 +3758,5 @@ reload:
                 dp_netdev_process_rxq_port(pmd, poll_list[i].rx,
                                            poll_list[i].port_no);
-            cycles_count_intermediate(pmd,
+            cycles_count_intermediate(pmd, NULL,
                                       process_packets ? PMD_CYCLES_PROCESSING
                                                       : PMD_CYCLES_IDLE);
-- 
1.8.3.1

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

Reply via email to