.. | .. |
---|
2 | 2 | /* |
---|
3 | 3 | * Portions of this file |
---|
4 | 4 | * Copyright(c) 2016 Intel Deutschland GmbH |
---|
5 | | -* Copyright (C) 2018 Intel Corporation |
---|
| 5 | +* Copyright (C) 2018 - 2019 Intel Corporation |
---|
6 | 6 | */ |
---|
7 | 7 | |
---|
8 | 8 | #ifndef __MAC80211_DRIVER_OPS |
---|
.. | .. |
---|
12 | 12 | #include "ieee80211_i.h" |
---|
13 | 13 | #include "trace.h" |
---|
14 | 14 | |
---|
15 | | -static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) |
---|
16 | | -{ |
---|
17 | | - return !WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), |
---|
18 | | - "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", |
---|
19 | | - sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); |
---|
20 | | -} |
---|
| 15 | +#define check_sdata_in_driver(sdata) ({ \ |
---|
| 16 | + !WARN_ONCE(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), \ |
---|
| 17 | + "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", \ |
---|
| 18 | + sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); \ |
---|
| 19 | +}) |
---|
21 | 20 | |
---|
22 | 21 | static inline struct ieee80211_sub_if_data * |
---|
23 | 22 | get_bss_sdata(struct ieee80211_sub_if_data *sdata) |
---|
.. | .. |
---|
529 | 528 | enum ieee80211_sta_state old_state, |
---|
530 | 529 | enum ieee80211_sta_state new_state); |
---|
531 | 530 | |
---|
| 531 | +__must_check |
---|
| 532 | +int drv_sta_set_txpwr(struct ieee80211_local *local, |
---|
| 533 | + struct ieee80211_sub_if_data *sdata, |
---|
| 534 | + struct sta_info *sta); |
---|
| 535 | + |
---|
532 | 536 | void drv_sta_rc_update(struct ieee80211_local *local, |
---|
533 | 537 | struct ieee80211_sub_if_data *sdata, |
---|
534 | 538 | struct ieee80211_sta *sta, u32 changed); |
---|
.. | .. |
---|
687 | 691 | return ret; |
---|
688 | 692 | } |
---|
689 | 693 | |
---|
690 | | -static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) |
---|
| 694 | +static inline int |
---|
| 695 | +drv_cancel_remain_on_channel(struct ieee80211_local *local, |
---|
| 696 | + struct ieee80211_sub_if_data *sdata) |
---|
691 | 697 | { |
---|
692 | 698 | int ret; |
---|
693 | 699 | |
---|
694 | 700 | might_sleep(); |
---|
695 | 701 | |
---|
696 | | - trace_drv_cancel_remain_on_channel(local); |
---|
697 | | - ret = local->ops->cancel_remain_on_channel(&local->hw); |
---|
| 702 | + trace_drv_cancel_remain_on_channel(local, sdata); |
---|
| 703 | + ret = local->ops->cancel_remain_on_channel(&local->hw, &sdata->vif); |
---|
698 | 704 | trace_drv_return_int(local, ret); |
---|
699 | 705 | |
---|
700 | 706 | return ret; |
---|
.. | .. |
---|
1052 | 1058 | return ret; |
---|
1053 | 1059 | } |
---|
1054 | 1060 | |
---|
| 1061 | +static inline void |
---|
| 1062 | +drv_abort_channel_switch(struct ieee80211_sub_if_data *sdata) |
---|
| 1063 | +{ |
---|
| 1064 | + struct ieee80211_local *local = sdata->local; |
---|
| 1065 | + |
---|
| 1066 | + if (!check_sdata_in_driver(sdata)) |
---|
| 1067 | + return; |
---|
| 1068 | + |
---|
| 1069 | + trace_drv_abort_channel_switch(local, sdata); |
---|
| 1070 | + |
---|
| 1071 | + if (local->ops->abort_channel_switch) |
---|
| 1072 | + local->ops->abort_channel_switch(&local->hw, &sdata->vif); |
---|
| 1073 | +} |
---|
| 1074 | + |
---|
| 1075 | +static inline void |
---|
| 1076 | +drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata, |
---|
| 1077 | + struct ieee80211_channel_switch *ch_switch) |
---|
| 1078 | +{ |
---|
| 1079 | + struct ieee80211_local *local = sdata->local; |
---|
| 1080 | + |
---|
| 1081 | + if (!check_sdata_in_driver(sdata)) |
---|
| 1082 | + return; |
---|
| 1083 | + |
---|
| 1084 | + trace_drv_channel_switch_rx_beacon(local, sdata, ch_switch); |
---|
| 1085 | + if (local->ops->channel_switch_rx_beacon) |
---|
| 1086 | + local->ops->channel_switch_rx_beacon(&local->hw, &sdata->vif, |
---|
| 1087 | + ch_switch); |
---|
| 1088 | +} |
---|
| 1089 | + |
---|
1055 | 1090 | static inline int drv_join_ibss(struct ieee80211_local *local, |
---|
1056 | 1091 | struct ieee80211_sub_if_data *sdata) |
---|
1057 | 1092 | { |
---|
.. | .. |
---|
1166 | 1201 | { |
---|
1167 | 1202 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); |
---|
1168 | 1203 | |
---|
1169 | | - if (local->in_reconfig) |
---|
| 1204 | + /* In reconfig don't transmit now, but mark for waking later */ |
---|
| 1205 | + if (local->in_reconfig) { |
---|
| 1206 | + set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags); |
---|
1170 | 1207 | return; |
---|
| 1208 | + } |
---|
1171 | 1209 | |
---|
1172 | 1210 | if (!check_sdata_in_driver(sdata)) |
---|
1173 | 1211 | return; |
---|
1174 | 1212 | |
---|
1175 | 1213 | trace_drv_wake_tx_queue(local, sdata, txq); |
---|
1176 | 1214 | local->ops->wake_tx_queue(&local->hw, &txq->txq); |
---|
| 1215 | +} |
---|
| 1216 | + |
---|
| 1217 | +static inline void schedule_and_wake_txq(struct ieee80211_local *local, |
---|
| 1218 | + struct txq_info *txqi) |
---|
| 1219 | +{ |
---|
| 1220 | + ieee80211_schedule_txq(&local->hw, &txqi->txq); |
---|
| 1221 | + drv_wake_tx_queue(local, txqi); |
---|
| 1222 | +} |
---|
| 1223 | + |
---|
| 1224 | +static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local, |
---|
| 1225 | + struct sk_buff *head, |
---|
| 1226 | + struct sk_buff *skb) |
---|
| 1227 | +{ |
---|
| 1228 | + if (!local->ops->can_aggregate_in_amsdu) |
---|
| 1229 | + return true; |
---|
| 1230 | + |
---|
| 1231 | + return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb); |
---|
| 1232 | +} |
---|
| 1233 | + |
---|
| 1234 | +static inline int |
---|
| 1235 | +drv_get_ftm_responder_stats(struct ieee80211_local *local, |
---|
| 1236 | + struct ieee80211_sub_if_data *sdata, |
---|
| 1237 | + struct cfg80211_ftm_responder_stats *ftm_stats) |
---|
| 1238 | +{ |
---|
| 1239 | + u32 ret = -EOPNOTSUPP; |
---|
| 1240 | + |
---|
| 1241 | + if (local->ops->get_ftm_responder_stats) |
---|
| 1242 | + ret = local->ops->get_ftm_responder_stats(&local->hw, |
---|
| 1243 | + &sdata->vif, |
---|
| 1244 | + ftm_stats); |
---|
| 1245 | + trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats); |
---|
| 1246 | + |
---|
| 1247 | + return ret; |
---|
| 1248 | +} |
---|
| 1249 | + |
---|
| 1250 | +static inline int drv_start_pmsr(struct ieee80211_local *local, |
---|
| 1251 | + struct ieee80211_sub_if_data *sdata, |
---|
| 1252 | + struct cfg80211_pmsr_request *request) |
---|
| 1253 | +{ |
---|
| 1254 | + int ret = -EOPNOTSUPP; |
---|
| 1255 | + |
---|
| 1256 | + might_sleep(); |
---|
| 1257 | + if (!check_sdata_in_driver(sdata)) |
---|
| 1258 | + return -EIO; |
---|
| 1259 | + |
---|
| 1260 | + trace_drv_start_pmsr(local, sdata); |
---|
| 1261 | + |
---|
| 1262 | + if (local->ops->start_pmsr) |
---|
| 1263 | + ret = local->ops->start_pmsr(&local->hw, &sdata->vif, request); |
---|
| 1264 | + trace_drv_return_int(local, ret); |
---|
| 1265 | + |
---|
| 1266 | + return ret; |
---|
| 1267 | +} |
---|
| 1268 | + |
---|
| 1269 | +static inline void drv_abort_pmsr(struct ieee80211_local *local, |
---|
| 1270 | + struct ieee80211_sub_if_data *sdata, |
---|
| 1271 | + struct cfg80211_pmsr_request *request) |
---|
| 1272 | +{ |
---|
| 1273 | + trace_drv_abort_pmsr(local, sdata); |
---|
| 1274 | + |
---|
| 1275 | + might_sleep(); |
---|
| 1276 | + if (!check_sdata_in_driver(sdata)) |
---|
| 1277 | + return; |
---|
| 1278 | + |
---|
| 1279 | + if (local->ops->abort_pmsr) |
---|
| 1280 | + local->ops->abort_pmsr(&local->hw, &sdata->vif, request); |
---|
| 1281 | + trace_drv_return_void(local); |
---|
1177 | 1282 | } |
---|
1178 | 1283 | |
---|
1179 | 1284 | static inline int drv_start_nan(struct ieee80211_local *local, |
---|
.. | .. |
---|
1255 | 1360 | trace_drv_return_void(local); |
---|
1256 | 1361 | } |
---|
1257 | 1362 | |
---|
| 1363 | +static inline int drv_set_tid_config(struct ieee80211_local *local, |
---|
| 1364 | + struct ieee80211_sub_if_data *sdata, |
---|
| 1365 | + struct ieee80211_sta *sta, |
---|
| 1366 | + struct cfg80211_tid_config *tid_conf) |
---|
| 1367 | +{ |
---|
| 1368 | + int ret; |
---|
| 1369 | + |
---|
| 1370 | + might_sleep(); |
---|
| 1371 | + ret = local->ops->set_tid_config(&local->hw, &sdata->vif, sta, |
---|
| 1372 | + tid_conf); |
---|
| 1373 | + trace_drv_return_int(local, ret); |
---|
| 1374 | + |
---|
| 1375 | + return ret; |
---|
| 1376 | +} |
---|
| 1377 | + |
---|
| 1378 | +static inline int drv_reset_tid_config(struct ieee80211_local *local, |
---|
| 1379 | + struct ieee80211_sub_if_data *sdata, |
---|
| 1380 | + struct ieee80211_sta *sta, u8 tids) |
---|
| 1381 | +{ |
---|
| 1382 | + int ret; |
---|
| 1383 | + |
---|
| 1384 | + might_sleep(); |
---|
| 1385 | + ret = local->ops->reset_tid_config(&local->hw, &sdata->vif, sta, tids); |
---|
| 1386 | + trace_drv_return_int(local, ret); |
---|
| 1387 | + |
---|
| 1388 | + return ret; |
---|
| 1389 | +} |
---|
| 1390 | + |
---|
| 1391 | +static inline void drv_update_vif_offload(struct ieee80211_local *local, |
---|
| 1392 | + struct ieee80211_sub_if_data *sdata) |
---|
| 1393 | +{ |
---|
| 1394 | + might_sleep(); |
---|
| 1395 | + check_sdata_in_driver(sdata); |
---|
| 1396 | + |
---|
| 1397 | + if (!local->ops->update_vif_offload) |
---|
| 1398 | + return; |
---|
| 1399 | + |
---|
| 1400 | + trace_drv_update_vif_offload(local, sdata); |
---|
| 1401 | + local->ops->update_vif_offload(&local->hw, &sdata->vif); |
---|
| 1402 | + trace_drv_return_void(local); |
---|
| 1403 | +} |
---|
| 1404 | + |
---|
| 1405 | +static inline void drv_sta_set_4addr(struct ieee80211_local *local, |
---|
| 1406 | + struct ieee80211_sub_if_data *sdata, |
---|
| 1407 | + struct ieee80211_sta *sta, bool enabled) |
---|
| 1408 | +{ |
---|
| 1409 | + sdata = get_bss_sdata(sdata); |
---|
| 1410 | + if (!check_sdata_in_driver(sdata)) |
---|
| 1411 | + return; |
---|
| 1412 | + |
---|
| 1413 | + trace_drv_sta_set_4addr(local, sdata, sta, enabled); |
---|
| 1414 | + if (local->ops->sta_set_4addr) |
---|
| 1415 | + local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled); |
---|
| 1416 | + trace_drv_return_void(local); |
---|
| 1417 | +} |
---|
| 1418 | + |
---|
1258 | 1419 | #endif /* __MAC80211_DRIVER_OPS */ |
---|