[ath6kl:pending 34/39] drivers/net/wireless/ath/ath10k/mac.c:5062:26: warning: cast from pointer to integer of different size

kbuild test robot fengguang.wu at intel.com
Thu Oct 5 17:15:56 PDT 2017


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
head:   49e3503004be11aa2538b9a443ea8b22d9a22631
commit: acdda8888c3414a63d4dc634ded50cc14f7f0ec4 [34/39] ath10k_sdio: high latency fixes for beacon buffer
config: i386-randconfig-c0-10060606 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        git checkout acdda8888c3414a63d4dc634ded50cc14f7f0ec4
        # 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:5062:26: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       arvif->beacon_paddr = (dma_addr_t)arvif->beacon_buf;
                             ^
   In file included from include/asm-generic/bug.h:4:0,
                    from arch/x86/include/asm/bug.h:81,
                    from include/linux/bug.h:4,
                    from include/net/mac80211.h:18,
                    from drivers/net/wireless/ath/ath10k/mac.h:21,
                    from drivers/net/wireless/ath/ath10k/mac.c:18:
   drivers/net/wireless/ath/ath10k/mac.c: At top level:
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:421:2: note: in expansion of macro 'if'
     if (p_size == (size_t)-1 && q_size == (size_t)-1)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:411:2: note: in expansion of macro 'if'
     if (p_size < size)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:409:2: note: in expansion of macro 'if'
     if (__builtin_constant_p(size) && p_size < size)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:400:2: note: in expansion of macro 'if'
     if (p_size < size)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:398:2: note: in expansion of macro 'if'
     if (__builtin_constant_p(size) && p_size < size)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:389:2: note: in expansion of macro 'if'
     if (p_size < size)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:387:2: note: in expansion of macro 'if'
     if (__builtin_constant_p(size) && p_size < size)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:379:2: note: in expansion of macro 'if'
     if (p_size < size || q_size < size)
     ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:376:3: note: in expansion of macro 'if'
      if (q_size < size)
      ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
       ______f = {     \
       ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   include/linux/string.h:374:3: note: in expansion of macro 'if'
      if (p_size < size)
      ^
   include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static

vim +5062 drivers/net/wireless/ath/ath10k/mac.c

  4925	
  4926	/*
  4927	 * TODO:
  4928	 * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE,
  4929	 * because we will send mgmt frames without CCK. This requirement
  4930	 * for P2P_FIND/GO_NEG should be handled by checking CCK flag
  4931	 * in the TX packet.
  4932	 */
  4933	static int ath10k_add_interface(struct ieee80211_hw *hw,
  4934					struct ieee80211_vif *vif)
  4935	{
  4936		struct ath10k *ar = hw->priv;
  4937		struct ath10k_vif *arvif = (void *)vif->drv_priv;
  4938		struct ath10k_peer *peer;
  4939		enum wmi_sta_powersave_param param;
  4940		int ret = 0;
  4941		u32 value;
  4942		int bit;
  4943		int i;
  4944		u32 vdev_param;
  4945	
  4946		vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
  4947	
  4948		mutex_lock(&ar->conf_mutex);
  4949	
  4950		memset(arvif, 0, sizeof(*arvif));
  4951		ath10k_mac_txq_init(vif->txq);
  4952	
  4953		arvif->ar = ar;
  4954		arvif->vif = vif;
  4955	
  4956		INIT_LIST_HEAD(&arvif->list);
  4957		INIT_WORK(&arvif->ap_csa_work, ath10k_mac_vif_ap_csa_work);
  4958		INIT_DELAYED_WORK(&arvif->connection_loss_work,
  4959				  ath10k_mac_vif_sta_connection_loss_work);
  4960	
  4961		for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) {
  4962			arvif->bitrate_mask.control[i].legacy = 0xffffffff;
  4963			memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff,
  4964			       sizeof(arvif->bitrate_mask.control[i].ht_mcs));
  4965			memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff,
  4966			       sizeof(arvif->bitrate_mask.control[i].vht_mcs));
  4967		}
  4968	
  4969		if (ar->num_peers >= ar->max_num_peers) {
  4970			ath10k_warn(ar, "refusing vdev creation due to insufficient peer entry resources in firmware\n");
  4971			ret = -ENOBUFS;
  4972			goto err;
  4973		}
  4974	
  4975		if (ar->free_vdev_map == 0) {
  4976			ath10k_warn(ar, "Free vdev map is empty, no more interfaces allowed.\n");
  4977			ret = -EBUSY;
  4978			goto err;
  4979		}
  4980		bit = __ffs64(ar->free_vdev_map);
  4981	
  4982		ath10k_dbg(ar, ATH10K_DBG_MAC, "mac create vdev %i map %llx\n",
  4983			   bit, ar->free_vdev_map);
  4984	
  4985		arvif->vdev_id = bit;
  4986		arvif->vdev_subtype =
  4987			ath10k_wmi_get_vdev_subtype(ar, WMI_VDEV_SUBTYPE_NONE);
  4988	
  4989		switch (vif->type) {
  4990		case NL80211_IFTYPE_P2P_DEVICE:
  4991			arvif->vdev_type = WMI_VDEV_TYPE_STA;
  4992			arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
  4993						(ar, WMI_VDEV_SUBTYPE_P2P_DEVICE);
  4994			break;
  4995		case NL80211_IFTYPE_UNSPECIFIED:
  4996		case NL80211_IFTYPE_STATION:
  4997			arvif->vdev_type = WMI_VDEV_TYPE_STA;
  4998			if (vif->p2p)
  4999				arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
  5000						(ar, WMI_VDEV_SUBTYPE_P2P_CLIENT);
  5001			break;
  5002		case NL80211_IFTYPE_ADHOC:
  5003			arvif->vdev_type = WMI_VDEV_TYPE_IBSS;
  5004			break;
  5005		case NL80211_IFTYPE_MESH_POINT:
  5006			if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) {
  5007				arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
  5008							(ar, WMI_VDEV_SUBTYPE_MESH_11S);
  5009			} else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) {
  5010				ret = -EINVAL;
  5011				ath10k_warn(ar, "must load driver with rawmode=1 to add mesh interfaces\n");
  5012				goto err;
  5013			}
  5014			arvif->vdev_type = WMI_VDEV_TYPE_AP;
  5015			break;
  5016		case NL80211_IFTYPE_AP:
  5017			arvif->vdev_type = WMI_VDEV_TYPE_AP;
  5018	
  5019			if (vif->p2p)
  5020				arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype
  5021							(ar, WMI_VDEV_SUBTYPE_P2P_GO);
  5022			break;
  5023		case NL80211_IFTYPE_MONITOR:
  5024			arvif->vdev_type = WMI_VDEV_TYPE_MONITOR;
  5025			break;
  5026		default:
  5027			WARN_ON(1);
  5028			break;
  5029		}
  5030	
  5031		/* Using vdev_id as queue number will make it very easy to do per-vif
  5032		 * tx queue locking. This shouldn't wrap due to interface combinations
  5033		 * but do a modulo for correctness sake and prevent using offchannel tx
  5034		 * queues for regular vif tx.
  5035		 */
  5036		vif->cab_queue = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1);
  5037		for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++)
  5038			vif->hw_queue[i] = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1);
  5039	
  5040		/* Some firmware revisions don't wait for beacon tx completion before
  5041		 * sending another SWBA event. This could lead to hardware using old
  5042		 * (freed) beacon data in some cases, e.g. tx credit starvation
  5043		 * combined with missed TBTT. This is very very rare.
  5044		 *
  5045		 * On non-IOMMU-enabled hosts this could be a possible security issue
  5046		 * because hw could beacon some random data on the air.  On
  5047		 * IOMMU-enabled hosts DMAR faults would occur in most cases and target
  5048		 * device would crash.
  5049		 *
  5050		 * Since there are no beacon tx completions (implicit nor explicit)
  5051		 * propagated to host the only workaround for this is to allocate a
  5052		 * DMA-coherent buffer for a lifetime of a vif and use it for all
  5053		 * beacon tx commands. Worst case for this approach is some beacons may
  5054		 * become corrupted, e.g. have garbled IEs or out-of-date TIM bitmap.
  5055		 */
  5056		if (vif->type == NL80211_IFTYPE_ADHOC ||
  5057		    vif->type == NL80211_IFTYPE_MESH_POINT ||
  5058		    vif->type == NL80211_IFTYPE_AP) {
  5059			if (ar->is_high_latency) {
  5060				arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN,
  5061							    GFP_KERNEL);
> 5062				arvif->beacon_paddr = (dma_addr_t)arvif->beacon_buf;
  5063			} else {
  5064				arvif->beacon_buf =
  5065					dma_zalloc_coherent(ar->dev,
  5066							    IEEE80211_MAX_FRAME_LEN,
  5067							    &arvif->beacon_paddr,
  5068							    GFP_ATOMIC);
  5069			}
  5070			if (!arvif->beacon_buf) {
  5071				ret = -ENOMEM;
  5072				ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
  5073					    ret);
  5074				goto err;
  5075			}
  5076		}
  5077		if (test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags))
  5078			arvif->nohwcrypt = true;
  5079	
  5080		if (arvif->nohwcrypt &&
  5081		    !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) {
  5082			ath10k_warn(ar, "cryptmode module param needed for sw crypto\n");
  5083			goto err;
  5084		}
  5085	
  5086		ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev create %d (add interface) type %d subtype %d bcnmode %s\n",
  5087			   arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype,
  5088			   arvif->beacon_buf ? "single-buf" : "per-skb");
  5089	
  5090		ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type,
  5091					     arvif->vdev_subtype, vif->addr);
  5092		if (ret) {
  5093			ath10k_warn(ar, "failed to create WMI vdev %i: %d\n",
  5094				    arvif->vdev_id, ret);
  5095			goto err;
  5096		}
  5097	
  5098		ar->free_vdev_map &= ~(1LL << arvif->vdev_id);
  5099		spin_lock_bh(&ar->data_lock);
  5100		list_add(&arvif->list, &ar->arvifs);
  5101		spin_unlock_bh(&ar->data_lock);
  5102	
  5103		/* It makes no sense to have firmware do keepalives. mac80211 already
  5104		 * takes care of this with idle connection polling.
  5105		 */
  5106		ret = ath10k_mac_vif_disable_keepalive(arvif);
  5107		if (ret) {
  5108			ath10k_warn(ar, "failed to disable keepalive on vdev %i: %d\n",
  5109				    arvif->vdev_id, ret);
  5110			goto err_vdev_delete;
  5111		}
  5112	
  5113		arvif->def_wep_key_idx = -1;
  5114	
  5115		vdev_param = ar->wmi.vdev_param->tx_encap_type;
  5116		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
  5117						ATH10K_HW_TXRX_NATIVE_WIFI);
  5118		/* 10.X firmware does not support this VDEV parameter. Do not warn */
  5119		if (ret && ret != -EOPNOTSUPP) {
  5120			ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n",
  5121				    arvif->vdev_id, ret);
  5122			goto err_vdev_delete;
  5123		}
  5124	
  5125		/* Configuring number of spatial stream for monitor interface is causing
  5126		 * target assert in qca9888 and qca6174.
  5127		 */
  5128		if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) {
  5129			u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask);
  5130	
  5131			vdev_param = ar->wmi.vdev_param->nss;
  5132			ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
  5133							nss);
  5134			if (ret) {
  5135				ath10k_warn(ar, "failed to set vdev %i chainmask 0x%x, nss %i: %d\n",
  5136					    arvif->vdev_id, ar->cfg_tx_chainmask, nss,
  5137					    ret);
  5138				goto err_vdev_delete;
  5139			}
  5140		}
  5141	
  5142		if (arvif->vdev_type == WMI_VDEV_TYPE_AP ||
  5143		    arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
  5144			ret = ath10k_peer_create(ar, vif, NULL, arvif->vdev_id,
  5145						 vif->addr, WMI_PEER_TYPE_DEFAULT);
  5146			if (ret) {
  5147				ath10k_warn(ar, "failed to create vdev %i peer for AP/IBSS: %d\n",
  5148					    arvif->vdev_id, ret);
  5149				goto err_vdev_delete;
  5150			}
  5151	
  5152			spin_lock_bh(&ar->data_lock);
  5153	
  5154			peer = ath10k_peer_find(ar, arvif->vdev_id, vif->addr);
  5155			if (!peer) {
  5156				ath10k_warn(ar, "failed to lookup peer %pM on vdev %i\n",
  5157					    vif->addr, arvif->vdev_id);
  5158				spin_unlock_bh(&ar->data_lock);
  5159				ret = -ENOENT;
  5160				goto err_peer_delete;
  5161			}
  5162	
  5163			arvif->peer_id = find_first_bit(peer->peer_ids,
  5164							ATH10K_MAX_NUM_PEER_IDS);
  5165	
  5166			spin_unlock_bh(&ar->data_lock);
  5167		} else {
  5168			arvif->peer_id = HTT_INVALID_PEERID;
  5169		}
  5170	
  5171		if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
  5172			ret = ath10k_mac_set_kickout(arvif);
  5173			if (ret) {
  5174				ath10k_warn(ar, "failed to set vdev %i kickout parameters: %d\n",
  5175					    arvif->vdev_id, ret);
  5176				goto err_peer_delete;
  5177			}
  5178		}
  5179	
  5180		if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
  5181			param = WMI_STA_PS_PARAM_RX_WAKE_POLICY;
  5182			value = WMI_STA_PS_RX_WAKE_POLICY_WAKE;
  5183			ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
  5184							  param, value);
  5185			if (ret) {
  5186				ath10k_warn(ar, "failed to set vdev %i RX wake policy: %d\n",
  5187					    arvif->vdev_id, ret);
  5188				goto err_peer_delete;
  5189			}
  5190	
  5191			ret = ath10k_mac_vif_recalc_ps_wake_threshold(arvif);
  5192			if (ret) {
  5193				ath10k_warn(ar, "failed to recalc ps wake threshold on vdev %i: %d\n",
  5194					    arvif->vdev_id, ret);
  5195				goto err_peer_delete;
  5196			}
  5197	
  5198			ret = ath10k_mac_vif_recalc_ps_poll_count(arvif);
  5199			if (ret) {
  5200				ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n",
  5201					    arvif->vdev_id, ret);
  5202				goto err_peer_delete;
  5203			}
  5204		}
  5205	
  5206		ret = ath10k_mac_set_txbf_conf(arvif);
  5207		if (ret) {
  5208			ath10k_warn(ar, "failed to set txbf for vdev %d: %d\n",
  5209				    arvif->vdev_id, ret);
  5210			goto err_peer_delete;
  5211		}
  5212	
  5213		ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold);
  5214		if (ret) {
  5215			ath10k_warn(ar, "failed to set rts threshold for vdev %d: %d\n",
  5216				    arvif->vdev_id, ret);
  5217			goto err_peer_delete;
  5218		}
  5219	
  5220		arvif->txpower = vif->bss_conf.txpower;
  5221		ret = ath10k_mac_txpower_recalc(ar);
  5222		if (ret) {
  5223			ath10k_warn(ar, "failed to recalc tx power: %d\n", ret);
  5224			goto err_peer_delete;
  5225		}
  5226	
  5227		if (vif->type == NL80211_IFTYPE_MONITOR) {
  5228			ar->monitor_arvif = arvif;
  5229			ret = ath10k_monitor_recalc(ar);
  5230			if (ret) {
  5231				ath10k_warn(ar, "failed to recalc monitor: %d\n", ret);
  5232				goto err_peer_delete;
  5233			}
  5234		}
  5235	
  5236		spin_lock_bh(&ar->htt.tx_lock);
  5237		if (!ar->tx_paused)
  5238			ieee80211_wake_queue(ar->hw, arvif->vdev_id);
  5239		spin_unlock_bh(&ar->htt.tx_lock);
  5240	
  5241		mutex_unlock(&ar->conf_mutex);
  5242		return 0;
  5243	
  5244	err_peer_delete:
  5245		if (arvif->vdev_type == WMI_VDEV_TYPE_AP ||
  5246		    arvif->vdev_type == WMI_VDEV_TYPE_IBSS)
  5247			ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr);
  5248	
  5249	err_vdev_delete:
  5250		ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
  5251		ar->free_vdev_map |= 1LL << arvif->vdev_id;
  5252		spin_lock_bh(&ar->data_lock);
  5253		list_del(&arvif->list);
  5254		spin_unlock_bh(&ar->data_lock);
  5255	
  5256	err:
  5257		if (arvif->beacon_buf) {
  5258			if (ar->is_high_latency)
  5259				kfree(arvif->beacon_buf);
  5260			else
  5261				dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
  5262						  arvif->beacon_buf,
  5263						  arvif->beacon_paddr);
  5264			arvif->beacon_buf = NULL;
  5265		}
  5266	
  5267		mutex_unlock(&ar->conf_mutex);
  5268	
  5269		return ret;
  5270	}
  5271	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 25408 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/ath10k/attachments/20171006/ff32ee8e/attachment-0001.gz>


More information about the ath10k mailing list