diff options
-rw-r--r-- | include/net/mac80211.h | 28 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 85 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 16 | ||||
-rw-r--r-- | net/mac80211/trace.h | 23 | ||||
-rw-r--r-- | net/mac80211/util.c | 5 |
5 files changed, 157 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index c4fadbafbf21..2ccd4d1bef89 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -309,6 +309,8 @@ struct ieee80211_vif_chanctx_switch { | |||
309 | * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected | 309 | * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected |
310 | * keep alive) changed. | 310 | * keep alive) changed. |
311 | * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface | 311 | * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface |
312 | * @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder | ||
313 | * functionality changed for this BSS (AP mode). | ||
312 | * | 314 | * |
313 | */ | 315 | */ |
314 | enum ieee80211_bss_change { | 316 | enum ieee80211_bss_change { |
@@ -338,6 +340,7 @@ enum ieee80211_bss_change { | |||
338 | BSS_CHANGED_MU_GROUPS = 1<<23, | 340 | BSS_CHANGED_MU_GROUPS = 1<<23, |
339 | BSS_CHANGED_KEEP_ALIVE = 1<<24, | 341 | BSS_CHANGED_KEEP_ALIVE = 1<<24, |
340 | BSS_CHANGED_MCAST_RATE = 1<<25, | 342 | BSS_CHANGED_MCAST_RATE = 1<<25, |
343 | BSS_CHANGED_FTM_RESPONDER = 1<<26, | ||
341 | 344 | ||
342 | /* when adding here, make sure to change ieee80211_reconfig */ | 345 | /* when adding here, make sure to change ieee80211_reconfig */ |
343 | }; | 346 | }; |
@@ -464,6 +467,21 @@ struct ieee80211_mu_group_data { | |||
464 | }; | 467 | }; |
465 | 468 | ||
466 | /** | 469 | /** |
470 | * ieee80211_ftm_responder_params - FTM responder parameters | ||
471 | * | ||
472 | * @lci: LCI subelement content | ||
473 | * @civicloc: CIVIC location subelement content | ||
474 | * @lci_len: LCI data length | ||
475 | * @civicloc_len: Civic data length | ||
476 | */ | ||
477 | struct ieee80211_ftm_responder_params { | ||
478 | const u8 *lci; | ||
479 | const u8 *civicloc; | ||
480 | size_t lci_len; | ||
481 | size_t civicloc_len; | ||
482 | }; | ||
483 | |||
484 | /** | ||
467 | * struct ieee80211_bss_conf - holds the BSS's changing parameters | 485 | * struct ieee80211_bss_conf - holds the BSS's changing parameters |
468 | * | 486 | * |
469 | * This structure keeps information about a BSS (and an association | 487 | * This structure keeps information about a BSS (and an association |
@@ -562,6 +580,9 @@ struct ieee80211_mu_group_data { | |||
562 | * @protected_keep_alive: if set, indicates that the station should send an RSN | 580 | * @protected_keep_alive: if set, indicates that the station should send an RSN |
563 | * protected frame to the AP to reset the idle timer at the AP for the | 581 | * protected frame to the AP to reset the idle timer at the AP for the |
564 | * station. | 582 | * station. |
583 | * @ftm_responder: whether to enable or disable fine timing measurement FTM | ||
584 | * responder functionality. | ||
585 | * @ftmr_params: configurable lci/civic parameter when enabling FTM responder. | ||
565 | */ | 586 | */ |
566 | struct ieee80211_bss_conf { | 587 | struct ieee80211_bss_conf { |
567 | const u8 *bssid; | 588 | const u8 *bssid; |
@@ -612,6 +633,8 @@ struct ieee80211_bss_conf { | |||
612 | bool allow_p2p_go_ps; | 633 | bool allow_p2p_go_ps; |
613 | u16 max_idle_period; | 634 | u16 max_idle_period; |
614 | bool protected_keep_alive; | 635 | bool protected_keep_alive; |
636 | bool ftm_responder; | ||
637 | struct ieee80211_ftm_responder_params *ftmr_params; | ||
615 | }; | 638 | }; |
616 | 639 | ||
617 | /** | 640 | /** |
@@ -3598,6 +3621,8 @@ enum ieee80211_reconfig_type { | |||
3598 | * aggregating two specific frames in the same A-MSDU. The relation | 3621 | * aggregating two specific frames in the same A-MSDU. The relation |
3599 | * between the skbs should be symmetric and transitive. Note that while | 3622 | * between the skbs should be symmetric and transitive. Note that while |
3600 | * skb is always a real frame, head may or may not be an A-MSDU. | 3623 | * skb is always a real frame, head may or may not be an A-MSDU. |
3624 | * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available. | ||
3625 | * Statistics should be cumulative, currently no way to reset is provided. | ||
3601 | */ | 3626 | */ |
3602 | struct ieee80211_ops { | 3627 | struct ieee80211_ops { |
3603 | void (*tx)(struct ieee80211_hw *hw, | 3628 | void (*tx)(struct ieee80211_hw *hw, |
@@ -3883,6 +3908,9 @@ struct ieee80211_ops { | |||
3883 | bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw, | 3908 | bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw, |
3884 | struct sk_buff *head, | 3909 | struct sk_buff *head, |
3885 | struct sk_buff *skb); | 3910 | struct sk_buff *skb); |
3911 | int (*get_ftm_responder_stats)(struct ieee80211_hw *hw, | ||
3912 | struct ieee80211_vif *vif, | ||
3913 | struct cfg80211_ftm_responder_stats *ftm_stats); | ||
3886 | }; | 3914 | }; |
3887 | 3915 | ||
3888 | /** | 3916 | /** |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 914aef7e7afd..51622333d460 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -790,6 +790,48 @@ static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
790 | return 0; | 790 | return 0; |
791 | } | 791 | } |
792 | 792 | ||
793 | static int ieee80211_set_ftm_responder_params( | ||
794 | struct ieee80211_sub_if_data *sdata, | ||
795 | const u8 *lci, size_t lci_len, | ||
796 | const u8 *civicloc, size_t civicloc_len) | ||
797 | { | ||
798 | struct ieee80211_ftm_responder_params *new, *old; | ||
799 | struct ieee80211_bss_conf *bss_conf; | ||
800 | u8 *pos; | ||
801 | int len; | ||
802 | |||
803 | if ((!lci || !lci_len) && (!civicloc || !civicloc_len)) | ||
804 | return 1; | ||
805 | |||
806 | bss_conf = &sdata->vif.bss_conf; | ||
807 | old = bss_conf->ftmr_params; | ||
808 | len = lci_len + civicloc_len; | ||
809 | |||
810 | new = kzalloc(sizeof(*new) + len, GFP_KERNEL); | ||
811 | if (!new) | ||
812 | return -ENOMEM; | ||
813 | |||
814 | pos = (u8 *)(new + 1); | ||
815 | if (lci_len) { | ||
816 | new->lci_len = lci_len; | ||
817 | new->lci = pos; | ||
818 | memcpy(pos, lci, lci_len); | ||
819 | pos += lci_len; | ||
820 | } | ||
821 | |||
822 | if (civicloc_len) { | ||
823 | new->civicloc_len = civicloc_len; | ||
824 | new->civicloc = pos; | ||
825 | memcpy(pos, civicloc, civicloc_len); | ||
826 | pos += civicloc_len; | ||
827 | } | ||
828 | |||
829 | bss_conf->ftmr_params = new; | ||
830 | kfree(old); | ||
831 | |||
832 | return 0; | ||
833 | } | ||
834 | |||
793 | static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, | 835 | static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, |
794 | struct cfg80211_beacon_data *params, | 836 | struct cfg80211_beacon_data *params, |
795 | const struct ieee80211_csa_settings *csa) | 837 | const struct ieee80211_csa_settings *csa) |
@@ -863,6 +905,20 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, | |||
863 | if (err == 0) | 905 | if (err == 0) |
864 | changed |= BSS_CHANGED_AP_PROBE_RESP; | 906 | changed |= BSS_CHANGED_AP_PROBE_RESP; |
865 | 907 | ||
908 | if (params->ftm_responder != -1) { | ||
909 | sdata->vif.bss_conf.ftm_responder = params->ftm_responder; | ||
910 | err = ieee80211_set_ftm_responder_params(sdata, | ||
911 | params->lci, | ||
912 | params->lci_len, | ||
913 | params->civicloc, | ||
914 | params->civicloc_len); | ||
915 | |||
916 | if (err < 0) | ||
917 | return err; | ||
918 | |||
919 | changed |= BSS_CHANGED_FTM_RESPONDER; | ||
920 | } | ||
921 | |||
866 | rcu_assign_pointer(sdata->u.ap.beacon, new); | 922 | rcu_assign_pointer(sdata->u.ap.beacon, new); |
867 | 923 | ||
868 | if (old) | 924 | if (old) |
@@ -1063,6 +1119,9 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) | |||
1063 | kfree_rcu(old_probe_resp, rcu_head); | 1119 | kfree_rcu(old_probe_resp, rcu_head); |
1064 | sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF; | 1120 | sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF; |
1065 | 1121 | ||
1122 | kfree(sdata->vif.bss_conf.ftmr_params); | ||
1123 | sdata->vif.bss_conf.ftmr_params = NULL; | ||
1124 | |||
1066 | __sta_info_flush(sdata, true); | 1125 | __sta_info_flush(sdata, true); |
1067 | ieee80211_free_keys(sdata, true); | 1126 | ieee80211_free_keys(sdata, true); |
1068 | 1127 | ||
@@ -2875,6 +2934,20 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon) | |||
2875 | memcpy(pos, beacon->probe_resp, beacon->probe_resp_len); | 2934 | memcpy(pos, beacon->probe_resp, beacon->probe_resp_len); |
2876 | pos += beacon->probe_resp_len; | 2935 | pos += beacon->probe_resp_len; |
2877 | } | 2936 | } |
2937 | if (beacon->ftm_responder) | ||
2938 | new_beacon->ftm_responder = beacon->ftm_responder; | ||
2939 | if (beacon->lci) { | ||
2940 | new_beacon->lci_len = beacon->lci_len; | ||
2941 | new_beacon->lci = pos; | ||
2942 | memcpy(pos, beacon->lci, beacon->lci_len); | ||
2943 | pos += beacon->lci_len; | ||
2944 | } | ||
2945 | if (beacon->civicloc) { | ||
2946 | new_beacon->civicloc_len = beacon->civicloc_len; | ||
2947 | new_beacon->civicloc = pos; | ||
2948 | memcpy(pos, beacon->civicloc, beacon->civicloc_len); | ||
2949 | pos += beacon->civicloc_len; | ||
2950 | } | ||
2878 | 2951 | ||
2879 | return new_beacon; | 2952 | return new_beacon; |
2880 | } | 2953 | } |
@@ -3765,6 +3838,17 @@ out: | |||
3765 | return ret; | 3838 | return ret; |
3766 | } | 3839 | } |
3767 | 3840 | ||
3841 | static int | ||
3842 | ieee80211_get_ftm_responder_stats(struct wiphy *wiphy, | ||
3843 | struct net_device *dev, | ||
3844 | struct cfg80211_ftm_responder_stats *ftm_stats) | ||
3845 | { | ||
3846 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
3847 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3848 | |||
3849 | return drv_get_ftm_responder_stats(local, sdata, ftm_stats); | ||
3850 | } | ||
3851 | |||
3768 | const struct cfg80211_ops mac80211_config_ops = { | 3852 | const struct cfg80211_ops mac80211_config_ops = { |
3769 | .add_virtual_intf = ieee80211_add_iface, | 3853 | .add_virtual_intf = ieee80211_add_iface, |
3770 | .del_virtual_intf = ieee80211_del_iface, | 3854 | .del_virtual_intf = ieee80211_del_iface, |
@@ -3859,4 +3943,5 @@ const struct cfg80211_ops mac80211_config_ops = { | |||
3859 | .set_multicast_to_unicast = ieee80211_set_multicast_to_unicast, | 3943 | .set_multicast_to_unicast = ieee80211_set_multicast_to_unicast, |
3860 | .tx_control_port = ieee80211_tx_control_port, | 3944 | .tx_control_port = ieee80211_tx_control_port, |
3861 | .get_txq_stats = ieee80211_get_txq_stats, | 3945 | .get_txq_stats = ieee80211_get_txq_stats, |
3946 | .get_ftm_responder_stats = ieee80211_get_ftm_responder_stats, | ||
3862 | }; | 3947 | }; |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index e42c641b6190..0b1747a2313d 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -1183,6 +1183,22 @@ static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local, | |||
1183 | return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb); | 1183 | return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb); |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static inline int | ||
1187 | drv_get_ftm_responder_stats(struct ieee80211_local *local, | ||
1188 | struct ieee80211_sub_if_data *sdata, | ||
1189 | struct cfg80211_ftm_responder_stats *ftm_stats) | ||
1190 | { | ||
1191 | u32 ret = -EOPNOTSUPP; | ||
1192 | |||
1193 | if (local->ops->get_ftm_responder_stats) | ||
1194 | ret = local->ops->get_ftm_responder_stats(&local->hw, | ||
1195 | &sdata->vif, | ||
1196 | ftm_stats); | ||
1197 | trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats); | ||
1198 | |||
1199 | return ret; | ||
1200 | } | ||
1201 | |||
1186 | static inline int drv_start_nan(struct ieee80211_local *local, | 1202 | static inline int drv_start_nan(struct ieee80211_local *local, |
1187 | struct ieee80211_sub_if_data *sdata, | 1203 | struct ieee80211_sub_if_data *sdata, |
1188 | struct cfg80211_nan_conf *conf) | 1204 | struct cfg80211_nan_conf *conf) |
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 0ab69a1964f8..588c51a67c89 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -2600,6 +2600,29 @@ TRACE_EVENT(drv_wake_tx_queue, | |||
2600 | ) | 2600 | ) |
2601 | ); | 2601 | ); |
2602 | 2602 | ||
2603 | TRACE_EVENT(drv_get_ftm_responder_stats, | ||
2604 | TP_PROTO(struct ieee80211_local *local, | ||
2605 | struct ieee80211_sub_if_data *sdata, | ||
2606 | struct cfg80211_ftm_responder_stats *ftm_stats), | ||
2607 | |||
2608 | TP_ARGS(local, sdata, ftm_stats), | ||
2609 | |||
2610 | TP_STRUCT__entry( | ||
2611 | LOCAL_ENTRY | ||
2612 | VIF_ENTRY | ||
2613 | ), | ||
2614 | |||
2615 | TP_fast_assign( | ||
2616 | LOCAL_ASSIGN; | ||
2617 | VIF_ASSIGN; | ||
2618 | ), | ||
2619 | |||
2620 | TP_printk( | ||
2621 | LOCAL_PR_FMT VIF_PR_FMT, | ||
2622 | LOCAL_PR_ARG, VIF_PR_ARG | ||
2623 | ) | ||
2624 | ); | ||
2625 | |||
2603 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ | 2626 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ |
2604 | 2627 | ||
2605 | #undef TRACE_INCLUDE_PATH | 2628 | #undef TRACE_INCLUDE_PATH |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index ef5d1f60a63b..bec424316ea4 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -2178,6 +2178,11 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
2178 | case NL80211_IFTYPE_AP: | 2178 | case NL80211_IFTYPE_AP: |
2179 | changed |= BSS_CHANGED_SSID | BSS_CHANGED_P2P_PS; | 2179 | changed |= BSS_CHANGED_SSID | BSS_CHANGED_P2P_PS; |
2180 | 2180 | ||
2181 | if (sdata->vif.bss_conf.ftm_responder == 1 && | ||
2182 | wiphy_ext_feature_isset(sdata->local->hw.wiphy, | ||
2183 | NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER)) | ||
2184 | changed |= BSS_CHANGED_FTM_RESPONDER; | ||
2185 | |||
2181 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | 2186 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
2182 | changed |= BSS_CHANGED_AP_PROBE_RESP; | 2187 | changed |= BSS_CHANGED_AP_PROBE_RESP; |
2183 | 2188 | ||