diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-02-09 16:12:09 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 16:12:09 -0500 |
commit | a3cc2de9138f1ee1581f55927f33f7d72ed6207d (patch) | |
tree | 4f0dbdb1b18bf24987485facb5e7800e242d932f /drivers/net/wireless/zd1211rw | |
parent | e45d9ab4051d99c9f237c96e75c4dd6671661236 (diff) | |
parent | 46b8c85e1df091fe2d53ae7d02addb0dc58a9123 (diff) |
Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream
Diffstat (limited to 'drivers/net/wireless/zd1211rw')
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.c | 44 | ||||
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_usb.c | 12 |
2 files changed, 46 insertions, 10 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index a08524191b5d..4c5f78eac349 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -156,7 +156,7 @@ void zd_mac_clear(struct zd_mac *mac) | |||
156 | static int reset_mode(struct zd_mac *mac) | 156 | static int reset_mode(struct zd_mac *mac) |
157 | { | 157 | { |
158 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); | 158 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
159 | struct zd_ioreq32 ioreqs[3] = { | 159 | struct zd_ioreq32 ioreqs[] = { |
160 | { CR_RX_FILTER, STA_RX_FILTER }, | 160 | { CR_RX_FILTER, STA_RX_FILTER }, |
161 | { CR_SNIFFER_ON, 0U }, | 161 | { CR_SNIFFER_ON, 0U }, |
162 | }; | 162 | }; |
@@ -164,10 +164,9 @@ static int reset_mode(struct zd_mac *mac) | |||
164 | if (ieee->iw_mode == IW_MODE_MONITOR) { | 164 | if (ieee->iw_mode == IW_MODE_MONITOR) { |
165 | ioreqs[0].value = 0xffffffff; | 165 | ioreqs[0].value = 0xffffffff; |
166 | ioreqs[1].value = 0x1; | 166 | ioreqs[1].value = 0x1; |
167 | ioreqs[2].value = ENC_SNIFFER; | ||
168 | } | 167 | } |
169 | 168 | ||
170 | return zd_iowrite32a(&mac->chip, ioreqs, 3); | 169 | return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs)); |
171 | } | 170 | } |
172 | 171 | ||
173 | int zd_mac_open(struct net_device *netdev) | 172 | int zd_mac_open(struct net_device *netdev) |
@@ -904,16 +903,21 @@ static int fill_ctrlset(struct zd_mac *mac, | |||
904 | static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri) | 903 | static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri) |
905 | { | 904 | { |
906 | int i, r; | 905 | int i, r; |
906 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); | ||
907 | 907 | ||
908 | for (i = 0; i < txb->nr_frags; i++) { | 908 | for (i = 0; i < txb->nr_frags; i++) { |
909 | struct sk_buff *skb = txb->fragments[i]; | 909 | struct sk_buff *skb = txb->fragments[i]; |
910 | 910 | ||
911 | r = fill_ctrlset(mac, txb, i); | 911 | r = fill_ctrlset(mac, txb, i); |
912 | if (r) | 912 | if (r) { |
913 | ieee->stats.tx_dropped++; | ||
913 | return r; | 914 | return r; |
915 | } | ||
914 | r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); | 916 | r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); |
915 | if (r) | 917 | if (r) { |
918 | ieee->stats.tx_dropped++; | ||
916 | return r; | 919 | return r; |
920 | } | ||
917 | } | 921 | } |
918 | 922 | ||
919 | /* FIXME: shouldn't this be handled by the upper layers? */ | 923 | /* FIXME: shouldn't this be handled by the upper layers? */ |
@@ -1063,9 +1067,23 @@ static int fill_rx_stats(struct ieee80211_rx_stats *stats, | |||
1063 | 1067 | ||
1064 | *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status)); | 1068 | *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status)); |
1065 | if (status->frame_status & ZD_RX_ERROR) { | 1069 | if (status->frame_status & ZD_RX_ERROR) { |
1066 | /* FIXME: update? */ | 1070 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
1071 | ieee->stats.rx_errors++; | ||
1072 | if (status->frame_status & ZD_RX_TIMEOUT_ERROR) | ||
1073 | ieee->stats.rx_missed_errors++; | ||
1074 | else if (status->frame_status & ZD_RX_FIFO_OVERRUN_ERROR) | ||
1075 | ieee->stats.rx_fifo_errors++; | ||
1076 | else if (status->frame_status & ZD_RX_DECRYPTION_ERROR) | ||
1077 | ieee->ieee_stats.rx_discards_undecryptable++; | ||
1078 | else if (status->frame_status & ZD_RX_CRC32_ERROR) { | ||
1079 | ieee->stats.rx_crc_errors++; | ||
1080 | ieee->ieee_stats.rx_fcs_errors++; | ||
1081 | } | ||
1082 | else if (status->frame_status & ZD_RX_CRC16_ERROR) | ||
1083 | ieee->stats.rx_crc_errors++; | ||
1067 | return -EINVAL; | 1084 | return -EINVAL; |
1068 | } | 1085 | } |
1086 | |||
1069 | memset(stats, 0, sizeof(struct ieee80211_rx_stats)); | 1087 | memset(stats, 0, sizeof(struct ieee80211_rx_stats)); |
1070 | stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN + | 1088 | stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN + |
1071 | + sizeof(struct rx_status)); | 1089 | + sizeof(struct rx_status)); |
@@ -1094,14 +1112,16 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb) | |||
1094 | if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN + | 1112 | if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN + |
1095 | IEEE80211_FCS_LEN + sizeof(struct rx_status)) | 1113 | IEEE80211_FCS_LEN + sizeof(struct rx_status)) |
1096 | { | 1114 | { |
1097 | dev_dbg_f(zd_mac_dev(mac), "Packet with length %u to small.\n", | 1115 | ieee->stats.rx_errors++; |
1098 | skb->len); | 1116 | ieee->stats.rx_length_errors++; |
1099 | goto free_skb; | 1117 | goto free_skb; |
1100 | } | 1118 | } |
1101 | 1119 | ||
1102 | r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len); | 1120 | r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len); |
1103 | if (r) { | 1121 | if (r) { |
1104 | /* Only packets with rx errors are included here. */ | 1122 | /* Only packets with rx errors are included here. |
1123 | * The error stats have already been set in fill_rx_stats. | ||
1124 | */ | ||
1105 | goto free_skb; | 1125 | goto free_skb; |
1106 | } | 1126 | } |
1107 | 1127 | ||
@@ -1114,8 +1134,10 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb) | |||
1114 | 1134 | ||
1115 | r = filter_rx(ieee, skb->data, skb->len, &stats); | 1135 | r = filter_rx(ieee, skb->data, skb->len, &stats); |
1116 | if (r <= 0) { | 1136 | if (r <= 0) { |
1117 | if (r < 0) | 1137 | if (r < 0) { |
1138 | ieee->stats.rx_errors++; | ||
1118 | dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n"); | 1139 | dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n"); |
1140 | } | ||
1119 | goto free_skb; | 1141 | goto free_skb; |
1120 | } | 1142 | } |
1121 | 1143 | ||
@@ -1146,7 +1168,9 @@ int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length) | |||
1146 | 1168 | ||
1147 | skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); | 1169 | skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); |
1148 | if (!skb) { | 1170 | if (!skb) { |
1171 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); | ||
1149 | dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); | 1172 | dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); |
1173 | ieee->stats.rx_dropped++; | ||
1150 | return -ENOMEM; | 1174 | return -ENOMEM; |
1151 | } | 1175 | } |
1152 | skb_reserve(skb, sizeof(struct zd_rt_hdr)); | 1176 | skb_reserve(skb, sizeof(struct zd_rt_hdr)); |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 75ef55624d7f..aac8a1c5ba08 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -313,6 +313,12 @@ out: | |||
313 | 313 | ||
314 | static inline void handle_retry_failed_int(struct urb *urb) | 314 | static inline void handle_retry_failed_int(struct urb *urb) |
315 | { | 315 | { |
316 | struct zd_usb *usb = urb->context; | ||
317 | struct zd_mac *mac = zd_usb_to_mac(usb); | ||
318 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); | ||
319 | |||
320 | ieee->stats.tx_errors++; | ||
321 | ieee->ieee_stats.tx_retry_limit_exceeded++; | ||
316 | dev_dbg_f(urb_dev(urb), "retry failed interrupt\n"); | 322 | dev_dbg_f(urb_dev(urb), "retry failed interrupt\n"); |
317 | } | 323 | } |
318 | 324 | ||
@@ -487,6 +493,9 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer, | |||
487 | 493 | ||
488 | if (length < sizeof(struct rx_length_info)) { | 494 | if (length < sizeof(struct rx_length_info)) { |
489 | /* It's not a complete packet anyhow. */ | 495 | /* It's not a complete packet anyhow. */ |
496 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); | ||
497 | ieee->stats.rx_errors++; | ||
498 | ieee->stats.rx_length_errors++; | ||
490 | return; | 499 | return; |
491 | } | 500 | } |
492 | length_info = (struct rx_length_info *) | 501 | length_info = (struct rx_length_info *) |
@@ -923,6 +932,8 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
923 | goto error; | 932 | goto error; |
924 | } | 933 | } |
925 | 934 | ||
935 | usb_reset_device(interface_to_usbdev(intf)); | ||
936 | |||
926 | netdev = zd_netdev_alloc(intf); | 937 | netdev = zd_netdev_alloc(intf); |
927 | if (netdev == NULL) { | 938 | if (netdev == NULL) { |
928 | r = -ENOMEM; | 939 | r = -ENOMEM; |
@@ -1024,6 +1035,7 @@ static int __init usb_init(void) | |||
1024 | 1035 | ||
1025 | r = usb_register(&driver); | 1036 | r = usb_register(&driver); |
1026 | if (r) { | 1037 | if (r) { |
1038 | destroy_workqueue(zd_workqueue); | ||
1027 | printk(KERN_ERR "%s usb_register() failed. Error number %d\n", | 1039 | printk(KERN_ERR "%s usb_register() failed. Error number %d\n", |
1028 | driver.name, r); | 1040 | driver.name, r); |
1029 | return r; | 1041 | return r; |