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 printk(KERN_INFO
"libertastf: Marvell WLAN 802.11 thinfirm adapter\n");
322 lbtf_deb_leave(LBTF_DEB_MACOPS
);
326 priv
->hw_reset_device(card
);
327 lbtf_deb_leave_args(LBTF_DEB_MACOPS
, "error programming fw; ret=%d", ret
);
331 static void lbtf_op_stop(struct ieee80211_hw
*hw
)
333 struct lbtf_private
*priv
= hw
->priv
;
337 struct cmd_ctrl_node
*cmdnode
;
339 lbtf_deb_enter(LBTF_DEB_MACOPS
);
341 /* Flush pending command nodes */
342 spin_lock_irqsave(&priv
->driver_lock
, flags
);
343 list_for_each_entry(cmdnode
, &priv
->cmdpendingq
, list
) {
344 cmdnode
->result
= -ENOENT
;
345 cmdnode
->cmdwaitqwoken
= 1;
346 wake_up_interruptible(&cmdnode
->cmdwait_q
);
349 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
350 cancel_work_sync(&priv
->cmd_work
);
351 cancel_work_sync(&priv
->tx_work
);
352 while ((skb
= skb_dequeue(&priv
->bc_ps_buf
)))
353 dev_kfree_skb_any(skb
);
354 priv
->radioon
= RADIO_OFF
;
355 lbtf_set_radio_control(priv
);
357 lbtf_deb_leave(LBTF_DEB_MACOPS
);
360 static int lbtf_op_add_interface(struct ieee80211_hw
*hw
,
361 struct ieee80211_vif
*vif
)
363 struct lbtf_private
*priv
= hw
->priv
;
364 lbtf_deb_enter(LBTF_DEB_MACOPS
);
365 if (priv
->vif
!= NULL
)
370 case NL80211_IFTYPE_MESH_POINT
:
371 case NL80211_IFTYPE_AP
:
372 lbtf_set_mode(priv
, LBTF_AP_MODE
);
374 case NL80211_IFTYPE_STATION
:
375 lbtf_set_mode(priv
, LBTF_STA_MODE
);
381 lbtf_set_mac_address(priv
, (u8
*) vif
->addr
);
382 lbtf_deb_leave(LBTF_DEB_MACOPS
);
386 static void lbtf_op_remove_interface(struct ieee80211_hw
*hw
,
387 struct ieee80211_vif
*vif
)
389 struct lbtf_private
*priv
= hw
->priv
;
390 lbtf_deb_enter(LBTF_DEB_MACOPS
);
392 if (priv
->vif
->type
== NL80211_IFTYPE_AP
||
393 priv
->vif
->type
== NL80211_IFTYPE_MESH_POINT
)
394 lbtf_beacon_ctrl(priv
, 0, 0);
395 lbtf_set_mode(priv
, LBTF_PASSIVE_MODE
);
396 lbtf_set_bssid(priv
, 0, NULL
);
398 lbtf_deb_leave(LBTF_DEB_MACOPS
);
401 static int lbtf_op_config(struct ieee80211_hw
*hw
, u32 changed
)
403 struct lbtf_private
*priv
= hw
->priv
;
404 struct ieee80211_conf
*conf
= &hw
->conf
;
405 lbtf_deb_enter(LBTF_DEB_MACOPS
);
407 if (conf
->chandef
.chan
->center_freq
!= priv
->cur_freq
) {
408 priv
->cur_freq
= conf
->chandef
.chan
->center_freq
;
409 lbtf_set_channel(priv
, conf
->chandef
.chan
->hw_value
);
411 lbtf_deb_leave(LBTF_DEB_MACOPS
);
415 static u64
lbtf_op_prepare_multicast(struct ieee80211_hw
*hw
,
416 struct netdev_hw_addr_list
*mc_list
)
418 struct lbtf_private
*priv
= hw
->priv
;
420 struct netdev_hw_addr
*ha
;
421 int mc_count
= netdev_hw_addr_list_count(mc_list
);
423 if (!mc_count
|| mc_count
> MRVDRV_MAX_MULTICAST_LIST_SIZE
)
426 priv
->nr_of_multicastmacaddr
= mc_count
;
428 netdev_hw_addr_list_for_each(ha
, mc_list
)
429 memcpy(&priv
->multicastlist
[i
++], ha
->addr
, ETH_ALEN
);
434 #define SUPPORTED_FIF_FLAGS FIF_ALLMULTI
435 static void lbtf_op_configure_filter(struct ieee80211_hw
*hw
,
436 unsigned int changed_flags
,
437 unsigned int *new_flags
,
440 struct lbtf_private
*priv
= hw
->priv
;
441 int old_mac_control
= priv
->mac_control
;
443 lbtf_deb_enter(LBTF_DEB_MACOPS
);
445 changed_flags
&= SUPPORTED_FIF_FLAGS
;
446 *new_flags
&= SUPPORTED_FIF_FLAGS
;
448 if (!changed_flags
) {
449 lbtf_deb_leave(LBTF_DEB_MACOPS
);
453 priv
->mac_control
&= ~CMD_ACT_MAC_PROMISCUOUS_ENABLE
;
454 if (*new_flags
& (FIF_ALLMULTI
) ||
455 multicast
> MRVDRV_MAX_MULTICAST_LIST_SIZE
) {
456 priv
->mac_control
|= CMD_ACT_MAC_ALL_MULTICAST_ENABLE
;
457 priv
->mac_control
&= ~CMD_ACT_MAC_MULTICAST_ENABLE
;
458 } else if (multicast
) {
459 priv
->mac_control
|= CMD_ACT_MAC_MULTICAST_ENABLE
;
460 priv
->mac_control
&= ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE
;
461 lbtf_cmd_set_mac_multicast_addr(priv
);
463 priv
->mac_control
&= ~(CMD_ACT_MAC_MULTICAST_ENABLE
|
464 CMD_ACT_MAC_ALL_MULTICAST_ENABLE
);
465 if (priv
->nr_of_multicastmacaddr
) {
466 priv
->nr_of_multicastmacaddr
= 0;
467 lbtf_cmd_set_mac_multicast_addr(priv
);
472 if (priv
->mac_control
!= old_mac_control
)
473 lbtf_set_mac_control(priv
);
475 lbtf_deb_leave(LBTF_DEB_MACOPS
);
478 static void lbtf_op_bss_info_changed(struct ieee80211_hw
*hw
,
479 struct ieee80211_vif
*vif
,
480 struct ieee80211_bss_conf
*bss_conf
,
483 struct lbtf_private
*priv
= hw
->priv
;
484 struct sk_buff
*beacon
;
485 lbtf_deb_enter(LBTF_DEB_MACOPS
);
487 if (changes
& (BSS_CHANGED_BEACON
| BSS_CHANGED_BEACON_INT
)) {
488 switch (priv
->vif
->type
) {
489 case NL80211_IFTYPE_AP
:
490 case NL80211_IFTYPE_MESH_POINT
:
491 beacon
= ieee80211_beacon_get(hw
, vif
);
493 lbtf_beacon_set(priv
, beacon
);
495 lbtf_beacon_ctrl(priv
, 1,
496 bss_conf
->beacon_int
);
504 if (changes
& BSS_CHANGED_BSSID
) {
505 bool activate
= !is_zero_ether_addr(bss_conf
->bssid
);
506 lbtf_set_bssid(priv
, activate
, bss_conf
->bssid
);
509 if (changes
& BSS_CHANGED_ERP_PREAMBLE
) {
510 if (bss_conf
->use_short_preamble
)
511 priv
->preamble
= CMD_TYPE_SHORT_PREAMBLE
;
513 priv
->preamble
= CMD_TYPE_LONG_PREAMBLE
;
514 lbtf_set_radio_control(priv
);
517 lbtf_deb_leave(LBTF_DEB_MACOPS
);
520 static int lbtf_op_get_survey(struct ieee80211_hw
*hw
, int idx
,
521 struct survey_info
*survey
)
523 struct lbtf_private
*priv
= hw
->priv
;
524 struct ieee80211_conf
*conf
= &hw
->conf
;
529 survey
->channel
= conf
->chandef
.chan
;
530 survey
->filled
= SURVEY_INFO_NOISE_DBM
;
531 survey
->noise
= priv
->noise
;
536 static const struct ieee80211_ops lbtf_ops
= {
538 .start
= lbtf_op_start
,
539 .stop
= lbtf_op_stop
,
540 .add_interface
= lbtf_op_add_interface
,
541 .remove_interface
= lbtf_op_remove_interface
,
542 .config
= lbtf_op_config
,
543 .prepare_multicast
= lbtf_op_prepare_multicast
,
544 .configure_filter
= lbtf_op_configure_filter
,
545 .bss_info_changed
= lbtf_op_bss_info_changed
,
546 .get_survey
= lbtf_op_get_survey
,
549 int lbtf_rx(struct lbtf_private
*priv
, struct sk_buff
*skb
)
551 struct ieee80211_rx_status stats
;
555 struct ieee80211_hdr
*hdr
;
557 lbtf_deb_enter(LBTF_DEB_RX
);
559 prxpd
= (struct rxpd
*) skb
->data
;
561 memset(&stats
, 0, sizeof(stats
));
562 if (!(prxpd
->status
& cpu_to_le16(MRVDRV_RXPD_STATUS_OK
)))
563 stats
.flag
|= RX_FLAG_FAILED_FCS_CRC
;
564 stats
.freq
= priv
->cur_freq
;
565 stats
.band
= NL80211_BAND_2GHZ
;
566 stats
.signal
= prxpd
->snr
;
567 priv
->noise
= prxpd
->nf
;
568 /* Marvell rate index has a hole at value 4 */
569 if (prxpd
->rx_rate
> 4)
571 stats
.rate_idx
= prxpd
->rx_rate
;
572 skb_pull(skb
, sizeof(struct rxpd
));
574 hdr
= (struct ieee80211_hdr
*)skb
->data
;
575 flags
= le32_to_cpu(*(__le32
*)(skb
->data
+ 4));
577 need_padding
= ieee80211_is_data_qos(hdr
->frame_control
);
578 need_padding
^= ieee80211_has_a4(hdr
->frame_control
);
579 need_padding
^= ieee80211_is_data_qos(hdr
->frame_control
) &&
580 (*ieee80211_get_qos_ctl(hdr
) &
581 IEEE80211_QOS_CTL_A_MSDU_PRESENT
);
584 memmove(skb
->data
+ 2, skb
->data
, skb
->len
);
588 memcpy(IEEE80211_SKB_RXCB(skb
), &stats
, sizeof(stats
));
590 lbtf_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
591 skb
->len
, sizeof(struct rxpd
), skb
->len
- sizeof(struct rxpd
));
592 lbtf_deb_hex(LBTF_DEB_RX
, "RX Data", skb
->data
,
593 min_t(unsigned int, skb
->len
, 100));
595 ieee80211_rx_irqsafe(priv
->hw
, skb
);
597 lbtf_deb_leave(LBTF_DEB_RX
);
600 EXPORT_SYMBOL_GPL(lbtf_rx
);
603 * lbtf_add_card: Add and initialize the card, no fw upload yet.
605 * @card A pointer to card
607 * Returns: pointer to struct lbtf_priv.
609 struct lbtf_private
*lbtf_add_card(void *card
, struct device
*dmdev
)
611 struct ieee80211_hw
*hw
;
612 struct lbtf_private
*priv
= NULL
;
614 lbtf_deb_enter(LBTF_DEB_MAIN
);
616 hw
= ieee80211_alloc_hw(sizeof(struct lbtf_private
), &lbtf_ops
);
621 if (lbtf_init_adapter(priv
))
622 goto err_init_adapter
;
629 ieee80211_hw_set(hw
, HOST_BROADCAST_PS_BUFFERING
);
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
;
655 lbtf_free_adapter(priv
);
656 ieee80211_free_hw(hw
);
660 lbtf_deb_leave_args(LBTF_DEB_MAIN
, "priv %p", priv
);
663 EXPORT_SYMBOL_GPL(lbtf_add_card
);
666 int lbtf_remove_card(struct lbtf_private
*priv
)
668 struct ieee80211_hw
*hw
= priv
->hw
;
670 lbtf_deb_enter(LBTF_DEB_MAIN
);
672 priv
->surpriseremoved
= 1;
673 del_timer(&priv
->command_timer
);
674 lbtf_free_adapter(priv
);
676 ieee80211_unregister_hw(hw
);
677 ieee80211_free_hw(hw
);
679 lbtf_deb_leave(LBTF_DEB_MAIN
);
682 EXPORT_SYMBOL_GPL(lbtf_remove_card
);
684 void lbtf_send_tx_feedback(struct lbtf_private
*priv
, u8 retrycnt
, u8 fail
)
686 struct ieee80211_tx_info
*info
= IEEE80211_SKB_CB(priv
->tx_skb
);
688 ieee80211_tx_info_clear_status(info
);
690 * Commented out, otherwise we never go beyond 1Mbit/s using mac80211
691 * default pid rc algorithm.
693 * info->status.retry_count = MRVL_DEFAULT_RETRIES - retrycnt;
695 if (!(info
->flags
& IEEE80211_TX_CTL_NO_ACK
) && !fail
)
696 info
->flags
|= IEEE80211_TX_STAT_ACK
;
697 skb_pull(priv
->tx_skb
, sizeof(struct txpd
));
698 ieee80211_tx_status_irqsafe(priv
->hw
, priv
->tx_skb
);
700 if (!priv
->skb_to_tx
&& skb_queue_empty(&priv
->bc_ps_buf
))
701 ieee80211_wake_queues(priv
->hw
);
703 queue_work(lbtf_wq
, &priv
->tx_work
);
705 EXPORT_SYMBOL_GPL(lbtf_send_tx_feedback
);
707 void lbtf_bcn_sent(struct lbtf_private
*priv
)
709 struct sk_buff
*skb
= NULL
;
711 if (priv
->vif
->type
!= NL80211_IFTYPE_AP
)
714 if (skb_queue_empty(&priv
->bc_ps_buf
)) {
715 bool tx_buff_bc
= false;
717 while ((skb
= ieee80211_get_buffered_bc(priv
->hw
, priv
->vif
))) {
718 skb_queue_tail(&priv
->bc_ps_buf
, skb
);
722 ieee80211_stop_queues(priv
->hw
);
723 queue_work(lbtf_wq
, &priv
->tx_work
);
727 skb
= ieee80211_beacon_get(priv
->hw
, priv
->vif
);
730 lbtf_beacon_set(priv
, skb
);
734 EXPORT_SYMBOL_GPL(lbtf_bcn_sent
);
736 static int __init
lbtf_init_module(void)
738 lbtf_deb_enter(LBTF_DEB_MAIN
);
739 lbtf_wq
= alloc_workqueue("libertastf", WQ_MEM_RECLAIM
, 0);
740 if (lbtf_wq
== NULL
) {
741 printk(KERN_ERR
"libertastf: couldn't create workqueue\n");
744 lbtf_deb_leave(LBTF_DEB_MAIN
);
748 static void __exit
lbtf_exit_module(void)
750 lbtf_deb_enter(LBTF_DEB_MAIN
);
751 destroy_workqueue(lbtf_wq
);
752 lbtf_deb_leave(LBTF_DEB_MAIN
);
755 module_init(lbtf_init_module
);
756 module_exit(lbtf_exit_module
);
758 MODULE_DESCRIPTION("Libertas WLAN Thinfirm Driver Library");
759 MODULE_AUTHOR("Cozybit Inc.");
760 MODULE_LICENSE("GPL");