diff options
| -rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 10 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h index acf38067a700..8971e2d0a984 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | |||
| @@ -286,9 +286,13 @@ static inline bool ixgbevf_qv_disable(struct ixgbevf_q_vector *q_vector) | |||
| 286 | ((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8) | 286 | ((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8) |
| 287 | #define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG | 287 | #define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG |
| 288 | 288 | ||
| 289 | #define IXGBE_DESC_UNUSED(R) \ | 289 | static inline u16 ixgbevf_desc_unused(struct ixgbevf_ring *ring) |
| 290 | ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ | 290 | { |
| 291 | (R)->next_to_clean - (R)->next_to_use - 1) | 291 | u16 ntc = ring->next_to_clean; |
| 292 | u16 ntu = ring->next_to_use; | ||
| 293 | |||
| 294 | return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; | ||
| 295 | } | ||
| 292 | 296 | ||
| 293 | #define IXGBEVF_RX_DESC(R, i) \ | 297 | #define IXGBEVF_RX_DESC(R, i) \ |
| 294 | (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) | 298 | (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 9685354e6b9d..038bfc8b7616 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
| @@ -251,7 +251,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector, | |||
| 251 | 251 | ||
| 252 | #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) | 252 | #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) |
| 253 | if (unlikely(count && netif_carrier_ok(tx_ring->netdev) && | 253 | if (unlikely(count && netif_carrier_ok(tx_ring->netdev) && |
| 254 | (IXGBE_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD))) { | 254 | (ixgbevf_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD))) { |
| 255 | /* Make sure that anybody stopping the queue after this | 255 | /* Make sure that anybody stopping the queue after this |
| 256 | * sees the new next_to_clean. | 256 | * sees the new next_to_clean. |
| 257 | */ | 257 | */ |
| @@ -529,7 +529,7 @@ next_desc: | |||
| 529 | } | 529 | } |
| 530 | 530 | ||
| 531 | rx_ring->next_to_clean = i; | 531 | rx_ring->next_to_clean = i; |
| 532 | cleaned_count = IXGBE_DESC_UNUSED(rx_ring); | 532 | cleaned_count = ixgbevf_desc_unused(rx_ring); |
| 533 | 533 | ||
| 534 | if (cleaned_count) | 534 | if (cleaned_count) |
| 535 | ixgbevf_alloc_rx_buffers(adapter, rx_ring, cleaned_count); | 535 | ixgbevf_alloc_rx_buffers(adapter, rx_ring, cleaned_count); |
| @@ -1380,7 +1380,7 @@ static void ixgbevf_configure(struct ixgbevf_adapter *adapter) | |||
| 1380 | for (i = 0; i < adapter->num_rx_queues; i++) { | 1380 | for (i = 0; i < adapter->num_rx_queues; i++) { |
| 1381 | struct ixgbevf_ring *ring = &adapter->rx_ring[i]; | 1381 | struct ixgbevf_ring *ring = &adapter->rx_ring[i]; |
| 1382 | ixgbevf_alloc_rx_buffers(adapter, ring, | 1382 | ixgbevf_alloc_rx_buffers(adapter, ring, |
| 1383 | IXGBE_DESC_UNUSED(ring)); | 1383 | ixgbevf_desc_unused(ring)); |
| 1384 | } | 1384 | } |
| 1385 | } | 1385 | } |
| 1386 | 1386 | ||
| @@ -3102,7 +3102,7 @@ static int __ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) | |||
| 3102 | 3102 | ||
| 3103 | /* We need to check again in a case another CPU has just | 3103 | /* We need to check again in a case another CPU has just |
| 3104 | * made room available. */ | 3104 | * made room available. */ |
| 3105 | if (likely(IXGBE_DESC_UNUSED(tx_ring) < size)) | 3105 | if (likely(ixgbevf_desc_unused(tx_ring) < size)) |
| 3106 | return -EBUSY; | 3106 | return -EBUSY; |
| 3107 | 3107 | ||
| 3108 | /* A reprieve! - use start_queue because it doesn't call schedule */ | 3108 | /* A reprieve! - use start_queue because it doesn't call schedule */ |
| @@ -3113,7 +3113,7 @@ static int __ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) | |||
| 3113 | 3113 | ||
| 3114 | static int ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) | 3114 | static int ixgbevf_maybe_stop_tx(struct ixgbevf_ring *tx_ring, int size) |
| 3115 | { | 3115 | { |
| 3116 | if (likely(IXGBE_DESC_UNUSED(tx_ring) >= size)) | 3116 | if (likely(ixgbevf_desc_unused(tx_ring) >= size)) |
| 3117 | return 0; | 3117 | return 0; |
| 3118 | return __ixgbevf_maybe_stop_tx(tx_ring, size); | 3118 | return __ixgbevf_maybe_stop_tx(tx_ring, size); |
| 3119 | } | 3119 | } |
