Denys Vlasenko | 727da60 | 2015-07-15 14:56:05 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify |
| 3 | * it under the terms of the GNU General Public License version 2 as |
| 4 | * published by the Free Software Foundation. |
| 5 | */ |
| 6 | #include <net/mac80211.h> |
| 7 | #include "ieee80211_i.h" |
| 8 | #include "trace.h" |
| 9 | #include "driver-ops.h" |
| 10 | |
| 11 | __must_check |
| 12 | int drv_sta_state(struct ieee80211_local *local, |
| 13 | struct ieee80211_sub_if_data *sdata, |
| 14 | struct sta_info *sta, |
| 15 | enum ieee80211_sta_state old_state, |
| 16 | enum ieee80211_sta_state new_state) |
| 17 | { |
| 18 | int ret = 0; |
| 19 | |
| 20 | might_sleep(); |
| 21 | |
| 22 | sdata = get_bss_sdata(sdata); |
| 23 | if (!check_sdata_in_driver(sdata)) |
| 24 | return -EIO; |
| 25 | |
| 26 | trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); |
| 27 | if (local->ops->sta_state) { |
| 28 | ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta, |
| 29 | old_state, new_state); |
| 30 | } else if (old_state == IEEE80211_STA_AUTH && |
| 31 | new_state == IEEE80211_STA_ASSOC) { |
| 32 | ret = drv_sta_add(local, sdata, &sta->sta); |
| 33 | if (ret == 0) |
| 34 | sta->uploaded = true; |
| 35 | } else if (old_state == IEEE80211_STA_ASSOC && |
| 36 | new_state == IEEE80211_STA_AUTH) { |
| 37 | drv_sta_remove(local, sdata, &sta->sta); |
| 38 | } |
| 39 | trace_drv_return_int(local, ret); |
| 40 | return ret; |
| 41 | } |