]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rtw88: add rts condition
authorPo-Hao Huang <phhuang@realtek.com>
Tue, 9 Feb 2021 07:07:49 +0000 (15:07 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 12 Feb 2021 07:50:55 +0000 (09:50 +0200)
Since we set the IEEE80211_HW_HAS_RATE_CONTROL flag, so use_rts in
ieee80211_tx_info will never be set in the ieee80211_xmit_fast path.
Add length check for skb to decide whether rts is needed.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210209070755.23019-3-pkshih@realtek.com
drivers/net/wireless/realtek/rtw88/tx.c
drivers/net/wireless/realtek/rtw88/tx.h

index 18ec0088bf416de594b1bc5122d07b0682eee3cd..313b824dca6df6847c3e87b4c04a202af43cc5dd 100644 (file)
@@ -58,6 +58,10 @@ void rtw_tx_fill_tx_desc(struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb)
        SET_TX_DESC_SPE_RPT(txdesc, pkt_info->report);
        SET_TX_DESC_SW_DEFINE(txdesc, pkt_info->sn);
        SET_TX_DESC_USE_RTS(txdesc, pkt_info->rts);
+       if (pkt_info->rts) {
+               SET_TX_DESC_RTSRATE(txdesc, DESC_RATE24M);
+               SET_TX_DESC_DATA_RTS_SHORT(txdesc, 1);
+       }
        SET_TX_DESC_DISQSELSEQ(txdesc, pkt_info->dis_qselseq);
        SET_TX_DESC_EN_HWSEQ(txdesc, pkt_info->en_hwseq);
        SET_TX_DESC_HW_SSN_SEL(txdesc, pkt_info->hw_ssn_sel);
@@ -290,6 +294,7 @@ static void rtw_tx_data_pkt_info_update(struct rtw_dev *rtwdev,
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_hw *hw = rtwdev->hw;
        struct rtw_sta_info *si;
        u16 seq;
        u8 ampdu_factor = 0;
@@ -313,7 +318,7 @@ static void rtw_tx_data_pkt_info_update(struct rtw_dev *rtwdev,
                ampdu_density = get_tx_ampdu_density(sta);
        }
 
-       if (info->control.use_rts)
+       if (info->control.use_rts || skb->len > hw->wiphy->rts_threshold)
                pkt_info->rts = true;
 
        if (sta->vht_cap.vht_supported)
index 6673dbcaa21c115410bfb88488c2a2a1afac5c62..022288c9b5fcb5fec228b8c1e454ea1070933faf 100644 (file)
        le32p_replace_bits((__le32 *)(txdesc) + 0x03, value, GENMASK(21, 17))
 #define SET_TX_DESC_USE_RTS(tx_desc, value)                                    \
        le32p_replace_bits((__le32 *)(txdesc) + 0x03, value, BIT(12))
+#define SET_TX_DESC_RTSRATE(txdesc, value)                                     \
+       le32p_replace_bits((__le32 *)(txdesc) + 0x04, value, GENMASK(28, 24))
+#define SET_TX_DESC_DATA_RTS_SHORT(txdesc, value)                              \
+       le32p_replace_bits((__le32 *)(txdesc) + 0x05, value, BIT(12))
 #define SET_TX_DESC_AMPDU_DENSITY(txdesc, value)                               \
        le32p_replace_bits((__le32 *)(txdesc) + 0x02, value, GENMASK(22, 20))
 #define SET_TX_DESC_DATA_STBC(txdesc, value)                                   \