aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2012-06-26 08:37:17 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-16 14:22:42 -0400
commitc3645eac479d9aaac9f8099c94bf681dc695dd34 (patch)
treef701eb4d7b3449d9f4672590f752081ea92f2009
parentd01a1e658606a0a69100f49c2ef09aacaf74d3e7 (diff)
mac80211: introduce new ieee80211_ops
Introduce channel context driver methods. The channel on a context channel is immutable, but the channel type and other properties can change. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/mac80211.h24
-rw-r--r--net/mac80211/driver-ops.h65
-rw-r--r--net/mac80211/trace.h107
3 files changed, 196 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ab1b5bafb568..d9d2119f0828 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2353,6 +2353,16 @@ enum ieee80211_rate_control_changed {
2353 * The callback will be called before each transmission and upon return 2353 * The callback will be called before each transmission and upon return
2354 * mac80211 will transmit the frame right away. 2354 * mac80211 will transmit the frame right away.
2355 * The callback is optional and can (should!) sleep. 2355 * The callback is optional and can (should!) sleep.
2356 *
2357 * @add_chanctx: Notifies device driver about new channel context creation.
2358 * @remove_chanctx: Notifies device driver about channel context destruction.
2359 * @change_chanctx: Notifies device driver about channel context changes that
2360 * may happen when combining different virtual interfaces on the same
2361 * channel context with different settings
2362 * @assign_vif_chanctx: Notifies device driver about channel context being bound
2363 * to vif. Possible use is for hw queue remapping.
2364 * @unassign_vif_chanctx: Notifies device driver about channel context being
2365 * unbound from vif.
2356 */ 2366 */
2357struct ieee80211_ops { 2367struct ieee80211_ops {
2358 void (*tx)(struct ieee80211_hw *hw, 2368 void (*tx)(struct ieee80211_hw *hw,
@@ -2497,6 +2507,20 @@ struct ieee80211_ops {
2497 2507
2498 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 2508 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
2499 struct ieee80211_vif *vif); 2509 struct ieee80211_vif *vif);
2510
2511 int (*add_chanctx)(struct ieee80211_hw *hw,
2512 struct ieee80211_chanctx_conf *ctx);
2513 void (*remove_chanctx)(struct ieee80211_hw *hw,
2514 struct ieee80211_chanctx_conf *ctx);
2515 void (*change_chanctx)(struct ieee80211_hw *hw,
2516 struct ieee80211_chanctx_conf *ctx,
2517 u32 changed);
2518 int (*assign_vif_chanctx)(struct ieee80211_hw *hw,
2519 struct ieee80211_vif *vif,
2520 struct ieee80211_chanctx_conf *ctx);
2521 void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
2522 struct ieee80211_vif *vif,
2523 struct ieee80211_chanctx_conf *ctx);
2500}; 2524};
2501 2525
2502/** 2526/**
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index da9003b20004..77407b31e1ff 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -871,4 +871,69 @@ static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
871 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif); 871 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
872 trace_drv_return_void(local); 872 trace_drv_return_void(local);
873} 873}
874
875static inline int drv_add_chanctx(struct ieee80211_local *local,
876 struct ieee80211_chanctx *ctx)
877{
878 int ret = -EOPNOTSUPP;
879
880 trace_drv_add_chanctx(local, ctx);
881 if (local->ops->add_chanctx)
882 ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
883 trace_drv_return_int(local, ret);
884
885 return ret;
886}
887
888static inline void drv_remove_chanctx(struct ieee80211_local *local,
889 struct ieee80211_chanctx *ctx)
890{
891 trace_drv_remove_chanctx(local, ctx);
892 if (local->ops->remove_chanctx)
893 local->ops->remove_chanctx(&local->hw, &ctx->conf);
894 trace_drv_return_void(local);
895}
896
897static inline void drv_change_chanctx(struct ieee80211_local *local,
898 struct ieee80211_chanctx *ctx,
899 u32 changed)
900{
901 trace_drv_change_chanctx(local, ctx, changed);
902 if (local->ops->change_chanctx)
903 local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
904 trace_drv_return_void(local);
905}
906
907static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
908 struct ieee80211_sub_if_data *sdata,
909 struct ieee80211_chanctx *ctx)
910{
911 int ret = 0;
912
913 check_sdata_in_driver(sdata);
914
915 trace_drv_assign_vif_chanctx(local, sdata, ctx);
916 if (local->ops->assign_vif_chanctx)
917 ret = local->ops->assign_vif_chanctx(&local->hw,
918 &sdata->vif,
919 &ctx->conf);
920 trace_drv_return_int(local, ret);
921
922 return ret;
923}
924
925static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
926 struct ieee80211_sub_if_data *sdata,
927 struct ieee80211_chanctx *ctx)
928{
929 check_sdata_in_driver(sdata);
930
931 trace_drv_unassign_vif_chanctx(local, sdata, ctx);
932 if (local->ops->unassign_vif_chanctx)
933 local->ops->unassign_vif_chanctx(&local->hw,
934 &sdata->vif,
935 &ctx->conf);
936 trace_drv_return_void(local);
937}
938
874#endif /* __MAC80211_DRIVER_OPS */ 939#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 18d9c8a52e9e..a3f5fe2a84a8 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -28,6 +28,15 @@
28#define VIF_PR_FMT " vif:%s(%d%s)" 28#define VIF_PR_FMT " vif:%s(%d%s)"
29#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" 29#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
30 30
31#define CHANCTX_ENTRY __field(int, freq) \
32 __field(int, chantype)
33#define CHANCTX_ASSIGN __entry->freq = ctx->conf.channel->center_freq; \
34 __entry->chantype = ctx->conf.channel_type
35#define CHANCTX_PR_FMT " freq:%d MHz chantype:%d"
36#define CHANCTX_PR_ARG __entry->freq, __entry->chantype
37
38
39
31/* 40/*
32 * Tracing for driver callbacks. 41 * Tracing for driver callbacks.
33 */ 42 */
@@ -1256,6 +1265,104 @@ DEFINE_EVENT(local_sdata_evt, drv_mgd_prepare_tx,
1256 TP_ARGS(local, sdata) 1265 TP_ARGS(local, sdata)
1257); 1266);
1258 1267
1268DECLARE_EVENT_CLASS(local_chanctx,
1269 TP_PROTO(struct ieee80211_local *local,
1270 struct ieee80211_chanctx *ctx),
1271
1272 TP_ARGS(local, ctx),
1273
1274 TP_STRUCT__entry(
1275 LOCAL_ENTRY
1276 CHANCTX_ENTRY
1277 ),
1278
1279 TP_fast_assign(
1280 LOCAL_ASSIGN;
1281 CHANCTX_ASSIGN;
1282 ),
1283
1284 TP_printk(
1285 LOCAL_PR_FMT CHANCTX_PR_FMT,
1286 LOCAL_PR_ARG, CHANCTX_PR_ARG
1287 )
1288);
1289
1290DEFINE_EVENT(local_chanctx, drv_add_chanctx,
1291 TP_PROTO(struct ieee80211_local *local,
1292 struct ieee80211_chanctx *ctx),
1293 TP_ARGS(local, ctx)
1294);
1295
1296DEFINE_EVENT(local_chanctx, drv_remove_chanctx,
1297 TP_PROTO(struct ieee80211_local *local,
1298 struct ieee80211_chanctx *ctx),
1299 TP_ARGS(local, ctx)
1300);
1301
1302TRACE_EVENT(drv_change_chanctx,
1303 TP_PROTO(struct ieee80211_local *local,
1304 struct ieee80211_chanctx *ctx,
1305 u32 changed),
1306
1307 TP_ARGS(local, ctx, changed),
1308
1309 TP_STRUCT__entry(
1310 LOCAL_ENTRY
1311 CHANCTX_ENTRY
1312 __field(u32, changed)
1313 ),
1314
1315 TP_fast_assign(
1316 LOCAL_ASSIGN;
1317 CHANCTX_ASSIGN;
1318 __entry->changed = changed;
1319 ),
1320
1321 TP_printk(
1322 LOCAL_PR_FMT CHANCTX_PR_FMT " changed:%#x",
1323 LOCAL_PR_ARG, CHANCTX_PR_ARG, __entry->changed
1324 )
1325);
1326
1327DECLARE_EVENT_CLASS(local_sdata_chanctx,
1328 TP_PROTO(struct ieee80211_local *local,
1329 struct ieee80211_sub_if_data *sdata,
1330 struct ieee80211_chanctx *ctx),
1331
1332 TP_ARGS(local, sdata, ctx),
1333
1334 TP_STRUCT__entry(
1335 LOCAL_ENTRY
1336 VIF_ENTRY
1337 CHANCTX_ENTRY
1338 ),
1339
1340 TP_fast_assign(
1341 LOCAL_ASSIGN;
1342 VIF_ASSIGN;
1343 CHANCTX_ASSIGN;
1344 ),
1345
1346 TP_printk(
1347 LOCAL_PR_FMT VIF_PR_FMT CHANCTX_PR_FMT,
1348 LOCAL_PR_ARG, VIF_PR_ARG, CHANCTX_PR_ARG
1349 )
1350);
1351
1352DEFINE_EVENT(local_sdata_chanctx, drv_assign_vif_chanctx,
1353 TP_PROTO(struct ieee80211_local *local,
1354 struct ieee80211_sub_if_data *sdata,
1355 struct ieee80211_chanctx *ctx),
1356 TP_ARGS(local, sdata, ctx)
1357);
1358
1359DEFINE_EVENT(local_sdata_chanctx, drv_unassign_vif_chanctx,
1360 TP_PROTO(struct ieee80211_local *local,
1361 struct ieee80211_sub_if_data *sdata,
1362 struct ieee80211_chanctx *ctx),
1363 TP_ARGS(local, sdata, ctx)
1364);
1365
1259/* 1366/*
1260 * Tracing for API calls that drivers call. 1367 * Tracing for API calls that drivers call.
1261 */ 1368 */