i40e: refactor tail_bump check
authorCarolyn Wyborny <carolyn.wyborny@intel.com>
Thu, 4 Aug 2016 18:37:03 +0000 (11:37 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 20 Aug 2016 04:24:28 +0000 (21:24 -0700)
This patch refactors tail bump check.

Change-ID: Ide0e19171d67d90cb2b06b8dcd4fa791ae120160
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.c

index df7ecc9578c9316fbf0caf50e757f1204d748146..f8d66236fcbf92bdcf5d58cc0ac57bb5eb3a2281 100644 (file)
@@ -2840,10 +2840,9 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
                                                  I40E_TXD_QW1_CMD_SHIFT);
 
        /* notify HW of packet */
-       if (!tail_bump)
+       if (!tail_bump) {
                prefetchw(tx_desc + 1);
-
-       if (tail_bump) {
+       } else {
                /* Force memory writes to complete before letting h/w
                 * know there are new descriptors to fetch.  (Only
                 * applicable for weak-ordered memory model archs,
@@ -2852,7 +2851,6 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
                wmb();
                writel(i, tx_ring->tail);
        }
-
        return;
 
 dma_error:
index a579193b2c21a4add77e8d5f5fdd636d36e69a84..0130458264e5753741821018ff473b41dfb1796a 100644 (file)
@@ -2068,10 +2068,9 @@ static inline void i40evf_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
                                                  I40E_TXD_QW1_CMD_SHIFT);
 
        /* notify HW of packet */
-       if (!tail_bump)
+       if (!tail_bump) {
                prefetchw(tx_desc + 1);
-
-       if (tail_bump) {
+       } else {
                /* Force memory writes to complete before letting h/w
                 * know there are new descriptors to fetch.  (Only
                 * applicable for weak-ordered memory model archs,
@@ -2080,7 +2079,6 @@ static inline void i40evf_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
                wmb();
                writel(i, tx_ring->tail);
        }
-
        return;
 
 dma_error: