7 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9 #include <linux/module.h>
13 #include <linux/netdevice.h>
14 #include <linux/if_arp.h>
17 #include <linux/slab.h>
28 #define DRIVER_RELEASE_VERSION "323.p0"
57 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 };
65 { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12,
66 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00
77 if (idx >=
sizeof(fw_data_rates))
79 return fw_data_rates[
idx];
95 for (i = 0; i <
sizeof(fw_data_rates); i++) {
96 if (rate == fw_data_rates[i])
195 netif_wake_queue(dev);
204 static bool lbs_command_queue_empty(
struct lbs_private *priv)
249 static int lbs_eth_stop(
struct net_device *dev)
259 netif_stop_queue(dev);
269 if (!lbs_iface_active(priv))
310 if (lbs_iface_active(priv))
326 static inline int mac_in_list(
unsigned char *
list,
int list_len,
349 netif_addr_lock_bh(dev);
352 if (mac_in_list(cmd->
maclist, nr_addrs, ha->
addr)) {
367 netif_addr_unlock_bh(dev);
383 if (netif_running(priv->
dev))
384 dev_flags |= priv->
dev->flags;
392 goto out_set_mac_control;
398 goto out_set_mac_control;
402 nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->
dev, 0);
403 if (nr_addrs >= 0 && priv->
mesh_dev)
404 nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->
mesh_dev, nr_addrs);
452 static int lbs_thread(
void *
data)
460 init_waitqueue_entry(&wait,
current);
501 "psmode %d, psstate %d\n",
550 (
unsigned char *) &event,
sizeof(event)) !=
571 netdev_info(dev,
"Timeout submitting command 0x%04x\n",
590 "dnld_sent %d, cur_cmd %p\n",
603 "ignore PS_SleepConfirm in non-connected state\n");
638 netif_wake_queue(priv->
dev);
662 static int lbs_setup_firmware(
struct lbs_private *priv)
665 s16 curlevel = 0, minlevel = 0, maxlevel = 0;
703 netdev_err(priv->
dev,
704 "deep sleep cancellation failed: %d\n", ret);
737 netdev_err(priv->
dev,
738 "deep sleep activation failed: %d\n", ret);
742 ret = lbs_setup_firmware(priv);
755 static void lbs_cmd_timeout_handler(
unsigned long data)
766 netdev_info(priv->
dev,
"command 0x%04x timed out\n",
791 static void lbs_tx_lockup_handler(
unsigned long data)
799 netdev_info(priv->
dev,
"TX lockup detected\n");
816 static void auto_deepsleep_timer_fn(
unsigned long data)
831 memset(&cmd, 0,
sizeof(cmd));
868 static int lbs_init_adapter(
struct lbs_private *priv)
896 (
unsigned long)priv);
898 (
unsigned long)priv);
900 (
unsigned long)priv);
909 pr_err(
"Out of memory allocating command buffers\n");
919 pr_err(
"Out of memory allocating event FIFO buffer\n");
929 static void lbs_free_adapter(
struct lbs_private *priv)
943 .ndo_open = lbs_dev_open,
944 .ndo_stop = lbs_eth_stop,
971 pr_err(
"cfg80211 init failed\n");
976 priv = wdev_priv(wdev);
979 if (lbs_init_adapter(priv)) {
980 pr_err(
"failed to initialize adapter structure\n");
986 dev_err(dmdev,
"no memory for network device instance\n");
1027 lbs_free_adapter(priv);
1079 lbs_free_adapter(priv);
1107 ret = lbs_setup_firmware(priv);
1117 pr_err(
"cannot register device\n");
1126 netdev_info(dev,
"Marvell WLAN 802.11 adapter\n");
1152 netif_stop_queue(dev);
1167 unsigned long flags;
1179 spin_unlock_irqrestore(&priv->
driver_lock, flags);
1201 static int __init lbs_init_module(
void)
1213 static void __exit lbs_exit_module(
void)