Skip to content

Commit

Permalink
wifi: iwlwifi: mvm: fix RFKILL report when driver is going down
Browse files Browse the repository at this point in the history
When CSME takes ownership, the driver sets RFKILL on, and this
triggers driver unload and sending the confirmation SAP message.
However, when IWL_MVM_MEI_REPORT_RFKILL is set, RFKILL was not
reported and as a result, the driver did not confirm the ownership
transition. Fix it.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230418122405.29ac3cd3df73.I96b32bc274bfe1e3871e54d3fa29c7ac4f40446f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Avraham Stern authored and Johannes Berg committed Apr 20, 2023
1 parent 06ce23a commit 22b68fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/mei/iwl-mei.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021 - 2022 Intel Corporation
*/

#ifndef __iwl_mei_h__
Expand Down Expand Up @@ -301,7 +301,7 @@ struct iwl_mei_colloc_info {
struct iwl_mei_ops {
void (*me_conn_status)(void *priv,
const struct iwl_mei_conn_info *conn_info);
void (*rfkill)(void *priv, bool blocked);
void (*rfkill)(void *priv, bool blocked, bool csme_taking_ownership);
void (*roaming_forbidden)(void *priv, bool forbidden);
void (*sap_connected)(void *priv);
void (*nic_stolen)(void *priv);
Expand Down
13 changes: 7 additions & 6 deletions drivers/net/wireless/intel/iwlwifi/mei/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ iwl_mei_handle_conn_status(struct mei_cl_device *cldev,
status->link_prot_state);
else
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv,
status->link_prot_state);
status->link_prot_state, false);
}

static void iwl_mei_set_init_conf(struct iwl_mei *mei)
Expand Down Expand Up @@ -796,7 +796,7 @@ static void iwl_mei_handle_amt_state(struct mei_cl_device *cldev,
if (mei->amt_enabled)
iwl_mei_set_init_conf(mei);
else if (iwl_mei_cache.ops)
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, false);
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, false, false);

schedule_work(&mei->netdev_work);

Expand Down Expand Up @@ -837,7 +837,7 @@ static void iwl_mei_handle_csme_taking_ownership(struct mei_cl_device *cldev,
*/
mei->csme_taking_ownership = true;

iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, true);
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, true, true);
} else {
iwl_mei_send_sap_msg(cldev,
SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED);
Expand Down Expand Up @@ -892,7 +892,7 @@ static void iwl_mei_handle_rx_host_own_req(struct mei_cl_device *cldev,

/* We can now start the connection, unblock rfkill */
if (iwl_mei_cache.ops)
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, false);
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, false, false);
}

static void iwl_mei_handle_pldr_ack(struct mei_cl_device *cldev,
Expand Down Expand Up @@ -1791,7 +1791,8 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops)
if (iwl_mei_is_connected()) {
if (mei->amt_enabled)
iwl_mei_send_sap_msg(mei->cldev,
SAP_MSG_NOTIF_WIFIDR_UP);
SAP_MSG_NOTIF_WIFIDR_UP,
false);
ops->rfkill(priv, mei->link_prot_state);
}
}
Expand Down Expand Up @@ -2111,7 +2112,7 @@ static void iwl_mei_remove(struct mei_cl_device *cldev)
spin_unlock_bh(&mei->data_q_lock);

if (iwl_mei_cache.ops)
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, false);
iwl_mei_cache.ops->rfkill(iwl_mei_cache.priv, false, false);

/*
* mei_cldev_disable will return only after all the MEI Rx is done.
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/wireless/intel/iwlwifi/mvm/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,14 @@ static void iwl_mvm_me_conn_status(void *priv, const struct iwl_mei_conn_info *c
kfree_rcu(prev_conn_info, rcu_head);
}

static void iwl_mvm_mei_rfkill(void *priv, bool blocked)
static void iwl_mvm_mei_rfkill(void *priv, bool blocked,
bool csme_taking_ownership)
{
struct iwl_mvm *mvm = priv;

if (blocked && !csme_taking_ownership)
return;

mvm->mei_rfkill_blocked = blocked;
if (!mvm->hw_registered)
return;
Expand Down

0 comments on commit 22b68fc

Please sign in to comment.