diff mbox series

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

Message ID 20221130173954.1043885-3-ktraynor@redhat.com
State Accepted
Commit ad6e506fcb63e34f3398c5284cb2bd1858ac3a49
Headers show
Series [ovs-dev,v3,1/3] dpif-netdev: Make pmd-rxq-show time configurable. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation fail test: fail

Commit Message

Kevin Traynor Nov. 30, 2022, 5:39 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(-)

Comments

David Marchand Dec. 2, 2022, 12:29 p.m. UTC | #1
On Wed, Nov 30, 2022 at 6:40 PM Kevin Traynor <ktraynor@redhat.com> wrote:
>
> 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>

Reviewed-by: David Marchand <david.marchand@redhat.com>
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 74d265a0b..cb3eb02e5 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -881,6 +881,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;
@@ -895,15 +895,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;
         }
 
@@ -922,7 +922,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 {
@@ -934,12 +934,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");