Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184058
b: refs/heads/master
c: 6906803
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Feb 8, 2010
1 parent e95c780 commit 860529a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e7e6213e4956828927c30e3ef5a42812d00c650
refs/heads/master: 690680360cd22b55235481ca3421a3450a96138a
44 changes: 43 additions & 1 deletion trunk/drivers/net/wireless/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ static int radios = 2;
module_param(radios, int, 0444);
MODULE_PARM_DESC(radios, "Number of simulated radios");

static bool fake_hw_scan;
module_param(fake_hw_scan, bool, 0444);
MODULE_PARM_DESC(fake_hw_scan, "Install fake (no-op) hw-scan handler");

/**
* enum hwsim_regtest - the type of regulatory tests we offer
*
Expand Down Expand Up @@ -908,8 +912,43 @@ static void mac80211_hwsim_flush(struct ieee80211_hw *hw, bool drop)
*/
}

struct hw_scan_done {
struct delayed_work w;
struct ieee80211_hw *hw;
};

static const struct ieee80211_ops mac80211_hwsim_ops =
static void hw_scan_done(struct work_struct *work)
{
struct hw_scan_done *hsd =
container_of(work, struct hw_scan_done, w.work);

ieee80211_scan_completed(hsd->hw, false);
kfree(hsd);
}

static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw,
struct cfg80211_scan_request *req)
{
struct hw_scan_done *hsd = kzalloc(sizeof(*hsd), GFP_KERNEL);
int i;

if (!hsd)
return -ENOMEM;

hsd->hw = hw;
INIT_DELAYED_WORK(&hsd->w, hw_scan_done);

printk(KERN_DEBUG "hwsim scan request\n");
for (i = 0; i < req->n_channels; i++)
printk(KERN_DEBUG "hwsim scan freq %d\n",
req->channels[i]->center_freq);

ieee80211_queue_delayed_work(hw, &hsd->w, 2 * HZ);

return 0;
}

static struct ieee80211_ops mac80211_hwsim_ops =
{
.tx = mac80211_hwsim_tx,
.start = mac80211_hwsim_start,
Expand Down Expand Up @@ -1119,6 +1158,9 @@ static int __init init_mac80211_hwsim(void)
if (radios < 1 || radios > 100)
return -EINVAL;

if (fake_hw_scan)
mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;

spin_lock_init(&hwsim_radio_lock);
INIT_LIST_HEAD(&hwsim_radios);

Expand Down

0 comments on commit 860529a

Please sign in to comment.