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