diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-04-23 10:13:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-06 15:14:36 -0400 |
commit | 2d0ddec5b2b859f06116f631fc0ffe94fbceb556 (patch) | |
tree | 9bf3cdfcbbefcb34f5984e6d797f488ebe358196 /drivers/net/wireless/ath/ath9k/main.c | |
parent | 57c4d7b4c4986037be51476b8e3025d5ba18d8b8 (diff) |
mac80211: unify config_interface and bss_info_changed
The config_interface method is a little strange, it contains the
BSSID and beacon updates, while bss_info_changed contains most
other BSS information for each interface. This patch removes
config_interface and rolls all the information it previously
passed to drivers into bss_info_changed.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 182 |
1 files changed, 83 insertions, 99 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 28cc9cd52f32..d3dc8e2c77b2 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -2363,104 +2363,6 @@ skip_chan_change: | |||
2363 | return 0; | 2363 | return 0; |
2364 | } | 2364 | } |
2365 | 2365 | ||
2366 | static int ath9k_config_interface(struct ieee80211_hw *hw, | ||
2367 | struct ieee80211_vif *vif, | ||
2368 | struct ieee80211_if_conf *conf) | ||
2369 | { | ||
2370 | struct ath_wiphy *aphy = hw->priv; | ||
2371 | struct ath_softc *sc = aphy->sc; | ||
2372 | struct ath_hw *ah = sc->sc_ah; | ||
2373 | struct ath_vif *avp = (void *)vif->drv_priv; | ||
2374 | u32 rfilt = 0; | ||
2375 | int error, i; | ||
2376 | |||
2377 | mutex_lock(&sc->mutex); | ||
2378 | |||
2379 | /* TODO: Need to decide which hw opmode to use for multi-interface | ||
2380 | * cases */ | ||
2381 | if (vif->type == NL80211_IFTYPE_AP && | ||
2382 | ah->opmode != NL80211_IFTYPE_AP) { | ||
2383 | ah->opmode = NL80211_IFTYPE_STATION; | ||
2384 | ath9k_hw_setopmode(ah); | ||
2385 | memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN); | ||
2386 | sc->curaid = 0; | ||
2387 | ath9k_hw_write_associd(sc); | ||
2388 | /* Request full reset to get hw opmode changed properly */ | ||
2389 | sc->sc_flags |= SC_OP_FULL_RESET; | ||
2390 | } | ||
2391 | |||
2392 | if ((conf->changed & IEEE80211_IFCC_BSSID) && | ||
2393 | !is_zero_ether_addr(conf->bssid)) { | ||
2394 | switch (vif->type) { | ||
2395 | case NL80211_IFTYPE_STATION: | ||
2396 | case NL80211_IFTYPE_ADHOC: | ||
2397 | case NL80211_IFTYPE_MESH_POINT: | ||
2398 | /* Set BSSID */ | ||
2399 | memcpy(sc->curbssid, conf->bssid, ETH_ALEN); | ||
2400 | memcpy(avp->bssid, conf->bssid, ETH_ALEN); | ||
2401 | sc->curaid = 0; | ||
2402 | ath9k_hw_write_associd(sc); | ||
2403 | |||
2404 | /* Set aggregation protection mode parameters */ | ||
2405 | sc->config.ath_aggr_prot = 0; | ||
2406 | |||
2407 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
2408 | "RX filter 0x%x bssid %pM aid 0x%x\n", | ||
2409 | rfilt, sc->curbssid, sc->curaid); | ||
2410 | |||
2411 | /* need to reconfigure the beacon */ | ||
2412 | sc->sc_flags &= ~SC_OP_BEACONS ; | ||
2413 | |||
2414 | break; | ||
2415 | default: | ||
2416 | break; | ||
2417 | } | ||
2418 | } | ||
2419 | |||
2420 | if ((vif->type == NL80211_IFTYPE_ADHOC) || | ||
2421 | (vif->type == NL80211_IFTYPE_AP) || | ||
2422 | (vif->type == NL80211_IFTYPE_MESH_POINT)) { | ||
2423 | if ((conf->changed & IEEE80211_IFCC_BEACON) || | ||
2424 | (conf->changed & IEEE80211_IFCC_BEACON_ENABLED && | ||
2425 | conf->enable_beacon)) { | ||
2426 | /* | ||
2427 | * Allocate and setup the beacon frame. | ||
2428 | * | ||
2429 | * Stop any previous beacon DMA. This may be | ||
2430 | * necessary, for example, when an ibss merge | ||
2431 | * causes reconfiguration; we may be called | ||
2432 | * with beacon transmission active. | ||
2433 | */ | ||
2434 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | ||
2435 | |||
2436 | error = ath_beacon_alloc(aphy, vif); | ||
2437 | if (error != 0) { | ||
2438 | mutex_unlock(&sc->mutex); | ||
2439 | return error; | ||
2440 | } | ||
2441 | |||
2442 | ath_beacon_config(sc, vif); | ||
2443 | } | ||
2444 | } | ||
2445 | |||
2446 | /* Check for WLAN_CAPABILITY_PRIVACY ? */ | ||
2447 | if ((avp->av_opmode != NL80211_IFTYPE_STATION)) { | ||
2448 | for (i = 0; i < IEEE80211_WEP_NKID; i++) | ||
2449 | if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i)) | ||
2450 | ath9k_hw_keysetmac(sc->sc_ah, | ||
2451 | (u16)i, | ||
2452 | sc->curbssid); | ||
2453 | } | ||
2454 | |||
2455 | /* Only legacy IBSS for now */ | ||
2456 | if (vif->type == NL80211_IFTYPE_ADHOC) | ||
2457 | ath_update_chainmask(sc, 0); | ||
2458 | |||
2459 | mutex_unlock(&sc->mutex); | ||
2460 | |||
2461 | return 0; | ||
2462 | } | ||
2463 | |||
2464 | #define SUPPORTED_FILTERS \ | 2366 | #define SUPPORTED_FILTERS \ |
2465 | (FIF_PROMISC_IN_BSS | \ | 2367 | (FIF_PROMISC_IN_BSS | \ |
2466 | FIF_ALLMULTI | \ | 2368 | FIF_ALLMULTI | \ |
@@ -2597,9 +2499,92 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
2597 | { | 2499 | { |
2598 | struct ath_wiphy *aphy = hw->priv; | 2500 | struct ath_wiphy *aphy = hw->priv; |
2599 | struct ath_softc *sc = aphy->sc; | 2501 | struct ath_softc *sc = aphy->sc; |
2502 | struct ath_hw *ah = sc->sc_ah; | ||
2503 | struct ath_vif *avp = (void *)vif->drv_priv; | ||
2504 | u32 rfilt = 0; | ||
2505 | int error, i; | ||
2600 | 2506 | ||
2601 | mutex_lock(&sc->mutex); | 2507 | mutex_lock(&sc->mutex); |
2602 | 2508 | ||
2509 | /* | ||
2510 | * TODO: Need to decide which hw opmode to use for | ||
2511 | * multi-interface cases | ||
2512 | * XXX: This belongs into add_interface! | ||
2513 | */ | ||
2514 | if (vif->type == NL80211_IFTYPE_AP && | ||
2515 | ah->opmode != NL80211_IFTYPE_AP) { | ||
2516 | ah->opmode = NL80211_IFTYPE_STATION; | ||
2517 | ath9k_hw_setopmode(ah); | ||
2518 | memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN); | ||
2519 | sc->curaid = 0; | ||
2520 | ath9k_hw_write_associd(sc); | ||
2521 | /* Request full reset to get hw opmode changed properly */ | ||
2522 | sc->sc_flags |= SC_OP_FULL_RESET; | ||
2523 | } | ||
2524 | |||
2525 | if ((changed & BSS_CHANGED_BSSID) && | ||
2526 | !is_zero_ether_addr(bss_conf->bssid)) { | ||
2527 | switch (vif->type) { | ||
2528 | case NL80211_IFTYPE_STATION: | ||
2529 | case NL80211_IFTYPE_ADHOC: | ||
2530 | case NL80211_IFTYPE_MESH_POINT: | ||
2531 | /* Set BSSID */ | ||
2532 | memcpy(sc->curbssid, bss_conf->bssid, ETH_ALEN); | ||
2533 | memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN); | ||
2534 | sc->curaid = 0; | ||
2535 | ath9k_hw_write_associd(sc); | ||
2536 | |||
2537 | /* Set aggregation protection mode parameters */ | ||
2538 | sc->config.ath_aggr_prot = 0; | ||
2539 | |||
2540 | DPRINTF(sc, ATH_DBG_CONFIG, | ||
2541 | "RX filter 0x%x bssid %pM aid 0x%x\n", | ||
2542 | rfilt, sc->curbssid, sc->curaid); | ||
2543 | |||
2544 | /* need to reconfigure the beacon */ | ||
2545 | sc->sc_flags &= ~SC_OP_BEACONS ; | ||
2546 | |||
2547 | break; | ||
2548 | default: | ||
2549 | break; | ||
2550 | } | ||
2551 | } | ||
2552 | |||
2553 | if ((vif->type == NL80211_IFTYPE_ADHOC) || | ||
2554 | (vif->type == NL80211_IFTYPE_AP) || | ||
2555 | (vif->type == NL80211_IFTYPE_MESH_POINT)) { | ||
2556 | if ((changed & BSS_CHANGED_BEACON) || | ||
2557 | (changed & BSS_CHANGED_BEACON_ENABLED && | ||
2558 | bss_conf->enable_beacon)) { | ||
2559 | /* | ||
2560 | * Allocate and setup the beacon frame. | ||
2561 | * | ||
2562 | * Stop any previous beacon DMA. This may be | ||
2563 | * necessary, for example, when an ibss merge | ||
2564 | * causes reconfiguration; we may be called | ||
2565 | * with beacon transmission active. | ||
2566 | */ | ||
2567 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | ||
2568 | |||
2569 | error = ath_beacon_alloc(aphy, vif); | ||
2570 | if (!error) | ||
2571 | ath_beacon_config(sc, vif); | ||
2572 | } | ||
2573 | } | ||
2574 | |||
2575 | /* Check for WLAN_CAPABILITY_PRIVACY ? */ | ||
2576 | if ((avp->av_opmode != NL80211_IFTYPE_STATION)) { | ||
2577 | for (i = 0; i < IEEE80211_WEP_NKID; i++) | ||
2578 | if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i)) | ||
2579 | ath9k_hw_keysetmac(sc->sc_ah, | ||
2580 | (u16)i, | ||
2581 | sc->curbssid); | ||
2582 | } | ||
2583 | |||
2584 | /* Only legacy IBSS for now */ | ||
2585 | if (vif->type == NL80211_IFTYPE_ADHOC) | ||
2586 | ath_update_chainmask(sc, 0); | ||
2587 | |||
2603 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { | 2588 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { |
2604 | DPRINTF(sc, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", | 2589 | DPRINTF(sc, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", |
2605 | bss_conf->use_short_preamble); | 2590 | bss_conf->use_short_preamble); |
@@ -2757,7 +2742,6 @@ struct ieee80211_ops ath9k_ops = { | |||
2757 | .add_interface = ath9k_add_interface, | 2742 | .add_interface = ath9k_add_interface, |
2758 | .remove_interface = ath9k_remove_interface, | 2743 | .remove_interface = ath9k_remove_interface, |
2759 | .config = ath9k_config, | 2744 | .config = ath9k_config, |
2760 | .config_interface = ath9k_config_interface, | ||
2761 | .configure_filter = ath9k_configure_filter, | 2745 | .configure_filter = ath9k_configure_filter, |
2762 | .sta_notify = ath9k_sta_notify, | 2746 | .sta_notify = ath9k_sta_notify, |
2763 | .conf_tx = ath9k_conf_tx, | 2747 | .conf_tx = ath9k_conf_tx, |