Commit d91d9b94 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Luca Coelho

iwlwifi: mvm: add support for TWT capabilities

We need to check the TWT support of the peer and to
propagte the capability to the firmware.
The current implementation will enable TWT only if the TWT
support is advertised in the HE CAP IE and in the Extended
Capability IE.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 71256480
...@@ -185,6 +185,14 @@ struct iwl_mac_data_ibss { ...@@ -185,6 +185,14 @@ struct iwl_mac_data_ibss {
__le32 beacon_template; __le32 beacon_template;
} __packed; /* IBSS_MAC_DATA_API_S_VER_1 */ } __packed; /* IBSS_MAC_DATA_API_S_VER_1 */
/**
* enum iwl_mac_data_policy - policy of the data path for this MAC
* @TWT_SUPPORTED: twt is supported
*/
enum iwl_mac_data_policy {
TWT_SUPPORTED = BIT(0),
};
/** /**
* struct iwl_mac_data_sta - configuration data for station MAC context * struct iwl_mac_data_sta - configuration data for station MAC context
* @is_assoc: 1 for associated state, 0 otherwise * @is_assoc: 1 for associated state, 0 otherwise
...@@ -193,7 +201,7 @@ struct iwl_mac_data_ibss { ...@@ -193,7 +201,7 @@ struct iwl_mac_data_ibss {
* @bi: beacon interval in TU, applicable only when associated * @bi: beacon interval in TU, applicable only when associated
* @reserved1: reserved * @reserved1: reserved
* @dtim_interval: DTIM interval in TU, applicable only when associated * @dtim_interval: DTIM interval in TU, applicable only when associated
* @reserved2: reserved * @data_policy: see &enum iwl_mac_data_policy
* @listen_interval: in beacon intervals, applicable only when associated * @listen_interval: in beacon intervals, applicable only when associated
* @assoc_id: unique ID assigned by the AP during association * @assoc_id: unique ID assigned by the AP during association
* @assoc_beacon_arrive_time: TSF of first beacon after association * @assoc_beacon_arrive_time: TSF of first beacon after association
...@@ -205,11 +213,11 @@ struct iwl_mac_data_sta { ...@@ -205,11 +213,11 @@ struct iwl_mac_data_sta {
__le32 bi; __le32 bi;
__le32 reserved1; __le32 reserved1;
__le32 dtim_interval; __le32 dtim_interval;
__le32 reserved2; __le32 data_policy;
__le32 listen_interval; __le32 listen_interval;
__le32 assoc_id; __le32 assoc_id;
__le32 assoc_beacon_arrive_time; __le32 assoc_beacon_arrive_time;
} __packed; /* STA_MAC_DATA_API_S_VER_1 */ } __packed; /* STA_MAC_DATA_API_S_VER_2 */
/** /**
* struct iwl_mac_data_go - configuration data for P2P GO MAC context * struct iwl_mac_data_go - configuration data for P2P GO MAC context
...@@ -233,7 +241,7 @@ struct iwl_mac_data_go { ...@@ -233,7 +241,7 @@ struct iwl_mac_data_go {
struct iwl_mac_data_p2p_sta { struct iwl_mac_data_p2p_sta {
struct iwl_mac_data_sta sta; struct iwl_mac_data_sta sta;
__le32 ctwin; __le32 ctwin;
} __packed; /* P2P_STA_MAC_DATA_API_S_VER_1 */ } __packed; /* P2P_STA_MAC_DATA_API_S_VER_2 */
/** /**
* struct iwl_mac_data_pibss - Pseudo IBSS config data * struct iwl_mac_data_pibss - Pseudo IBSS config data
......
...@@ -777,8 +777,30 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, ...@@ -777,8 +777,30 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST); cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
if (vif->bss_conf.assoc && vif->bss_conf.he_support && if (vif->bss_conf.assoc && vif->bss_conf.he_support &&
!iwlwifi_mod_params.disable_11ax) !iwlwifi_mod_params.disable_11ax) {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
u8 sta_id = mvmvif->ap_sta_id;
cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_11AX); cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_11AX);
if (sta_id != IWL_MVM_INVALID_STA) {
struct ieee80211_sta *sta;
sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],
lockdep_is_held(&mvm->mutex));
/*
* TODO: we should check the ext cap IE but it is
* unclear why the spec requires two bits (one in HE
* cap IE, and one in the ext cap IE). In the meantime
* rely on the HE cap IE only.
*/
if (sta && (sta->he_cap.he_cap_elem.mac_cap_info[0] &
IEEE80211_HE_MAC_CAP0_TWT_RES))
ctxt_sta->data_policy |=
cpu_to_le32(TWT_SUPPORTED);
}
}
return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
} }
......
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