aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-02-19 17:39:26 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:47 -0500
commit8eccb53f1b858c9bd0b745f839174725b76508ec (patch)
tree434ed31a9409936670c1c06f867ad541a08f2e2d /drivers/net
parentca2d559e1a41d62a5b49fb9ab513025ea27f1e7c (diff)
b43: Fix DMA buffer size handling
This fixes hidden bugs in the size handling of the DMA buffers. This sets the RX buffer size to the theoretical max packet size and fixes passing of the size values to the device (must not subtract the header offset). These bugs are hidden and don't actually trigger due to the magic +100 offset for the buffer size. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/b43/dma.c9
-rw-r--r--drivers/net/wireless/b43/dma.h13
2 files changed, 7 insertions, 15 deletions
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 0f021c666d08..38246046a42f 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -74,8 +74,7 @@ static void op32_fill_descriptor(struct b43_dmaring *ring,
74 addrext = (u32) (dmaaddr & SSB_DMA_TRANSLATION_MASK) 74 addrext = (u32) (dmaaddr & SSB_DMA_TRANSLATION_MASK)
75 >> SSB_DMA_TRANSLATION_SHIFT; 75 >> SSB_DMA_TRANSLATION_SHIFT;
76 addr |= ssb_dma_translation(ring->dev->dev); 76 addr |= ssb_dma_translation(ring->dev->dev);
77 ctl = (bufsize - ring->frameoffset) 77 ctl = bufsize & B43_DMA32_DCTL_BYTECNT;
78 & B43_DMA32_DCTL_BYTECNT;
79 if (slot == ring->nr_slots - 1) 78 if (slot == ring->nr_slots - 1)
80 ctl |= B43_DMA32_DCTL_DTABLEEND; 79 ctl |= B43_DMA32_DCTL_DTABLEEND;
81 if (start) 80 if (start)
@@ -177,8 +176,7 @@ static void op64_fill_descriptor(struct b43_dmaring *ring,
177 ctl0 |= B43_DMA64_DCTL0_FRAMEEND; 176 ctl0 |= B43_DMA64_DCTL0_FRAMEEND;
178 if (irq) 177 if (irq)
179 ctl0 |= B43_DMA64_DCTL0_IRQ; 178 ctl0 |= B43_DMA64_DCTL0_IRQ;
180 ctl1 |= (bufsize - ring->frameoffset) 179 ctl1 |= bufsize & B43_DMA64_DCTL1_BYTECNT;
181 & B43_DMA64_DCTL1_BYTECNT;
182 ctl1 |= (addrext << B43_DMA64_DCTL1_ADDREXT_SHIFT) 180 ctl1 |= (addrext << B43_DMA64_DCTL1_ADDREXT_SHIFT)
183 & B43_DMA64_DCTL1_ADDREXT_MASK; 181 & B43_DMA64_DCTL1_ADDREXT_MASK;
184 182
@@ -830,9 +828,6 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
830 if (ring->index == 0) { 828 if (ring->index == 0) {
831 ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE; 829 ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE;
832 ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET; 830 ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET;
833 } else if (ring->index == 3) {
834 ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE;
835 ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET;
836 } else 831 } else
837 B43_WARN_ON(1); 832 B43_WARN_ON(1);
838 } 833 }
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index d1eb5c0848a5..4ec24e8f4fd7 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -1,14 +1,12 @@
1#ifndef B43_DMA_H_ 1#ifndef B43_DMA_H_
2#define B43_DMA_H_ 2#define B43_DMA_H_
3 3
4#include <linux/list.h> 4#include <linux/ieee80211.h>
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
6#include <linux/workqueue.h>
7#include <linux/linkage.h>
8#include <asm/atomic.h>
9 6
10#include "b43.h" 7#include "b43.h"
11 8
9
12/* DMA-Interrupt reasons. */ 10/* DMA-Interrupt reasons. */
13#define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ 11#define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \
14 | (1 << 14) | (1 << 15)) 12 | (1 << 14) | (1 << 15))
@@ -161,14 +159,13 @@ struct b43_dmadesc_generic {
161 159
162/* Misc DMA constants */ 160/* Misc DMA constants */
163#define B43_DMA_RINGMEMSIZE PAGE_SIZE 161#define B43_DMA_RINGMEMSIZE PAGE_SIZE
164#define B43_DMA0_RX_FRAMEOFFSET 30 162#define B43_DMA0_RX_FRAMEOFFSET 30
165#define B43_DMA3_RX_FRAMEOFFSET 0
166 163
167/* DMA engine tuning knobs */ 164/* DMA engine tuning knobs */
168#define B43_TXRING_SLOTS 128 165#define B43_TXRING_SLOTS 128
169#define B43_RXRING_SLOTS 64 166#define B43_RXRING_SLOTS 64
170#define B43_DMA0_RX_BUFFERSIZE (2304 + 100) 167#define B43_DMA0_RX_BUFFERSIZE IEEE80211_MAX_FRAME_LEN
171#define B43_DMA3_RX_BUFFERSIZE 16 168
172 169
173struct sk_buff; 170struct sk_buff;
174struct b43_private; 171struct b43_private;