1. 01 Dec, 2016 6 commits
    • Bhumika Goyal's avatar
      ath9k: constify ath_bus_ops structure · 8ca5a607
      Bhumika Goyal authored
      Declare the structure ath_bus_ops as const as it is only passed as an
      argument to the function ath9k_init_device. This argument is of type
      const struct ath_bus_ops *, so ath_bus_ops structures with this property
      can be declared as const.
      Done using Coccinelle:
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct ath_bus_ops i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      expression e1,e2;
      @@
      ath9k_init_device(e1,e2,&i@p)
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      static
      +const
      struct ath_bus_ops i={...};
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct ath_bus_ops i;
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         1295	    232	      0	   1527	    5f7	ath/ath9k/ahb.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
         1359	    176	      0	   1535	    5ff	ath/ath9k/ahb.o
      Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      8ca5a607
    • Ben Greear's avatar
      ath10k: wmi-alloc-chunk should use DMA_BIDIRECTIONAL · 43ca92d3
      Ben Greear authored
      These memory chunks are often used as 'swap' by the NIC,
      so it will be both reading and writing to these areas.
      
      This seems to fix errors like this on my x86-64 machine:
      
      kernel: DMAR: DMAR:[DMA Write] Request device [05:00.0] fault addr ff5de000
              DMAR:[fault reason 05] PTE Write access is not set
      Tested-by: default avatarMarek Behun <kabel@blackhole.sk>
      Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      43ca92d3
    • Mohammed Shafi Shajakhan's avatar
      ath10k: fix Tx DMA alloc failure during continuous wifi down/up · 9ec34a86
      Mohammed Shafi Shajakhan authored
      With maximum number of vap's configured in a two radio supported
      systems of ~256 Mb RAM, doing a continuous wifi down/up and
      intermittent traffic streaming from the connected stations results
      in failure to allocate contiguous memory for tx buffers. This results
      in the disappearance of all VAP's and a manual reboot is needed as
      this is not a crash (or) OOM(for OOM killer to be invoked). To address
      this allocate contiguous memory for tx buffers one time and re-use them
      until the modules are unloaded but this results in a slight increase in
      memory footprint of ath10k when the wifi is down, but the modules are
      still loaded. Also as of now we use a separate bool 'tx_mem_allocated'
      to keep track of the one time memory allocation, as we cannot come up
      with something like 'ath10k_tx_{register,unregister}' before
      'ath10k_probe_fw' is called as 'ath10k_htt_tx_alloc_cont_frag_desc'
      memory allocation is dependent on the hw_param 'continuous_frag_desc'
      
      a) memory footprint of ath10k without the change
      
      lsmod | grep ath10k
      ath10k_core           414498  1 ath10k_pci
      ath10k_pci             38236  0
      
      b) memory footprint of ath10k with the change
      
      ath10k_core           414980  1 ath10k_pci
      ath10k_pci             38236  0
      
      Memory Failure Call trace:
      
      hostapd: page allocation failure: order:6, mode:0xd0
       [<c021f150>] (__dma_alloc_buffer.isra.23) from
      [<c021f23c>] (__alloc_remap_buffer.isra.26+0x14/0xb8)
      [<c021f23c>] (__alloc_remap_buffer.isra.26) from
      [<c021f664>] (__dma_alloc+0x224/0x2b8)
      [<c021f664>] (__dma_alloc) from [<c021f810>]
      (arm_dma_alloc+0x84/0x90)
      [<c021f810>] (arm_dma_alloc) from [<bf954764>]
      (ath10k_htt_tx_alloc+0xe0/0x2e4 [ath10k_core])
      [<bf954764>] (ath10k_htt_tx_alloc [ath10k_core]) from
      [<bf94e6ac>] (ath10k_core_start+0x538/0xcf8 [ath10k_core])
      [<bf94e6ac>] (ath10k_core_start [ath10k_core]) from
      [<bf947eec>] (ath10k_start+0xbc/0x56c [ath10k_core])
      [<bf947eec>] (ath10k_start [ath10k_core]) from
      [<bf8a7a04>] (drv_start+0x40/0x5c [mac80211])
      [<bf8a7a04>] (drv_start [mac80211]) from [<bf8b7cf8>]
      (ieee80211_do_open+0x170/0x82c [mac80211])
      [<bf8b7cf8>] (ieee80211_do_open [mac80211]) from
      [<c056afc8>] (__dev_open+0xa0/0xf4)
      [21053.491752] Normal: 641*4kB (UEMR) 505*8kB (UEMR) 330*16kB (UEMR)
      126*32kB (UEMR) 762*64kB (UEMR) 237*128kB (UEMR) 1*256kB (M) 0*512kB
      0*1024kB 0*2048kB 0*4096kB = 95276kB
      Signed-off-by: default avatarMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      9ec34a86
    • Mohammed Shafi Shajakhan's avatar
      ath10k: fix soft lockup during firmware crash/hw-restart · c2cac2f7
      Mohammed Shafi Shajakhan authored
      During firmware crash (or) user requested manual restart
      the system gets into a soft lock up state because of the
      below root cause.
      
      During user requested hardware restart / firmware crash
      the system goes into a soft lockup state as 'napi_synchronize'
      is called after 'napi_disable' (which sets 'NAPI_STATE_SCHED'
      bit) and it sleeps into infinite loop as it waits for
      'NAPI_STATE_SCHED' to be cleared. This condition is hit because
      'ath10k_hif_stop' is called twice as below (resulting in calling
      'napi_synchronize' after 'napi_disable')
      
      'ath10k_core_restart' -> 'ath10k_hif_stop' (ATH10K_STATE_ON) ->
      -> 'ieee80211_restart_hw' -> 'ath10k_start' -> 'ath10k_halt' ->
      'ath10k_core_stop' -> 'ath10k_hif_stop' (ATH10K_STATE_RESTARTING)
      
      Fix this by calling 'ath10k_halt' in ath10k_core_restart itself
      as it makes more sense before informing mac80211 to restart h/w
      Also remove 'ath10k_halt' in ath10k_start for the state of 'restarting'
      
      Fixes: 3c97f5de ("ath10k: implement NAPI support")
      Cc: <stable@vger.kernel.org> # v4.9
      Signed-off-by: default avatarMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      c2cac2f7
    • Erik Stromdahl's avatar
      ath10k: fix TLV set regdomain command · 4e322f7d
      Erik Stromdahl authored
      There is a typo bug in the current implementation of
      ath10k_wmi_tlv_op_gen_pdev_set_rd.
      The conformance test limits are not set up properly.
      
      The two arguments ctl2g and ctl5g were not used at all.
      Instead, the regdomain arguments rd2g and rd5g were used
      for the ctl settings as well.
      Signed-off-by: default avatarErik Stromdahl <erik.stromdahl@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      4e322f7d
    • Zefir Kurtisi's avatar
      ath9k: feed only active spectral / dfs-detector · 87fedb97
      Zefir Kurtisi authored
      Radar pulse and spectral scan reports are provided by the HW
      with the ATH9K_RXERR_PHY flag set. Those are forwarded to
      the dfs-detector and spectral module for further processing.
      
      For some older chips, the pre-conditions checked in those
      modules are ambiguous, since ATH9K_PHYERR_RADAR is used to
      tag both types. As a result, spectral frames are fed into
      the dfs-detector and vice versa.
      
      This could lead to a false radar detection on a non-DFS
      channel (which is uncritical), but more relevant it causes
      useless CPU load for processing invalid frames.
      
      This commit ensures that the dfs-detector and spectral
      collector are only fed when they are active.
      Signed-off-by: default avatarZefir Kurtisi <zefir.kurtisi@neratec.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      87fedb97
  2. 23 Nov, 2016 17 commits
  3. 19 Nov, 2016 15 commits
  4. 18 Nov, 2016 2 commits
    • Brian Norris's avatar
      mwifiex: don't do unbalanced free()'ing in cleanup_if() · 66b9c182
      Brian Norris authored
      The cleanup_if() callback is the inverse of init_if(). We allocate our
      'card' interface structure in the probe() function, but we free it in
      cleanup_if(). That gives a few problems:
      (a) we leak this memory if probe() fails before we reach init_if()
      (b) we can't safely utilize 'card' after cleanup_if() -- namely, in
          remove() or suspend(), both of which might race with the cleanup
          paths in our asynchronous FW initialization path
      
      Solution: just use devm_kzalloc(), which will free this structure
      properly when the device is removed -- and drop the set_drvdata(...,
      NULL), since the driver core does this for us. This also removes the
      temptation to use drvdata == NULL as a hack for checking if the device
      has been "cleaned up."
      
      I *do* leave the set_drvdata(..., NULL) for the hacky SDIO
      mwifiex_recreate_adapter(), since the device core won't be able to clear
      that one for us.
      Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      66b9c182
    • Amitkumar Karwar's avatar
      mwifiex: ignore calibration data failure · 14e5e937
      Amitkumar Karwar authored
      Firmware may reject calibration data from host for certain OTP
      settings. In that case, we should continue initialisation ignoring
      the failure.
      Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      14e5e937