Commit be9ae34e authored by Nathan Errera's avatar Nathan Errera Committed by Kalle Valo
Browse files

iwlwifi: mvm: get number of stations from TLV



FW is changing the max number of supported stations. To adapt to the
change we get the max number from the TLV and act according to the new
number.

Signed-off-by: default avatarNathan Errera <nathan.errera@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008180656.863ab470babc.I393223392f36436663c4e66add03fefe77b74e60@changeid
parent 8b2426c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@
#define NUM_MAC_INDEX		(NUM_MAC_INDEX_DRIVER + 1)
#define NUM_MAC_INDEX_CDB	(NUM_MAC_INDEX_DRIVER + 2)

#define IWL_MVM_STATION_COUNT		16
#define IWL_MVM_STATION_COUNT_MAX	16
#define IWL_MVM_INVALID_STA		0xFF

enum iwl_ac {
+4 −6
Original line number Diff line number Diff line
@@ -5,10 +5,9 @@
 *
 * GPL LICENSE SUMMARY
 *
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
 * Copyright (C) 2018 Intel Corporation
 * Copyright(c) 2012 - 2014, 2018, 2020 Intel Corporation
 *
 * 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
@@ -28,9 +27,8 @@
 *
 * BSD LICENSE
 *
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright (C) 2018 Intel Corporation
 * Copyright(c) 2012 - 2014, 2018, 2020 Intel Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
@@ -383,14 +381,14 @@ struct mvm_statistics_load {
	__le32 air_time[MAC_INDEX_AUX];
	__le32 byte_count[MAC_INDEX_AUX];
	__le32 pkt_count[MAC_INDEX_AUX];
	u8 avg_energy[IWL_MVM_STATION_COUNT];
	u8 avg_energy[IWL_MVM_STATION_COUNT_MAX];
} __packed; /* STATISTICS_RX_MAC_STATION_S_VER_3 */

struct mvm_statistics_load_v1 {
	__le32 air_time[NUM_MAC_INDEX];
	__le32 byte_count[NUM_MAC_INDEX];
	__le32 pkt_count[NUM_MAC_INDEX];
	u8 avg_energy[IWL_MVM_STATION_COUNT];
	u8 avg_energy[IWL_MVM_STATION_COUNT_MAX];
} __packed; /* STATISTICS_RX_MAC_STATION_S_VER_1 */

struct mvm_statistics_rx {
+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ struct iwl_ucode_header {
};

#define IWL_UCODE_TLV_DEBUG_BASE	0x1000005
#define IWL_UCODE_TLV_CONST_BASE	0x100

/*
 * new TLV uCode file layout
@@ -147,6 +148,8 @@ enum iwl_ucode_tlv_type {
	IWL_UCODE_TLV_FW_RECOVERY_INFO	= 57,
	IWL_UCODE_TLV_FW_FSEQ_VERSION	= 60,

	IWL_UCODE_TLV_FW_NUM_STATIONS		= IWL_UCODE_TLV_CONST_BASE + 0,

	IWL_UCODE_TLV_TYPE_DEBUG_INFO		= IWL_UCODE_TLV_DEBUG_BASE + 0,
	IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION	= IWL_UCODE_TLV_DEBUG_BASE + 1,
	IWL_UCODE_TLV_TYPE_HCMD			= IWL_UCODE_TLV_DEBUG_BASE + 2,
+1 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ struct iwl_ucode_capabilities {
	u32 flags;
	u32 error_log_addr;
	u32 error_log_size;
	u32 num_stations;
	unsigned long _api[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_API)];
	unsigned long _capa[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_CAPA)];

+15 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@
#include "iwl-config.h"
#include "iwl-modparams.h"
#include "fw/api/alive.h"
#include "fw/api/mac.h"

/******************************************************************************
 *
@@ -1127,6 +1128,19 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
				 fseq_ver->version);
			}
			break;
		case IWL_UCODE_TLV_FW_NUM_STATIONS:
			if (tlv_len != sizeof(u32))
				goto invalid_tlv_len;
			if (le32_to_cpup((__le32 *)tlv_data) >
			    IWL_MVM_STATION_COUNT_MAX) {
				IWL_ERR(drv,
					"%d is an invalid number of station\n",
					le32_to_cpup((__le32 *)tlv_data));
				goto tlv_error;
			}
			capa->num_stations =
				le32_to_cpup((__le32 *)tlv_data);
			break;
		case IWL_UCODE_TLV_UMAC_DEBUG_ADDRS: {
			struct iwl_umac_debug_addrs *dbg_ptrs =
				(void *)tlv_data;
@@ -1348,6 +1362,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
	fw->ucode_capa.standard_phy_calibration_size =
			IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE;
	fw->ucode_capa.n_scan_channels = IWL_DEFAULT_SCAN_CHANNELS;
	fw->ucode_capa.num_stations = IWL_MVM_STATION_COUNT_MAX;
	/* dump all fw memory areas by default */
	fw->dbg.dump_mask = 0xffffffff;

Loading