Skip to content
  1. Aug 17, 2020
  2. Aug 15, 2020
    • Wen Gong's avatar
      ath10k: correct the array index from mcs index for HT mode for QCA6174 · db04b755
      Wen Gong authored
      The mcs index of HT mode is 0 to 31, please refer http://mcsindex.com/
      
      .
      Its spatial stream(Nss) number is from 1 to 4, mcs index is 0~7 for
      Nss=1, 8~15 for Nss=2, 16~23 for Nss=3 and 24~31 is for Nss=4.
      
      The mcs is reported from firmware in wmi_tlv_peer_stats_info of
      event WMI_TLV_PEER_STATS_INFO_EVENTID, its range is from 0~15 for
      QCA6174 SDIO and PCIe. It is for both Nss=1 and Nss=2, and it has 2
      rate table supported_ht_mcs_rate_nss1 and supported_ht_mcs_rate_nss2
      in ath10k, they are for Nss=1 and Nss=2, each table has 8 rates.
      
      It need to find the matched row number with the mcs index, for example,
      mcs index is 2, it is <=7, so it is Nss=1, and match row 2 in table of
      Nss=1. If mcs index is 12, it is >= 8 and <= 15, so it is Nss=2, it
      match row 4(12-8) in table of Nss=2. If mcs index is >=16, it is for
      Nss=3/4, it need to add rate table, so it is not support in current
      ath10k.
      
      This patch is to find the row number in rate table of Nss=1 or Nss=2
      with the mcs index reported from firmware.
      
      This patch only effect the chips which supports_peer_stats_info of its
      hw_params is true, it is true only for QCA6174 currently.
      
      Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00048
      Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
      
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/1597392294-13124-1-git-send-email-wgong@codeaurora.org
      db04b755
    • Wen Gong's avatar
      ath10k: enable supports_peer_stats_info for QCA6174 PCI devices · cbcbabb9
      Wen Gong authored
      
      
      When using QCA6174 PCI devices working in station mode, after connected
      to AP, tx bitrate is always '1.0 MBit/s' in output of command 'iw wlan0
      station dump'. (QCA6174 SDIO devices are working fine.)
      
      After this patch, it show correct bitrate:
      
      Station c4:04:15:5d:97:22 (on wls1)
              inactive time:  312 ms
              rx bytes:       31496
              rx packets:     173
              tx bytes:       8625
              tx packets:     46
              tx retries:     0
              tx failed:      0
              signal:         -76 [-88, -80] dBm
              signal avg:     -75 [-82, -77] dBm
              tx bitrate:     39.0 MBit/s MCS 4
              rx bitrate:     26.0 MBit/s MCS 3
      
      Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
      
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/1597312029-32348-4-git-send-email-wgong@codeaurora.org
      cbcbabb9
    • Wen Gong's avatar
      ath10k: remove return for NL80211_STA_INFO_TX_BITRATE · 1cd6ba8a
      Wen Gong authored
      
      
      ath10k_sta_statistics is used to report many info to iw wlan0 link,
      if it return for empty legacy and nss of arsta->txrate, then the other
      stats after it will not be set.
      
      It has 4 bit to set after the return:
      NL80211_STA_INFO_TX_FAILED
      NL80211_STA_INFO_RX_BITRATE
      NL80211_STA_INFO_TX_BITRATE
      NL80211_STA_INFO_TX_RETRIES
      
      This patch not effect the info of above 4 bit for all hardware, reason
      as below:
      
      NL80211_STA_INFO_TX_FAILED is only for htt.disable_tx_comp is true, it
      is for QCA6174 SDIO.
      
      NL80211_STA_INFO_RX_BITRATE and NL80211_STA_INFO_TX_BITRATE are both
      set in ath10k_mac_sta_get_peer_stats_info, it is only enabled for chips
      which supports_peer_stats_info is true in hw_params, recently only for
      QCA6174 SDIO, NL80211_STA_INFO_TX_BITRATE is set again in function
      ath10k_mac_sta_get_peer_stats_info because the value which parsed from
      arsta->tx_rate_code and arsta->tx_bitrate_kbps is correct for QCA6174
      SDIO and PCIe, and the value arsta->txrate is not correct for QCA6174
      SDIO and PCIe, so it need to set again with the correct value.
      
      NL80211_STA_INFO_TX_RETRIES is use value of arsta->tx_retries, it is set
      in ath10k_update_per_peer_tx_stats, which accumulate the retry_pkts in
      HTT message from firmware, if the chips not support this feature, then
      it is always 0 after accumulate, then iw wlan0 station dump always show
      0 for retry count. If not set NL80211_STA_INFO_TX_RETRIES here, then it
      is still 0, so the result is same, then set NL80211_STA_INFO_TX_RETRIES
      has no effect.
      
      Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00048
      Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
      
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/1597312029-32348-3-git-send-email-wgong@codeaurora.org
      1cd6ba8a
    • Wen Gong's avatar
      ath10k: add wmi service peer stat info for wmi tlv · e39f32af
      Wen Gong authored
      
      
      ath10k_sta_statistics is used to report info for iw wlan0 link,
      it check ath10k_peer_stats_enabled, and ath10k_peer_stats_enabled
      check WMI_SERVICE_PEER_STATS bit of ar->wmi.svc_map. SVCMAP() for
      WMI_SERVICE_PEER_STATS was defined only for wmi_10x_svc_map and
      wmi_10_4_svc_map interfaces, it missed in wmi_tlv_svc_map, so it is
      not usable for iw wlan0 link for wmi tlv interface.
      
      If firmware report WMI_TLV_SERVICE_PEER_STATS_INFO for wmi tlv, then
      enable the WMI_SERVICE_PEER_STATS bit in ath10k, and then it pass check
      in ath10k_peer_stats_enabled and ath10k_sta_statistics pass check.
      
      Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00048
      Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
      
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/1597312029-32348-2-git-send-email-wgong@codeaurora.org
      e39f32af
  3. Aug 14, 2020
    • Wen Gong's avatar
      ath10k: start recovery process when payload length exceeds max htc length for sdio · 2fd3c8f3
      Wen Gong authored
      
      
      When simulate random transfer fail for sdio write and read, it happened
      "payload length exceeds max htc length" and recovery later sometimes.
      
      Test steps:
      1. Add config and update kernel:
      CONFIG_FAIL_MMC_REQUEST=y
      CONFIG_FAULT_INJECTION=y
      CONFIG_FAULT_INJECTION_DEBUG_FS=y
      
      2. Run simulate fail:
      cd /sys/kernel/debug/mmc1/fail_mmc_request
      echo 10 > probability
      echo 10 > times # repeat until hitting issues
      
      3. It happened payload length exceeds max htc length.
      [  199.935506] ath10k_sdio mmc1:0001:1: payload length 57005 exceeds max htc length: 4088
      ....
      [  264.990191] ath10k_sdio mmc1:0001:1: payload length 57005 exceeds max htc length: 4088
      
      4. after some time, such as 60 seconds, it start recovery which triggered
      by wmi command timeout for periodic scan.
      [  269.229232] ieee80211 phy0: Hardware restart was requested
      [  269.734693] ath10k_sdio mmc1:0001:1: device successfully recovered
      
      The simulate fail of sdio is not a real sdio transter fail, it only
      set an error status in mmc_should_fail_request after the transfer end,
      actually the transfer is success, then sdio_io_rw_ext_helper will
      return error status and stop transfer the left data. For example,
      the really RX len is 286 bytes, then it will split to 2 blocks in
      sdio_io_rw_ext_helper, one is 256 bytes, left is 30 bytes, if the
      first 256 bytes get an error status by mmc_should_fail_request,then
      the left 30 bytes will not read in this RX operation. Then when the
      next RX arrive, the left 30 bytes will be considered as the header
      of the read, the top 4 bytes of the 30 bytes will be considered as
      lookaheads, but actually the 4 bytes is not the lookaheads, so the len
      from this lookaheads is not correct, it exceeds max htc length 4088
      sometimes. When happened exceeds, the buffer chain is not matched between
      firmware and ath10k, then it need to start recovery ASAP. Recently then
      recovery will be started by wmi command timeout, but it will be long time
      later, for example, it is 60+ seconds later from the periodic scan, if
      it does not have periodic scan, it will be longer.
      
      Start recovery when it happened "payload length exceeds max htc length"
      will be reasonable.
      
      This patch only effect sdio chips.
      
      Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
      
      Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200108031957.22308-3-wgong@codeaurora.org
      2fd3c8f3
    • Alexander A. Klimov's avatar
      ath5k: Replace HTTP links with HTTPS ones · 5b525ce8
      Alexander A. Klimov authored
      Rationale:
      Reduces attack surface on kernel devs opening the links for MITM
      as HTTPS traffic is much harder to manipulate.
      
      Deterministic algorithm:
      For each file:
        If not .svg:
          For each line:
            If doesn't contain `\bxmlns\b`:
              For each link, `\bhttp://[^#
      
       \t\r\n]*(?:\w|/)`:
      	  If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
                  If both the HTTP and HTTPS versions
                  return 200 OK and serve the same content:
                    Replace HTTP with HTTPS.
      
      Signed-off-by: default avatarAlexander A. Klimov <grandmaster@al2klimov.de>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200719104041.57916-1-grandmaster@al2klimov.de
      5b525ce8
    • Julia Lawall's avatar
      ath: drop unnecessary list_empty · 18c25b40
      Julia Lawall authored
      list_for_each_entry{_safe} is able to handle an empty list.
      The only effect of avoiding the loop is not initializing the
      index variable.
      Drop list_empty tests in cases where these variables are not
      used.
      
      Note that list_for_each_entry{_safe} is defined in terms of
      list_first_entry, which indicates that it should not be used on an
      empty list.  But in list_for_each_entry{_safe}, the element obtained
      by list_first_entry is not really accessed, only the address of its
      list_head field is compared to the address of the list head, so the
      list_first_entry is safe.
      
      The semantic patch that makes this change for the list_for_each_entry
      case is as follows: (http://coccinelle.lip6.fr/
      
      )
      
      <smpl>
      @@
      expression x,e;
      statement S;
      identifier i;
      @@
      
      -if (!(list_empty(x)))
         list_for_each_entry(i,x,...) S
       ... when != i
      ? i = e
      </smpl>
      
      Signed-off-by: default avatarJulia Lawall <Julia.Lawall@inria.fr>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/1595761112-11003-8-git-send-email-Julia.Lawall@inria.fr
      18c25b40