diff options
author | Ulrich Kunitz <kune@deine-taler.de> | 2006-11-22 00:05:53 +0000 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-02 00:12:05 -0500 |
commit | 741fec53f268b691b869ffc70023319406e0cc97 (patch) | |
tree | 47ea2334fd44daaaa19b9a3d22d34466d0250069 /drivers/net/wireless/zd1211rw/zd_mac.c | |
parent | 84bc715c465f76584fc5127955fca0c61592e04b (diff) |
[PATCH] zd1211rw: cleanups
Bit-field constants in zd_chip.h are now defined using a shift expression.
The value 0x08 is now (1 << 3). The fix is intended to improve readability.
Remove misleading comment in zd_mac.c: The function already returns -EPERM
in managed mode (IW_MODE_INFRA).
Remove unused code in zd_mac.c: The unused code intended for debugging
rx_status values is no longer useful.
Added dump_stack() to ZD_ASSERT macro: Output of the stack helps to debug
assertions. Keep in mind that the ZD_ASSERT() macro only results in code,
if DEBUG is defined.
Improved comments for filter_rx()
zd_usb.c: Added driver name to module init and exit functions
Signed-off-by: Ulrich Kunitz <kune@deine-taler.de>
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw/zd_mac.c')
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.c | 71 |
1 files changed, 6 insertions, 65 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 7845b6dac83..0bb53f0b8bd 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -295,7 +295,6 @@ static void set_channel(struct net_device *netdev, u8 channel) zd_chip_set_channel(&mac->chip, channel); } -/* TODO: Should not work in Managed mode. */ int zd_mac_request_channel(struct zd_mac *mac, u8 channel) { unsigned long lock_flags; @@ -773,9 +772,11 @@ static int is_data_packet_for_us(struct ieee80211_device *ieee, (netdev->flags & IFF_PROMISC); } -/* Filters receiving packets. If it returns 1 send it to ieee80211_rx, if 0 - * return. If an error is detected -EINVAL is returned. ieee80211_rx_mgt() is - * called here. +/* Filters received packets. The function returns 1 if the packet should be + * forwarded to ieee80211_rx(). If the packet should be ignored the function + * returns 0. If an invalid packet is found the function returns -EINVAL. + * + * The function calls ieee80211_rx_mgt() directly. * * It has been based on ieee80211_rx_any. */ @@ -801,9 +802,9 @@ static int filter_rx(struct ieee80211_device *ieee, ieee80211_rx_mgt(ieee, hdr, stats); return 0; case IEEE80211_FTYPE_CTL: - /* Ignore invalid short buffers */ return 0; case IEEE80211_FTYPE_DATA: + /* Ignore invalid short buffers */ if (length < sizeof(struct ieee80211_hdr_3addr)) return -EINVAL; return is_data_packet_for_us(ieee, hdr); @@ -1019,66 +1020,6 @@ struct iw_statistics *zd_mac_get_wireless_stats(struct net_device *ndev) return iw_stats; } -#ifdef DEBUG -static const char* decryption_types[] = { - [ZD_RX_NO_WEP] = "none", - [ZD_RX_WEP64] = "WEP64", - [ZD_RX_TKIP] = "TKIP", - [ZD_RX_AES] = "AES", - [ZD_RX_WEP128] = "WEP128", - [ZD_RX_WEP256] = "WEP256", -}; - -static const char *decryption_type_string(u8 type) -{ - const char *s; - - if (type < ARRAY_SIZE(decryption_types)) { - s = decryption_types[type]; - } else { - s = NULL; - } - return s ? s : "unknown"; -} - -static int is_ofdm(u8 frame_status) -{ - return (frame_status & ZD_RX_OFDM); -} - -void zd_dump_rx_status(const struct rx_status *status) -{ - const char* modulation; - u8 quality; - - if (is_ofdm(status->frame_status)) { - modulation = "ofdm"; - quality = status->signal_quality_ofdm; - } else { - modulation = "cck"; - quality = status->signal_quality_cck; - } - pr_debug("rx status %s strength %#04x qual %#04x decryption %s\n", - modulation, status->signal_strength, quality, - decryption_type_string(status->decryption_type)); - if (status->frame_status & ZD_RX_ERROR) { - pr_debug("rx error %s%s%s%s%s%s\n", - (status->frame_status & ZD_RX_TIMEOUT_ERROR) ? - "timeout " : "", - (status->frame_status & ZD_RX_FIFO_OVERRUN_ERROR) ? - "fifo " : "", - (status->frame_status & ZD_RX_DECRYPTION_ERROR) ? - "decryption " : "", - (status->frame_status & ZD_RX_CRC32_ERROR) ? - "crc32 " : "", - (status->frame_status & ZD_RX_NO_ADDR1_MATCH_ERROR) ? - "addr1 " : "", - (status->frame_status & ZD_RX_CRC16_ERROR) ? - "crc16" : ""); - } -} -#endif /* DEBUG */ - #define LINK_LED_WORK_DELAY HZ static void link_led_handler(void *p) |