diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-05-05 16:14:16 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-05 16:14:16 -0400 |
commit | 83163244f845c296a118ce85c653872dbff6abfe (patch) | |
tree | ce2eac695a1c198f23d537e20ed86c16ece21f7e /drivers/net/wireless/libertas_tf | |
parent | 0a12761bcd5646691c5d16dd93df84d1b8849285 (diff) | |
parent | adfba3c7c026a6a5560d2a43fefc9b198cb74462 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
drivers/net/wireless/libertas_tf/cmd.c
drivers/net/wireless/libertas_tf/main.c
Diffstat (limited to 'drivers/net/wireless/libertas_tf')
-rw-r--r-- | drivers/net/wireless/libertas_tf/cmd.c | 203 | ||||
-rw-r--r-- | drivers/net/wireless/libertas_tf/deb_defs.h | 104 | ||||
-rw-r--r-- | drivers/net/wireless/libertas_tf/if_usb.c | 251 | ||||
-rw-r--r-- | drivers/net/wireless/libertas_tf/libertas_tf.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas_tf/main.c | 91 |
5 files changed, 570 insertions, 81 deletions
diff --git a/drivers/net/wireless/libertas_tf/cmd.c b/drivers/net/wireless/libertas_tf/cmd.c index b620daf59ef7..8945afd6ce3e 100644 --- a/drivers/net/wireless/libertas_tf/cmd.c +++ b/drivers/net/wireless/libertas_tf/cmd.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * the Free Software Foundation; either version 2 of the License, or (at | 7 | * the Free Software Foundation; either version 2 of the License, or (at |
8 | * your option) any later version. | 8 | * your option) any later version. |
9 | */ | 9 | */ |
10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | |||
10 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
11 | 13 | ||
12 | #include "libertas_tf.h" | 14 | #include "libertas_tf.h" |
@@ -82,6 +84,8 @@ int lbtf_update_hw_spec(struct lbtf_private *priv) | |||
82 | int ret = -1; | 84 | int ret = -1; |
83 | u32 i; | 85 | u32 i; |
84 | 86 | ||
87 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
88 | |||
85 | memset(&cmd, 0, sizeof(cmd)); | 89 | memset(&cmd, 0, sizeof(cmd)); |
86 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 90 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
87 | memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); | 91 | memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); |
@@ -104,6 +108,8 @@ int lbtf_update_hw_spec(struct lbtf_private *priv) | |||
104 | priv->fwrelease >> 8 & 0xff, | 108 | priv->fwrelease >> 8 & 0xff, |
105 | priv->fwrelease & 0xff, | 109 | priv->fwrelease & 0xff, |
106 | priv->fwcapinfo); | 110 | priv->fwcapinfo); |
111 | lbtf_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", | ||
112 | cmd.hwifversion, cmd.version); | ||
107 | 113 | ||
108 | /* Clamp region code to 8-bit since FW spec indicates that it should | 114 | /* Clamp region code to 8-bit since FW spec indicates that it should |
109 | * only ever be 8-bit, even though the field size is 16-bit. Some | 115 | * only ever be 8-bit, even though the field size is 16-bit. Some |
@@ -118,8 +124,10 @@ int lbtf_update_hw_spec(struct lbtf_private *priv) | |||
118 | } | 124 | } |
119 | 125 | ||
120 | /* if it's unidentified region code, use the default (USA) */ | 126 | /* if it's unidentified region code, use the default (USA) */ |
121 | if (i >= MRVDRV_MAX_REGION_CODE) | 127 | if (i >= MRVDRV_MAX_REGION_CODE) { |
122 | priv->regioncode = 0x10; | 128 | priv->regioncode = 0x10; |
129 | pr_info("unidentified region code; using the default (USA)\n"); | ||
130 | } | ||
123 | 131 | ||
124 | if (priv->current_addr[0] == 0xff) | 132 | if (priv->current_addr[0] == 0xff) |
125 | memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); | 133 | memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); |
@@ -128,6 +136,7 @@ int lbtf_update_hw_spec(struct lbtf_private *priv) | |||
128 | 136 | ||
129 | lbtf_geo_init(priv); | 137 | lbtf_geo_init(priv); |
130 | out: | 138 | out: |
139 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
131 | return ret; | 140 | return ret; |
132 | } | 141 | } |
133 | 142 | ||
@@ -141,13 +150,18 @@ out: | |||
141 | */ | 150 | */ |
142 | int lbtf_set_channel(struct lbtf_private *priv, u8 channel) | 151 | int lbtf_set_channel(struct lbtf_private *priv, u8 channel) |
143 | { | 152 | { |
153 | int ret = 0; | ||
144 | struct cmd_ds_802_11_rf_channel cmd; | 154 | struct cmd_ds_802_11_rf_channel cmd; |
145 | 155 | ||
156 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
157 | |||
146 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 158 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
147 | cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); | 159 | cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); |
148 | cmd.channel = cpu_to_le16(channel); | 160 | cmd.channel = cpu_to_le16(channel); |
149 | 161 | ||
150 | return lbtf_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); | 162 | ret = lbtf_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); |
163 | lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", ret); | ||
164 | return ret; | ||
151 | } | 165 | } |
152 | 166 | ||
153 | int lbtf_beacon_set(struct lbtf_private *priv, struct sk_buff *beacon) | 167 | int lbtf_beacon_set(struct lbtf_private *priv, struct sk_buff *beacon) |
@@ -155,20 +169,28 @@ int lbtf_beacon_set(struct lbtf_private *priv, struct sk_buff *beacon) | |||
155 | struct cmd_ds_802_11_beacon_set cmd; | 169 | struct cmd_ds_802_11_beacon_set cmd; |
156 | int size; | 170 | int size; |
157 | 171 | ||
158 | if (beacon->len > MRVL_MAX_BCN_SIZE) | 172 | lbtf_deb_enter(LBTF_DEB_CMD); |
173 | |||
174 | if (beacon->len > MRVL_MAX_BCN_SIZE) { | ||
175 | lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", -1); | ||
159 | return -1; | 176 | return -1; |
177 | } | ||
160 | size = sizeof(cmd) - sizeof(cmd.beacon) + beacon->len; | 178 | size = sizeof(cmd) - sizeof(cmd.beacon) + beacon->len; |
161 | cmd.hdr.size = cpu_to_le16(size); | 179 | cmd.hdr.size = cpu_to_le16(size); |
162 | cmd.len = cpu_to_le16(beacon->len); | 180 | cmd.len = cpu_to_le16(beacon->len); |
163 | memcpy(cmd.beacon, (u8 *) beacon->data, beacon->len); | 181 | memcpy(cmd.beacon, (u8 *) beacon->data, beacon->len); |
164 | 182 | ||
165 | lbtf_cmd_async(priv, CMD_802_11_BEACON_SET, &cmd.hdr, size); | 183 | lbtf_cmd_async(priv, CMD_802_11_BEACON_SET, &cmd.hdr, size); |
184 | |||
185 | lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", 0); | ||
166 | return 0; | 186 | return 0; |
167 | } | 187 | } |
168 | 188 | ||
169 | int lbtf_beacon_ctrl(struct lbtf_private *priv, bool beacon_enable, | 189 | int lbtf_beacon_ctrl(struct lbtf_private *priv, bool beacon_enable, |
170 | int beacon_int) { | 190 | int beacon_int) |
191 | { | ||
171 | struct cmd_ds_802_11_beacon_control cmd; | 192 | struct cmd_ds_802_11_beacon_control cmd; |
193 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
172 | 194 | ||
173 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 195 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
174 | cmd.action = cpu_to_le16(CMD_ACT_SET); | 196 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
@@ -176,6 +198,8 @@ int lbtf_beacon_ctrl(struct lbtf_private *priv, bool beacon_enable, | |||
176 | cmd.beacon_period = cpu_to_le16(beacon_int); | 198 | cmd.beacon_period = cpu_to_le16(beacon_int); |
177 | 199 | ||
178 | lbtf_cmd_async(priv, CMD_802_11_BEACON_CTRL, &cmd.hdr, sizeof(cmd)); | 200 | lbtf_cmd_async(priv, CMD_802_11_BEACON_CTRL, &cmd.hdr, sizeof(cmd)); |
201 | |||
202 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
179 | return 0; | 203 | return 0; |
180 | } | 204 | } |
181 | 205 | ||
@@ -183,17 +207,28 @@ static void lbtf_queue_cmd(struct lbtf_private *priv, | |||
183 | struct cmd_ctrl_node *cmdnode) | 207 | struct cmd_ctrl_node *cmdnode) |
184 | { | 208 | { |
185 | unsigned long flags; | 209 | unsigned long flags; |
210 | lbtf_deb_enter(LBTF_DEB_HOST); | ||
186 | 211 | ||
187 | if (!cmdnode) | 212 | if (!cmdnode) { |
188 | return; | 213 | lbtf_deb_host("QUEUE_CMD: cmdnode is NULL\n"); |
214 | goto qcmd_done; | ||
215 | } | ||
189 | 216 | ||
190 | if (!cmdnode->cmdbuf->size) | 217 | if (!cmdnode->cmdbuf->size) { |
191 | return; | 218 | lbtf_deb_host("DNLD_CMD: cmd size is zero\n"); |
219 | goto qcmd_done; | ||
220 | } | ||
192 | 221 | ||
193 | cmdnode->result = 0; | 222 | cmdnode->result = 0; |
194 | spin_lock_irqsave(&priv->driver_lock, flags); | 223 | spin_lock_irqsave(&priv->driver_lock, flags); |
195 | list_add_tail(&cmdnode->list, &priv->cmdpendingq); | 224 | list_add_tail(&cmdnode->list, &priv->cmdpendingq); |
196 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 225 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
226 | |||
227 | lbtf_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n", | ||
228 | le16_to_cpu(cmdnode->cmdbuf->command)); | ||
229 | |||
230 | qcmd_done: | ||
231 | lbtf_deb_leave(LBTF_DEB_HOST); | ||
197 | } | 232 | } |
198 | 233 | ||
199 | static void lbtf_submit_command(struct lbtf_private *priv, | 234 | static void lbtf_submit_command(struct lbtf_private *priv, |
@@ -206,22 +241,33 @@ static void lbtf_submit_command(struct lbtf_private *priv, | |||
206 | int timeo = 5 * HZ; | 241 | int timeo = 5 * HZ; |
207 | int ret; | 242 | int ret; |
208 | 243 | ||
244 | lbtf_deb_enter(LBTF_DEB_HOST); | ||
245 | |||
209 | cmd = cmdnode->cmdbuf; | 246 | cmd = cmdnode->cmdbuf; |
210 | 247 | ||
211 | spin_lock_irqsave(&priv->driver_lock, flags); | 248 | spin_lock_irqsave(&priv->driver_lock, flags); |
212 | priv->cur_cmd = cmdnode; | 249 | priv->cur_cmd = cmdnode; |
213 | cmdsize = le16_to_cpu(cmd->size); | 250 | cmdsize = le16_to_cpu(cmd->size); |
214 | command = le16_to_cpu(cmd->command); | 251 | command = le16_to_cpu(cmd->command); |
252 | |||
253 | lbtf_deb_cmd("DNLD_CMD: command 0x%04x, seq %d, size %d\n", | ||
254 | command, le16_to_cpu(cmd->seqnum), cmdsize); | ||
255 | lbtf_deb_hex(LBTF_DEB_CMD, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); | ||
256 | |||
215 | ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); | 257 | ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); |
216 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 258 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
217 | 259 | ||
218 | if (ret) | 260 | if (ret) { |
261 | pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); | ||
219 | /* Let the timer kick in and retry, and potentially reset | 262 | /* Let the timer kick in and retry, and potentially reset |
220 | the whole thing if the condition persists */ | 263 | the whole thing if the condition persists */ |
221 | timeo = HZ; | 264 | timeo = HZ; |
265 | } | ||
222 | 266 | ||
223 | /* Setup the timer after transmit command */ | 267 | /* Setup the timer after transmit command */ |
224 | mod_timer(&priv->command_timer, jiffies + timeo); | 268 | mod_timer(&priv->command_timer, jiffies + timeo); |
269 | |||
270 | lbtf_deb_leave(LBTF_DEB_HOST); | ||
225 | } | 271 | } |
226 | 272 | ||
227 | /** | 273 | /** |
@@ -231,8 +277,10 @@ static void lbtf_submit_command(struct lbtf_private *priv, | |||
231 | static void __lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, | 277 | static void __lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, |
232 | struct cmd_ctrl_node *cmdnode) | 278 | struct cmd_ctrl_node *cmdnode) |
233 | { | 279 | { |
280 | lbtf_deb_enter(LBTF_DEB_HOST); | ||
281 | |||
234 | if (!cmdnode) | 282 | if (!cmdnode) |
235 | return; | 283 | goto cl_ins_out; |
236 | 284 | ||
237 | cmdnode->callback = NULL; | 285 | cmdnode->callback = NULL; |
238 | cmdnode->callback_arg = 0; | 286 | cmdnode->callback_arg = 0; |
@@ -240,6 +288,9 @@ static void __lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, | |||
240 | memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); | 288 | memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); |
241 | 289 | ||
242 | list_add_tail(&cmdnode->list, &priv->cmdfreeq); | 290 | list_add_tail(&cmdnode->list, &priv->cmdfreeq); |
291 | |||
292 | cl_ins_out: | ||
293 | lbtf_deb_leave(LBTF_DEB_HOST); | ||
243 | } | 294 | } |
244 | 295 | ||
245 | static void lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, | 296 | static void lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, |
@@ -268,29 +319,41 @@ int lbtf_cmd_set_mac_multicast_addr(struct lbtf_private *priv) | |||
268 | { | 319 | { |
269 | struct cmd_ds_mac_multicast_addr cmd; | 320 | struct cmd_ds_mac_multicast_addr cmd; |
270 | 321 | ||
322 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
323 | |||
271 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 324 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
272 | cmd.action = cpu_to_le16(CMD_ACT_SET); | 325 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
273 | 326 | ||
274 | cmd.nr_of_adrs = cpu_to_le16((u16) priv->nr_of_multicastmacaddr); | 327 | cmd.nr_of_adrs = cpu_to_le16((u16) priv->nr_of_multicastmacaddr); |
328 | |||
329 | lbtf_deb_cmd("MULTICAST_ADR: setting %d addresses\n", cmd.nr_of_adrs); | ||
330 | |||
275 | memcpy(cmd.maclist, priv->multicastlist, | 331 | memcpy(cmd.maclist, priv->multicastlist, |
276 | priv->nr_of_multicastmacaddr * ETH_ALEN); | 332 | priv->nr_of_multicastmacaddr * ETH_ALEN); |
277 | 333 | ||
278 | lbtf_cmd_async(priv, CMD_MAC_MULTICAST_ADR, &cmd.hdr, sizeof(cmd)); | 334 | lbtf_cmd_async(priv, CMD_MAC_MULTICAST_ADR, &cmd.hdr, sizeof(cmd)); |
335 | |||
336 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
279 | return 0; | 337 | return 0; |
280 | } | 338 | } |
281 | 339 | ||
282 | void lbtf_set_mode(struct lbtf_private *priv, enum lbtf_mode mode) | 340 | void lbtf_set_mode(struct lbtf_private *priv, enum lbtf_mode mode) |
283 | { | 341 | { |
284 | struct cmd_ds_set_mode cmd; | 342 | struct cmd_ds_set_mode cmd; |
343 | lbtf_deb_enter(LBTF_DEB_WEXT); | ||
285 | 344 | ||
286 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 345 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
287 | cmd.mode = cpu_to_le16(mode); | 346 | cmd.mode = cpu_to_le16(mode); |
347 | lbtf_deb_wext("Switching to mode: 0x%x\n", mode); | ||
288 | lbtf_cmd_async(priv, CMD_802_11_SET_MODE, &cmd.hdr, sizeof(cmd)); | 348 | lbtf_cmd_async(priv, CMD_802_11_SET_MODE, &cmd.hdr, sizeof(cmd)); |
349 | |||
350 | lbtf_deb_leave(LBTF_DEB_WEXT); | ||
289 | } | 351 | } |
290 | 352 | ||
291 | void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid) | 353 | void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid) |
292 | { | 354 | { |
293 | struct cmd_ds_set_bssid cmd; | 355 | struct cmd_ds_set_bssid cmd; |
356 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
294 | 357 | ||
295 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 358 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
296 | cmd.activate = activate ? 1 : 0; | 359 | cmd.activate = activate ? 1 : 0; |
@@ -298,11 +361,13 @@ void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid) | |||
298 | memcpy(cmd.bssid, bssid, ETH_ALEN); | 361 | memcpy(cmd.bssid, bssid, ETH_ALEN); |
299 | 362 | ||
300 | lbtf_cmd_async(priv, CMD_802_11_SET_BSSID, &cmd.hdr, sizeof(cmd)); | 363 | lbtf_cmd_async(priv, CMD_802_11_SET_BSSID, &cmd.hdr, sizeof(cmd)); |
364 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
301 | } | 365 | } |
302 | 366 | ||
303 | int lbtf_set_mac_address(struct lbtf_private *priv, uint8_t *mac_addr) | 367 | int lbtf_set_mac_address(struct lbtf_private *priv, uint8_t *mac_addr) |
304 | { | 368 | { |
305 | struct cmd_ds_802_11_mac_address cmd; | 369 | struct cmd_ds_802_11_mac_address cmd; |
370 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
306 | 371 | ||
307 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 372 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
308 | cmd.action = cpu_to_le16(CMD_ACT_SET); | 373 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
@@ -310,6 +375,7 @@ int lbtf_set_mac_address(struct lbtf_private *priv, uint8_t *mac_addr) | |||
310 | memcpy(cmd.macadd, mac_addr, ETH_ALEN); | 375 | memcpy(cmd.macadd, mac_addr, ETH_ALEN); |
311 | 376 | ||
312 | lbtf_cmd_async(priv, CMD_802_11_MAC_ADDRESS, &cmd.hdr, sizeof(cmd)); | 377 | lbtf_cmd_async(priv, CMD_802_11_MAC_ADDRESS, &cmd.hdr, sizeof(cmd)); |
378 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
313 | return 0; | 379 | return 0; |
314 | } | 380 | } |
315 | 381 | ||
@@ -318,6 +384,8 @@ int lbtf_set_radio_control(struct lbtf_private *priv) | |||
318 | int ret = 0; | 384 | int ret = 0; |
319 | struct cmd_ds_802_11_radio_control cmd; | 385 | struct cmd_ds_802_11_radio_control cmd; |
320 | 386 | ||
387 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
388 | |||
321 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 389 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
322 | cmd.action = cpu_to_le16(CMD_ACT_SET); | 390 | cmd.action = cpu_to_le16(CMD_ACT_SET); |
323 | 391 | ||
@@ -341,19 +409,28 @@ int lbtf_set_radio_control(struct lbtf_private *priv) | |||
341 | else | 409 | else |
342 | cmd.control &= cpu_to_le16(~TURN_ON_RF); | 410 | cmd.control &= cpu_to_le16(~TURN_ON_RF); |
343 | 411 | ||
412 | lbtf_deb_cmd("RADIO_SET: radio %d, preamble %d\n", priv->radioon, | ||
413 | priv->preamble); | ||
414 | |||
344 | ret = lbtf_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); | 415 | ret = lbtf_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); |
416 | |||
417 | lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", ret); | ||
345 | return ret; | 418 | return ret; |
346 | } | 419 | } |
347 | 420 | ||
348 | void lbtf_set_mac_control(struct lbtf_private *priv) | 421 | void lbtf_set_mac_control(struct lbtf_private *priv) |
349 | { | 422 | { |
350 | struct cmd_ds_mac_control cmd; | 423 | struct cmd_ds_mac_control cmd; |
424 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
425 | |||
351 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | 426 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
352 | cmd.action = cpu_to_le16(priv->mac_control); | 427 | cmd.action = cpu_to_le16(priv->mac_control); |
353 | cmd.reserved = 0; | 428 | cmd.reserved = 0; |
354 | 429 | ||
355 | lbtf_cmd_async(priv, CMD_MAC_CONTROL, | 430 | lbtf_cmd_async(priv, CMD_MAC_CONTROL, |
356 | &cmd.hdr, sizeof(cmd)); | 431 | &cmd.hdr, sizeof(cmd)); |
432 | |||
433 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
357 | } | 434 | } |
358 | 435 | ||
359 | /** | 436 | /** |
@@ -365,29 +442,43 @@ void lbtf_set_mac_control(struct lbtf_private *priv) | |||
365 | */ | 442 | */ |
366 | int lbtf_allocate_cmd_buffer(struct lbtf_private *priv) | 443 | int lbtf_allocate_cmd_buffer(struct lbtf_private *priv) |
367 | { | 444 | { |
445 | int ret = 0; | ||
368 | u32 bufsize; | 446 | u32 bufsize; |
369 | u32 i; | 447 | u32 i; |
370 | struct cmd_ctrl_node *cmdarray; | 448 | struct cmd_ctrl_node *cmdarray; |
371 | 449 | ||
450 | lbtf_deb_enter(LBTF_DEB_HOST); | ||
451 | |||
372 | /* Allocate and initialize the command array */ | 452 | /* Allocate and initialize the command array */ |
373 | bufsize = sizeof(struct cmd_ctrl_node) * LBS_NUM_CMD_BUFFERS; | 453 | bufsize = sizeof(struct cmd_ctrl_node) * LBS_NUM_CMD_BUFFERS; |
374 | cmdarray = kzalloc(bufsize, GFP_KERNEL); | 454 | cmdarray = kzalloc(bufsize, GFP_KERNEL); |
375 | if (!cmdarray) | 455 | if (!cmdarray) { |
376 | return -1; | 456 | lbtf_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n"); |
457 | ret = -1; | ||
458 | goto done; | ||
459 | } | ||
377 | priv->cmd_array = cmdarray; | 460 | priv->cmd_array = cmdarray; |
378 | 461 | ||
379 | /* Allocate and initialize each command buffer in the command array */ | 462 | /* Allocate and initialize each command buffer in the command array */ |
380 | for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { | 463 | for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { |
381 | cmdarray[i].cmdbuf = kzalloc(LBS_CMD_BUFFER_SIZE, GFP_KERNEL); | 464 | cmdarray[i].cmdbuf = kzalloc(LBS_CMD_BUFFER_SIZE, GFP_KERNEL); |
382 | if (!cmdarray[i].cmdbuf) | 465 | if (!cmdarray[i].cmdbuf) { |
383 | return -1; | 466 | lbtf_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n"); |
467 | ret = -1; | ||
468 | goto done; | ||
469 | } | ||
384 | } | 470 | } |
385 | 471 | ||
386 | for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { | 472 | for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { |
387 | init_waitqueue_head(&cmdarray[i].cmdwait_q); | 473 | init_waitqueue_head(&cmdarray[i].cmdwait_q); |
388 | lbtf_cleanup_and_insert_cmd(priv, &cmdarray[i]); | 474 | lbtf_cleanup_and_insert_cmd(priv, &cmdarray[i]); |
389 | } | 475 | } |
390 | return 0; | 476 | |
477 | ret = 0; | ||
478 | |||
479 | done: | ||
480 | lbtf_deb_leave_args(LBTF_DEB_HOST, "ret %d", ret); | ||
481 | return ret; | ||
391 | } | 482 | } |
392 | 483 | ||
393 | /** | 484 | /** |
@@ -402,9 +493,13 @@ int lbtf_free_cmd_buffer(struct lbtf_private *priv) | |||
402 | struct cmd_ctrl_node *cmdarray; | 493 | struct cmd_ctrl_node *cmdarray; |
403 | unsigned int i; | 494 | unsigned int i; |
404 | 495 | ||
496 | lbtf_deb_enter(LBTF_DEB_HOST); | ||
497 | |||
405 | /* need to check if cmd array is allocated or not */ | 498 | /* need to check if cmd array is allocated or not */ |
406 | if (priv->cmd_array == NULL) | 499 | if (priv->cmd_array == NULL) { |
407 | return 0; | 500 | lbtf_deb_host("FREE_CMD_BUF: cmd_array is NULL\n"); |
501 | goto done; | ||
502 | } | ||
408 | 503 | ||
409 | cmdarray = priv->cmd_array; | 504 | cmdarray = priv->cmd_array; |
410 | 505 | ||
@@ -418,6 +513,8 @@ int lbtf_free_cmd_buffer(struct lbtf_private *priv) | |||
418 | kfree(priv->cmd_array); | 513 | kfree(priv->cmd_array); |
419 | priv->cmd_array = NULL; | 514 | priv->cmd_array = NULL; |
420 | 515 | ||
516 | done: | ||
517 | lbtf_deb_leave(LBTF_DEB_HOST); | ||
421 | return 0; | 518 | return 0; |
422 | } | 519 | } |
423 | 520 | ||
@@ -433,6 +530,8 @@ static struct cmd_ctrl_node *lbtf_get_cmd_ctrl_node(struct lbtf_private *priv) | |||
433 | struct cmd_ctrl_node *tempnode; | 530 | struct cmd_ctrl_node *tempnode; |
434 | unsigned long flags; | 531 | unsigned long flags; |
435 | 532 | ||
533 | lbtf_deb_enter(LBTF_DEB_HOST); | ||
534 | |||
436 | if (!priv) | 535 | if (!priv) |
437 | return NULL; | 536 | return NULL; |
438 | 537 | ||
@@ -442,11 +541,14 @@ static struct cmd_ctrl_node *lbtf_get_cmd_ctrl_node(struct lbtf_private *priv) | |||
442 | tempnode = list_first_entry(&priv->cmdfreeq, | 541 | tempnode = list_first_entry(&priv->cmdfreeq, |
443 | struct cmd_ctrl_node, list); | 542 | struct cmd_ctrl_node, list); |
444 | list_del(&tempnode->list); | 543 | list_del(&tempnode->list); |
445 | } else | 544 | } else { |
545 | lbtf_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); | ||
446 | tempnode = NULL; | 546 | tempnode = NULL; |
547 | } | ||
447 | 548 | ||
448 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 549 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
449 | 550 | ||
551 | lbtf_deb_leave(LBTF_DEB_HOST); | ||
450 | return tempnode; | 552 | return tempnode; |
451 | } | 553 | } |
452 | 554 | ||
@@ -462,16 +564,20 @@ int lbtf_execute_next_command(struct lbtf_private *priv) | |||
462 | struct cmd_ctrl_node *cmdnode = NULL; | 564 | struct cmd_ctrl_node *cmdnode = NULL; |
463 | struct cmd_header *cmd; | 565 | struct cmd_header *cmd; |
464 | unsigned long flags; | 566 | unsigned long flags; |
567 | int ret = 0; | ||
465 | 568 | ||
466 | /* Debug group is LBS_DEB_THREAD and not LBS_DEB_HOST, because the | 569 | /* Debug group is lbtf_deb_THREAD and not lbtf_deb_HOST, because the |
467 | * only caller to us is lbtf_thread() and we get even when a | 570 | * only caller to us is lbtf_thread() and we get even when a |
468 | * data packet is received */ | 571 | * data packet is received */ |
572 | lbtf_deb_enter(LBTF_DEB_THREAD); | ||
469 | 573 | ||
470 | spin_lock_irqsave(&priv->driver_lock, flags); | 574 | spin_lock_irqsave(&priv->driver_lock, flags); |
471 | 575 | ||
472 | if (priv->cur_cmd) { | 576 | if (priv->cur_cmd) { |
577 | pr_alert("EXEC_NEXT_CMD: already processing command!\n"); | ||
473 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 578 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
474 | return -1; | 579 | ret = -1; |
580 | goto done; | ||
475 | } | 581 | } |
476 | 582 | ||
477 | if (!list_empty(&priv->cmdpendingq)) { | 583 | if (!list_empty(&priv->cmdpendingq)) { |
@@ -483,11 +589,17 @@ int lbtf_execute_next_command(struct lbtf_private *priv) | |||
483 | cmd = cmdnode->cmdbuf; | 589 | cmd = cmdnode->cmdbuf; |
484 | 590 | ||
485 | list_del(&cmdnode->list); | 591 | list_del(&cmdnode->list); |
592 | lbtf_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", | ||
593 | le16_to_cpu(cmd->command)); | ||
486 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 594 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
487 | lbtf_submit_command(priv, cmdnode); | 595 | lbtf_submit_command(priv, cmdnode); |
488 | } else | 596 | } else |
489 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 597 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
490 | return 0; | 598 | |
599 | ret = 0; | ||
600 | done: | ||
601 | lbtf_deb_leave(LBTF_DEB_THREAD); | ||
602 | return ret; | ||
491 | } | 603 | } |
492 | 604 | ||
493 | static struct cmd_ctrl_node *__lbtf_cmd_async(struct lbtf_private *priv, | 605 | static struct cmd_ctrl_node *__lbtf_cmd_async(struct lbtf_private *priv, |
@@ -498,14 +610,22 @@ static struct cmd_ctrl_node *__lbtf_cmd_async(struct lbtf_private *priv, | |||
498 | { | 610 | { |
499 | struct cmd_ctrl_node *cmdnode; | 611 | struct cmd_ctrl_node *cmdnode; |
500 | 612 | ||
501 | if (priv->surpriseremoved) | 613 | lbtf_deb_enter(LBTF_DEB_HOST); |
502 | return ERR_PTR(-ENOENT); | 614 | |
615 | if (priv->surpriseremoved) { | ||
616 | lbtf_deb_host("PREP_CMD: card removed\n"); | ||
617 | cmdnode = ERR_PTR(-ENOENT); | ||
618 | goto done; | ||
619 | } | ||
503 | 620 | ||
504 | cmdnode = lbtf_get_cmd_ctrl_node(priv); | 621 | cmdnode = lbtf_get_cmd_ctrl_node(priv); |
505 | if (cmdnode == NULL) { | 622 | if (cmdnode == NULL) { |
623 | lbtf_deb_host("PREP_CMD: cmdnode is NULL\n"); | ||
624 | |||
506 | /* Wake up main thread to execute next command */ | 625 | /* Wake up main thread to execute next command */ |
507 | queue_work(lbtf_wq, &priv->cmd_work); | 626 | queue_work(lbtf_wq, &priv->cmd_work); |
508 | return ERR_PTR(-ENOBUFS); | 627 | cmdnode = ERR_PTR(-ENOBUFS); |
628 | goto done; | ||
509 | } | 629 | } |
510 | 630 | ||
511 | cmdnode->callback = callback; | 631 | cmdnode->callback = callback; |
@@ -520,17 +640,24 @@ static struct cmd_ctrl_node *__lbtf_cmd_async(struct lbtf_private *priv, | |||
520 | cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); | 640 | cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); |
521 | cmdnode->cmdbuf->seqnum = cpu_to_le16(priv->seqnum); | 641 | cmdnode->cmdbuf->seqnum = cpu_to_le16(priv->seqnum); |
522 | cmdnode->cmdbuf->result = 0; | 642 | cmdnode->cmdbuf->result = 0; |
643 | |||
644 | lbtf_deb_host("PREP_CMD: command 0x%04x\n", command); | ||
645 | |||
523 | cmdnode->cmdwaitqwoken = 0; | 646 | cmdnode->cmdwaitqwoken = 0; |
524 | lbtf_queue_cmd(priv, cmdnode); | 647 | lbtf_queue_cmd(priv, cmdnode); |
525 | queue_work(lbtf_wq, &priv->cmd_work); | 648 | queue_work(lbtf_wq, &priv->cmd_work); |
526 | 649 | ||
650 | done: | ||
651 | lbtf_deb_leave_args(LBTF_DEB_HOST, "ret %p", cmdnode); | ||
527 | return cmdnode; | 652 | return cmdnode; |
528 | } | 653 | } |
529 | 654 | ||
530 | void lbtf_cmd_async(struct lbtf_private *priv, uint16_t command, | 655 | void lbtf_cmd_async(struct lbtf_private *priv, uint16_t command, |
531 | struct cmd_header *in_cmd, int in_cmd_size) | 656 | struct cmd_header *in_cmd, int in_cmd_size) |
532 | { | 657 | { |
658 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
533 | __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size, NULL, 0); | 659 | __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size, NULL, 0); |
660 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
534 | } | 661 | } |
535 | 662 | ||
536 | int __lbtf_cmd(struct lbtf_private *priv, uint16_t command, | 663 | int __lbtf_cmd(struct lbtf_private *priv, uint16_t command, |
@@ -543,30 +670,35 @@ int __lbtf_cmd(struct lbtf_private *priv, uint16_t command, | |||
543 | unsigned long flags; | 670 | unsigned long flags; |
544 | int ret = 0; | 671 | int ret = 0; |
545 | 672 | ||
673 | lbtf_deb_enter(LBTF_DEB_HOST); | ||
674 | |||
546 | cmdnode = __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size, | 675 | cmdnode = __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size, |
547 | callback, callback_arg); | 676 | callback, callback_arg); |
548 | if (IS_ERR(cmdnode)) | 677 | if (IS_ERR(cmdnode)) { |
549 | return PTR_ERR(cmdnode); | 678 | ret = PTR_ERR(cmdnode); |
679 | goto done; | ||
680 | } | ||
550 | 681 | ||
551 | might_sleep(); | 682 | might_sleep(); |
552 | ret = wait_event_interruptible(cmdnode->cmdwait_q, | 683 | ret = wait_event_interruptible(cmdnode->cmdwait_q, |
553 | cmdnode->cmdwaitqwoken); | 684 | cmdnode->cmdwaitqwoken); |
554 | if (ret) { | 685 | if (ret) { |
555 | printk(KERN_DEBUG | 686 | pr_info("PREP_CMD: command 0x%04x interrupted by signal: %d\n", |
556 | "libertastf: command 0x%04x interrupted by signal", | 687 | command, ret); |
557 | command); | 688 | goto done; |
558 | return ret; | ||
559 | } | 689 | } |
560 | 690 | ||
561 | spin_lock_irqsave(&priv->driver_lock, flags); | 691 | spin_lock_irqsave(&priv->driver_lock, flags); |
562 | ret = cmdnode->result; | 692 | ret = cmdnode->result; |
563 | if (ret) | 693 | if (ret) |
564 | printk(KERN_DEBUG "libertastf: command 0x%04x failed: %d\n", | 694 | pr_info("PREP_CMD: command 0x%04x failed: %d\n", |
565 | command, ret); | 695 | command, ret); |
566 | 696 | ||
567 | __lbtf_cleanup_and_insert_cmd(priv, cmdnode); | 697 | __lbtf_cleanup_and_insert_cmd(priv, cmdnode); |
568 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 698 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
569 | 699 | ||
700 | done: | ||
701 | lbtf_deb_leave_args(LBTF_DEB_HOST, "ret %d", ret); | ||
570 | return ret; | 702 | return ret; |
571 | } | 703 | } |
572 | EXPORT_SYMBOL_GPL(__lbtf_cmd); | 704 | EXPORT_SYMBOL_GPL(__lbtf_cmd); |
@@ -587,6 +719,8 @@ int lbtf_process_rx_command(struct lbtf_private *priv) | |||
587 | unsigned long flags; | 719 | unsigned long flags; |
588 | uint16_t result; | 720 | uint16_t result; |
589 | 721 | ||
722 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
723 | |||
590 | mutex_lock(&priv->lock); | 724 | mutex_lock(&priv->lock); |
591 | spin_lock_irqsave(&priv->driver_lock, flags); | 725 | spin_lock_irqsave(&priv->driver_lock, flags); |
592 | 726 | ||
@@ -602,7 +736,7 @@ int lbtf_process_rx_command(struct lbtf_private *priv) | |||
602 | result = le16_to_cpu(resp->result); | 736 | result = le16_to_cpu(resp->result); |
603 | 737 | ||
604 | if (net_ratelimit()) | 738 | if (net_ratelimit()) |
605 | printk(KERN_DEBUG "libertastf: cmd response 0x%04x, seq %d, size %d\n", | 739 | pr_info("libertastf: cmd response 0x%04x, seq %d, size %d\n", |
606 | respcmd, le16_to_cpu(resp->seqnum), | 740 | respcmd, le16_to_cpu(resp->seqnum), |
607 | le16_to_cpu(resp->size)); | 741 | le16_to_cpu(resp->size)); |
608 | 742 | ||
@@ -639,7 +773,7 @@ int lbtf_process_rx_command(struct lbtf_private *priv) | |||
639 | switch (respcmd) { | 773 | switch (respcmd) { |
640 | case CMD_RET(CMD_GET_HW_SPEC): | 774 | case CMD_RET(CMD_GET_HW_SPEC): |
641 | case CMD_RET(CMD_802_11_RESET): | 775 | case CMD_RET(CMD_802_11_RESET): |
642 | printk(KERN_DEBUG "libertastf: reset failed\n"); | 776 | pr_info("libertastf: reset failed\n"); |
643 | break; | 777 | break; |
644 | 778 | ||
645 | } | 779 | } |
@@ -666,5 +800,6 @@ int lbtf_process_rx_command(struct lbtf_private *priv) | |||
666 | 800 | ||
667 | done: | 801 | done: |
668 | mutex_unlock(&priv->lock); | 802 | mutex_unlock(&priv->lock); |
803 | lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", ret); | ||
669 | return ret; | 804 | return ret; |
670 | } | 805 | } |
diff --git a/drivers/net/wireless/libertas_tf/deb_defs.h b/drivers/net/wireless/libertas_tf/deb_defs.h new file mode 100644 index 000000000000..ae753962d8b5 --- /dev/null +++ b/drivers/net/wireless/libertas_tf/deb_defs.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /** | ||
2 | * This header file contains global constant/enum definitions, | ||
3 | * global variable declaration. | ||
4 | */ | ||
5 | #ifndef _LBS_DEB_DEFS_H_ | ||
6 | #define _LBS_DEB_EFS_H_ | ||
7 | |||
8 | #ifndef DRV_NAME | ||
9 | #define DRV_NAME "libertas_tf" | ||
10 | #endif | ||
11 | |||
12 | #include <linux/spinlock.h> | ||
13 | |||
14 | #ifdef CONFIG_LIBERTAS_THINFIRM_DEBUG | ||
15 | #define DEBUG | ||
16 | #define PROC_DEBUG | ||
17 | #endif | ||
18 | |||
19 | #define LBTF_DEB_ENTER 0x00000001 | ||
20 | #define LBTF_DEB_LEAVE 0x00000002 | ||
21 | #define LBTF_DEB_MAIN 0x00000004 | ||
22 | #define LBTF_DEB_NET 0x00000008 | ||
23 | #define LBTF_DEB_MESH 0x00000010 | ||
24 | #define LBTF_DEB_WEXT 0x00000020 | ||
25 | #define LBTF_DEB_IOCTL 0x00000040 | ||
26 | #define LBTF_DEB_SCAN 0x00000080 | ||
27 | #define LBTF_DEB_ASSOC 0x00000100 | ||
28 | #define LBTF_DEB_JOIN 0x00000200 | ||
29 | #define LBTF_DEB_11D 0x00000400 | ||
30 | #define LBTF_DEB_DEBUGFS 0x00000800 | ||
31 | #define LBTF_DEB_ETHTOOL 0x00001000 | ||
32 | #define LBTF_DEB_HOST 0x00002000 | ||
33 | #define LBTF_DEB_CMD 0x00004000 | ||
34 | #define LBTF_DEB_RX 0x00008000 | ||
35 | #define LBTF_DEB_TX 0x00010000 | ||
36 | #define LBTF_DEB_USB 0x00020000 | ||
37 | #define LBTF_DEB_CS 0x00040000 | ||
38 | #define LBTF_DEB_FW 0x00080000 | ||
39 | #define LBTF_DEB_THREAD 0x00100000 | ||
40 | #define LBTF_DEB_HEX 0x00200000 | ||
41 | #define LBTF_DEB_SDIO 0x00400000 | ||
42 | #define LBTF_DEB_MACOPS 0x00800000 | ||
43 | |||
44 | extern unsigned int lbtf_debug; | ||
45 | |||
46 | |||
47 | #ifdef DEBUG | ||
48 | #define LBTF_DEB_LL(grp, grpnam, fmt, args...) \ | ||
49 | do { if ((lbtf_debug & (grp)) == (grp)) \ | ||
50 | printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \ | ||
51 | in_interrupt() ? " (INT)" : "", ## args); } while (0) | ||
52 | #else | ||
53 | #define LBTF_DEB_LL(grp, grpnam, fmt, args...) do {} while (0) | ||
54 | #endif | ||
55 | |||
56 | #define lbtf_deb_enter(grp) \ | ||
57 | LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s()\n", __func__); | ||
58 | #define lbtf_deb_enter_args(grp, fmt, args...) \ | ||
59 | LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args); | ||
60 | #define lbtf_deb_leave(grp) \ | ||
61 | LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s()\n", __func__); | ||
62 | #define lbtf_deb_leave_args(grp, fmt, args...) \ | ||
63 | LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s(), " fmt "\n", \ | ||
64 | __func__, ##args); | ||
65 | #define lbtf_deb_main(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MAIN, " main", fmt, ##args) | ||
66 | #define lbtf_deb_net(fmt, args...) LBTF_DEB_LL(LBTF_DEB_NET, " net", fmt, ##args) | ||
67 | #define lbtf_deb_mesh(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MESH, " mesh", fmt, ##args) | ||
68 | #define lbtf_deb_wext(fmt, args...) LBTF_DEB_LL(LBTF_DEB_WEXT, " wext", fmt, ##args) | ||
69 | #define lbtf_deb_ioctl(fmt, args...) LBTF_DEB_LL(LBTF_DEB_IOCTL, " ioctl", fmt, ##args) | ||
70 | #define lbtf_deb_scan(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SCAN, " scan", fmt, ##args) | ||
71 | #define lbtf_deb_assoc(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ASSOC, " assoc", fmt, ##args) | ||
72 | #define lbtf_deb_join(fmt, args...) LBTF_DEB_LL(LBTF_DEB_JOIN, " join", fmt, ##args) | ||
73 | #define lbtf_deb_11d(fmt, args...) LBTF_DEB_LL(LBTF_DEB_11D, " 11d", fmt, ##args) | ||
74 | #define lbtf_deb_debugfs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_DEBUGFS, " debugfs", fmt, ##args) | ||
75 | #define lbtf_deb_ethtool(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ETHTOOL, " ethtool", fmt, ##args) | ||
76 | #define lbtf_deb_host(fmt, args...) LBTF_DEB_LL(LBTF_DEB_HOST, " host", fmt, ##args) | ||
77 | #define lbtf_deb_cmd(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CMD, " cmd", fmt, ##args) | ||
78 | #define lbtf_deb_rx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_RX, " rx", fmt, ##args) | ||
79 | #define lbtf_deb_tx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_TX, " tx", fmt, ##args) | ||
80 | #define lbtf_deb_fw(fmt, args...) LBTF_DEB_LL(LBTF_DEB_FW, " fw", fmt, ##args) | ||
81 | #define lbtf_deb_usb(fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usb", fmt, ##args) | ||
82 | #define lbtf_deb_usbd(dev, fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args) | ||
83 | #define lbtf_deb_cs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CS, " cs", fmt, ##args) | ||
84 | #define lbtf_deb_thread(fmt, args...) LBTF_DEB_LL(LBTF_DEB_THREAD, " thread", fmt, ##args) | ||
85 | #define lbtf_deb_sdio(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SDIO, " thread", fmt, ##args) | ||
86 | #define lbtf_deb_macops(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MACOPS, " thread", fmt, ##args) | ||
87 | |||
88 | #ifdef DEBUG | ||
89 | static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) | ||
90 | { | ||
91 | char newprompt[32]; | ||
92 | |||
93 | if (len && | ||
94 | (lbtf_debug & LBTF_DEB_HEX) && | ||
95 | (lbtf_debug & grp)) { | ||
96 | snprintf(newprompt, sizeof(newprompt), DRV_NAME " %s: ", prompt); | ||
97 | print_hex_dump_bytes(prompt, DUMP_PREFIX_NONE, buf, len); | ||
98 | } | ||
99 | } | ||
100 | #else | ||
101 | #define lbtf_deb_hex(grp, prompt, buf, len) do {} while (0) | ||
102 | #endif | ||
103 | |||
104 | #endif | ||
diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c index 8cc9db60c14b..4412c279ca94 100644 --- a/drivers/net/wireless/libertas_tf/if_usb.c +++ b/drivers/net/wireless/libertas_tf/if_usb.c | |||
@@ -7,6 +7,13 @@ | |||
7 | * the Free Software Foundation; either version 2 of the License, or (at | 7 | * the Free Software Foundation; either version 2 of the License, or (at |
8 | * your option) any later version. | 8 | * your option) any later version. |
9 | */ | 9 | */ |
10 | #define DRV_NAME "lbtf_usb" | ||
11 | |||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
14 | #include "libertas_tf.h" | ||
15 | #include "if_usb.h" | ||
16 | |||
10 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
11 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
12 | #include <linux/firmware.h> | 19 | #include <linux/firmware.h> |
@@ -14,10 +21,8 @@ | |||
14 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
15 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
16 | 23 | ||
17 | #define DRV_NAME "lbtf_usb" | 24 | #define INSANEDEBUG 0 |
18 | 25 | #define lbtf_deb_usb2(...) do { if (INSANEDEBUG) lbtf_deb_usbd(__VA_ARGS__); } while (0) | |
19 | #include "libertas_tf.h" | ||
20 | #include "if_usb.h" | ||
21 | 26 | ||
22 | #define MESSAGE_HEADER_LEN 4 | 27 | #define MESSAGE_HEADER_LEN 4 |
23 | 28 | ||
@@ -53,9 +58,14 @@ static int if_usb_reset_device(struct if_usb_card *cardp); | |||
53 | */ | 58 | */ |
54 | static void if_usb_write_bulk_callback(struct urb *urb) | 59 | static void if_usb_write_bulk_callback(struct urb *urb) |
55 | { | 60 | { |
56 | if (urb->status != 0) | 61 | if (urb->status != 0) { |
57 | printk(KERN_INFO "libertastf: URB in failure status: %d\n", | 62 | /* print the failure status number for debug */ |
58 | urb->status); | 63 | pr_info("URB in failure status: %d\n", urb->status); |
64 | } else { | ||
65 | lbtf_deb_usb2(&urb->dev->dev, "URB status is successful\n"); | ||
66 | lbtf_deb_usb2(&urb->dev->dev, "Actual length transmitted %d\n", | ||
67 | urb->actual_length); | ||
68 | } | ||
59 | } | 69 | } |
60 | 70 | ||
61 | /** | 71 | /** |
@@ -65,6 +75,8 @@ static void if_usb_write_bulk_callback(struct urb *urb) | |||
65 | */ | 75 | */ |
66 | static void if_usb_free(struct if_usb_card *cardp) | 76 | static void if_usb_free(struct if_usb_card *cardp) |
67 | { | 77 | { |
78 | lbtf_deb_enter(LBTF_DEB_USB); | ||
79 | |||
68 | /* Unlink tx & rx urb */ | 80 | /* Unlink tx & rx urb */ |
69 | usb_kill_urb(cardp->tx_urb); | 81 | usb_kill_urb(cardp->tx_urb); |
70 | usb_kill_urb(cardp->rx_urb); | 82 | usb_kill_urb(cardp->rx_urb); |
@@ -81,6 +93,8 @@ static void if_usb_free(struct if_usb_card *cardp) | |||
81 | 93 | ||
82 | kfree(cardp->ep_out_buf); | 94 | kfree(cardp->ep_out_buf); |
83 | cardp->ep_out_buf = NULL; | 95 | cardp->ep_out_buf = NULL; |
96 | |||
97 | lbtf_deb_leave(LBTF_DEB_USB); | ||
84 | } | 98 | } |
85 | 99 | ||
86 | static void if_usb_setup_firmware(struct lbtf_private *priv) | 100 | static void if_usb_setup_firmware(struct lbtf_private *priv) |
@@ -88,23 +102,33 @@ static void if_usb_setup_firmware(struct lbtf_private *priv) | |||
88 | struct if_usb_card *cardp = priv->card; | 102 | struct if_usb_card *cardp = priv->card; |
89 | struct cmd_ds_set_boot2_ver b2_cmd; | 103 | struct cmd_ds_set_boot2_ver b2_cmd; |
90 | 104 | ||
105 | lbtf_deb_enter(LBTF_DEB_USB); | ||
106 | |||
91 | if_usb_submit_rx_urb(cardp); | 107 | if_usb_submit_rx_urb(cardp); |
92 | b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd)); | 108 | b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd)); |
93 | b2_cmd.action = 0; | 109 | b2_cmd.action = 0; |
94 | b2_cmd.version = cardp->boot2_version; | 110 | b2_cmd.version = cardp->boot2_version; |
95 | 111 | ||
96 | if (lbtf_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd)) | 112 | if (lbtf_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd)) |
97 | printk(KERN_INFO "libertastf: setting boot2 version failed\n"); | 113 | lbtf_deb_usb("Setting boot2 version failed\n"); |
114 | |||
115 | lbtf_deb_leave(LBTF_DEB_USB); | ||
98 | } | 116 | } |
99 | 117 | ||
100 | static void if_usb_fw_timeo(unsigned long priv) | 118 | static void if_usb_fw_timeo(unsigned long priv) |
101 | { | 119 | { |
102 | struct if_usb_card *cardp = (void *)priv; | 120 | struct if_usb_card *cardp = (void *)priv; |
103 | 121 | ||
104 | if (!cardp->fwdnldover) | 122 | lbtf_deb_enter(LBTF_DEB_USB); |
123 | if (!cardp->fwdnldover) { | ||
105 | /* Download timed out */ | 124 | /* Download timed out */ |
106 | cardp->priv->surpriseremoved = 1; | 125 | cardp->priv->surpriseremoved = 1; |
126 | pr_err("Download timed out\n"); | ||
127 | } else { | ||
128 | lbtf_deb_usb("Download complete, no event. Assuming success\n"); | ||
129 | } | ||
107 | wake_up(&cardp->fw_wq); | 130 | wake_up(&cardp->fw_wq); |
131 | lbtf_deb_leave(LBTF_DEB_USB); | ||
108 | } | 132 | } |
109 | 133 | ||
110 | /** | 134 | /** |
@@ -125,11 +149,14 @@ static int if_usb_probe(struct usb_interface *intf, | |||
125 | struct if_usb_card *cardp; | 149 | struct if_usb_card *cardp; |
126 | int i; | 150 | int i; |
127 | 151 | ||
152 | lbtf_deb_enter(LBTF_DEB_USB); | ||
128 | udev = interface_to_usbdev(intf); | 153 | udev = interface_to_usbdev(intf); |
129 | 154 | ||
130 | cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); | 155 | cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); |
131 | if (!cardp) | 156 | if (!cardp) { |
157 | pr_err("Out of memory allocating private data.\n"); | ||
132 | goto error; | 158 | goto error; |
159 | } | ||
133 | 160 | ||
134 | setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); | 161 | setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); |
135 | init_waitqueue_head(&cardp->fw_wq); | 162 | init_waitqueue_head(&cardp->fw_wq); |
@@ -137,38 +164,62 @@ static int if_usb_probe(struct usb_interface *intf, | |||
137 | cardp->udev = udev; | 164 | cardp->udev = udev; |
138 | iface_desc = intf->cur_altsetting; | 165 | iface_desc = intf->cur_altsetting; |
139 | 166 | ||
167 | lbtf_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" | ||
168 | " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", | ||
169 | le16_to_cpu(udev->descriptor.bcdUSB), | ||
170 | udev->descriptor.bDeviceClass, | ||
171 | udev->descriptor.bDeviceSubClass, | ||
172 | udev->descriptor.bDeviceProtocol); | ||
173 | |||
140 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | 174 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
141 | endpoint = &iface_desc->endpoint[i].desc; | 175 | endpoint = &iface_desc->endpoint[i].desc; |
142 | if (usb_endpoint_is_bulk_in(endpoint)) { | 176 | if (usb_endpoint_is_bulk_in(endpoint)) { |
143 | cardp->ep_in_size = | 177 | cardp->ep_in_size = |
144 | le16_to_cpu(endpoint->wMaxPacketSize); | 178 | le16_to_cpu(endpoint->wMaxPacketSize); |
145 | cardp->ep_in = usb_endpoint_num(endpoint); | 179 | cardp->ep_in = usb_endpoint_num(endpoint); |
180 | |||
181 | lbtf_deb_usbd(&udev->dev, "in_endpoint = %d\n", cardp->ep_in); | ||
182 | lbtf_deb_usbd(&udev->dev, "Bulk in size is %d\n", cardp->ep_in_size); | ||
146 | } else if (usb_endpoint_is_bulk_out(endpoint)) { | 183 | } else if (usb_endpoint_is_bulk_out(endpoint)) { |
147 | cardp->ep_out_size = | 184 | cardp->ep_out_size = |
148 | le16_to_cpu(endpoint->wMaxPacketSize); | 185 | le16_to_cpu(endpoint->wMaxPacketSize); |
149 | cardp->ep_out = usb_endpoint_num(endpoint); | 186 | cardp->ep_out = usb_endpoint_num(endpoint); |
187 | |||
188 | lbtf_deb_usbd(&udev->dev, "out_endpoint = %d\n", cardp->ep_out); | ||
189 | lbtf_deb_usbd(&udev->dev, "Bulk out size is %d\n", | ||
190 | cardp->ep_out_size); | ||
150 | } | 191 | } |
151 | } | 192 | } |
152 | if (!cardp->ep_out_size || !cardp->ep_in_size) | 193 | if (!cardp->ep_out_size || !cardp->ep_in_size) { |
194 | lbtf_deb_usbd(&udev->dev, "Endpoints not found\n"); | ||
153 | /* Endpoints not found */ | 195 | /* Endpoints not found */ |
154 | goto dealloc; | 196 | goto dealloc; |
197 | } | ||
155 | 198 | ||
156 | cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL); | 199 | cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL); |
157 | if (!cardp->rx_urb) | 200 | if (!cardp->rx_urb) { |
201 | lbtf_deb_usbd(&udev->dev, "Rx URB allocation failed\n"); | ||
158 | goto dealloc; | 202 | goto dealloc; |
203 | } | ||
159 | 204 | ||
160 | cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL); | 205 | cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL); |
161 | if (!cardp->tx_urb) | 206 | if (!cardp->tx_urb) { |
207 | lbtf_deb_usbd(&udev->dev, "Tx URB allocation failed\n"); | ||
162 | goto dealloc; | 208 | goto dealloc; |
209 | } | ||
163 | 210 | ||
164 | cardp->cmd_urb = usb_alloc_urb(0, GFP_KERNEL); | 211 | cardp->cmd_urb = usb_alloc_urb(0, GFP_KERNEL); |
165 | if (!cardp->cmd_urb) | 212 | if (!cardp->cmd_urb) { |
213 | lbtf_deb_usbd(&udev->dev, "Cmd URB allocation failed\n"); | ||
166 | goto dealloc; | 214 | goto dealloc; |
215 | } | ||
167 | 216 | ||
168 | cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, | 217 | cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, |
169 | GFP_KERNEL); | 218 | GFP_KERNEL); |
170 | if (!cardp->ep_out_buf) | 219 | if (!cardp->ep_out_buf) { |
220 | lbtf_deb_usbd(&udev->dev, "Could not allocate buffer\n"); | ||
171 | goto dealloc; | 221 | goto dealloc; |
222 | } | ||
172 | 223 | ||
173 | priv = lbtf_add_card(cardp, &udev->dev); | 224 | priv = lbtf_add_card(cardp, &udev->dev); |
174 | if (!priv) | 225 | if (!priv) |
@@ -189,6 +240,7 @@ static int if_usb_probe(struct usb_interface *intf, | |||
189 | dealloc: | 240 | dealloc: |
190 | if_usb_free(cardp); | 241 | if_usb_free(cardp); |
191 | error: | 242 | error: |
243 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
192 | return -ENOMEM; | 244 | return -ENOMEM; |
193 | } | 245 | } |
194 | 246 | ||
@@ -202,6 +254,8 @@ static void if_usb_disconnect(struct usb_interface *intf) | |||
202 | struct if_usb_card *cardp = usb_get_intfdata(intf); | 254 | struct if_usb_card *cardp = usb_get_intfdata(intf); |
203 | struct lbtf_private *priv = (struct lbtf_private *) cardp->priv; | 255 | struct lbtf_private *priv = (struct lbtf_private *) cardp->priv; |
204 | 256 | ||
257 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
258 | |||
205 | if_usb_reset_device(cardp); | 259 | if_usb_reset_device(cardp); |
206 | 260 | ||
207 | if (priv) | 261 | if (priv) |
@@ -212,6 +266,8 @@ static void if_usb_disconnect(struct usb_interface *intf) | |||
212 | 266 | ||
213 | usb_set_intfdata(intf, NULL); | 267 | usb_set_intfdata(intf, NULL); |
214 | usb_put_dev(interface_to_usbdev(intf)); | 268 | usb_put_dev(interface_to_usbdev(intf)); |
269 | |||
270 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
215 | } | 271 | } |
216 | 272 | ||
217 | /** | 273 | /** |
@@ -226,6 +282,8 @@ static int if_usb_send_fw_pkt(struct if_usb_card *cardp) | |||
226 | struct fwdata *fwdata = cardp->ep_out_buf; | 282 | struct fwdata *fwdata = cardp->ep_out_buf; |
227 | u8 *firmware = (u8 *) cardp->fw->data; | 283 | u8 *firmware = (u8 *) cardp->fw->data; |
228 | 284 | ||
285 | lbtf_deb_enter(LBTF_DEB_FW); | ||
286 | |||
229 | /* If we got a CRC failure on the last block, back | 287 | /* If we got a CRC failure on the last block, back |
230 | up and retry it */ | 288 | up and retry it */ |
231 | if (!cardp->CRC_OK) { | 289 | if (!cardp->CRC_OK) { |
@@ -233,6 +291,9 @@ static int if_usb_send_fw_pkt(struct if_usb_card *cardp) | |||
233 | cardp->fwseqnum--; | 291 | cardp->fwseqnum--; |
234 | } | 292 | } |
235 | 293 | ||
294 | lbtf_deb_usb2(&cardp->udev->dev, "totalbytes = %d\n", | ||
295 | cardp->totalbytes); | ||
296 | |||
236 | /* struct fwdata (which we sent to the card) has an | 297 | /* struct fwdata (which we sent to the card) has an |
237 | extra __le32 field in between the header and the data, | 298 | extra __le32 field in between the header and the data, |
238 | which is not in the struct fwheader in the actual | 299 | which is not in the struct fwheader in the actual |
@@ -246,18 +307,33 @@ static int if_usb_send_fw_pkt(struct if_usb_card *cardp) | |||
246 | memcpy(fwdata->data, &firmware[cardp->totalbytes], | 307 | memcpy(fwdata->data, &firmware[cardp->totalbytes], |
247 | le32_to_cpu(fwdata->hdr.datalength)); | 308 | le32_to_cpu(fwdata->hdr.datalength)); |
248 | 309 | ||
310 | lbtf_deb_usb2(&cardp->udev->dev, "Data length = %d\n", | ||
311 | le32_to_cpu(fwdata->hdr.datalength)); | ||
312 | |||
249 | fwdata->seqnum = cpu_to_le32(++cardp->fwseqnum); | 313 | fwdata->seqnum = cpu_to_le32(++cardp->fwseqnum); |
250 | cardp->totalbytes += le32_to_cpu(fwdata->hdr.datalength); | 314 | cardp->totalbytes += le32_to_cpu(fwdata->hdr.datalength); |
251 | 315 | ||
252 | usb_tx_block(cardp, cardp->ep_out_buf, sizeof(struct fwdata) + | 316 | usb_tx_block(cardp, cardp->ep_out_buf, sizeof(struct fwdata) + |
253 | le32_to_cpu(fwdata->hdr.datalength), 0); | 317 | le32_to_cpu(fwdata->hdr.datalength), 0); |
254 | 318 | ||
255 | if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) | 319 | if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) { |
320 | lbtf_deb_usb2(&cardp->udev->dev, "There are data to follow\n"); | ||
321 | lbtf_deb_usb2(&cardp->udev->dev, "seqnum = %d totalbytes = %d\n", | ||
322 | cardp->fwseqnum, cardp->totalbytes); | ||
323 | } else if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) { | ||
324 | lbtf_deb_usb2(&cardp->udev->dev, "Host has finished FW downloading\n"); | ||
325 | lbtf_deb_usb2(&cardp->udev->dev, "Donwloading FW JUMP BLOCK\n"); | ||
326 | |||
256 | /* Host has finished FW downloading | 327 | /* Host has finished FW downloading |
257 | * Donwloading FW JUMP BLOCK | 328 | * Donwloading FW JUMP BLOCK |
258 | */ | 329 | */ |
259 | cardp->fwfinalblk = 1; | 330 | cardp->fwfinalblk = 1; |
331 | } | ||
260 | 332 | ||
333 | lbtf_deb_usb2(&cardp->udev->dev, "Firmware download done; size %d\n", | ||
334 | cardp->totalbytes); | ||
335 | |||
336 | lbtf_deb_leave(LBTF_DEB_FW); | ||
261 | return 0; | 337 | return 0; |
262 | } | 338 | } |
263 | 339 | ||
@@ -266,6 +342,8 @@ static int if_usb_reset_device(struct if_usb_card *cardp) | |||
266 | struct cmd_ds_802_11_reset *cmd = cardp->ep_out_buf + 4; | 342 | struct cmd_ds_802_11_reset *cmd = cardp->ep_out_buf + 4; |
267 | int ret; | 343 | int ret; |
268 | 344 | ||
345 | lbtf_deb_enter(LBTF_DEB_USB); | ||
346 | |||
269 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); | 347 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); |
270 | 348 | ||
271 | cmd->hdr.command = cpu_to_le16(CMD_802_11_RESET); | 349 | cmd->hdr.command = cpu_to_le16(CMD_802_11_RESET); |
@@ -280,6 +358,8 @@ static int if_usb_reset_device(struct if_usb_card *cardp) | |||
280 | ret = usb_reset_device(cardp->udev); | 358 | ret = usb_reset_device(cardp->udev); |
281 | msleep(100); | 359 | msleep(100); |
282 | 360 | ||
361 | lbtf_deb_leave_args(LBTF_DEB_USB, "ret %d", ret); | ||
362 | |||
283 | return ret; | 363 | return ret; |
284 | } | 364 | } |
285 | EXPORT_SYMBOL_GPL(if_usb_reset_device); | 365 | EXPORT_SYMBOL_GPL(if_usb_reset_device); |
@@ -297,11 +377,15 @@ EXPORT_SYMBOL_GPL(if_usb_reset_device); | |||
297 | static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, | 377 | static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, |
298 | uint16_t nb, u8 data) | 378 | uint16_t nb, u8 data) |
299 | { | 379 | { |
380 | int ret = -1; | ||
300 | struct urb *urb; | 381 | struct urb *urb; |
301 | 382 | ||
383 | lbtf_deb_enter(LBTF_DEB_USB); | ||
302 | /* check if device is removed */ | 384 | /* check if device is removed */ |
303 | if (cardp->priv->surpriseremoved) | 385 | if (cardp->priv->surpriseremoved) { |
304 | return -1; | 386 | lbtf_deb_usbd(&cardp->udev->dev, "Device removed\n"); |
387 | goto tx_ret; | ||
388 | } | ||
305 | 389 | ||
306 | if (data) | 390 | if (data) |
307 | urb = cardp->tx_urb; | 391 | urb = cardp->tx_urb; |
@@ -315,19 +399,34 @@ static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, | |||
315 | 399 | ||
316 | urb->transfer_flags |= URB_ZERO_PACKET; | 400 | urb->transfer_flags |= URB_ZERO_PACKET; |
317 | 401 | ||
318 | if (usb_submit_urb(urb, GFP_ATOMIC)) | 402 | if (usb_submit_urb(urb, GFP_ATOMIC)) { |
319 | return -1; | 403 | lbtf_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed: %d\n", ret); |
320 | return 0; | 404 | goto tx_ret; |
405 | } | ||
406 | |||
407 | lbtf_deb_usb2(&cardp->udev->dev, "usb_submit_urb success\n"); | ||
408 | |||
409 | ret = 0; | ||
410 | |||
411 | tx_ret: | ||
412 | lbtf_deb_leave(LBTF_DEB_USB); | ||
413 | return ret; | ||
321 | } | 414 | } |
322 | 415 | ||
323 | static int __if_usb_submit_rx_urb(struct if_usb_card *cardp, | 416 | static int __if_usb_submit_rx_urb(struct if_usb_card *cardp, |
324 | void (*callbackfn)(struct urb *urb)) | 417 | void (*callbackfn)(struct urb *urb)) |
325 | { | 418 | { |
326 | struct sk_buff *skb; | 419 | struct sk_buff *skb; |
420 | int ret = -1; | ||
421 | |||
422 | lbtf_deb_enter(LBTF_DEB_USB); | ||
327 | 423 | ||
328 | skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); | 424 | skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); |
329 | if (!skb) | 425 | if (!skb) { |
426 | pr_err("No free skb\n"); | ||
427 | lbtf_deb_leave(LBTF_DEB_USB); | ||
330 | return -1; | 428 | return -1; |
429 | } | ||
331 | 430 | ||
332 | cardp->rx_skb = skb; | 431 | cardp->rx_skb = skb; |
333 | 432 | ||
@@ -339,12 +438,19 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp, | |||
339 | 438 | ||
340 | cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; | 439 | cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; |
341 | 440 | ||
342 | if (usb_submit_urb(cardp->rx_urb, GFP_ATOMIC)) { | 441 | lbtf_deb_usb2(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); |
442 | ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC); | ||
443 | if (ret) { | ||
444 | lbtf_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed: %d\n", ret); | ||
343 | kfree_skb(skb); | 445 | kfree_skb(skb); |
344 | cardp->rx_skb = NULL; | 446 | cardp->rx_skb = NULL; |
447 | lbtf_deb_leave(LBTF_DEB_USB); | ||
345 | return -1; | 448 | return -1; |
346 | } else | 449 | } else { |
450 | lbtf_deb_usb2(&cardp->udev->dev, "Submit Rx URB success\n"); | ||
451 | lbtf_deb_leave(LBTF_DEB_USB); | ||
347 | return 0; | 452 | return 0; |
453 | } | ||
348 | } | 454 | } |
349 | 455 | ||
350 | static int if_usb_submit_rx_urb_fwload(struct if_usb_card *cardp) | 456 | static int if_usb_submit_rx_urb_fwload(struct if_usb_card *cardp) |
@@ -364,8 +470,12 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
364 | struct fwsyncheader *syncfwheader; | 470 | struct fwsyncheader *syncfwheader; |
365 | struct bootcmdresp bcmdresp; | 471 | struct bootcmdresp bcmdresp; |
366 | 472 | ||
473 | lbtf_deb_enter(LBTF_DEB_USB); | ||
367 | if (urb->status) { | 474 | if (urb->status) { |
475 | lbtf_deb_usbd(&cardp->udev->dev, | ||
476 | "URB status is failed during fw load\n"); | ||
368 | kfree_skb(skb); | 477 | kfree_skb(skb); |
478 | lbtf_deb_leave(LBTF_DEB_USB); | ||
369 | return; | 479 | return; |
370 | } | 480 | } |
371 | 481 | ||
@@ -373,12 +483,17 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
373 | __le32 *tmp = (__le32 *)(skb->data); | 483 | __le32 *tmp = (__le32 *)(skb->data); |
374 | 484 | ||
375 | if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && | 485 | if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && |
376 | tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) | 486 | tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) { |
377 | /* Firmware ready event received */ | 487 | /* Firmware ready event received */ |
488 | pr_info("Firmware ready event received\n"); | ||
378 | wake_up(&cardp->fw_wq); | 489 | wake_up(&cardp->fw_wq); |
379 | else | 490 | } else { |
491 | lbtf_deb_usb("Waiting for confirmation; got %x %x\n", | ||
492 | le32_to_cpu(tmp[0]), le32_to_cpu(tmp[1])); | ||
380 | if_usb_submit_rx_urb_fwload(cardp); | 493 | if_usb_submit_rx_urb_fwload(cardp); |
494 | } | ||
381 | kfree_skb(skb); | 495 | kfree_skb(skb); |
496 | lbtf_deb_leave(LBTF_DEB_USB); | ||
382 | return; | 497 | return; |
383 | } | 498 | } |
384 | if (cardp->bootcmdresp <= 0) { | 499 | if (cardp->bootcmdresp <= 0) { |
@@ -389,34 +504,60 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
389 | if_usb_submit_rx_urb_fwload(cardp); | 504 | if_usb_submit_rx_urb_fwload(cardp); |
390 | cardp->bootcmdresp = 1; | 505 | cardp->bootcmdresp = 1; |
391 | /* Received valid boot command response */ | 506 | /* Received valid boot command response */ |
507 | lbtf_deb_usbd(&cardp->udev->dev, | ||
508 | "Received valid boot command response\n"); | ||
509 | lbtf_deb_leave(LBTF_DEB_USB); | ||
392 | return; | 510 | return; |
393 | } | 511 | } |
394 | if (bcmdresp.magic != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { | 512 | if (bcmdresp.magic != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { |
395 | if (bcmdresp.magic == cpu_to_le32(CMD_TYPE_REQUEST) || | 513 | if (bcmdresp.magic == cpu_to_le32(CMD_TYPE_REQUEST) || |
396 | bcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || | 514 | bcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || |
397 | bcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) | 515 | bcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) { |
516 | if (!cardp->bootcmdresp) | ||
517 | pr_info("Firmware already seems alive; resetting\n"); | ||
398 | cardp->bootcmdresp = -1; | 518 | cardp->bootcmdresp = -1; |
399 | } else if (bcmdresp.cmd == BOOT_CMD_FW_BY_USB && | 519 | } else { |
400 | bcmdresp.result == BOOT_CMD_RESP_OK) | 520 | pr_info("boot cmd response wrong magic number (0x%x)\n", |
521 | le32_to_cpu(bcmdresp.magic)); | ||
522 | } | ||
523 | } else if (bcmdresp.cmd != BOOT_CMD_FW_BY_USB) { | ||
524 | pr_info("boot cmd response cmd_tag error (%d)\n", | ||
525 | bcmdresp.cmd); | ||
526 | } else if (bcmdresp.result != BOOT_CMD_RESP_OK) { | ||
527 | pr_info("boot cmd response result error (%d)\n", | ||
528 | bcmdresp.result); | ||
529 | } else { | ||
401 | cardp->bootcmdresp = 1; | 530 | cardp->bootcmdresp = 1; |
531 | lbtf_deb_usbd(&cardp->udev->dev, | ||
532 | "Received valid boot command response\n"); | ||
533 | } | ||
402 | 534 | ||
403 | kfree_skb(skb); | 535 | kfree_skb(skb); |
404 | if_usb_submit_rx_urb_fwload(cardp); | 536 | if_usb_submit_rx_urb_fwload(cardp); |
537 | lbtf_deb_leave(LBTF_DEB_USB); | ||
405 | return; | 538 | return; |
406 | } | 539 | } |
407 | 540 | ||
408 | syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC); | 541 | syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC); |
409 | if (!syncfwheader) { | 542 | if (!syncfwheader) { |
543 | lbtf_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n"); | ||
410 | kfree_skb(skb); | 544 | kfree_skb(skb); |
545 | lbtf_deb_leave(LBTF_DEB_USB); | ||
411 | return; | 546 | return; |
412 | } | 547 | } |
413 | 548 | ||
414 | memcpy(syncfwheader, skb->data, sizeof(struct fwsyncheader)); | 549 | memcpy(syncfwheader, skb->data, sizeof(struct fwsyncheader)); |
415 | 550 | ||
416 | if (!syncfwheader->cmd) | 551 | if (!syncfwheader->cmd) { |
552 | lbtf_deb_usb2(&cardp->udev->dev, "FW received Blk with correct CRC\n"); | ||
553 | lbtf_deb_usb2(&cardp->udev->dev, "FW received Blk seqnum = %d\n", | ||
554 | le32_to_cpu(syncfwheader->seqnum)); | ||
417 | cardp->CRC_OK = 1; | 555 | cardp->CRC_OK = 1; |
418 | else | 556 | } else { |
557 | lbtf_deb_usbd(&cardp->udev->dev, "FW received Blk with CRC error\n"); | ||
419 | cardp->CRC_OK = 0; | 558 | cardp->CRC_OK = 0; |
559 | } | ||
560 | |||
420 | kfree_skb(skb); | 561 | kfree_skb(skb); |
421 | 562 | ||
422 | /* reschedule timer for 200ms hence */ | 563 | /* reschedule timer for 200ms hence */ |
@@ -434,6 +575,7 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
434 | 575 | ||
435 | kfree(syncfwheader); | 576 | kfree(syncfwheader); |
436 | 577 | ||
578 | lbtf_deb_leave(LBTF_DEB_USB); | ||
437 | return; | 579 | return; |
438 | } | 580 | } |
439 | 581 | ||
@@ -445,6 +587,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, | |||
445 | { | 587 | { |
446 | if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + MESSAGE_HEADER_LEN | 588 | if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + MESSAGE_HEADER_LEN |
447 | || recvlength < MRVDRV_MIN_PKT_LEN) { | 589 | || recvlength < MRVDRV_MIN_PKT_LEN) { |
590 | lbtf_deb_usbd(&cardp->udev->dev, "Packet length is Invalid\n"); | ||
448 | kfree_skb(skb); | 591 | kfree_skb(skb); |
449 | return; | 592 | return; |
450 | } | 593 | } |
@@ -460,6 +603,8 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, | |||
460 | struct lbtf_private *priv) | 603 | struct lbtf_private *priv) |
461 | { | 604 | { |
462 | if (recvlength > LBS_CMD_BUFFER_SIZE) { | 605 | if (recvlength > LBS_CMD_BUFFER_SIZE) { |
606 | lbtf_deb_usbd(&cardp->udev->dev, | ||
607 | "The receive buffer is too large\n"); | ||
463 | kfree_skb(skb); | 608 | kfree_skb(skb); |
464 | return; | 609 | return; |
465 | } | 610 | } |
@@ -489,16 +634,24 @@ static void if_usb_receive(struct urb *urb) | |||
489 | uint32_t recvtype = 0; | 634 | uint32_t recvtype = 0; |
490 | __le32 *pkt = (__le32 *) skb->data; | 635 | __le32 *pkt = (__le32 *) skb->data; |
491 | 636 | ||
637 | lbtf_deb_enter(LBTF_DEB_USB); | ||
638 | |||
492 | if (recvlength) { | 639 | if (recvlength) { |
493 | if (urb->status) { | 640 | if (urb->status) { |
641 | lbtf_deb_usbd(&cardp->udev->dev, "RX URB failed: %d\n", | ||
642 | urb->status); | ||
494 | kfree_skb(skb); | 643 | kfree_skb(skb); |
495 | goto setup_for_next; | 644 | goto setup_for_next; |
496 | } | 645 | } |
497 | 646 | ||
498 | recvbuff = skb->data; | 647 | recvbuff = skb->data; |
499 | recvtype = le32_to_cpu(pkt[0]); | 648 | recvtype = le32_to_cpu(pkt[0]); |
649 | lbtf_deb_usbd(&cardp->udev->dev, | ||
650 | "Recv length = 0x%x, Recv type = 0x%X\n", | ||
651 | recvlength, recvtype); | ||
500 | } else if (urb->status) { | 652 | } else if (urb->status) { |
501 | kfree_skb(skb); | 653 | kfree_skb(skb); |
654 | lbtf_deb_leave(LBTF_DEB_USB); | ||
502 | return; | 655 | return; |
503 | } | 656 | } |
504 | 657 | ||
@@ -515,6 +668,7 @@ static void if_usb_receive(struct urb *urb) | |||
515 | { | 668 | { |
516 | /* Event cause handling */ | 669 | /* Event cause handling */ |
517 | u32 event_cause = le32_to_cpu(pkt[1]); | 670 | u32 event_cause = le32_to_cpu(pkt[1]); |
671 | lbtf_deb_usbd(&cardp->udev->dev, "**EVENT** 0x%X\n", event_cause); | ||
518 | 672 | ||
519 | /* Icky undocumented magic special case */ | 673 | /* Icky undocumented magic special case */ |
520 | if (event_cause & 0xffff0000) { | 674 | if (event_cause & 0xffff0000) { |
@@ -529,21 +683,22 @@ static void if_usb_receive(struct urb *urb) | |||
529 | } else if (event_cause == LBTF_EVENT_BCN_SENT) | 683 | } else if (event_cause == LBTF_EVENT_BCN_SENT) |
530 | lbtf_bcn_sent(priv); | 684 | lbtf_bcn_sent(priv); |
531 | else | 685 | else |
532 | printk(KERN_DEBUG | 686 | lbtf_deb_usbd(&cardp->udev->dev, |
533 | "Unsupported notification %d received\n", | 687 | "Unsupported notification %d received\n", |
534 | event_cause); | 688 | event_cause); |
535 | kfree_skb(skb); | 689 | kfree_skb(skb); |
536 | break; | 690 | break; |
537 | } | 691 | } |
538 | default: | 692 | default: |
539 | printk(KERN_DEBUG "libertastf: unknown command type 0x%X\n", | 693 | lbtf_deb_usbd(&cardp->udev->dev, |
540 | recvtype); | 694 | "libertastf: unknown command type 0x%X\n", recvtype); |
541 | kfree_skb(skb); | 695 | kfree_skb(skb); |
542 | break; | 696 | break; |
543 | } | 697 | } |
544 | 698 | ||
545 | setup_for_next: | 699 | setup_for_next: |
546 | if_usb_submit_rx_urb(cardp); | 700 | if_usb_submit_rx_urb(cardp); |
701 | lbtf_deb_leave(LBTF_DEB_USB); | ||
547 | } | 702 | } |
548 | 703 | ||
549 | /** | 704 | /** |
@@ -562,6 +717,9 @@ static int if_usb_host_to_card(struct lbtf_private *priv, uint8_t type, | |||
562 | struct if_usb_card *cardp = priv->card; | 717 | struct if_usb_card *cardp = priv->card; |
563 | u8 data = 0; | 718 | u8 data = 0; |
564 | 719 | ||
720 | lbtf_deb_usbd(&cardp->udev->dev, "*** type = %u\n", type); | ||
721 | lbtf_deb_usbd(&cardp->udev->dev, "size after = %d\n", nb); | ||
722 | |||
565 | if (type == MVMS_CMD) { | 723 | if (type == MVMS_CMD) { |
566 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); | 724 | *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); |
567 | } else { | 725 | } else { |
@@ -639,8 +797,10 @@ static int check_fwfile_format(const u8 *data, u32 totlen) | |||
639 | } while (!exit); | 797 | } while (!exit); |
640 | 798 | ||
641 | if (ret) | 799 | if (ret) |
642 | printk(KERN_INFO | 800 | pr_err("firmware file format check FAIL\n"); |
643 | "libertastf: firmware file format check failed\n"); | 801 | else |
802 | lbtf_deb_fw("firmware file format check PASS\n"); | ||
803 | |||
644 | return ret; | 804 | return ret; |
645 | } | 805 | } |
646 | 806 | ||
@@ -651,10 +811,12 @@ static int if_usb_prog_firmware(struct if_usb_card *cardp) | |||
651 | static int reset_count = 10; | 811 | static int reset_count = 10; |
652 | int ret = 0; | 812 | int ret = 0; |
653 | 813 | ||
814 | lbtf_deb_enter(LBTF_DEB_USB); | ||
815 | |||
654 | ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev); | 816 | ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev); |
655 | if (ret < 0) { | 817 | if (ret < 0) { |
656 | printk(KERN_INFO "libertastf: firmware %s not found\n", | 818 | pr_err("request_firmware() failed with %#x\n", ret); |
657 | lbtf_fw_name); | 819 | pr_err("firmware %s not found\n", lbtf_fw_name); |
658 | goto done; | 820 | goto done; |
659 | } | 821 | } |
660 | 822 | ||
@@ -663,6 +825,7 @@ static int if_usb_prog_firmware(struct if_usb_card *cardp) | |||
663 | 825 | ||
664 | restart: | 826 | restart: |
665 | if (if_usb_submit_rx_urb_fwload(cardp) < 0) { | 827 | if (if_usb_submit_rx_urb_fwload(cardp) < 0) { |
828 | lbtf_deb_usbd(&cardp->udev->dev, "URB submission is failed\n"); | ||
666 | ret = -1; | 829 | ret = -1; |
667 | goto release_fw; | 830 | goto release_fw; |
668 | } | 831 | } |
@@ -709,14 +872,13 @@ restart: | |||
709 | usb_kill_urb(cardp->rx_urb); | 872 | usb_kill_urb(cardp->rx_urb); |
710 | 873 | ||
711 | if (!cardp->fwdnldover) { | 874 | if (!cardp->fwdnldover) { |
712 | printk(KERN_INFO "libertastf: failed to load fw," | 875 | pr_info("failed to load fw, resetting device!\n"); |
713 | " resetting device!\n"); | ||
714 | if (--reset_count >= 0) { | 876 | if (--reset_count >= 0) { |
715 | if_usb_reset_device(cardp); | 877 | if_usb_reset_device(cardp); |
716 | goto restart; | 878 | goto restart; |
717 | } | 879 | } |
718 | 880 | ||
719 | printk(KERN_INFO "libertastf: fw download failure\n"); | 881 | pr_info("FW download failure, time = %d ms\n", i * 100); |
720 | ret = -1; | 882 | ret = -1; |
721 | goto release_fw; | 883 | goto release_fw; |
722 | } | 884 | } |
@@ -730,6 +892,7 @@ restart: | |||
730 | if_usb_setup_firmware(cardp->priv); | 892 | if_usb_setup_firmware(cardp->priv); |
731 | 893 | ||
732 | done: | 894 | done: |
895 | lbtf_deb_leave_args(LBTF_DEB_USB, "ret %d", ret); | ||
733 | return ret; | 896 | return ret; |
734 | } | 897 | } |
735 | EXPORT_SYMBOL_GPL(if_usb_prog_firmware); | 898 | EXPORT_SYMBOL_GPL(if_usb_prog_firmware); |
@@ -751,13 +914,19 @@ static int __init if_usb_init_module(void) | |||
751 | { | 914 | { |
752 | int ret = 0; | 915 | int ret = 0; |
753 | 916 | ||
917 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
918 | |||
754 | ret = usb_register(&if_usb_driver); | 919 | ret = usb_register(&if_usb_driver); |
920 | |||
921 | lbtf_deb_leave_args(LBTF_DEB_MAIN, "ret %d", ret); | ||
755 | return ret; | 922 | return ret; |
756 | } | 923 | } |
757 | 924 | ||
758 | static void __exit if_usb_exit_module(void) | 925 | static void __exit if_usb_exit_module(void) |
759 | { | 926 | { |
927 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
760 | usb_deregister(&if_usb_driver); | 928 | usb_deregister(&if_usb_driver); |
929 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
761 | } | 930 | } |
762 | 931 | ||
763 | module_init(if_usb_init_module); | 932 | module_init(if_usb_init_module); |
diff --git a/drivers/net/wireless/libertas_tf/libertas_tf.h b/drivers/net/wireless/libertas_tf/libertas_tf.h index 4cc42dd5a005..fbbaaae7a1ae 100644 --- a/drivers/net/wireless/libertas_tf/libertas_tf.h +++ b/drivers/net/wireless/libertas_tf/libertas_tf.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/kthread.h> | 13 | #include <linux/kthread.h> |
14 | #include <net/mac80211.h> | 14 | #include <net/mac80211.h> |
15 | 15 | ||
16 | #include "deb_defs.h" | ||
17 | |||
16 | #ifndef DRV_NAME | 18 | #ifndef DRV_NAME |
17 | #define DRV_NAME "libertas_tf" | 19 | #define DRV_NAME "libertas_tf" |
18 | #endif | 20 | #endif |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index 7533a23e0500..60787de56f3a 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -7,10 +7,12 @@ | |||
7 | * the Free Software Foundation; either version 2 of the License, or (at | 7 | * the Free Software Foundation; either version 2 of the License, or (at |
8 | * your option) any later version. | 8 | * your option) any later version. |
9 | */ | 9 | */ |
10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | |||
10 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
11 | 13 | ||
14 | #include <linux/etherdevice.h> | ||
12 | #include "libertas_tf.h" | 15 | #include "libertas_tf.h" |
13 | #include "linux/etherdevice.h" | ||
14 | 16 | ||
15 | #define DRIVER_RELEASE_VERSION "004.p0" | 17 | #define DRIVER_RELEASE_VERSION "004.p0" |
16 | /* thinfirm version: 5.132.X.pX */ | 18 | /* thinfirm version: 5.132.X.pX */ |
@@ -18,7 +20,17 @@ | |||
18 | #define LBTF_FW_VER_MAX 0x0584ffff | 20 | #define LBTF_FW_VER_MAX 0x0584ffff |
19 | #define QOS_CONTROL_LEN 2 | 21 | #define QOS_CONTROL_LEN 2 |
20 | 22 | ||
21 | static const char lbtf_driver_version[] = "THINFIRM-USB8388-" DRIVER_RELEASE_VERSION; | 23 | /* Module parameters */ |
24 | unsigned int lbtf_debug; | ||
25 | EXPORT_SYMBOL_GPL(lbtf_debug); | ||
26 | module_param_named(libertas_tf_debug, lbtf_debug, int, 0644); | ||
27 | |||
28 | static const char lbtf_driver_version[] = "THINFIRM-USB8388-" DRIVER_RELEASE_VERSION | ||
29 | #ifdef DEBUG | ||
30 | "-dbg" | ||
31 | #endif | ||
32 | ""; | ||
33 | |||
22 | struct workqueue_struct *lbtf_wq; | 34 | struct workqueue_struct *lbtf_wq; |
23 | 35 | ||
24 | static const struct ieee80211_channel lbtf_channels[] = { | 36 | static const struct ieee80211_channel lbtf_channels[] = { |
@@ -81,6 +93,9 @@ static void lbtf_cmd_work(struct work_struct *work) | |||
81 | { | 93 | { |
82 | struct lbtf_private *priv = container_of(work, struct lbtf_private, | 94 | struct lbtf_private *priv = container_of(work, struct lbtf_private, |
83 | cmd_work); | 95 | cmd_work); |
96 | |||
97 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
98 | |||
84 | spin_lock_irq(&priv->driver_lock); | 99 | spin_lock_irq(&priv->driver_lock); |
85 | /* command response? */ | 100 | /* command response? */ |
86 | if (priv->cmd_response_rxed) { | 101 | if (priv->cmd_response_rxed) { |
@@ -108,11 +123,16 @@ static void lbtf_cmd_work(struct work_struct *work) | |||
108 | priv->cmd_timed_out = 0; | 123 | priv->cmd_timed_out = 0; |
109 | spin_unlock_irq(&priv->driver_lock); | 124 | spin_unlock_irq(&priv->driver_lock); |
110 | 125 | ||
111 | if (!priv->fw_ready) | 126 | if (!priv->fw_ready) { |
127 | lbtf_deb_leave_args(LBTF_DEB_CMD, "fw not ready"); | ||
112 | return; | 128 | return; |
129 | } | ||
130 | |||
113 | /* Execute the next command */ | 131 | /* Execute the next command */ |
114 | if (!priv->cur_cmd) | 132 | if (!priv->cur_cmd) |
115 | lbtf_execute_next_command(priv); | 133 | lbtf_execute_next_command(priv); |
134 | |||
135 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
116 | } | 136 | } |
117 | 137 | ||
118 | /** | 138 | /** |
@@ -126,6 +146,7 @@ static int lbtf_setup_firmware(struct lbtf_private *priv) | |||
126 | { | 146 | { |
127 | int ret = -1; | 147 | int ret = -1; |
128 | 148 | ||
149 | lbtf_deb_enter(LBTF_DEB_FW); | ||
129 | /* | 150 | /* |
130 | * Read priv address from HW | 151 | * Read priv address from HW |
131 | */ | 152 | */ |
@@ -141,6 +162,7 @@ static int lbtf_setup_firmware(struct lbtf_private *priv) | |||
141 | 162 | ||
142 | ret = 0; | 163 | ret = 0; |
143 | done: | 164 | done: |
165 | lbtf_deb_leave_args(LBTF_DEB_FW, "ret: %d", ret); | ||
144 | return ret; | 166 | return ret; |
145 | } | 167 | } |
146 | 168 | ||
@@ -152,6 +174,7 @@ static void command_timer_fn(unsigned long data) | |||
152 | { | 174 | { |
153 | struct lbtf_private *priv = (struct lbtf_private *)data; | 175 | struct lbtf_private *priv = (struct lbtf_private *)data; |
154 | unsigned long flags; | 176 | unsigned long flags; |
177 | lbtf_deb_enter(LBTF_DEB_CMD); | ||
155 | 178 | ||
156 | spin_lock_irqsave(&priv->driver_lock, flags); | 179 | spin_lock_irqsave(&priv->driver_lock, flags); |
157 | 180 | ||
@@ -168,10 +191,12 @@ static void command_timer_fn(unsigned long data) | |||
168 | queue_work(lbtf_wq, &priv->cmd_work); | 191 | queue_work(lbtf_wq, &priv->cmd_work); |
169 | out: | 192 | out: |
170 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 193 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
194 | lbtf_deb_leave(LBTF_DEB_CMD); | ||
171 | } | 195 | } |
172 | 196 | ||
173 | static int lbtf_init_adapter(struct lbtf_private *priv) | 197 | static int lbtf_init_adapter(struct lbtf_private *priv) |
174 | { | 198 | { |
199 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
175 | memset(priv->current_addr, 0xff, ETH_ALEN); | 200 | memset(priv->current_addr, 0xff, ETH_ALEN); |
176 | mutex_init(&priv->lock); | 201 | mutex_init(&priv->lock); |
177 | 202 | ||
@@ -188,13 +213,16 @@ static int lbtf_init_adapter(struct lbtf_private *priv) | |||
188 | if (lbtf_allocate_cmd_buffer(priv)) | 213 | if (lbtf_allocate_cmd_buffer(priv)) |
189 | return -1; | 214 | return -1; |
190 | 215 | ||
216 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
191 | return 0; | 217 | return 0; |
192 | } | 218 | } |
193 | 219 | ||
194 | static void lbtf_free_adapter(struct lbtf_private *priv) | 220 | static void lbtf_free_adapter(struct lbtf_private *priv) |
195 | { | 221 | { |
222 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
196 | lbtf_free_cmd_buffer(priv); | 223 | lbtf_free_cmd_buffer(priv); |
197 | del_timer(&priv->command_timer); | 224 | del_timer(&priv->command_timer); |
225 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
198 | } | 226 | } |
199 | 227 | ||
200 | static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 228 | static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
@@ -221,14 +249,18 @@ static void lbtf_tx_work(struct work_struct *work) | |||
221 | struct sk_buff *skb = NULL; | 249 | struct sk_buff *skb = NULL; |
222 | int err; | 250 | int err; |
223 | 251 | ||
252 | lbtf_deb_enter(LBTF_DEB_MACOPS | LBTF_DEB_TX); | ||
253 | |||
224 | if ((priv->vif->type == NL80211_IFTYPE_AP) && | 254 | if ((priv->vif->type == NL80211_IFTYPE_AP) && |
225 | (!skb_queue_empty(&priv->bc_ps_buf))) | 255 | (!skb_queue_empty(&priv->bc_ps_buf))) |
226 | skb = skb_dequeue(&priv->bc_ps_buf); | 256 | skb = skb_dequeue(&priv->bc_ps_buf); |
227 | else if (priv->skb_to_tx) { | 257 | else if (priv->skb_to_tx) { |
228 | skb = priv->skb_to_tx; | 258 | skb = priv->skb_to_tx; |
229 | priv->skb_to_tx = NULL; | 259 | priv->skb_to_tx = NULL; |
230 | } else | 260 | } else { |
261 | lbtf_deb_leave(LBTF_DEB_MACOPS | LBTF_DEB_TX); | ||
231 | return; | 262 | return; |
263 | } | ||
232 | 264 | ||
233 | len = skb->len; | 265 | len = skb->len; |
234 | info = IEEE80211_SKB_CB(skb); | 266 | info = IEEE80211_SKB_CB(skb); |
@@ -236,6 +268,7 @@ static void lbtf_tx_work(struct work_struct *work) | |||
236 | 268 | ||
237 | if (priv->surpriseremoved) { | 269 | if (priv->surpriseremoved) { |
238 | dev_kfree_skb_any(skb); | 270 | dev_kfree_skb_any(skb); |
271 | lbtf_deb_leave(LBTF_DEB_MACOPS | LBTF_DEB_TX); | ||
239 | return; | 272 | return; |
240 | } | 273 | } |
241 | 274 | ||
@@ -249,6 +282,7 @@ static void lbtf_tx_work(struct work_struct *work) | |||
249 | ETH_ALEN); | 282 | ETH_ALEN); |
250 | txpd->tx_packet_length = cpu_to_le16(len); | 283 | txpd->tx_packet_length = cpu_to_le16(len); |
251 | txpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); | 284 | txpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); |
285 | lbtf_deb_hex(LBTF_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); | ||
252 | BUG_ON(priv->tx_skb); | 286 | BUG_ON(priv->tx_skb); |
253 | spin_lock_irq(&priv->driver_lock); | 287 | spin_lock_irq(&priv->driver_lock); |
254 | priv->tx_skb = skb; | 288 | priv->tx_skb = skb; |
@@ -257,7 +291,9 @@ static void lbtf_tx_work(struct work_struct *work) | |||
257 | if (err) { | 291 | if (err) { |
258 | dev_kfree_skb_any(skb); | 292 | dev_kfree_skb_any(skb); |
259 | priv->tx_skb = NULL; | 293 | priv->tx_skb = NULL; |
294 | pr_err("TX error: %d", err); | ||
260 | } | 295 | } |
296 | lbtf_deb_leave(LBTF_DEB_MACOPS | LBTF_DEB_TX); | ||
261 | } | 297 | } |
262 | 298 | ||
263 | static int lbtf_op_start(struct ieee80211_hw *hw) | 299 | static int lbtf_op_start(struct ieee80211_hw *hw) |
@@ -266,6 +302,8 @@ static int lbtf_op_start(struct ieee80211_hw *hw) | |||
266 | void *card = priv->card; | 302 | void *card = priv->card; |
267 | int ret = -1; | 303 | int ret = -1; |
268 | 304 | ||
305 | lbtf_deb_enter(LBTF_DEB_MACOPS); | ||
306 | |||
269 | if (!priv->fw_ready) | 307 | if (!priv->fw_ready) |
270 | /* Upload firmware */ | 308 | /* Upload firmware */ |
271 | if (priv->hw_prog_firmware(card)) | 309 | if (priv->hw_prog_firmware(card)) |
@@ -286,10 +324,12 @@ static int lbtf_op_start(struct ieee80211_hw *hw) | |||
286 | } | 324 | } |
287 | 325 | ||
288 | printk(KERN_INFO "libertastf: Marvell WLAN 802.11 thinfirm adapter\n"); | 326 | printk(KERN_INFO "libertastf: Marvell WLAN 802.11 thinfirm adapter\n"); |
327 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
289 | return 0; | 328 | return 0; |
290 | 329 | ||
291 | err_prog_firmware: | 330 | err_prog_firmware: |
292 | priv->hw_reset_device(card); | 331 | priv->hw_reset_device(card); |
332 | lbtf_deb_leave_args(LBTF_DEB_MACOPS, "error programing fw; ret=%d", ret); | ||
293 | return ret; | 333 | return ret; |
294 | } | 334 | } |
295 | 335 | ||
@@ -300,6 +340,9 @@ static void lbtf_op_stop(struct ieee80211_hw *hw) | |||
300 | struct sk_buff *skb; | 340 | struct sk_buff *skb; |
301 | 341 | ||
302 | struct cmd_ctrl_node *cmdnode; | 342 | struct cmd_ctrl_node *cmdnode; |
343 | |||
344 | lbtf_deb_enter(LBTF_DEB_MACOPS); | ||
345 | |||
303 | /* Flush pending command nodes */ | 346 | /* Flush pending command nodes */ |
304 | spin_lock_irqsave(&priv->driver_lock, flags); | 347 | spin_lock_irqsave(&priv->driver_lock, flags); |
305 | list_for_each_entry(cmdnode, &priv->cmdpendingq, list) { | 348 | list_for_each_entry(cmdnode, &priv->cmdpendingq, list) { |
@@ -316,6 +359,7 @@ static void lbtf_op_stop(struct ieee80211_hw *hw) | |||
316 | priv->radioon = RADIO_OFF; | 359 | priv->radioon = RADIO_OFF; |
317 | lbtf_set_radio_control(priv); | 360 | lbtf_set_radio_control(priv); |
318 | 361 | ||
362 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
319 | return; | 363 | return; |
320 | } | 364 | } |
321 | 365 | ||
@@ -323,6 +367,7 @@ static int lbtf_op_add_interface(struct ieee80211_hw *hw, | |||
323 | struct ieee80211_vif *vif) | 367 | struct ieee80211_vif *vif) |
324 | { | 368 | { |
325 | struct lbtf_private *priv = hw->priv; | 369 | struct lbtf_private *priv = hw->priv; |
370 | lbtf_deb_enter(LBTF_DEB_MACOPS); | ||
326 | if (priv->vif != NULL) | 371 | if (priv->vif != NULL) |
327 | return -EOPNOTSUPP; | 372 | return -EOPNOTSUPP; |
328 | 373 | ||
@@ -340,6 +385,7 @@ static int lbtf_op_add_interface(struct ieee80211_hw *hw, | |||
340 | return -EOPNOTSUPP; | 385 | return -EOPNOTSUPP; |
341 | } | 386 | } |
342 | lbtf_set_mac_address(priv, (u8 *) vif->addr); | 387 | lbtf_set_mac_address(priv, (u8 *) vif->addr); |
388 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
343 | return 0; | 389 | return 0; |
344 | } | 390 | } |
345 | 391 | ||
@@ -347,6 +393,7 @@ static void lbtf_op_remove_interface(struct ieee80211_hw *hw, | |||
347 | struct ieee80211_vif *vif) | 393 | struct ieee80211_vif *vif) |
348 | { | 394 | { |
349 | struct lbtf_private *priv = hw->priv; | 395 | struct lbtf_private *priv = hw->priv; |
396 | lbtf_deb_enter(LBTF_DEB_MACOPS); | ||
350 | 397 | ||
351 | if (priv->vif->type == NL80211_IFTYPE_AP || | 398 | if (priv->vif->type == NL80211_IFTYPE_AP || |
352 | priv->vif->type == NL80211_IFTYPE_MESH_POINT) | 399 | priv->vif->type == NL80211_IFTYPE_MESH_POINT) |
@@ -354,17 +401,20 @@ static void lbtf_op_remove_interface(struct ieee80211_hw *hw, | |||
354 | lbtf_set_mode(priv, LBTF_PASSIVE_MODE); | 401 | lbtf_set_mode(priv, LBTF_PASSIVE_MODE); |
355 | lbtf_set_bssid(priv, 0, NULL); | 402 | lbtf_set_bssid(priv, 0, NULL); |
356 | priv->vif = NULL; | 403 | priv->vif = NULL; |
404 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
357 | } | 405 | } |
358 | 406 | ||
359 | static int lbtf_op_config(struct ieee80211_hw *hw, u32 changed) | 407 | static int lbtf_op_config(struct ieee80211_hw *hw, u32 changed) |
360 | { | 408 | { |
361 | struct lbtf_private *priv = hw->priv; | 409 | struct lbtf_private *priv = hw->priv; |
362 | struct ieee80211_conf *conf = &hw->conf; | 410 | struct ieee80211_conf *conf = &hw->conf; |
411 | lbtf_deb_enter(LBTF_DEB_MACOPS); | ||
363 | 412 | ||
364 | if (conf->channel->center_freq != priv->cur_freq) { | 413 | if (conf->channel->center_freq != priv->cur_freq) { |
365 | priv->cur_freq = conf->channel->center_freq; | 414 | priv->cur_freq = conf->channel->center_freq; |
366 | lbtf_set_channel(priv, conf->channel->hw_value); | 415 | lbtf_set_channel(priv, conf->channel->hw_value); |
367 | } | 416 | } |
417 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
368 | return 0; | 418 | return 0; |
369 | } | 419 | } |
370 | 420 | ||
@@ -395,11 +445,16 @@ static void lbtf_op_configure_filter(struct ieee80211_hw *hw, | |||
395 | { | 445 | { |
396 | struct lbtf_private *priv = hw->priv; | 446 | struct lbtf_private *priv = hw->priv; |
397 | int old_mac_control = priv->mac_control; | 447 | int old_mac_control = priv->mac_control; |
448 | |||
449 | lbtf_deb_enter(LBTF_DEB_MACOPS); | ||
450 | |||
398 | changed_flags &= SUPPORTED_FIF_FLAGS; | 451 | changed_flags &= SUPPORTED_FIF_FLAGS; |
399 | *new_flags &= SUPPORTED_FIF_FLAGS; | 452 | *new_flags &= SUPPORTED_FIF_FLAGS; |
400 | 453 | ||
401 | if (!changed_flags) | 454 | if (!changed_flags) { |
455 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
402 | return; | 456 | return; |
457 | } | ||
403 | 458 | ||
404 | if (*new_flags & (FIF_PROMISC_IN_BSS)) | 459 | if (*new_flags & (FIF_PROMISC_IN_BSS)) |
405 | priv->mac_control |= CMD_ACT_MAC_PROMISCUOUS_ENABLE; | 460 | priv->mac_control |= CMD_ACT_MAC_PROMISCUOUS_ENABLE; |
@@ -425,6 +480,8 @@ static void lbtf_op_configure_filter(struct ieee80211_hw *hw, | |||
425 | 480 | ||
426 | if (priv->mac_control != old_mac_control) | 481 | if (priv->mac_control != old_mac_control) |
427 | lbtf_set_mac_control(priv); | 482 | lbtf_set_mac_control(priv); |
483 | |||
484 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
428 | } | 485 | } |
429 | 486 | ||
430 | static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw, | 487 | static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw, |
@@ -434,6 +491,7 @@ static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw, | |||
434 | { | 491 | { |
435 | struct lbtf_private *priv = hw->priv; | 492 | struct lbtf_private *priv = hw->priv; |
436 | struct sk_buff *beacon; | 493 | struct sk_buff *beacon; |
494 | lbtf_deb_enter(LBTF_DEB_MACOPS); | ||
437 | 495 | ||
438 | if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_INT)) { | 496 | if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_INT)) { |
439 | switch (priv->vif->type) { | 497 | switch (priv->vif->type) { |
@@ -464,6 +522,8 @@ static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw, | |||
464 | priv->preamble = CMD_TYPE_LONG_PREAMBLE; | 522 | priv->preamble = CMD_TYPE_LONG_PREAMBLE; |
465 | lbtf_set_radio_control(priv); | 523 | lbtf_set_radio_control(priv); |
466 | } | 524 | } |
525 | |||
526 | lbtf_deb_leave(LBTF_DEB_MACOPS); | ||
467 | } | 527 | } |
468 | 528 | ||
469 | static const struct ieee80211_ops lbtf_ops = { | 529 | static const struct ieee80211_ops lbtf_ops = { |
@@ -486,6 +546,8 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
486 | unsigned int flags; | 546 | unsigned int flags; |
487 | struct ieee80211_hdr *hdr; | 547 | struct ieee80211_hdr *hdr; |
488 | 548 | ||
549 | lbtf_deb_enter(LBTF_DEB_RX); | ||
550 | |||
489 | prxpd = (struct rxpd *) skb->data; | 551 | prxpd = (struct rxpd *) skb->data; |
490 | 552 | ||
491 | stats.flag = 0; | 553 | stats.flag = 0; |
@@ -494,7 +556,6 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
494 | stats.freq = priv->cur_freq; | 556 | stats.freq = priv->cur_freq; |
495 | stats.band = IEEE80211_BAND_2GHZ; | 557 | stats.band = IEEE80211_BAND_2GHZ; |
496 | stats.signal = prxpd->snr; | 558 | stats.signal = prxpd->snr; |
497 | stats.noise = prxpd->nf; | ||
498 | /* Marvell rate index has a hole at value 4 */ | 559 | /* Marvell rate index has a hole at value 4 */ |
499 | if (prxpd->rx_rate > 4) | 560 | if (prxpd->rx_rate > 4) |
500 | --prxpd->rx_rate; | 561 | --prxpd->rx_rate; |
@@ -516,7 +577,15 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
516 | } | 577 | } |
517 | 578 | ||
518 | memcpy(IEEE80211_SKB_RXCB(skb), &stats, sizeof(stats)); | 579 | memcpy(IEEE80211_SKB_RXCB(skb), &stats, sizeof(stats)); |
580 | |||
581 | lbtf_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", | ||
582 | skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); | ||
583 | lbtf_deb_hex(LBTF_DEB_RX, "RX Data", skb->data, | ||
584 | min_t(unsigned int, skb->len, 100)); | ||
585 | |||
519 | ieee80211_rx_irqsafe(priv->hw, skb); | 586 | ieee80211_rx_irqsafe(priv->hw, skb); |
587 | |||
588 | lbtf_deb_leave(LBTF_DEB_RX); | ||
520 | return 0; | 589 | return 0; |
521 | } | 590 | } |
522 | EXPORT_SYMBOL_GPL(lbtf_rx); | 591 | EXPORT_SYMBOL_GPL(lbtf_rx); |
@@ -533,6 +602,8 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev) | |||
533 | struct ieee80211_hw *hw; | 602 | struct ieee80211_hw *hw; |
534 | struct lbtf_private *priv = NULL; | 603 | struct lbtf_private *priv = NULL; |
535 | 604 | ||
605 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
606 | |||
536 | hw = ieee80211_alloc_hw(sizeof(struct lbtf_private), &lbtf_ops); | 607 | hw = ieee80211_alloc_hw(sizeof(struct lbtf_private), &lbtf_ops); |
537 | if (!hw) | 608 | if (!hw) |
538 | goto done; | 609 | goto done; |
@@ -575,6 +646,7 @@ err_init_adapter: | |||
575 | priv = NULL; | 646 | priv = NULL; |
576 | 647 | ||
577 | done: | 648 | done: |
649 | lbtf_deb_leave_args(LBTF_DEB_MAIN, "priv %p", priv); | ||
578 | return priv; | 650 | return priv; |
579 | } | 651 | } |
580 | EXPORT_SYMBOL_GPL(lbtf_add_card); | 652 | EXPORT_SYMBOL_GPL(lbtf_add_card); |
@@ -584,6 +656,8 @@ int lbtf_remove_card(struct lbtf_private *priv) | |||
584 | { | 656 | { |
585 | struct ieee80211_hw *hw = priv->hw; | 657 | struct ieee80211_hw *hw = priv->hw; |
586 | 658 | ||
659 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
660 | |||
587 | priv->surpriseremoved = 1; | 661 | priv->surpriseremoved = 1; |
588 | del_timer(&priv->command_timer); | 662 | del_timer(&priv->command_timer); |
589 | lbtf_free_adapter(priv); | 663 | lbtf_free_adapter(priv); |
@@ -591,6 +665,7 @@ int lbtf_remove_card(struct lbtf_private *priv) | |||
591 | ieee80211_unregister_hw(hw); | 665 | ieee80211_unregister_hw(hw); |
592 | ieee80211_free_hw(hw); | 666 | ieee80211_free_hw(hw); |
593 | 667 | ||
668 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
594 | return 0; | 669 | return 0; |
595 | } | 670 | } |
596 | EXPORT_SYMBOL_GPL(lbtf_remove_card); | 671 | EXPORT_SYMBOL_GPL(lbtf_remove_card); |
@@ -649,17 +724,21 @@ EXPORT_SYMBOL_GPL(lbtf_bcn_sent); | |||
649 | 724 | ||
650 | static int __init lbtf_init_module(void) | 725 | static int __init lbtf_init_module(void) |
651 | { | 726 | { |
727 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
652 | lbtf_wq = create_workqueue("libertastf"); | 728 | lbtf_wq = create_workqueue("libertastf"); |
653 | if (lbtf_wq == NULL) { | 729 | if (lbtf_wq == NULL) { |
654 | printk(KERN_ERR "libertastf: couldn't create workqueue\n"); | 730 | printk(KERN_ERR "libertastf: couldn't create workqueue\n"); |
655 | return -ENOMEM; | 731 | return -ENOMEM; |
656 | } | 732 | } |
733 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
657 | return 0; | 734 | return 0; |
658 | } | 735 | } |
659 | 736 | ||
660 | static void __exit lbtf_exit_module(void) | 737 | static void __exit lbtf_exit_module(void) |
661 | { | 738 | { |
739 | lbtf_deb_enter(LBTF_DEB_MAIN); | ||
662 | destroy_workqueue(lbtf_wq); | 740 | destroy_workqueue(lbtf_wq); |
741 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
663 | } | 742 | } |
664 | 743 | ||
665 | module_init(lbtf_init_module); | 744 | module_init(lbtf_init_module); |