2 * Copyright (C) 2008, cozybit Inc.
3 * Copyright (C) 2003-2006, Marvell International Ltd.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
10 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
12 #include <linux/hardirq.h>
13 #include <linux/slab.h>
15 #include <linux/etherdevice.h>
16 #include <linux/module.h>
17 #include "libertas_tf.h"
19 /* thinfirm version: 5.132.X.pX */
20 #define LBTF_FW_VER_MIN 0x05840300
21 #define LBTF_FW_VER_MAX 0x0584ffff
22 #define QOS_CONTROL_LEN 2
24 /* Module parameters */
25 unsigned int lbtf_debug
;
26 EXPORT_SYMBOL_GPL(lbtf_debug
);
27 module_param_named(libertas_tf_debug
, lbtf_debug
, int, 0644);
29 struct workqueue_struct
*lbtf_wq
;
31 static const struct ieee80211_channel lbtf_channels
[] = {
32 { .center_freq
= 2412, .hw_value
= 1 },
33 { .center_freq
= 2417, .hw_value
= 2 },
34 { .center_freq
= 2422, .hw_value
= 3 },
35 { .center_freq
= 2427, .hw_value
= 4 },
36 { .center_freq
= 2432, .hw_value
= 5 },
37 { .center_freq
= 2437, .hw_value
= 6 },
38 { .center_freq
= 2442, .hw_value
= 7 },
39 { .center_freq
= 2447, .hw_value
= 8 },
40 { .center_freq
= 2452, .hw_value
= 9 },
41 { .center_freq
= 2457, .hw_value
= 10 },
42 { .center_freq
= 2462, .hw_value
= 11 },
43 { .center_freq
= 2467, .hw_value
= 12 },
44 { .center_freq
= 2472, .hw_value
= 13 },
45 { .center_freq
= 2484, .hw_value
= 14 },
48 /* This table contains the hardware specific values for the modulation rates. */
49 static const struct ieee80211_rate lbtf_rates
[] = {
54 .flags
= IEEE80211_RATE_SHORT_PREAMBLE
},
57 .flags
= IEEE80211_RATE_SHORT_PREAMBLE
},
60 .flags
= IEEE80211_RATE_SHORT_PREAMBLE
},
87 static void lbtf_cmd_work(struct work_struct
*work
)
89 struct lbtf_private
*priv
= container_of(work
, struct lbtf_private
,
92 lbtf_deb_enter(LBTF_DEB_CMD
);
94 spin_lock_irq(&priv
->driver_lock
);
95 /* command response? */
96 if (priv
->cmd_response_rxed
) {
97 priv
->cmd_response_rxed
= 0;
98 spin_unlock_irq(&priv
->driver_lock
);
99 lbtf_process_rx_command(priv
);
100 spin_lock_irq(&priv
->driver_lock
);
103 if (priv
->cmd_timed_out
&& priv
->cur_cmd
) {
104 struct cmd_ctrl_node
*cmdnode
= priv
->cur_cmd
;
106 if (++priv
->nr_retries
> 10) {
107 lbtf_complete_command(priv
, cmdnode
,
109 priv
->nr_retries
= 0;
111 priv
->cur_cmd
= NULL
;
113 /* Stick it back at the _top_ of the pending
114 * queue for immediate resubmission */
115 list_add(&cmdnode
->list
, &priv
->cmdpendingq
);
118 priv
->cmd_timed_out
= 0;
119 spin_unlock_irq(&priv
->driver_lock
);
121 if (!priv
->fw_ready
) {
122 lbtf_deb_leave_args(LBTF_DEB_CMD
, "fw not ready");
126 /* Execute the next command */
128 lbtf_execute_next_command(priv
);
130 lbtf_deb_leave(LBTF_DEB_CMD
);
134 * lbtf_setup_firmware: initialize firmware.
136 * @priv A pointer to struct lbtf_private structure
138 * Returns: 0 on success.
140 static int lbtf_setup_firmware(struct lbtf_private
*priv
)
144 lbtf_deb_enter(LBTF_DEB_FW
);
146 * Read priv address from HW
148 eth_broadcast_addr(priv
->current_addr
);
149 ret
= lbtf_update_hw_spec(priv
);
155 lbtf_set_mac_control(priv
);
156 lbtf_set_radio_control(priv
);
160 lbtf_deb_leave_args(LBTF_DEB_FW
, "ret: %d", ret
);
165 * This function handles the timeout of command sending.
166 * It will re-send the same command again.
168 static void command_timer_fn(struct timer_list
*t
)
170 struct lbtf_private
*priv
= from_timer(priv
, t
, command_timer
);
172 lbtf_deb_enter(LBTF_DEB_CMD
);
174 spin_lock_irqsave(&priv
->driver_lock
, flags
);
176 if (!priv
->cur_cmd
) {
177 printk(KERN_DEBUG
"libertastf: command timer expired; "
178 "no pending command\n");
182 printk(KERN_DEBUG
"libertas: command %x timed out\n",
183 le16_to_cpu(priv
->cur_cmd
->cmdbuf
->command
));
185 priv
->cmd_timed_out
= 1;
186 queue_work(lbtf_wq
, &priv
->cmd_work
);
188 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
189 lbtf_deb_leave(LBTF_DEB_CMD
);
192 static int lbtf_init_adapter(struct lbtf_private
*priv
)
194 lbtf_deb_enter(LBTF_DEB_MAIN
);
195 eth_broadcast_addr(priv
->current_addr
);
196 mutex_init(&priv
->lock
);
199 timer_setup(&priv
->command_timer
, command_timer_fn
, 0);
201 INIT_LIST_HEAD(&priv
->cmdfreeq
);
202 INIT_LIST_HEAD(&priv
->cmdpendingq
);
204 spin_lock_init(&priv
->driver_lock
);
206 /* Allocate the command buffers */
207 if (lbtf_allocate_cmd_buffer(priv
))
210 lbtf_deb_leave(LBTF_DEB_MAIN
);
214 static void lbtf_free_adapter(struct lbtf_private
*priv
)
216 lbtf_deb_enter(LBTF_DEB_MAIN
);
217 lbtf_free_cmd_buffer(priv
);
218 del_timer(&priv
->command_timer
);
219 lbtf_deb_leave(LBTF_DEB_MAIN
);
222 static void lbtf_op_tx(struct ieee80211_hw
*hw
,
223 struct ieee80211_tx_control
*control
,
226 struct lbtf_private
*priv
= hw
->priv
;
228 priv
->skb_to_tx
= skb
;
229 queue_work(lbtf_wq
, &priv
->tx_work
);
231 * queue will be restarted when we receive transmission feedback if
232 * there are no buffered multicast frames to send
234 ieee80211_stop_queues(priv
->hw
);
237 static void lbtf_tx_work(struct work_struct
*work
)
239 struct lbtf_private
*priv
= container_of(work
, struct lbtf_private
,
242 struct ieee80211_tx_info
*info
;
244 struct sk_buff
*skb
= NULL
;
247 lbtf_deb_enter(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
249 if ((priv
->vif
->type
== NL80211_IFTYPE_AP
) &&
250 (!skb_queue_empty(&priv
->bc_ps_buf
)))
251 skb
= skb_dequeue(&priv
->bc_ps_buf
);
252 else if (priv
->skb_to_tx
) {
253 skb
= priv
->skb_to_tx
;
254 priv
->skb_to_tx
= NULL
;
256 lbtf_deb_leave(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
261 info
= IEEE80211_SKB_CB(skb
);
262 txpd
= skb_push(skb
, sizeof(struct txpd
));
264 if (priv
->surpriseremoved
) {
265 dev_kfree_skb_any(skb
);
266 lbtf_deb_leave(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
270 memset(txpd
, 0, sizeof(struct txpd
));
271 /* Activate per-packet rate selection */
272 txpd
->tx_control
|= cpu_to_le32(MRVL_PER_PACKET_RATE
|
273 ieee80211_get_tx_rate(priv
->hw
, info
)->hw_value
);
275 /* copy destination address from 802.11 header */
276 memcpy(txpd
->tx_dest_addr_high
, skb
->data
+ sizeof(struct txpd
) + 4,
278 txpd
->tx_packet_length
= cpu_to_le16(len
);
279 txpd
->tx_packet_location
= cpu_to_le32(sizeof(struct txpd
));
280 lbtf_deb_hex(LBTF_DEB_TX
, "TX Data", skb
->data
, min_t(unsigned int, skb
->len
, 100));
281 BUG_ON(priv
->tx_skb
);
282 spin_lock_irq(&priv
->driver_lock
);
284 err
= priv
->hw_host_to_card(priv
, MVMS_DAT
, skb
->data
, skb
->len
);
285 spin_unlock_irq(&priv
->driver_lock
);
287 dev_kfree_skb_any(skb
);
289 pr_err("TX error: %d", err
);
291 lbtf_deb_leave(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
294 static int lbtf_op_start(struct ieee80211_hw
*hw
)
296 struct lbtf_private
*priv
= hw
->priv
;
297 void *card
= priv
->card
;
300 lbtf_deb_enter(LBTF_DEB_MACOPS
);
303 /* Upload firmware */
304 if (priv
->hw_prog_firmware(card
))
305 goto err_prog_firmware
;
307 /* poke the firmware */
308 priv
->capability
= WLAN_CAPABILITY_SHORT_PREAMBLE
;
309 priv
->radioon
= RADIO_ON
;
310 priv
->mac_control
= CMD_ACT_MAC_RX_ON
| CMD_ACT_MAC_TX_ON
;
311 ret
= lbtf_setup_firmware(priv
);
313 goto err_prog_firmware
;
315 if ((priv
->fwrelease
< LBTF_FW_VER_MIN
) ||
316 (priv
->fwrelease
> LBTF_FW_VER_MAX
)) {
318 goto err_prog_firmware
;
321 lbtf_deb_leave(LBTF_DEB_MACOPS
);
325 priv
->hw_reset_device(card
);
326 lbtf_deb_leave_args(LBTF_DEB_MACOPS
, "error programming fw; ret=%d", ret
);
330 static void lbtf_op_stop(struct ieee80211_hw
*hw
)
332 struct lbtf_private
*priv
= hw
->priv
;
336 struct cmd_ctrl_node
*cmdnode
;
338 lbtf_deb_enter(LBTF_DEB_MACOPS
);
340 /* Flush pending command nodes */
341 spin_lock_irqsave(&priv
->driver_lock
, flags
);
342 list_for_each_entry(cmdnode
, &priv
->cmdpendingq
, list
) {
343 cmdnode
->result
= -ENOENT
;
344 cmdnode
->cmdwaitqwoken
= 1;
345 wake_up_interruptible(&cmdnode
->cmdwait_q
);
348 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
349 cancel_work_sync(&priv
->cmd_work
);
350 cancel_work_sync(&priv
->tx_work
);
351 while ((skb
= skb_dequeue(&priv
->bc_ps_buf
)))
352 dev_kfree_skb_any(skb
);
353 priv
->radioon
= RADIO_OFF
;
354 lbtf_set_radio_control(priv
);
356 lbtf_deb_leave(LBTF_DEB_MACOPS
);
359 static int lbtf_op_add_interface(struct ieee80211_hw
*hw
,
360 struct ieee80211_vif
*vif
)
362 struct lbtf_private
*priv
= hw
->priv
;
363 lbtf_deb_enter(LBTF_DEB_MACOPS
);
364 if (priv
->vif
!= NULL
)
369 case NL80211_IFTYPE_MESH_POINT
:
370 case NL80211_IFTYPE_AP
:
371 lbtf_set_mode(priv
, LBTF_AP_MODE
);
373 case NL80211_IFTYPE_STATION
:
374 lbtf_set_mode(priv
, LBTF_STA_MODE
);
380 lbtf_set_mac_address(priv
, (u8
*) vif
->addr
);
381 lbtf_deb_leave(LBTF_DEB_MACOPS
);
385 static void lbtf_op_remove_interface(struct ieee80211_hw
*hw
,
386 struct ieee80211_vif
*vif
)
388 struct lbtf_private
*priv
= hw
->priv
;
389 lbtf_deb_enter(LBTF_DEB_MACOPS
);
391 if (priv
->vif
->type
== NL80211_IFTYPE_AP
||
392 priv
->vif
->type
== NL80211_IFTYPE_MESH_POINT
)
393 lbtf_beacon_ctrl(priv
, 0, 0);
394 lbtf_set_mode(priv
, LBTF_PASSIVE_MODE
);
395 lbtf_set_bssid(priv
, 0, NULL
);
397 lbtf_deb_leave(LBTF_DEB_MACOPS
);
400 static int lbtf_op_config(struct ieee80211_hw
*hw
, u32 changed
)
402 struct lbtf_private
*priv
= hw
->priv
;
403 struct ieee80211_conf
*conf
= &hw
->conf
;
404 lbtf_deb_enter(LBTF_DEB_MACOPS
);
406 if (conf
->chandef
.chan
->center_freq
!= priv
->cur_freq
) {
407 priv
->cur_freq
= conf
->chandef
.chan
->center_freq
;
408 lbtf_set_channel(priv
, conf
->chandef
.chan
->hw_value
);
410 lbtf_deb_leave(LBTF_DEB_MACOPS
);
414 static u64
lbtf_op_prepare_multicast(struct ieee80211_hw
*hw
,
415 struct netdev_hw_addr_list
*mc_list
)
417 struct lbtf_private
*priv
= hw
->priv
;
419 struct netdev_hw_addr
*ha
;
420 int mc_count
= netdev_hw_addr_list_count(mc_list
);
422 if (!mc_count
|| mc_count
> MRVDRV_MAX_MULTICAST_LIST_SIZE
)
425 priv
->nr_of_multicastmacaddr
= mc_count
;
427 netdev_hw_addr_list_for_each(ha
, mc_list
)
428 memcpy(&priv
->multicastlist
[i
++], ha
->addr
, ETH_ALEN
);
433 #define SUPPORTED_FIF_FLAGS FIF_ALLMULTI
434 static void lbtf_op_configure_filter(struct ieee80211_hw
*hw
,
435 unsigned int changed_flags
,
436 unsigned int *new_flags
,
439 struct lbtf_private
*priv
= hw
->priv
;
440 int old_mac_control
= priv
->mac_control
;
442 lbtf_deb_enter(LBTF_DEB_MACOPS
);
444 changed_flags
&= SUPPORTED_FIF_FLAGS
;
445 *new_flags
&= SUPPORTED_FIF_FLAGS
;
447 if (!changed_flags
) {
448 lbtf_deb_leave(LBTF_DEB_MACOPS
);
452 priv
->mac_control
&= ~CMD_ACT_MAC_PROMISCUOUS_ENABLE
;
453 if (*new_flags
& (FIF_ALLMULTI
) ||
454 multicast
> MRVDRV_MAX_MULTICAST_LIST_SIZE
) {
455 priv
->mac_control
|= CMD_ACT_MAC_ALL_MULTICAST_ENABLE
;
456 priv
->mac_control
&= ~CMD_ACT_MAC_MULTICAST_ENABLE
;
457 } else if (multicast
) {
458 priv
->mac_control
|= CMD_ACT_MAC_MULTICAST_ENABLE
;
459 priv
->mac_control
&= ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE
;
460 lbtf_cmd_set_mac_multicast_addr(priv
);
462 priv
->mac_control
&= ~(CMD_ACT_MAC_MULTICAST_ENABLE
|
463 CMD_ACT_MAC_ALL_MULTICAST_ENABLE
);
464 if (priv
->nr_of_multicastmacaddr
) {
465 priv
->nr_of_multicastmacaddr
= 0;
466 lbtf_cmd_set_mac_multicast_addr(priv
);
471 if (priv
->mac_control
!= old_mac_control
)
472 lbtf_set_mac_control(priv
);
474 lbtf_deb_leave(LBTF_DEB_MACOPS
);
477 static void lbtf_op_bss_info_changed(struct ieee80211_hw
*hw
,
478 struct ieee80211_vif
*vif
,
479 struct ieee80211_bss_conf
*bss_conf
,
482 struct lbtf_private
*priv
= hw
->priv
;
483 struct sk_buff
*beacon
;
484 lbtf_deb_enter(LBTF_DEB_MACOPS
);
486 if (changes
& (BSS_CHANGED_BEACON
| BSS_CHANGED_BEACON_INT
)) {
487 switch (priv
->vif
->type
) {
488 case NL80211_IFTYPE_AP
:
489 case NL80211_IFTYPE_MESH_POINT
:
490 beacon
= ieee80211_beacon_get(hw
, vif
);
492 lbtf_beacon_set(priv
, beacon
);
494 lbtf_beacon_ctrl(priv
, 1,
495 bss_conf
->beacon_int
);
503 if (changes
& BSS_CHANGED_BSSID
) {
504 bool activate
= !is_zero_ether_addr(bss_conf
->bssid
);
505 lbtf_set_bssid(priv
, activate
, bss_conf
->bssid
);
508 if (changes
& BSS_CHANGED_ERP_PREAMBLE
) {
509 if (bss_conf
->use_short_preamble
)
510 priv
->preamble
= CMD_TYPE_SHORT_PREAMBLE
;
512 priv
->preamble
= CMD_TYPE_LONG_PREAMBLE
;
513 lbtf_set_radio_control(priv
);
516 lbtf_deb_leave(LBTF_DEB_MACOPS
);
519 static int lbtf_op_get_survey(struct ieee80211_hw
*hw
, int idx
,
520 struct survey_info
*survey
)
522 struct lbtf_private
*priv
= hw
->priv
;
523 struct ieee80211_conf
*conf
= &hw
->conf
;
528 survey
->channel
= conf
->chandef
.chan
;
529 survey
->filled
= SURVEY_INFO_NOISE_DBM
;
530 survey
->noise
= priv
->noise
;
535 static const struct ieee80211_ops lbtf_ops
= {
537 .start
= lbtf_op_start
,
538 .stop
= lbtf_op_stop
,
539 .add_interface
= lbtf_op_add_interface
,
540 .remove_interface
= lbtf_op_remove_interface
,
541 .config
= lbtf_op_config
,
542 .prepare_multicast
= lbtf_op_prepare_multicast
,
543 .configure_filter
= lbtf_op_configure_filter
,
544 .bss_info_changed
= lbtf_op_bss_info_changed
,
545 .get_survey
= lbtf_op_get_survey
,
548 int lbtf_rx(struct lbtf_private
*priv
, struct sk_buff
*skb
)
550 struct ieee80211_rx_status stats
;
554 struct ieee80211_hdr
*hdr
;
556 lbtf_deb_enter(LBTF_DEB_RX
);
558 prxpd
= (struct rxpd
*) skb
->data
;
560 memset(&stats
, 0, sizeof(stats
));
561 if (!(prxpd
->status
& cpu_to_le16(MRVDRV_RXPD_STATUS_OK
)))
562 stats
.flag
|= RX_FLAG_FAILED_FCS_CRC
;
563 stats
.freq
= priv
->cur_freq
;
564 stats
.band
= NL80211_BAND_2GHZ
;
565 stats
.signal
= prxpd
->snr
- prxpd
->nf
;
566 priv
->noise
= prxpd
->nf
;
567 /* Marvell rate index has a hole at value 4 */
568 if (prxpd
->rx_rate
> 4)
570 stats
.rate_idx
= prxpd
->rx_rate
;
571 skb_pull(skb
, sizeof(struct rxpd
));
573 hdr
= (struct ieee80211_hdr
*)skb
->data
;
574 flags
= le32_to_cpu(*(__le32
*)(skb
->data
+ 4));
576 need_padding
= ieee80211_is_data_qos(hdr
->frame_control
);
577 need_padding
^= ieee80211_has_a4(hdr
->frame_control
);
578 need_padding
^= ieee80211_is_data_qos(hdr
->frame_control
) &&
579 (*ieee80211_get_qos_ctl(hdr
) &
580 IEEE80211_QOS_CTL_A_MSDU_PRESENT
);
583 memmove(skb
->data
+ 2, skb
->data
, skb
->len
);
587 memcpy(IEEE80211_SKB_RXCB(skb
), &stats
, sizeof(stats
));
589 lbtf_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
590 skb
->len
, sizeof(struct rxpd
), skb
->len
- sizeof(struct rxpd
));
591 lbtf_deb_hex(LBTF_DEB_RX
, "RX Data", skb
->data
,
592 min_t(unsigned int, skb
->len
, 100));
594 ieee80211_rx_irqsafe(priv
->hw
, skb
);
596 lbtf_deb_leave(LBTF_DEB_RX
);
599 EXPORT_SYMBOL_GPL(lbtf_rx
);
602 * lbtf_add_card: Add and initialize the card, no fw upload yet.
604 * @card A pointer to card
606 * Returns: pointer to struct lbtf_priv.
608 struct lbtf_private
*lbtf_add_card(void *card
, struct device
*dmdev
)
610 struct ieee80211_hw
*hw
;
611 struct lbtf_private
*priv
= NULL
;
613 lbtf_deb_enter(LBTF_DEB_MAIN
);
615 hw
= ieee80211_alloc_hw(sizeof(struct lbtf_private
), &lbtf_ops
);
620 if (lbtf_init_adapter(priv
))
621 goto err_init_adapter
;
628 ieee80211_hw_set(hw
, HOST_BROADCAST_PS_BUFFERING
);
629 ieee80211_hw_set(hw
, SIGNAL_DBM
);
630 hw
->extra_tx_headroom
= sizeof(struct txpd
);
631 memcpy(priv
->channels
, lbtf_channels
, sizeof(lbtf_channels
));
632 memcpy(priv
->rates
, lbtf_rates
, sizeof(lbtf_rates
));
633 priv
->band
.n_bitrates
= ARRAY_SIZE(lbtf_rates
);
634 priv
->band
.bitrates
= priv
->rates
;
635 priv
->band
.n_channels
= ARRAY_SIZE(lbtf_channels
);
636 priv
->band
.channels
= priv
->channels
;
637 hw
->wiphy
->bands
[NL80211_BAND_2GHZ
] = &priv
->band
;
638 hw
->wiphy
->interface_modes
=
639 BIT(NL80211_IFTYPE_STATION
) |
640 BIT(NL80211_IFTYPE_ADHOC
);
641 skb_queue_head_init(&priv
->bc_ps_buf
);
643 wiphy_ext_feature_set(hw
->wiphy
, NL80211_EXT_FEATURE_CQM_RSSI_LIST
);
645 SET_IEEE80211_DEV(hw
, dmdev
);
647 INIT_WORK(&priv
->cmd_work
, lbtf_cmd_work
);
648 INIT_WORK(&priv
->tx_work
, lbtf_tx_work
);
649 if (ieee80211_register_hw(hw
))
650 goto err_init_adapter
;
652 dev_info(dmdev
, "libertastf: Marvell WLAN 802.11 thinfirm adapter\n");
656 lbtf_free_adapter(priv
);
657 ieee80211_free_hw(hw
);
661 lbtf_deb_leave_args(LBTF_DEB_MAIN
, "priv %p", priv
);
664 EXPORT_SYMBOL_GPL(lbtf_add_card
);
667 int lbtf_remove_card(struct lbtf_private
*priv
)
669 struct ieee80211_hw
*hw
= priv
->hw
;
671 lbtf_deb_enter(LBTF_DEB_MAIN
);
673 priv
->surpriseremoved
= 1;
674 del_timer(&priv
->command_timer
);
675 lbtf_free_adapter(priv
);
677 ieee80211_unregister_hw(hw
);
678 ieee80211_free_hw(hw
);
680 lbtf_deb_leave(LBTF_DEB_MAIN
);
683 EXPORT_SYMBOL_GPL(lbtf_remove_card
);
685 void lbtf_send_tx_feedback(struct lbtf_private
*priv
, u8 retrycnt
, u8 fail
)
687 struct ieee80211_tx_info
*info
= IEEE80211_SKB_CB(priv
->tx_skb
);
689 ieee80211_tx_info_clear_status(info
);
691 * Commented out, otherwise we never go beyond 1Mbit/s using mac80211
692 * default pid rc algorithm.
694 * info->status.retry_count = MRVL_DEFAULT_RETRIES - retrycnt;
696 if (!(info
->flags
& IEEE80211_TX_CTL_NO_ACK
) && !fail
)
697 info
->flags
|= IEEE80211_TX_STAT_ACK
;
698 skb_pull(priv
->tx_skb
, sizeof(struct txpd
));
699 ieee80211_tx_status_irqsafe(priv
->hw
, priv
->tx_skb
);
701 if (!priv
->skb_to_tx
&& skb_queue_empty(&priv
->bc_ps_buf
))
702 ieee80211_wake_queues(priv
->hw
);
704 queue_work(lbtf_wq
, &priv
->tx_work
);
706 EXPORT_SYMBOL_GPL(lbtf_send_tx_feedback
);
708 void lbtf_bcn_sent(struct lbtf_private
*priv
)
710 struct sk_buff
*skb
= NULL
;
712 if (priv
->vif
->type
!= NL80211_IFTYPE_AP
)
715 if (skb_queue_empty(&priv
->bc_ps_buf
)) {
716 bool tx_buff_bc
= false;
718 while ((skb
= ieee80211_get_buffered_bc(priv
->hw
, priv
->vif
))) {
719 skb_queue_tail(&priv
->bc_ps_buf
, skb
);
723 ieee80211_stop_queues(priv
->hw
);
724 queue_work(lbtf_wq
, &priv
->tx_work
);
728 skb
= ieee80211_beacon_get(priv
->hw
, priv
->vif
);
731 lbtf_beacon_set(priv
, skb
);
735 EXPORT_SYMBOL_GPL(lbtf_bcn_sent
);
737 static int __init
lbtf_init_module(void)
739 lbtf_deb_enter(LBTF_DEB_MAIN
);
740 lbtf_wq
= alloc_workqueue("libertastf", WQ_MEM_RECLAIM
, 0);
741 if (lbtf_wq
== NULL
) {
742 printk(KERN_ERR
"libertastf: couldn't create workqueue\n");
745 lbtf_deb_leave(LBTF_DEB_MAIN
);
749 static void __exit
lbtf_exit_module(void)
751 lbtf_deb_enter(LBTF_DEB_MAIN
);
752 destroy_workqueue(lbtf_wq
);
753 lbtf_deb_leave(LBTF_DEB_MAIN
);
756 module_init(lbtf_init_module
);
757 module_exit(lbtf_exit_module
);
759 MODULE_DESCRIPTION("Libertas WLAN Thinfirm Driver Library");
760 MODULE_AUTHOR("Cozybit Inc.");
761 MODULE_LICENSE("GPL");