mac80211: update to 2014-10-08
[openwrt/staging/rmilecki.git] / package / kernel / mac80211 / patches / 303-ath9k-Use-sta_state-callback.patch
1 From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
2 Date: Fri, 17 Oct 2014 07:40:08 +0530
3 Subject: [PATCH] ath9k: Use sta_state() callback
4
5 Instead of using the sta_add()/sta_remove() callbacks,
6 use the sta_state() callback since this gives
7 more fine-grained control.
8
9 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
10 ---
11
12 --- a/drivers/net/wireless/ath/ath9k/main.c
13 +++ b/drivers/net/wireless/ath/ath9k/main.c
14 @@ -1547,6 +1547,31 @@ static int ath9k_sta_remove(struct ieee8
15 return 0;
16 }
17
18 +static int ath9k_sta_state(struct ieee80211_hw *hw,
19 + struct ieee80211_vif *vif,
20 + struct ieee80211_sta *sta,
21 + enum ieee80211_sta_state old_state,
22 + enum ieee80211_sta_state new_state)
23 +{
24 + struct ath_softc *sc = hw->priv;
25 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
26 + int ret = 0;
27 +
28 + if (old_state == IEEE80211_STA_AUTH &&
29 + new_state == IEEE80211_STA_ASSOC) {
30 + ret = ath9k_sta_add(hw, vif, sta);
31 + ath_dbg(common, CONFIG,
32 + "Add station: %pM\n", sta->addr);
33 + } else if (old_state == IEEE80211_STA_ASSOC &&
34 + new_state == IEEE80211_STA_AUTH) {
35 + ret = ath9k_sta_remove(hw, vif, sta);
36 + ath_dbg(common, CONFIG,
37 + "Remove station: %pM\n", sta->addr);
38 + }
39 +
40 + return ret;
41 +}
42 +
43 static void ath9k_sta_set_tx_filter(struct ath_hw *ah,
44 struct ath_node *an,
45 bool set)
46 @@ -2471,8 +2496,7 @@ struct ieee80211_ops ath9k_ops = {
47 .remove_interface = ath9k_remove_interface,
48 .config = ath9k_config,
49 .configure_filter = ath9k_configure_filter,
50 - .sta_add = ath9k_sta_add,
51 - .sta_remove = ath9k_sta_remove,
52 + .sta_state = ath9k_sta_state,
53 .sta_notify = ath9k_sta_notify,
54 .conf_tx = ath9k_conf_tx,
55 .bss_info_changed = ath9k_bss_info_changed,