diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-11-25 11:46:19 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-21 18:38:52 -0500 |
commit | 47846c9b0c10808d9337d2e7d09361f3e0a0a71a (patch) | |
tree | 8e5d0dbf3309b7868fa73a888f9561ffea1580e3 /net/mac80211/ibss.c | |
parent | abe60632f311d515b082b450504ee24006023951 (diff) |
mac80211: reduce reliance on netdev
For bluetooth 3, we will most likely not have
a netdev for a virtual interface (sdata), so
prepare for that by reducing the reliance on
having a netdev. This patch moves the name
and address fields into the sdata struct and
uses them from there all over. Some work is
needed to keep them sync'ed, but that's not
a lot of work and in slow paths anyway.
In doing so, this also reduces the number of
pointer dereferences in many places, because
of things like sdata->dev->dev_addr becoming
sdata->vif.addr.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r-- | net/mac80211/ibss.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 1925be9b82fb..ef6c6b2401d1 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -117,7 +117,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
117 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 117 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
118 | IEEE80211_STYPE_PROBE_RESP); | 118 | IEEE80211_STYPE_PROBE_RESP); |
119 | memset(mgmt->da, 0xff, ETH_ALEN); | 119 | memset(mgmt->da, 0xff, ETH_ALEN); |
120 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 120 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
121 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); | 121 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); |
122 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); | 122 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); |
123 | mgmt->u.beacon.timestamp = cpu_to_le64(tsf); | 123 | mgmt->u.beacon.timestamp = cpu_to_le64(tsf); |
@@ -266,7 +266,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
266 | printk(KERN_DEBUG "%s: updated supp_rates set " | 266 | printk(KERN_DEBUG "%s: updated supp_rates set " |
267 | "for %pM based on beacon info (0x%llx | " | 267 | "for %pM based on beacon info (0x%llx | " |
268 | "0x%llx -> 0x%llx)\n", | 268 | "0x%llx -> 0x%llx)\n", |
269 | sdata->dev->name, | 269 | sdata->name, |
270 | sta->sta.addr, | 270 | sta->sta.addr, |
271 | (unsigned long long) prev_rates, | 271 | (unsigned long long) prev_rates, |
272 | (unsigned long long) supp_rates, | 272 | (unsigned long long) supp_rates, |
@@ -364,7 +364,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
364 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 364 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
365 | printk(KERN_DEBUG "%s: beacon TSF higher than " | 365 | printk(KERN_DEBUG "%s: beacon TSF higher than " |
366 | "local TSF - IBSS merge with BSSID %pM\n", | 366 | "local TSF - IBSS merge with BSSID %pM\n", |
367 | sdata->dev->name, mgmt->bssid); | 367 | sdata->name, mgmt->bssid); |
368 | #endif | 368 | #endif |
369 | ieee80211_sta_join_ibss(sdata, bss); | 369 | ieee80211_sta_join_ibss(sdata, bss); |
370 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates); | 370 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates); |
@@ -393,7 +393,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
393 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 393 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
394 | if (net_ratelimit()) | 394 | if (net_ratelimit()) |
395 | printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", | 395 | printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", |
396 | sdata->dev->name, addr); | 396 | sdata->name, addr); |
397 | return NULL; | 397 | return NULL; |
398 | } | 398 | } |
399 | 399 | ||
@@ -402,7 +402,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
402 | 402 | ||
403 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 403 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
404 | printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n", | 404 | printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n", |
405 | wiphy_name(local->hw.wiphy), addr, sdata->dev->name); | 405 | wiphy_name(local->hw.wiphy), addr, sdata->name); |
406 | #endif | 406 | #endif |
407 | 407 | ||
408 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | 408 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); |
@@ -466,7 +466,7 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | |||
466 | return; | 466 | return; |
467 | 467 | ||
468 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " | 468 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
469 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); | 469 | "IBSS networks with same SSID (merge)\n", sdata->name); |
470 | 470 | ||
471 | ieee80211_request_internal_scan(sdata, ifibss->ssid, ifibss->ssid_len); | 471 | ieee80211_request_internal_scan(sdata, ifibss->ssid, ifibss->ssid_len); |
472 | } | 472 | } |
@@ -488,13 +488,13 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | |||
488 | * random number generator get different BSSID. */ | 488 | * random number generator get different BSSID. */ |
489 | get_random_bytes(bssid, ETH_ALEN); | 489 | get_random_bytes(bssid, ETH_ALEN); |
490 | for (i = 0; i < ETH_ALEN; i++) | 490 | for (i = 0; i < ETH_ALEN; i++) |
491 | bssid[i] ^= sdata->dev->dev_addr[i]; | 491 | bssid[i] ^= sdata->vif.addr[i]; |
492 | bssid[0] &= ~0x01; | 492 | bssid[0] &= ~0x01; |
493 | bssid[0] |= 0x02; | 493 | bssid[0] |= 0x02; |
494 | } | 494 | } |
495 | 495 | ||
496 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", | 496 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", |
497 | sdata->dev->name, bssid); | 497 | sdata->name, bssid); |
498 | 498 | ||
499 | sband = local->hw.wiphy->bands[ifibss->channel->band]; | 499 | sband = local->hw.wiphy->bands[ifibss->channel->band]; |
500 | 500 | ||
@@ -523,7 +523,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
523 | active_ibss = ieee80211_sta_active_ibss(sdata); | 523 | active_ibss = ieee80211_sta_active_ibss(sdata); |
524 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 524 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
525 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", | 525 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", |
526 | sdata->dev->name, active_ibss); | 526 | sdata->name, active_ibss); |
527 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 527 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
528 | 528 | ||
529 | if (active_ibss) | 529 | if (active_ibss) |
@@ -552,7 +552,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
552 | 552 | ||
553 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" | 553 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" |
554 | " based on configured SSID\n", | 554 | " based on configured SSID\n", |
555 | sdata->dev->name, bss->cbss.bssid); | 555 | sdata->name, bss->cbss.bssid); |
556 | 556 | ||
557 | ieee80211_sta_join_ibss(sdata, bss); | 557 | ieee80211_sta_join_ibss(sdata, bss); |
558 | ieee80211_rx_bss_put(local, bss); | 558 | ieee80211_rx_bss_put(local, bss); |
@@ -571,7 +571,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
571 | } else if (time_after(jiffies, ifibss->last_scan_completed + | 571 | } else if (time_after(jiffies, ifibss->last_scan_completed + |
572 | IEEE80211_SCAN_INTERVAL)) { | 572 | IEEE80211_SCAN_INTERVAL)) { |
573 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 573 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
574 | "join\n", sdata->dev->name); | 574 | "join\n", sdata->name); |
575 | 575 | ||
576 | ieee80211_request_internal_scan(sdata, ifibss->ssid, | 576 | ieee80211_request_internal_scan(sdata, ifibss->ssid, |
577 | ifibss->ssid_len); | 577 | ifibss->ssid_len); |
@@ -585,7 +585,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
585 | return; | 585 | return; |
586 | } | 586 | } |
587 | printk(KERN_DEBUG "%s: IBSS not allowed on" | 587 | printk(KERN_DEBUG "%s: IBSS not allowed on" |
588 | " %d MHz\n", sdata->dev->name, | 588 | " %d MHz\n", sdata->name, |
589 | local->hw.conf.channel->center_freq); | 589 | local->hw.conf.channel->center_freq); |
590 | 590 | ||
591 | /* No IBSS found - decrease scan interval and continue | 591 | /* No IBSS found - decrease scan interval and continue |
@@ -619,7 +619,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
619 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 619 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
620 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" | 620 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" |
621 | " (tx_last_beacon=%d)\n", | 621 | " (tx_last_beacon=%d)\n", |
622 | sdata->dev->name, mgmt->sa, mgmt->da, | 622 | sdata->name, mgmt->sa, mgmt->da, |
623 | mgmt->bssid, tx_last_beacon); | 623 | mgmt->bssid, tx_last_beacon); |
624 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 624 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
625 | 625 | ||
@@ -637,7 +637,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
637 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 637 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
638 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " | 638 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " |
639 | "from %pM\n", | 639 | "from %pM\n", |
640 | sdata->dev->name, mgmt->sa); | 640 | sdata->name, mgmt->sa); |
641 | #endif | 641 | #endif |
642 | return; | 642 | return; |
643 | } | 643 | } |
@@ -657,7 +657,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
657 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 657 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
658 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 658 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
659 | printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", | 659 | printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", |
660 | sdata->dev->name, resp->da); | 660 | sdata->name, resp->da); |
661 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 661 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
662 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 662 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
663 | ieee80211_tx_skb(sdata, skb); | 663 | ieee80211_tx_skb(sdata, skb); |
@@ -671,7 +671,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
671 | size_t baselen; | 671 | size_t baselen; |
672 | struct ieee802_11_elems elems; | 672 | struct ieee802_11_elems elems; |
673 | 673 | ||
674 | if (memcmp(mgmt->da, sdata->dev->dev_addr, ETH_ALEN)) | 674 | if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) |
675 | return; /* ignore ProbeResp to foreign address */ | 675 | return; /* ignore ProbeResp to foreign address */ |
676 | 676 | ||
677 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; | 677 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; |