1. 04 Oct, 2019 15 commits
    • Chung-Hsien Hsu's avatar
      brcmfmac: add support for SAE authentication offload · 3b1e0a7b
      Chung-Hsien Hsu authored
      The firmware may have SAE authentication code built-in. This is
      detected by the driver and indicated in the wiphy features flags.
      User-space can use this flag to determine whether or not to provide
      the password material for SAE authentication in the nl80211 CONNECT
      command.
      Signed-off-by: default avatarChung-Hsien Hsu <stanley.hsu@cypress.com>
      Signed-off-by: default avatarChi-Hsien Lin <chi-hsien.lin@cypress.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      3b1e0a7b
    • Ping-Ke Shih's avatar
      rtw88: fix error handling when setup efuse info · f4268729
      Ping-Ke Shih authored
      Disable efuse if the efuse is enabled when we failed to setup the efuse
      information, otherwise the hardware will not turn off.
      
      Fixes: e3037485 ("rtw88: new Realtek 802.11ac driver")
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      f4268729
    • Ping-Ke Shih's avatar
      rtw88: fix NSS of hw_cap · 4f5bb7ff
      Ping-Ke Shih authored
      8822C is a 2x2 11ac chip, and then NSS must be less or equal to 2. However,
      current nss of hw cap is 3, likes
      	hw cap: hci=0x0f, bw=0x07, ptcl=0x03, ant_num=7, nss=3
      
      This commit adds constraint to make sure NSS <= rf_path_num, and result
      looks like
      	hw cap: hci=0x0f, bw=0x07, ptcl=0x03, ant_num=7, nss=2
      
      Fixes: e3037485 ("rtw88: new Realtek 802.11ac driver")
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      4f5bb7ff
    • Ping-Ke Shih's avatar
      rtw88: use struct rtw_fw_hdr to access firmware header · cc20a713
      Ping-Ke Shih authored
      This commit doesn't change logic at all, just use struct rtw_fw_hdr to
      access fixed part of 64 bytes header. Since remaining part is variable
      length data of actual firmware, we don't define them within the struct.
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      cc20a713
    • Yan-Hsuan Chuang's avatar
      rtw88: raise firmware version debug level · bc3696e0
      Yan-Hsuan Chuang authored
      It's better to print firmware version at load time.
      But since we need to set debug_mask properly to default print
      rtw_dbg(), raise the debug level to rtw_info() instead.
      
      Also change the multiple line style to one line only, it will
      be easier for log analyzing.
      Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      bc3696e0
    • 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 24 commits