]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e/i40evf: Fix handling of boolean logic in polling routines
authorAlexander Duyck <aduyck@mirantis.com>
Mon, 7 Mar 2016 17:29:57 +0000 (09:29 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 7 Jul 2016 17:40:42 +0000 (10:40 -0700)
Orabug: 23176970

In the polling routines for i40e and i40evf we were using bitwise operators
to avoid the side effects of the logical operators, specifically the fact
that if the first case is true with "||" we skip the second case, or if it
is false with "&&" we skip the second case.  This fixes an earlier patch
that converted the bitwise operators over to the logical operators and
instead replaces the entire thing with just an if statement since it should
be more readable what we are trying to do this way.

Fixes: 1a36d7fadd14 ("i40e/i40evf: use logical operators, not bitwise")
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f2edaaaa392bc21c24f532ea9bcc952a54a22367)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.c

drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.c

index 3ffd8da99d3df5d5c1948cbc10c4f62658fb7ae1..d18a874ad6c01f7778418baafcc56fbe05f9c7bc 100644 (file)
@@ -1978,9 +1978,11 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
         * budget and be more aggressive about cleaning up the Tx descriptors.
         */
        i40e_for_each_ring(ring, q_vector->tx) {
-               clean_complete = clean_complete &&
-                                i40e_clean_tx_irq(ring, vsi->work_limit);
-               arm_wb = arm_wb || ring->arm_wb;
+               if (!i40e_clean_tx_irq(ring, vsi->work_limit)) {
+                       clean_complete = false;
+                       continue;
+               }
+               arm_wb |= ring->arm_wb;
                ring->arm_wb = false;
        }
 
@@ -1998,8 +2000,9 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
                        cleaned = i40e_clean_rx_irq_ps(ring, budget_per_ring);
                else
                        cleaned = i40e_clean_rx_irq_1buf(ring, budget_per_ring);
-               /* if we didn't clean as many as budgeted, we must be done */
-               clean_complete = clean_complete && (budget_per_ring > cleaned);
+               /* if we clean as many as budgeted, we must not be done */
+               if (cleaned >= budget_per_ring)
+                       clean_complete = false;
        }
 
        /* If work not completed, return budget and polling will return */
index 2fbbed0b12e7dc1d9179024cdf2af91526bf6285..9d857ceea3cc4c926a7ad5d9a9ea4a005936af2b 100644 (file)
@@ -1414,9 +1414,11 @@ int i40evf_napi_poll(struct napi_struct *napi, int budget)
         * budget and be more aggressive about cleaning up the Tx descriptors.
         */
        i40e_for_each_ring(ring, q_vector->tx) {
-               clean_complete = clean_complete &&
-                                i40e_clean_tx_irq(ring, vsi->work_limit);
-               arm_wb = arm_wb || ring->arm_wb;
+               if (!i40e_clean_tx_irq(ring, vsi->work_limit)) {
+                       clean_complete = false;
+                       continue;
+               }
+               arm_wb |= ring->arm_wb;
                ring->arm_wb = false;
        }
 
@@ -1434,8 +1436,9 @@ int i40evf_napi_poll(struct napi_struct *napi, int budget)
                        cleaned = i40e_clean_rx_irq_ps(ring, budget_per_ring);
                else
                        cleaned = i40e_clean_rx_irq_1buf(ring, budget_per_ring);
-               /* if we didn't clean as many as budgeted, we must be done */
-               clean_complete = clean_complete && (budget_per_ring > cleaned);
+               /* if we clean as many as budgeted, we must not be done */
+               if (cleaned >= budget_per_ring)
+                       clean_complete = false;
        }
 
        /* If work not completed, return budget and polling will return */