1. 04 Oct, 2019 10 commits
    • Yan-Hsuan Chuang's avatar
      rtw88: configure TX queue EDCA parameters · bf06c7ec
      Yan-Hsuan Chuang authored
      Set CWmax/CWmin, TXOP and AIFS according to ieee80211_tx_queue_params.
      
      Do note that hardware has only one group of EDCA[ac] registers, if more
      than one vif are added, the EDCA[ac] registers will contain value of
      params of the most recent set by ieee80211_ops::conf_tx().
      
      And AIFS = AIFSN[ac] * slot_time + SIFS, so if use_short_slot is changed,
      need to also change AIFS.
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      bf06c7ec
    • Ping-Ke Shih's avatar
      rtw88: Don't set RX_FLAG_DECRYPTED if packet has no encryption · 0649ff58
      Ping-Ke Shih authored
      The value of GET_RX_DESC_SWDEC() indicates that if this RX
      packet requires software decryption or not. And software
      decryption is required when the packet was encrypted and the
      hardware failed to decrypt it.
      
      So, GET_RX_DESC_SWDEC() is negative does not mean that this
      packet is decrypted, it might just have no encryption at all.
      To actually see if the packet is decrypted, driver needs to
      further check if the hardware has successfully decrypted it,
      with a specific type of encryption algorithm.
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      0649ff58
    • Yan-Hsuan Chuang's avatar
      rtw88: fix beaconing mode rsvd_page memory violation issue · c3594559
      Yan-Hsuan Chuang authored
      When downloading the reserved page, the first page always contains
      a beacon for the firmware to reference. For non-beaconing modes such
      as station mode, also put a blank skb with length=1.
      
      And for the beaconing modes, driver will get a real beacon with a
      length approximate to the page size. But as the beacon is always put
      at the first page, it does not need a tx_desc, because the TX path
      will generate one when TXing the reserved page to the hardware. So we
      could allocate a buffer with a size smaller than the reserved page,
      when using memcpy() to copy the content of reserved page to the buffer,
      the over-sized reserved page will violate the kernel memory.
      
      To fix it, add the tx_desc before memcpy() the reserved packets to
      the buffer, then we can get SKBs with correct length when counting
      the pages in total. And for page 0, count the extra tx_desc_sz that
      the TX path will generate. This way, the first beacon that allocated
      without tx_desc can be counted with the extra tx_desc_sz to get
      actual pages it requires.
      
      Fixes: e3037485 ("rtw88: new Realtek 802.11ac driver")
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      c3594559
    • Yan-Hsuan Chuang's avatar
      rtw88: flush hardware tx queues · 1131ad7f
      Yan-Hsuan Chuang authored
      Sometimes mac80211 will ask us to flush the hardware queues.
      To flush them, first we need to get the corresponding priority queues
      from the RQPN mapping table.
      
      Then we can check the available pages are equal to the originally
      reserved pages, which means the hardware has returned all of the pages
      it used to transmit.
      
      Note that now we only check for 100 ms for the priority queue, but
      sometimes if we have a lot of traffic (ex. 100Mbps up), some of the
      packets could be dropped.
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      1131ad7f
    • Yan-Hsuan Chuang's avatar
      rtw88: add TX-AMSDU support · 127eef1d
      Yan-Hsuan Chuang authored
      Based on the mac80211's TXQ implementation, TX-AMSDU can
      be used to get higher MAC efficiency. To make mac80211
      aggregate MSDUs, low level driver just need to leave skbs
      in the TXQ, and mac80211 will try to aggregate them if
      possible. As driver will schedule a tasklet when the TX
      queue is woke, until the tasklet being served, there will
      have some skbs in the queue if traffic is heavy.
      
      Driver can control the max AMSDU size depending on the
      current bit rate used by hardware/firmware. The higher
      rates are used, the larger AMSDU size can be.
      
      It is tested that can achieve higher T-Put at higher rates.
      If the environment is relatively clean, and the bit_rate
      is high enough, we can get about 80Mbps improvement.
      
      For lower bit rates, not much gain can we get, so leave
      the max_amsdu length low to prevent aggregation.
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      127eef1d
    • Tzu-En Huang's avatar
      rtw88: report tx rate to mac80211 stack · 699c7730
      Tzu-En Huang authored
      Whenever the firmware increases/decreases the bit rate used
      to transmit to a peer, it sends an RA report through C2H to
      driver. Driver can then record the bit rate in the peer's
      struct rtw_sta_info, and report to mac80211 when it asks us
      for the statistics of the sta by ieee80211_ops::sta_statistics
      Signed-off-by: default avatarTzu-En Huang <tehuang@realtek.com>
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      699c7730
    • Yan-Hsuan Chuang's avatar
      rtw88: take over rate control from mac80211 · 46ebb174
      Yan-Hsuan Chuang authored
      We can indicate IEEE80211_HW_HAS_RATE_CONTROL to mac80211 because
      the hardware has its own rate control algorithm. And what driver needs
      to do is to choose an RA mask according the peer's capabilities.
      
      But the hardware is not able to setup BA session by itself. So driver
      requires to initiate tx BA session for hardware, and tells it if it is
      possible to transmit AMPDU. The hardware can then aggregate MPDUs.
      
      And the size of AMPDU is controlled by the TX descriptor and the
      register value. Since the TX descriptor will reference the max AMPDU
      size from ieee80211_sta::ht_cap::ampdu_factor, just set the register
      value to 0x3f, and let it be controlled by TX descriptor.
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      46ebb174
    • Yan-Hsuan Chuang's avatar
      rtw88: add driver TX queue support · 3745d3e5
      Yan-Hsuan Chuang authored
      The mac80211 provides software TX queue for driver, as long as
      driver has hooked ieee80211_ops::wake_tx_queue. Each time a
      packet is queued onto the TX queue, that queue will be woken
      up the inform driver to serve the queue.
      
      Now driver only supports PCI interface ICs, there's no specific
      traffic control for each queue, just schedule a tasklet, and
      dump all of the packets at once to the DMA ring. Instead of TX
      the packets whenever TX queue is woke, tasklet handler can have
      more packets dumped to the device, takes advantage of burst
      write with DMA engine.
      
      And if the driver is going to support USB/SDIO ICs, the tasklet
      can be more flexible for aggregating the packets, enhance the
      efficiency of bandwidth usage.
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      3745d3e5
    • Yan-Hsuan Chuang's avatar
      rtw88: allows to set RTS in TX descriptor · 942e2a5d
      Yan-Hsuan Chuang authored
      Allows driver to send RTS by filling tx descriptor.
      
      The user may want to set the rts threshold. But since we have not
      been taking over rate control from mac80211 to driver by setting flag
      IEEE80211_HW_HAS_RATE_CONTROL, there is nothing we can do about it.
      So here just store the value, and mac80211 will tell us to use rts
      protection by ieee80211_tx_info::control::use_rts.
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      942e2a5d
    • Chin-Yen Lee's avatar
      rtw88: check firmware leave lps successfully · 3a2dd6b7
      Chin-Yen Lee authored
      Driver needs to wait for firmware to restore hardware setting
      to active mode after leaving lps.
      
      After getting H2C from driver for leaving lps, firmware will
      issue null packet without PS bit to inform AP driver is active,
      and then restore REG_TCR Register if AP has receiced null packet.
      
      But the transmission of null packet may cost much more time
      in noisy environment. If driver does not wait for firmware,
      null packet with PS bit could be sent due to incorrect REG_TCR setting.
      And AP will be confused.
      
      In our test, 100ms is enough for firmware to send null packet
      to AP. If REG_TCR Register is still wrong after 100ms, we will
      modify it directly, force the PS bit to be cleared
      Signed-off-by: default avatarChin-Yen Lee <timlee@realtek.com>
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      3a2dd6b7
  2. 03 Oct, 2019 1 commit
  3. 02 Oct, 2019 25 commits
  4. 01 Oct, 2019 4 commits
    • Masashi Honma's avatar
      ath9k_htc: Discard undersized packets · cd486e62
      Masashi Honma authored
      Sometimes the hardware will push small packets that trigger a WARN_ON
      in mac80211. Discard them early to avoid this issue.
      
      This patch ports 2 patches from ath9k to ath9k_htc.
      commit 3c0efb74 "ath9k: discard
      undersized packets".
      commit df5c4150 "ath9k: correctly
      handle short radar pulses".
      
      [  112.835889] ------------[ cut here ]------------
      [  112.835971] WARNING: CPU: 5 PID: 0 at net/mac80211/rx.c:804 ieee80211_rx_napi+0xaac/0xb40 [mac80211]
      [  112.835973] Modules linked in: ath9k_htc ath9k_common ath9k_hw ath mac80211 cfg80211 libarc4 nouveau snd_hda_codec_hdmi intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_hda_codec video snd_hda_core ttm snd_hwdep drm_kms_helper snd_pcm crct10dif_pclmul snd_seq_midi drm snd_seq_midi_event crc32_pclmul snd_rawmidi ghash_clmulni_intel snd_seq aesni_intel aes_x86_64 crypto_simd cryptd snd_seq_device glue_helper snd_timer sch_fq_codel i2c_algo_bit fb_sys_fops snd input_leds syscopyarea sysfillrect sysimgblt intel_cstate mei_me intel_rapl_perf soundcore mxm_wmi lpc_ich mei kvm_intel kvm mac_hid irqbypass parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid hid raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear e1000e ahci libahci wmi
      [  112.836022] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.3.0-wt #1
      [  112.836023] Hardware name: MouseComputer Co.,Ltd. X99-S01/X99-S01, BIOS 1.0C-W7 04/01/2015
      [  112.836056] RIP: 0010:ieee80211_rx_napi+0xaac/0xb40 [mac80211]
      [  112.836059] Code: 00 00 66 41 89 86 b0 00 00 00 e9 c8 fa ff ff 4c 89 b5 40 ff ff ff 49 89 c6 e9 c9 fa ff ff 48 c7 c7 e0 a2 a5 c0 e8 47 41 b0 e9 <0f> 0b 48 89 df e8 5a 94 2d ea e9 02 f9 ff ff 41 39 c1 44 89 85 60
      [  112.836060] RSP: 0018:ffffaa6180220da8 EFLAGS: 00010286
      [  112.836062] RAX: 0000000000000024 RBX: ffff909a20eeda00 RCX: 0000000000000000
      [  112.836064] RDX: 0000000000000000 RSI: ffff909a2f957448 RDI: ffff909a2f957448
      [  112.836065] RBP: ffffaa6180220e78 R08: 00000000000006e9 R09: 0000000000000004
      [  112.836066] R10: 000000000000000a R11: 0000000000000001 R12: 0000000000000000
      [  112.836068] R13: ffff909a261a47a0 R14: 0000000000000000 R15: 0000000000000004
      [  112.836070] FS:  0000000000000000(0000) GS:ffff909a2f940000(0000) knlGS:0000000000000000
      [  112.836071] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  112.836073] CR2: 00007f4e3ffffa08 CR3: 00000001afc0a006 CR4: 00000000001606e0
      [  112.836074] Call Trace:
      [  112.836076]  <IRQ>
      [  112.836083]  ? finish_td+0xb3/0xf0
      [  112.836092]  ? ath9k_rx_prepare.isra.11+0x22f/0x2a0 [ath9k_htc]
      [  112.836099]  ath9k_rx_tasklet+0x10b/0x1d0 [ath9k_htc]
      [  112.836105]  tasklet_action_common.isra.22+0x63/0x110
      [  112.836108]  tasklet_action+0x22/0x30
      [  112.836115]  __do_softirq+0xe4/0x2da
      [  112.836118]  irq_exit+0xae/0xb0
      [  112.836121]  do_IRQ+0x86/0xe0
      [  112.836125]  common_interrupt+0xf/0xf
      [  112.836126]  </IRQ>
      [  112.836130] RIP: 0010:cpuidle_enter_state+0xa9/0x440
      [  112.836133] Code: 3d bc 20 38 55 e8 f7 1d 84 ff 49 89 c7 0f 1f 44 00 00 31 ff e8 28 29 84 ff 80 7d d3 00 0f 85 e6 01 00 00 fb 66 0f 1f 44 00 00 <45> 85 ed 0f 89 ff 01 00 00 41 c7 44 24 10 00 00 00 00 48 83 c4 18
      [  112.836134] RSP: 0018:ffffaa61800e3e48 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde
      [  112.836136] RAX: ffff909a2f96b340 RBX: ffffffffabb58200 RCX: 000000000000001f
      [  112.836137] RDX: 0000001a458adc5d RSI: 0000000026c9b581 RDI: 0000000000000000
      [  112.836139] RBP: ffffaa61800e3e88 R08: 0000000000000002 R09: 000000000002abc0
      [  112.836140] R10: ffffaa61800e3e18 R11: 000000000000002d R12: ffffca617fb40b00
      [  112.836141] R13: 0000000000000002 R14: ffffffffabb582d8 R15: 0000001a458adc5d
      [  112.836145]  ? cpuidle_enter_state+0x98/0x440
      [  112.836149]  ? menu_select+0x370/0x600
      [  112.836151]  cpuidle_enter+0x2e/0x40
      [  112.836154]  call_cpuidle+0x23/0x40
      [  112.836156]  do_idle+0x204/0x280
      [  112.836159]  cpu_startup_entry+0x1d/0x20
      [  112.836164]  start_secondary+0x167/0x1c0
      [  112.836169]  secondary_startup_64+0xa4/0xb0
      [  112.836173] ---[ end trace 9f4cd18479cc5ae5 ]---
      Signed-off-by: default avatarMasashi Honma <masashi.honma@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      cd486e62
    • Masashi Honma's avatar
      ath9k_htc: Modify byte order for an error message · e01fddc1
      Masashi Honma authored
      rs_datalen is be16 so we need to convert it before printing.
      Signed-off-by: default avatarMasashi Honma <masashi.honma@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      e01fddc1
    • Denis Efremov's avatar
      ath9k_hw: fix uninitialized variable data · 80e84f36
      Denis Efremov authored
      Currently, data variable in ar9003_hw_thermo_cal_apply() could be
      uninitialized if ar9300_otp_read_word() will fail to read the value.
      Initialize data variable with 0 to prevent an undefined behavior. This
      will be enough to handle error case when ar9300_otp_read_word() fails.
      
      Fixes: 80fe43f2 ("ath9k_hw: Read and configure thermocal for AR9462")
      Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
      Cc: John W. Linville <linville@tuxdriver.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      80e84f36
    • Anilkumar Kolli's avatar
      ath10k: fix backtrace on coredump · d98ddae8
      Anilkumar Kolli authored
      In a multiradio board with one QCA9984 and one AR9987
      after enabling the crashdump with module parameter
      coredump_mask=7, below backtrace is seen.
      
      vmalloc: allocation failure: 0 bytes
       kworker/u4:0: page allocation failure: order:0, mode:0x80d2
       CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 3.14.77 #130
       Workqueue: ath10k_wq ath10k_core_register_work [ath10k_core]
       (unwind_backtrace) from [<c021abf8>] (show_stack+0x10/0x14)
       (dump_stack+0x80/0xa0)
       (warn_alloc_failed+0xd0/0xfc)
       (__vmalloc_node_range+0x1b4/0x1d8)
       (__vmalloc_node+0x34/0x40)
       (vzalloc+0x24/0x30)
       (ath10k_coredump_register+0x6c/0x88 [ath10k_core])
       (ath10k_core_register_work+0x350/0xb34 [ath10k_core])
       (process_one_work+0x20c/0x32c)
       (worker_thread+0x228/0x360)
      
      This is due to ath10k_hw_mem_layout is not defined for AR9987.
      For coredump undefined hw ramdump_size is 0.
      Check for the ramdump_size before allocation memory.
      
      Tested on: AR9987, QCA9984
      FW version: 10.4-3.9.0.2-00044
      Signed-off-by: default avatarAnilkumar Kolli <akolli@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      d98ddae8