Commit fe959c7b authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Luca Coelho
Browse files

iwlwifi: mvm: use the new session protection command



The firmware has now a new session protection command.
This new API allows the firmware to manage the protection
needed for association. It'll also remove the event when
the association is complete.

Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent c327ae2f
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
 * Copyright(c) 2018 Intel Corporation
 * Copyright(c) 2018 - 2019 Intel Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
 * Copyright(c) 2018 Intel Corporation
 * Copyright(c) 2018 - 2019 Intel Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
@@ -77,6 +77,16 @@ enum iwl_mac_conf_subcmd_ids {
	 * @CHANNEL_SWITCH_TIME_EVENT_CMD: &struct iwl_chan_switch_te_cmd
	 */
	CHANNEL_SWITCH_TIME_EVENT_CMD = 0x4,
	/**
	 * @SESSION_PROTECTION_CMD: &struct iwl_mvm_session_prot_cmd
	 */
	SESSION_PROTECTION_CMD = 0x5,

	/**
	 * @SESSION_PROTECTION_NOTIF: &struct iwl_mvm_session_prot_notif
	 */
	SESSION_PROTECTION_NOTIF = 0xFB,

	/**
	 * @PROBE_RESPONSE_DATA_NOTIF: &struct iwl_probe_resp_data_notif
	 */
+78 −2
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
 * Copyright(c) 2018        Intel Corporation
 * Copyright(c) 2018 - 2019 Intel Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
 * Copyright(c) 2018        Intel Corporation
 * Copyright(c) 2018 - 2019 Intel Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
@@ -393,4 +393,80 @@ struct iwl_hs20_roc_res {
	__le32 status;
} __packed; /* HOT_SPOT_RSP_API_S_VER_1 */

/**
 * enum iwl_mvm_session_prot_conf_id - session protection's configurations
 * @SESSION_PROTECT_CONF_ASSOC: Start a session protection for association.
 *	The firmware will allocate two events.
 *	Valid for BSS_STA and P2P_STA.
 *	* A rather short event that can't be fragmented and with a very
 *	high priority. If every goes well (99% of the cases) the
 *	association should complete within this first event. During
 *	that event, no other activity will happen in the firmware,
 *	which is why it can't be too long.
 *	The length of this event is hard-coded in the firmware: 300TUs.
 *	* Another event which can be much longer (it's duration is
 *	configurable by the driver) which has a slightly lower
 *	priority and that can be fragmented allowing other activities
 *	to run while this event is running.
 *	The firmware will automatically remove both events once the driver sets
 *	the BSS MAC as associated. Neither of the events will be removed
 *	for the P2P_STA MAC.
 *	Only the duration is configurable for this protection.
 * @SESSION_PROTECT_CONF_GO_CLIENT_ASSOC: not used
 * @SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV: Schedule the P2P Device to be in
 *	listen mode. Will be fragmented. Valid only on the P2P Device MAC.
 *	Valid only on the P2P Device MAC. The firmware will take into account
 *	the duration, the interval and the repetition count.
 * @SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION: Schedule the P2P Device to be be
 *	able to run the GO Negotiation. Will not be fragmented and not
 *	repetitive. Valid only on the P2P Device MAC. Only the duration will
 *	be taken into account.
 */
enum iwl_mvm_session_prot_conf_id {
	SESSION_PROTECT_CONF_ASSOC,
	SESSION_PROTECT_CONF_GO_CLIENT_ASSOC,
	SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV,
	SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION,
}; /* SESSION_PROTECTION_CONF_ID_E_VER_1 */

/**
 * struct iwl_mvm_session_prot_cmd - configure a session protection
 * @id_and_color: the id and color of the mac for which this session protection
 *	is sent
 * @action: can be either FW_CTXT_ACTION_ADD or FW_CTXT_ACTION_REMOVE
 * @conf_id: see &enum iwl_mvm_session_prot_conf_id
 * @duration_tu: the duration of the whole protection in TUs.
 * @repetition_count: not used
 * @interval: not used
 *
 * Note: the session protection will always be scheduled to start as
 * early as possible, but the maximum delay is configuration dependent.
 * The firmware supports only one concurrent session protection per vif.
 * Adding a new session protection will remove any currently running session.
 */
struct iwl_mvm_session_prot_cmd {
	/* COMMON_INDEX_HDR_API_S_VER_1 hdr */
	__le32 id_and_color;
	__le32 action;
	__le32 conf_id;
	__le32 duration_tu;
	__le32 repetition_count;
	__le32 interval;
} __packed; /* SESSION_PROTECTION_CMD_API_S_VER_1 */

/**
 * struct iwl_mvm_session_prot_notif - session protection started / ended
 * @mac_id: the mac id for which the session protection started / ended
 * @status: 1 means success, 0 means failure
 * @start: 1 means the session protection started, 0 means it ended
 *
 * Note that any session protection will always get two notifications: start
 * and end even the firmware could not schedule it.
 */
struct iwl_mvm_session_prot_notif {
	__le32 mac_id;
	__le32 status;
	__le32 start;
} __packed; /* SESSION_PROTECTION_NOTIFICATION_API_S_VER_1 */

#endif /* __iwl_fw_api_time_event_h__ */
+1 −0
Original line number Diff line number Diff line
@@ -445,6 +445,7 @@ enum iwl_ucode_tlv_capa {
	IWL_UCODE_TLV_CAPA_CS_MODIFY			= (__force iwl_ucode_tlv_capa_t)49,
	IWL_UCODE_TLV_CAPA_SET_LTR_GEN2			= (__force iwl_ucode_tlv_capa_t)50,
	IWL_UCODE_TLV_CAPA_SET_PPAG			= (__force iwl_ucode_tlv_capa_t)52,
	IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD		= (__force iwl_ucode_tlv_capa_t)54,

	/* set 2 */
	IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE		= (__force iwl_ucode_tlv_capa_t)64,
+28 −5
Original line number Diff line number Diff line
@@ -2280,7 +2280,9 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
			}

			if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART,
				     &mvm->status)) {
				     &mvm->status) &&
			    !fw_has_capa(&mvm->fw->ucode_capa,
					 IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD)) {
				/*
				 * If we're restarting then the firmware will
				 * obviously have lost synchronisation with
@@ -2294,6 +2296,10 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
				 *
				 * Set a large maximum delay to allow for more
				 * than a single interface.
				 *
				 * For new firmware versions, rely on the
				 * firmware. This is relevant for DCM scenarios
				 * only anyway.
				 */
				u32 dur = (11 * vif->bss_conf.beacon_int) / 10;
				iwl_mvm_protect_session(mvm, vif, dur, dur,
@@ -2384,7 +2390,10 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
		/*
		 * We received a beacon from the associated AP so
		 * remove the session protection.
		 * A firmware with the new API will remove it automatically.
		 */
		if (!fw_has_capa(&mvm->fw->ucode_capa,
				 IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD))
			iwl_mvm_stop_session_protection(mvm, vif);

		iwl_mvm_sf_update(mvm, vif, false);
@@ -3255,8 +3264,22 @@ static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
		duration = req_duration;

	mutex_lock(&mvm->mutex);
	/* Try really hard to protect the session and hear a beacon */
	iwl_mvm_protect_session(mvm, vif, duration, min_duration, 500, false);
	/* Try really hard to protect the session and hear a beacon
	 * The new session protection command allows us to protect the
	 * session for a much longer time since the firmware will internally
	 * create two events: a 300TU one with a very high priority that
	 * won't be fragmented which should be enough for 99% of the cases,
	 * and another one (which we configure here to be 900TU long) which
	 * will have a slightly lower priority, but more importantly, can be
	 * fragmented so that it'll allow other activities to run.
	 */
	if (fw_has_capa(&mvm->fw->ucode_capa,
			IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD))
		iwl_mvm_schedule_session_protection(mvm, vif, 900,
						    min_duration);
	else
		iwl_mvm_protect_session(mvm, vif, duration,
					min_duration, 500, false);
	mutex_unlock(&mvm->mutex);
}

@@ -3848,7 +3871,7 @@ static int iwl_mvm_cancel_roc(struct ieee80211_hw *hw,
	IWL_DEBUG_MAC80211(mvm, "enter\n");

	mutex_lock(&mvm->mutex);
	iwl_mvm_stop_roc(mvm);
	iwl_mvm_stop_roc(mvm, vif);
	mutex_unlock(&mvm->mutex);

	IWL_DEBUG_MAC80211(mvm, "leave\n");
+4 −0
Original line number Diff line number Diff line
@@ -263,6 +263,8 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {

	RX_HANDLER(TIME_EVENT_NOTIFICATION, iwl_mvm_rx_time_event_notif,
		   RX_HANDLER_SYNC),
	RX_HANDLER_GRP(MAC_CONF_GROUP, SESSION_PROTECTION_NOTIF,
		       iwl_mvm_rx_session_protect_notif, RX_HANDLER_SYNC),
	RX_HANDLER(MCC_CHUB_UPDATE_CMD, iwl_mvm_rx_chub_update_mcc,
		   RX_HANDLER_ASYNC_LOCKED),

@@ -432,6 +434,8 @@ static const struct iwl_hcmd_names iwl_mvm_system_names[] = {
 */
static const struct iwl_hcmd_names iwl_mvm_mac_conf_names[] = {
	HCMD_NAME(CHANNEL_SWITCH_TIME_EVENT_CMD),
	HCMD_NAME(SESSION_PROTECTION_CMD),
	HCMD_NAME(SESSION_PROTECTION_NOTIF),
	HCMD_NAME(CHANNEL_SWITCH_NOA_NOTIF),
};

Loading