Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183584
b: refs/heads/master
c: e477c56
h: refs/heads/master
v: v3
  • Loading branch information
Kalle Valo authored and John W. Linville committed Jan 12, 2010
1 parent 33c973b commit 82f5d39
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 75 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: 3a98c30f3e8bb1f32b5bcb74a39647b3670de275
refs/heads/master: e477c56e852c4c6db1f7665c642c9f45f76616a9
86 changes: 12 additions & 74 deletions trunk/drivers/net/wireless/wl12xx/wl1251_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,82 +831,11 @@ static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
return ret;
}

static int wl1251_build_basic_rates(char *rates)
{
u8 index = 0;

rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;

return index;
}

static int wl1251_build_extended_rates(char *rates)
{
u8 index = 0;

rates[index++] = IEEE80211_OFDM_RATE_6MB;
rates[index++] = IEEE80211_OFDM_RATE_9MB;
rates[index++] = IEEE80211_OFDM_RATE_12MB;
rates[index++] = IEEE80211_OFDM_RATE_18MB;
rates[index++] = IEEE80211_OFDM_RATE_24MB;
rates[index++] = IEEE80211_OFDM_RATE_36MB;
rates[index++] = IEEE80211_OFDM_RATE_48MB;
rates[index++] = IEEE80211_OFDM_RATE_54MB;

return index;
}


static int wl1251_build_probe_req(struct wl1251 *wl, u8 *ssid, size_t ssid_len)
{
struct wl12xx_probe_req_template template;
struct wl12xx_ie_rates *rates;
char *ptr;
u16 size;

ptr = (char *)&template;
size = sizeof(struct ieee80211_header);

memset(template.header.da, 0xff, ETH_ALEN);
memset(template.header.bssid, 0xff, ETH_ALEN);
memcpy(template.header.sa, wl->mac_addr, ETH_ALEN);
template.header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);

/* IEs */
/* SSID */
template.ssid.header.id = WLAN_EID_SSID;
template.ssid.header.len = ssid_len;
if (ssid_len && ssid)
memcpy(template.ssid.ssid, ssid, ssid_len);
size += sizeof(struct wl12xx_ie_header) + ssid_len;
ptr += size;

/* Basic Rates */
rates = (struct wl12xx_ie_rates *)ptr;
rates->header.id = WLAN_EID_SUPP_RATES;
rates->header.len = wl1251_build_basic_rates(rates->rates);
size += sizeof(struct wl12xx_ie_header) + rates->header.len;
ptr += sizeof(struct wl12xx_ie_header) + rates->header.len;

/* Extended rates */
rates = (struct wl12xx_ie_rates *)ptr;
rates->header.id = WLAN_EID_EXT_SUPP_RATES;
rates->header.len = wl1251_build_extended_rates(rates->rates);
size += sizeof(struct wl12xx_ie_header) + rates->header.len;

wl1251_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size);

return wl1251_cmd_template_set(wl, CMD_PROBE_REQ, &template,
size);
}

static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
struct cfg80211_scan_request *req)
{
struct wl1251 *wl = hw->priv;
struct sk_buff *skb;
size_t ssid_len = 0;
u8 *ssid = NULL;
int ret;
Expand All @@ -930,9 +859,18 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
if (ret < 0)
goto out;

ret = wl1251_build_probe_req(wl, ssid, ssid_len);
skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len,
req->ie, req->ie_len);
if (!skb) {
ret = -ENOMEM;
goto out;
}

ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data,
skb->len);
dev_kfree_skb(skb);
if (ret < 0)
wl1251_error("probe request template build failed");
goto out_sleep;

ret = wl1251_cmd_trigger_scan_to(wl, 0);
if (ret < 0)
Expand Down

0 comments on commit 82f5d39

Please sign in to comment.