Commit 30de48b4 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Kalle Valo

iwlwifi: mei: report RFKILL upon register when needed

When we register and we are in link protection passive, meaning
that the host can't touch the device, report RFKILL immediately
upon register() and don't wait for the CSME firmware to let us
know again about the link protection state.

What happens if we wait is that the host will not see RFKILL soon
enough and we'll have a window of time during which it can bring
up the device which will request ownership.

Fixes: 2da4366f ("iwlwifi: mei: add the driver to allow cooperation with CSME")
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/iwlwifi.20220128142706.a136f9f46336.Ief7506dc3b1813a1943a5a639aa45d8e5f284f31@changeid
parent 7cf800f4
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (C) 2021 Intel Corporation * Copyright (C) 2021-2022 Intel Corporation
*/ */
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -146,6 +146,7 @@ struct iwl_mei_filters { ...@@ -146,6 +146,7 @@ struct iwl_mei_filters {
* @csme_taking_ownership: true when CSME is taking ownership. Used to remember * @csme_taking_ownership: true when CSME is taking ownership. Used to remember
* to send CSME_OWNERSHIP_CONFIRMED when the driver completes its down * to send CSME_OWNERSHIP_CONFIRMED when the driver completes its down
* flow. * flow.
* @link_prot_state: true when we are in link protection PASSIVE
* @csa_throttle_end_wk: used when &csa_throttled is true * @csa_throttle_end_wk: used when &csa_throttled is true
* @data_q_lock: protects the access to the data queues which are * @data_q_lock: protects the access to the data queues which are
* accessed without the mutex. * accessed without the mutex.
...@@ -165,6 +166,7 @@ struct iwl_mei { ...@@ -165,6 +166,7 @@ struct iwl_mei {
bool amt_enabled; bool amt_enabled;
bool csa_throttled; bool csa_throttled;
bool csme_taking_ownership; bool csme_taking_ownership;
bool link_prot_state;
struct delayed_work csa_throttle_end_wk; struct delayed_work csa_throttle_end_wk;
spinlock_t data_q_lock; spinlock_t data_q_lock;
...@@ -667,6 +669,8 @@ iwl_mei_handle_conn_status(struct mei_cl_device *cldev, ...@@ -667,6 +669,8 @@ iwl_mei_handle_conn_status(struct mei_cl_device *cldev,
iwl_mei_cache.ops->me_conn_status(iwl_mei_cache.priv, &conn_info); iwl_mei_cache.ops->me_conn_status(iwl_mei_cache.priv, &conn_info);
mei->link_prot_state = status->link_prot_state;
/* /*
* Update the Rfkill state in case the host does not own the device: * Update the Rfkill state in case the host does not own the device:
* if we are in Link Protection, ask to not touch the device, else, * if we are in Link Protection, ask to not touch the device, else,
...@@ -1661,9 +1665,11 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops) ...@@ -1661,9 +1665,11 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops)
mei_cldev_get_drvdata(iwl_mei_global_cldev); mei_cldev_get_drvdata(iwl_mei_global_cldev);
/* we have already a SAP connection */ /* we have already a SAP connection */
if (iwl_mei_is_connected()) if (iwl_mei_is_connected()) {
iwl_mei_send_sap_msg(mei->cldev, iwl_mei_send_sap_msg(mei->cldev,
SAP_MSG_NOTIF_WIFIDR_UP); SAP_MSG_NOTIF_WIFIDR_UP);
ops->rfkill(priv, mei->link_prot_state);
}
} }
ret = 0; ret = 0;
......
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