2 * This file contains the major functions in WLAN
3 * driver. It includes init, exit, open, close and main
7 #include <linux/moduleparam.h>
8 #include <linux/delay.h>
9 #include <linux/etherdevice.h>
10 #include <linux/netdevice.h>
11 #include <linux/if_arp.h>
12 #include <linux/kthread.h>
14 #include <net/iw_handler.h>
15 #include <net/ieee80211.h>
25 #define DRIVER_RELEASE_VERSION "323.p0"
26 const char lbs_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION
33 /* Module parameters */
34 unsigned int lbs_debug;
35 EXPORT_SYMBOL_GPL(lbs_debug);
36 module_param_named(libertas_debug, lbs_debug, int, 0644);
39 /* This global structure is used to send the confirm_sleep command as
40 * fast as possible down to the firmware. */
41 struct cmd_confirm_sleep confirm_sleep;
44 #define LBS_TX_PWR_DEFAULT 20 /*100mW */
45 #define LBS_TX_PWR_US_DEFAULT 20 /*100mW */
46 #define LBS_TX_PWR_JP_DEFAULT 16 /*50mW */
47 #define LBS_TX_PWR_FR_DEFAULT 20 /*100mW */
48 #define LBS_TX_PWR_EMEA_DEFAULT 20 /*100mW */
50 /* Format { channel, frequency (MHz), maxtxpower } */
51 /* band: 'B/G', region: USA FCC/Canada IC */
52 static struct chan_freq_power channel_freq_power_US_BG[] = {
53 {1, 2412, LBS_TX_PWR_US_DEFAULT},
54 {2, 2417, LBS_TX_PWR_US_DEFAULT},
55 {3, 2422, LBS_TX_PWR_US_DEFAULT},
56 {4, 2427, LBS_TX_PWR_US_DEFAULT},
57 {5, 2432, LBS_TX_PWR_US_DEFAULT},
58 {6, 2437, LBS_TX_PWR_US_DEFAULT},
59 {7, 2442, LBS_TX_PWR_US_DEFAULT},
60 {8, 2447, LBS_TX_PWR_US_DEFAULT},
61 {9, 2452, LBS_TX_PWR_US_DEFAULT},
62 {10, 2457, LBS_TX_PWR_US_DEFAULT},
63 {11, 2462, LBS_TX_PWR_US_DEFAULT}
66 /* band: 'B/G', region: Europe ETSI */
67 static struct chan_freq_power channel_freq_power_EU_BG[] = {
68 {1, 2412, LBS_TX_PWR_EMEA_DEFAULT},
69 {2, 2417, LBS_TX_PWR_EMEA_DEFAULT},
70 {3, 2422, LBS_TX_PWR_EMEA_DEFAULT},
71 {4, 2427, LBS_TX_PWR_EMEA_DEFAULT},
72 {5, 2432, LBS_TX_PWR_EMEA_DEFAULT},
73 {6, 2437, LBS_TX_PWR_EMEA_DEFAULT},
74 {7, 2442, LBS_TX_PWR_EMEA_DEFAULT},
75 {8, 2447, LBS_TX_PWR_EMEA_DEFAULT},
76 {9, 2452, LBS_TX_PWR_EMEA_DEFAULT},
77 {10, 2457, LBS_TX_PWR_EMEA_DEFAULT},
78 {11, 2462, LBS_TX_PWR_EMEA_DEFAULT},
79 {12, 2467, LBS_TX_PWR_EMEA_DEFAULT},
80 {13, 2472, LBS_TX_PWR_EMEA_DEFAULT}
83 /* band: 'B/G', region: Spain */
84 static struct chan_freq_power channel_freq_power_SPN_BG[] = {
85 {10, 2457, LBS_TX_PWR_DEFAULT},
86 {11, 2462, LBS_TX_PWR_DEFAULT}
89 /* band: 'B/G', region: France */
90 static struct chan_freq_power channel_freq_power_FR_BG[] = {
91 {10, 2457, LBS_TX_PWR_FR_DEFAULT},
92 {11, 2462, LBS_TX_PWR_FR_DEFAULT},
93 {12, 2467, LBS_TX_PWR_FR_DEFAULT},
94 {13, 2472, LBS_TX_PWR_FR_DEFAULT}
97 /* band: 'B/G', region: Japan */
98 static struct chan_freq_power channel_freq_power_JPN_BG[] = {
99 {1, 2412, LBS_TX_PWR_JP_DEFAULT},
100 {2, 2417, LBS_TX_PWR_JP_DEFAULT},
101 {3, 2422, LBS_TX_PWR_JP_DEFAULT},
102 {4, 2427, LBS_TX_PWR_JP_DEFAULT},
103 {5, 2432, LBS_TX_PWR_JP_DEFAULT},
104 {6, 2437, LBS_TX_PWR_JP_DEFAULT},
105 {7, 2442, LBS_TX_PWR_JP_DEFAULT},
106 {8, 2447, LBS_TX_PWR_JP_DEFAULT},
107 {9, 2452, LBS_TX_PWR_JP_DEFAULT},
108 {10, 2457, LBS_TX_PWR_JP_DEFAULT},
109 {11, 2462, LBS_TX_PWR_JP_DEFAULT},
110 {12, 2467, LBS_TX_PWR_JP_DEFAULT},
111 {13, 2472, LBS_TX_PWR_JP_DEFAULT},
112 {14, 2484, LBS_TX_PWR_JP_DEFAULT}
116 * the structure for channel, frequency and power
118 struct region_cfp_table {
120 struct chan_freq_power *cfp_BG;
125 * the structure for the mapping between region and CFP
127 static struct region_cfp_table region_cfp_table[] = {
129 channel_freq_power_US_BG,
130 ARRAY_SIZE(channel_freq_power_US_BG),
133 {0x20, /*CANADA IC */
134 channel_freq_power_US_BG,
135 ARRAY_SIZE(channel_freq_power_US_BG),
138 {0x30, /*EU*/ channel_freq_power_EU_BG,
139 ARRAY_SIZE(channel_freq_power_EU_BG),
142 {0x31, /*SPAIN*/ channel_freq_power_SPN_BG,
143 ARRAY_SIZE(channel_freq_power_SPN_BG),
146 {0x32, /*FRANCE*/ channel_freq_power_FR_BG,
147 ARRAY_SIZE(channel_freq_power_FR_BG),
150 {0x40, /*JAPAN*/ channel_freq_power_JPN_BG,
151 ARRAY_SIZE(channel_freq_power_JPN_BG),
154 /*Add new region here */
158 * the table to keep region code
160 u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
161 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 };
164 * 802.11b/g supported bitrates (in 500Kb/s units)
166 u8 lbs_bg_rates[MAX_RATES] =
167 { 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c,
171 * FW rate table. FW refers to rates by their index in this table, not by the
172 * rate value itself. Values of 0x00 are
173 * reserved positions.
175 static u8 fw_data_rates[MAX_RATES] =
176 { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12,
177 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00
181 * @brief use index to get the data rate
183 * @param idx The index of data rate
184 * @return data rate or 0
186 u32 lbs_fw_index_to_data_rate(u8 idx)
188 if (idx >= sizeof(fw_data_rates))
190 return fw_data_rates[idx];
194 * @brief use rate to get the index
196 * @param rate data rate
199 u8 lbs_data_rate_to_fw_index(u32 rate)
206 for (i = 0; i < sizeof(fw_data_rates); i++) {
207 if (rate == fw_data_rates[i])
214 * Attributes exported through sysfs
218 * @brief Get function for sysfs attribute anycast_mask
220 static ssize_t lbs_anycast_get(struct device *dev,
221 struct device_attribute *attr, char * buf)
223 struct lbs_private *priv = to_net_dev(dev)->priv;
224 struct cmd_ds_mesh_access mesh_access;
227 memset(&mesh_access, 0, sizeof(mesh_access));
229 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_ANYCAST, &mesh_access);
233 return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
237 * @brief Set function for sysfs attribute anycast_mask
239 static ssize_t lbs_anycast_set(struct device *dev,
240 struct device_attribute *attr, const char * buf, size_t count)
242 struct lbs_private *priv = to_net_dev(dev)->priv;
243 struct cmd_ds_mesh_access mesh_access;
247 memset(&mesh_access, 0, sizeof(mesh_access));
248 sscanf(buf, "%x", &datum);
249 mesh_access.data[0] = cpu_to_le32(datum);
251 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_ANYCAST, &mesh_access);
258 static int lbs_add_rtap(struct lbs_private *priv);
259 static void lbs_remove_rtap(struct lbs_private *priv);
260 static int lbs_add_mesh(struct lbs_private *priv);
261 static void lbs_remove_mesh(struct lbs_private *priv);
265 * Get function for sysfs attribute rtap
267 static ssize_t lbs_rtap_get(struct device *dev,
268 struct device_attribute *attr, char * buf)
270 struct lbs_private *priv = to_net_dev(dev)->priv;
271 return snprintf(buf, 5, "0x%X\n", priv->monitormode);
275 * Set function for sysfs attribute rtap
277 static ssize_t lbs_rtap_set(struct device *dev,
278 struct device_attribute *attr, const char * buf, size_t count)
281 struct lbs_private *priv = to_net_dev(dev)->priv;
283 sscanf(buf, "%x", &monitor_mode);
285 if (priv->monitormode == monitor_mode)
287 if (!priv->monitormode) {
288 if (priv->infra_open || priv->mesh_open)
290 if (priv->mode == IW_MODE_INFRA)
291 lbs_send_deauthentication(priv);
292 else if (priv->mode == IW_MODE_ADHOC)
293 lbs_stop_adhoc_network(priv);
296 priv->monitormode = monitor_mode;
300 if (!priv->monitormode)
302 priv->monitormode = 0;
303 lbs_remove_rtap(priv);
305 if (priv->currenttxskb) {
306 dev_kfree_skb_any(priv->currenttxskb);
307 priv->currenttxskb = NULL;
310 /* Wake queues, command thread, etc. */
311 lbs_host_to_card_done(priv);
314 lbs_prepare_and_send_command(priv,
315 CMD_802_11_MONITOR_MODE, CMD_ACT_SET,
316 CMD_OPTION_WAITFORRSP, 0, &priv->monitormode);
321 * lbs_rtap attribute to be exported per ethX interface
322 * through sysfs (/sys/class/net/ethX/lbs_rtap)
324 static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, lbs_rtap_set );
327 * Get function for sysfs attribute mesh
329 static ssize_t lbs_mesh_get(struct device *dev,
330 struct device_attribute *attr, char * buf)
332 struct lbs_private *priv = to_net_dev(dev)->priv;
333 return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev);
337 * Set function for sysfs attribute mesh
339 static ssize_t lbs_mesh_set(struct device *dev,
340 struct device_attribute *attr, const char * buf, size_t count)
342 struct lbs_private *priv = to_net_dev(dev)->priv;
346 sscanf(buf, "%x", &enable);
348 if (enable == !!priv->mesh_dev)
351 ret = lbs_mesh_config(priv, enable, priv->curbssparams.channel);
358 lbs_remove_mesh(priv);
364 * lbs_mesh attribute to be exported per ethX interface
365 * through sysfs (/sys/class/net/ethX/lbs_mesh)
367 static DEVICE_ATTR(lbs_mesh, 0644, lbs_mesh_get, lbs_mesh_set);
370 * anycast_mask attribute to be exported per mshX interface
371 * through sysfs (/sys/class/net/mshX/anycast_mask)
373 static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set);
375 static struct attribute *lbs_mesh_sysfs_entries[] = {
376 &dev_attr_anycast_mask.attr,
380 static struct attribute_group lbs_mesh_attr_group = {
381 .attrs = lbs_mesh_sysfs_entries,
385 * @brief This function opens the ethX or mshX interface
387 * @param dev A pointer to net_device structure
388 * @return 0 or -EBUSY if monitor mode active
390 static int lbs_dev_open(struct net_device *dev)
392 struct lbs_private *priv = (struct lbs_private *) dev->priv ;
395 lbs_deb_enter(LBS_DEB_NET);
397 spin_lock_irq(&priv->driver_lock);
399 if (priv->monitormode) {
404 if (dev == priv->mesh_dev) {
406 priv->mesh_connect_status = LBS_CONNECTED;
407 netif_carrier_on(dev);
409 priv->infra_open = 1;
411 if (priv->connect_status == LBS_CONNECTED)
412 netif_carrier_on(dev);
414 netif_carrier_off(dev);
417 if (!priv->tx_pending_len)
418 netif_wake_queue(dev);
421 spin_unlock_irq(&priv->driver_lock);
422 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
427 * @brief This function closes the mshX interface
429 * @param dev A pointer to net_device structure
432 static int lbs_mesh_stop(struct net_device *dev)
434 struct lbs_private *priv = (struct lbs_private *) (dev->priv);
436 lbs_deb_enter(LBS_DEB_MESH);
437 spin_lock_irq(&priv->driver_lock);
440 priv->mesh_connect_status = LBS_DISCONNECTED;
442 netif_stop_queue(dev);
443 netif_carrier_off(dev);
445 spin_unlock_irq(&priv->driver_lock);
447 lbs_deb_leave(LBS_DEB_MESH);
452 * @brief This function closes the ethX interface
454 * @param dev A pointer to net_device structure
457 static int lbs_eth_stop(struct net_device *dev)
459 struct lbs_private *priv = (struct lbs_private *) dev->priv;
461 lbs_deb_enter(LBS_DEB_NET);
463 spin_lock_irq(&priv->driver_lock);
464 priv->infra_open = 0;
465 netif_stop_queue(dev);
466 spin_unlock_irq(&priv->driver_lock);
468 lbs_deb_leave(LBS_DEB_NET);
472 static void lbs_tx_timeout(struct net_device *dev)
474 struct lbs_private *priv = (struct lbs_private *) dev->priv;
476 lbs_deb_enter(LBS_DEB_TX);
478 lbs_pr_err("tx watch dog timeout\n");
480 dev->trans_start = jiffies;
482 if (priv->currenttxskb) {
483 priv->eventcause = 0x01000000;
484 lbs_send_tx_feedback(priv);
486 /* XX: Shouldn't we also call into the hw-specific driver
487 to kick it somehow? */
488 lbs_host_to_card_done(priv);
490 /* More often than not, this actually happens because the
491 firmware has crapped itself -- rather than just a very
492 busy medium. So send a harmless command, and if/when
493 _that_ times out, we'll kick it in the head. */
494 lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
497 lbs_deb_leave(LBS_DEB_TX);
500 void lbs_host_to_card_done(struct lbs_private *priv)
504 lbs_deb_enter(LBS_DEB_THREAD);
506 spin_lock_irqsave(&priv->driver_lock, flags);
508 priv->dnld_sent = DNLD_RES_RECEIVED;
510 /* Wake main thread if commands are pending */
511 if (!priv->cur_cmd || priv->tx_pending_len > 0)
512 wake_up_interruptible(&priv->waitq);
514 spin_unlock_irqrestore(&priv->driver_lock, flags);
515 lbs_deb_leave(LBS_DEB_THREAD);
517 EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
520 * @brief This function returns the network statistics
522 * @param dev A pointer to struct lbs_private structure
523 * @return A pointer to net_device_stats structure
525 static struct net_device_stats *lbs_get_stats(struct net_device *dev)
527 struct lbs_private *priv = (struct lbs_private *) dev->priv;
529 lbs_deb_enter(LBS_DEB_NET);
533 static int lbs_set_mac_address(struct net_device *dev, void *addr)
536 struct lbs_private *priv = (struct lbs_private *) dev->priv;
537 struct sockaddr *phwaddr = addr;
538 struct cmd_ds_802_11_mac_address cmd;
540 lbs_deb_enter(LBS_DEB_NET);
542 /* In case it was called from the mesh device */
545 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
546 cmd.action = cpu_to_le16(CMD_ACT_SET);
547 memcpy(cmd.macadd, phwaddr->sa_data, ETH_ALEN);
549 ret = lbs_cmd_with_response(priv, CMD_802_11_MAC_ADDRESS, &cmd);
551 lbs_deb_net("set MAC address failed\n");
555 memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN);
556 memcpy(dev->dev_addr, phwaddr->sa_data, ETH_ALEN);
558 memcpy(priv->mesh_dev->dev_addr, phwaddr->sa_data, ETH_ALEN);
561 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
565 static int lbs_copy_multicast_address(struct lbs_private *priv,
566 struct net_device *dev)
569 struct dev_mc_list *mcptr = dev->mc_list;
571 for (i = 0; i < dev->mc_count; i++) {
572 memcpy(&priv->multicastlist[i], mcptr->dmi_addr, ETH_ALEN);
578 static void lbs_set_multicast_list(struct net_device *dev)
580 struct lbs_private *priv = dev->priv;
582 DECLARE_MAC_BUF(mac);
584 lbs_deb_enter(LBS_DEB_NET);
586 old_mac_control = priv->mac_control;
588 if (dev->flags & IFF_PROMISC) {
589 lbs_deb_net("enable promiscuous mode\n");
591 CMD_ACT_MAC_PROMISCUOUS_ENABLE;
593 ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE |
594 CMD_ACT_MAC_MULTICAST_ENABLE);
598 ~CMD_ACT_MAC_PROMISCUOUS_ENABLE;
600 if (dev->flags & IFF_ALLMULTI || dev->mc_count >
601 MRVDRV_MAX_MULTICAST_LIST_SIZE) {
602 lbs_deb_net( "enabling all multicast\n");
604 CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
606 ~CMD_ACT_MAC_MULTICAST_ENABLE;
609 ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
611 if (!dev->mc_count) {
612 lbs_deb_net("no multicast addresses, "
613 "disabling multicast\n");
615 ~CMD_ACT_MAC_MULTICAST_ENABLE;
620 CMD_ACT_MAC_MULTICAST_ENABLE;
622 priv->nr_of_multicastmacaddr =
623 lbs_copy_multicast_address(priv, dev);
625 lbs_deb_net("multicast addresses: %d\n",
628 for (i = 0; i < dev->mc_count; i++) {
629 lbs_deb_net("Multicast address %d: %s\n",
631 priv->multicastlist[i]));
633 /* send multicast addresses to firmware */
634 lbs_prepare_and_send_command(priv,
635 CMD_MAC_MULTICAST_ADR,
642 if (priv->mac_control != old_mac_control)
643 lbs_set_mac_control(priv);
645 lbs_deb_leave(LBS_DEB_NET);
649 * @brief This function handles the major jobs in the LBS driver.
650 * It handles all events generated by firmware, RX data received
651 * from firmware and TX data sent from kernel.
653 * @param data A pointer to lbs_thread structure
656 static int lbs_thread(void *data)
658 struct net_device *dev = data;
659 struct lbs_private *priv = dev->priv;
663 lbs_deb_enter(LBS_DEB_THREAD);
665 init_waitqueue_entry(&wait, current);
670 lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
671 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
673 add_wait_queue(&priv->waitq, &wait);
674 set_current_state(TASK_INTERRUPTIBLE);
675 spin_lock_irq(&priv->driver_lock);
677 if (kthread_should_stop())
678 shouldsleep = 0; /* Bye */
679 else if (priv->surpriseremoved)
680 shouldsleep = 1; /* We need to wait until we're _told_ to die */
681 else if (priv->psstate == PS_STATE_SLEEP)
682 shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */
683 else if (priv->intcounter)
684 shouldsleep = 0; /* Interrupt pending. Deal with it now */
685 else if (priv->cmd_timed_out)
686 shouldsleep = 0; /* Command timed out. Recover */
687 else if (!priv->fw_ready)
688 shouldsleep = 1; /* Firmware not ready. We're waiting for it */
689 else if (priv->dnld_sent)
690 shouldsleep = 1; /* Something is en route to the device already */
691 else if (priv->tx_pending_len > 0)
692 shouldsleep = 0; /* We've a packet to send */
693 else if (priv->cur_cmd)
694 shouldsleep = 1; /* Can't send a command; one already running */
695 else if (!list_empty(&priv->cmdpendingq))
696 shouldsleep = 0; /* We have a command to send */
698 shouldsleep = 1; /* No command */
701 lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n",
702 priv->connect_status, priv->intcounter,
703 priv->psmode, priv->psstate);
704 spin_unlock_irq(&priv->driver_lock);
707 spin_unlock_irq(&priv->driver_lock);
709 lbs_deb_thread("main-thread 222 (waking up): intcounter=%d currenttxskb=%p dnld_sent=%d\n",
710 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
712 set_current_state(TASK_RUNNING);
713 remove_wait_queue(&priv->waitq, &wait);
715 lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
716 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
718 if (kthread_should_stop()) {
719 lbs_deb_thread("main-thread: break from main thread\n");
723 if (priv->surpriseremoved) {
724 lbs_deb_thread("adapter removed; waiting to die...\n");
728 spin_lock_irq(&priv->driver_lock);
730 if (priv->intcounter) {
733 priv->intcounter = 0;
734 int_status = priv->hw_get_int_status(priv, &ireg);
737 lbs_deb_thread("main-thread: reading HOST_INT_STATUS_REG failed\n");
738 spin_unlock_irq(&priv->driver_lock);
741 priv->hisregcpy |= ireg;
744 lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
745 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
747 /* command response? */
748 if (priv->hisregcpy & MRVDRV_CMD_UPLD_RDY) {
749 lbs_deb_thread("main-thread: cmd response ready\n");
751 priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY;
752 spin_unlock_irq(&priv->driver_lock);
753 lbs_process_rx_command(priv);
754 spin_lock_irq(&priv->driver_lock);
757 if (priv->cmd_timed_out && priv->cur_cmd) {
758 struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
760 if (++priv->nr_retries > 10) {
761 lbs_pr_info("Excessive timeouts submitting command %x\n",
762 le16_to_cpu(cmdnode->cmdbuf->command));
763 lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
764 priv->nr_retries = 0;
766 priv->cur_cmd = NULL;
767 lbs_pr_info("requeueing command %x due to timeout (#%d)\n",
768 le16_to_cpu(cmdnode->cmdbuf->command), priv->nr_retries);
770 /* Stick it back at the _top_ of the pending queue
771 for immediate resubmission */
772 list_add(&cmdnode->list, &priv->cmdpendingq);
775 priv->cmd_timed_out = 0;
778 if (priv->hisregcpy & MRVDRV_CARDEVENT) {
779 lbs_deb_thread("main-thread: Card Event Activity\n");
781 priv->hisregcpy &= ~MRVDRV_CARDEVENT;
783 if (priv->hw_read_event_cause(priv)) {
784 lbs_pr_alert("main-thread: hw_read_event_cause failed\n");
785 spin_unlock_irq(&priv->driver_lock);
788 spin_unlock_irq(&priv->driver_lock);
789 lbs_process_event(priv);
791 spin_unlock_irq(&priv->driver_lock);
796 /* Check if we need to confirm Sleep Request received previously */
797 if (priv->psstate == PS_STATE_PRE_SLEEP &&
798 !priv->dnld_sent && !priv->cur_cmd) {
799 if (priv->connect_status == LBS_CONNECTED) {
800 lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n",
801 priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd);
803 lbs_ps_confirm_sleep(priv);
805 /* workaround for firmware sending
806 * deauth/linkloss event immediately
807 * after sleep request; remove this
808 * after firmware fixes it
810 priv->psstate = PS_STATE_AWAKE;
811 lbs_pr_alert("main-thread: ignore PS_SleepConfirm in non-connected state\n");
815 /* The PS state is changed during processing of Sleep Request
818 if ((priv->psstate == PS_STATE_SLEEP) ||
819 (priv->psstate == PS_STATE_PRE_SLEEP))
822 /* Execute the next command */
823 if (!priv->dnld_sent && !priv->cur_cmd)
824 lbs_execute_next_command(priv);
826 /* Wake-up command waiters which can't sleep in
827 * lbs_prepare_and_send_command
829 if (!list_empty(&priv->cmdpendingq))
830 wake_up_all(&priv->cmd_pending);
832 spin_lock_irq(&priv->driver_lock);
833 if (!priv->dnld_sent && priv->tx_pending_len > 0) {
834 int ret = priv->hw_host_to_card(priv, MVMS_DAT,
835 priv->tx_pending_buf,
836 priv->tx_pending_len);
838 lbs_deb_tx("host_to_card failed %d\n", ret);
839 priv->dnld_sent = DNLD_RES_RECEIVED;
841 priv->tx_pending_len = 0;
842 if (!priv->currenttxskb) {
843 /* We can wake the queues immediately if we aren't
844 waiting for TX feedback */
845 if (priv->connect_status == LBS_CONNECTED)
846 netif_wake_queue(priv->dev);
847 if (priv->mesh_dev &&
848 priv->mesh_connect_status == LBS_CONNECTED)
849 netif_wake_queue(priv->mesh_dev);
852 spin_unlock_irq(&priv->driver_lock);
855 del_timer(&priv->command_timer);
856 wake_up_all(&priv->cmd_pending);
858 lbs_deb_leave(LBS_DEB_THREAD);
862 static int lbs_suspend_callback(struct lbs_private *priv, unsigned long dummy,
863 struct cmd_header *cmd)
865 lbs_deb_enter(LBS_DEB_FW);
867 netif_device_detach(priv->dev);
869 netif_device_detach(priv->mesh_dev);
872 lbs_deb_leave(LBS_DEB_FW);
876 int lbs_suspend(struct lbs_private *priv)
878 struct cmd_header cmd;
881 lbs_deb_enter(LBS_DEB_FW);
883 if (priv->wol_criteria == 0xffffffff) {
884 lbs_pr_info("Suspend attempt without configuring wake params!\n");
888 memset(&cmd, 0, sizeof(cmd));
890 ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd,
891 sizeof(cmd), lbs_suspend_callback, 0);
893 lbs_pr_info("HOST_SLEEP_ACTIVATE failed: %d\n", ret);
895 lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
898 EXPORT_SYMBOL_GPL(lbs_suspend);
900 int lbs_resume(struct lbs_private *priv)
902 lbs_deb_enter(LBS_DEB_FW);
906 /* Firmware doesn't seem to give us RX packets any more
907 until we send it some command. Might as well update */
908 lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
911 netif_device_attach(priv->dev);
913 netif_device_attach(priv->mesh_dev);
915 lbs_deb_leave(LBS_DEB_FW);
918 EXPORT_SYMBOL_GPL(lbs_resume);
921 * @brief This function downloads firmware image, gets
922 * HW spec from firmware and set basic parameters to
925 * @param priv A pointer to struct lbs_private structure
928 static int lbs_setup_firmware(struct lbs_private *priv)
932 lbs_deb_enter(LBS_DEB_FW);
935 * Read MAC address from HW
937 memset(priv->current_addr, 0xff, ETH_ALEN);
938 ret = lbs_update_hw_spec(priv);
944 lbs_set_mac_control(priv);
946 ret = lbs_get_data_rate(priv);
954 lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
959 * This function handles the timeout of command sending.
960 * It will re-send the same command again.
962 static void command_timer_fn(unsigned long data)
964 struct lbs_private *priv = (struct lbs_private *)data;
967 lbs_deb_enter(LBS_DEB_CMD);
968 spin_lock_irqsave(&priv->driver_lock, flags);
970 if (!priv->cur_cmd) {
971 lbs_pr_info("Command timer expired; no pending command\n");
975 lbs_pr_info("Command %x timed out\n", le16_to_cpu(priv->cur_cmd->cmdbuf->command));
977 priv->cmd_timed_out = 1;
978 wake_up_interruptible(&priv->waitq);
980 spin_unlock_irqrestore(&priv->driver_lock, flags);
981 lbs_deb_leave(LBS_DEB_CMD);
984 static void lbs_sync_channel_worker(struct work_struct *work)
986 struct lbs_private *priv = container_of(work, struct lbs_private,
989 lbs_deb_enter(LBS_DEB_MAIN);
990 if (lbs_update_channel(priv))
991 lbs_pr_info("Channel synchronization failed.");
992 lbs_deb_leave(LBS_DEB_MAIN);
996 static int lbs_init_adapter(struct lbs_private *priv)
1001 lbs_deb_enter(LBS_DEB_MAIN);
1003 /* Allocate buffer to store the BSSID list */
1004 bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
1005 priv->networks = kzalloc(bufsize, GFP_KERNEL);
1006 if (!priv->networks) {
1007 lbs_pr_err("Out of memory allocating beacons\n");
1012 /* Initialize scan result lists */
1013 INIT_LIST_HEAD(&priv->network_free_list);
1014 INIT_LIST_HEAD(&priv->network_list);
1015 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
1016 list_add_tail(&priv->networks[i].list,
1017 &priv->network_free_list);
1020 memset(priv->current_addr, 0xff, ETH_ALEN);
1022 priv->connect_status = LBS_DISCONNECTED;
1023 priv->mesh_connect_status = LBS_DISCONNECTED;
1024 priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1025 priv->mode = IW_MODE_INFRA;
1026 priv->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
1027 priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
1028 priv->radioon = RADIO_ON;
1029 priv->auto_rate = 1;
1030 priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
1031 priv->psmode = LBS802_11POWERMODECAM;
1032 priv->psstate = PS_STATE_FULL_POWER;
1034 mutex_init(&priv->lock);
1036 setup_timer(&priv->command_timer, command_timer_fn,
1037 (unsigned long)priv);
1039 INIT_LIST_HEAD(&priv->cmdfreeq);
1040 INIT_LIST_HEAD(&priv->cmdpendingq);
1042 spin_lock_init(&priv->driver_lock);
1043 init_waitqueue_head(&priv->cmd_pending);
1045 /* Allocate the command buffers */
1046 if (lbs_allocate_cmd_buffer(priv)) {
1047 lbs_pr_err("Out of memory allocating command buffers\n");
1052 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1057 static void lbs_free_adapter(struct lbs_private *priv)
1059 lbs_deb_enter(LBS_DEB_MAIN);
1061 lbs_free_cmd_buffer(priv);
1062 del_timer(&priv->command_timer);
1063 kfree(priv->networks);
1064 priv->networks = NULL;
1066 lbs_deb_leave(LBS_DEB_MAIN);
1070 * @brief This function adds the card. it will probe the
1071 * card, allocate the lbs_priv and initialize the device.
1073 * @param card A pointer to card
1074 * @return A pointer to struct lbs_private structure
1076 struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1078 struct net_device *dev = NULL;
1079 struct lbs_private *priv = NULL;
1081 lbs_deb_enter(LBS_DEB_MAIN);
1083 /* Allocate an Ethernet device and register it */
1084 dev = alloc_etherdev(sizeof(struct lbs_private));
1086 lbs_pr_err("init ethX device failed\n");
1091 if (lbs_init_adapter(priv)) {
1092 lbs_pr_err("failed to initialize adapter structure.\n");
1093 goto err_init_adapter;
1098 priv->mesh_open = 0;
1099 priv->infra_open = 0;
1101 /* Setup the OS Interface to our functions */
1102 dev->open = lbs_dev_open;
1103 dev->hard_start_xmit = lbs_hard_start_xmit;
1104 dev->stop = lbs_eth_stop;
1105 dev->set_mac_address = lbs_set_mac_address;
1106 dev->tx_timeout = lbs_tx_timeout;
1107 dev->get_stats = lbs_get_stats;
1108 dev->watchdog_timeo = 5 * HZ;
1109 dev->ethtool_ops = &lbs_ethtool_ops;
1111 dev->wireless_handlers = (struct iw_handler_def *)&lbs_handler_def;
1113 dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
1114 dev->set_multicast_list = lbs_set_multicast_list;
1116 SET_NETDEV_DEV(dev, dmdev);
1118 priv->rtap_net_dev = NULL;
1120 lbs_deb_thread("Starting main thread...\n");
1121 init_waitqueue_head(&priv->waitq);
1122 priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main");
1123 if (IS_ERR(priv->main_thread)) {
1124 lbs_deb_thread("Error creating main thread.\n");
1125 goto err_init_adapter;
1128 priv->work_thread = create_singlethread_workqueue("lbs_worker");
1129 INIT_DELAYED_WORK(&priv->assoc_work, lbs_association_worker);
1130 INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker);
1131 INIT_WORK(&priv->sync_channel, lbs_sync_channel_worker);
1133 sprintf(priv->mesh_ssid, "mesh");
1134 priv->mesh_ssid_len = 4;
1136 priv->wol_criteria = 0xffffffff;
1137 priv->wol_gpio = 0xff;
1142 lbs_free_adapter(priv);
1147 lbs_deb_leave_args(LBS_DEB_MAIN, "priv %p", priv);
1150 EXPORT_SYMBOL_GPL(lbs_add_card);
1153 int lbs_remove_card(struct lbs_private *priv)
1155 struct net_device *dev = priv->dev;
1156 union iwreq_data wrqu;
1158 lbs_deb_enter(LBS_DEB_MAIN);
1160 lbs_remove_mesh(priv);
1161 lbs_remove_rtap(priv);
1165 cancel_delayed_work(&priv->scan_work);
1166 cancel_delayed_work(&priv->assoc_work);
1167 destroy_workqueue(priv->work_thread);
1169 if (priv->psmode == LBS802_11POWERMODEMAX_PSP) {
1170 priv->psmode = LBS802_11POWERMODECAM;
1171 lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP);
1174 memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN);
1175 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
1176 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
1178 /* Stop the thread servicing the interrupts */
1179 priv->surpriseremoved = 1;
1180 kthread_stop(priv->main_thread);
1182 lbs_free_adapter(priv);
1187 lbs_deb_leave(LBS_DEB_MAIN);
1190 EXPORT_SYMBOL_GPL(lbs_remove_card);
1193 int lbs_start_card(struct lbs_private *priv)
1195 struct net_device *dev = priv->dev;
1198 lbs_deb_enter(LBS_DEB_MAIN);
1200 /* poke the firmware */
1201 ret = lbs_setup_firmware(priv);
1208 if (register_netdev(dev)) {
1209 lbs_pr_err("cannot register ethX device\n");
1212 if (device_create_file(&dev->dev, &dev_attr_lbs_rtap))
1213 lbs_pr_err("cannot register lbs_rtap attribute\n");
1215 lbs_update_channel(priv);
1217 /* 5.0.16p0 is known to NOT support any mesh */
1218 if (priv->fwrelease > 0x05001000) {
1219 /* Enable mesh, if supported, and work out which TLV it uses.
1220 0x100 + 291 is an unofficial value used in 5.110.20.pXX
1221 0x100 + 37 is the official value used in 5.110.21.pXX
1222 but we check them in that order because 20.pXX doesn't
1223 give an error -- it just silently fails. */
1225 /* 5.110.20.pXX firmware will fail the command if the channel
1226 doesn't match the existing channel. But only if the TLV
1227 is correct. If the channel is wrong, _BOTH_ versions will
1228 give an error to 0x100+291, and allow 0x100+37 to succeed.
1229 It's just that 5.110.20.pXX will not have done anything
1232 priv->mesh_tlv = 0x100 + 291;
1233 if (lbs_mesh_config(priv, 1, priv->curbssparams.channel)) {
1234 priv->mesh_tlv = 0x100 + 37;
1235 if (lbs_mesh_config(priv, 1, priv->curbssparams.channel))
1238 if (priv->mesh_tlv) {
1241 if (device_create_file(&dev->dev, &dev_attr_lbs_mesh))
1242 lbs_pr_err("cannot register lbs_mesh attribute\n");
1246 lbs_debugfs_init_one(priv, dev);
1248 lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name);
1253 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1256 EXPORT_SYMBOL_GPL(lbs_start_card);
1259 int lbs_stop_card(struct lbs_private *priv)
1261 struct net_device *dev = priv->dev;
1263 struct cmd_ctrl_node *cmdnode;
1264 unsigned long flags;
1266 lbs_deb_enter(LBS_DEB_MAIN);
1268 netif_stop_queue(priv->dev);
1269 netif_carrier_off(priv->dev);
1271 lbs_debugfs_remove_one(priv);
1272 device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
1274 device_remove_file(&dev->dev, &dev_attr_lbs_mesh);
1276 /* Flush pending command nodes */
1277 spin_lock_irqsave(&priv->driver_lock, flags);
1278 list_for_each_entry(cmdnode, &priv->cmdpendingq, list) {
1279 cmdnode->result = -ENOENT;
1280 cmdnode->cmdwaitqwoken = 1;
1281 wake_up_interruptible(&cmdnode->cmdwait_q);
1283 spin_unlock_irqrestore(&priv->driver_lock, flags);
1285 unregister_netdev(dev);
1287 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1290 EXPORT_SYMBOL_GPL(lbs_stop_card);
1294 * @brief This function adds mshX interface
1296 * @param priv A pointer to the struct lbs_private structure
1297 * @return 0 if successful, -X otherwise
1299 static int lbs_add_mesh(struct lbs_private *priv)
1301 struct net_device *mesh_dev = NULL;
1304 lbs_deb_enter(LBS_DEB_MESH);
1306 /* Allocate a virtual mesh device */
1307 if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
1308 lbs_deb_mesh("init mshX device failed\n");
1312 mesh_dev->priv = priv;
1313 priv->mesh_dev = mesh_dev;
1315 mesh_dev->open = lbs_dev_open;
1316 mesh_dev->hard_start_xmit = lbs_hard_start_xmit;
1317 mesh_dev->stop = lbs_mesh_stop;
1318 mesh_dev->get_stats = lbs_get_stats;
1319 mesh_dev->set_mac_address = lbs_set_mac_address;
1320 mesh_dev->ethtool_ops = &lbs_ethtool_ops;
1321 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr,
1322 sizeof(priv->dev->dev_addr));
1324 SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent);
1327 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
1329 /* Register virtual mesh interface */
1330 ret = register_netdev(mesh_dev);
1332 lbs_pr_err("cannot register mshX virtual interface\n");
1336 ret = sysfs_create_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group);
1338 goto err_unregister;
1340 /* Everything successful */
1345 unregister_netdev(mesh_dev);
1348 free_netdev(mesh_dev);
1351 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
1355 static void lbs_remove_mesh(struct lbs_private *priv)
1357 struct net_device *mesh_dev;
1360 mesh_dev = priv->mesh_dev;
1364 lbs_deb_enter(LBS_DEB_MESH);
1365 netif_stop_queue(mesh_dev);
1366 netif_carrier_off(priv->mesh_dev);
1367 sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group);
1368 unregister_netdev(mesh_dev);
1369 priv->mesh_dev = NULL;
1370 free_netdev(mesh_dev);
1371 lbs_deb_leave(LBS_DEB_MESH);
1375 * @brief This function finds the CFP in
1376 * region_cfp_table based on region and band parameter.
1378 * @param region The region code
1379 * @param band The band
1380 * @param cfp_no A pointer to CFP number
1381 * @return A pointer to CFP
1383 struct chan_freq_power *lbs_get_region_cfp_table(u8 region, int *cfp_no)
1387 lbs_deb_enter(LBS_DEB_MAIN);
1389 end = ARRAY_SIZE(region_cfp_table);
1391 for (i = 0; i < end ; i++) {
1392 lbs_deb_main("region_cfp_table[i].region=%d\n",
1393 region_cfp_table[i].region);
1394 if (region_cfp_table[i].region == region) {
1395 *cfp_no = region_cfp_table[i].cfp_no_BG;
1396 lbs_deb_leave(LBS_DEB_MAIN);
1397 return region_cfp_table[i].cfp_BG;
1401 lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL");
1405 int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band)
1410 struct chan_freq_power *cfp;
1413 lbs_deb_enter(LBS_DEB_MAIN);
1415 memset(priv->region_channel, 0, sizeof(priv->region_channel));
1417 cfp = lbs_get_region_cfp_table(region, &cfp_no);
1419 priv->region_channel[i].nrcfp = cfp_no;
1420 priv->region_channel[i].CFP = cfp;
1422 lbs_deb_main("wrong region code %#x in band B/G\n",
1427 priv->region_channel[i].valid = 1;
1428 priv->region_channel[i].region = region;
1429 priv->region_channel[i].band = band;
1432 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1437 * @brief This function handles the interrupt. it will change PS
1438 * state if applicable. it will wake up main_thread to handle
1439 * the interrupt event as well.
1441 * @param dev A pointer to net_device structure
1444 void lbs_interrupt(struct lbs_private *priv)
1446 lbs_deb_enter(LBS_DEB_THREAD);
1448 lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->intcounter);
1450 if (priv->psstate == PS_STATE_SLEEP)
1451 priv->psstate = PS_STATE_AWAKE;
1452 wake_up_interruptible(&priv->waitq);
1454 lbs_deb_leave(LBS_DEB_THREAD);
1456 EXPORT_SYMBOL_GPL(lbs_interrupt);
1458 static int __init lbs_init_module(void)
1460 lbs_deb_enter(LBS_DEB_MAIN);
1461 memset(&confirm_sleep, 0, sizeof(confirm_sleep));
1462 confirm_sleep.hdr.command = cpu_to_le16(CMD_802_11_PS_MODE);
1463 confirm_sleep.hdr.size = cpu_to_le16(sizeof(confirm_sleep));
1464 confirm_sleep.action = cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
1466 lbs_deb_leave(LBS_DEB_MAIN);
1470 static void __exit lbs_exit_module(void)
1472 lbs_deb_enter(LBS_DEB_MAIN);
1473 lbs_debugfs_remove();
1474 lbs_deb_leave(LBS_DEB_MAIN);
1478 * rtap interface support fuctions
1481 static int lbs_rtap_open(struct net_device *dev)
1483 /* Yes, _stop_ the queue. Because we don't support injection */
1484 lbs_deb_enter(LBS_DEB_MAIN);
1485 netif_carrier_off(dev);
1486 netif_stop_queue(dev);
1487 lbs_deb_leave(LBS_DEB_LEAVE);
1491 static int lbs_rtap_stop(struct net_device *dev)
1493 lbs_deb_enter(LBS_DEB_MAIN);
1494 lbs_deb_leave(LBS_DEB_MAIN);
1498 static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1500 netif_stop_queue(dev);
1501 return NETDEV_TX_BUSY;
1504 static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev)
1506 struct lbs_private *priv = dev->priv;
1507 lbs_deb_enter(LBS_DEB_NET);
1508 return &priv->stats;
1512 static void lbs_remove_rtap(struct lbs_private *priv)
1514 lbs_deb_enter(LBS_DEB_MAIN);
1515 if (priv->rtap_net_dev == NULL)
1517 unregister_netdev(priv->rtap_net_dev);
1518 free_netdev(priv->rtap_net_dev);
1519 priv->rtap_net_dev = NULL;
1520 lbs_deb_leave(LBS_DEB_MAIN);
1523 static int lbs_add_rtap(struct lbs_private *priv)
1526 struct net_device *rtap_dev;
1528 lbs_deb_enter(LBS_DEB_MAIN);
1529 if (priv->rtap_net_dev) {
1534 rtap_dev = alloc_netdev(0, "rtap%d", ether_setup);
1535 if (rtap_dev == NULL) {
1540 memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN);
1541 rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP;
1542 rtap_dev->open = lbs_rtap_open;
1543 rtap_dev->stop = lbs_rtap_stop;
1544 rtap_dev->get_stats = lbs_rtap_get_stats;
1545 rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit;
1546 rtap_dev->set_multicast_list = lbs_set_multicast_list;
1547 rtap_dev->priv = priv;
1549 ret = register_netdev(rtap_dev);
1551 free_netdev(rtap_dev);
1554 priv->rtap_net_dev = rtap_dev;
1557 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1561 #ifndef CONFIG_IEEE80211
1562 const char *escape_essid(const char *essid, u8 essid_len)
1564 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
1565 const char *s = essid;
1568 if (ieee80211_is_empty_essid(essid, essid_len)) {
1569 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
1573 essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
1574 while (essid_len--) {
1588 module_init(lbs_init_module);
1589 module_exit(lbs_exit_module);
1591 MODULE_DESCRIPTION("Libertas WLAN Driver Library");
1592 MODULE_AUTHOR("Marvell International Ltd.");
1593 MODULE_LICENSE("GPL");