diff options
author | Kiran Divekar | 2010-06-14 22:01:26 +0530 |
---|---|---|
committer | John W. Linville | 2010-06-23 15:13:11 -0400 |
commit | e86dc1ca4676445d9f0dfe35104efe0eb8a2f566 (patch) | |
tree | bd39d0d4403899fb438a2e983e1b97c1ccd9b1ad /drivers/net/wireless/libertas/main.c | |
parent | f90754c15f47063671aea55268a9dd6a37b51492 (diff) |
Libertas: cfg80211 support
Holger Schurig's patch (https://patchwork.kernel.org/patch/64286/)
is rebased to latest wireless-testing tree.
(Includes patches from me originally posted as "libertas: fix build
error due to undefined symbol" and "libertas: unmangle capability
value". -- JWL)
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Tested-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 221 |
1 files changed, 4 insertions, 217 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index abfecc4814b4..51b7e1923ab2 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -11,20 +11,14 @@ #include <linux/if_arp.h> #include <linux/kthread.h> #include <linux/kfifo.h> -#include <linux/stddef.h> -#include <linux/ieee80211.h> #include <linux/slab.h> -#include <net/iw_handler.h> #include <net/cfg80211.h> #include "host.h" #include "decl.h" #include "dev.h" -#include "wext.h" #include "cfg.h" #include "debugfs.h" -#include "scan.h" -#include "assoc.h" #include "cmd.h" #define DRIVER_RELEASE_VERSION "323.p0" @@ -96,72 +90,6 @@ u8 lbs_data_rate_to_fw_index(u32 rate) } -static int lbs_add_rtap(struct lbs_private *priv); -static void lbs_remove_rtap(struct lbs_private *priv); - - -/** - * Get function for sysfs attribute rtap - */ -static ssize_t lbs_rtap_get(struct device *dev, - struct device_attribute *attr, char * buf) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - return snprintf(buf, 5, "0x%X\n", priv->monitormode); -} - -/** - * Set function for sysfs attribute rtap - */ -static ssize_t lbs_rtap_set(struct device *dev, - struct device_attribute *attr, const char * buf, size_t count) -{ - int monitor_mode; - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - - sscanf(buf, "%x", &monitor_mode); - if (monitor_mode) { - if (priv->monitormode == monitor_mode) - return strlen(buf); - if (!priv->monitormode) { - if (priv->infra_open || lbs_mesh_open(priv)) - return -EBUSY; - if (priv->mode == IW_MODE_INFRA) - lbs_cmd_80211_deauthenticate(priv, - priv->curbssparams.bssid, - WLAN_REASON_DEAUTH_LEAVING); - else if (priv->mode == IW_MODE_ADHOC) - lbs_adhoc_stop(priv); - lbs_add_rtap(priv); - } - priv->monitormode = monitor_mode; - } else { - if (!priv->monitormode) - return strlen(buf); - priv->monitormode = 0; - lbs_remove_rtap(priv); - - if (priv->currenttxskb) { - dev_kfree_skb_any(priv->currenttxskb); - priv->currenttxskb = NULL; - } - - /* Wake queues, command thread, etc. */ - lbs_host_to_card_done(priv); - } - - lbs_prepare_and_send_command(priv, - CMD_802_11_MONITOR_MODE, CMD_ACT_SET, - CMD_OPTION_WAITFORRSP, 0, &priv->monitormode); - return strlen(buf); -} - -/** - * lbs_rtap attribute to be exported per ethX interface - * through sysfs (/sys/class/net/ethX/lbs_rtap) - */ -static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, lbs_rtap_set ); - /** * @brief This function opens the ethX interface * @@ -177,13 +105,6 @@ static int lbs_dev_open(struct net_device *dev) spin_lock_irq(&priv->driver_lock); - if (priv->monitormode) { - ret = -EBUSY; - goto out; - } - - priv->infra_open = 1; - if (priv->connect_status == LBS_CONNECTED) netif_carrier_on(dev); else @@ -191,7 +112,6 @@ static int lbs_dev_open(struct net_device *dev) if (!priv->tx_pending_len) netif_wake_queue(dev); - out: spin_unlock_irq(&priv->driver_lock); lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); @@ -211,7 +131,6 @@ static int lbs_eth_stop(struct net_device *dev) lbs_deb_enter(LBS_DEB_NET); spin_lock_irq(&priv->driver_lock); - priv->infra_open = 0; netif_stop_queue(dev); spin_unlock_irq(&priv->driver_lock); @@ -822,37 +741,16 @@ int lbs_exit_auto_deep_sleep(struct lbs_private *priv) static int lbs_init_adapter(struct lbs_private *priv) { - size_t bufsize; - int i, ret = 0; + int ret; lbs_deb_enter(LBS_DEB_MAIN); - /* Allocate buffer to store the BSSID list */ - bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor); - priv->networks = kzalloc(bufsize, GFP_KERNEL); - if (!priv->networks) { - lbs_pr_err("Out of memory allocating beacons\n"); - ret = -1; - goto out; - } - - /* Initialize scan result lists */ - INIT_LIST_HEAD(&priv->network_free_list); - INIT_LIST_HEAD(&priv->network_list); - for (i = 0; i < MAX_NETWORK_COUNT; i++) { - list_add_tail(&priv->networks[i].list, - &priv->network_free_list); - } - memset(priv->current_addr, 0xff, ETH_ALEN); priv->connect_status = LBS_DISCONNECTED; - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - priv->mode = IW_MODE_INFRA; priv->channel = DEFAULT_AD_HOC_CHANNEL; priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; priv->radio_on = 1; - priv->enablehwauto = 1; priv->psmode = LBS802_11POWERMODECAM; priv->psstate = PS_STATE_FULL_POWER; priv->is_deep_sleep = 0; @@ -907,8 +805,6 @@ static void lbs_free_adapter(struct lbs_private *priv) kfifo_free(&priv->event_fifo); del_timer(&priv->command_timer); del_timer(&priv->auto_deepsleep_timer); - kfree(priv->networks); - priv->networks = NULL; lbs_deb_leave(LBS_DEB_MAIN); } @@ -945,7 +841,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) lbs_pr_err("cfg80211 init failed\n"); goto done; } - /* TODO? */ + wdev->iftype = NL80211_IFTYPE_STATION; priv = wdev_priv(wdev); priv->wdev = wdev; @@ -955,7 +851,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) goto err_wdev; } - //TODO? dev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES); dev = alloc_netdev(0, "wlan%d", ether_setup); if (!dev) { dev_err(dmdev, "no memory for network device instance\n"); @@ -971,20 +866,10 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) dev->netdev_ops = &lbs_netdev_ops; dev->watchdog_timeo = 5 * HZ; dev->ethtool_ops = &lbs_ethtool_ops; -#ifdef WIRELESS_EXT - dev->wireless_handlers = &lbs_handler_def; -#endif dev->flags |= IFF_BROADCAST | IFF_MULTICAST; - - // TODO: kzalloc + iwm_init_default_profile(iwm, iwm->umac_profile); ?? - - priv->card = card; - priv->infra_open = 0; - - priv->rtap_net_dev = NULL; strcpy(dev->name, "wlan%d"); lbs_deb_thread("Starting main thread...\n"); @@ -996,8 +881,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev) } priv->work_thread = create_singlethread_workqueue("lbs_worker"); - INIT_DELAYED_WORK(&priv->assoc_work, lbs_association_worker); - INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker); INIT_WORK(&priv->mcast_work, lbs_set_mcast_worker); priv->wol_criteria = 0xffffffff; @@ -1031,12 +914,10 @@ void lbs_remove_card(struct lbs_private *priv) lbs_deb_enter(LBS_DEB_MAIN); lbs_remove_mesh(priv); - lbs_remove_rtap(priv); + lbs_scan_deinit(priv); dev = priv->dev; - cancel_delayed_work_sync(&priv->scan_work); - cancel_delayed_work_sync(&priv->assoc_work); cancel_work_sync(&priv->mcast_work); /* worker thread destruction blocks on the in-flight command which @@ -1077,7 +958,7 @@ void lbs_remove_card(struct lbs_private *priv) EXPORT_SYMBOL_GPL(lbs_remove_card); -static int lbs_rtap_supported(struct lbs_private *priv) +int lbs_rtap_supported(struct lbs_private *priv) { if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5) return 1; @@ -1109,16 +990,6 @@ int lbs_start_card(struct lbs_private *priv) lbs_init_mesh(priv); - /* - * While rtap isn't related to mesh, only mesh-enabled - * firmware implements the rtap functionality via - * CMD_802_11_MONITOR_MODE. - */ - if (lbs_rtap_supported(priv)) { - if (device_create_file(&dev->dev, &dev_attr_lbs_rtap)) - lbs_pr_err("cannot register lbs_rtap attribute\n"); - } - lbs_debugfs_init_one(priv, dev); lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name); @@ -1150,9 +1021,6 @@ void lbs_stop_card(struct lbs_private *priv) lbs_debugfs_remove_one(priv); lbs_deinit_mesh(priv); - if (lbs_rtap_supported(priv)) - device_remove_file(&dev->dev, &dev_attr_lbs_rtap); - /* Delete the timeout of the currently processing command */ del_timer_sync(&priv->command_timer); del_timer_sync(&priv->auto_deepsleep_timer); @@ -1239,87 +1107,6 @@ static void __exit lbs_exit_module(void) lbs_deb_leave(LBS_DEB_MAIN); } -/* - * rtap interface support fuctions - */ - -static int lbs_rtap_open(struct net_device *dev) -{ - /* Yes, _stop_ the queue. Because we don't support injection */ - lbs_deb_enter(LBS_DEB_MAIN); - netif_carrier_off(dev); - netif_stop_queue(dev); - lbs_deb_leave(LBS_DEB_LEAVE); - return 0; -} - -static int lbs_rtap_stop(struct net_device *dev) -{ - lbs_deb_enter(LBS_DEB_MAIN); - lbs_deb_leave(LBS_DEB_MAIN); - return 0; -} - -static netdev_tx_t lbs_rtap_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - netif_stop_queue(dev); - return NETDEV_TX_BUSY; -} - -static void lbs_remove_rtap(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_MAIN); - if (priv->rtap_net_dev == NULL) - goto out; - unregister_netdev(priv->rtap_net_dev); - free_netdev(priv->rtap_net_dev); - priv->rtap_net_dev = NULL; -out: - lbs_deb_leave(LBS_DEB_MAIN); -} - -static const struct net_device_ops rtap_netdev_ops = { - .ndo_open = lbs_rtap_open, - .ndo_stop = lbs_rtap_stop, - .ndo_start_xmit = lbs_rtap_hard_start_xmit, -}; - -static int lbs_add_rtap(struct lbs_private *priv) -{ - int ret = 0; - struct net_device *rtap_dev; - - lbs_deb_enter(LBS_DEB_MAIN); - if (priv->rtap_net_dev) { - ret = -EPERM; - goto out; - } - - rtap_dev = alloc_netdev(0, "rtap%d", ether_setup); - if (rtap_dev == NULL) { - ret = -ENOMEM; - goto out; - } - - memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN); - rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP; - rtap_dev->netdev_ops = &rtap_netdev_ops; - rtap_dev->ml_priv = priv; - SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent); - - ret = register_netdev(rtap_dev); - if (ret) { - free_netdev(rtap_dev); - goto out; - } - priv->rtap_net_dev = rtap_dev; - -out: - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - return ret; -} - module_init(lbs_init_module); module_exit(lbs_exit_module); |