hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/mac80211/driver-ops.h
....@@ -2,7 +2,7 @@
22 /*
33 * Portions of this file
44 * Copyright(c) 2016 Intel Deutschland GmbH
5
-* Copyright (C) 2018 Intel Corporation
5
+* Copyright (C) 2018 - 2019 Intel Corporation
66 */
77
88 #ifndef __MAC80211_DRIVER_OPS
....@@ -12,12 +12,11 @@
1212 #include "ieee80211_i.h"
1313 #include "trace.h"
1414
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
+})
2120
2221 static inline struct ieee80211_sub_if_data *
2322 get_bss_sdata(struct ieee80211_sub_if_data *sdata)
....@@ -529,6 +528,11 @@
529528 enum ieee80211_sta_state old_state,
530529 enum ieee80211_sta_state new_state);
531530
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
+
532536 void drv_sta_rc_update(struct ieee80211_local *local,
533537 struct ieee80211_sub_if_data *sdata,
534538 struct ieee80211_sta *sta, u32 changed);
....@@ -687,14 +691,16 @@
687691 return ret;
688692 }
689693
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)
691697 {
692698 int ret;
693699
694700 might_sleep();
695701
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);
698704 trace_drv_return_int(local, ret);
699705
700706 return ret;
....@@ -1052,6 +1058,35 @@
10521058 return ret;
10531059 }
10541060
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
+
10551090 static inline int drv_join_ibss(struct ieee80211_local *local,
10561091 struct ieee80211_sub_if_data *sdata)
10571092 {
....@@ -1166,14 +1201,84 @@
11661201 {
11671202 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
11681203
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);
11701207 return;
1208
+ }
11711209
11721210 if (!check_sdata_in_driver(sdata))
11731211 return;
11741212
11751213 trace_drv_wake_tx_queue(local, sdata, txq);
11761214 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);
11771282 }
11781283
11791284 static inline int drv_start_nan(struct ieee80211_local *local,
....@@ -1255,4 +1360,60 @@
12551360 trace_drv_return_void(local);
12561361 }
12571362
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
+
12581419 #endif /* __MAC80211_DRIVER_OPS */