diff options
-rw-r--r-- | drivers/net/ibmveth.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 4734c939ad03..d2cc6d3f401c 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -252,7 +252,9 @@ static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter, struc | |||
252 | } | 252 | } |
253 | 253 | ||
254 | free_index = pool->consumer_index; | 254 | free_index = pool->consumer_index; |
255 | pool->consumer_index = (pool->consumer_index + 1) % pool->size; | 255 | pool->consumer_index++; |
256 | if (pool->consumer_index >= pool->size) | ||
257 | pool->consumer_index = 0; | ||
256 | index = pool->free_map[free_index]; | 258 | index = pool->free_map[free_index]; |
257 | 259 | ||
258 | ibmveth_assert(index != IBM_VETH_INVALID_MAP); | 260 | ibmveth_assert(index != IBM_VETH_INVALID_MAP); |
@@ -377,9 +379,10 @@ static void ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter, u64 | |||
377 | DMA_FROM_DEVICE); | 379 | DMA_FROM_DEVICE); |
378 | 380 | ||
379 | free_index = adapter->rx_buff_pool[pool].producer_index; | 381 | free_index = adapter->rx_buff_pool[pool].producer_index; |
380 | adapter->rx_buff_pool[pool].producer_index | 382 | adapter->rx_buff_pool[pool].producer_index++; |
381 | = (adapter->rx_buff_pool[pool].producer_index + 1) | 383 | if (adapter->rx_buff_pool[pool].producer_index >= |
382 | % adapter->rx_buff_pool[pool].size; | 384 | adapter->rx_buff_pool[pool].size) |
385 | adapter->rx_buff_pool[pool].producer_index = 0; | ||
383 | adapter->rx_buff_pool[pool].free_map[free_index] = index; | 386 | adapter->rx_buff_pool[pool].free_map[free_index] = index; |
384 | 387 | ||
385 | mb(); | 388 | mb(); |