Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2b13452 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

mac80211: clean up scan namespace



Most of the scan functions are called ieee80211_sta_scan_*
or similar, make clean it up so they are all just called
ieee80211_scan_*.

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 213cd118
Loading
Loading
Loading
Loading
+28 −25
Original line number Diff line number Diff line
@@ -71,9 +71,9 @@ struct ieee80211_fragment_entry {
};


struct ieee80211_sta_bss {
struct ieee80211_bss {
	struct list_head list;
	struct ieee80211_sta_bss *hnext;
	struct ieee80211_bss *hnext;
	size_t ssid_len;

	atomic_t users;
@@ -112,7 +112,7 @@ struct ieee80211_sta_bss {
	u8 erp_value;
};

static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss)
static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
{
#ifdef CONFIG_MAC80211_MESH
	return bss->mesh_cfg;
@@ -120,7 +120,7 @@ static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss)
	return NULL;
}

static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss)
static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
{
#ifdef CONFIG_MAC80211_MESH
	return bss->mesh_id;
@@ -128,7 +128,7 @@ static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss)
	return NULL;
}

static inline u8 bss_mesh_id_len(struct ieee80211_sta_bss *bss)
static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
{
#ifdef CONFIG_MAC80211_MESH
	return bss->mesh_id_len;
@@ -658,8 +658,8 @@ struct ieee80211_local {
	spinlock_t key_lock;


	bool sta_sw_scanning;
	bool sta_hw_scanning;
	/* Scanning and BSS list */
	bool sw_scanning, hw_scanning;
	int scan_channel_idx;
	enum ieee80211_band scan_band;

@@ -670,9 +670,9 @@ struct ieee80211_local {
	struct ieee80211_channel *oper_channel, *scan_channel;
	u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
	size_t scan_ssid_len;
	struct list_head sta_bss_list;
	struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
	spinlock_t sta_bss_lock;
	struct list_head bss_list;
	struct ieee80211_bss *bss_hash[STA_HASH_SIZE];
	spinlock_t bss_lock;

	/* SNMP counters */
	/* dot11CountersTable */
@@ -905,7 +905,7 @@ extern const struct iw_handler_def ieee80211_iw_handler_def;

/* STA/IBSS code */
void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
void ieee80211_sta_scan_work(struct work_struct *work);
void ieee80211_scan_work(struct work_struct *work);
void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
			   struct ieee80211_rx_status *rx_status);
int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
@@ -926,35 +926,38 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
			      u8 *ssid, size_t ssid_len);

/* scan/BSS handling */
int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len);
int ieee80211_sta_scan_results(struct ieee80211_local *local,
int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
			   u8 *ssid, size_t ssid_len);
int ieee80211_scan_results(struct ieee80211_local *local,
			   struct iw_request_info *info,
			   char *buf, size_t len);
ieee80211_rx_result ieee80211_sta_rx_scan(
	struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
ieee80211_rx_result
ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata,
		  struct sk_buff *skb,
		  struct ieee80211_rx_status *rx_status);
void ieee80211_rx_bss_list_init(struct ieee80211_local *local);
void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local);
int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len);
int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata,
			       char *ie, size_t len);

void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata,
int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
			 u8 *ssid, size_t ssid_len);
struct ieee80211_sta_bss *
struct ieee80211_bss *
ieee80211_bss_info_update(struct ieee80211_local *local,
			  struct ieee80211_rx_status *rx_status,
			  struct ieee80211_mgmt *mgmt,
			  size_t len,
			  struct ieee802_11_elems *elems,
			  int freq, bool beacon);
struct ieee80211_sta_bss *
struct ieee80211_bss *
ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq,
		     u8 *ssid, u8 ssid_len);
struct ieee80211_sta_bss *
struct ieee80211_bss *
ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
		     u8 *ssid, u8 ssid_len);
void ieee80211_rx_bss_put(struct ieee80211_local *local,
			  struct ieee80211_sta_bss *bss);
			  struct ieee80211_bss *bss);

/* interface handling */
void ieee80211_if_setup(struct net_device *dev);
+3 −3
Original line number Diff line number Diff line
@@ -598,7 +598,7 @@ static int ieee80211_stop(struct net_device *dev)
			 * the scan_sdata is NULL already don't send out a
			 * scan event to userspace -- the scan is incomplete.
			 */
			if (local->sta_sw_scanning)
			if (local->sw_scanning)
				ieee80211_scan_completed(&local->hw);
		}

@@ -732,7 +732,7 @@ int ieee80211_hw_config(struct ieee80211_local *local)
	struct ieee80211_channel *chan;
	int ret = 0;

	if (local->sta_sw_scanning)
	if (local->sw_scanning)
		chan = local->scan_channel;
	else
		chan = local->oper_channel;
@@ -1290,7 +1290,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,

	spin_lock_init(&local->key_lock);

	INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work);
	INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);

	sta_info_init(local);

+1 −1
Original line number Diff line number Diff line
@@ -566,7 +566,7 @@ static void ieee80211_mesh_work(struct work_struct *work)
	if (!netif_running(sdata->dev))
		return;

	if (local->sta_sw_scanning || local->sta_hw_scanning)
	if (local->sw_scanning || local->hw_scanning)
		return;

	while ((skb = skb_dequeue(&ifmsh->skb_queue)))
+26 −25
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static int ecw2cw(int ecw)
	return (1 << ecw) - 1;
}

static u8 *ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie)
static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
{
	u8 *end, *pos;

@@ -72,7 +72,7 @@ static u8 *ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie)
	return NULL;
}

static int ieee80211_compatible_rates(struct ieee80211_sta_bss *bss,
static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
				      struct ieee80211_supported_band *sband,
				      u64 *rates)
{
@@ -239,7 +239,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
	u8 *pos, *ies, *ht_add_ie;
	int i, len, count, rates_len, supp_rates_len;
	u16 capab;
	struct ieee80211_sta_bss *bss;
	struct ieee80211_bss *bss;
	int wmm = 0;
	struct ieee80211_supported_band *sband;
	u64 rates = 0;
@@ -470,7 +470,7 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,

/* MLME */
static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
					 struct ieee80211_sta_bss *bss)
					 struct ieee80211_bss *bss)
{
	struct ieee80211_local *local = sdata->local;
	int i, have_higher_than_11mbit = 0;
@@ -621,7 +621,7 @@ static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata,
}

static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
					   struct ieee80211_sta_bss *bss)
					   struct ieee80211_bss *bss)
{
	u32 changed = 0;

@@ -674,7 +674,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
	struct ieee80211_conf *conf = &local_to_hw(local)->conf;
	u32 changed = BSS_CHANGED_ASSOC;

	struct ieee80211_sta_bss *bss;
	struct ieee80211_bss *bss;

	ifsta->flags |= IEEE80211_STA_ASSOCIATED;

@@ -846,7 +846,7 @@ static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata,
				      struct ieee80211_if_sta *ifsta)
{
	struct ieee80211_local *local = sdata->local;
	struct ieee80211_sta_bss *bss;
	struct ieee80211_bss *bss;
	int bss_privacy;
	int wep_privacy;
	int privacy_invoked;
@@ -1219,7 +1219,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
	/* Add STA entry for the AP */
	sta = sta_info_get(local, ifsta->bssid);
	if (!sta) {
		struct ieee80211_sta_bss *bss;
		struct ieee80211_bss *bss;
		int err;

		sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC);
@@ -1339,7 +1339,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,

static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
				   struct ieee80211_if_sta *ifsta,
				   struct ieee80211_sta_bss *bss)
				   struct ieee80211_bss *bss)
{
	struct ieee80211_local *local = sdata->local;
	int res, rates, i, j;
@@ -1490,7 +1490,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
{
	struct ieee80211_local *local = sdata->local;
	int freq;
	struct ieee80211_sta_bss *bss;
	struct ieee80211_bss *bss;
	struct sta_info *sta;
	struct ieee80211_channel *channel;
	u64 beacon_timestamp, rx_timestamp;
@@ -1893,7 +1893,7 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata,

	printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
	       "IBSS networks with same SSID (merge)\n", sdata->dev->name);
	ieee80211_sta_req_scan(sdata, ifsta->ssid, ifsta->ssid_len);
	ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len);
}


@@ -1974,7 +1974,7 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata,
				     struct ieee80211_if_sta *ifsta)
{
	struct ieee80211_local *local = sdata->local;
	struct ieee80211_sta_bss *bss;
	struct ieee80211_bss *bss;
	struct ieee80211_supported_band *sband;
	u8 bssid[ETH_ALEN], *pos;
	int i;
@@ -2035,7 +2035,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
				   struct ieee80211_if_sta *ifsta)
{
	struct ieee80211_local *local = sdata->local;
	struct ieee80211_sta_bss *bss;
	struct ieee80211_bss *bss;
	int found = 0;
	u8 bssid[ETH_ALEN];
	int active_ibss;
@@ -2050,8 +2050,8 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
	printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n",
	       sdata->dev->name, active_ibss);
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
	spin_lock_bh(&local->sta_bss_lock);
	list_for_each_entry(bss, &local->sta_bss_list, list) {
	spin_lock_bh(&local->bss_lock);
	list_for_each_entry(bss, &local->bss_list, list) {
		if (ifsta->ssid_len != bss->ssid_len ||
		    memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0
		    || !(bss->capability & WLAN_CAPABILITY_IBSS))
@@ -2065,7 +2065,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
		if (active_ibss || memcmp(bssid, ifsta->bssid, ETH_ALEN) != 0)
			break;
	}
	spin_unlock_bh(&local->sta_bss_lock);
	spin_unlock_bh(&local->bss_lock);

#ifdef CONFIG_MAC80211_IBSS_DEBUG
	if (found)
@@ -2110,7 +2110,7 @@ dont_join:
			      IEEE80211_SCAN_INTERVAL)) {
		printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to "
		       "join\n", sdata->dev->name);
		return ieee80211_sta_req_scan(sdata, ifsta->ssid,
		return ieee80211_request_scan(sdata, ifsta->ssid,
					      ifsta->ssid_len);
	} else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) {
		int interval = IEEE80211_SCAN_INTERVAL;
@@ -2145,12 +2145,12 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
				     struct ieee80211_if_sta *ifsta)
{
	struct ieee80211_local *local = sdata->local;
	struct ieee80211_sta_bss *bss, *selected = NULL;
	struct ieee80211_bss *bss, *selected = NULL;
	int top_rssi = 0, freq;

	spin_lock_bh(&local->sta_bss_lock);
	spin_lock_bh(&local->bss_lock);
	freq = local->oper_channel->center_freq;
	list_for_each_entry(bss, &local->sta_bss_list, list) {
	list_for_each_entry(bss, &local->bss_list, list) {
		if (!(bss->capability & WLAN_CAPABILITY_ESS))
			continue;

@@ -2180,7 +2180,7 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
	}
	if (selected)
		atomic_inc(&selected->users);
	spin_unlock_bh(&local->sta_bss_lock);
	spin_unlock_bh(&local->bss_lock);

	if (selected) {
		ieee80211_set_freq(sdata, selected->freq);
@@ -2207,9 +2207,9 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
		if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) {
			ifsta->assoc_scan_tries++;
			if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL)
				ieee80211_sta_start_scan(sdata, NULL, 0);
				ieee80211_start_scan(sdata, NULL, 0);
			else
				ieee80211_sta_start_scan(sdata, ifsta->ssid,
				ieee80211_start_scan(sdata, ifsta->ssid,
							 ifsta->ssid_len);
			ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
			set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
@@ -2231,7 +2231,7 @@ static void ieee80211_sta_work(struct work_struct *work)
	if (!netif_running(sdata->dev))
		return;

	if (local->sta_sw_scanning || local->sta_hw_scanning)
	if (local->sw_scanning || local->hw_scanning)
		return;

	if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA &&
@@ -2246,7 +2246,8 @@ static void ieee80211_sta_work(struct work_struct *work)
	    ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
	    ifsta->state != IEEE80211_STA_MLME_ASSOCIATE &&
	    test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
		ieee80211_sta_start_scan(sdata, ifsta->scan_ssid, ifsta->scan_ssid_len);
		ieee80211_start_scan(sdata, ifsta->scan_ssid,
				     ifsta->scan_ssid_len);
		return;
	}

+5 −5
Original line number Diff line number Diff line
@@ -403,12 +403,12 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
	struct ieee80211_local *local = rx->local;
	struct sk_buff *skb = rx->skb;

	if (unlikely(local->sta_hw_scanning))
		return ieee80211_sta_rx_scan(rx->sdata, skb, rx->status);
	if (unlikely(local->hw_scanning))
		return ieee80211_scan_rx(rx->sdata, skb, rx->status);

	if (unlikely(local->sta_sw_scanning)) {
	if (unlikely(local->sw_scanning)) {
		/* drop all the other packets during a software scan anyway */
		if (ieee80211_sta_rx_scan(rx->sdata, skb, rx->status)
		if (ieee80211_scan_rx(rx->sdata, skb, rx->status)
		    != RX_QUEUED)
			dev_kfree_skb(skb);
		return RX_QUEUED;
@@ -1918,7 +1918,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
		return;
	}

	if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning))
	if (unlikely(local->sw_scanning || local->hw_scanning))
		rx.flags |= IEEE80211_RX_IN_SCAN;

	ieee80211_parse_qos(&rx);
Loading