Skip to content

Commit c033a6d

Browse files
santildavem330
authored andcommitted
ibmveth: batch rx buffer replacement
At the moment we try and replenish the receive ring on every rx interrupt. We even have a pool->threshold but aren't using it. To limit the maximum latency incurred when refilling, change the threshold from 1/2 to 7/8 and reduce the largest rx pool from 768 buffers to 512 which should be more than enough. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a613f58 commit c033a6d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

drivers/net/ibmveth.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void ibmveth_init_buffer_pool(struct ibmveth_buff_pool *pool, u32 pool_in
178178
pool->size = pool_size;
179179
pool->index = pool_index;
180180
pool->buff_size = buff_size;
181-
pool->threshold = pool_size / 2;
181+
pool->threshold = pool_size * 7 / 8;
182182
pool->active = pool_active;
183183
}
184184

@@ -315,10 +315,13 @@ static void ibmveth_replenish_task(struct ibmveth_adapter *adapter)
315315

316316
adapter->replenish_task_cycles++;
317317

318-
for (i = (IbmVethNumBufferPools - 1); i >= 0; i--)
319-
if(adapter->rx_buff_pool[i].active)
320-
ibmveth_replenish_buffer_pool(adapter,
321-
&adapter->rx_buff_pool[i]);
318+
for (i = (IbmVethNumBufferPools - 1); i >= 0; i--) {
319+
struct ibmveth_buff_pool *pool = &adapter->rx_buff_pool[i];
320+
321+
if (pool->active &&
322+
(atomic_read(&pool->available) < pool->threshold))
323+
ibmveth_replenish_buffer_pool(adapter, pool);
324+
}
322325

323326
adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8);
324327
}

drivers/net/ibmveth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static inline long h_illan_attributes(unsigned long unit_address,
102102
#define IBMVETH_MAX_BUF_SIZE (1024 * 128)
103103

104104
static int pool_size[] = { 512, 1024 * 2, 1024 * 16, 1024 * 32, 1024 * 64 };
105-
static int pool_count[] = { 256, 768, 256, 256, 256 };
105+
static int pool_count[] = { 256, 512, 256, 256, 256 };
106106
static int pool_active[] = { 1, 1, 0, 0, 0};
107107

108108
#define IBM_VETH_INVALID_MAP ((u16)0xffff)

0 commit comments

Comments
 (0)