diff mbox series

[ovs-dev,4/4] dpif-netdev: Rename pmd_info_show_rxq variables.

Message ID 20221005125312.162578-5-ktraynor@redhat.com
State Superseded
Headers show
Series Configurable pmd-rxq-show 'pmd usage' time frame. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Kevin Traynor Oct. 5, 2022, 12:53 p.m. UTC
There are some similar readings taken for pmds and Rx queues
in this function and a few of the variable names are ambiguous.

Improve the readability of the code by updating some variables
names to indicate that they are readings related to the pmd.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 lib/dpif-netdev.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index a4e44b657..78886f072 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -882,6 +882,6 @@  pmd_info_show_rxq(struct ds *reply, struct dp_netdev_pmd_thread *pmd,
         struct rxq_poll *list;
         size_t n_rxq;
-        uint64_t total_cycles = 0;
-        uint64_t busy_cycles = 0;
+        uint64_t total_pmd_cycles = 0;
+        uint64_t busy_pmd_cycles = 0;
         uint64_t total_rxq_proc_cycles = 0;
         unsigned int intervals;
@@ -896,15 +896,15 @@  pmd_info_show_rxq(struct ds *reply, struct dp_netdev_pmd_thread *pmd,
 
         /* Get the total pmd cycles for an interval. */
-        atomic_read_relaxed(&pmd->intrvl_cycles, &total_cycles);
+        atomic_read_relaxed(&pmd->intrvl_cycles, &total_pmd_cycles);
         /* Calculate how many intervals are to be used. */
         intervals = DIV_ROUND_UP(secs,
                                  PMD_INTERVAL_LEN / INTERVAL_USEC_TO_SEC);
         /* Estimate the cycles to cover all intervals. */
-        total_cycles *= intervals;
-        busy_cycles = get_interval_values(pmd->busy_cycles_intrvl,
-                                          &pmd->intrvl_idx,
-                                          intervals);
-        if (busy_cycles > total_cycles) {
-            busy_cycles = total_cycles;
+        total_pmd_cycles *= intervals;
+        busy_pmd_cycles = get_interval_values(pmd->busy_cycles_intrvl,
+                                              &pmd->intrvl_idx,
+                                              intervals);
+        if (busy_pmd_cycles > total_pmd_cycles) {
+            busy_pmd_cycles = total_pmd_cycles;
         }
 
@@ -923,7 +923,7 @@  pmd_info_show_rxq(struct ds *reply, struct dp_netdev_pmd_thread *pmd,
                                         ? "(enabled) " : "(disabled)");
             ds_put_format(reply, "  pmd usage: ");
-            if (total_cycles) {
+            if (total_pmd_cycles) {
                 ds_put_format(reply, "%2"PRIu64"",
-                              rxq_proc_cycles * 100 / total_cycles);
+                              rxq_proc_cycles * 100 / total_pmd_cycles);
                 ds_put_cstr(reply, " %");
             } else {
@@ -935,12 +935,12 @@  pmd_info_show_rxq(struct ds *reply, struct dp_netdev_pmd_thread *pmd,
         if (n_rxq > 0) {
             ds_put_cstr(reply, "  overhead: ");
-            if (total_cycles) {
+            if (total_pmd_cycles) {
                 uint64_t overhead_cycles = 0;
 
-                if (total_rxq_proc_cycles < busy_cycles) {
-                    overhead_cycles = busy_cycles - total_rxq_proc_cycles;
+                if (total_rxq_proc_cycles < busy_pmd_cycles) {
+                    overhead_cycles = busy_pmd_cycles - total_rxq_proc_cycles;
                 }
                 ds_put_format(reply, "%2"PRIu64" %%",
-                              overhead_cycles * 100 / total_cycles);
+                              overhead_cycles * 100 / total_pmd_cycles);
             } else {
                 ds_put_cstr(reply, "NOT AVAIL");