aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/zd1211rw/zd_mac.c
diff options
context:
space:
mode:
authorUlrich Kunitz <kune@deine-taler.de>2006-11-21 19:05:53 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-02 00:12:05 -0500
commit741fec53f268b691b869ffc70023319406e0cc97 (patch)
tree47ea2334fd44daaaa19b9a3d22d34466d0250069 /drivers/net/wireless/zd1211rw/zd_mac.c
parent84bc715c465f76584fc5127955fca0c61592e04b (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.c71
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 7845b6dac832..0bb53f0b8bdd 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)
295 zd_chip_set_channel(&mac->chip, channel); 295 zd_chip_set_channel(&mac->chip, channel);
296} 296}
297 297
298/* TODO: Should not work in Managed mode. */
299int zd_mac_request_channel(struct zd_mac *mac, u8 channel) 298int zd_mac_request_channel(struct zd_mac *mac, u8 channel)
300{ 299{
301 unsigned long lock_flags; 300 unsigned long lock_flags;
@@ -773,9 +772,11 @@ static int is_data_packet_for_us(struct ieee80211_device *ieee,
773 (netdev->flags & IFF_PROMISC); 772 (netdev->flags & IFF_PROMISC);
774} 773}
775 774
776/* Filters receiving packets. If it returns 1 send it to ieee80211_rx, if 0 775/* Filters received packets. The function returns 1 if the packet should be
777 * return. If an error is detected -EINVAL is returned. ieee80211_rx_mgt() is 776 * forwarded to ieee80211_rx(). If the packet should be ignored the function
778 * called here. 777 * returns 0. If an invalid packet is found the function returns -EINVAL.
778 *
779 * The function calls ieee80211_rx_mgt() directly.
779 * 780 *
780 * It has been based on ieee80211_rx_any. 781 * It has been based on ieee80211_rx_any.
781 */ 782 */
@@ -801,9 +802,9 @@ static int filter_rx(struct ieee80211_device *ieee,
801 ieee80211_rx_mgt(ieee, hdr, stats); 802 ieee80211_rx_mgt(ieee, hdr, stats);
802 return 0; 803 return 0;
803 case IEEE80211_FTYPE_CTL: 804 case IEEE80211_FTYPE_CTL:
804 /* Ignore invalid short buffers */
805 return 0; 805 return 0;
806 case IEEE80211_FTYPE_DATA: 806 case IEEE80211_FTYPE_DATA:
807 /* Ignore invalid short buffers */
807 if (length < sizeof(struct ieee80211_hdr_3addr)) 808 if (length < sizeof(struct ieee80211_hdr_3addr))
808 return -EINVAL; 809 return -EINVAL;
809 return is_data_packet_for_us(ieee, hdr); 810 return is_data_packet_for_us(ieee, hdr);
@@ -1019,66 +1020,6 @@ struct iw_statistics *zd_mac_get_wireless_stats(struct net_device *ndev)
1019 return iw_stats; 1020 return iw_stats;
1020} 1021}
1021 1022
1022#ifdef DEBUG
1023static const char* decryption_types[] = {
1024 [ZD_RX_NO_WEP] = "none",
1025 [ZD_RX_WEP64] = "WEP64",
1026 [ZD_RX_TKIP] = "TKIP",
1027 [ZD_RX_AES] = "AES",
1028 [ZD_RX_WEP128] = "WEP128",
1029 [ZD_RX_WEP256] = "WEP256",
1030};
1031
1032static const char *decryption_type_string(u8 type)
1033{
1034 const char *s;
1035
1036 if (type < ARRAY_SIZE(decryption_types)) {
1037 s = decryption_types[type];
1038 } else {
1039 s = NULL;
1040 }
1041 return s ? s : "unknown";
1042}
1043
1044static int is_ofdm(u8 frame_status)
1045{
1046 return (frame_status & ZD_RX_OFDM);
1047}
1048
1049void zd_dump_rx_status(const struct rx_status *status)
1050{
1051 const char* modulation;
1052 u8 quality;
1053
1054 if (is_ofdm(status->frame_status)) {
1055 modulation = "ofdm";
1056 quality = status->signal_quality_ofdm;
1057 } else {
1058 modulation = "cck";
1059 quality = status->signal_quality_cck;
1060 }
1061 pr_debug("rx status %s strength %#04x qual %#04x decryption %s\n",
1062 modulation, status->signal_strength, quality,
1063 decryption_type_string(status->decryption_type));
1064 if (status->frame_status & ZD_RX_ERROR) {
1065 pr_debug("rx error %s%s%s%s%s%s\n",
1066 (status->frame_status & ZD_RX_TIMEOUT_ERROR) ?
1067 "timeout " : "",
1068 (status->frame_status & ZD_RX_FIFO_OVERRUN_ERROR) ?
1069 "fifo " : "",
1070 (status->frame_status & ZD_RX_DECRYPTION_ERROR) ?
1071 "decryption " : "",
1072 (status->frame_status & ZD_RX_CRC32_ERROR) ?
1073 "crc32 " : "",
1074 (status->frame_status & ZD_RX_NO_ADDR1_MATCH_ERROR) ?
1075 "addr1 " : "",
1076 (status->frame_status & ZD_RX_CRC16_ERROR) ?
1077 "crc16" : "");
1078 }
1079}
1080#endif /* DEBUG */
1081
1082#define LINK_LED_WORK_DELAY HZ 1023#define LINK_LED_WORK_DELAY HZ
1083 1024
1084static void link_led_handler(void *p) 1025static void link_led_handler(void *p)