Initial commit
This commit is contained in:
		
							
								
								
									
										96
									
								
								package/kernel/ath10k-ct/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								package/kernel/ath10k-ct/Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,96 @@ | ||||
| include $(TOPDIR)/rules.mk | ||||
|  | ||||
| PKG_NAME:=ath10k-ct | ||||
| PKG_RELEASE=3 | ||||
|  | ||||
| PKG_LICENSE:=GPLv2 | ||||
| PKG_LICENSE_FILES:= | ||||
|  | ||||
| PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_DATE:=2018-03-16 | ||||
| PKG_SOURCE_VERSION:=30827f7d5b9841905c4efe918da2d95fc518c921 | ||||
| PKG_MIRROR_HASH:=aac023d7f9b09becf27058b1d09ae6d068b14bb6f10c5b5a248c7ee5ecff04dc | ||||
|  | ||||
| # Build the 4.13 ath10k-ct driver version.  Other options are "-4.9", or | ||||
| # leave un-defined for 4.7 kernel.  Probably this should match as closely as | ||||
| # possible to whatever mac80211 backports version is being used. | ||||
| CT_KVER="-4.13" | ||||
|  | ||||
| PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com> | ||||
| PKG_BUILD_PARALLEL:=1 | ||||
| PKG_EXTMOD_SUBDIRS:=ath10k$(CT_KVER) | ||||
|  | ||||
| STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h | ||||
|  | ||||
| include $(INCLUDE_DIR)/kernel.mk | ||||
| include $(INCLUDE_DIR)/package.mk | ||||
|  | ||||
| define KernelPackage/ath10k-ct | ||||
|   SUBMENU:=Wireless Drivers | ||||
|   TITLE:=ath10k-ct driver optimized for CT ath10k firmware | ||||
|   DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT +kmod-hwmon-core | ||||
|   FILES:=\ | ||||
| 	$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \ | ||||
| 	$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko | ||||
|   AUTOLOAD:=$(call AutoProbe,ath10k_pci) | ||||
|   PROVIDES:=kmod-ath10k | ||||
| endef | ||||
|  | ||||
| NOSTDINC_FLAGS = \ | ||||
| 	-I$(PKG_BUILD_DIR) \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211-backport \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211/uapi \ | ||||
| 	-I$(STAGING_DIR)/usr/include/mac80211 \ | ||||
| 	-include backport/autoconf.h \ | ||||
| 	-include backport/backport.h | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_MESH | ||||
|   NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH | ||||
| endif | ||||
|  | ||||
| CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m | ||||
|  | ||||
| # This AHB logic is needed for IPQ4019 radios | ||||
| CT_MAKEDEFS += CONFIG_ATH10K_AHB=m | ||||
| NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB | ||||
|  | ||||
| NOSTDINC_FLAGS += -DSTANDALONE_CT | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS | ||||
|   CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y | ||||
|   NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_ATH_DEBUG | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_ATH_DFS | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_DFS_CERTIFIED | ||||
| endif | ||||
|  | ||||
| ifdef CONFIG_PACKAGE_ATH_SPECTRAL | ||||
|   CT_MAKEDEFS += CONFIG_ATH10K_SPECTRAL=y | ||||
|   NOSTDINC_FLAGS += -DCONFIG_ATH10K_SPECTRAL | ||||
| endif | ||||
|  | ||||
| define Build/Configure | ||||
| 	cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR) | ||||
| endef | ||||
|  | ||||
| ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) | ||||
|   CT_MAKEDEFS += V=1 | ||||
| endif | ||||
|  | ||||
| define Build/Compile | ||||
| 	+$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \ | ||||
| 		$(KERNEL_MAKE_FLAGS) \ | ||||
| 		SUBDIRS="$(PKG_BUILD_DIR)/ath10k$(CT_KVER)" \ | ||||
| 		NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ | ||||
| 		modules | ||||
| endef | ||||
|  | ||||
| $(eval $(call KernelPackage,ath10k-ct)) | ||||
| @@ -0,0 +1,113 @@ | ||||
| From d06f26c5c8a41f246a9c40862a77a55725cedbd3 Mon Sep 17 00:00:00 2001 | ||||
| From: Sven Eckelmann <sven.eckelmann@openmesh.com> | ||||
| Date: Fri, 8 Dec 2017 11:37:42 +0100 | ||||
| Subject: ath10k: search DT for qcom,ath10k-calibration-variant | ||||
|  | ||||
| Board Data File (BDF) is loaded upon driver boot-up procedure. The right | ||||
| board data file is identified on QCA4019 using bus, bmi-chip-id and | ||||
| bmi-board-id. | ||||
|  | ||||
| The problem, however, can occur when the (default) board data file cannot | ||||
| fulfill with the vendor requirements and it is necessary to use a different | ||||
| board data file. | ||||
|  | ||||
| This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8. | ||||
| Something similar has to be provided for systems without SMBIOS but with | ||||
| device trees. No solution was specified by QCA and therefore a new one has | ||||
| to be found for ath10k. | ||||
|  | ||||
| The device tree requires addition strings to define the variant name | ||||
|  | ||||
|     wifi@a000000 { | ||||
|     	status = "okay"; | ||||
|     	qcom,ath10k-calibration-variant = "RT-AC58U"; | ||||
|     }; | ||||
|  | ||||
|     wifi@a800000 { | ||||
|     	status = "okay"; | ||||
|     	qcom,ath10k-calibration-variant = "RT-AC58U"; | ||||
|     }; | ||||
|  | ||||
| This would create the boarddata identifiers for the board-2.bin search | ||||
|  | ||||
|  *  bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U | ||||
|  *  bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U | ||||
|  | ||||
| Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com> | ||||
| Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> | ||||
|  | ||||
| Origin: upstream, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d06f26c5c8a41f246a9c40862a77a55725cedbd3 | ||||
| --- | ||||
|  ath10k-4.13/core.c | 40 ++++++++++++++++++++++++++++------ | ||||
|  1 file changed, 33 insertions(+), 7 deletions(-) | ||||
|  | ||||
| --- a/ath10k-4.13/core.c | ||||
| +++ b/ath10k-4.13/core.c | ||||
| @@ -889,6 +889,28 @@ static int ath10k_core_check_smbios(stru | ||||
|  	return 0; | ||||
|  } | ||||
|   | ||||
| +static int ath10k_core_check_dt(struct ath10k *ar) | ||||
| +{ | ||||
| +	struct device_node *node; | ||||
| +	const char *variant = NULL; | ||||
| + | ||||
| +	node = ar->dev->of_node; | ||||
| +	if (!node) | ||||
| +		return -ENOENT; | ||||
| + | ||||
| +	of_property_read_string(node, "qcom,ath10k-calibration-variant", | ||||
| +				&variant); | ||||
| +	if (!variant) | ||||
| +		return -ENODATA; | ||||
| + | ||||
| +	if (strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)) < 0) | ||||
| +		ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||||
| +			   "bdf variant string is longer than the buffer can accommodate (variant: %s)\n", | ||||
| +			    variant); | ||||
| + | ||||
| +	return 0; | ||||
| +} | ||||
| + | ||||
|  static int ath10k_download_and_run_otp(struct ath10k *ar) | ||||
|  { | ||||
|  	u32 result, address = ar->hw_params.patch_load_addr; | ||||
| @@ -1522,19 +1544,19 @@ static int ath10k_core_create_board_name | ||||
|  	/* strlen(',variant=') + strlen(ar->id.bdf_ext) */ | ||||
|  	char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; | ||||
|   | ||||
| +	if (ar->id.bdf_ext[0] != '\0') | ||||
| +		scnprintf(variant, sizeof(variant), ",variant=%s", | ||||
| +			  ar->id.bdf_ext); | ||||
| + | ||||
|  	if (ar->id.bmi_ids_valid) { | ||||
|  		scnprintf(name, name_len, | ||||
| -			  "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", | ||||
| +			  "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s", | ||||
|  			  ath10k_bus_str(ar->hif.bus), | ||||
|  			  ar->id.bmi_chip_id, | ||||
| -			  ar->id.bmi_board_id); | ||||
| +			  ar->id.bmi_board_id, variant); | ||||
|  		goto out; | ||||
|  	} | ||||
|   | ||||
| -	if (ar->id.bdf_ext[0] != '\0') | ||||
| -		scnprintf(variant, sizeof(variant), ",variant=%s", | ||||
| -			  ar->id.bdf_ext); | ||||
| - | ||||
|  	scnprintf(name, name_len, | ||||
|  		  "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", | ||||
|  		  ath10k_bus_str(ar->hif.bus), | ||||
| @@ -2964,7 +2986,11 @@ static int ath10k_core_probe_fw(struct a | ||||
|   | ||||
|  	ret = ath10k_core_check_smbios(ar); | ||||
|  	if (ret) | ||||
| -		ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n"); | ||||
| +		ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n"); | ||||
| + | ||||
| +	ret = ath10k_core_check_dt(ar); | ||||
| +	if (ret) | ||||
| +		ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n"); | ||||
|   | ||||
|  	ret = ath10k_core_fetch_board_file(ar); | ||||
|  	if (ret) { | ||||
							
								
								
									
										97
									
								
								package/kernel/ath10k-ct/patches/100-kernel_compat.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								package/kernel/ath10k-ct/patches/100-kernel_compat.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,97 @@ | ||||
| --- a/ath10k/debug.c | ||||
| +++ b/ath10k/debug.c | ||||
| @@ -166,11 +166,11 @@ void ath10k_debug_print_hwfw_info(struct | ||||
|  		    ar->id.subsystem_vendor, ar->id.subsystem_device); | ||||
|   | ||||
|  	ath10k_info(ar, "kconfig debug %d debugfs %d tracing %d dfs %d testmode %d\n", | ||||
| -		    config_enabled(CONFIG_ATH10K_DEBUG), | ||||
| -		    config_enabled(CONFIG_ATH10K_DEBUGFS), | ||||
| -		    config_enabled(CONFIG_ATH10K_TRACING), | ||||
| -		    config_enabled(CONFIG_ATH10K_DFS_CERTIFIED), | ||||
| -		    config_enabled(CONFIG_NL80211_TESTMODE)); | ||||
| +		    IS_ENABLED(CONFIG_ATH10K_DEBUG), | ||||
| +		    IS_ENABLED(CONFIG_ATH10K_DEBUGFS), | ||||
| +		    IS_ENABLED(CONFIG_ATH10K_TRACING), | ||||
| +		    IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED), | ||||
| +		    IS_ENABLED(CONFIG_NL80211_TESTMODE)); | ||||
|   | ||||
|  	firmware = ar->normal_mode_fw.fw_file.firmware; | ||||
|  	if (firmware) | ||||
| @@ -3422,7 +3422,7 @@ int ath10k_debug_register(struct ath10k | ||||
|  	debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR, | ||||
|  			    ar->debug.debugfs_phy, ar, &fops_nf_cal_period); | ||||
|   | ||||
| -	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) { | ||||
| +	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { | ||||
|  		debugfs_create_file("dfs_simulate_radar", S_IWUSR, | ||||
|  				    ar->debug.debugfs_phy, ar, | ||||
|  				    &fops_simulate_radar); | ||||
| --- a/ath10k/mac.c | ||||
| +++ b/ath10k/mac.c | ||||
| @@ -3604,7 +3604,7 @@ static void ath10k_regd_update(struct at | ||||
|   | ||||
|  	regpair = ar->ath_common.regulatory.regpair; | ||||
|   | ||||
| -	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { | ||||
| +	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { | ||||
|  		nl_dfs_reg = ar->dfs_detector->region; | ||||
|  		wmi_dfs_reg = ath10k_mac_get_dfs_region(nl_dfs_reg); | ||||
|  		ath10k_dbg(ar, ATH10K_DBG_REGULATORY, | ||||
| @@ -3638,7 +3638,7 @@ static void ath10k_reg_notifier(struct w | ||||
|   | ||||
|  	ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory); | ||||
|   | ||||
| -	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { | ||||
| +	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { | ||||
|  		ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "reg-notifier: dfs region 0x%x\n", | ||||
|  			   request->dfs_region); | ||||
|  		result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, | ||||
| @@ -8938,7 +8938,7 @@ int ath10k_mac_register(struct ath10k *a | ||||
|  	if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) | ||||
|  		ar->hw->netdev_features = NETIF_F_HW_CSUM; | ||||
|   | ||||
| -	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) { | ||||
| +	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { | ||||
|  		/* Init ath dfs pattern detector */ | ||||
|  		ar->ath_common.debug_mask = ATH_DBG_DFS; | ||||
|  		ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, | ||||
| @@ -8983,7 +8983,7 @@ err_unregister: | ||||
|  	ieee80211_unregister_hw(ar->hw); | ||||
|   | ||||
|  err_dfs_detector_exit: | ||||
| -	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) | ||||
| +	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) | ||||
|  		ar->dfs_detector->exit(ar->dfs_detector); | ||||
|   | ||||
|  err_free: | ||||
| @@ -8998,7 +8998,7 @@ void ath10k_mac_unregister(struct ath10k | ||||
|  { | ||||
|  	ieee80211_unregister_hw(ar->hw); | ||||
|   | ||||
| -	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) | ||||
| +	if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) | ||||
|  		ar->dfs_detector->exit(ar->dfs_detector); | ||||
|   | ||||
|  	kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); | ||||
| --- a/ath10k/thermal.c | ||||
| +++ b/ath10k/thermal.c | ||||
| @@ -192,7 +192,7 @@ int ath10k_thermal_register(struct ath10 | ||||
|   | ||||
|  	/* Avoid linking error on devm_hwmon_device_register_with_groups, I | ||||
|  	 * guess linux/hwmon.h is missing proper stubs. */ | ||||
| -	if (!config_enabled(CONFIG_HWMON)) | ||||
| +	if (!IS_ENABLED(CONFIG_HWMON)) | ||||
|  		return 0; | ||||
|   | ||||
|  	hwmon_dev = devm_hwmon_device_register_with_groups(ar->dev, | ||||
| --- a/ath10k/wmi.c | ||||
| +++ b/ath10k/wmi.c | ||||
| @@ -3883,7 +3883,7 @@ void ath10k_wmi_event_dfs(struct ath10k | ||||
|  		   phyerr->tsf_timestamp, tsf, buf_len); | ||||
|   | ||||
|  	/* Skip event if DFS disabled */ | ||||
| -	if (!config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) | ||||
| +	if (!IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) | ||||
|  		return; | ||||
|   | ||||
|  	ATH10K_DFS_STAT_INC(ar, pulses_total); | ||||
							
								
								
									
										11
									
								
								package/kernel/ath10k-ct/patches/110-api_fix.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								package/kernel/ath10k-ct/patches/110-api_fix.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| --- a/ath10k/htt_rx.c | ||||
| +++ b/ath10k/htt_rx.c | ||||
| @@ -2514,7 +2514,7 @@ bool ath10k_htt_t2h_msg_handler(struct a | ||||
|  		u32 freq = __le32_to_cpu(resp->chan_change.freq); | ||||
|   | ||||
|  		ar->tgt_oper_chan = | ||||
| -			__ieee80211_get_channel(ar->hw->wiphy, freq); | ||||
| +			ieee80211_get_channel(ar->hw->wiphy, freq); | ||||
|  		ath10k_dbg(ar, ATH10K_DBG_HTT, | ||||
|  			   "htt chan change freq %u phymode %s\n", | ||||
|  			   freq, ath10k_wmi_phymode_str(phymode)); | ||||
							
								
								
									
										104
									
								
								package/kernel/ath10k-ct/patches/120-mac80211-4-14-api.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								package/kernel/ath10k-ct/patches/120-mac80211-4-14-api.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,104 @@ | ||||
| --- a/ath10k/htt_rx.c | ||||
| +++ b/ath10k/htt_rx.c | ||||
| @@ -642,11 +642,11 @@ static void ath10k_htt_rx_h_rates(struct | ||||
|  		sgi = (info3 >> 7) & 1; | ||||
|   | ||||
|  		status->rate_idx = mcs; | ||||
| -		status->flag |= RX_FLAG_HT; | ||||
| +		status->encoding = RX_ENC_HT; | ||||
|  		if (sgi) | ||||
| -			status->flag |= RX_FLAG_SHORT_GI; | ||||
| +			status->enc_flags |= RX_ENC_FLAG_SHORT_GI; | ||||
|  		if (bw) | ||||
| -			status->flag |= RX_FLAG_40MHZ; | ||||
| +			status->bw = RATE_INFO_BW_40; | ||||
|  		break; | ||||
|  	case HTT_RX_VHT: | ||||
|  	case HTT_RX_VHT_WITH_TXBF: | ||||
| @@ -698,10 +698,10 @@ static void ath10k_htt_rx_h_rates(struct | ||||
|  		} | ||||
|   | ||||
|  		status->rate_idx = mcs; | ||||
| -		status->vht_nss = nss; | ||||
| +		status->nss = nss; | ||||
|   | ||||
|  		if (sgi) | ||||
| -			status->flag |= RX_FLAG_SHORT_GI; | ||||
| +			status->enc_flags |= RX_ENC_FLAG_SHORT_GI; | ||||
|   | ||||
|  		switch (bw) { | ||||
|  		/* 20MHZ */ | ||||
| @@ -709,18 +709,18 @@ static void ath10k_htt_rx_h_rates(struct | ||||
|  			break; | ||||
|  		/* 40MHZ */ | ||||
|  		case 1: | ||||
| -			status->flag |= RX_FLAG_40MHZ; | ||||
| +			status->bw = RATE_INFO_BW_40; | ||||
|  			break; | ||||
|  		/* 80MHZ */ | ||||
|  		case 2: | ||||
| -			status->vht_flag |= RX_VHT_FLAG_80MHZ; | ||||
| +			status->bw = RATE_INFO_BW_80; | ||||
|  			break; | ||||
|  		case 3: | ||||
| -			status->vht_flag |= RX_VHT_FLAG_160MHZ; | ||||
| +			status->bw = RATE_INFO_BW_160; | ||||
|  			break; | ||||
|  		} | ||||
|   | ||||
| -		status->flag |= RX_FLAG_VHT; | ||||
| +		status->encoding = RX_ENC_VHT; | ||||
|  		break; | ||||
|  	default: | ||||
|  		break; | ||||
| @@ -900,13 +900,10 @@ static void ath10k_htt_rx_h_ppdu(struct | ||||
|  		/* New PPDU starts so clear out the old per-PPDU status. */ | ||||
|  		status->freq = 0; | ||||
|  		status->rate_idx = 0; | ||||
| -		status->vht_nss = 0; | ||||
| -		status->vht_flag &= ~RX_VHT_FLAG_80MHZ; | ||||
| -		status->flag &= ~(RX_FLAG_HT | | ||||
| -				  RX_FLAG_VHT | | ||||
| -				  RX_FLAG_SHORT_GI | | ||||
| -				  RX_FLAG_40MHZ | | ||||
| -				  RX_FLAG_MACTIME_END); | ||||
| +		status->nss = 0; | ||||
| +		status->encoding = RX_ENC_LEGACY; | ||||
| +		status->bw = RATE_INFO_BW_20; | ||||
| +		status->flag &= ~RX_FLAG_MACTIME_END; | ||||
|  		status->flag |= RX_FLAG_NO_SIGNAL_VAL; | ||||
|   | ||||
|  		ath10k_htt_rx_h_signal(ar, status, rxd); | ||||
| @@ -959,7 +956,7 @@ static void ath10k_process_rx(struct ath | ||||
|  	*status = *rx_status; | ||||
|   | ||||
|  	ath10k_dbg(ar, ATH10K_DBG_DATA, | ||||
| -		   "rx skb %p len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%llx fcs-err %i mic-err %i amsdu-more %i\n", | ||||
| +		   "rx skb %p len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", | ||||
|  		   skb, | ||||
|  		   skb->len, | ||||
|  		   ieee80211_get_SA(hdr), | ||||
| @@ -967,15 +964,15 @@ static void ath10k_process_rx(struct ath | ||||
|  		   is_multicast_ether_addr(ieee80211_get_DA(hdr)) ? | ||||
|  							"mcast" : "ucast", | ||||
|  		   (__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4, | ||||
| -		   status->flag == 0 ? "legacy" : "", | ||||
| -		   status->flag & RX_FLAG_HT ? "ht" : "", | ||||
| -		   status->flag & RX_FLAG_VHT ? "vht" : "", | ||||
| -		   status->flag & RX_FLAG_40MHZ ? "40" : "", | ||||
| -		   status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "", | ||||
| -		   status->vht_flag & RX_VHT_FLAG_160MHZ ? "160" : "", | ||||
| -		   status->flag & RX_FLAG_SHORT_GI ? "sgi " : "", | ||||
| +		   (status->encoding == RX_ENC_LEGACY) ? "legacy" : "", | ||||
| +		   (status->encoding == RX_ENC_HT) ? "ht" : "", | ||||
| +		   (status->encoding == RX_ENC_VHT) ? "vht" : "", | ||||
| +		   (status->bw == RATE_INFO_BW_40) ? "40" : "", | ||||
| +		   (status->bw == RATE_INFO_BW_80) ? "80" : "", | ||||
| +		   (status->bw == RATE_INFO_BW_160) ? "160" : "", | ||||
| +		   status->enc_flags & RX_ENC_FLAG_SHORT_GI ? "sgi " : "", | ||||
|  		   status->rate_idx, | ||||
| -		   status->vht_nss, | ||||
| +		   status->nss, | ||||
|  		   status->freq, | ||||
|  		   status->band, status->flag, | ||||
|  		   !!(status->flag & RX_FLAG_FAILED_FCS_CRC), | ||||
| @@ -0,0 +1,249 @@ | ||||
| From: Thomas Hebb <tommyhebb@gmail.com> | ||||
| Date: Fri, 13 Apr 2018 17:40:26 +0300 | ||||
| Subject: [PATCH] ath10k: search all IEs for variant before falling back | ||||
|  | ||||
| commit f2593cb1b291 ("ath10k: Search SMBIOS for OEM board file | ||||
| extension") added a feature to ath10k that allows Board Data File | ||||
| (BDF) conflicts between multiple devices that use the same device IDs | ||||
| but have different calibration requirements to be resolved by allowing | ||||
| a "variant" string to be stored in SMBIOS [and later device tree, added | ||||
| by commit d06f26c5c8a4 ("ath10k: search DT for qcom,ath10k-calibration- | ||||
| variant")] that gets appended to the ID stored in board-2.bin. | ||||
|  | ||||
| This original patch had a regression, however. Namely that devices with | ||||
| a variant present in SMBIOS that didn't need custom BDFs could no longer | ||||
| find the default BDF, which has no variant appended. The patch was | ||||
| reverted and re-applied with a fix for this issue in commit 1657b8f84ed9 | ||||
| ("search SMBIOS for OEM board file extension"). | ||||
|  | ||||
| But the fix to fall back to a default BDF introduced another issue: the | ||||
| driver currently parses IEs in board-2.bin one by one, and for each one | ||||
| it first checks to see if it matches the ID with the variant appended. | ||||
| If it doesn't, it checks to see if it matches the "fallback" ID with no | ||||
| variant. If a matching BDF is found at any point during this search, the | ||||
| search is terminated and that BDF is used. The issue is that it's very | ||||
| possible (and is currently the case for board-2.bin files present in the | ||||
| ath10k-firmware repository) for the default BDF to occur in an earlier | ||||
| IE than the variant-specific BDF. In this case, the current code will | ||||
| happily choose the default BDF even though a better-matching BDF is | ||||
| present later in the file. | ||||
|  | ||||
| This patch fixes the issue by first searching the entire file for the ID | ||||
| with variant, and searching for the fallback ID only if that search | ||||
| fails. It also includes some code cleanup in the area, as | ||||
| ath10k_core_fetch_board_data_api_n() no longer does its own string | ||||
| mangling to remove the variant from an ID, instead leaving that job to a | ||||
| new flag passed to ath10k_core_create_board_name(). | ||||
|  | ||||
| I've tested this patch on a QCA4019 and verified that the driver behaves | ||||
| correctly for 1) both fallback and variant BDFs present, 2) only fallback | ||||
| BDF present, and 3) no matching BDFs present. | ||||
|  | ||||
| Fixes: 1657b8f84ed9 ("ath10k: search SMBIOS for OEM board file extension") | ||||
| Signed-off-by: Thomas Hebb <tommyhebb@gmail.com> | ||||
| Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | ||||
|  | ||||
| Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c8489668065a283d3027e86e877b103a87f99d22 | ||||
| --- | ||||
|  ath10k-4.13/core.c | 134 ++++++++++++++++++--------------- | ||||
|  1 file changed, 72 insertions(+), 62 deletions(-) | ||||
|  | ||||
| --- a/ath10k-4.13/core.c | ||||
| +++ b/ath10k-4.13/core.c | ||||
| @@ -1419,14 +1419,61 @@ out: | ||||
|  	return ret; | ||||
|  } | ||||
|   | ||||
| +static int ath10k_core_search_bd(struct ath10k *ar, | ||||
| +				 const char *boardname, | ||||
| +				 const u8 *data, | ||||
| +				 size_t len) | ||||
| +{ | ||||
| +	size_t ie_len; | ||||
| +	struct ath10k_fw_ie *hdr; | ||||
| +	int ret = -ENOENT, ie_id; | ||||
| + | ||||
| +	while (len > sizeof(struct ath10k_fw_ie)) { | ||||
| +		hdr = (struct ath10k_fw_ie *)data; | ||||
| +		ie_id = le32_to_cpu(hdr->id); | ||||
| +		ie_len = le32_to_cpu(hdr->len); | ||||
| + | ||||
| +		len -= sizeof(*hdr); | ||||
| +		data = hdr->data; | ||||
| + | ||||
| +		if (len < ALIGN(ie_len, 4)) { | ||||
| +			ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", | ||||
| +				   ie_id, ie_len, len); | ||||
| +			return -EINVAL; | ||||
| +		} | ||||
| + | ||||
| +		switch (ie_id) { | ||||
| +		case ATH10K_BD_IE_BOARD: | ||||
| +			ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, | ||||
| +							    boardname); | ||||
| +			if (ret == -ENOENT) | ||||
| +				/* no match found, continue */ | ||||
| +				break; | ||||
| + | ||||
| +			/* either found or error, so stop searching */ | ||||
| +			goto out; | ||||
| +		} | ||||
| + | ||||
| +		/* jump over the padding */ | ||||
| +		ie_len = ALIGN(ie_len, 4); | ||||
| + | ||||
| +		len -= ie_len; | ||||
| +		data += ie_len; | ||||
| +	} | ||||
| + | ||||
| +out: | ||||
| +	/* return result of parse_bd_ie_board() or -ENOENT */ | ||||
| +	return ret; | ||||
| +} | ||||
| + | ||||
|  static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, | ||||
|  					      const char *boardname, | ||||
| +					      const char *fallback_boardname, | ||||
|  					      const char *filename) | ||||
|  { | ||||
| -	size_t len, magic_len, ie_len; | ||||
| -	struct ath10k_fw_ie *hdr; | ||||
| +	size_t len, magic_len; | ||||
|  	const u8 *data; | ||||
| -	int ret, ie_id; | ||||
| +	int ret; | ||||
|   | ||||
|  	ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, | ||||
|  							ar->hw_params.fw.dir, | ||||
| @@ -1464,73 +1511,28 @@ static int ath10k_core_fetch_board_data_ | ||||
|  	data += magic_len; | ||||
|  	len -= magic_len; | ||||
|   | ||||
| -	while (len > sizeof(struct ath10k_fw_ie)) { | ||||
| -		hdr = (struct ath10k_fw_ie *)data; | ||||
| -		ie_id = le32_to_cpu(hdr->id); | ||||
| -		ie_len = le32_to_cpu(hdr->len); | ||||
| - | ||||
| -		len -= sizeof(*hdr); | ||||
| -		data = hdr->data; | ||||
| - | ||||
| -		if (len < ALIGN(ie_len, 4)) { | ||||
| -			ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", | ||||
| -				   ie_id, ie_len, len); | ||||
| -			ret = -EINVAL; | ||||
| -			goto err; | ||||
| -		} | ||||
| - | ||||
| -		switch (ie_id) { | ||||
| -		case ATH10K_BD_IE_BOARD: | ||||
| -			ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, | ||||
| -							    boardname); | ||||
| -			if (ret == -ENOENT && ar->id.bdf_ext[0] != '\0') { | ||||
| -				/* try default bdf if variant was not found */ | ||||
| -				char *s, *v = ",variant="; | ||||
| -				char boardname2[100]; | ||||
| - | ||||
| -				strlcpy(boardname2, boardname, | ||||
| -					sizeof(boardname2)); | ||||
| - | ||||
| -				s = strstr(boardname2, v); | ||||
| -				if (s) | ||||
| -					*s = '\0';  /* strip ",variant=%s" */ | ||||
| - | ||||
| -				ret = ath10k_core_parse_bd_ie_board(ar, data, | ||||
| -								    ie_len, | ||||
| -								    boardname2); | ||||
| -			} | ||||
| - | ||||
| -			if (ret == -ENOENT) | ||||
| -				/* no match found, continue */ | ||||
| -				break; | ||||
| -			else if (ret) | ||||
| -				/* there was an error, bail out */ | ||||
| -				goto err; | ||||
| - | ||||
| -			/* board data found */ | ||||
| -			goto out; | ||||
| -		} | ||||
| +	/* attempt to find boardname in the IE list */ | ||||
| +	ret = ath10k_core_search_bd(ar, boardname, data, len); | ||||
|   | ||||
| -		/* jump over the padding */ | ||||
| -		ie_len = ALIGN(ie_len, 4); | ||||
| - | ||||
| -		len -= ie_len; | ||||
| -		data += ie_len; | ||||
| -	} | ||||
| +	/* if we didn't find it and have a fallback name, try that */ | ||||
| +	if (ret == -ENOENT && fallback_boardname) | ||||
| +		ret = ath10k_core_search_bd(ar, fallback_boardname, data, len); | ||||
|   | ||||
|  out: | ||||
| -	if (!ar->normal_mode_fw.board_data || !ar->normal_mode_fw.board_len) { | ||||
| +	if (ret == -ENOENT) { | ||||
|  		ath10k_err(ar, | ||||
|  			   "failed to fetch board data for %s from %s/%s\n", | ||||
|  			   boardname, ar->hw_params.fw.dir, filename); | ||||
|  		ret = -ENODATA; | ||||
| -		goto err; | ||||
|  	} | ||||
|   | ||||
|  	/* Save firmware board name so we can display it later. */ | ||||
|  	strlcpy(ar->normal_mode_fw.fw_file.fw_board_name, filename, | ||||
|  		sizeof(ar->normal_mode_fw.fw_file.fw_board_name)); | ||||
|   | ||||
| +	if (ret) | ||||
| +		goto err; | ||||
| + | ||||
|  	return 0; | ||||
|   | ||||
|  err: | ||||
| @@ -1539,12 +1541,12 @@ err: | ||||
|  } | ||||
|   | ||||
|  static int ath10k_core_create_board_name(struct ath10k *ar, char *name, | ||||
| -					 size_t name_len) | ||||
| +					 size_t name_len, bool with_variant) | ||||
|  { | ||||
|  	/* strlen(',variant=') + strlen(ar->id.bdf_ext) */ | ||||
|  	char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; | ||||
|   | ||||
| -	if (ar->id.bdf_ext[0] != '\0') | ||||
| +	if (with_variant && ar->id.bdf_ext[0] != '\0') | ||||
|  		scnprintf(variant, sizeof(variant), ",variant=%s", | ||||
|  			  ar->id.bdf_ext); | ||||
|   | ||||
| @@ -1570,21 +1572,31 @@ out: | ||||
|   | ||||
|  static int ath10k_core_fetch_board_file(struct ath10k *ar) | ||||
|  { | ||||
| -	char boardname[100]; | ||||
| +	char boardname[100], fallback_boardname[100]; | ||||
|  	int ret; | ||||
|   | ||||
| -	ret = ath10k_core_create_board_name(ar, boardname, sizeof(boardname)); | ||||
| +	ret = ath10k_core_create_board_name(ar, boardname, | ||||
| +					    sizeof(boardname), true); | ||||
|  	if (ret) { | ||||
|  		ath10k_err(ar, "failed to create board name: %d", ret); | ||||
|  		return ret; | ||||
|  	} | ||||
|   | ||||
| +	ret = ath10k_core_create_board_name(ar, fallback_boardname, | ||||
| +					    sizeof(boardname), false); | ||||
| +	if (ret) { | ||||
| +		ath10k_err(ar, "failed to create fallback board name: %d", ret); | ||||
| +		return ret; | ||||
| +	} | ||||
| + | ||||
|  	ar->bd_api = 2; | ||||
|  	if (ar->fwcfg.bname[0]) | ||||
|  		ret = ath10k_core_fetch_board_data_api_n(ar, boardname, | ||||
| +							 fallback_boardname, | ||||
|  							 ar->fwcfg.bname); | ||||
|  	else | ||||
|  		ret = ath10k_core_fetch_board_data_api_n(ar, boardname, | ||||
| +							 fallback_boardname, | ||||
|  							 ATH10K_BOARD_API2_FILE); | ||||
|  	if (!ret) | ||||
|  		goto success; | ||||
| @@ -0,0 +1,81 @@ | ||||
| From 42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61 Mon Sep 17 00:00:00 2001 | ||||
| Message-Id: <42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61.1515610034.git.mschiffer@universe-factory.net> | ||||
| In-Reply-To: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> | ||||
| References: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> | ||||
| From: Matthias Schiffer <mschiffer@universe-factory.net> | ||||
| Date: Mon, 27 Nov 2017 18:56:23 +0100 | ||||
| Subject: [PATCH 2/2] ath10k: move spectral scan support under a separate | ||||
|  config symbol | ||||
|  | ||||
| At the moment, spectral scan support, and with it RELAY, is always enabled | ||||
| with ATH10K_DEBUGFS. Spectral scan support is currently the only user of | ||||
| RELAY in ath10k, and it unconditionally reserves a relay channel. | ||||
|  | ||||
| Having debugfs support in ath10k is often useful even on very small | ||||
| embedded routers, where we'd rather like to avoid the code size and RAM | ||||
| usage of the relay support. While ath10k-based devices usually have more | ||||
| resources than ath9k-based ones, it makes sense to keep the configuration | ||||
| symmetric to ath9k, so the same base kernel without RELAY can be used for | ||||
| both ath9k and ath10k hardware. | ||||
|  | ||||
| Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> | ||||
| Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> | ||||
| --- | ||||
|  ath10k-4.13/Kconfig    | 9 ++++++++- | ||||
|  ath10k-4.13/Makefile   | 2 +- | ||||
|  ath10k-4.13/spectral.h | 4 ++-- | ||||
|  3 files changed, 11 insertions(+), 4 deletions(-) | ||||
|  | ||||
| --- a/ath10k-4.13/Kconfig | ||||
| +++ b/ath10k-4.13/Kconfig | ||||
| @@ -40,12 +40,19 @@ config ATH10K_DEBUG | ||||
|  config ATH10K_DEBUGFS | ||||
|  	bool "Atheros ath10k debugfs support" | ||||
|  	depends on ATH10K && DEBUG_FS | ||||
| -	select RELAY | ||||
|  	---help--- | ||||
|  	  Enabled debugfs support | ||||
|   | ||||
|  	  If unsure, say Y to make it easier to debug problems. | ||||
|   | ||||
| +config ATH10K_SPECTRAL | ||||
| +	bool "Atheros ath10k spectral scan support" | ||||
| +	depends on ATH10K_DEBUGFS | ||||
| +	select RELAY | ||||
| +	default n | ||||
| +	---help--- | ||||
| +	  Say Y to enable access to the FFT/spectral data via debugfs. | ||||
| + | ||||
|  config ATH10K_TRACING | ||||
|  	bool "Atheros ath10k tracing support" | ||||
|  	depends on ATH10K | ||||
| --- a/ath10k-4.13/Makefile | ||||
| +++ b/ath10k-4.13/Makefile | ||||
| @@ -14,7 +14,7 @@ ath10k_core-y += mac.o \ | ||||
|  		 p2p.o \ | ||||
|  		 swap.o | ||||
|   | ||||
| -ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o | ||||
| +ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += spectral.o | ||||
|  ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o | ||||
|  ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o | ||||
|  ath10k_core-$(CONFIG_THERMAL) += thermal.o | ||||
| --- a/ath10k-4.13/spectral.h | ||||
| +++ b/ath10k-4.13/spectral.h | ||||
| @@ -44,7 +44,7 @@ enum ath10k_spectral_mode { | ||||
|  	SPECTRAL_MANUAL, | ||||
|  }; | ||||
|   | ||||
| -#ifdef CONFIG_ATH10K_DEBUGFS | ||||
| +#ifdef CONFIG_ATH10K_SPECTRAL | ||||
|   | ||||
|  int ath10k_spectral_process_fft(struct ath10k *ar, | ||||
|  				struct wmi_phyerr_ev_arg *phyerr, | ||||
| @@ -85,6 +85,6 @@ static inline void ath10k_spectral_destr | ||||
|  { | ||||
|  } | ||||
|   | ||||
| -#endif /* CONFIG_ATH10K_DEBUGFS */ | ||||
| +#endif /* CONFIG_ATH10K_SPECTRAL */ | ||||
|   | ||||
|  #endif /* SPECTRAL_H */ | ||||
		Reference in New Issue
	
	Block a user
	 domenico
					domenico