diff options
Diffstat (limited to 'sys/contrib/dev/iwlwifi/mvm/time-event.c')
| -rw-r--r-- | sys/contrib/dev/iwlwifi/mvm/time-event.c | 61 | 
1 files changed, 22 insertions, 39 deletions
| diff --git a/sys/contrib/dev/iwlwifi/mvm/time-event.c b/sys/contrib/dev/iwlwifi/mvm/time-event.c index a8c42ce3b630..aa653782d6d7 100644 --- a/sys/contrib/dev/iwlwifi/mvm/time-event.c +++ b/sys/contrib/dev/iwlwifi/mvm/time-event.c @@ -1,6 +1,6 @@  // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause  /* - * Copyright (C) 2012-2014, 2018-2024 Intel Corporation + * Copyright (C) 2012-2014, 2018-2025 Intel Corporation   * Copyright (C) 2013-2015 Intel Mobile Communications GmbH   * Copyright (C) 2017 Intel Deutschland GmbH   */ @@ -114,16 +114,14 @@ static void iwl_mvm_cleanup_roc(struct iwl_mvm *mvm)  		iwl_mvm_flush_sta(mvm, mvm->aux_sta.sta_id,  				  mvm->aux_sta.tfd_queue_msk); -		if (mvm->mld_api_is_used) { -			iwl_mvm_mld_rm_aux_sta(mvm); -			mutex_unlock(&mvm->mutex); -			return; -		} -  		/* In newer version of this command an aux station is added only  		 * in cases of dedicated tx queue and need to be removed in end -		 * of use */ -		if (iwl_mvm_has_new_station_api(mvm->fw)) +		 * of use. For the even newer mld api, use the appropriate +		 * function. +		 */ +		if (mvm->mld_api_is_used) +			iwl_mvm_mld_rm_aux_sta(mvm); +		else if (iwl_mvm_has_new_station_api(mvm->fw))  			iwl_mvm_rm_aux_sta(mvm);  	} @@ -753,7 +751,7 @@ static void iwl_mvm_cancel_session_protection(struct iwl_mvm *mvm,  					      u32 id, s8 link_id)  {  	int mac_link_id = iwl_mvm_get_session_prot_id(mvm, vif, link_id); -	struct iwl_mvm_session_prot_cmd cmd = { +	struct iwl_session_prot_cmd cmd = {  		.id_and_color = cpu_to_le32(mac_link_id),  		.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE),  		.conf_id = cpu_to_le32(id), @@ -777,11 +775,13 @@ static void iwl_mvm_roc_rm_cmd(struct iwl_mvm *mvm, u32 activity)  		.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE),  		.activity = cpu_to_le32(activity),  	}; +	u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0); +	u16 cmd_len = ver < 6 ? sizeof(struct iwl_roc_req_v5) : sizeof(roc_cmd);  	int ret;  	lockdep_assert_held(&mvm->mutex);  	ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0, -				   sizeof(roc_cmd), &roc_cmd); +				   cmd_len, &roc_cmd);  	if (ret)  		IWL_ERR(mvm, "Couldn't send the ROC_CMD: %d\n", ret);  } @@ -957,41 +957,20 @@ void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm,  				      struct iwl_rx_cmd_buffer *rxb)  {  	struct iwl_rx_packet *pkt = rxb_addr(rxb); -	struct iwl_mvm_session_prot_notif *notif = (void *)pkt->data; -	unsigned int ver = -		iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, -					SESSION_PROTECTION_NOTIF, 2); +	struct iwl_session_prot_notif *notif = (void *)pkt->data;  	int id = le32_to_cpu(notif->mac_link_id);  	struct ieee80211_vif *vif;  	struct iwl_mvm_vif *mvmvif; -	unsigned int notif_link_id;  	rcu_read_lock(); -	if (ver <= 2) { -		vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true); -	} else { -		struct ieee80211_bss_conf *link_conf = -			iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, id, true); - -		if (!link_conf) -			goto out_unlock; - -		notif_link_id = link_conf->link_id; -		vif = link_conf->vif; -	} - +	/* note we use link ID == MAC ID */ +	vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true);  	if (!vif)  		goto out_unlock;  	mvmvif = iwl_mvm_vif_from_mac80211(vif); -	if (WARN(ver > 2 && mvmvif->time_event_data.link_id >= 0 && -		 mvmvif->time_event_data.link_id != notif_link_id, -		 "SESSION_PROTECTION_NOTIF was received for link %u, while the current time event is on link %u\n", -		 notif_link_id, mvmvif->time_event_data.link_id)) -		goto out_unlock; -  	/* The vif is not a P2P_DEVICE, maintain its time_event_data */  	if (vif->type != NL80211_IFTYPE_P2P_DEVICE) {  		struct iwl_mvm_time_event_data *te_data = @@ -1032,6 +1011,8 @@ void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm,  		/* End TE, notify mac80211 */  		mvmvif->time_event_data.id = SESSION_PROTECT_CONF_MAX_ID;  		mvmvif->time_event_data.link_id = -1; +		/* set the bit so the ROC cleanup will actually clean up */ +		set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status);  		iwl_mvm_roc_finished(mvm);  		ieee80211_remain_on_channel_expired(mvm->hw);  	} else if (le32_to_cpu(notif->start)) { @@ -1107,6 +1088,8 @@ int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm,  		.activity = cpu_to_le32(activity),  		.sta_id = cpu_to_le32(mvm->aux_sta.sta_id),  	}; +	u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0); +	u16 cmd_len = ver < 6 ? sizeof(struct iwl_roc_req_v5) : sizeof(roc_req);  	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);  	lockdep_assert_held(&mvm->mutex); @@ -1136,7 +1119,7 @@ int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm,  	memcpy(roc_req.node_addr, vif->addr, ETH_ALEN);  	res = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), -				   0, sizeof(roc_req), &roc_req); +				   0, cmd_len, &roc_req);  	if (!res)  		mvmvif->roc_activity = activity; @@ -1150,7 +1133,7 @@ iwl_mvm_start_p2p_roc_session_protection(struct iwl_mvm *mvm,  					 enum ieee80211_roc_type type)  {  	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); -	struct iwl_mvm_session_prot_cmd cmd = { +	struct iwl_session_prot_cmd cmd = {  		.id_and_color =  			cpu_to_le32(iwl_mvm_get_session_prot_id(mvm, vif, 0)),  		.action = cpu_to_le32(FW_CTXT_ACTION_ADD), @@ -1419,7 +1402,7 @@ static bool iwl_mvm_session_prot_notif(struct iwl_notif_wait_data *notif_wait,  {  	struct iwl_mvm *mvm =  		container_of(notif_wait, struct iwl_mvm, notif_wait); -	struct iwl_mvm_session_prot_notif *resp; +	struct iwl_session_prot_notif *resp;  	int resp_len = iwl_rx_packet_payload_len(pkt);  	if (WARN_ON(pkt->hdr.cmd != SESSION_PROTECTION_NOTIF || @@ -1451,7 +1434,7 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,  	const u16 notif[] = { WIDE_ID(MAC_CONF_GROUP, SESSION_PROTECTION_NOTIF) };  	struct iwl_notification_wait wait_notif;  	int mac_link_id = iwl_mvm_get_session_prot_id(mvm, vif, (s8)link_id); -	struct iwl_mvm_session_prot_cmd cmd = { +	struct iwl_session_prot_cmd cmd = {  		.id_and_color = cpu_to_le32(mac_link_id),  		.action = cpu_to_le32(FW_CTXT_ACTION_ADD),  		.conf_id = cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), | 
