From 0c7bbdc8a87a9092992e892b85247d5a3d988637 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Mon, 12 Nov 2012 21:16:28 +0000 Subject: [PATCH] --- yaml --- r: 337837 b: refs/heads/master c: 87648933116f528b3cda64c4d80d9577277fe4f0 h: refs/heads/master i: 337835: fd034d8bd20511219136ade7b9046072728dff9e v: v3 --- [refs] | 2 +- trunk/drivers/staging/et131x/et131x.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index a9ccb4b903d1..e226272d1eec 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9d10b221264b9383fcf8e8628f89e9859c05599d +refs/heads/master: 87648933116f528b3cda64c4d80d9577277fe4f0 diff --git a/trunk/drivers/staging/et131x/et131x.c b/trunk/drivers/staging/et131x/et131x.c index 69a07299b74d..4f68646f66b6 100644 --- a/trunk/drivers/staging/et131x/et131x.c +++ b/trunk/drivers/staging/et131x/et131x.c @@ -2266,7 +2266,9 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) u8 id; u32 i, j; u32 bufsize; - u32 pktstat_ringsize, fbr_chunksize; + u32 pktstat_ringsize; + u32 fbr_chunksize; + u32 fbr_align; struct rx_ring *rx_ring; /* Setup some convenience pointers */ @@ -2341,10 +2343,17 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) } for (id = 0; id < NUM_FBRS; id++) { + if (id == 0 && rx_ring->fbr[id]->buffsize > 4096) + fbr_align = 4096; + else + fbr_align = rx_ring->fbr[id]->buffsize; + + fbr_chunksize = (FBR_CHUNKS * + rx_ring->fbr[id]->buffsize) + fbr_align - 1; + for (i = 0; i < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS); i++) { dma_addr_t fbr_tmp_physaddr; dma_addr_t fbr_offset; - u32 fbr_align; /* This code allocates an area of memory big enough for * N free buffers + (buffer_size - 1) so that the @@ -2353,13 +2362,6 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) * effect would be to double the size of FBR0. By * allocating N buffers at once, we reduce this overhead */ - if (id == 0 && rx_ring->fbr[id]->buffsize > 4096) - fbr_align = 4096; - else - fbr_align = rx_ring->fbr[id]->buffsize; - - fbr_chunksize = (FBR_CHUNKS * - rx_ring->fbr[id]->buffsize) + fbr_align - 1; rx_ring->fbr[id]->mem_virtaddrs[i] = dma_alloc_coherent( &adapter->pdev->dev, fbr_chunksize, &rx_ring->fbr[id]->mem_physaddrs[i],