Commit 7524d7d6 authored by Adrian Bunk's avatar Adrian Bunk Committed by John W. Linville

the scheduled ieee80211 softmac removal

Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2079fcdc
......@@ -230,14 +230,6 @@ Who: Jean Delvare <khali@linux-fr.org>
---------------------------
What: ieee80211 softmac wireless networking component
When: 2.6.26 (or after removal of bcm43xx and port of zd1211rw to mac80211)
Files: net/ieee80211/softmac
Why: No in-kernel drivers will depend on it any longer.
Who: John W. Linville <linville@tuxdriver.com>
---------------------------
What: rc80211-simple rate control algorithm for mac80211
When: 2.6.26
Files: net/mac80211/rc80211-simple.c
......
......@@ -3548,12 +3548,6 @@ M: mhoffman@lightlink.com
L: lm-sensors@lm-sensors.org
S: Maintained
SOFTMAC LAYER (IEEE 802.11)
P: Daniel Drake
M: dsd@gentoo.org
L: linux-wireless@vger.kernel.org
S: Obsolete
SOFTWARE RAID (Multiple Disks) SUPPORT
P: Ingo Molnar
M: mingo@redhat.com
......
This diff is collapsed.
/*
* This file contains the prototypes for the wireless extension
* handlers that the softmac API provides. Include this file to
* use the wx handlers, you can assign these directly.
*
* Copyright (c) 2005 Johannes Berg <johannes@sipsolutions.net>
* Joseph Jezak <josejx@gentoo.org>
* Larry Finger <Larry.Finger@lwfinger.net>
* Danny van Dyk <kugelfang@gentoo.org>
* Michael Buesch <mbuesch@freenet.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* The full GNU General Public License is included in this distribution in the
* file called COPYING.
*/
#ifndef _IEEE80211SOFTMAC_WX_H
#define _IEEE80211SOFTMAC_WX_H
#include <net/ieee80211softmac.h>
#include <net/iw_handler.h>
extern int
ieee80211softmac_wx_trigger_scan(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_get_scan_results(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_set_essid(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_get_essid(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_set_rate(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_get_rate(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_get_wap(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_set_wap(struct net_device *net_dev,
struct iw_request_info *info,
union iwreq_data *data,
char *extra);
extern int
ieee80211softmac_wx_set_genie(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu,
char *extra);
extern int
ieee80211softmac_wx_get_genie(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu,
char *extra);
extern int
ieee80211softmac_wx_set_mlme(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu,
char *extra);
#endif /* _IEEE80211SOFTMAC_WX */
......@@ -71,4 +71,3 @@ config IEEE80211_CRYPT_TKIP
This can be compiled as a module and it will be called
"ieee80211_crypt_tkip".
source "net/ieee80211/softmac/Kconfig"
......@@ -10,4 +10,3 @@ ieee80211-objs := \
ieee80211_wx.o \
ieee80211_geo.o
obj-$(CONFIG_IEEE80211_SOFTMAC) += softmac/
config IEEE80211_SOFTMAC
tristate "Software MAC add-on to the IEEE 802.11 networking stack"
depends on IEEE80211 && EXPERIMENTAL
select WIRELESS_EXT
select IEEE80211_CRYPT_WEP
---help---
This option enables the hardware independent software MAC addon
for the IEEE 802.11 networking stack.
config IEEE80211_SOFTMAC_DEBUG
bool "Enable full debugging output"
depends on IEEE80211_SOFTMAC
obj-$(CONFIG_IEEE80211_SOFTMAC) += ieee80211softmac.o
ieee80211softmac-objs := \
ieee80211softmac_io.o \
ieee80211softmac_auth.o \
ieee80211softmac_module.o \
ieee80211softmac_scan.o \
ieee80211softmac_wx.o \
ieee80211softmac_assoc.o \
ieee80211softmac_event.o
This diff is collapsed.
This diff is collapsed.
/*
* Event system
* Also see comments in public header file and longer explanation below.
*
* Copyright (c) 2005, 2006 Johannes Berg <johannes@sipsolutions.net>
* Joseph Jezak <josejx@gentoo.org>
* Larry Finger <Larry.Finger@lwfinger.net>
* Danny van Dyk <kugelfang@gentoo.org>
* Michael Buesch <mbuesch@freenet.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* The full GNU General Public License is included in this distribution in the
* file called COPYING.
*/
#include "ieee80211softmac_priv.h"
/*
* Each event has associated to it
* - an event type (see constants in public header)
* - an event context (see below)
* - the function to be called
* - a context (extra parameter to call the function with)
* - and the softmac struct
*
* The event context is private and can only be used from
* within this module. Its meaning varies with the event
* type:
* SCAN_FINISHED,
* DISASSOCIATED: NULL
* ASSOCIATED,
* ASSOCIATE_FAILED,
* ASSOCIATE_TIMEOUT,
* AUTHENTICATED,
* AUTH_FAILED,
* AUTH_TIMEOUT: a pointer to the network struct
* ...
* Code within this module can use the event context to be only
* called when the event is true for that specific context
* as per above table.
* If the event context is NULL, then the notification is always called,
* regardless of the event context. The event context is not passed to
* the callback, it is assumed that the context suffices.
*
* You can also use the event context only by setting the event type
* to -1 (private use only), in which case you'll be notified
* whenever the event context matches.
*/
static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = {
NULL, /* scan finished */
NULL, /* associated */
"associating failed",
"associating timed out",
"authenticated",
"authenticating failed",
"authenticating timed out",
"associating failed because no suitable network was found",
NULL, /* disassociated */
};
static void
ieee80211softmac_notify_callback(struct work_struct *work)
{
struct ieee80211softmac_event *pevent =
container_of(work, struct ieee80211softmac_event, work.work);
struct ieee80211softmac_event event = *pevent;
kfree(pevent);
event.fun(event.mac->dev, event.event_type, event.context);
}
int
ieee80211softmac_notify_internal(struct ieee80211softmac_device *mac,
int event, void *event_context, notify_function_ptr fun, void *context, gfp_t gfp_mask)
{
struct ieee80211softmac_event *eventptr;
unsigned long flags;
if (event < -1 || event > IEEE80211SOFTMAC_EVENT_LAST)
return -ENOSYS;
if (!fun)
return -EINVAL;
eventptr = kmalloc(sizeof(struct ieee80211softmac_event), gfp_mask);
if (!eventptr)
return -ENOMEM;
eventptr->event_type = event;
INIT_DELAYED_WORK(&eventptr->work, ieee80211softmac_notify_callback);
eventptr->fun = fun;
eventptr->context = context;
eventptr->mac = mac;
eventptr->event_context = event_context;
spin_lock_irqsave(&mac->lock, flags);
list_add(&eventptr->list, &mac->events);
spin_unlock_irqrestore(&mac->lock, flags);
return 0;
}
int
ieee80211softmac_notify_gfp(struct net_device *dev,
int event, notify_function_ptr fun, void *context, gfp_t gfp_mask)
{
struct ieee80211softmac_device *mac = ieee80211_priv(dev);
if (event < 0 || event > IEEE80211SOFTMAC_EVENT_LAST)
return -ENOSYS;
return ieee80211softmac_notify_internal(mac, event, NULL, fun, context, gfp_mask);
}
EXPORT_SYMBOL_GPL(ieee80211softmac_notify_gfp);
/* private -- calling all callbacks that were specified */
void
ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx)
{
struct ieee80211softmac_event *eventptr, *tmp;
struct ieee80211softmac_network *network;
if (event >= 0) {
union iwreq_data wrqu;
int we_event;
char *msg = NULL;
memset(&wrqu, '\0', sizeof (union iwreq_data));
switch(event) {
case IEEE80211SOFTMAC_EVENT_ASSOCIATED:
network = (struct ieee80211softmac_network *)event_ctx;
memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN);
/* fall through */
case IEEE80211SOFTMAC_EVENT_DISASSOCIATED:
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
we_event = SIOCGIWAP;
break;
case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED:
we_event = SIOCGIWSCAN;
break;
default:
msg = event_descriptions[event];
if (!msg)
msg = "SOFTMAC EVENT BUG";
wrqu.data.length = strlen(msg);
we_event = IWEVCUSTOM;
break;
}
wireless_send_event(mac->dev, we_event, &wrqu, msg);
}
if (!list_empty(&mac->events))
list_for_each_entry_safe(eventptr, tmp, &mac->events, list) {
if ((eventptr->event_type == event || eventptr->event_type == -1)
&& (eventptr->event_context == NULL || eventptr->event_context == event_ctx)) {
list_del(&eventptr->list);
/* User may have subscribed to ANY event, so
* we tell them which event triggered it. */
eventptr->event_type = event;
queue_delayed_work(mac->wq, &eventptr->work, 0);
}
}
}
void
ieee80211softmac_call_events(struct ieee80211softmac_device *mac, int event, void *event_ctx)
{
unsigned long flags;
spin_lock_irqsave(&mac->lock, flags);
ieee80211softmac_call_events_locked(mac, event, event_ctx);
spin_unlock_irqrestore(&mac->lock, flags);
}
This diff is collapsed.
This diff is collapsed.
/*
* Internal softmac API definitions.
*
* Copyright (c) 2005, 2006 Johannes Berg <johannes@sipsolutions.net>
* Joseph Jezak <josejx@gentoo.org>
* Larry Finger <Larry.Finger@lwfinger.net>
* Danny van Dyk <kugelfang@gentoo.org>
* Michael Buesch <mbuesch@freenet.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* The full GNU General Public License is included in this distribution in the
* file called COPYING.
*/
#ifndef IEEE80211SOFTMAC_PRIV_H_
#define IEEE80211SOFTMAC_PRIV_H_
#include <net/ieee80211softmac.h>
#include <net/ieee80211softmac_wx.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
#define PFX "SoftMAC: "
#ifdef assert
# undef assert
#endif
#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
#define assert(expr) \
do { \
if (unlikely(!(expr))) { \
printkl(KERN_ERR PFX "ASSERTION FAILED (%s) at: %s:%d:%s()\n", #expr, \
__FILE__, __LINE__, __func__); \
} \
} while (0)
#else
#define assert(expr) do {} while (0)
#endif
/* rate limited printk(). */
#ifdef printkl
# undef printkl
#endif
#define printkl(f, x...) do { if (printk_ratelimit()) printk(f ,##x); } while (0)
/* rate limited printk() for debugging */
#ifdef dprintkl
# undef dprintkl
#endif
#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
# define dprintkl printkl
#else
# define dprintkl(f, x...) do { /* nothing */ } while (0)
#endif
/* debugging printk() */
#ifdef dprintk
# undef dprintk
#endif
#ifdef CONFIG_IEEE80211_SOFTMAC_DEBUG
# define dprintk(f, x...) do { printk(f ,##x); } while (0)
#else
# define dprintk(f, x...) do { /* nothing */ } while (0)
#endif
/* private definitions and prototypes */
/*** prototypes from _scan.c */
void ieee80211softmac_scan(struct work_struct *work);
/* for internal use if scanning is needed */
int ieee80211softmac_start_scan(struct ieee80211softmac_device *mac);
void ieee80211softmac_stop_scan(struct ieee80211softmac_device *mac);
void ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *mac);
/* for use by _module.c to assign to the callbacks */
int ieee80211softmac_start_scan_implementation(struct net_device *dev);
void ieee80211softmac_stop_scan_implementation(struct net_device *dev);
void ieee80211softmac_wait_for_scan_implementation(struct net_device *dev);
/*** Network prototypes from _module.c */
struct ieee80211softmac_network * ieee80211softmac_create_network(
struct ieee80211softmac_device *mac, struct ieee80211_network *net);
void ieee80211softmac_add_network_locked(struct ieee80211softmac_device *mac,
struct ieee80211softmac_network *net);
void ieee80211softmac_add_network(struct ieee80211softmac_device *mac,
struct ieee80211softmac_network *net);
void ieee80211softmac_del_network_locked(struct ieee80211softmac_device *mac,
struct ieee80211softmac_network *net);
void ieee80211softmac_del_network(struct ieee80211softmac_device *mac,
struct ieee80211softmac_network *net);
struct ieee80211softmac_network * ieee80211softmac_get_network_by_bssid_locked(
struct ieee80211softmac_device *mac, u8 *ea);
struct ieee80211softmac_network * ieee80211softmac_get_network_by_bssid(
struct ieee80211softmac_device *mac, u8 *ea);
struct ieee80211softmac_network * ieee80211softmac_get_network_by_ssid_locked(
struct ieee80211softmac_device *mac, u8 *ssid, u8 ssid_len);
struct ieee80211softmac_network * ieee80211softmac_get_network_by_ssid(
struct ieee80211softmac_device *mac, u8 *ssid, u8 ssid_len);
struct ieee80211softmac_network *
ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac,
struct ieee80211softmac_essid *essid);
struct ieee80211softmac_network *
ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac,
struct ieee80211softmac_essid *essid);
/* Rates related */
void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac,
u8 erp_value);
int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate);
u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta);
void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac);
void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac);
static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) {
return ieee80211softmac_lower_rate_delta(mac, rate, 1);
}
static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate)
{
return ieee80211softmac_lower_rate_delta(mac, rate, 2);
}
/*** prototypes from _io.c */
int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac,
void* ptrarg, u32 type, u32 arg);
int ieee80211softmac_handle_beacon(struct net_device *dev,
struct ieee80211_beacon *beacon,
struct ieee80211_network *network);
/*** prototypes from _auth.c */
/* do these have to go into the public header? */
int ieee80211softmac_auth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net);
int ieee80211softmac_deauth_req(struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, int reason);
/* for use by _module.c to assign to the callbacks */
int ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth);
int ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *deauth);
/*** prototypes from _assoc.c */
void ieee80211softmac_assoc_work(struct work_struct *work);
int ieee80211softmac_handle_assoc_response(struct net_device * dev,
struct ieee80211_assoc_response * resp,
struct ieee80211_network * network);
int ieee80211softmac_handle_disassoc(struct net_device * dev,
struct ieee80211_disassoc * disassoc);
int ieee80211softmac_handle_reassoc_req(struct net_device * dev,
struct ieee80211_reassoc_request * reassoc);
void ieee80211softmac_assoc_timeout(struct work_struct *work);
void ieee80211softmac_send_disassoc_req(struct ieee80211softmac_device *mac, u16 reason);
void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac);
/* some helper functions */
static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm)
{
return (sm->start_scan == ieee80211softmac_start_scan_implementation) &&
(sm->stop_scan == ieee80211softmac_stop_scan_implementation) &&
(sm->wait_for_scan == ieee80211softmac_wait_for_scan_implementation);
}
static inline int ieee80211softmac_scan_sanity_check(struct ieee80211softmac_device *sm)
{
return ((sm->start_scan != ieee80211softmac_start_scan_implementation) &&
(sm->stop_scan != ieee80211softmac_stop_scan_implementation) &&
(sm->wait_for_scan != ieee80211softmac_wait_for_scan_implementation)
) || ieee80211softmac_scan_handlers_check_self(sm);
}
#define IEEE80211SOFTMAC_PROBE_DELAY HZ/50
#define IEEE80211SOFTMAC_WORKQUEUE_NAME_LEN (17 + IFNAMSIZ)
struct ieee80211softmac_network {
struct list_head list; /* List */
/* Network information copied from ieee80211_network */
u8 bssid[ETH_ALEN];
u8 channel;
struct ieee80211softmac_essid essid;
struct ieee80211softmac_ratesinfo supported_rates;
/* SoftMAC specific */
u16 authenticating:1, /* Status Flags */
authenticated:1,
auth_desynced_once:1;
u8 erp_value; /* Saved ERP value */
u16 capabilities; /* Capabilities bitfield */
u8 challenge_len; /* Auth Challenge length */
char *challenge; /* Challenge Text */
};
/* structure used to keep track of networks we're auth'ing to */
struct ieee80211softmac_auth_queue_item {
struct list_head list; /* List head */
struct ieee80211softmac_network *net; /* Network to auth */
struct ieee80211softmac_device *mac; /* SoftMAC device */
u8 retry; /* Retry limit */
u8 state; /* Auth State */
struct delayed_work work; /* Work queue */
};
/* scanning information */
struct ieee80211softmac_scaninfo {
u8 current_channel_idx,
number_channels;
struct ieee80211_channel *channels;
u8 started:1,
stop:1;
u8 skip_flags;
struct completion finished;
struct delayed_work softmac_scan;
struct ieee80211softmac_device *mac;
};
/* private event struct */
struct ieee80211softmac_event {
struct list_head list;
int event_type;
void *event_context;
struct delayed_work work;
notify_function_ptr fun;
void *context;
struct ieee80211softmac_device *mac;
};
void ieee80211softmac_call_events(struct ieee80211softmac_device *mac, int event, void *event_context);
void ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_context);
int ieee80211softmac_notify_internal(struct ieee80211softmac_device *mac,
int event, void *event_context, notify_function_ptr fun, void *context, gfp_t gfp_mask);
void ieee80211softmac_try_reassoc(struct ieee80211softmac_device *mac);
#endif /* IEEE80211SOFTMAC_PRIV_H_ */
/*
* Scanning routines.
*
* These are not exported because they're assigned to the function pointers.
*
* Copyright (c) 2005, 2006 Johannes Berg <johannes@sipsolutions.net>
* Joseph Jezak <josejx@gentoo.org>
* Larry Finger <Larry.Finger@lwfinger.net>
* Danny van Dyk <kugelfang@gentoo.org>
* Michael Buesch <mbuesch@freenet.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* The full GNU General Public License is included in this distribution in the
* file called COPYING.
*/
#include <linux/completion.h>
#include "ieee80211softmac_priv.h"
/* internal, use to trigger scanning if needed.
* Returns -EBUSY if already scanning,
* result of start_scan otherwise */
int
ieee80211softmac_start_scan(struct ieee80211softmac_device *sm)
{
unsigned long flags;
int ret;
spin_lock_irqsave(&sm->lock, flags);
if (sm->scanning)
{
spin_unlock_irqrestore(&sm->lock, flags);
return -EINPROGRESS;
}
sm->scanning = 1;
spin_unlock_irqrestore(&sm->lock, flags);
ret = sm->start_scan(sm->dev);
if (ret) {
spin_lock_irqsave(&sm->lock, flags);
sm->scanning = 0;
spin_unlock_irqrestore(&sm->lock, flags);
}
return ret;
}
void
ieee80211softmac_stop_scan(struct ieee80211softmac_device *sm)
{
unsigned long flags;
spin_lock_irqsave(&sm->lock, flags);
if (!sm->scanning) {
spin_unlock_irqrestore(&sm->lock, flags);
return;
}
spin_unlock_irqrestore(&sm->lock, flags);
sm->stop_scan(sm->dev);
}
void
ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *sm)
{
unsigned long flags;
spin_lock_irqsave(&sm->lock, flags);
if (!sm->scanning) {
spin_unlock_irqrestore(&sm->lock, flags);
return;
}
spin_unlock_irqrestore(&sm->lock, flags);
sm->wait_for_scan(sm->dev);
}
/* internal scanning implementation follows */
void ieee80211softmac_scan(struct work_struct *work)
{
int invalid_channel;
u8 current_channel_idx;
struct ieee80211softmac_scaninfo *si =
container_of(work, struct ieee80211softmac_scaninfo,
softmac_scan.work);
struct ieee80211softmac_device *sm = si->mac;
unsigned long flags;
while (!(si->stop) && (si->current_channel_idx < si->number_channels)) {
current_channel_idx = si->current_channel_idx;
si->current_channel_idx++; /* go to the next channel */
invalid_channel = (si->skip_flags & si->channels[current_channel_idx].flags);
if (!invalid_channel) {
sm->set_channel(sm->dev, si->channels[current_channel_idx].channel);
// FIXME make this user configurable (active/passive)
if(ieee80211softmac_send_mgt_frame(sm, NULL, IEEE80211_STYPE_PROBE_REQ, 0))
printkl(KERN_DEBUG PFX "Sending Probe Request Failed\n");
/* also send directed management frame for the network we're looking for */
// TODO: is this if correct, or should we do this only if scanning from assoc request?
if (sm->associnfo.req_essid.len)
ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0);
spin_lock_irqsave(&sm->lock, flags);
if (unlikely(!sm->running)) {
/* Prevent reschedule on workqueue flush */
spin_unlock_irqrestore(&sm->lock, flags);
break;
}
queue_delayed_work(sm->wq, &si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY);
spin_unlock_irqrestore(&sm->lock, flags);
return;
} else {
dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel);
}
}
spin_lock_irqsave(&sm->lock, flags);
cancel_delayed_work(&si->softmac_scan);
si->started = 0;
spin_unlock_irqrestore(&sm->lock, flags);
dprintk(PFX "Scanning finished: scanned %d channels starting with channel %d\n",
sm->scaninfo->number_channels, sm->scaninfo->channels[0].channel);
ieee80211softmac_scan_finished(sm);
complete_all(&sm->scaninfo->finished);
}
static inline struct ieee80211softmac_scaninfo *allocate_scaninfo(struct ieee80211softmac_device *mac)
{
/* ugh. can we call this without having the spinlock held? */
struct ieee80211softmac_scaninfo *info = kmalloc(sizeof(struct ieee80211softmac_scaninfo), GFP_ATOMIC);
if (unlikely(!info))
return NULL;
INIT_DELAYED_WORK(&info->softmac_scan, ieee80211softmac_scan);
info->mac = mac;
init_completion(&info->finished);
return info;
}
int ieee80211softmac_start_scan_implementation(struct net_device *dev)
{
struct ieee80211softmac_device *sm = ieee80211_priv(dev);
unsigned long flags;
if (!(dev->flags & IFF_UP))
return -ENODEV;
assert(ieee80211softmac_scan_handlers_check_self(sm));
if (!ieee80211softmac_scan_handlers_check_self(sm))
return -EINVAL;
spin_lock_irqsave(&sm->lock, flags);
/* it looks like we need to hold the lock here
* to make sure we don't allocate two of these... */
if (unlikely(!sm->scaninfo))
sm->scaninfo = allocate_scaninfo(sm);
if (unlikely(!sm->scaninfo)) {
spin_unlock_irqrestore(&sm->lock, flags);
return -ENOMEM;
}
sm->scaninfo->skip_flags = IEEE80211_CH_INVALID;
if (0 /* not scanning in IEEE802.11b */)//TODO
sm->scaninfo->skip_flags |= IEEE80211_CH_B_ONLY;
if (0 /* IEEE802.11a */) {//TODO
sm->scaninfo->channels = sm->ieee->geo.a;
sm->scaninfo->number_channels = sm->ieee->geo.a_channels;
} else {
sm->scaninfo->channels = sm->ieee->geo.bg;
sm->scaninfo->number_channels = sm->ieee->geo.bg_channels;
}
sm->scaninfo->current_channel_idx = 0;
sm->scaninfo->started = 1;
sm->scaninfo->stop = 0;
INIT_COMPLETION(sm->scaninfo->finished);
queue_delayed_work(sm->wq, &sm->scaninfo->softmac_scan, 0);
spin_unlock_irqrestore(&sm->lock, flags);
return 0;
}
void ieee80211softmac_stop_scan_implementation(struct net_device *dev)
{
struct ieee80211softmac_device *sm = ieee80211_priv(dev);
unsigned long flags;
assert(ieee80211softmac_scan_handlers_check_self(sm));
if (!ieee80211softmac_scan_handlers_check_self(sm))
return;
spin_lock_irqsave(&sm->lock, flags);
assert(sm->scaninfo != NULL);
if (sm->scaninfo) {
if (sm->scaninfo->started)
sm->scaninfo->stop = 1;
else
complete_all(&sm->scaninfo->finished);
}
spin_unlock_irqrestore(&sm->lock, flags);
}
void ieee80211softmac_wait_for_scan_implementation(struct net_device *dev)
{
struct ieee80211softmac_device *sm = ieee80211_priv(dev);
unsigned long flags;
assert(ieee80211softmac_scan_handlers_check_self(sm));
if (!ieee80211softmac_scan_handlers_check_self(sm))
return;
spin_lock_irqsave(&sm->lock, flags);
if (!sm->scaninfo->started) {
spin_unlock_irqrestore(&sm->lock, flags);
return;
}
spin_unlock_irqrestore(&sm->lock, flags);
wait_for_completion(&sm->scaninfo->finished);
}
/* this is what drivers (that do scanning) call when they're done */
void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm)
{
unsigned long flags;
spin_lock_irqsave(&sm->lock, flags);
sm->scanning = 0;
spin_unlock_irqrestore(&sm->lock, flags);
if (sm->associnfo.bssvalid) {
struct ieee80211softmac_network *net;
net = ieee80211softmac_get_network_by_bssid(sm, sm->associnfo.bssid);
if (net)
sm->set_channel(sm->dev, net->channel);
}
ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL);
}
EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished);
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment