提交 7d4987de 编写于 作者: A Alexander Duyck 提交者: Jeff Kirsher

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: NAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 a65151ba
...@@ -306,9 +306,13 @@ struct ixgbe_q_vector { ...@@ -306,9 +306,13 @@ struct ixgbe_q_vector {
((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8) ((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8)
#define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG #define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG
#define IXGBE_DESC_UNUSED(R) \ static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring)
((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ {
(R)->next_to_clean - (R)->next_to_use - 1) u16 ntc = ring->next_to_clean;
u16 ntu = ring->next_to_use;
return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
}
#define IXGBE_RX_DESC_ADV(R, i) \ #define IXGBE_RX_DESC_ADV(R, i) \
(&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
......
...@@ -882,7 +882,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, ...@@ -882,7 +882,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
if (unlikely(count && netif_carrier_ok(tx_ring->netdev) && if (unlikely(count && netif_carrier_ok(tx_ring->netdev) &&
(IXGBE_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD))) { (ixgbe_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) {
/* Make sure that anybody stopping the queue after this /* Make sure that anybody stopping the queue after this
* sees the new next_to_clean. * sees the new next_to_clean.
*/ */
...@@ -1474,7 +1474,7 @@ static void ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, ...@@ -1474,7 +1474,7 @@ static void ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
} }
rx_ring->next_to_clean = i; rx_ring->next_to_clean = i;
cleaned_count = IXGBE_DESC_UNUSED(rx_ring); cleaned_count = ixgbe_desc_unused(rx_ring);
if (cleaned_count) if (cleaned_count)
ixgbe_alloc_rx_buffers(rx_ring, cleaned_count); ixgbe_alloc_rx_buffers(rx_ring, cleaned_count);
...@@ -3126,7 +3126,7 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, ...@@ -3126,7 +3126,7 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(reg_idx), rxdctl); IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(reg_idx), rxdctl);
ixgbe_rx_desc_queue_enable(adapter, ring); ixgbe_rx_desc_queue_enable(adapter, ring);
ixgbe_alloc_rx_buffers(ring, IXGBE_DESC_UNUSED(ring)); ixgbe_alloc_rx_buffers(ring, ixgbe_desc_unused(ring));
} }
static void ixgbe_setup_psrtype(struct ixgbe_adapter *adapter) static 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,7 +6817,7 @@ static int __ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size)
/* We need to check again in a case another CPU has just /* We need to check again in a case another CPU has just
* made room available. */ * made room available. */
if (likely(IXGBE_DESC_UNUSED(tx_ring) < size)) if (likely(ixgbe_desc_unused(tx_ring) < size))
return -EBUSY; return -EBUSY;
/* A reprieve! - use start_queue because it doesn't call schedule */ /* 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,7 +6828,7 @@ static int __ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size)
static int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size) static int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, int size)
{ {
if (likely(IXGBE_DESC_UNUSED(tx_ring) >= size)) if (likely(ixgbe_desc_unused(tx_ring) >= size))
return 0; return 0;
return __ixgbe_maybe_stop_tx(tx_ring, size); return __ixgbe_maybe_stop_tx(tx_ring, size);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册