OSDN Git Service

iwlwifi: mvm: rfi: handle deactivation notification
authorGregory Greenman <gregory.greenman@intel.com>
Sat, 5 Feb 2022 09:21:31 +0000 (11:21 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 18 Feb 2022 08:40:54 +0000 (10:40 +0200)
Sometimes RFIm can be deactivated in FW due to internal
errors. In this case, FW will send a notification to the
driver about that. Add a log message in this case since
FW logs are not always available.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.48d0a1624fec.I8f9271959fc53223fa329ab097b12fd69b498b71@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
drivers/net/wireless/intel/iwlwifi/fw/api/rfi.h
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
drivers/net/wireless/intel/iwlwifi/mvm/rfi.c

index dded6e8..a91bd66 100644 (file)
@@ -605,6 +605,11 @@ enum iwl_system_subcmd_ids {
         * @SYSTEM_FEATURES_CONTROL_CMD: &struct iwl_system_features_control_cmd
         */
        SYSTEM_FEATURES_CONTROL_CMD = 0xd,
+
+       /**
+        * @RFI_DEACTIVATE_NOTIF: &struct iwl_rfi_deactivate_notif
+        */
+       RFI_DEACTIVATE_NOTIF = 0xff,
 };
 
 #endif /* __iwl_fw_api_commands_h__ */
index c678b9a..1a84a40 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2020 Intel Corporation
+ * Copyright (C) 2020-2021 Intel Corporation
  */
 #ifndef __iwl_fw_api_rfi_h__
 #define __iwl_fw_api_rfi_h__
@@ -57,4 +57,12 @@ struct iwl_rfi_freq_table_resp_cmd {
        __le32 status;
 } __packed; /* RFI_CONFIG_CMD_API_S_VER_1 */
 
+/**
+ * struct iwl_rfi_deactivate_notif - notifcation that FW disaled RFIm
+ *
+ * @reason: used only for a log message
+ */
+struct iwl_rfi_deactivate_notif {
+       __le32 reason;
+} __packed; /* RFI_DEACTIVATE_NTF_S_VER_1 */
 #endif /* __iwl_fw_api_rfi_h__ */
index 3208a76..f6c69a4 100644 (file)
@@ -2099,6 +2099,8 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
 int iwl_rfi_send_config_cmd(struct iwl_mvm *mvm,
                            struct iwl_rfi_lut_entry *rfi_table);
 struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm);
+void iwl_rfi_deactivate_notif_handler(struct iwl_mvm *mvm,
+                                     struct iwl_rx_cmd_buffer *rxb);
 
 static inline u8 iwl_mvm_phy_band_from_nl80211(enum nl80211_band band)
 {
index 1bf0049..17fc1f6 100644 (file)
@@ -24,6 +24,7 @@
 #include "iwl-prph.h"
 #include "rs.h"
 #include "fw/api/scan.h"
+#include "fw/api/rfi.h"
 #include "time-event.h"
 #include "fw-api.h"
 #include "fw/acpi.h"
@@ -396,6 +397,10 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
                       iwl_mvm_rx_thermal_dual_chain_req,
                       RX_HANDLER_ASYNC_LOCKED,
                       struct iwl_thermal_dual_chain_request),
+
+       RX_HANDLER_GRP(SYSTEM_GROUP, RFI_DEACTIVATE_NOTIF,
+                      iwl_rfi_deactivate_notif_handler, RX_HANDLER_ASYNC_UNLOCKED,
+                      struct iwl_rfi_deactivate_notif),
 };
 #undef RX_HANDLER
 #undef RX_HANDLER_GRP
@@ -505,6 +510,7 @@ static const struct iwl_hcmd_names iwl_mvm_system_names[] = {
        HCMD_NAME(RFI_CONFIG_CMD),
        HCMD_NAME(RFI_GET_FREQ_TABLE_CMD),
        HCMD_NAME(SYSTEM_FEATURES_CONTROL_CMD),
+       HCMD_NAME(RFI_DEACTIVATE_NOTIF),
 };
 
 /* Please keep this array *SORTED* by hex value.
index f054ce7..7acb2be 100644 (file)
@@ -134,3 +134,12 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm)
        iwl_free_resp(&cmd);
        return resp;
 }
+
+void iwl_rfi_deactivate_notif_handler(struct iwl_mvm *mvm,
+                                     struct iwl_rx_cmd_buffer *rxb)
+{
+       struct iwl_rx_packet *pkt = rxb_addr(rxb);
+       struct iwl_rfi_deactivate_notif *notif = (void *)pkt->data;
+
+       IWL_INFO(mvm, "RFIm is deactivated, reason = %d\n", notif->reason);
+}