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 | } |
Denys Vlasenko | b23dcd4 | 2015-09-18 15:19:34 +0200 | [diff] [blame^] | 42 | |
| 43 | int drv_conf_tx(struct ieee80211_local *local, |
| 44 | struct ieee80211_sub_if_data *sdata, u16 ac, |
| 45 | const struct ieee80211_tx_queue_params *params) |
| 46 | { |
| 47 | int ret = -EOPNOTSUPP; |
| 48 | |
| 49 | might_sleep(); |
| 50 | |
| 51 | if (!check_sdata_in_driver(sdata)) |
| 52 | return -EIO; |
| 53 | |
| 54 | if (WARN_ONCE(params->cw_min == 0 || |
| 55 | params->cw_min > params->cw_max, |
| 56 | "%s: invalid CW_min/CW_max: %d/%d\n", |
| 57 | sdata->name, params->cw_min, params->cw_max)) |
| 58 | return -EINVAL; |
| 59 | |
| 60 | trace_drv_conf_tx(local, sdata, ac, params); |
| 61 | if (local->ops->conf_tx) |
| 62 | ret = local->ops->conf_tx(&local->hw, &sdata->vif, |
| 63 | ac, params); |
| 64 | trace_drv_return_int(local, ret); |
| 65 | return ret; |
| 66 | } |