mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 13:59:45 -04:00
wifi: rtl8xxxu: Remove usage of tx_info->control.rates[0].flags
As this driver uses HAS_RATE_CONTROL, rate_flags will not be provided by mac80211. Stop using tx_info->control.rates[0].flags and ieee80211_get_rts_cts_rate() and use rts_threshold and bss_conf.use_cts_prot instead to determine when to use RTS and CTS. Send RTS with 24M rate like the vendor drivers. Also set this RTS rate for ampdu_enable = true, because we also enable RTS for these frames. Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230428150833.218605-17-martin.kaistra@linutronix.de
This commit is contained in:
committed by
Kalle Valo
parent
07342528f7
commit
19b396c241
@@ -5255,7 +5255,6 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
u8 *qc = ieee80211_get_qos_ctl(hdr);
|
||||
u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
u32 rate = 0;
|
||||
u16 rate_flags = tx_info->control.rates[0].flags;
|
||||
u16 seq_number;
|
||||
|
||||
if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX)
|
||||
@@ -5296,10 +5295,10 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
* rts_rate is zero if RTS/CTS or CTS to SELF are not enabled
|
||||
*/
|
||||
tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT);
|
||||
if (ampdu_enable || (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
|
||||
if (ampdu_enable || tx_info->control.use_rts) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE);
|
||||
} else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
|
||||
} else if (tx_info->control.use_cts_prot) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE);
|
||||
}
|
||||
@@ -5322,7 +5321,6 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
u8 *qc = ieee80211_get_qos_ctl(hdr);
|
||||
u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
u32 rate = 0;
|
||||
u16 rate_flags = tx_info->control.rates[0].flags;
|
||||
u16 seq_number;
|
||||
|
||||
tx_desc40 = (struct rtl8xxxu_txdesc40 *)tx_desc32;
|
||||
@@ -5363,13 +5361,14 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
tx_desc40->txdw5 |= cpu_to_le32(TXDESC40_SHORT_PREAMBLE);
|
||||
|
||||
tx_desc40->txdw4 |= cpu_to_le32(rts_rate << TXDESC40_RTS_RATE_SHIFT);
|
||||
|
||||
/*
|
||||
* rts_rate is zero if RTS/CTS or CTS to SELF are not enabled
|
||||
*/
|
||||
if (ampdu_enable || (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
|
||||
if (ampdu_enable || tx_info->control.use_rts) {
|
||||
tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_RTS_CTS_ENABLE);
|
||||
tx_desc40->txdw3 |= cpu_to_le32(TXDESC40_HW_RTS_ENABLE);
|
||||
} else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
|
||||
} else if (tx_info->control.use_cts_prot) {
|
||||
/*
|
||||
* For some reason the vendor driver doesn't set
|
||||
* TXDESC40_HW_RTS_ENABLE for CTS to SELF
|
||||
@@ -5396,7 +5395,6 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
u8 *qc = ieee80211_get_qos_ctl(hdr);
|
||||
u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
u32 rate = 0;
|
||||
u16 rate_flags = tx_info->control.rates[0].flags;
|
||||
u16 seq_number;
|
||||
|
||||
seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl));
|
||||
@@ -5451,10 +5449,10 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
* rts_rate is zero if RTS/CTS or CTS to SELF are not enabled
|
||||
*/
|
||||
tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT);
|
||||
if (ampdu_enable || (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
|
||||
if (ampdu_enable || tx_info->control.use_rts) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE);
|
||||
} else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
|
||||
} else if (tx_info->control.use_cts_prot) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE);
|
||||
}
|
||||
@@ -5478,7 +5476,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,
|
||||
struct device *dev = &priv->udev->dev;
|
||||
u32 queue, rts_rate;
|
||||
u16 pktlen = skb->len;
|
||||
u16 rate_flag = tx_info->control.rates[0].flags;
|
||||
int tx_desc_size = priv->fops->tx_desc_size;
|
||||
u8 macid;
|
||||
int ret;
|
||||
@@ -5563,20 +5560,23 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,
|
||||
}
|
||||
}
|
||||
|
||||
if (rate_flag & IEEE80211_TX_RC_SHORT_GI ||
|
||||
(ieee80211_is_data_qos(hdr->frame_control) &&
|
||||
sta && sta->deflink.ht_cap.cap &
|
||||
(IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20)))
|
||||
if (ieee80211_is_data_qos(hdr->frame_control) &&
|
||||
sta && sta->deflink.ht_cap.cap &
|
||||
(IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20))
|
||||
sgi = true;
|
||||
|
||||
if (rate_flag & IEEE80211_TX_RC_USE_SHORT_PREAMBLE ||
|
||||
(sta && vif && vif->bss_conf.use_short_preamble))
|
||||
if (sta && vif && vif->bss_conf.use_short_preamble)
|
||||
short_preamble = true;
|
||||
|
||||
if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS)
|
||||
rts_rate = ieee80211_get_rts_cts_rate(hw, tx_info)->hw_value;
|
||||
else if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT)
|
||||
rts_rate = ieee80211_get_rts_cts_rate(hw, tx_info)->hw_value;
|
||||
if (skb->len > hw->wiphy->rts_threshold)
|
||||
tx_info->control.use_rts = true;
|
||||
|
||||
if (sta && vif && vif->bss_conf.use_cts_prot)
|
||||
tx_info->control.use_cts_prot = true;
|
||||
|
||||
if (ampdu_enable || tx_info->control.use_rts ||
|
||||
tx_info->control.use_cts_prot)
|
||||
rts_rate = DESC_RATE_24M;
|
||||
else
|
||||
rts_rate = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user