Commit | Line | Data |
---|---|---|
727da60b DV |
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 | } | |
b23dcd4a | 42 | |
4fbd572c DV |
43 | void drv_sta_rc_update(struct ieee80211_local *local, |
44 | struct ieee80211_sub_if_data *sdata, | |
45 | struct ieee80211_sta *sta, u32 changed) | |
46 | { | |
47 | sdata = get_bss_sdata(sdata); | |
48 | if (!check_sdata_in_driver(sdata)) | |
49 | return; | |
50 | ||
51 | WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED && | |
52 | (sdata->vif.type != NL80211_IFTYPE_ADHOC && | |
53 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT)); | |
54 | ||
55 | trace_drv_sta_rc_update(local, sdata, sta, changed); | |
56 | if (local->ops->sta_rc_update) | |
57 | local->ops->sta_rc_update(&local->hw, &sdata->vif, | |
58 | sta, changed); | |
59 | ||
60 | trace_drv_return_void(local); | |
61 | } | |
62 | ||
b23dcd4a DV |
63 | int drv_conf_tx(struct ieee80211_local *local, |
64 | struct ieee80211_sub_if_data *sdata, u16 ac, | |
65 | const struct ieee80211_tx_queue_params *params) | |
66 | { | |
67 | int ret = -EOPNOTSUPP; | |
68 | ||
69 | might_sleep(); | |
70 | ||
71 | if (!check_sdata_in_driver(sdata)) | |
72 | return -EIO; | |
73 | ||
74 | if (WARN_ONCE(params->cw_min == 0 || | |
75 | params->cw_min > params->cw_max, | |
76 | "%s: invalid CW_min/CW_max: %d/%d\n", | |
77 | sdata->name, params->cw_min, params->cw_max)) | |
78 | return -EINVAL; | |
79 | ||
80 | trace_drv_conf_tx(local, sdata, ac, params); | |
81 | if (local->ops->conf_tx) | |
82 | ret = local->ops->conf_tx(&local->hw, &sdata->vif, | |
83 | ac, params); | |
84 | trace_drv_return_int(local, ret); | |
85 | return ret; | |
86 | } |