]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
rtw88: add TX-AMSDU support
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Wed, 2 Oct 2019 06:35:23 +0000 (14:35 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 20 Mar 2020 21:31:25 +0000 (16:31 -0500)
BugLink: https://bugs.launchpad.net/bugs/1780590
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: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
(cherry picked from commit 127eef1d46f80056fe9f18406c6eab38778d8a06)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/net/wireless/realtek/rtw88/fw.c
drivers/net/wireless/realtek/rtw88/main.c

index 86ff7ba889a7a6af2b0c8055af390b565d03cbef..65594393dd1e792b4b87ac899ec66449785b196e 100644 (file)
@@ -29,6 +29,28 @@ static void rtw_fw_c2h_cmd_handle_ext(struct rtw_dev *rtwdev,
        }
 }
 
+static u16 get_max_amsdu_len(u32 bit_rate)
+{
+       /* lower than ofdm, do not aggregate */
+       if (bit_rate < 550)
+               return 1;
+
+       /* lower than 20M 2ss mcs8, make it small */
+       if (bit_rate < 1800)
+               return 1200;
+
+       /* lower than 40M 2ss mcs9, make it medium */
+       if (bit_rate < 4000)
+               return 2600;
+
+       /* not yet 80M 2ss mcs8/9, make it twice regular packet size */
+       if (bit_rate < 7000)
+               return 3500;
+
+       /* unlimited */
+       return 0;
+}
+
 struct rtw_fw_iter_ra_data {
        struct rtw_dev *rtwdev;
        u8 *payload;
@@ -83,6 +105,8 @@ legacy:
 
        si->ra_report.desc_rate = rate;
        si->ra_report.bit_rate = bit_rate;
+
+       sta->max_rc_amsdu_len = get_max_amsdu_len(bit_rate);
 }
 
 static void rtw_fw_ra_report_handle(struct rtw_dev *rtwdev, u8 *payload,
index bb62cd255d42b13520469616e94c7798daa1392e..00ca2d14e0bb582985411ed7671349f6aa28e184 100644 (file)
@@ -1310,6 +1310,7 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
        ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
        ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU);
        ieee80211_hw_set(hw, HAS_RATE_CONTROL);
+       ieee80211_hw_set(hw, TX_AMSDU);
 
        hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
                                     BIT(NL80211_IFTYPE_AP) |