tree: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath10k-pending-sdio-usb head: 3ea6ce40aecf119c80d392db5ca8dbf87010ff52 commit: 3ea6ce40aecf119c80d392db5ca8dbf87010ff52 [16/16] HACK: ath10k: high latency fixes for beacon buffer config: i386-randconfig-x0-02240950 (attached as .config) compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010 reproduce: git checkout 3ea6ce40aecf119c80d392db5ca8dbf87010ff52 # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>): drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_add_interface': >> drivers/net/wireless/ath/ath10k/mac.c:5223:26: warning: cast from pointer to >> integer of different size [-Wpointer-to-int-cast] arvif->beacon_paddr = (dma_addr_t)arvif->beacon_buf; ^ vim +5223 drivers/net/wireless/ath/ath10k/mac.c 5086 5087 /* 5088 * TODO: 5089 * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE, 5090 * because we will send mgmt frames without CCK. This requirement 5091 * for P2P_FIND/GO_NEG should be handled by checking CCK flag 5092 * in the TX packet. 5093 */ 5094 static int ath10k_add_interface(struct ieee80211_hw *hw, 5095 struct ieee80211_vif *vif) 5096 { 5097 struct ath10k *ar = hw->priv; 5098 struct ath10k_vif *arvif = (void *)vif->drv_priv; 5099 struct ath10k_peer *peer; 5100 enum wmi_sta_powersave_param param; 5101 int ret = 0; 5102 u32 value; 5103 int bit; 5104 int i; 5105 u32 vdev_param; 5106 5107 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; 5108 5109 mutex_lock(&ar->conf_mutex); 5110 5111 memset(arvif, 0, sizeof(*arvif)); 5112 ath10k_mac_txq_init(vif->txq); 5113 5114 arvif->ar = ar; 5115 arvif->vif = vif; 5116 5117 INIT_LIST_HEAD(&arvif->list); 5118 INIT_WORK(&arvif->ap_csa_work, ath10k_mac_vif_ap_csa_work); 5119 INIT_DELAYED_WORK(&arvif->connection_loss_work, 5120 ath10k_mac_vif_sta_connection_loss_work); 5121 5122 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { 5123 arvif->bitrate_mask.control[i].legacy = 0xffffffff; 5124 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, 5125 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); 5126 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, 5127 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); 5128 } 5129 5130 if (ar->num_peers >= ar->max_num_peers) { 5131 ath10k_warn(ar, "refusing vdev creation due to insufficient peer entry resources in firmware\n"); 5132 ret = -ENOBUFS; 5133 goto err; 5134 } 5135 5136 if (ar->free_vdev_map == 0) { 5137 ath10k_warn(ar, "Free vdev map is empty, no more interfaces allowed.\n"); 5138 ret = -EBUSY; 5139 goto err; 5140 } 5141 bit = __ffs64(ar->free_vdev_map); 5142 5143 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac create vdev %i map %llx\n", 5144 bit, ar->free_vdev_map); 5145 5146 arvif->vdev_id = bit; 5147 arvif->vdev_subtype = 5148 ath10k_wmi_get_vdev_subtype(ar, WMI_VDEV_SUBTYPE_NONE); 5149 5150 switch (vif->type) { 5151 case NL80211_IFTYPE_P2P_DEVICE: 5152 arvif->vdev_type = WMI_VDEV_TYPE_STA; 5153 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype 5154 (ar, WMI_VDEV_SUBTYPE_P2P_DEVICE); 5155 break; 5156 case NL80211_IFTYPE_UNSPECIFIED: 5157 case NL80211_IFTYPE_STATION: 5158 arvif->vdev_type = WMI_VDEV_TYPE_STA; 5159 if (vif->p2p) 5160 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype 5161 (ar, WMI_VDEV_SUBTYPE_P2P_CLIENT); 5162 break; 5163 case NL80211_IFTYPE_ADHOC: 5164 arvif->vdev_type = WMI_VDEV_TYPE_IBSS; 5165 break; 5166 case NL80211_IFTYPE_MESH_POINT: 5167 if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) { 5168 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype 5169 (ar, WMI_VDEV_SUBTYPE_MESH_11S); 5170 } else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { 5171 ret = -EINVAL; 5172 ath10k_warn(ar, "must load driver with rawmode=1 to add mesh interfaces\n"); 5173 goto err; 5174 } 5175 arvif->vdev_type = WMI_VDEV_TYPE_AP; 5176 break; 5177 case NL80211_IFTYPE_AP: 5178 arvif->vdev_type = WMI_VDEV_TYPE_AP; 5179 5180 if (vif->p2p) 5181 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype 5182 (ar, WMI_VDEV_SUBTYPE_P2P_GO); 5183 break; 5184 case NL80211_IFTYPE_MONITOR: 5185 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; 5186 break; 5187 default: 5188 WARN_ON(1); 5189 break; 5190 } 5191 5192 /* Using vdev_id as queue number will make it very easy to do per-vif 5193 * tx queue locking. This shouldn't wrap due to interface combinations 5194 * but do a modulo for correctness sake and prevent using offchannel tx 5195 * queues for regular vif tx. 5196 */ 5197 vif->cab_queue = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); 5198 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) 5199 vif->hw_queue[i] = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); 5200 5201 /* Some firmware revisions don't wait for beacon tx completion before 5202 * sending another SWBA event. This could lead to hardware using old 5203 * (freed) beacon data in some cases, e.g. tx credit starvation 5204 * combined with missed TBTT. This is very very rare. 5205 * 5206 * On non-IOMMU-enabled hosts this could be a possible security issue 5207 * because hw could beacon some random data on the air. On 5208 * IOMMU-enabled hosts DMAR faults would occur in most cases and target 5209 * device would crash. 5210 * 5211 * Since there are no beacon tx completions (implicit nor explicit) 5212 * propagated to host the only workaround for this is to allocate a 5213 * DMA-coherent buffer for a lifetime of a vif and use it for all 5214 * beacon tx commands. Worst case for this approach is some beacons may 5215 * become corrupted, e.g. have garbled IEs or out-of-date TIM bitmap. 5216 */ 5217 if (vif->type == NL80211_IFTYPE_ADHOC || 5218 vif->type == NL80211_IFTYPE_MESH_POINT || 5219 vif->type == NL80211_IFTYPE_AP) { 5220 if (ar->dev_type == ATH10K_DEV_TYPE_HL) { 5221 arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN, 5222 GFP_KERNEL); > 5223 arvif->beacon_paddr = > (dma_addr_t)arvif->beacon_buf; 5224 } else { 5225 arvif->beacon_buf = 5226 dma_alloc_coherent(ar->dev, 5227 IEEE80211_MAX_FRAME_LEN, 5228 &arvif->beacon_paddr, 5229 GFP_ATOMIC); 5230 } 5231 if (!arvif->beacon_buf) { 5232 ret = -ENOMEM; 5233 ath10k_warn(ar, "failed to allocate beacon buffer: %d\n", 5234 ret); 5235 goto err; 5236 } 5237 } 5238 if (test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)) 5239 arvif->nohwcrypt = true; 5240 5241 if (arvif->nohwcrypt && 5242 !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { 5243 ath10k_warn(ar, "cryptmode module param needed for sw crypto\n"); 5244 goto err; 5245 } 5246 5247 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev create %d (add interface) type %d subtype %d bcnmode %s\n", 5248 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, 5249 arvif->beacon_buf ? "single-buf" : "per-skb"); 5250 5251 ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, 5252 arvif->vdev_subtype, vif->addr); 5253 if (ret) { 5254 ath10k_warn(ar, "failed to create WMI vdev %i: %d\n", 5255 arvif->vdev_id, ret); 5256 goto err; 5257 } 5258 5259 if (test_bit(WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 5260 ar->wmi.svc_map)) { 5261 vdev_param = ar->wmi.vdev_param->disable_4addr_src_lrn; 5262 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, 5263 WMI_VDEV_DISABLE_4_ADDR_SRC_LRN); 5264 if (ret && ret != -EOPNOTSUPP) { 5265 ath10k_warn(ar, "failed to disable 4addr src lrn vdev %i: %d\n", 5266 arvif->vdev_id, ret); 5267 } 5268 } 5269 5270 ar->free_vdev_map &= ~(1LL << arvif->vdev_id); 5271 spin_lock_bh(&ar->data_lock); 5272 list_add(&arvif->list, &ar->arvifs); 5273 spin_unlock_bh(&ar->data_lock); 5274 5275 /* It makes no sense to have firmware do keepalives. mac80211 already 5276 * takes care of this with idle connection polling. 5277 */ 5278 ret = ath10k_mac_vif_disable_keepalive(arvif); 5279 if (ret) { 5280 ath10k_warn(ar, "failed to disable keepalive on vdev %i: %d\n", 5281 arvif->vdev_id, ret); 5282 goto err_vdev_delete; 5283 } 5284 5285 arvif->def_wep_key_idx = -1; 5286 5287 vdev_param = ar->wmi.vdev_param->tx_encap_type; 5288 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, 5289 ATH10K_HW_TXRX_NATIVE_WIFI); 5290 /* 10.X firmware does not support this VDEV parameter. Do not warn */ 5291 if (ret && ret != -EOPNOTSUPP) { 5292 ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", 5293 arvif->vdev_id, ret); 5294 goto err_vdev_delete; 5295 } 5296 5297 /* Configuring number of spatial stream for monitor interface is causing 5298 * target assert in qca9888 and qca6174. 5299 */ 5300 if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) { 5301 u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask); 5302 5303 vdev_param = ar->wmi.vdev_param->nss; 5304 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, 5305 nss); 5306 if (ret) { 5307 ath10k_warn(ar, "failed to set vdev %i chainmask 0x%x, nss %i: %d\n", 5308 arvif->vdev_id, ar->cfg_tx_chainmask, nss, 5309 ret); 5310 goto err_vdev_delete; 5311 } 5312 } 5313 5314 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || 5315 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { 5316 ret = ath10k_peer_create(ar, vif, NULL, arvif->vdev_id, 5317 vif->addr, WMI_PEER_TYPE_DEFAULT); 5318 if (ret) { 5319 ath10k_warn(ar, "failed to create vdev %i peer for AP/IBSS: %d\n", 5320 arvif->vdev_id, ret); 5321 goto err_vdev_delete; 5322 } 5323 5324 spin_lock_bh(&ar->data_lock); 5325 5326 peer = ath10k_peer_find(ar, arvif->vdev_id, vif->addr); 5327 if (!peer) { 5328 ath10k_warn(ar, "failed to lookup peer %pM on vdev %i\n", 5329 vif->addr, arvif->vdev_id); 5330 spin_unlock_bh(&ar->data_lock); 5331 ret = -ENOENT; 5332 goto err_peer_delete; 5333 } 5334 5335 arvif->peer_id = find_first_bit(peer->peer_ids, 5336 ATH10K_MAX_NUM_PEER_IDS); 5337 5338 spin_unlock_bh(&ar->data_lock); 5339 } else { 5340 arvif->peer_id = HTT_INVALID_PEERID; 5341 } 5342 5343 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { 5344 ret = ath10k_mac_set_kickout(arvif); 5345 if (ret) { 5346 ath10k_warn(ar, "failed to set vdev %i kickout parameters: %d\n", 5347 arvif->vdev_id, ret); 5348 goto err_peer_delete; 5349 } 5350 } 5351 5352 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { 5353 param = WMI_STA_PS_PARAM_RX_WAKE_POLICY; 5354 value = WMI_STA_PS_RX_WAKE_POLICY_WAKE; 5355 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, 5356 param, value); 5357 if (ret) { 5358 ath10k_warn(ar, "failed to set vdev %i RX wake policy: %d\n", 5359 arvif->vdev_id, ret); 5360 goto err_peer_delete; 5361 } 5362 5363 ret = ath10k_mac_vif_recalc_ps_wake_threshold(arvif); 5364 if (ret) { 5365 ath10k_warn(ar, "failed to recalc ps wake threshold on vdev %i: %d\n", 5366 arvif->vdev_id, ret); 5367 goto err_peer_delete; 5368 } 5369 5370 ret = ath10k_mac_vif_recalc_ps_poll_count(arvif); 5371 if (ret) { 5372 ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n", 5373 arvif->vdev_id, ret); 5374 goto err_peer_delete; 5375 } 5376 } 5377 5378 ret = ath10k_mac_set_txbf_conf(arvif); 5379 if (ret) { 5380 ath10k_warn(ar, "failed to set txbf for vdev %d: %d\n", 5381 arvif->vdev_id, ret); 5382 goto err_peer_delete; 5383 } 5384 5385 ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); 5386 if (ret) { 5387 ath10k_warn(ar, "failed to set rts threshold for vdev %d: %d\n", 5388 arvif->vdev_id, ret); 5389 goto err_peer_delete; 5390 } 5391 5392 arvif->txpower = vif->bss_conf.txpower; 5393 ret = ath10k_mac_txpower_recalc(ar); 5394 if (ret) { 5395 ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); 5396 goto err_peer_delete; 5397 } 5398 5399 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { 5400 vdev_param = ar->wmi.vdev_param->rtt_responder_role; 5401 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, 5402 arvif->ftm_responder); 5403 5404 /* It is harmless to not set FTM role. Do not warn */ 5405 if (ret && ret != -EOPNOTSUPP) 5406 ath10k_warn(ar, "failed to set vdev %i FTM Responder: %d\n", 5407 arvif->vdev_id, ret); 5408 } 5409 5410 if (vif->type == NL80211_IFTYPE_MONITOR) { 5411 ar->monitor_arvif = arvif; 5412 ret = ath10k_monitor_recalc(ar); 5413 if (ret) { 5414 ath10k_warn(ar, "failed to recalc monitor: %d\n", ret); 5415 goto err_peer_delete; 5416 } 5417 } 5418 5419 spin_lock_bh(&ar->htt.tx_lock); 5420 if (!ar->tx_paused) 5421 ieee80211_wake_queue(ar->hw, arvif->vdev_id); 5422 spin_unlock_bh(&ar->htt.tx_lock); 5423 5424 mutex_unlock(&ar->conf_mutex); 5425 return 0; 5426 5427 err_peer_delete: 5428 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || 5429 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) 5430 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr); 5431 5432 err_vdev_delete: 5433 ath10k_wmi_vdev_delete(ar, arvif->vdev_id); 5434 ar->free_vdev_map |= 1LL << arvif->vdev_id; 5435 spin_lock_bh(&ar->data_lock); 5436 list_del(&arvif->list); 5437 spin_unlock_bh(&ar->data_lock); 5438 5439 err: 5440 if (arvif->beacon_buf) { 5441 if (ar->dev_type == ATH10K_DEV_TYPE_HL) 5442 kfree(arvif->beacon_buf); 5443 else 5444 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, 5445 arvif->beacon_buf, 5446 arvif->beacon_paddr); 5447 arvif->beacon_buf = NULL; 5448 } 5449 5450 mutex_unlock(&ar->conf_mutex); 5451 5452 return ret; 5453 } 5454 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
.config.gz
Description: application/gzip
_______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k