wifi: rtl8xxxu: Remove usage of ieee80211_get_tx_rate()
authorMartin Kaistra <martin.kaistra@linutronix.de>
Fri, 28 Apr 2023 15:08:30 +0000 (17:08 +0200)
committerKalle Valo <kvalo@kernel.org>
Fri, 5 May 2023 07:30:14 +0000 (10:30 +0300)
As this driver uses HAS_RATE_CONTROL, tx_rates will not be provided by
mac80211.

For some frames c->control.rates[0].idx is negative, which means
ieee80211_get_tx_rate() will print a warning and return NULL.

Only management frames have USE_DRIVER_RATE set, so for all others the
rate info of txdesc is ignored anyway.

Remove call to ieee80211_get_tx_rate() and send management frames with
1M (rate info = 0).

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-16-martin.kaistra@linutronix.de
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index 9e9d172a37f1e6b221a522f70e8656f306dc0d6b..a2cc9177fba4992ca7a14dd888437c36b2b55dd8 100644 (file)
@@ -5250,21 +5250,14 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
                        bool short_preamble, bool ampdu_enable, u32 rts_rate,
                        u8 macid)
 {
-       struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
        struct rtl8xxxu_priv *priv = hw->priv;
        struct device *dev = &priv->udev->dev;
        u8 *qc = ieee80211_get_qos_ctl(hdr);
        u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
-       u32 rate;
+       u32 rate = 0;
        u16 rate_flags = tx_info->control.rates[0].flags;
        u16 seq_number;
 
-       if (rate_flags & IEEE80211_TX_RC_MCS &&
-           !ieee80211_is_mgmt(hdr->frame_control))
-               rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0;
-       else
-               rate = tx_rate->hw_value;
-
        if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX)
                dev_info(dev, "%s: TX rate: %d, pkt size %u\n",
                         __func__, rate, le16_to_cpu(tx_desc->pkt_size));
@@ -5323,24 +5316,17 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
                        bool short_preamble, bool ampdu_enable, u32 rts_rate,
                        u8 macid)
 {
-       struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
        struct rtl8xxxu_priv *priv = hw->priv;
        struct device *dev = &priv->udev->dev;
        struct rtl8xxxu_txdesc40 *tx_desc40;
        u8 *qc = ieee80211_get_qos_ctl(hdr);
        u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
-       u32 rate;
+       u32 rate = 0;
        u16 rate_flags = tx_info->control.rates[0].flags;
        u16 seq_number;
 
        tx_desc40 = (struct rtl8xxxu_txdesc40 *)tx_desc32;
 
-       if (rate_flags & IEEE80211_TX_RC_MCS &&
-           !ieee80211_is_mgmt(hdr->frame_control))
-               rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0;
-       else
-               rate = tx_rate->hw_value;
-
        if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX)
                dev_info(dev, "%s: TX rate: %d, pkt size %u\n",
                         __func__, rate, le16_to_cpu(tx_desc40->pkt_size));
@@ -5404,22 +5390,15 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
                        bool short_preamble, bool ampdu_enable, u32 rts_rate,
                        u8 macid)
 {
-       struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
        struct rtl8xxxu_priv *priv = hw->priv;
        struct device *dev = &priv->udev->dev;
        struct rtl8xxxu_ra_info *ra = &priv->ra_info;
        u8 *qc = ieee80211_get_qos_ctl(hdr);
        u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
-       u32 rate;
+       u32 rate = 0;
        u16 rate_flags = tx_info->control.rates[0].flags;
        u16 seq_number;
 
-       if (rate_flags & IEEE80211_TX_RC_MCS &&
-           !ieee80211_is_mgmt(hdr->frame_control))
-               rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0;
-       else
-               rate = tx_rate->hw_value;
-
        seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl));
 
        if (ieee80211_is_data(hdr->frame_control)) {