Commit e32cf9a3 authored by David S. Miller's avatar David S. Miller

Merge tag 'mac80211-next-for-davem-2018-10-12' of...

Merge tag 'mac80211-next-for-davem-2018-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
Highlights:
 * merge net-next, so I can finish the hwsim workqueue removal
 * fix TXQ NULL pointer issue that was reported multiple times
 * minstrel cleanups from Felix
 * simplify lib80211 code by not using skcipher, note that this
   will conflict with the crypto tree (and this new code here
   should be used)
 * use new netlink policy validation in nl80211
 * fix up SAE (part of WPA3) in client-mode
 * FTM responder support in the stack
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9163a0fc f8252e7b
...@@ -495,7 +495,6 @@ static const struct ieee80211_iface_combination hwsim_if_comb_p2p_dev[] = { ...@@ -495,7 +495,6 @@ static const struct ieee80211_iface_combination hwsim_if_comb_p2p_dev[] = {
static spinlock_t hwsim_radio_lock; static spinlock_t hwsim_radio_lock;
static LIST_HEAD(hwsim_radios); static LIST_HEAD(hwsim_radios);
static struct workqueue_struct *hwsim_wq;
static struct rhashtable hwsim_radios_rht; static struct rhashtable hwsim_radios_rht;
static int hwsim_radio_idx; static int hwsim_radio_idx;
static int hwsim_radios_generation = 1; static int hwsim_radios_generation = 1;
...@@ -3692,13 +3691,9 @@ static int __init init_mac80211_hwsim(void) ...@@ -3692,13 +3691,9 @@ static int __init init_mac80211_hwsim(void)
spin_lock_init(&hwsim_radio_lock); spin_lock_init(&hwsim_radio_lock);
hwsim_wq = alloc_workqueue("hwsim_wq", 0, 0);
if (!hwsim_wq)
return -ENOMEM;
err = rhashtable_init(&hwsim_radios_rht, &hwsim_rht_params); err = rhashtable_init(&hwsim_radios_rht, &hwsim_rht_params);
if (err) if (err)
goto out_free_wq; return err;
err = register_pernet_device(&hwsim_net_ops); err = register_pernet_device(&hwsim_net_ops);
if (err) if (err)
...@@ -3829,8 +3824,6 @@ static int __init init_mac80211_hwsim(void) ...@@ -3829,8 +3824,6 @@ static int __init init_mac80211_hwsim(void)
unregister_pernet_device(&hwsim_net_ops); unregister_pernet_device(&hwsim_net_ops);
out_free_rht: out_free_rht:
rhashtable_destroy(&hwsim_radios_rht); rhashtable_destroy(&hwsim_radios_rht);
out_free_wq:
destroy_workqueue(hwsim_wq);
return err; return err;
} }
module_init(init_mac80211_hwsim); module_init(init_mac80211_hwsim);
...@@ -3842,12 +3835,10 @@ static void __exit exit_mac80211_hwsim(void) ...@@ -3842,12 +3835,10 @@ static void __exit exit_mac80211_hwsim(void)
hwsim_exit_netlink(); hwsim_exit_netlink();
mac80211_hwsim_free(); mac80211_hwsim_free();
flush_workqueue(hwsim_wq);
rhashtable_destroy(&hwsim_radios_rht); rhashtable_destroy(&hwsim_radios_rht);
unregister_netdev(hwsim_mon); unregister_netdev(hwsim_mon);
platform_driver_unregister(&mac80211_hwsim_driver); platform_driver_unregister(&mac80211_hwsim_driver);
unregister_pernet_device(&hwsim_net_ops); unregister_pernet_device(&hwsim_net_ops);
destroy_workqueue(hwsim_wq);
} }
module_exit(exit_mac80211_hwsim); module_exit(exit_mac80211_hwsim);
...@@ -1670,6 +1670,7 @@ struct ieee80211_mu_edca_param_set { ...@@ -1670,6 +1670,7 @@ struct ieee80211_mu_edca_param_set {
#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
......
...@@ -775,6 +775,12 @@ struct cfg80211_crypto_settings { ...@@ -775,6 +775,12 @@ struct cfg80211_crypto_settings {
* @assocresp_ies_len: length of assocresp_ies in octets * @assocresp_ies_len: length of assocresp_ies in octets
* @probe_resp_len: length of probe response template (@probe_resp) * @probe_resp_len: length of probe response template (@probe_resp)
* @probe_resp: probe response template (AP mode only) * @probe_resp: probe response template (AP mode only)
* @ftm_responder: enable FTM responder functionality; -1 for no change
* (which also implies no change in LCI/civic location data)
* @lci: LCI subelement content
* @civicloc: Civic location subelement content
* @lci_len: LCI data length
* @civicloc_len: Civic location data length
*/ */
struct cfg80211_beacon_data { struct cfg80211_beacon_data {
const u8 *head, *tail; const u8 *head, *tail;
...@@ -782,12 +788,17 @@ struct cfg80211_beacon_data { ...@@ -782,12 +788,17 @@ struct cfg80211_beacon_data {
const u8 *proberesp_ies; const u8 *proberesp_ies;
const u8 *assocresp_ies; const u8 *assocresp_ies;
const u8 *probe_resp; const u8 *probe_resp;
const u8 *lci;
const u8 *civicloc;
s8 ftm_responder;
size_t head_len, tail_len; size_t head_len, tail_len;
size_t beacon_ies_len; size_t beacon_ies_len;
size_t proberesp_ies_len; size_t proberesp_ies_len;
size_t assocresp_ies_len; size_t assocresp_ies_len;
size_t probe_resp_len; size_t probe_resp_len;
size_t lci_len;
size_t civicloc_len;
}; };
struct mac_address { struct mac_address {
...@@ -1292,6 +1303,10 @@ struct cfg80211_tid_stats { ...@@ -1292,6 +1303,10 @@ struct cfg80211_tid_stats {
* @ack_signal: signal strength (in dBm) of the last ACK frame. * @ack_signal: signal strength (in dBm) of the last ACK frame.
* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
* been sent. * been sent.
* @rx_mpdu_count: number of MPDUs received from this station
* @fcs_err_count: number of packets (MPDUs) received from this station with
* an FCS error. This counter should be incremented only when TA of the
* received packet with an FCS error matches the peer MAC address.
*/ */
struct station_info { struct station_info {
u64 filled; u64 filled;
...@@ -1338,6 +1353,9 @@ struct station_info { ...@@ -1338,6 +1353,9 @@ struct station_info {
struct cfg80211_tid_stats *pertid; struct cfg80211_tid_stats *pertid;
s8 ack_signal; s8 ack_signal;
s8 avg_ack_signal; s8 avg_ack_signal;
u32 rx_mpdu_count;
u32 fcs_err_count;
}; };
#if IS_ENABLED(CONFIG_CFG80211) #if IS_ENABLED(CONFIG_CFG80211)
...@@ -2796,6 +2814,40 @@ struct cfg80211_external_auth_params { ...@@ -2796,6 +2814,40 @@ struct cfg80211_external_auth_params {
u16 status; u16 status;
}; };
/**
* cfg80211_ftm_responder_stats - FTM responder statistics
*
* @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
* indicate the relevant values in this struct for them
* @success_num: number of FTM sessions in which all frames were successfully
* answered
* @partial_num: number of FTM sessions in which part of frames were
* successfully answered
* @failed_num: number of failed FTM sessions
* @asap_num: number of ASAP FTM sessions
* @non_asap_num: number of non-ASAP FTM sessions
* @total_duration_ms: total sessions durations - gives an indication
* of how much time the responder was busy
* @unknown_triggers_num: number of unknown FTM triggers - triggers from
* initiators that didn't finish successfully the negotiation phase with
* the responder
* @reschedule_requests_num: number of FTM reschedule requests - initiator asks
* for a new scheduling although it already has scheduled FTM slot
* @out_of_window_triggers_num: total FTM triggers out of scheduled window
*/
struct cfg80211_ftm_responder_stats {
u32 filled;
u32 success_num;
u32 partial_num;
u32 failed_num;
u32 asap_num;
u32 non_asap_num;
u64 total_duration_ms;
u32 unknown_triggers_num;
u32 reschedule_requests_num;
u32 out_of_window_triggers_num;
};
/** /**
* struct cfg80211_ops - backend description for wireless configuration * struct cfg80211_ops - backend description for wireless configuration
* *
...@@ -3128,6 +3180,9 @@ struct cfg80211_external_auth_params { ...@@ -3128,6 +3180,9 @@ struct cfg80211_external_auth_params {
* *
* @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
* tells the driver that the frame should not be encrypted. * tells the driver that the frame should not be encrypted.
*
* @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
* Statistics should be cumulative, currently no way to reset is provided.
*/ */
struct cfg80211_ops { struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
...@@ -3433,6 +3488,10 @@ struct cfg80211_ops { ...@@ -3433,6 +3488,10 @@ struct cfg80211_ops {
const u8 *buf, size_t len, const u8 *buf, size_t len,
const u8 *dest, const __be16 proto, const u8 *dest, const __be16 proto,
const bool noencrypt); const bool noencrypt);
int (*get_ftm_responder_stats)(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_ftm_responder_stats *ftm_stats);
}; };
/* /*
...@@ -3960,7 +4019,6 @@ struct wiphy_iftype_ext_capab { ...@@ -3960,7 +4019,6 @@ struct wiphy_iftype_ext_capab {
* by the driver in the .connect() callback. The bit position maps to the * by the driver in the .connect() callback. The bit position maps to the
* attribute indices defined in &enum nl80211_bss_select_attr. * attribute indices defined in &enum nl80211_bss_select_attr.
* *
* @cookie_counter: unique generic cookie counter, used to identify objects.
* @nan_supported_bands: bands supported by the device in NAN mode, a * @nan_supported_bands: bands supported by the device in NAN mode, a
* bitmap of &enum nl80211_band values. For instance, for * bitmap of &enum nl80211_band values. For instance, for
* NL80211_BAND_2GHZ, bit 0 would be set * NL80211_BAND_2GHZ, bit 0 would be set
...@@ -4099,8 +4157,6 @@ struct wiphy { ...@@ -4099,8 +4157,6 @@ struct wiphy {
u32 bss_select_support; u32 bss_select_support;
u64 cookie_counter;
u8 nan_supported_bands; u8 nan_supported_bands;
u32 txq_limit; u32 txq_limit;
......
...@@ -309,6 +309,8 @@ struct ieee80211_vif_chanctx_switch { ...@@ -309,6 +309,8 @@ struct ieee80211_vif_chanctx_switch {
* @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected
* keep alive) changed. * keep alive) changed.
* @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
* @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder
* functionality changed for this BSS (AP mode).
* *
*/ */
enum ieee80211_bss_change { enum ieee80211_bss_change {
...@@ -338,6 +340,7 @@ enum ieee80211_bss_change { ...@@ -338,6 +340,7 @@ enum ieee80211_bss_change {
BSS_CHANGED_MU_GROUPS = 1<<23, BSS_CHANGED_MU_GROUPS = 1<<23,
BSS_CHANGED_KEEP_ALIVE = 1<<24, BSS_CHANGED_KEEP_ALIVE = 1<<24,
BSS_CHANGED_MCAST_RATE = 1<<25, BSS_CHANGED_MCAST_RATE = 1<<25,
BSS_CHANGED_FTM_RESPONDER = 1<<26,
/* when adding here, make sure to change ieee80211_reconfig */ /* when adding here, make sure to change ieee80211_reconfig */
}; };
...@@ -463,6 +466,21 @@ struct ieee80211_mu_group_data { ...@@ -463,6 +466,21 @@ struct ieee80211_mu_group_data {
u8 position[WLAN_USER_POSITION_LEN]; u8 position[WLAN_USER_POSITION_LEN];
}; };
/**
* ieee80211_ftm_responder_params - FTM responder parameters
*
* @lci: LCI subelement content
* @civicloc: CIVIC location subelement content
* @lci_len: LCI data length
* @civicloc_len: Civic data length
*/
struct ieee80211_ftm_responder_params {
const u8 *lci;
const u8 *civicloc;
size_t lci_len;
size_t civicloc_len;
};
/** /**
* struct ieee80211_bss_conf - holds the BSS's changing parameters * struct ieee80211_bss_conf - holds the BSS's changing parameters
* *
...@@ -562,6 +580,9 @@ struct ieee80211_mu_group_data { ...@@ -562,6 +580,9 @@ struct ieee80211_mu_group_data {
* @protected_keep_alive: if set, indicates that the station should send an RSN * @protected_keep_alive: if set, indicates that the station should send an RSN
* protected frame to the AP to reset the idle timer at the AP for the * protected frame to the AP to reset the idle timer at the AP for the
* station. * station.
* @ftm_responder: whether to enable or disable fine timing measurement FTM
* responder functionality.
* @ftmr_params: configurable lci/civic parameter when enabling FTM responder.
*/ */
struct ieee80211_bss_conf { struct ieee80211_bss_conf {
const u8 *bssid; const u8 *bssid;
...@@ -612,6 +633,8 @@ struct ieee80211_bss_conf { ...@@ -612,6 +633,8 @@ struct ieee80211_bss_conf {
bool allow_p2p_go_ps; bool allow_p2p_go_ps;
u16 max_idle_period; u16 max_idle_period;
bool protected_keep_alive; bool protected_keep_alive;
bool ftm_responder;
struct ieee80211_ftm_responder_params *ftmr_params;
}; };
/** /**
...@@ -3598,6 +3621,8 @@ enum ieee80211_reconfig_type { ...@@ -3598,6 +3621,8 @@ enum ieee80211_reconfig_type {
* aggregating two specific frames in the same A-MSDU. The relation * aggregating two specific frames in the same A-MSDU. The relation
* between the skbs should be symmetric and transitive. Note that while * between the skbs should be symmetric and transitive. Note that while
* skb is always a real frame, head may or may not be an A-MSDU. * skb is always a real frame, head may or may not be an A-MSDU.
* @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
* Statistics should be cumulative, currently no way to reset is provided.
*/ */
struct ieee80211_ops { struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw, void (*tx)(struct ieee80211_hw *hw,
...@@ -3883,6 +3908,9 @@ struct ieee80211_ops { ...@@ -3883,6 +3908,9 @@ struct ieee80211_ops {
bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw, bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw,
struct sk_buff *head, struct sk_buff *head,
struct sk_buff *skb); struct sk_buff *skb);
int (*get_ftm_responder_stats)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct cfg80211_ftm_responder_stats *ftm_stats);
}; };
/** /**
...@@ -4351,6 +4379,21 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif, ...@@ -4351,6 +4379,21 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
void ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta, void ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta,
u32 thr); u32 thr);
/**
* ieee80211_tx_rate_update - transmit rate update callback
*
* Drivers should call this functions with a non-NULL pub sta
* This function can be used in drivers that does not have provision
* in updating the tx rate in data path.
*
* @hw: the hardware the frame was transmitted by
* @pubsta: the station to update the tx rate for.
* @info: tx status information
*/
void ieee80211_tx_rate_update(struct ieee80211_hw *hw,
struct ieee80211_sta *pubsta,
struct ieee80211_tx_info *info);
/** /**
* ieee80211_tx_status - transmit status callback * ieee80211_tx_status - transmit status callback
* *
......
...@@ -1033,6 +1033,9 @@ ...@@ -1033,6 +1033,9 @@
* %NL80211_ATTR_CHANNEL_WIDTH,%NL80211_ATTR_NSS attributes with its * %NL80211_ATTR_CHANNEL_WIDTH,%NL80211_ATTR_NSS attributes with its
* address(specified in %NL80211_ATTR_MAC). * address(specified in %NL80211_ATTR_MAC).
* *
* @NL80211_CMD_GET_FTM_RESPONDER_STATS: Retrieve FTM responder statistics, in
* the %NL80211_ATTR_FTM_RESPONDER_STATS attribute.
*
* @NL80211_CMD_MAX: highest used command number * @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use * @__NL80211_CMD_AFTER_LAST: internal use
*/ */
...@@ -1245,6 +1248,8 @@ enum nl80211_commands { ...@@ -1245,6 +1248,8 @@ enum nl80211_commands {
NL80211_CMD_CONTROL_PORT_FRAME, NL80211_CMD_CONTROL_PORT_FRAME,
NL80211_CMD_GET_FTM_RESPONDER_STATS,
/* add new commands above here */ /* add new commands above here */
/* used to define NL80211_CMD_MAX below */ /* used to define NL80211_CMD_MAX below */
...@@ -2241,6 +2246,14 @@ enum nl80211_commands { ...@@ -2241,6 +2246,14 @@ enum nl80211_commands {
* association request when used with NL80211_CMD_NEW_STATION). Can be set * association request when used with NL80211_CMD_NEW_STATION). Can be set
* only if %NL80211_STA_FLAG_WME is set. * only if %NL80211_STA_FLAG_WME is set.
* *
* @NL80211_ATTR_FTM_RESPONDER: nested attribute which user-space can include
* in %NL80211_CMD_START_AP or %NL80211_CMD_SET_BEACON for fine timing
* measurement (FTM) responder functionality and containing parameters as
* possible, see &enum nl80211_ftm_responder_attr
*
* @NL80211_ATTR_FTM_RESPONDER_STATS: Nested attribute with FTM responder
* statistics, see &enum nl80211_ftm_responder_stats.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined * @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use * @__NL80211_ATTR_AFTER_LAST: internal use
...@@ -2682,6 +2695,10 @@ enum nl80211_attrs { ...@@ -2682,6 +2695,10 @@ enum nl80211_attrs {
NL80211_ATTR_HE_CAPABILITY, NL80211_ATTR_HE_CAPABILITY,
NL80211_ATTR_FTM_RESPONDER,
NL80211_ATTR_FTM_RESPONDER_STATS,
/* add attributes here, update the policy in nl80211.c */ /* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST, __NL80211_ATTR_AFTER_LAST,
...@@ -3051,6 +3068,12 @@ enum nl80211_sta_bss_param { ...@@ -3051,6 +3068,12 @@ enum nl80211_sta_bss_param {
* @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
* @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm)
* @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm) * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm)
* @NL80211_STA_INFO_RX_MPDUS: total number of received packets (MPDUs)
* (u32, from this station)
* @NL80211_STA_INFO_FCS_ERROR_COUNT: total number of packets (MPDUs) received
* with an FCS error (u32, from this station). This count may not include
* some packets with an FCS error due to TA corruption. Hence this counter
* might not be fully accurate.
* @__NL80211_STA_INFO_AFTER_LAST: internal * @__NL80211_STA_INFO_AFTER_LAST: internal
* @NL80211_STA_INFO_MAX: highest possible station info attribute * @NL80211_STA_INFO_MAX: highest possible station info attribute
*/ */
...@@ -3091,6 +3114,8 @@ enum nl80211_sta_info { ...@@ -3091,6 +3114,8 @@ enum nl80211_sta_info {
NL80211_STA_INFO_PAD, NL80211_STA_INFO_PAD,
NL80211_STA_INFO_ACK_SIGNAL, NL80211_STA_INFO_ACK_SIGNAL,
NL80211_STA_INFO_ACK_SIGNAL_AVG, NL80211_STA_INFO_ACK_SIGNAL_AVG,
NL80211_STA_INFO_RX_MPDUS,
NL80211_STA_INFO_FCS_ERROR_COUNT,
/* keep last */ /* keep last */
__NL80211_STA_INFO_AFTER_LAST, __NL80211_STA_INFO_AFTER_LAST,
...@@ -5225,6 +5250,8 @@ enum nl80211_feature_flags { ...@@ -5225,6 +5250,8 @@ enum nl80211_feature_flags {
* @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data * @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data
* except for supported rates from the probe request content if requested * except for supported rates from the probe request content if requested
* by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag. * by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag.
* @NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER: Driver supports enabling fine
* timing measurement responder role.
* *
* @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0: Driver/device confirm that they are * @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0: Driver/device confirm that they are
* able to rekey an in-use key correctly. Userspace must not rekey PTK keys * able to rekey an in-use key correctly. Userspace must not rekey PTK keys
...@@ -5269,6 +5296,7 @@ enum nl80211_ext_feature_index { ...@@ -5269,6 +5296,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_SCAN_RANDOM_SN, NL80211_EXT_FEATURE_SCAN_RANDOM_SN,
NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
NL80211_EXT_FEATURE_CAN_REPLACE_PTK0, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
/* add new features before the definition below */ /* add new features before the definition below */
NUM_NL80211_EXT_FEATURES, NUM_NL80211_EXT_FEATURES,
...@@ -5808,4 +5836,74 @@ enum nl80211_external_auth_action { ...@@ -5808,4 +5836,74 @@ enum nl80211_external_auth_action {
NL80211_EXTERNAL_AUTH_ABORT, NL80211_EXTERNAL_AUTH_ABORT,
}; };
/**
* enum nl80211_ftm_responder_attributes - fine timing measurement
* responder attributes
* @__NL80211_FTM_RESP_ATTR_INVALID: Invalid
* @NL80211_FTM_RESP_ATTR_ENABLED: FTM responder is enabled
* @NL80211_FTM_RESP_ATTR_LCI: The content of Measurement Report Element
* (9.4.2.22 in 802.11-2016) with type 8 - LCI (9.4.2.22.10)
* @NL80211_FTM_RESP_ATTR_CIVIC: The content of Measurement Report Element
* (9.4.2.22 in 802.11-2016) with type 11 - Civic (Section 9.4.2.22.13)
* @__NL80211_FTM_RESP_ATTR_LAST: Internal
* @NL80211_FTM_RESP_ATTR_MAX: highest FTM responder attribute.
*/
enum nl80211_ftm_responder_attributes {
__NL80211_FTM_RESP_ATTR_INVALID,
NL80211_FTM_RESP_ATTR_ENABLED,
NL80211_FTM_RESP_ATTR_LCI,
NL80211_FTM_RESP_ATTR_CIVICLOC,
/* keep last */
__NL80211_FTM_RESP_ATTR_LAST,
NL80211_FTM_RESP_ATTR_MAX = __NL80211_FTM_RESP_ATTR_LAST - 1,
};
/*
* enum nl80211_ftm_responder_stats - FTM responder statistics
*
* These attribute types are used with %NL80211_ATTR_FTM_RESPONDER_STATS
* when getting FTM responder statistics.
*
* @__NL80211_FTM_STATS_INVALID: attribute number 0 is reserved
* @NL80211_FTM_STATS_SUCCESS_NUM: number of FTM sessions in which all frames
* were ssfully answered (u32)
* @NL80211_FTM_STATS_PARTIAL_NUM: number of FTM sessions in which part of the
* frames were successfully answered (u32)
* @NL80211_FTM_STATS_FAILED_NUM: number of failed FTM sessions (u32)
* @NL80211_FTM_STATS_ASAP_NUM: number of ASAP sessions (u32)
* @NL80211_FTM_STATS_NON_ASAP_NUM: number of non-ASAP sessions (u32)
* @NL80211_FTM_STATS_TOTAL_DURATION_MSEC: total sessions durations - gives an
* indication of how much time the responder was busy (u64, msec)
* @NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM: number of unknown FTM triggers -
* triggers from initiators that didn't finish successfully the negotiation
* phase with the responder (u32)
* @NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM: number of FTM reschedule requests
* - initiator asks for a new scheduling although it already has scheduled
* FTM slot (u32)
* @NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM: number of FTM triggers out of
* scheduled window (u32)
* @NL80211_FTM_STATS_PAD: used for padding, ignore
* @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
* @NL80211_FTM_STATS_MAX: highest possible FTM responder stats attribute
*/
enum nl80211_ftm_responder_stats {
__NL80211_FTM_STATS_INVALID,
NL80211_FTM_STATS_SUCCESS_NUM,
NL80211_FTM_STATS_PARTIAL_NUM,
NL80211_FTM_STATS_FAILED_NUM,
NL80211_FTM_STATS_ASAP_NUM,
NL80211_FTM_STATS_NON_ASAP_NUM,
NL80211_FTM_STATS_TOTAL_DURATION_MSEC,
NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM,
NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM,
NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM,
NL80211_FTM_STATS_PAD,
/* keep last */
__NL80211_FTM_STATS_AFTER_LAST,
NL80211_FTM_STATS_MAX = __NL80211_FTM_STATS_AFTER_LAST - 1
};
#endif /* __LINUX_NL80211_H */ #endif /* __LINUX_NL80211_H */
...@@ -27,20 +27,6 @@ config MAC80211_RC_MINSTREL ...@@ -27,20 +27,6 @@ config MAC80211_RC_MINSTREL
---help--- ---help---
This option enables the 'minstrel' TX rate control algorithm This option enables the 'minstrel' TX rate control algorithm
config MAC80211_RC_MINSTREL_HT
bool "Minstrel 802.11n support" if EXPERT
depends on MAC80211_RC_MINSTREL
default y
---help---
This option enables the 'minstrel_ht' TX rate control algorithm
config MAC80211_RC_MINSTREL_VHT
bool "Minstrel 802.11ac support" if EXPERT
depends on MAC80211_RC_MINSTREL_HT
default n
---help---
This option enables VHT in the 'minstrel_ht' TX rate control algorithm
choice choice
prompt "Default rate control algorithm" prompt "Default rate control algorithm"
depends on MAC80211_HAS_RC depends on MAC80211_HAS_RC
...@@ -62,8 +48,7 @@ endchoice ...@@ -62,8 +48,7 @@ endchoice
config MAC80211_RC_DEFAULT config MAC80211_RC_DEFAULT
string string
default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL && MAC80211_RC_MINSTREL_HT default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL
default "minstrel" if MAC80211_RC_DEFAULT_MINSTREL
default "" default ""
endif endif
......
...@@ -53,13 +53,14 @@ mac80211-$(CONFIG_PM) += pm.o ...@@ -53,13 +53,14 @@ mac80211-$(CONFIG_PM) += pm.o
CFLAGS_trace.o := -I$(src) CFLAGS_trace.o := -I$(src)
rc80211_minstrel-y := rc80211_minstrel.o rc80211_minstrel-y := \
rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o rc80211_minstrel.o \
rc80211_minstrel_ht.o
rc80211_minstrel_ht-y := rc80211_minstrel_ht.o rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += \
rc80211_minstrel_ht-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_ht_debugfs.o rc80211_minstrel_debugfs.o \
rc80211_minstrel_ht_debugfs.o
mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y)
mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y)
ccflags-y += -DDEBUG ccflags-y += -DDEBUG
...@@ -790,6 +790,48 @@ static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, ...@@ -790,6 +790,48 @@ static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
return 0; return 0;
} }
static int ieee80211_set_ftm_responder_params(
struct ieee80211_sub_if_data *sdata,
const u8 *lci, size_t lci_len,
const u8 *civicloc, size_t civicloc_len)
{
struct ieee80211_ftm_responder_params *new, *old;
struct ieee80211_bss_conf *bss_conf;
u8 *pos;
int len;
if ((!lci || !lci_len) && (!civicloc || !civicloc_len))
return 1;
bss_conf = &sdata->vif.bss_conf;
old = bss_conf->ftmr_params;
len = lci_len + civicloc_len;
new = kzalloc(sizeof(*new) + len, GFP_KERNEL);
if (!new)
return -ENOMEM;
pos = (u8 *)(new + 1);
if (lci_len) {
new->lci_len = lci_len;
new->lci = pos;
memcpy(pos, lci, lci_len);
pos += lci_len;
}
if (civicloc_len) {
new->civicloc_len = civicloc_len;
new->civicloc = pos;
memcpy(pos, civicloc, civicloc_len);
pos += civicloc_len;
}
bss_conf->ftmr_params = new;
kfree(old);
return 0;
}
static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
struct cfg80211_beacon_data *params, struct cfg80211_beacon_data *params,
const struct ieee80211_csa_settings *csa) const struct ieee80211_csa_settings *csa)
...@@ -863,6 +905,20 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, ...@@ -863,6 +905,20 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
if (err == 0) if (err == 0)
changed |= BSS_CHANGED_AP_PROBE_RESP; changed |= BSS_CHANGED_AP_PROBE_RESP;
if (params->ftm_responder != -1) {
sdata->vif.bss_conf.ftm_responder = params->ftm_responder;
err = ieee80211_set_ftm_responder_params(sdata,
params->lci,
params->lci_len,
params->civicloc,
params->civicloc_len);
if (err < 0)
return err;
changed |= BSS_CHANGED_FTM_RESPONDER;
}
rcu_assign_pointer(sdata->u.ap.beacon, new); rcu_assign_pointer(sdata->u.ap.beacon, new);
if (old) if (old)
...@@ -1063,6 +1119,9 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) ...@@ -1063,6 +1119,9 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
kfree_rcu(old_probe_resp, rcu_head); kfree_rcu(old_probe_resp, rcu_head);
sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF; sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
kfree(sdata->vif.bss_conf.ftmr_params);
sdata->vif.bss_conf.ftmr_params = NULL;
__sta_info_flush(sdata, true); __sta_info_flush(sdata, true);
ieee80211_free_keys(sdata, true); ieee80211_free_keys(sdata, true);
...@@ -2875,6 +2934,20 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon) ...@@ -2875,6 +2934,20 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
memcpy(pos, beacon->probe_resp, beacon->probe_resp_len); memcpy(pos, beacon->probe_resp, beacon->probe_resp_len);
pos += beacon->probe_resp_len; pos += beacon->probe_resp_len;
} }
if (beacon->ftm_responder)
new_beacon->ftm_responder = beacon->ftm_responder;
if (beacon->lci) {
new_beacon->lci_len = beacon->lci_len;
new_beacon->lci = pos;
memcpy(pos, beacon->lci, beacon->lci_len);
pos += beacon->lci_len;
}
if (beacon->civicloc) {
new_beacon->civicloc_len = beacon->civicloc_len;
new_beacon->civicloc = pos;
memcpy(pos, beacon->civicloc, beacon->civicloc_len);
pos += beacon->civicloc_len;
}
return new_beacon; return new_beacon;
} }
...@@ -3765,6 +3838,17 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy, ...@@ -3765,6 +3838,17 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy,
return ret; return ret;
} }
static int
ieee80211_get_ftm_responder_stats(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_ftm_responder_stats *ftm_stats)
{
struct ieee80211_local *local = wiphy_priv(wiphy);
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
return drv_get_ftm_responder_stats(local, sdata, ftm_stats);
}
const struct cfg80211_ops mac80211_config_ops = { const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface, .add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface, .del_virtual_intf = ieee80211_del_iface,
...@@ -3859,4 +3943,5 @@ const struct cfg80211_ops mac80211_config_ops = { ...@@ -3859,4 +3943,5 @@ const struct cfg80211_ops mac80211_config_ops = {
.set_multicast_to_unicast = ieee80211_set_multicast_to_unicast, .set_multicast_to_unicast = ieee80211_set_multicast_to_unicast,
.tx_control_port = ieee80211_tx_control_port, .tx_control_port = ieee80211_tx_control_port,
.get_txq_stats = ieee80211_get_txq_stats, .get_txq_stats = ieee80211_get_txq_stats,
.get_ftm_responder_stats = ieee80211_get_ftm_responder_stats,
}; };
...@@ -1183,6 +1183,22 @@ static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local, ...@@ -1183,6 +1183,22 @@ static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local,
return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb); return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb);
} }
static inline int
drv_get_ftm_responder_stats(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct cfg80211_ftm_responder_stats *ftm_stats)
{
u32 ret = -EOPNOTSUPP;
if (local->ops->get_ftm_responder_stats)
ret = local->ops->get_ftm_responder_stats(&local->hw,
&sdata->vif,
ftm_stats);
trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats);
return ret;
}
static inline int drv_start_nan(struct ieee80211_local *local, static inline int drv_start_nan(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, struct ieee80211_sub_if_data *sdata,
struct cfg80211_nan_conf *conf) struct cfg80211_nan_conf *conf)
......
...@@ -377,6 +377,7 @@ struct ieee80211_mgd_auth_data { ...@@ -377,6 +377,7 @@ struct ieee80211_mgd_auth_data {
u8 key[WLAN_KEY_LEN_WEP104]; u8 key[WLAN_KEY_LEN_WEP104];
u8 key_len, key_idx; u8 key_len, key_idx;
bool done; bool done;
bool peer_confirmed;
bool timeout_started; bool timeout_started;
u16 sae_trans, sae_status; u16 sae_trans, sae_status;
......
...@@ -1203,8 +1203,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) ...@@ -1203,8 +1203,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
continue; continue;
sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL); sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL);
if (!sband) if (!sband) {
result = -ENOMEM;
goto fail_rate; goto fail_rate;
}
wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n", wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n",
band); band);
...@@ -1373,18 +1375,12 @@ static int __init ieee80211_init(void) ...@@ -1373,18 +1375,12 @@ static int __init ieee80211_init(void)
if (ret) if (ret)
return ret; return ret;
ret = rc80211_minstrel_ht_init();
if (ret)
goto err_minstrel;
ret = ieee80211_iface_init(); ret = ieee80211_iface_init();
if (ret) if (ret)
goto err_netdev; goto err_netdev;
return 0; return 0;
err_netdev: err_netdev:
rc80211_minstrel_ht_exit();
err_minstrel:
rc80211_minstrel_exit(); rc80211_minstrel_exit();
return ret; return ret;
...@@ -1392,7 +1388,6 @@ static int __init ieee80211_init(void) ...@@ -1392,7 +1388,6 @@ static int __init ieee80211_init(void)
static void __exit ieee80211_exit(void) static void __exit ieee80211_exit(void)
{ {
rc80211_minstrel_ht_exit();
rc80211_minstrel_exit(); rc80211_minstrel_exit();
ieee80211s_stop(); ieee80211s_stop();
......
...@@ -2761,13 +2761,40 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata, ...@@ -2761,13 +2761,40 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
auth_data->key_idx, tx_flags); auth_data->key_idx, tx_flags);
} }
static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata,
const u8 *bssid)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct sta_info *sta;
sdata_info(sdata, "authenticated\n");
ifmgd->auth_data->done = true;
ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
ifmgd->auth_data->timeout_started = true;
run_again(sdata, ifmgd->auth_data->timeout);
/* move station state to auth */
mutex_lock(&sdata->local->sta_mtx);
sta = sta_info_get(sdata, bssid);
if (!sta) {
WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid);
return false;
}
if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
sdata_info(sdata, "failed moving %pM to auth\n", bssid);
return false;
}
mutex_unlock(&sdata->local->sta_mtx);
return true;
}
static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgmt *mgmt, size_t len) struct ieee80211_mgmt *mgmt, size_t len)
{ {
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u16 auth_alg, auth_transaction, status_code; u16 auth_alg, auth_transaction, status_code;
struct sta_info *sta;
struct ieee80211_event event = { struct ieee80211_event event = {
.type = MLME_EVENT, .type = MLME_EVENT,
.u.mlme.data = AUTH_EVENT, .u.mlme.data = AUTH_EVENT,
...@@ -2791,7 +2818,11 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2791,7 +2818,11 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
status_code = le16_to_cpu(mgmt->u.auth.status_code); status_code = le16_to_cpu(mgmt->u.auth.status_code);
if (auth_alg != ifmgd->auth_data->algorithm || if (auth_alg != ifmgd->auth_data->algorithm ||
auth_transaction != ifmgd->auth_data->expected_transaction) { (auth_alg != WLAN_AUTH_SAE &&
auth_transaction != ifmgd->auth_data->expected_transaction) ||
(auth_alg == WLAN_AUTH_SAE &&
(auth_transaction < ifmgd->auth_data->expected_transaction ||
auth_transaction > 2))) {
sdata_info(sdata, "%pM unexpected authentication state: alg %d (expected %d) transact %d (expected %d)\n", sdata_info(sdata, "%pM unexpected authentication state: alg %d (expected %d) transact %d (expected %d)\n",
mgmt->sa, auth_alg, ifmgd->auth_data->algorithm, mgmt->sa, auth_alg, ifmgd->auth_data->algorithm,
auth_transaction, auth_transaction,
...@@ -2834,35 +2865,17 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2834,35 +2865,17 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
event.u.mlme.status = MLME_SUCCESS; event.u.mlme.status = MLME_SUCCESS;
drv_event_callback(sdata->local, sdata, &event); drv_event_callback(sdata->local, sdata, &event);
sdata_info(sdata, "authenticated\n"); if (ifmgd->auth_data->algorithm != WLAN_AUTH_SAE ||
ifmgd->auth_data->done = true; (auth_transaction == 2 &&
ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; ifmgd->auth_data->expected_transaction == 2)) {
ifmgd->auth_data->timeout_started = true; if (!ieee80211_mark_sta_auth(sdata, bssid))
run_again(sdata, ifmgd->auth_data->timeout); goto out_err;
} else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE &&
if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && auth_transaction == 2) {
ifmgd->auth_data->expected_transaction != 2) { sdata_info(sdata, "SAE peer confirmed\n");
/* ifmgd->auth_data->peer_confirmed = true;
* Report auth frame to user space for processing since another
* round of Authentication frames is still needed.
*/
cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return;
} }
/* move station state to auth */
mutex_lock(&sdata->local->sta_mtx);
sta = sta_info_get(sdata, bssid);
if (!sta) {
WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid);
goto out_err;
}
if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
sdata_info(sdata, "failed moving %pM to auth\n", bssid);
goto out_err;
}
mutex_unlock(&sdata->local->sta_mtx);
cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return; return;
out_err: out_err:
...@@ -4878,6 +4891,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -4878,6 +4891,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_auth_data *auth_data; struct ieee80211_mgd_auth_data *auth_data;
u16 auth_alg; u16 auth_alg;
int err; int err;
bool cont_auth;
/* prepare auth data structure */ /* prepare auth data structure */
...@@ -4912,6 +4926,9 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -4912,6 +4926,9 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (ifmgd->assoc_data)
return -EBUSY;
auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len + auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len +
req->ie_len, GFP_KERNEL); req->ie_len, GFP_KERNEL);
if (!auth_data) if (!auth_data)
...@@ -4931,6 +4948,13 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -4931,6 +4948,13 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
auth_data->data_len += req->auth_data_len - 4; auth_data->data_len += req->auth_data_len - 4;
} }
/* Check if continuing authentication or trying to authenticate with the
* same BSS that we were in the process of authenticating with and avoid
* removal and re-addition of the STA entry in
* ieee80211_prep_connection().
*/
cont_auth = ifmgd->auth_data && req->bss == ifmgd->auth_data->bss;
if (req->ie && req->ie_len) { if (req->ie && req->ie_len) {
memcpy(&auth_data->data[auth_data->data_len], memcpy(&auth_data->data[auth_data->data_len],
req->ie, req->ie_len); req->ie, req->ie_len);
...@@ -4947,18 +4971,26 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -4947,18 +4971,26 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
/* try to authenticate/probe */ /* try to authenticate/probe */
if ((ifmgd->auth_data && !ifmgd->auth_data->done) || if (ifmgd->auth_data) {
ifmgd->assoc_data) { if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE) {
err = -EBUSY; auth_data->peer_confirmed =
goto err_free; ifmgd->auth_data->peer_confirmed;
}
ieee80211_destroy_auth_data(sdata, cont_auth);
} }
if (ifmgd->auth_data)
ieee80211_destroy_auth_data(sdata, false);
/* prep auth_data so we don't go into idle on disassoc */ /* prep auth_data so we don't go into idle on disassoc */
ifmgd->auth_data = auth_data; ifmgd->auth_data = auth_data;
/* If this is continuation of an ongoing SAE authentication exchange
* (i.e., request to send SAE Confirm) and the peer has already
* confirmed, mark authentication completed since we are about to send
* out SAE Confirm.
*/
if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE &&
auth_data->peer_confirmed && auth_data->sae_trans == 2)
ieee80211_mark_sta_auth(sdata, req->bss->bssid);
if (ifmgd->associated) { if (ifmgd->associated) {
u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
...@@ -4976,7 +5008,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -4976,7 +5008,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid);
err = ieee80211_prep_connection(sdata, req->bss, false, false); err = ieee80211_prep_connection(sdata, req->bss, cont_auth, false);
if (err) if (err)
goto err_clear; goto err_clear;
...@@ -4997,7 +5029,6 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -4997,7 +5029,6 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
mutex_lock(&sdata->local->mtx); mutex_lock(&sdata->local->mtx);
ieee80211_vif_release_channel(sdata); ieee80211_vif_release_channel(sdata);
mutex_unlock(&sdata->local->mtx); mutex_unlock(&sdata->local->mtx);
err_free:
kfree(auth_data); kfree(auth_data);
return err; return err;
} }
......
...@@ -95,18 +95,5 @@ static inline void rc80211_minstrel_exit(void) ...@@ -95,18 +95,5 @@ static inline void rc80211_minstrel_exit(void)
} }
#endif #endif
#ifdef CONFIG_MAC80211_RC_MINSTREL_HT
int rc80211_minstrel_ht_init(void);
void rc80211_minstrel_ht_exit(void);
#else
static inline int rc80211_minstrel_ht_init(void)
{
return 0;
}
static inline void rc80211_minstrel_ht_exit(void)
{
}
#endif
#endif /* IEEE80211_RATE_H */ #endif /* IEEE80211_RATE_H */
...@@ -167,12 +167,6 @@ minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs) ...@@ -167,12 +167,6 @@ minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs)
if (unlikely(!mrs->att_hist)) { if (unlikely(!mrs->att_hist)) {
mrs->prob_ewma = cur_prob; mrs->prob_ewma = cur_prob;
} else { } else {
/* update exponential weighted moving variance */
mrs->prob_ewmv = minstrel_ewmv(mrs->prob_ewmv,
cur_prob,
mrs->prob_ewma,
EWMA_LEVEL);
/*update exponential weighted moving avarage */ /*update exponential weighted moving avarage */
mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma, mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma,
cur_prob, cur_prob,
...@@ -572,141 +566,6 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, ...@@ -572,141 +566,6 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
minstrel_update_rates(mp, mi); minstrel_update_rates(mp, mi);
} }
static void *
minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
{
struct ieee80211_supported_band *sband;
struct minstrel_sta_info *mi;
struct minstrel_priv *mp = priv;
struct ieee80211_hw *hw = mp->hw;
int max_rates = 0;
int i;
mi = kzalloc(sizeof(struct minstrel_sta_info), gfp);
if (!mi)
return NULL;
for (i = 0; i < NUM_NL80211_BANDS; i++) {
sband = hw->wiphy->bands[i];
if (sband && sband->n_bitrates > max_rates)
max_rates = sband->n_bitrates;
}
mi->r = kcalloc(max_rates, sizeof(struct minstrel_rate), gfp);
if (!mi->r)
goto error;
mi->sample_table = kmalloc_array(max_rates, SAMPLE_COLUMNS, gfp);
if (!mi->sample_table)
goto error1;
mi->last_stats_update = jiffies;
return mi;
error1:
kfree(mi->r);
error:
kfree(mi);
return NULL;
}
static void
minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta)
{
struct minstrel_sta_info *mi = priv_sta;
kfree(mi->sample_table);
kfree(mi->r);
kfree(mi);
}
static void
minstrel_init_cck_rates(struct minstrel_priv *mp)
{
static const int bitrates[4] = { 10, 20, 55, 110 };
struct ieee80211_supported_band *sband;
u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef);
int i, j;
sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ];
if (!sband)
return;
for (i = 0, j = 0; i < sband->n_bitrates; i++) {
struct ieee80211_rate *rate = &sband->bitrates[i];
if (rate->flags & IEEE80211_RATE_ERP_G)
continue;
if ((rate_flags & sband->bitrates[i].flags) != rate_flags)
continue;
for (j = 0; j < ARRAY_SIZE(bitrates); j++) {
if (rate->bitrate != bitrates[j])
continue;
mp->cck_rates[j] = i;
break;
}
}
}
static void *
minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
{
struct minstrel_priv *mp;
mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC);
if (!mp)
return NULL;
/* contention window settings
* Just an approximation. Using the per-queue values would complicate
* the calculations and is probably unnecessary */
mp->cw_min = 15;
mp->cw_max = 1023;
/* number of packets (in %) to use for sampling other rates
* sample less often for non-mrr packets, because the overhead
* is much higher than with mrr */
mp->lookaround_rate = 5;
mp->lookaround_rate_mrr = 10;
/* maximum time that the hw is allowed to stay in one MRR segment */
mp->segment_size = 6000;
if (hw->max_rate_tries > 0)
mp->max_retry = hw->max_rate_tries;
else
/* safe default, does not necessarily have to match hw properties */
mp->max_retry = 7;
if (hw->max_rates >= 4)
mp->has_mrr = true;
mp->hw = hw;
mp->update_interval = 100;
#ifdef CONFIG_MAC80211_DEBUGFS
mp->fixed_rate_idx = (u32) -1;
mp->dbg_fixed_rate = debugfs_create_u32("fixed_rate_idx",
0666, debugfsdir, &mp->fixed_rate_idx);
#endif
minstrel_init_cck_rates(mp);
return mp;
}
static void
minstrel_free(void *priv)
{
#ifdef CONFIG_MAC80211_DEBUGFS
debugfs_remove(((struct minstrel_priv *)priv)->dbg_fixed_rate);
#endif
kfree(priv);
}
static u32 minstrel_get_expected_throughput(void *priv_sta) static u32 minstrel_get_expected_throughput(void *priv_sta)
{ {
struct minstrel_sta_info *mi = priv_sta; struct minstrel_sta_info *mi = priv_sta;
...@@ -725,29 +584,8 @@ static u32 minstrel_get_expected_throughput(void *priv_sta) ...@@ -725,29 +584,8 @@ static u32 minstrel_get_expected_throughput(void *priv_sta)
} }
const struct rate_control_ops mac80211_minstrel = { const struct rate_control_ops mac80211_minstrel = {
.name = "minstrel",
.tx_status_ext = minstrel_tx_status, .tx_status_ext = minstrel_tx_status,
.get_rate = minstrel_get_rate, .get_rate = minstrel_get_rate,
.rate_init = minstrel_rate_init, .rate_init = minstrel_rate_init,
.alloc = minstrel_alloc,
.free = minstrel_free,
.alloc_sta = minstrel_alloc_sta,
.free_sta = minstrel_free_sta,
#ifdef CONFIG_MAC80211_DEBUGFS
.add_sta_debugfs = minstrel_add_sta_debugfs,
.remove_sta_debugfs = minstrel_remove_sta_debugfs,
#endif
.get_expected_throughput = minstrel_get_expected_throughput, .get_expected_throughput = minstrel_get_expected_throughput,
}; };
int __init
rc80211_minstrel_init(void)
{
return ieee80211_rate_control_register(&mac80211_minstrel);
}
void
rc80211_minstrel_exit(void)
{
ieee80211_rate_control_unregister(&mac80211_minstrel);
}
...@@ -35,19 +35,6 @@ minstrel_ewma(int old, int new, int weight) ...@@ -35,19 +35,6 @@ minstrel_ewma(int old, int new, int weight)
return old + incr; return old + incr;
} }
/*
* Perform EWMV (Exponentially Weighted Moving Variance) calculation
*/
static inline int
minstrel_ewmv(int old_ewmv, int cur_prob, int prob_ewma, int weight)
{
int diff, incr;
diff = cur_prob - prob_ewma;
incr = (EWMA_DIV - weight) * diff / EWMA_DIV;
return weight * (old_ewmv + MINSTREL_TRUNC(diff * incr)) / EWMA_DIV;
}
struct minstrel_rate_stats { struct minstrel_rate_stats {
/* current / last sampling period attempts/success counters */ /* current / last sampling period attempts/success counters */
u16 attempts, last_attempts; u16 attempts, last_attempts;
...@@ -56,11 +43,8 @@ struct minstrel_rate_stats { ...@@ -56,11 +43,8 @@ struct minstrel_rate_stats {
/* total attempts/success counters */ /* total attempts/success counters */
u32 att_hist, succ_hist; u32 att_hist, succ_hist;
/* statistis of packet delivery probability /* prob_ewma - exponential weighted moving average of prob */
* prob_ewma - exponential weighted moving average of prob
* prob_ewmsd - exp. weighted moving standard deviation of prob */
u16 prob_ewma; u16 prob_ewma;
u16 prob_ewmv;
/* maximum retry counts */ /* maximum retry counts */
u8 retry_count; u8 retry_count;
...@@ -109,11 +93,6 @@ struct minstrel_sta_info { ...@@ -109,11 +93,6 @@ struct minstrel_sta_info {
/* sampling table */ /* sampling table */
u8 *sample_table; u8 *sample_table;
#ifdef CONFIG_MAC80211_DEBUGFS
struct dentry *dbg_stats;
struct dentry *dbg_stats_csv;
#endif
}; };
struct minstrel_priv { struct minstrel_priv {
...@@ -137,7 +116,6 @@ struct minstrel_priv { ...@@ -137,7 +116,6 @@ struct minstrel_priv {
* - setting will be applied on next update * - setting will be applied on next update
*/ */
u32 fixed_rate_idx; u32 fixed_rate_idx;
struct dentry *dbg_fixed_rate;
#endif #endif
}; };
...@@ -146,17 +124,8 @@ struct minstrel_debugfs_info { ...@@ -146,17 +124,8 @@ struct minstrel_debugfs_info {
char buf[]; char buf[];
}; };
/* Get EWMSD (Exponentially Weighted Moving Standard Deviation) * 10 */
static inline int
minstrel_get_ewmsd10(struct minstrel_rate_stats *mrs)
{
unsigned int ewmv = mrs->prob_ewmv;
return int_sqrt(MINSTREL_TRUNC(ewmv * 1000 * 1000));
}
extern const struct rate_control_ops mac80211_minstrel; extern const struct rate_control_ops mac80211_minstrel;
void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
/* Recalculate success probabilities and counters for a given rate using EWMA */ /* Recalculate success probabilities and counters for a given rate using EWMA */
void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs); void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs);
...@@ -165,7 +134,5 @@ int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma); ...@@ -165,7 +134,5 @@ int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma);
/* debugfs */ /* debugfs */
int minstrel_stats_open(struct inode *inode, struct file *file); int minstrel_stats_open(struct inode *inode, struct file *file);
int minstrel_stats_csv_open(struct inode *inode, struct file *file); int minstrel_stats_csv_open(struct inode *inode, struct file *file);
ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos);
int minstrel_stats_release(struct inode *inode, struct file *file);
#endif #endif
...@@ -54,22 +54,6 @@ ...@@ -54,22 +54,6 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include "rc80211_minstrel.h" #include "rc80211_minstrel.h"
ssize_t
minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos)
{
struct minstrel_debugfs_info *ms;
ms = file->private_data;
return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len);
}
int
minstrel_stats_release(struct inode *inode, struct file *file)
{
kfree(file->private_data);
return 0;
}
int int
minstrel_stats_open(struct inode *inode, struct file *file) minstrel_stats_open(struct inode *inode, struct file *file)
{ {
...@@ -86,14 +70,13 @@ minstrel_stats_open(struct inode *inode, struct file *file) ...@@ -86,14 +70,13 @@ minstrel_stats_open(struct inode *inode, struct file *file)
p = ms->buf; p = ms->buf;
p += sprintf(p, "\n"); p += sprintf(p, "\n");
p += sprintf(p, p += sprintf(p,
"best __________rate_________ ________statistics________ ____last_____ ______sum-of________\n"); "best __________rate_________ ____statistics___ ____last_____ ______sum-of________\n");
p += sprintf(p, p += sprintf(p,
"rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n"); "rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n");
for (i = 0; i < mi->n_rates; i++) { for (i = 0; i < mi->n_rates; i++) {
struct minstrel_rate *mr = &mi->r[i]; struct minstrel_rate *mr = &mi->r[i];
struct minstrel_rate_stats *mrs = &mi->r[i].stats; struct minstrel_rate_stats *mrs = &mi->r[i].stats;
unsigned int prob_ewmsd;
*(p++) = (i == mi->max_tp_rate[0]) ? 'A' : ' '; *(p++) = (i == mi->max_tp_rate[0]) ? 'A' : ' ';
*(p++) = (i == mi->max_tp_rate[1]) ? 'B' : ' '; *(p++) = (i == mi->max_tp_rate[1]) ? 'B' : ' ';
...@@ -109,15 +92,13 @@ minstrel_stats_open(struct inode *inode, struct file *file) ...@@ -109,15 +92,13 @@ minstrel_stats_open(struct inode *inode, struct file *file)
tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
prob_ewmsd = minstrel_get_ewmsd10(mrs);
p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u"
" %3u %3u %-3u " " %3u %3u %-3u "
"%9llu %-9llu\n", "%9llu %-9llu\n",
tp_max / 10, tp_max % 10, tp_max / 10, tp_max % 10,
tp_avg / 10, tp_avg % 10, tp_avg / 10, tp_avg % 10,
eprob / 10, eprob % 10, eprob / 10, eprob % 10,
prob_ewmsd / 10, prob_ewmsd % 10,
mrs->retry_count, mrs->retry_count,
mrs->last_success, mrs->last_success,
mrs->last_attempts, mrs->last_attempts,
...@@ -135,14 +116,6 @@ minstrel_stats_open(struct inode *inode, struct file *file) ...@@ -135,14 +116,6 @@ minstrel_stats_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
static const struct file_operations minstrel_stat_fops = {
.owner = THIS_MODULE,
.open = minstrel_stats_open,
.read = minstrel_stats_read,
.release = minstrel_stats_release,
.llseek = default_llseek,
};
int int
minstrel_stats_csv_open(struct inode *inode, struct file *file) minstrel_stats_csv_open(struct inode *inode, struct file *file)
{ {
...@@ -161,7 +134,6 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file) ...@@ -161,7 +134,6 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file)
for (i = 0; i < mi->n_rates; i++) { for (i = 0; i < mi->n_rates; i++) {
struct minstrel_rate *mr = &mi->r[i]; struct minstrel_rate *mr = &mi->r[i];
struct minstrel_rate_stats *mrs = &mi->r[i].stats; struct minstrel_rate_stats *mrs = &mi->r[i].stats;
unsigned int prob_ewmsd;
p += sprintf(p, "%s" ,((i == mi->max_tp_rate[0]) ? "A" : "")); p += sprintf(p, "%s" ,((i == mi->max_tp_rate[0]) ? "A" : ""));
p += sprintf(p, "%s" ,((i == mi->max_tp_rate[1]) ? "B" : "")); p += sprintf(p, "%s" ,((i == mi->max_tp_rate[1]) ? "B" : ""));
...@@ -177,14 +149,12 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file) ...@@ -177,14 +149,12 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file)
tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100));
tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma);
eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
prob_ewmsd = minstrel_get_ewmsd10(mrs);
p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u," p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u,%u,%u,"
"%llu,%llu,%d,%d\n", "%llu,%llu,%d,%d\n",
tp_max / 10, tp_max % 10, tp_max / 10, tp_max % 10,
tp_avg / 10, tp_avg % 10, tp_avg / 10, tp_avg % 10,
eprob / 10, eprob % 10, eprob / 10, eprob % 10,
prob_ewmsd / 10, prob_ewmsd % 10,
mrs->retry_count, mrs->retry_count,
mrs->last_success, mrs->last_success,
mrs->last_attempts, mrs->last_attempts,
...@@ -200,33 +170,3 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file) ...@@ -200,33 +170,3 @@ minstrel_stats_csv_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
static const struct file_operations minstrel_stat_csv_fops = {
.owner = THIS_MODULE,
.open = minstrel_stats_csv_open,
.read = minstrel_stats_read,
.release = minstrel_stats_release,
.llseek = default_llseek,
};
void
minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir)
{
struct minstrel_sta_info *mi = priv_sta;
mi->dbg_stats = debugfs_create_file("rc_stats", 0444, dir, mi,
&minstrel_stat_fops);
mi->dbg_stats_csv = debugfs_create_file("rc_stats_csv", 0444, dir, mi,
&minstrel_stat_csv_fops);
}
void
minstrel_remove_sta_debugfs(void *priv, void *priv_sta)
{
struct minstrel_sta_info *mi = priv_sta;
debugfs_remove(mi->dbg_stats);
debugfs_remove(mi->dbg_stats_csv);
}
This diff is collapsed.
...@@ -15,11 +15,7 @@ ...@@ -15,11 +15,7 @@
*/ */
#define MINSTREL_MAX_STREAMS 3 #define MINSTREL_MAX_STREAMS 3
#define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */
#ifdef CONFIG_MAC80211_RC_MINSTREL_VHT
#define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */ #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */
#else
#define MINSTREL_VHT_STREAM_GROUPS 0
#endif
#define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \
MINSTREL_HT_STREAM_GROUPS) MINSTREL_HT_STREAM_GROUPS)
...@@ -34,16 +30,13 @@ ...@@ -34,16 +30,13 @@
#define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB)
#define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1) #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1)
#ifdef CONFIG_MAC80211_RC_MINSTREL_VHT
#define MCS_GROUP_RATES 10 #define MCS_GROUP_RATES 10
#else
#define MCS_GROUP_RATES 8
#endif
struct mcs_group { struct mcs_group {
u32 flags; u16 flags;
unsigned int streams; u8 streams;
unsigned int duration[MCS_GROUP_RATES]; u8 shift;
u16 duration[MCS_GROUP_RATES];
}; };
extern const struct mcs_group minstrel_mcs_groups[]; extern const struct mcs_group minstrel_mcs_groups[];
...@@ -110,17 +103,12 @@ struct minstrel_ht_sta_priv { ...@@ -110,17 +103,12 @@ struct minstrel_ht_sta_priv {
struct minstrel_ht_sta ht; struct minstrel_ht_sta ht;
struct minstrel_sta_info legacy; struct minstrel_sta_info legacy;
}; };
#ifdef CONFIG_MAC80211_DEBUGFS
struct dentry *dbg_stats;
struct dentry *dbg_stats_csv;
#endif
void *ratelist; void *ratelist;
void *sample_table; void *sample_table;
bool is_ht; bool is_ht;
}; };
void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta);
int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate,
int prob_ewma); int prob_ewma);
......
...@@ -15,6 +15,22 @@ ...@@ -15,6 +15,22 @@
#include "rc80211_minstrel.h" #include "rc80211_minstrel.h"
#include "rc80211_minstrel_ht.h" #include "rc80211_minstrel_ht.h"
static ssize_t
minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos)
{
struct minstrel_debugfs_info *ms;
ms = file->private_data;
return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len);
}
static int
minstrel_stats_release(struct inode *inode, struct file *file)
{
kfree(file->private_data);
return 0;
}
static char * static char *
minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
{ {
...@@ -41,7 +57,7 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) ...@@ -41,7 +57,7 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j];
static const int bitrates[4] = { 10, 20, 55, 110 }; static const int bitrates[4] = { 10, 20, 55, 110 };
int idx = i * MCS_GROUP_RATES + j; int idx = i * MCS_GROUP_RATES + j;
unsigned int prob_ewmsd; unsigned int duration;
if (!(mi->supported[i] & BIT(j))) if (!(mi->supported[i] & BIT(j)))
continue; continue;
...@@ -79,21 +95,21 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) ...@@ -79,21 +95,21 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
p += sprintf(p, " %3u ", idx); p += sprintf(p, " %3u ", idx);
/* tx_time[rate(i)] in usec */ /* tx_time[rate(i)] in usec */
tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); duration = mg->duration[j];
duration <<= mg->shift;
tx_time = DIV_ROUND_CLOSEST(duration, 1000);
p += sprintf(p, "%6u ", tx_time); p += sprintf(p, "%6u ", tx_time);
tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
prob_ewmsd = minstrel_get_ewmsd10(mrs);
p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u"
" %3u %3u %-3u " " %3u %3u %-3u "
"%9llu %-9llu\n", "%9llu %-9llu\n",
tp_max / 10, tp_max % 10, tp_max / 10, tp_max % 10,
tp_avg / 10, tp_avg % 10, tp_avg / 10, tp_avg % 10,
eprob / 10, eprob % 10, eprob / 10, eprob % 10,
prob_ewmsd / 10, prob_ewmsd % 10,
mrs->retry_count, mrs->retry_count,
mrs->last_success, mrs->last_success,
mrs->last_attempts, mrs->last_attempts,
...@@ -130,9 +146,9 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) ...@@ -130,9 +146,9 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file)
p += sprintf(p, "\n"); p += sprintf(p, "\n");
p += sprintf(p, p += sprintf(p,
" best ____________rate__________ ________statistics________ _____last____ ______sum-of________\n"); " best ____________rate__________ ____statistics___ _____last____ ______sum-of________\n");
p += sprintf(p, p += sprintf(p,
"mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [retry|suc|att] [#success | #attempts]\n"); "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n");
p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p); p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p);
for (i = 0; i < MINSTREL_CCK_GROUP; i++) for (i = 0; i < MINSTREL_CCK_GROUP; i++)
...@@ -187,7 +203,7 @@ minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p) ...@@ -187,7 +203,7 @@ minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p)
struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j];
static const int bitrates[4] = { 10, 20, 55, 110 }; static const int bitrates[4] = { 10, 20, 55, 110 };
int idx = i * MCS_GROUP_RATES + j; int idx = i * MCS_GROUP_RATES + j;
unsigned int prob_ewmsd; unsigned int duration;
if (!(mi->supported[i] & BIT(j))) if (!(mi->supported[i] & BIT(j)))
continue; continue;
...@@ -222,20 +238,21 @@ minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p) ...@@ -222,20 +238,21 @@ minstrel_ht_stats_csv_dump(struct minstrel_ht_sta *mi, int i, char *p)
} }
p += sprintf(p, "%u,", idx); p += sprintf(p, "%u,", idx);
tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000);
duration = mg->duration[j];
duration <<= mg->shift;
tx_time = DIV_ROUND_CLOSEST(duration, 1000);
p += sprintf(p, "%u,", tx_time); p += sprintf(p, "%u,", tx_time);
tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100));
tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma);
eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000);
prob_ewmsd = minstrel_get_ewmsd10(mrs);
p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u," p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u,%u,"
"%u,%llu,%llu,", "%u,%llu,%llu,",
tp_max / 10, tp_max % 10, tp_max / 10, tp_max % 10,
tp_avg / 10, tp_avg % 10, tp_avg / 10, tp_avg % 10,
eprob / 10, eprob % 10, eprob / 10, eprob % 10,
prob_ewmsd / 10, prob_ewmsd % 10,
mrs->retry_count, mrs->retry_count,
mrs->last_success, mrs->last_success,
mrs->last_attempts, mrs->last_attempts,
...@@ -303,17 +320,8 @@ minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) ...@@ -303,17 +320,8 @@ minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir)
{ {
struct minstrel_ht_sta_priv *msp = priv_sta; struct minstrel_ht_sta_priv *msp = priv_sta;
msp->dbg_stats = debugfs_create_file("rc_stats", 0444, dir, msp, debugfs_create_file("rc_stats", 0444, dir, msp,
&minstrel_ht_stat_fops); &minstrel_ht_stat_fops);
msp->dbg_stats_csv = debugfs_create_file("rc_stats_csv", 0444, dir, msp, debugfs_create_file("rc_stats_csv", 0444, dir, msp,
&minstrel_ht_stat_csv_fops); &minstrel_ht_stat_csv_fops);
}
void
minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta)
{
struct minstrel_ht_sta_priv *msp = priv_sta;
debugfs_remove(msp->dbg_stats);
debugfs_remove(msp->dbg_stats_csv);
} }
...@@ -2458,8 +2458,9 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) ...@@ -2458,8 +2458,9 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
if (!xmit_skb) if (!xmit_skb)
net_info_ratelimited("%s: failed to clone multicast frame\n", net_info_ratelimited("%s: failed to clone multicast frame\n",
dev->name); dev->name);
} else if (!is_multicast_ether_addr(ehdr->h_dest)) { } else if (!is_multicast_ether_addr(ehdr->h_dest) &&
dsta = sta_info_get(sdata, skb->data); !ether_addr_equal(ehdr->h_dest, ehdr->h_source)) {
dsta = sta_info_get(sdata, ehdr->h_dest);
if (dsta) { if (dsta) {
/* /*
* The destination station is associated to * The destination station is associated to
...@@ -4240,11 +4241,10 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, ...@@ -4240,11 +4241,10 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
if (fast_rx->internal_forward) { if (fast_rx->internal_forward) {
struct sk_buff *xmit_skb = NULL; struct sk_buff *xmit_skb = NULL;
bool multicast = is_multicast_ether_addr(skb->data); if (is_multicast_ether_addr(addrs.da)) {
if (multicast) {
xmit_skb = skb_copy(skb, GFP_ATOMIC); xmit_skb = skb_copy(skb, GFP_ATOMIC);
} else if (sta_info_get(rx->sdata, skb->data)) { } else if (!ether_addr_equal(addrs.da, addrs.sa) &&
sta_info_get(rx->sdata, addrs.da)) {
xmit_skb = skb; xmit_skb = skb;
skb = NULL; skb = NULL;
} }
......
...@@ -987,6 +987,25 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, ...@@ -987,6 +987,25 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
} }
EXPORT_SYMBOL(ieee80211_tx_status_ext); EXPORT_SYMBOL(ieee80211_tx_status_ext);
void ieee80211_tx_rate_update(struct ieee80211_hw *hw,
struct ieee80211_sta *pubsta,
struct ieee80211_tx_info *info)
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_supported_band *sband = hw->wiphy->bands[info->band];
struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
struct ieee80211_tx_status status = {
.info = info,
.sta = pubsta,
};
rate_control_tx_status(local, sband, &status);
if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL))
sta->tx_stats.last_rate = info->status.rates[0];
}
EXPORT_SYMBOL(ieee80211_tx_rate_update);
void ieee80211_report_low_ack(struct ieee80211_sta *pubsta, u32 num_packets) void ieee80211_report_low_ack(struct ieee80211_sta *pubsta, u32 num_packets)
{ {
struct sta_info *sta = container_of(pubsta, struct sta_info, sta); struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
......
...@@ -2600,6 +2600,29 @@ TRACE_EVENT(drv_wake_tx_queue, ...@@ -2600,6 +2600,29 @@ TRACE_EVENT(drv_wake_tx_queue,
) )
); );
TRACE_EVENT(drv_get_ftm_responder_stats,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct cfg80211_ftm_responder_stats *ftm_stats),
TP_ARGS(local, sdata, ftm_stats),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
),
TP_printk(
LOCAL_PR_FMT VIF_PR_FMT,
LOCAL_PR_ARG, VIF_PR_ARG
)
);
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_PATH
......
...@@ -264,6 +264,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) ...@@ -264,6 +264,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
struct ieee80211_txq *txq = sta->sta.txq[i]; struct ieee80211_txq *txq = sta->sta.txq[i];
if (!txq)
continue;
txqi = to_txq_info(txq); txqi = to_txq_info(txq);
if (ac != txq->ac) if (ac != txq->ac)
...@@ -2175,6 +2178,11 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2175,6 +2178,11 @@ int ieee80211_reconfig(struct ieee80211_local *local)
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
changed |= BSS_CHANGED_SSID | BSS_CHANGED_P2P_PS; changed |= BSS_CHANGED_SSID | BSS_CHANGED_P2P_PS;
if (sdata->vif.bss_conf.ftm_responder == 1 &&
wiphy_ext_feature_isset(sdata->local->hw.wiphy,
NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER))
changed |= BSS_CHANGED_FTM_RESPONDER;
if (sdata->vif.type == NL80211_IFTYPE_AP) { if (sdata->vif.type == NL80211_IFTYPE_AP) {
changed |= BSS_CHANGED_AP_PROBE_RESP; changed |= BSS_CHANGED_AP_PROBE_RESP;
......
...@@ -1019,36 +1019,49 @@ void cfg80211_cqm_config_free(struct wireless_dev *wdev) ...@@ -1019,36 +1019,49 @@ void cfg80211_cqm_config_free(struct wireless_dev *wdev)
wdev->cqm_config = NULL; wdev->cqm_config = NULL;
} }
void cfg80211_unregister_wdev(struct wireless_dev *wdev) static void __cfg80211_unregister_wdev(struct wireless_dev *wdev, bool sync)
{ {
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
ASSERT_RTNL(); ASSERT_RTNL();
if (WARN_ON(wdev->netdev))
return;
nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE); nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE);
list_del_rcu(&wdev->list); list_del_rcu(&wdev->list);
synchronize_rcu(); if (sync)
synchronize_rcu();
rdev->devlist_generation++; rdev->devlist_generation++;
cfg80211_mlme_purge_registrations(wdev);
switch (wdev->iftype) { switch (wdev->iftype) {
case NL80211_IFTYPE_P2P_DEVICE: case NL80211_IFTYPE_P2P_DEVICE:
cfg80211_mlme_purge_registrations(wdev);
cfg80211_stop_p2p_device(rdev, wdev); cfg80211_stop_p2p_device(rdev, wdev);
break; break;
case NL80211_IFTYPE_NAN: case NL80211_IFTYPE_NAN:
cfg80211_stop_nan(rdev, wdev); cfg80211_stop_nan(rdev, wdev);
break; break;
default: default:
WARN_ON_ONCE(1);
break; break;
} }
#ifdef CONFIG_CFG80211_WEXT
kzfree(wdev->wext.keys);
#endif
/* only initialized if we have a netdev */
if (wdev->netdev)
flush_work(&wdev->disconnect_wk);
cfg80211_cqm_config_free(wdev); cfg80211_cqm_config_free(wdev);
} }
void cfg80211_unregister_wdev(struct wireless_dev *wdev)
{
if (WARN_ON(wdev->netdev))
return;
__cfg80211_unregister_wdev(wdev, true);
}
EXPORT_SYMBOL(cfg80211_unregister_wdev); EXPORT_SYMBOL(cfg80211_unregister_wdev);
static const struct device_type wiphy_type = { static const struct device_type wiphy_type = {
...@@ -1153,6 +1166,30 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -1153,6 +1166,30 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
} }
EXPORT_SYMBOL(cfg80211_stop_iface); EXPORT_SYMBOL(cfg80211_stop_iface);
void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev)
{
mutex_init(&wdev->mtx);
INIT_LIST_HEAD(&wdev->event_list);
spin_lock_init(&wdev->event_lock);
INIT_LIST_HEAD(&wdev->mgmt_registrations);
spin_lock_init(&wdev->mgmt_registrations_lock);
/*
* We get here also when the interface changes network namespaces,
* as it's registered into the new one, but we don't want it to
* change ID in that case. Checking if the ID is already assigned
* works, because 0 isn't considered a valid ID and the memory is
* 0-initialized.
*/
if (!wdev->identifier)
wdev->identifier = ++rdev->wdev_id;
list_add_rcu(&wdev->list, &rdev->wiphy.wdev_list);
rdev->devlist_generation++;
nl80211_notify_iface(rdev, wdev, NL80211_CMD_NEW_INTERFACE);
}
static int cfg80211_netdev_notifier_call(struct notifier_block *nb, static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
unsigned long state, void *ptr) unsigned long state, void *ptr)
{ {
...@@ -1178,23 +1215,6 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, ...@@ -1178,23 +1215,6 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
* called within code protected by it when interfaces * called within code protected by it when interfaces
* are added with nl80211. * are added with nl80211.
*/ */
mutex_init(&wdev->mtx);
INIT_LIST_HEAD(&wdev->event_list);
spin_lock_init(&wdev->event_lock);
INIT_LIST_HEAD(&wdev->mgmt_registrations);
spin_lock_init(&wdev->mgmt_registrations_lock);
/*
* We get here also when the interface changes network namespaces,
* as it's registered into the new one, but we don't want it to
* change ID in that case. Checking if the ID is already assigned
* works, because 0 isn't considered a valid ID and the memory is
* 0-initialized.
*/
if (!wdev->identifier)
wdev->identifier = ++rdev->wdev_id;
list_add_rcu(&wdev->list, &rdev->wiphy.wdev_list);
rdev->devlist_generation++;
/* can only change netns with wiphy */ /* can only change netns with wiphy */
dev->features |= NETIF_F_NETNS_LOCAL; dev->features |= NETIF_F_NETNS_LOCAL;
...@@ -1223,7 +1243,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, ...@@ -1223,7 +1243,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk); INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
nl80211_notify_iface(rdev, wdev, NL80211_CMD_NEW_INTERFACE); cfg80211_init_wdev(rdev, wdev);
break; break;
case NETDEV_GOING_DOWN: case NETDEV_GOING_DOWN:
cfg80211_leave(rdev, wdev); cfg80211_leave(rdev, wdev);
...@@ -1238,7 +1258,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, ...@@ -1238,7 +1258,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
list_for_each_entry_safe(pos, tmp, list_for_each_entry_safe(pos, tmp,
&rdev->sched_scan_req_list, list) { &rdev->sched_scan_req_list, list) {
if (WARN_ON(pos && pos->dev == wdev->netdev)) if (WARN_ON(pos->dev == wdev->netdev))
cfg80211_stop_sched_scan_req(rdev, pos, false); cfg80211_stop_sched_scan_req(rdev, pos, false);
} }
...@@ -1302,17 +1322,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, ...@@ -1302,17 +1322,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
* remove and clean it up. * remove and clean it up.
*/ */
if (!list_empty(&wdev->list)) { if (!list_empty(&wdev->list)) {
nl80211_notify_iface(rdev, wdev, __cfg80211_unregister_wdev(wdev, false);
NL80211_CMD_DEL_INTERFACE);
sysfs_remove_link(&dev->dev.kobj, "phy80211"); sysfs_remove_link(&dev->dev.kobj, "phy80211");
list_del_rcu(&wdev->list);
rdev->devlist_generation++;
cfg80211_mlme_purge_registrations(wdev);
#ifdef CONFIG_CFG80211_WEXT
kzfree(wdev->wext.keys);
#endif
flush_work(&wdev->disconnect_wk);
cfg80211_cqm_config_free(wdev);
} }
/* /*
* synchronise (so that we won't find this netdev * synchronise (so that we won't find this netdev
......
...@@ -66,6 +66,7 @@ struct cfg80211_registered_device { ...@@ -66,6 +66,7 @@ struct cfg80211_registered_device {
/* protected by RTNL only */ /* protected by RTNL only */
int num_running_ifaces; int num_running_ifaces;
int num_running_monitor_ifaces; int num_running_monitor_ifaces;
u64 cookie_counter;
/* BSSes/scanning */ /* BSSes/scanning */
spinlock_t bss_lock; spinlock_t bss_lock;
...@@ -133,6 +134,16 @@ cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev) ...@@ -133,6 +134,16 @@ cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev)
#endif #endif
} }
static inline u64 cfg80211_assign_cookie(struct cfg80211_registered_device *rdev)
{
u64 r = ++rdev->cookie_counter;
if (WARN_ON(r == 0))
r = ++rdev->cookie_counter;
return r;
}
extern struct workqueue_struct *cfg80211_wq; extern struct workqueue_struct *cfg80211_wq;
extern struct list_head cfg80211_rdev_list; extern struct list_head cfg80211_rdev_list;
extern int cfg80211_rdev_list_generation; extern int cfg80211_rdev_list_generation;
...@@ -187,6 +198,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); ...@@ -187,6 +198,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);
int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
struct net *net); struct net *net);
void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev);
static inline void wdev_lock(struct wireless_dev *wdev) static inline void wdev_lock(struct wireless_dev *wdev)
__acquires(wdev) __acquires(wdev)
{ {
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <crypto/hash.h> #include <crypto/hash.h>
#include <crypto/skcipher.h> #include <linux/crypto.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <net/lib80211.h> #include <net/lib80211.h>
...@@ -64,9 +64,9 @@ struct lib80211_tkip_data { ...@@ -64,9 +64,9 @@ struct lib80211_tkip_data {
int key_idx; int key_idx;
struct crypto_skcipher *rx_tfm_arc4; struct crypto_cipher *rx_tfm_arc4;
struct crypto_shash *rx_tfm_michael; struct crypto_shash *rx_tfm_michael;
struct crypto_skcipher *tx_tfm_arc4; struct crypto_cipher *tx_tfm_arc4;
struct crypto_shash *tx_tfm_michael; struct crypto_shash *tx_tfm_michael;
/* scratch buffers for virt_to_page() (crypto API) */ /* scratch buffers for virt_to_page() (crypto API) */
...@@ -99,8 +99,7 @@ static void *lib80211_tkip_init(int key_idx) ...@@ -99,8 +99,7 @@ static void *lib80211_tkip_init(int key_idx)
priv->key_idx = key_idx; priv->key_idx = key_idx;
priv->tx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0, priv->tx_tfm_arc4 = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC);
CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm_arc4)) { if (IS_ERR(priv->tx_tfm_arc4)) {
priv->tx_tfm_arc4 = NULL; priv->tx_tfm_arc4 = NULL;
goto fail; goto fail;
...@@ -112,8 +111,7 @@ static void *lib80211_tkip_init(int key_idx) ...@@ -112,8 +111,7 @@ static void *lib80211_tkip_init(int key_idx)
goto fail; goto fail;
} }
priv->rx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0, priv->rx_tfm_arc4 = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC);
CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->rx_tfm_arc4)) { if (IS_ERR(priv->rx_tfm_arc4)) {
priv->rx_tfm_arc4 = NULL; priv->rx_tfm_arc4 = NULL;
goto fail; goto fail;
...@@ -130,9 +128,9 @@ static void *lib80211_tkip_init(int key_idx) ...@@ -130,9 +128,9 @@ static void *lib80211_tkip_init(int key_idx)
fail: fail:
if (priv) { if (priv) {
crypto_free_shash(priv->tx_tfm_michael); crypto_free_shash(priv->tx_tfm_michael);
crypto_free_skcipher(priv->tx_tfm_arc4); crypto_free_cipher(priv->tx_tfm_arc4);
crypto_free_shash(priv->rx_tfm_michael); crypto_free_shash(priv->rx_tfm_michael);
crypto_free_skcipher(priv->rx_tfm_arc4); crypto_free_cipher(priv->rx_tfm_arc4);
kfree(priv); kfree(priv);
} }
...@@ -144,9 +142,9 @@ static void lib80211_tkip_deinit(void *priv) ...@@ -144,9 +142,9 @@ static void lib80211_tkip_deinit(void *priv)
struct lib80211_tkip_data *_priv = priv; struct lib80211_tkip_data *_priv = priv;
if (_priv) { if (_priv) {
crypto_free_shash(_priv->tx_tfm_michael); crypto_free_shash(_priv->tx_tfm_michael);
crypto_free_skcipher(_priv->tx_tfm_arc4); crypto_free_cipher(_priv->tx_tfm_arc4);
crypto_free_shash(_priv->rx_tfm_michael); crypto_free_shash(_priv->rx_tfm_michael);
crypto_free_skcipher(_priv->rx_tfm_arc4); crypto_free_cipher(_priv->rx_tfm_arc4);
} }
kfree(priv); kfree(priv);
} }
...@@ -344,12 +342,10 @@ static int lib80211_tkip_hdr(struct sk_buff *skb, int hdr_len, ...@@ -344,12 +342,10 @@ static int lib80211_tkip_hdr(struct sk_buff *skb, int hdr_len,
static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct lib80211_tkip_data *tkey = priv; struct lib80211_tkip_data *tkey = priv;
SKCIPHER_REQUEST_ON_STACK(req, tkey->tx_tfm_arc4);
int len; int len;
u8 rc4key[16], *pos, *icv; u8 rc4key[16], *pos, *icv;
u32 crc; u32 crc;
struct scatterlist sg; int i;
int err;
if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
...@@ -374,14 +370,10 @@ static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -374,14 +370,10 @@ static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
icv[2] = crc >> 16; icv[2] = crc >> 16;
icv[3] = crc >> 24; icv[3] = crc >> 24;
crypto_skcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
sg_init_one(&sg, pos, len + 4); for (i = 0; i < len + 4; i++)
skcipher_request_set_tfm(req, tkey->tx_tfm_arc4); crypto_cipher_encrypt_one(tkey->tx_tfm_arc4, pos + i, pos + i);
skcipher_request_set_callback(req, 0, NULL, NULL); return 0;
skcipher_request_set_crypt(req, &sg, &sg, len + 4, NULL);
err = crypto_skcipher_encrypt(req);
skcipher_request_zero(req);
return err;
} }
/* /*
...@@ -400,7 +392,6 @@ static inline int tkip_replay_check(u32 iv32_n, u16 iv16_n, ...@@ -400,7 +392,6 @@ static inline int tkip_replay_check(u32 iv32_n, u16 iv16_n,
static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct lib80211_tkip_data *tkey = priv; struct lib80211_tkip_data *tkey = priv;
SKCIPHER_REQUEST_ON_STACK(req, tkey->rx_tfm_arc4);
u8 rc4key[16]; u8 rc4key[16];
u8 keyidx, *pos; u8 keyidx, *pos;
u32 iv32; u32 iv32;
...@@ -408,9 +399,8 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -408,9 +399,8 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
u8 icv[4]; u8 icv[4];
u32 crc; u32 crc;
struct scatterlist sg;
int plen; int plen;
int err; int i;
hdr = (struct ieee80211_hdr *)skb->data; hdr = (struct ieee80211_hdr *)skb->data;
...@@ -463,18 +453,9 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -463,18 +453,9 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
plen = skb->len - hdr_len - 12; plen = skb->len - hdr_len - 12;
crypto_skcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
sg_init_one(&sg, pos, plen + 4); for (i = 0; i < plen + 4; i++)
skcipher_request_set_tfm(req, tkey->rx_tfm_arc4); crypto_cipher_decrypt_one(tkey->rx_tfm_arc4, pos + i, pos + i);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, &sg, &sg, plen + 4, NULL);
err = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
if (err) {
net_dbg_ratelimited("TKIP: failed to decrypt received packet from %pM\n",
hdr->addr2);
return -7;
}
crc = ~crc32_le(~0, pos, plen); crc = ~crc32_le(~0, pos, plen);
icv[0] = crc; icv[0] = crc;
...@@ -660,9 +641,9 @@ static int lib80211_tkip_set_key(void *key, int len, u8 * seq, void *priv) ...@@ -660,9 +641,9 @@ static int lib80211_tkip_set_key(void *key, int len, u8 * seq, void *priv)
struct lib80211_tkip_data *tkey = priv; struct lib80211_tkip_data *tkey = priv;
int keyidx; int keyidx;
struct crypto_shash *tfm = tkey->tx_tfm_michael; struct crypto_shash *tfm = tkey->tx_tfm_michael;
struct crypto_skcipher *tfm2 = tkey->tx_tfm_arc4; struct crypto_cipher *tfm2 = tkey->tx_tfm_arc4;
struct crypto_shash *tfm3 = tkey->rx_tfm_michael; struct crypto_shash *tfm3 = tkey->rx_tfm_michael;
struct crypto_skcipher *tfm4 = tkey->rx_tfm_arc4; struct crypto_cipher *tfm4 = tkey->rx_tfm_arc4;
keyidx = tkey->key_idx; keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey)); memset(tkey, 0, sizeof(*tkey));
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <net/lib80211.h> #include <net/lib80211.h>
#include <crypto/skcipher.h> #include <linux/crypto.h>
#include <linux/crc32.h> #include <linux/crc32.h>
MODULE_AUTHOR("Jouni Malinen"); MODULE_AUTHOR("Jouni Malinen");
...@@ -35,8 +35,8 @@ struct lib80211_wep_data { ...@@ -35,8 +35,8 @@ struct lib80211_wep_data {
u8 key[WEP_KEY_LEN + 1]; u8 key[WEP_KEY_LEN + 1];
u8 key_len; u8 key_len;
u8 key_idx; u8 key_idx;
struct crypto_skcipher *tx_tfm; struct crypto_cipher *tx_tfm;
struct crypto_skcipher *rx_tfm; struct crypto_cipher *rx_tfm;
}; };
static void *lib80211_wep_init(int keyidx) static void *lib80211_wep_init(int keyidx)
...@@ -48,13 +48,13 @@ static void *lib80211_wep_init(int keyidx) ...@@ -48,13 +48,13 @@ static void *lib80211_wep_init(int keyidx)
goto fail; goto fail;
priv->key_idx = keyidx; priv->key_idx = keyidx;
priv->tx_tfm = crypto_alloc_skcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); priv->tx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm)) { if (IS_ERR(priv->tx_tfm)) {
priv->tx_tfm = NULL; priv->tx_tfm = NULL;
goto fail; goto fail;
} }
priv->rx_tfm = crypto_alloc_skcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); priv->rx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->rx_tfm)) { if (IS_ERR(priv->rx_tfm)) {
priv->rx_tfm = NULL; priv->rx_tfm = NULL;
goto fail; goto fail;
...@@ -66,8 +66,8 @@ static void *lib80211_wep_init(int keyidx) ...@@ -66,8 +66,8 @@ static void *lib80211_wep_init(int keyidx)
fail: fail:
if (priv) { if (priv) {
crypto_free_skcipher(priv->tx_tfm); crypto_free_cipher(priv->tx_tfm);
crypto_free_skcipher(priv->rx_tfm); crypto_free_cipher(priv->rx_tfm);
kfree(priv); kfree(priv);
} }
return NULL; return NULL;
...@@ -77,8 +77,8 @@ static void lib80211_wep_deinit(void *priv) ...@@ -77,8 +77,8 @@ static void lib80211_wep_deinit(void *priv)
{ {
struct lib80211_wep_data *_priv = priv; struct lib80211_wep_data *_priv = priv;
if (_priv) { if (_priv) {
crypto_free_skcipher(_priv->tx_tfm); crypto_free_cipher(_priv->tx_tfm);
crypto_free_skcipher(_priv->rx_tfm); crypto_free_cipher(_priv->rx_tfm);
} }
kfree(priv); kfree(priv);
} }
...@@ -129,12 +129,10 @@ static int lib80211_wep_build_iv(struct sk_buff *skb, int hdr_len, ...@@ -129,12 +129,10 @@ static int lib80211_wep_build_iv(struct sk_buff *skb, int hdr_len,
static int lib80211_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) static int lib80211_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct lib80211_wep_data *wep = priv; struct lib80211_wep_data *wep = priv;
SKCIPHER_REQUEST_ON_STACK(req, wep->tx_tfm);
u32 crc, klen, len; u32 crc, klen, len;
u8 *pos, *icv; u8 *pos, *icv;
struct scatterlist sg;
u8 key[WEP_KEY_LEN + 3]; u8 key[WEP_KEY_LEN + 3];
int err; int i;
/* other checks are in lib80211_wep_build_iv */ /* other checks are in lib80211_wep_build_iv */
if (skb_tailroom(skb) < 4) if (skb_tailroom(skb) < 4)
...@@ -162,14 +160,12 @@ static int lib80211_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -162,14 +160,12 @@ static int lib80211_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
icv[2] = crc >> 16; icv[2] = crc >> 16;
icv[3] = crc >> 24; icv[3] = crc >> 24;
crypto_skcipher_setkey(wep->tx_tfm, key, klen); crypto_cipher_setkey(wep->tx_tfm, key, klen);
sg_init_one(&sg, pos, len + 4);
skcipher_request_set_tfm(req, wep->tx_tfm); for (i = 0; i < len + 4; i++)
skcipher_request_set_callback(req, 0, NULL, NULL); crypto_cipher_encrypt_one(wep->tx_tfm, pos + i, pos + i);
skcipher_request_set_crypt(req, &sg, &sg, len + 4, NULL);
err = crypto_skcipher_encrypt(req); return 0;
skcipher_request_zero(req);
return err;
} }
/* Perform WEP decryption on given buffer. Buffer includes whole WEP part of /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of
...@@ -182,12 +178,10 @@ static int lib80211_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -182,12 +178,10 @@ static int lib80211_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
static int lib80211_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) static int lib80211_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct lib80211_wep_data *wep = priv; struct lib80211_wep_data *wep = priv;
SKCIPHER_REQUEST_ON_STACK(req, wep->rx_tfm);
u32 crc, klen, plen; u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3]; u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4]; u8 keyidx, *pos, icv[4];
struct scatterlist sg; int i;
int err;
if (skb->len < hdr_len + 8) if (skb->len < hdr_len + 8)
return -1; return -1;
...@@ -208,15 +202,9 @@ static int lib80211_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -208,15 +202,9 @@ static int lib80211_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
/* Apply RC4 to data and compute CRC32 over decrypted data */ /* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8; plen = skb->len - hdr_len - 8;
crypto_skcipher_setkey(wep->rx_tfm, key, klen); crypto_cipher_setkey(wep->rx_tfm, key, klen);
sg_init_one(&sg, pos, plen + 4); for (i = 0; i < plen + 4; i++)
skcipher_request_set_tfm(req, wep->rx_tfm); crypto_cipher_decrypt_one(wep->rx_tfm, pos + i, pos + i);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, &sg, &sg, plen + 4, NULL);
err = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
if (err)
return -7;
crc = ~crc32_le(~0, pos, plen); crc = ~crc32_le(~0, pos, plen);
icv[0] = crc; icv[0] = crc;
......
This diff is collapsed.
...@@ -1232,4 +1232,19 @@ rdev_external_auth(struct cfg80211_registered_device *rdev, ...@@ -1232,4 +1232,19 @@ rdev_external_auth(struct cfg80211_registered_device *rdev,
return ret; return ret;
} }
static inline int
rdev_get_ftm_responder_stats(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_ftm_responder_stats *ftm_stats)
{
int ret = -EOPNOTSUPP;
trace_rdev_get_ftm_responder_stats(&rdev->wiphy, dev, ftm_stats);
if (rdev->ops->get_ftm_responder_stats)
ret = rdev->ops->get_ftm_responder_stats(&rdev->wiphy, dev,
ftm_stats);
trace_rdev_return_int(&rdev->wiphy, ret);
return ret;
}
#endif /* __CFG80211_RDEV_OPS */ #endif /* __CFG80211_RDEV_OPS */
...@@ -3831,6 +3831,15 @@ static int __init regulatory_init_db(void) ...@@ -3831,6 +3831,15 @@ static int __init regulatory_init_db(void)
{ {
int err; int err;
/*
* It's possible that - due to other bugs/issues - cfg80211
* never called regulatory_init() below, or that it failed;
* in that case, don't try to do any further work here as
* it's doomed to lead to crashes.
*/
if (IS_ERR_OR_NULL(reg_pdev))
return -EINVAL;
err = load_builtin_regdb_keys(); err = load_builtin_regdb_keys();
if (err) if (err)
return err; return err;
......
...@@ -2368,6 +2368,140 @@ TRACE_EVENT(rdev_external_auth, ...@@ -2368,6 +2368,140 @@ TRACE_EVENT(rdev_external_auth,
__entry->bssid, __entry->ssid, __entry->status) __entry->bssid, __entry->ssid, __entry->status)
); );
TRACE_EVENT(rdev_start_radar_detection,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_chan_def *chandef,
u32 cac_time_ms),
TP_ARGS(wiphy, netdev, chandef, cac_time_ms),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
CHAN_DEF_ENTRY
__field(u32, cac_time_ms)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
CHAN_DEF_ASSIGN(chandef);
__entry->cac_time_ms = cac_time_ms;
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT
", cac_time_ms=%u",
WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG,
__entry->cac_time_ms)
);
TRACE_EVENT(rdev_set_mcast_rate,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
int *mcast_rate),
TP_ARGS(wiphy, netdev, mcast_rate),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
__array(int, mcast_rate, NUM_NL80211_BANDS)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
memcpy(__entry->mcast_rate, mcast_rate,
sizeof(int) * NUM_NL80211_BANDS);
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", "
"mcast_rates [2.4GHz=0x%x, 5.2GHz=0x%x, 60GHz=0x%x]",
WIPHY_PR_ARG, NETDEV_PR_ARG,
__entry->mcast_rate[NL80211_BAND_2GHZ],
__entry->mcast_rate[NL80211_BAND_5GHZ],
__entry->mcast_rate[NL80211_BAND_60GHZ])
);
TRACE_EVENT(rdev_set_coalesce,
TP_PROTO(struct wiphy *wiphy, struct cfg80211_coalesce *coalesce),
TP_ARGS(wiphy, coalesce),
TP_STRUCT__entry(
WIPHY_ENTRY
__field(int, n_rules)
),
TP_fast_assign(
WIPHY_ASSIGN;
__entry->n_rules = coalesce ? coalesce->n_rules : 0;
),
TP_printk(WIPHY_PR_FMT ", n_rules=%d",
WIPHY_PR_ARG, __entry->n_rules)
);
DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
TP_ARGS(wiphy, wdev)
);
TRACE_EVENT(rdev_set_multicast_to_unicast,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
const bool enabled),
TP_ARGS(wiphy, netdev, enabled),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
__field(bool, enabled)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
__entry->enabled = enabled;
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", unicast: %s",
WIPHY_PR_ARG, NETDEV_PR_ARG,
BOOL_TO_STR(__entry->enabled))
);
DEFINE_EVENT(wiphy_wdev_evt, rdev_get_txq_stats,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
TP_ARGS(wiphy, wdev)
);
TRACE_EVENT(rdev_get_ftm_responder_stats,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_ftm_responder_stats *ftm_stats),
TP_ARGS(wiphy, netdev, ftm_stats),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
__field(u64, timestamp)
__field(u32, success_num)
__field(u32, partial_num)
__field(u32, failed_num)
__field(u32, asap_num)
__field(u32, non_asap_num)
__field(u64, duration)
__field(u32, unknown_triggers)
__field(u32, reschedule)
__field(u32, out_of_window)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
__entry->success_num = ftm_stats->success_num;
__entry->partial_num = ftm_stats->partial_num;
__entry->failed_num = ftm_stats->failed_num;
__entry->asap_num = ftm_stats->asap_num;
__entry->non_asap_num = ftm_stats->non_asap_num;
__entry->duration = ftm_stats->total_duration_ms;
__entry->unknown_triggers = ftm_stats->unknown_triggers_num;
__entry->reschedule = ftm_stats->reschedule_requests_num;
__entry->out_of_window = ftm_stats->out_of_window_triggers_num;
),
TP_printk(WIPHY_PR_FMT "Ftm responder stats: success %u, partial %u, "
"failed %u, asap %u, non asap %u, total duration %llu, unknown "
"triggers %u, rescheduled %u, out of window %u", WIPHY_PR_ARG,
__entry->success_num, __entry->partial_num, __entry->failed_num,
__entry->asap_num, __entry->non_asap_num, __entry->duration,
__entry->unknown_triggers, __entry->reschedule,
__entry->out_of_window)
);
/************************************************************* /*************************************************************
* cfg80211 exported functions traces * * cfg80211 exported functions traces *
*************************************************************/ *************************************************************/
...@@ -3160,105 +3294,6 @@ TRACE_EVENT(cfg80211_stop_iface, ...@@ -3160,105 +3294,6 @@ TRACE_EVENT(cfg80211_stop_iface,
TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT, TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT,
WIPHY_PR_ARG, WDEV_PR_ARG) WIPHY_PR_ARG, WDEV_PR_ARG)
); );
TRACE_EVENT(rdev_start_radar_detection,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_chan_def *chandef,
u32 cac_time_ms),
TP_ARGS(wiphy, netdev, chandef, cac_time_ms),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
CHAN_DEF_ENTRY
__field(u32, cac_time_ms)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
CHAN_DEF_ASSIGN(chandef);
__entry->cac_time_ms = cac_time_ms;
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT
", cac_time_ms=%u",
WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG,
__entry->cac_time_ms)
);
TRACE_EVENT(rdev_set_mcast_rate,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
int *mcast_rate),
TP_ARGS(wiphy, netdev, mcast_rate),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
__array(int, mcast_rate, NUM_NL80211_BANDS)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
memcpy(__entry->mcast_rate, mcast_rate,
sizeof(int) * NUM_NL80211_BANDS);
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", "
"mcast_rates [2.4GHz=0x%x, 5.2GHz=0x%x, 60GHz=0x%x]",
WIPHY_PR_ARG, NETDEV_PR_ARG,
__entry->mcast_rate[NL80211_BAND_2GHZ],
__entry->mcast_rate[NL80211_BAND_5GHZ],
__entry->mcast_rate[NL80211_BAND_60GHZ])
);
TRACE_EVENT(rdev_set_coalesce,
TP_PROTO(struct wiphy *wiphy, struct cfg80211_coalesce *coalesce),
TP_ARGS(wiphy, coalesce),
TP_STRUCT__entry(
WIPHY_ENTRY
__field(int, n_rules)
),
TP_fast_assign(
WIPHY_ASSIGN;
__entry->n_rules = coalesce ? coalesce->n_rules : 0;
),
TP_printk(WIPHY_PR_FMT ", n_rules=%d",
WIPHY_PR_ARG, __entry->n_rules)
);
DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
TP_ARGS(wiphy, wdev)
);
TRACE_EVENT(rdev_set_multicast_to_unicast,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
const bool enabled),
TP_ARGS(wiphy, netdev, enabled),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
__field(bool, enabled)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
__entry->enabled = enabled;
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", unicast: %s",
WIPHY_PR_ARG, NETDEV_PR_ARG,
BOOL_TO_STR(__entry->enabled))
);
TRACE_EVENT(rdev_get_txq_stats,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
TP_ARGS(wiphy, wdev),
TP_STRUCT__entry(
WIPHY_ENTRY
WDEV_ENTRY
),
TP_fast_assign(
WIPHY_ASSIGN;
WDEV_ASSIGN;
),
TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT, WIPHY_PR_ARG, WDEV_PR_ARG)
);
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_PATH
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment