mac80211: split ieee80211_send_probe_req()

This function is passed many more parameters in the scan case
than in the MLME case, and differentiates the two cases inside.
Split it up and make both versions static to simplify things.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
This commit is contained in:
Johannes Berg 2018-05-28 15:47:39 +02:00 committed by Johannes Berg
parent 00387f3215
commit 45ad683484
4 changed files with 37 additions and 35 deletions

View File

@ -2050,13 +2050,6 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
u32 flags); u32 flags);
void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *src, const u8 *dst,
const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len,
u32 ratemask, u32 flags, u32 tx_flags,
struct ieee80211_channel *channel, bool scan);
u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems, struct ieee802_11_elems *elems,
enum nl80211_band band, u32 *basic_rates); enum nl80211_band band, u32 *basic_rates);

View File

@ -2219,6 +2219,20 @@ void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
ieee80211_sta_reset_conn_monitor(sdata); ieee80211_sta_reset_conn_monitor(sdata);
} }
static void ieee80211_mlme_send_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *src, const u8 *dst,
const u8 *ssid, size_t ssid_len,
struct ieee80211_channel *channel)
{
struct sk_buff *skb;
skb = ieee80211_build_probe_req(sdata, src, dst, (u32)-1, channel,
ssid, ssid_len, NULL, 0,
IEEE80211_PROBE_FLAG_DIRECTED);
if (skb)
ieee80211_tx_skb(sdata, skb);
}
static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
@ -2265,11 +2279,9 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
else else
ssid_len = ssid[1]; ssid_len = ssid[1];
ieee80211_send_probe_req(sdata, sdata->vif.addr, dst, ieee80211_mlme_send_probe_req(sdata, sdata->vif.addr, dst,
ssid + 2, ssid_len, NULL, ssid + 2, ssid_len,
0, (u32) -1, ifmgd->associated->channel);
IEEE80211_PROBE_FLAG_DIRECTED, 0,
ifmgd->associated->channel, false);
rcu_read_unlock(); rcu_read_unlock();
} }

View File

@ -528,6 +528,24 @@ void ieee80211_run_deferred_scan(struct ieee80211_local *local)
round_jiffies_relative(0)); round_jiffies_relative(0));
} }
static void ieee80211_send_scan_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *src, const u8 *dst,
const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len,
u32 ratemask, u32 flags, u32 tx_flags,
struct ieee80211_channel *channel)
{
struct sk_buff *skb;
skb = ieee80211_build_probe_req(sdata, src, dst, ratemask, channel,
ssid, ssid_len,
ie, ie_len, flags);
if (skb) {
IEEE80211_SKB_CB(skb)->flags |= tx_flags;
ieee80211_tx_skb_tid_band(sdata, skb, 7, channel->band);
}
}
static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
unsigned long *next_delay) unsigned long *next_delay)
{ {
@ -548,12 +566,12 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->mtx));
for (i = 0; i < scan_req->n_ssids; i++) for (i = 0; i < scan_req->n_ssids; i++)
ieee80211_send_probe_req( ieee80211_send_scan_probe_req(
sdata, local->scan_addr, scan_req->bssid, sdata, local->scan_addr, scan_req->bssid,
scan_req->ssids[i].ssid, scan_req->ssids[i].ssid_len, scan_req->ssids[i].ssid, scan_req->ssids[i].ssid_len,
scan_req->ie, scan_req->ie_len, scan_req->ie, scan_req->ie_len,
scan_req->rates[band], 0, scan_req->rates[band], 0,
tx_flags, local->hw.conf.chandef.chan, true); tx_flags, local->hw.conf.chandef.chan);
/* /*
* After sending probe requests, wait for probe responses * After sending probe requests, wait for probe responses

View File

@ -1607,27 +1607,6 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
return skb; return skb;
} }
void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *src, const u8 *dst,
const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len,
u32 ratemask, u32 flags, u32 tx_flags,
struct ieee80211_channel *channel, bool scan)
{
struct sk_buff *skb;
skb = ieee80211_build_probe_req(sdata, src, dst, ratemask, channel,
ssid, ssid_len,
ie, ie_len, flags);
if (skb) {
IEEE80211_SKB_CB(skb)->flags |= tx_flags;
if (scan)
ieee80211_tx_skb_tid_band(sdata, skb, 7, channel->band);
else
ieee80211_tx_skb(sdata, skb);
}
}
u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems, struct ieee802_11_elems *elems,
enum nl80211_band band, u32 *basic_rates) enum nl80211_band band, u32 *basic_rates)