From ca2d559e1a41d62a5b49fb9ab513025ea27f1e7c Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 19 Feb 2009 20:17:36 +0100 Subject: b43: Move DMA stop sanity check Move the DMA stop sanity check up a few lines, so it's actually theoretically possible to trigger. (But it still shouldn't trigger, of course). Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/dma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/b43/dma.c') diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 6d65a02b705..0f021c666d0 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -1306,16 +1306,18 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) } spin_lock_irqsave(&ring->lock, flags); + B43_WARN_ON(!ring->tx); + /* Check if the queue was stopped in mac80211, + * but we got called nevertheless. + * That would be a mac80211 bug. */ + B43_WARN_ON(ring->stopped); + if (unlikely(free_slots(ring) < SLOTS_PER_PACKET)) { b43warn(dev->wl, "DMA queue overflow\n"); err = -ENOSPC; goto out_unlock; } - /* Check if the queue was stopped in mac80211, - * but we got called nevertheless. - * That would be a mac80211 bug. */ - B43_WARN_ON(ring->stopped); /* Assign the queue number to the ring (if not already done before) * so TX status handling can use it. The queue to ring mapping is -- cgit v1.2.3-70-g09d2 From 8eccb53f1b858c9bd0b745f839174725b76508ec Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 19 Feb 2009 23:39:26 +0100 Subject: 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 Signed-off-by: John W. Linville --- drivers/net/wireless/b43/dma.c | 9 ++------- drivers/net/wireless/b43/dma.h | 13 +++++-------- 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'drivers/net/wireless/b43/dma.c') diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 0f021c666d0..38246046a42 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, addrext = (u32) (dmaaddr & SSB_DMA_TRANSLATION_MASK) >> SSB_DMA_TRANSLATION_SHIFT; addr |= ssb_dma_translation(ring->dev->dev); - ctl = (bufsize - ring->frameoffset) - & B43_DMA32_DCTL_BYTECNT; + ctl = bufsize & B43_DMA32_DCTL_BYTECNT; if (slot == ring->nr_slots - 1) ctl |= B43_DMA32_DCTL_DTABLEEND; if (start) @@ -177,8 +176,7 @@ static void op64_fill_descriptor(struct b43_dmaring *ring, ctl0 |= B43_DMA64_DCTL0_FRAMEEND; if (irq) ctl0 |= B43_DMA64_DCTL0_IRQ; - ctl1 |= (bufsize - ring->frameoffset) - & B43_DMA64_DCTL1_BYTECNT; + ctl1 |= bufsize & B43_DMA64_DCTL1_BYTECNT; ctl1 |= (addrext << B43_DMA64_DCTL1_ADDREXT_SHIFT) & B43_DMA64_DCTL1_ADDREXT_MASK; @@ -830,9 +828,6 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, if (ring->index == 0) { ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE; ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET; - } else if (ring->index == 3) { - ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE; - ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET; } else B43_WARN_ON(1); } diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h index d1eb5c0848a..4ec24e8f4fd 100644 --- a/drivers/net/wireless/b43/dma.h +++ b/drivers/net/wireless/b43/dma.h @@ -1,14 +1,12 @@ #ifndef B43_DMA_H_ #define B43_DMA_H_ -#include +#include #include -#include -#include -#include #include "b43.h" + /* DMA-Interrupt reasons. */ #define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ | (1 << 14) | (1 << 15)) @@ -161,14 +159,13 @@ struct b43_dmadesc_generic { /* Misc DMA constants */ #define B43_DMA_RINGMEMSIZE PAGE_SIZE -#define B43_DMA0_RX_FRAMEOFFSET 30 -#define B43_DMA3_RX_FRAMEOFFSET 0 +#define B43_DMA0_RX_FRAMEOFFSET 30 /* DMA engine tuning knobs */ #define B43_TXRING_SLOTS 128 #define B43_RXRING_SLOTS 64 -#define B43_DMA0_RX_BUFFERSIZE (2304 + 100) -#define B43_DMA3_RX_BUFFERSIZE 16 +#define B43_DMA0_RX_BUFFERSIZE IEEE80211_MAX_FRAME_LEN + struct sk_buff; struct b43_private; -- cgit v1.2.3-70-g09d2 From bdceeb2dad5c8487ffeb4d0fa949686e4350ec7f Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 19 Feb 2009 23:45:43 +0100 Subject: b43: Optimize DMA buffers In the old days we used one slot per frame. But when we changed that to 2, we didn't raise the overall slot count. Which resulted in an effective division of two to the number of slots. Double the number of TX slots, so we have an effective hardware queue of 128 frames per QoS queue. Also optimize the TX header cache handling. We don't need a cached TX header for slots that will never carry an actual header. So we reduce the memory consumption of the cache by 50%. So as a net result we end up with more or less the same memory usage before and after this patch (except a few tiny meta structures), but have twice the number of TX slots available. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/dma.c | 38 +++++++++++++++++++++++--------------- drivers/net/wireless/b43/dma.h | 4 ++-- 2 files changed, 25 insertions(+), 17 deletions(-) (limited to 'drivers/net/wireless/b43/dma.c') diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 38246046a42..189b2ec1bac 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -41,6 +41,12 @@ #include +/* Required number of TX DMA slots per TX frame. + * This currently is 2, because we put the header and the ieee80211 frame + * into separate slots. */ +#define TX_SLOTS_PER_FRAME 2 + + /* 32bit DMA ops. */ static struct b43_dmadesc_generic *op32_idx2desc(struct b43_dmaring *ring, @@ -574,12 +580,11 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, return -ENOMEM; dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); - } - - if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { - b43err(ring->dev->wl, "RX DMA buffer allocation failed\n"); - dev_kfree_skb_any(skb); - return -EIO; + if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { + b43err(ring->dev->wl, "RX DMA buffer allocation failed\n"); + dev_kfree_skb_any(skb); + return -EIO; + } } meta->skb = skb; @@ -837,7 +842,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, #endif if (for_tx) { - ring->txhdr_cache = kcalloc(ring->nr_slots, + ring->txhdr_cache = kcalloc(ring->nr_slots / TX_SLOTS_PER_FRAME, b43_txhdr_size(dev), GFP_KERNEL); if (!ring->txhdr_cache) @@ -853,7 +858,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, b43_txhdr_size(dev), 1)) { /* ugh realloc */ kfree(ring->txhdr_cache); - ring->txhdr_cache = kcalloc(ring->nr_slots, + ring->txhdr_cache = kcalloc(ring->nr_slots / TX_SLOTS_PER_FRAME, b43_txhdr_size(dev), GFP_KERNEL | GFP_DMA); if (!ring->txhdr_cache) @@ -1144,7 +1149,10 @@ static int dma_tx_fragment(struct b43_dmaring *ring, u16 cookie; size_t hdrsize = b43_txhdr_size(ring->dev); -#define SLOTS_PER_PACKET 2 + /* Important note: If the number of used DMA slots per TX frame + * is changed here, the TX_SLOTS_PER_FRAME definition at the top of + * the file has to be updated, too! + */ old_top_slot = ring->current_slot; old_used_slots = ring->used_slots; @@ -1154,7 +1162,7 @@ static int dma_tx_fragment(struct b43_dmaring *ring, desc = ops->idx2desc(ring, slot, &meta_hdr); memset(meta_hdr, 0, sizeof(*meta_hdr)); - header = &(ring->txhdr_cache[slot * hdrsize]); + header = &(ring->txhdr_cache[(slot / TX_SLOTS_PER_FRAME) * hdrsize]); cookie = generate_cookie(ring, slot); err = b43_generate_txhdr(ring->dev, header, skb->data, skb->len, info, cookie); @@ -1308,7 +1316,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) * That would be a mac80211 bug. */ B43_WARN_ON(ring->stopped); - if (unlikely(free_slots(ring) < SLOTS_PER_PACKET)) { + if (unlikely(free_slots(ring) < TX_SLOTS_PER_FRAME)) { b43warn(dev->wl, "DMA queue overflow\n"); err = -ENOSPC; goto out_unlock; @@ -1332,7 +1340,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) goto out_unlock; } ring->nr_tx_packets++; - if ((free_slots(ring) < SLOTS_PER_PACKET) || + if ((free_slots(ring) < TX_SLOTS_PER_FRAME) || should_inject_overflow(ring)) { /* This TX ring is full. */ ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); @@ -1416,7 +1424,7 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, } dev->stats.last_tx = jiffies; if (ring->stopped) { - B43_WARN_ON(free_slots(ring) < SLOTS_PER_PACKET); + B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); ring->stopped = 0; if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { @@ -1439,8 +1447,8 @@ void b43_dma_get_tx_stats(struct b43_wldev *dev, ring = select_ring_by_priority(dev, i); spin_lock_irqsave(&ring->lock, flags); - stats[i].len = ring->used_slots / SLOTS_PER_PACKET; - stats[i].limit = ring->nr_slots / SLOTS_PER_PACKET; + stats[i].len = ring->used_slots / TX_SLOTS_PER_FRAME; + stats[i].limit = ring->nr_slots / TX_SLOTS_PER_FRAME; stats[i].count = ring->nr_tx_packets; spin_unlock_irqrestore(&ring->lock, flags); } diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h index 4ec24e8f4fd..05dde646d83 100644 --- a/drivers/net/wireless/b43/dma.h +++ b/drivers/net/wireless/b43/dma.h @@ -162,7 +162,7 @@ struct b43_dmadesc_generic { #define B43_DMA0_RX_FRAMEOFFSET 30 /* DMA engine tuning knobs */ -#define B43_TXRING_SLOTS 128 +#define B43_TXRING_SLOTS 256 #define B43_RXRING_SLOTS 64 #define B43_DMA0_RX_BUFFERSIZE IEEE80211_MAX_FRAME_LEN @@ -212,7 +212,7 @@ struct b43_dmaring { void *descbase; /* Meta data about all descriptors. */ struct b43_dmadesc_meta *meta; - /* Cache of TX headers for each slot. + /* Cache of TX headers for each TX frame. * This is to avoid an allocation on each TX. * This is NULL for an RX ring. */ -- cgit v1.2.3-70-g09d2 From 2d071ca50e9f20bf0203a7e8dbb1c784934e324d Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Fri, 20 Feb 2009 12:24:52 +0100 Subject: b43: Add slot count compiletime assertion This adds a compiletime assertion for a recently introduced assumption on the slot counts. The tx header cache handling code assumes that the TX slot count can be divided evenly by the number of TX slots per frame. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/dma.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/net/wireless/b43/dma.c') diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 189b2ec1bac..c69b70e0a72 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -842,6 +842,9 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, #endif if (for_tx) { + /* Assumption: B43_TXRING_SLOTS can be divided by TX_SLOTS_PER_FRAME */ + BUILD_BUG_ON(B43_TXRING_SLOTS % TX_SLOTS_PER_FRAME != 0); + ring->txhdr_cache = kcalloc(ring->nr_slots / TX_SLOTS_PER_FRAME, b43_txhdr_size(dev), GFP_KERNEL); -- cgit v1.2.3-70-g09d2 From 99da185a72ba685a5aaf49dff6a5fe83885112e4 Mon Sep 17 00:00:00 2001 From: John Daiker Date: Tue, 24 Feb 2009 02:16:42 -0800 Subject: b43: checkpatch.pl cleanups Keeping this one simple. Changing a few "foo * bar" to "foo *bar" Removes 22 checkpatch.pl errors, with no introduced warnings. Signed-off-by: John Daiker Signed-off-by: John W. Linville --- drivers/net/wireless/b43/debugfs.c | 4 ++-- drivers/net/wireless/b43/dma.c | 4 ++-- drivers/net/wireless/b43/lo.c | 18 +++++++++--------- drivers/net/wireless/b43/main.c | 26 +++++++++++++------------- drivers/net/wireless/b43/phy_g.c | 8 ++++---- drivers/net/wireless/b43/pio.c | 16 ++++++++-------- drivers/net/wireless/b43/rfkill.c | 2 +- 7 files changed, 39 insertions(+), 39 deletions(-) (limited to 'drivers/net/wireless/b43/dma.c') diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index bc2767da46e..45e3d6af69f 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c @@ -51,8 +51,8 @@ struct b43_debugfs_fops { }; static inline -struct b43_dfs_file * fops_to_dfs_file(struct b43_wldev *dev, - const struct b43_debugfs_fops *dfops) +struct b43_dfs_file *fops_to_dfs_file(struct b43_wldev *dev, + const struct b43_debugfs_fops *dfops) { void *p; diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index c69b70e0a72..92e1c0189a6 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -1260,8 +1260,8 @@ static inline int should_inject_overflow(struct b43_dmaring *ring) } /* Static mapping of mac80211's queues (priorities) to b43 DMA rings. */ -static struct b43_dmaring * select_ring_by_priority(struct b43_wldev *dev, - u8 queue_prio) +static struct b43_dmaring *select_ring_by_priority(struct b43_wldev *dev, + u8 queue_prio) { struct b43_dmaring *ring; diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c index 2a4e2b02faf..22d0fbd83a6 100644 --- a/drivers/net/wireless/b43/lo.c +++ b/drivers/net/wireless/b43/lo.c @@ -36,8 +36,8 @@ #include -static struct b43_lo_calib * b43_find_lo_calib(struct b43_txpower_lo_control *lo, - const struct b43_bbatt *bbatt, +static struct b43_lo_calib *b43_find_lo_calib(struct b43_txpower_lo_control *lo, + const struct b43_bbatt *bbatt, const struct b43_rfatt *rfatt) { struct b43_lo_calib *c; @@ -138,7 +138,7 @@ static u16 lo_measure_feedthrough(struct b43_wldev *dev, * "pad_mix_gain" is the PAD Mixer Gain. */ static u16 lo_txctl_register_table(struct b43_wldev *dev, - u16 * value, u16 * pad_mix_gain) + u16 *value, u16 *pad_mix_gain) { struct b43_phy *phy = &dev->phy; u16 reg, v, padmix; @@ -731,9 +731,9 @@ static void lo_probe_loctls_statemachine(struct b43_wldev *dev, } static -struct b43_lo_calib * b43_calibrate_lo_setting(struct b43_wldev *dev, - const struct b43_bbatt *bbatt, - const struct b43_rfatt *rfatt) +struct b43_lo_calib *b43_calibrate_lo_setting(struct b43_wldev *dev, + const struct b43_bbatt *bbatt, + const struct b43_rfatt *rfatt) { struct b43_phy *phy = &dev->phy; struct b43_phy_g *gphy = phy->g; @@ -797,9 +797,9 @@ struct b43_lo_calib * b43_calibrate_lo_setting(struct b43_wldev *dev, /* Get a calibrated LO setting for the given attenuation values. * Might return a NULL pointer under OOM! */ static -struct b43_lo_calib * b43_get_calib_lo_settings(struct b43_wldev *dev, - const struct b43_bbatt *bbatt, - const struct b43_rfatt *rfatt) +struct b43_lo_calib *b43_get_calib_lo_settings(struct b43_wldev *dev, + const struct b43_bbatt *bbatt, + const struct b43_rfatt *rfatt) { struct b43_txpower_lo_control *lo = dev->phy.g->lo_control; struct b43_lo_calib *c; diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6d52bae4932..8e1126d99f4 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c @@ -512,7 +512,7 @@ void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value) } /* Read HostFlags */ -u64 b43_hf_read(struct b43_wldev * dev) +u64 b43_hf_read(struct b43_wldev *dev) { u64 ret; @@ -600,7 +600,7 @@ void b43_tsf_write(struct b43_wldev *dev, u64 tsf) } static -void b43_macfilter_set(struct b43_wldev *dev, u16 offset, const u8 * mac) +void b43_macfilter_set(struct b43_wldev *dev, u16 offset, const u8 *mac) { static const u8 zero_addr[ETH_ALEN] = { 0 }; u16 data; @@ -790,7 +790,7 @@ void b43_dummy_transmission(struct b43_wldev *dev) } static void key_write(struct b43_wldev *dev, - u8 index, u8 algorithm, const u8 * key) + u8 index, u8 algorithm, const u8 *key) { unsigned int i; u32 offset; @@ -812,7 +812,7 @@ static void key_write(struct b43_wldev *dev, } } -static void keymac_write(struct b43_wldev *dev, u8 index, const u8 * addr) +static void keymac_write(struct b43_wldev *dev, u8 index, const u8 *addr) { u32 addrtmp[2] = { 0, 0, }; u8 per_sta_keys_start = 8; @@ -862,7 +862,7 @@ static void keymac_write(struct b43_wldev *dev, u8 index, const u8 * addr) static void do_key_write(struct b43_wldev *dev, u8 index, u8 algorithm, - const u8 * key, size_t key_len, const u8 * mac_addr) + const u8 *key, size_t key_len, const u8 *mac_addr) { u8 buf[B43_SEC_KEYSIZE] = { 0, }; u8 per_sta_keys_start = 8; @@ -886,8 +886,8 @@ static void do_key_write(struct b43_wldev *dev, static int b43_key_write(struct b43_wldev *dev, int index, u8 algorithm, - const u8 * key, size_t key_len, - const u8 * mac_addr, + const u8 *key, size_t key_len, + const u8 *mac_addr, struct ieee80211_key_conf *keyconf) { int i; @@ -1286,7 +1286,7 @@ static void handle_irq_pmq(struct b43_wldev *dev) } static void b43_write_template_common(struct b43_wldev *dev, - const u8 * data, u16 size, + const u8 *data, u16 size, u16 ram_offset, u16 shm_size_offset, u8 rate) { @@ -1476,9 +1476,9 @@ static void b43_write_probe_resp_plcp(struct b43_wldev *dev, * 2) Patching duration field * 3) Stripping TIM */ -static const u8 * b43_generate_probe_resp(struct b43_wldev *dev, - u16 *dest_size, - struct ieee80211_rate *rate) +static const u8 *b43_generate_probe_resp(struct b43_wldev *dev, + u16 *dest_size, + struct ieee80211_rate *rate) { const u8 *src_data; u8 *dest_data; @@ -2980,7 +2980,7 @@ static void b43_security_init(struct b43_wldev *dev) b43_clear_keys(dev); } -static int b43_rng_read(struct hwrng *rng, u32 * data) +static int b43_rng_read(struct hwrng *rng, u32 *data) { struct b43_wl *wl = (struct b43_wl *)rng->priv; unsigned long flags; @@ -3311,7 +3311,7 @@ static void b43_put_phy_into_reset(struct b43_wldev *dev) msleep(1); } -static const char * band_to_string(enum ieee80211_band band) +static const char *band_to_string(enum ieee80211_band band) { switch (band) { case IEEE80211_BAND_5GHZ: diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c index 607f17c3131..e7b98f013b0 100644 --- a/drivers/net/wireless/b43/phy_g.c +++ b/drivers/net/wireless/b43/phy_g.c @@ -767,7 +767,7 @@ static void b43_calc_nrssi_threshold(struct b43_wldev *dev) * interference mitigation code. * It is save to restore values in random order. */ -static void _stack_save(u32 * _stackptr, size_t * stackidx, +static void _stack_save(u32 *_stackptr, size_t *stackidx, u8 id, u16 offset, u16 value) { u32 *stackptr = &(_stackptr[*stackidx]); @@ -781,7 +781,7 @@ static void _stack_save(u32 * _stackptr, size_t * stackidx, B43_WARN_ON(*stackidx >= B43_INTERFSTACK_SIZE); } -static u16 _stack_restore(u32 * stackptr, u8 id, u16 offset) +static u16 _stack_restore(u32 *stackptr, u8 id, u16 offset) { size_t i; @@ -2350,8 +2350,8 @@ static s8 b43_tssi2dbm_entry(s8 entry[], u8 index, return 0; } -u8 * b43_generate_dyn_tssi2dbm_tab(struct b43_wldev *dev, - s16 pab0, s16 pab1, s16 pab2) +u8 *b43_generate_dyn_tssi2dbm_tab(struct b43_wldev *dev, + s16 pab0, s16 pab1, s16 pab2) { unsigned int i; u8 *tab; diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c index 1036bef8c4c..8cd9776752e 100644 --- a/drivers/net/wireless/b43/pio.c +++ b/drivers/net/wireless/b43/pio.c @@ -55,8 +55,8 @@ static u16 generate_cookie(struct b43_pio_txqueue *q, } static -struct b43_pio_txqueue * parse_cookie(struct b43_wldev *dev, - u16 cookie, +struct b43_pio_txqueue *parse_cookie(struct b43_wldev *dev, + u16 cookie, struct b43_pio_txpacket **pack) { struct b43_pio *pio = &dev->pio; @@ -134,8 +134,8 @@ static u16 pio_rxqueue_offset(struct b43_wldev *dev) return 8; } -static struct b43_pio_txqueue * b43_setup_pioqueue_tx(struct b43_wldev *dev, - unsigned int index) +static struct b43_pio_txqueue *b43_setup_pioqueue_tx(struct b43_wldev *dev, + unsigned int index) { struct b43_pio_txqueue *q; struct b43_pio_txpacket *p; @@ -171,8 +171,8 @@ static struct b43_pio_txqueue * b43_setup_pioqueue_tx(struct b43_wldev *dev, return q; } -static struct b43_pio_rxqueue * b43_setup_pioqueue_rx(struct b43_wldev *dev, - unsigned int index) +static struct b43_pio_rxqueue *b43_setup_pioqueue_rx(struct b43_wldev *dev, + unsigned int index) { struct b43_pio_rxqueue *q; @@ -308,8 +308,8 @@ err_destroy_bk: } /* Static mapping of mac80211's queues (priorities) to b43 PIO queues. */ -static struct b43_pio_txqueue * select_queue_by_priority(struct b43_wldev *dev, - u8 queue_prio) +static struct b43_pio_txqueue *select_queue_by_priority(struct b43_wldev *dev, + u8 queue_prio) { struct b43_pio_txqueue *q; diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 713753781f4..afad4235869 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c @@ -113,7 +113,7 @@ out_unlock: return err; } -char * b43_rfkill_led_name(struct b43_wldev *dev) +char *b43_rfkill_led_name(struct b43_wldev *dev) { struct b43_rfkill *rfk = &(dev->wl->rfkill); -- cgit v1.2.3-70-g09d2 From ce4fbdbf161b2676b3833412367113572d739253 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 2 Mar 2009 23:18:37 +0100 Subject: b43: Pass more RX flags to mac80211 This changes the RX handler to pass more status flags to mac80211. It also changes part of the drop policy, if bad frames were requested. (Note that currently mac80211 will throw a WARN_ON in that case. But nothing bad will happen). This also removes some obsolete unused timestamping code. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/b43.h | 3 --- drivers/net/wireless/b43/dma.c | 1 - drivers/net/wireless/b43/xmit.c | 17 +++++++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'drivers/net/wireless/b43/dma.c') diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index b4573101278..beaf18d6e8a 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h @@ -550,9 +550,6 @@ struct b43_noise_calculation { struct b43_stats { u8 link_noise; - /* Store the last TX/RX times here for updating the leds. */ - unsigned long last_tx; - unsigned long last_rx; }; struct b43_key { diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 92e1c0189a6..0cc804d0a21 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -1425,7 +1425,6 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, break; slot = next_slot(ring, slot); } - dev->stats.last_tx = jiffies; if (ring->stopped) { B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index eae9b805265..0f53c7e5e01 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c @@ -538,8 +538,14 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) chanstat = le16_to_cpu(rxhdr->channel); phytype = chanstat & B43_RX_CHAN_PHYTYPE; - if (macstat & B43_RX_MAC_FCSERR) + if (unlikely(macstat & B43_RX_MAC_FCSERR)) { dev->wl->ieee_stats.dot11FCSErrorCount++; + status.flag |= RX_FLAG_FAILED_FCS_CRC; + } + if (unlikely(phystat0 & (B43_RX_PHYST0_PLCPHCF | B43_RX_PHYST0_PLCPFV))) + status.flag |= RX_FLAG_FAILED_PLCP_CRC; + if (phystat0 & B43_RX_PHYST0_SHORTPRMBL) + status.flag |= RX_FLAG_SHORTPRE; if (macstat & B43_RX_MAC_DECERR) { /* Decryption with the given key failed. * Drop the packet. We also won't be able to decrypt it with @@ -606,8 +612,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) phytype == B43_PHYTYPE_A); else status.rate_idx = b43_plcp_get_bitrate_idx_cck(plcp); - if (unlikely(status.rate_idx == -1)) - goto drop; + if (unlikely(status.rate_idx == -1)) { + /* PLCP seems to be corrupted. + * Drop the frame, if we are not interested in corrupted frames. */ + if (!(dev->wl->filter_flags & FIF_PLCPFAIL)) + goto drop; + } status.antenna = !!(phystat0 & B43_RX_PHYST0_ANT); /* @@ -661,7 +671,6 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) goto drop; } - dev->stats.last_rx = jiffies; ieee80211_rx_irqsafe(dev->wl->hw, skb, &status); return; -- cgit v1.2.3-70-g09d2