Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee9219b2 authored by Avraham Stern's avatar Avraham Stern Committed by Emmanuel Grumbach
Browse files

iwlwifi: mvm: add UMAC scan iteration complete notification



Add UMAC scan iteration complete notification. This notification can
be enabled by setting scan_iter_notif_enabled through debugfs.
Upon receiving this notification, print the list of channels that
have been scanned in this iteration. This is useful for debugging.

Signed-off-by: default avatarAvraham Stern <avraham.stern@intel.com>
Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 1fa1bcc0
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -837,4 +837,27 @@ struct iwl_scan_offload_profiles_query {
	struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
} __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */

/**
 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
 * @scanned_channels: number of channels scanned and number of valid elements in
 *	results array
 * @status: one of SCAN_COMP_STATUS_*
 * @bt_status: BT on/off status
 * @last_channel: last channel that was scanned
 * @tsf_low: TSF timer (lower half) in usecs
 * @tsf_high: TSF timer (higher half) in usecs
 * @results: array of scan results, only "scanned_channels" of them are valid
 */
struct iwl_umac_scan_iter_complete_notif {
	__le32 uid;
	u8 scanned_channels;
	u8 status;
	u8 bt_status;
	u8 last_channel;
	__le32 tsf_low;
	__le32 tsf_high;
	struct iwl_scan_results_notif results[];
} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */

#endif
+3 −2
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
 * GPL LICENSE SUMMARY
 *
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 *
 * 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
@@ -32,7 +32,7 @@
 * BSD LICENSE
 *
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
@@ -108,6 +108,7 @@ enum {
	ANTENNA_COUPLING_NOTIFICATION = 0xa,

	/* UMAC scan commands */
	SCAN_ITERATION_COMPLETE_UMAC = 0xb5,
	SCAN_CFG_CMD = 0xc,
	SCAN_REQ_UMAC = 0xd,
	SCAN_ABORT_UMAC = 0xe,
+3 −0
Original line number Diff line number Diff line
@@ -1150,6 +1150,9 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm);
int iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
					struct iwl_rx_cmd_buffer *rxb,
					struct iwl_device_cmd *cmd);
int iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
					     struct iwl_rx_cmd_buffer *rxb,
					     struct iwl_device_cmd *cmd);

/* MVM debugfs */
#ifdef CONFIG_IWLWIFI_DEBUGFS
+3 −0
Original line number Diff line number Diff line
@@ -245,6 +245,8 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
		   false),
	RX_HANDLER(SCAN_COMPLETE_UMAC, iwl_mvm_rx_umac_scan_complete_notif,
		   true),
	RX_HANDLER(SCAN_ITERATION_COMPLETE_UMAC,
		   iwl_mvm_rx_umac_scan_iter_complete_notif, false),

	RX_HANDLER(CARD_STATE_NOTIFICATION, iwl_mvm_rx_card_state_notif, false),

@@ -356,6 +358,7 @@ static const char *const iwl_mvm_cmd_strings[REPLY_MAX] = {
	CMD(TDLS_CHANNEL_SWITCH_NOTIFICATION),
	CMD(TDLS_CONFIG_CMD),
	CMD(MCC_UPDATE_CMD),
	CMD(SCAN_ITERATION_COMPLETE_UMAC),
};
#undef CMD

+21 −0
Original line number Diff line number Diff line
@@ -1181,6 +1181,10 @@ static u32 iwl_mvm_scan_umac_flags(struct iwl_mvm *mvm,
	if (iwl_mvm_scan_total_iterations(params) > 1)
		flags |= IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC;

#ifdef CONFIG_IWLWIFI_DEBUGFS
	if (mvm->scan_iter_notif_enabled)
		flags |= IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE;
#endif
	return flags;
}

@@ -1522,6 +1526,23 @@ int iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
	return 0;
}

int iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
					     struct iwl_rx_cmd_buffer *rxb,
					     struct iwl_device_cmd *cmd)
{
	struct iwl_rx_packet *pkt = rxb_addr(rxb);
	struct iwl_umac_scan_iter_complete_notif *notif = (void *)pkt->data;
	u8 buf[256];

	IWL_DEBUG_SCAN(mvm,
		       "UMAC Scan iteration complete: status=0x%x scanned_channels=%d channels list: %s\n",
		       notif->status, notif->scanned_channels,
		       iwl_mvm_dump_channel_list(notif->results,
						 notif->scanned_channels, buf,
						 sizeof(buf)));
	return 0;
}

static bool iwl_scan_umac_done_check(struct iwl_notif_wait_data *notif_wait,
				     struct iwl_rx_packet *pkt, void *data)
{