aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2011-05-27 01:31:37 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-06-25 03:04:32 -0400
commit7d4987de752a94772ad1ae85ad5c702bbcf73305 (patch)
tree136cd312e7d2582fc98e46d8be5b7f585ec0ee61 /drivers/net/ixgbe
parenta65151ba201fe56ac146767e018674a84bfef1a6 (diff)
ixgbe: Convert IXGBE_DESC_UNUSED from macro to static inline function
This change is a minor cleanup that converts the IXGBE_DESC_UNUSED macro into a static inline function just for the case of the code being a bit cleaner. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe.h10
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index d6bfb2f6ba86..b1d4b02606ae 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -306,9 +306,13 @@ struct ixgbe_q_vector {
306 ((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8) 306 ((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8)
307#define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG 307#define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG
308 308
309#define IXGBE_DESC_UNUSED(R) \ 309static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring)
310 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ 310{
311 (R)->next_to_clean - (R)->next_to_use - 1) 311 u16 ntc = ring->next_to_clean;
312 u16 ntu = ring->next_to_use;
313
314 return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
315}
312 316
313#define IXGBE_RX_DESC_ADV(R, i) \ 317#define IXGBE_RX_DESC_ADV(R, i) \
314 (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) 318 (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index b308571428a5..f8a22eb89daf 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -882,7 +882,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
882 882
883#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) 883#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
884 if (unlikely(count && netif_carrier_ok(tx_ring->netdev) && 884 if (unlikely(count && netif_carrier_ok(tx_ring->netdev) &&
885 (IXGBE_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD))) { 885 (ixgbe_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) {
886 /* Make sure that anybody stopping the queue after this 886 /* Make sure that anybody stopping the queue after this
887 * sees the new next_to_clean. 887 * sees the new next_to_clean.
888 */ 888 */
@@ -1474,7 +1474,7 @@ next_desc:
1474 } 1474 }
1475 1475
1476 rx_ring->next_to_clean = i; 1476 rx_ring->next_to_clean = i;
1477 cleaned_count = IXGBE_DESC_UNUSED(rx_ring); 1477 cleaned_count = ixgbe_desc_unused(rx_ring);
1478 1478
1479 if (cleaned_count) 1479 if (cleaned_count)
1480 ixgbe_alloc_rx_buffers(rx_ring, cleaned_count); 1480 ixgbe_alloc_rx_buffers(rx_ring, cleaned_count);
@@ -3126,7 +3126,7 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
3126 IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(reg_idx), rxdctl); 3126 IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(reg_idx), rxdctl);
3127 3127
3128 ixgbe_rx_desc_queue_enable(adapter, ring); 3128 ixgbe_rx_desc_queue_enable(adapter, ring);
3129 ixgbe_alloc_rx_buffers(ring, IXGBE_DESC_UNUSED(ring)); 3129 ixgbe_alloc_rx_buffers(ring, ixgbe_desc_unused(ring));
3130} 3130}
3131 3131
3132static void ixgbe_setup_psrtype(struct ixgbe_adapter *adapter) 3132static void ixgbe_setup_psrtype(struct ixgbe_adapter *adapter)
@@ -6817,7 +6817,7 @@ static int __ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size)
6817 6817
6818 /* We need to check again in a case another CPU has just 6818 /* We need to check again in a case another CPU has just
6819 * made room available. */ 6819 * made room available. */
6820 if (likely(IXGBE_DESC_UNUSED(tx_ring) < size)) 6820 if (likely(ixgbe_desc_unused(tx_ring) < size))
6821 return -EBUSY; 6821 return -EBUSY;
6822 6822
6823 /* A reprieve! - use start_queue because it doesn't call schedule */ 6823 /* A reprieve! - use start_queue because it doesn't call schedule */
@@ -6828,7 +6828,7 @@ static int __ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size)
6828 6828
6829static int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size) 6829static int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size)
6830{ 6830{
6831 if (likely(IXGBE_DESC_UNUSED(tx_ring) >= size)) 6831 if (likely(ixgbe_desc_unused(tx_ring) >= size))
6832 return 0; 6832 return 0;
6833 return __ixgbe_maybe_stop_tx(tx_ring, size); 6833 return __ixgbe_maybe_stop_tx(tx_ring, size);
6834} 6834}