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 #define DRIVER_RELEASE_VERSION "004.p0"
20 /* thinfirm version: 5.132.X.pX */
21 #define LBTF_FW_VER_MIN 0x05840300
22 #define LBTF_FW_VER_MAX 0x0584ffff
23 #define QOS_CONTROL_LEN 2
25 /* Module parameters */
26 unsigned int lbtf_debug
;
27 EXPORT_SYMBOL_GPL(lbtf_debug
);
28 module_param_named(libertas_tf_debug
, lbtf_debug
, int, 0644);
30 static const char lbtf_driver_version
[] = "THINFIRM-USB8388-" DRIVER_RELEASE_VERSION
36 struct workqueue_struct
*lbtf_wq
;
38 static const struct ieee80211_channel lbtf_channels
[] = {
39 { .center_freq
= 2412, .hw_value
= 1 },
40 { .center_freq
= 2417, .hw_value
= 2 },
41 { .center_freq
= 2422, .hw_value
= 3 },
42 { .center_freq
= 2427, .hw_value
= 4 },
43 { .center_freq
= 2432, .hw_value
= 5 },
44 { .center_freq
= 2437, .hw_value
= 6 },
45 { .center_freq
= 2442, .hw_value
= 7 },
46 { .center_freq
= 2447, .hw_value
= 8 },
47 { .center_freq
= 2452, .hw_value
= 9 },
48 { .center_freq
= 2457, .hw_value
= 10 },
49 { .center_freq
= 2462, .hw_value
= 11 },
50 { .center_freq
= 2467, .hw_value
= 12 },
51 { .center_freq
= 2472, .hw_value
= 13 },
52 { .center_freq
= 2484, .hw_value
= 14 },
55 /* This table contains the hardware specific values for the modulation rates. */
56 static const struct ieee80211_rate lbtf_rates
[] = {
61 .flags
= IEEE80211_RATE_SHORT_PREAMBLE
},
64 .flags
= IEEE80211_RATE_SHORT_PREAMBLE
},
67 .flags
= IEEE80211_RATE_SHORT_PREAMBLE
},
94 static void lbtf_cmd_work(struct work_struct
*work
)
96 struct lbtf_private
*priv
= container_of(work
, struct lbtf_private
,
99 lbtf_deb_enter(LBTF_DEB_CMD
);
101 spin_lock_irq(&priv
->driver_lock
);
102 /* command response? */
103 if (priv
->cmd_response_rxed
) {
104 priv
->cmd_response_rxed
= 0;
105 spin_unlock_irq(&priv
->driver_lock
);
106 lbtf_process_rx_command(priv
);
107 spin_lock_irq(&priv
->driver_lock
);
110 if (priv
->cmd_timed_out
&& priv
->cur_cmd
) {
111 struct cmd_ctrl_node
*cmdnode
= priv
->cur_cmd
;
113 if (++priv
->nr_retries
> 10) {
114 lbtf_complete_command(priv
, cmdnode
,
116 priv
->nr_retries
= 0;
118 priv
->cur_cmd
= NULL
;
120 /* Stick it back at the _top_ of the pending
121 * queue for immediate resubmission */
122 list_add(&cmdnode
->list
, &priv
->cmdpendingq
);
125 priv
->cmd_timed_out
= 0;
126 spin_unlock_irq(&priv
->driver_lock
);
128 if (!priv
->fw_ready
) {
129 lbtf_deb_leave_args(LBTF_DEB_CMD
, "fw not ready");
133 /* Execute the next command */
135 lbtf_execute_next_command(priv
);
137 lbtf_deb_leave(LBTF_DEB_CMD
);
141 * lbtf_setup_firmware: initialize firmware.
143 * @priv A pointer to struct lbtf_private structure
145 * Returns: 0 on success.
147 static int lbtf_setup_firmware(struct lbtf_private
*priv
)
151 lbtf_deb_enter(LBTF_DEB_FW
);
153 * Read priv address from HW
155 eth_broadcast_addr(priv
->current_addr
);
156 ret
= lbtf_update_hw_spec(priv
);
162 lbtf_set_mac_control(priv
);
163 lbtf_set_radio_control(priv
);
167 lbtf_deb_leave_args(LBTF_DEB_FW
, "ret: %d", ret
);
172 * This function handles the timeout of command sending.
173 * It will re-send the same command again.
175 static void command_timer_fn(unsigned long data
)
177 struct lbtf_private
*priv
= (struct lbtf_private
*)data
;
179 lbtf_deb_enter(LBTF_DEB_CMD
);
181 spin_lock_irqsave(&priv
->driver_lock
, flags
);
183 if (!priv
->cur_cmd
) {
184 printk(KERN_DEBUG
"libertastf: command timer expired; "
185 "no pending command\n");
189 printk(KERN_DEBUG
"libertas: command %x timed out\n",
190 le16_to_cpu(priv
->cur_cmd
->cmdbuf
->command
));
192 priv
->cmd_timed_out
= 1;
193 queue_work(lbtf_wq
, &priv
->cmd_work
);
195 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
196 lbtf_deb_leave(LBTF_DEB_CMD
);
199 static int lbtf_init_adapter(struct lbtf_private
*priv
)
201 lbtf_deb_enter(LBTF_DEB_MAIN
);
202 eth_broadcast_addr(priv
->current_addr
);
203 mutex_init(&priv
->lock
);
206 setup_timer(&priv
->command_timer
, command_timer_fn
,
207 (unsigned long)priv
);
209 INIT_LIST_HEAD(&priv
->cmdfreeq
);
210 INIT_LIST_HEAD(&priv
->cmdpendingq
);
212 spin_lock_init(&priv
->driver_lock
);
214 /* Allocate the command buffers */
215 if (lbtf_allocate_cmd_buffer(priv
))
218 lbtf_deb_leave(LBTF_DEB_MAIN
);
222 static void lbtf_free_adapter(struct lbtf_private
*priv
)
224 lbtf_deb_enter(LBTF_DEB_MAIN
);
225 lbtf_free_cmd_buffer(priv
);
226 del_timer(&priv
->command_timer
);
227 lbtf_deb_leave(LBTF_DEB_MAIN
);
230 static void lbtf_op_tx(struct ieee80211_hw
*hw
,
231 struct ieee80211_tx_control
*control
,
234 struct lbtf_private
*priv
= hw
->priv
;
236 priv
->skb_to_tx
= skb
;
237 queue_work(lbtf_wq
, &priv
->tx_work
);
239 * queue will be restarted when we receive transmission feedback if
240 * there are no buffered multicast frames to send
242 ieee80211_stop_queues(priv
->hw
);
245 static void lbtf_tx_work(struct work_struct
*work
)
247 struct lbtf_private
*priv
= container_of(work
, struct lbtf_private
,
250 struct ieee80211_tx_info
*info
;
252 struct sk_buff
*skb
= NULL
;
255 lbtf_deb_enter(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
257 if ((priv
->vif
->type
== NL80211_IFTYPE_AP
) &&
258 (!skb_queue_empty(&priv
->bc_ps_buf
)))
259 skb
= skb_dequeue(&priv
->bc_ps_buf
);
260 else if (priv
->skb_to_tx
) {
261 skb
= priv
->skb_to_tx
;
262 priv
->skb_to_tx
= NULL
;
264 lbtf_deb_leave(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
269 info
= IEEE80211_SKB_CB(skb
);
270 txpd
= (struct txpd
*) skb_push(skb
, sizeof(struct txpd
));
272 if (priv
->surpriseremoved
) {
273 dev_kfree_skb_any(skb
);
274 lbtf_deb_leave(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
278 memset(txpd
, 0, sizeof(struct txpd
));
279 /* Activate per-packet rate selection */
280 txpd
->tx_control
|= cpu_to_le32(MRVL_PER_PACKET_RATE
|
281 ieee80211_get_tx_rate(priv
->hw
, info
)->hw_value
);
283 /* copy destination address from 802.11 header */
284 memcpy(txpd
->tx_dest_addr_high
, skb
->data
+ sizeof(struct txpd
) + 4,
286 txpd
->tx_packet_length
= cpu_to_le16(len
);
287 txpd
->tx_packet_location
= cpu_to_le32(sizeof(struct txpd
));
288 lbtf_deb_hex(LBTF_DEB_TX
, "TX Data", skb
->data
, min_t(unsigned int, skb
->len
, 100));
289 BUG_ON(priv
->tx_skb
);
290 spin_lock_irq(&priv
->driver_lock
);
292 err
= priv
->hw_host_to_card(priv
, MVMS_DAT
, skb
->data
, skb
->len
);
293 spin_unlock_irq(&priv
->driver_lock
);
295 dev_kfree_skb_any(skb
);
297 pr_err("TX error: %d", err
);
299 lbtf_deb_leave(LBTF_DEB_MACOPS
| LBTF_DEB_TX
);
302 static int lbtf_op_start(struct ieee80211_hw
*hw
)
304 struct lbtf_private
*priv
= hw
->priv
;
305 void *card
= priv
->card
;
308 lbtf_deb_enter(LBTF_DEB_MACOPS
);
311 /* Upload firmware */
312 if (priv
->hw_prog_firmware(card
))
313 goto err_prog_firmware
;
315 /* poke the firmware */
316 priv
->capability
= WLAN_CAPABILITY_SHORT_PREAMBLE
;
317 priv
->radioon
= RADIO_ON
;
318 priv
->mac_control
= CMD_ACT_MAC_RX_ON
| CMD_ACT_MAC_TX_ON
;
319 ret
= lbtf_setup_firmware(priv
);
321 goto err_prog_firmware
;
323 if ((priv
->fwrelease
< LBTF_FW_VER_MIN
) ||
324 (priv
->fwrelease
> LBTF_FW_VER_MAX
)) {
326 goto err_prog_firmware
;
329 printk(KERN_INFO
"libertastf: Marvell WLAN 802.11 thinfirm adapter\n");
330 lbtf_deb_leave(LBTF_DEB_MACOPS
);
334 priv
->hw_reset_device(card
);
335 lbtf_deb_leave_args(LBTF_DEB_MACOPS
, "error programming fw; ret=%d", ret
);
339 static void lbtf_op_stop(struct ieee80211_hw
*hw
)
341 struct lbtf_private
*priv
= hw
->priv
;
345 struct cmd_ctrl_node
*cmdnode
;
347 lbtf_deb_enter(LBTF_DEB_MACOPS
);
349 /* Flush pending command nodes */
350 spin_lock_irqsave(&priv
->driver_lock
, flags
);
351 list_for_each_entry(cmdnode
, &priv
->cmdpendingq
, list
) {
352 cmdnode
->result
= -ENOENT
;
353 cmdnode
->cmdwaitqwoken
= 1;
354 wake_up_interruptible(&cmdnode
->cmdwait_q
);
357 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
358 cancel_work_sync(&priv
->cmd_work
);
359 cancel_work_sync(&priv
->tx_work
);
360 while ((skb
= skb_dequeue(&priv
->bc_ps_buf
)))
361 dev_kfree_skb_any(skb
);
362 priv
->radioon
= RADIO_OFF
;
363 lbtf_set_radio_control(priv
);
365 lbtf_deb_leave(LBTF_DEB_MACOPS
);
368 static int lbtf_op_add_interface(struct ieee80211_hw
*hw
,
369 struct ieee80211_vif
*vif
)
371 struct lbtf_private
*priv
= hw
->priv
;
372 lbtf_deb_enter(LBTF_DEB_MACOPS
);
373 if (priv
->vif
!= NULL
)
378 case NL80211_IFTYPE_MESH_POINT
:
379 case NL80211_IFTYPE_AP
:
380 lbtf_set_mode(priv
, LBTF_AP_MODE
);
382 case NL80211_IFTYPE_STATION
:
383 lbtf_set_mode(priv
, LBTF_STA_MODE
);
389 lbtf_set_mac_address(priv
, (u8
*) vif
->addr
);
390 lbtf_deb_leave(LBTF_DEB_MACOPS
);
394 static void lbtf_op_remove_interface(struct ieee80211_hw
*hw
,
395 struct ieee80211_vif
*vif
)
397 struct lbtf_private
*priv
= hw
->priv
;
398 lbtf_deb_enter(LBTF_DEB_MACOPS
);
400 if (priv
->vif
->type
== NL80211_IFTYPE_AP
||
401 priv
->vif
->type
== NL80211_IFTYPE_MESH_POINT
)
402 lbtf_beacon_ctrl(priv
, 0, 0);
403 lbtf_set_mode(priv
, LBTF_PASSIVE_MODE
);
404 lbtf_set_bssid(priv
, 0, NULL
);
406 lbtf_deb_leave(LBTF_DEB_MACOPS
);
409 static int lbtf_op_config(struct ieee80211_hw
*hw
, u32 changed
)
411 struct lbtf_private
*priv
= hw
->priv
;
412 struct ieee80211_conf
*conf
= &hw
->conf
;
413 lbtf_deb_enter(LBTF_DEB_MACOPS
);
415 if (conf
->chandef
.chan
->center_freq
!= priv
->cur_freq
) {
416 priv
->cur_freq
= conf
->chandef
.chan
->center_freq
;
417 lbtf_set_channel(priv
, conf
->chandef
.chan
->hw_value
);
419 lbtf_deb_leave(LBTF_DEB_MACOPS
);
423 static u64
lbtf_op_prepare_multicast(struct ieee80211_hw
*hw
,
424 struct netdev_hw_addr_list
*mc_list
)
426 struct lbtf_private
*priv
= hw
->priv
;
428 struct netdev_hw_addr
*ha
;
429 int mc_count
= netdev_hw_addr_list_count(mc_list
);
431 if (!mc_count
|| mc_count
> MRVDRV_MAX_MULTICAST_LIST_SIZE
)
434 priv
->nr_of_multicastmacaddr
= mc_count
;
436 netdev_hw_addr_list_for_each(ha
, mc_list
)
437 memcpy(&priv
->multicastlist
[i
++], ha
->addr
, ETH_ALEN
);
442 #define SUPPORTED_FIF_FLAGS FIF_ALLMULTI
443 static void lbtf_op_configure_filter(struct ieee80211_hw
*hw
,
444 unsigned int changed_flags
,
445 unsigned int *new_flags
,
448 struct lbtf_private
*priv
= hw
->priv
;
449 int old_mac_control
= priv
->mac_control
;
451 lbtf_deb_enter(LBTF_DEB_MACOPS
);
453 changed_flags
&= SUPPORTED_FIF_FLAGS
;
454 *new_flags
&= SUPPORTED_FIF_FLAGS
;
456 if (!changed_flags
) {
457 lbtf_deb_leave(LBTF_DEB_MACOPS
);
461 priv
->mac_control
&= ~CMD_ACT_MAC_PROMISCUOUS_ENABLE
;
462 if (*new_flags
& (FIF_ALLMULTI
) ||
463 multicast
> MRVDRV_MAX_MULTICAST_LIST_SIZE
) {
464 priv
->mac_control
|= CMD_ACT_MAC_ALL_MULTICAST_ENABLE
;
465 priv
->mac_control
&= ~CMD_ACT_MAC_MULTICAST_ENABLE
;
466 } else if (multicast
) {
467 priv
->mac_control
|= CMD_ACT_MAC_MULTICAST_ENABLE
;
468 priv
->mac_control
&= ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE
;
469 lbtf_cmd_set_mac_multicast_addr(priv
);
471 priv
->mac_control
&= ~(CMD_ACT_MAC_MULTICAST_ENABLE
|
472 CMD_ACT_MAC_ALL_MULTICAST_ENABLE
);
473 if (priv
->nr_of_multicastmacaddr
) {
474 priv
->nr_of_multicastmacaddr
= 0;
475 lbtf_cmd_set_mac_multicast_addr(priv
);
480 if (priv
->mac_control
!= old_mac_control
)
481 lbtf_set_mac_control(priv
);
483 lbtf_deb_leave(LBTF_DEB_MACOPS
);
486 static void lbtf_op_bss_info_changed(struct ieee80211_hw
*hw
,
487 struct ieee80211_vif
*vif
,
488 struct ieee80211_bss_conf
*bss_conf
,
491 struct lbtf_private
*priv
= hw
->priv
;
492 struct sk_buff
*beacon
;
493 lbtf_deb_enter(LBTF_DEB_MACOPS
);
495 if (changes
& (BSS_CHANGED_BEACON
| BSS_CHANGED_BEACON_INT
)) {
496 switch (priv
->vif
->type
) {
497 case NL80211_IFTYPE_AP
:
498 case NL80211_IFTYPE_MESH_POINT
:
499 beacon
= ieee80211_beacon_get(hw
, vif
);
501 lbtf_beacon_set(priv
, beacon
);
503 lbtf_beacon_ctrl(priv
, 1,
504 bss_conf
->beacon_int
);
512 if (changes
& BSS_CHANGED_BSSID
) {
513 bool activate
= !is_zero_ether_addr(bss_conf
->bssid
);
514 lbtf_set_bssid(priv
, activate
, bss_conf
->bssid
);
517 if (changes
& BSS_CHANGED_ERP_PREAMBLE
) {
518 if (bss_conf
->use_short_preamble
)
519 priv
->preamble
= CMD_TYPE_SHORT_PREAMBLE
;
521 priv
->preamble
= CMD_TYPE_LONG_PREAMBLE
;
522 lbtf_set_radio_control(priv
);
525 lbtf_deb_leave(LBTF_DEB_MACOPS
);
528 static int lbtf_op_get_survey(struct ieee80211_hw
*hw
, int idx
,
529 struct survey_info
*survey
)
531 struct lbtf_private
*priv
= hw
->priv
;
532 struct ieee80211_conf
*conf
= &hw
->conf
;
537 survey
->channel
= conf
->chandef
.chan
;
538 survey
->filled
= SURVEY_INFO_NOISE_DBM
;
539 survey
->noise
= priv
->noise
;
544 static const struct ieee80211_ops lbtf_ops
= {
546 .start
= lbtf_op_start
,
547 .stop
= lbtf_op_stop
,
548 .add_interface
= lbtf_op_add_interface
,
549 .remove_interface
= lbtf_op_remove_interface
,
550 .config
= lbtf_op_config
,
551 .prepare_multicast
= lbtf_op_prepare_multicast
,
552 .configure_filter
= lbtf_op_configure_filter
,
553 .bss_info_changed
= lbtf_op_bss_info_changed
,
554 .get_survey
= lbtf_op_get_survey
,
557 int lbtf_rx(struct lbtf_private
*priv
, struct sk_buff
*skb
)
559 struct ieee80211_rx_status stats
;
563 struct ieee80211_hdr
*hdr
;
565 lbtf_deb_enter(LBTF_DEB_RX
);
567 prxpd
= (struct rxpd
*) skb
->data
;
569 memset(&stats
, 0, sizeof(stats
));
570 if (!(prxpd
->status
& cpu_to_le16(MRVDRV_RXPD_STATUS_OK
)))
571 stats
.flag
|= RX_FLAG_FAILED_FCS_CRC
;
572 stats
.freq
= priv
->cur_freq
;
573 stats
.band
= IEEE80211_BAND_2GHZ
;
574 stats
.signal
= prxpd
->snr
;
575 priv
->noise
= prxpd
->nf
;
576 /* Marvell rate index has a hole at value 4 */
577 if (prxpd
->rx_rate
> 4)
579 stats
.rate_idx
= prxpd
->rx_rate
;
580 skb_pull(skb
, sizeof(struct rxpd
));
582 hdr
= (struct ieee80211_hdr
*)skb
->data
;
583 flags
= le32_to_cpu(*(__le32
*)(skb
->data
+ 4));
585 need_padding
= ieee80211_is_data_qos(hdr
->frame_control
);
586 need_padding
^= ieee80211_has_a4(hdr
->frame_control
);
587 need_padding
^= ieee80211_is_data_qos(hdr
->frame_control
) &&
588 (*ieee80211_get_qos_ctl(hdr
) &
589 IEEE80211_QOS_CTL_A_MSDU_PRESENT
);
592 memmove(skb
->data
+ 2, skb
->data
, skb
->len
);
596 memcpy(IEEE80211_SKB_RXCB(skb
), &stats
, sizeof(stats
));
598 lbtf_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
599 skb
->len
, sizeof(struct rxpd
), skb
->len
- sizeof(struct rxpd
));
600 lbtf_deb_hex(LBTF_DEB_RX
, "RX Data", skb
->data
,
601 min_t(unsigned int, skb
->len
, 100));
603 ieee80211_rx_irqsafe(priv
->hw
, skb
);
605 lbtf_deb_leave(LBTF_DEB_RX
);
608 EXPORT_SYMBOL_GPL(lbtf_rx
);
611 * lbtf_add_card: Add and initialize the card, no fw upload yet.
613 * @card A pointer to card
615 * Returns: pointer to struct lbtf_priv.
617 struct lbtf_private
*lbtf_add_card(void *card
, struct device
*dmdev
)
619 struct ieee80211_hw
*hw
;
620 struct lbtf_private
*priv
= NULL
;
622 lbtf_deb_enter(LBTF_DEB_MAIN
);
624 hw
= ieee80211_alloc_hw(sizeof(struct lbtf_private
), &lbtf_ops
);
629 if (lbtf_init_adapter(priv
))
630 goto err_init_adapter
;
637 ieee80211_hw_set(hw
, HOST_BROADCAST_PS_BUFFERING
);
638 hw
->extra_tx_headroom
= sizeof(struct txpd
);
639 memcpy(priv
->channels
, lbtf_channels
, sizeof(lbtf_channels
));
640 memcpy(priv
->rates
, lbtf_rates
, sizeof(lbtf_rates
));
641 priv
->band
.n_bitrates
= ARRAY_SIZE(lbtf_rates
);
642 priv
->band
.bitrates
= priv
->rates
;
643 priv
->band
.n_channels
= ARRAY_SIZE(lbtf_channels
);
644 priv
->band
.channels
= priv
->channels
;
645 hw
->wiphy
->bands
[IEEE80211_BAND_2GHZ
] = &priv
->band
;
646 hw
->wiphy
->interface_modes
=
647 BIT(NL80211_IFTYPE_STATION
) |
648 BIT(NL80211_IFTYPE_ADHOC
);
649 skb_queue_head_init(&priv
->bc_ps_buf
);
651 SET_IEEE80211_DEV(hw
, dmdev
);
653 INIT_WORK(&priv
->cmd_work
, lbtf_cmd_work
);
654 INIT_WORK(&priv
->tx_work
, lbtf_tx_work
);
655 if (ieee80211_register_hw(hw
))
656 goto err_init_adapter
;
661 lbtf_free_adapter(priv
);
662 ieee80211_free_hw(hw
);
666 lbtf_deb_leave_args(LBTF_DEB_MAIN
, "priv %p", priv
);
669 EXPORT_SYMBOL_GPL(lbtf_add_card
);
672 int lbtf_remove_card(struct lbtf_private
*priv
)
674 struct ieee80211_hw
*hw
= priv
->hw
;
676 lbtf_deb_enter(LBTF_DEB_MAIN
);
678 priv
->surpriseremoved
= 1;
679 del_timer(&priv
->command_timer
);
680 lbtf_free_adapter(priv
);
682 ieee80211_unregister_hw(hw
);
683 ieee80211_free_hw(hw
);
685 lbtf_deb_leave(LBTF_DEB_MAIN
);
688 EXPORT_SYMBOL_GPL(lbtf_remove_card
);
690 void lbtf_send_tx_feedback(struct lbtf_private
*priv
, u8 retrycnt
, u8 fail
)
692 struct ieee80211_tx_info
*info
= IEEE80211_SKB_CB(priv
->tx_skb
);
694 ieee80211_tx_info_clear_status(info
);
696 * Commented out, otherwise we never go beyond 1Mbit/s using mac80211
697 * default pid rc algorithm.
699 * info->status.retry_count = MRVL_DEFAULT_RETRIES - retrycnt;
701 if (!(info
->flags
& IEEE80211_TX_CTL_NO_ACK
) && !fail
)
702 info
->flags
|= IEEE80211_TX_STAT_ACK
;
703 skb_pull(priv
->tx_skb
, sizeof(struct txpd
));
704 ieee80211_tx_status_irqsafe(priv
->hw
, priv
->tx_skb
);
706 if (!priv
->skb_to_tx
&& skb_queue_empty(&priv
->bc_ps_buf
))
707 ieee80211_wake_queues(priv
->hw
);
709 queue_work(lbtf_wq
, &priv
->tx_work
);
711 EXPORT_SYMBOL_GPL(lbtf_send_tx_feedback
);
713 void lbtf_bcn_sent(struct lbtf_private
*priv
)
715 struct sk_buff
*skb
= NULL
;
717 if (priv
->vif
->type
!= NL80211_IFTYPE_AP
)
720 if (skb_queue_empty(&priv
->bc_ps_buf
)) {
721 bool tx_buff_bc
= false;
723 while ((skb
= ieee80211_get_buffered_bc(priv
->hw
, priv
->vif
))) {
724 skb_queue_tail(&priv
->bc_ps_buf
, skb
);
728 ieee80211_stop_queues(priv
->hw
);
729 queue_work(lbtf_wq
, &priv
->tx_work
);
733 skb
= ieee80211_beacon_get(priv
->hw
, priv
->vif
);
736 lbtf_beacon_set(priv
, skb
);
740 EXPORT_SYMBOL_GPL(lbtf_bcn_sent
);
742 static int __init
lbtf_init_module(void)
744 lbtf_deb_enter(LBTF_DEB_MAIN
);
745 lbtf_wq
= create_workqueue("libertastf");
746 if (lbtf_wq
== NULL
) {
747 printk(KERN_ERR
"libertastf: couldn't create workqueue\n");
750 lbtf_deb_leave(LBTF_DEB_MAIN
);
754 static void __exit
lbtf_exit_module(void)
756 lbtf_deb_enter(LBTF_DEB_MAIN
);
757 destroy_workqueue(lbtf_wq
);
758 lbtf_deb_leave(LBTF_DEB_MAIN
);
761 module_init(lbtf_init_module
);
762 module_exit(lbtf_exit_module
);
764 MODULE_DESCRIPTION("Libertas WLAN Thinfirm Driver Library");
765 MODULE_AUTHOR("Cozybit Inc.");
766 MODULE_LICENSE("GPL");