]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtl8xxxu: Enable 40 MHz width by default
authorBitterblue Smith <rtl8821cerfe2@gmail.com>
Thu, 20 Nov 2025 14:13:49 +0000 (16:13 +0200)
committerPing-Ke Shih <pkshih@realtek.com>
Fri, 21 Nov 2025 05:33:41 +0000 (13:33 +0800)
40 MHz support is hidden behind the ht40_2g module parameter with
this comment:

/*
 * Some APs will negotiate HT20_40 in a noisy environment leading
 * to miserable performance. Rather than defaulting to this, only
 * enable it if explicitly requested at module load time.
 */

This parameter was added in commit 26f1fad29ad9 ("New driver:
rtl8xxxu (mac80211)"). Back then rtl8xxxu only supported RTL8723AU
and the RTL8192CU family. It's entirely possible the miserable
performance was due to mistakes in the channel switching function,
which were fixed in a previous patch.

Delete the ht40_2g module parameter. If someone still needs to
disable 40 MHz support, cfg80211 has the module parameter
cfg80211_disable_40mhz_24ghz. That works too.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/4f053103-adfd-4ead-acb3-ef69127a4bab@gmail.com
drivers/net/wireless/realtek/rtl8xxxu/core.c

index a18f73aea83741c8f4459c72ada788cd05fa8c97..c06ad064f37c654409c581c76c101d44691a3bb6 100644 (file)
@@ -20,7 +20,6 @@
 #define DRIVER_NAME "rtl8xxxu"
 
 int rtl8xxxu_debug;
-static bool rtl8xxxu_ht40_2g;
 static bool rtl8xxxu_dma_aggregation;
 static int rtl8xxxu_dma_agg_timeout = -1;
 static int rtl8xxxu_dma_agg_pages = -1;
@@ -45,8 +44,6 @@ MODULE_FIRMWARE("rtlwifi/rtl8192fufw.bin");
 
 module_param_named(debug, rtl8xxxu_debug, int, 0600);
 MODULE_PARM_DESC(debug, "Set debug mask");
-module_param_named(ht40_2g, rtl8xxxu_ht40_2g, bool, 0600);
-MODULE_PARM_DESC(ht40_2g, "Enable HT40 support on the 2.4GHz band");
 module_param_named(dma_aggregation, rtl8xxxu_dma_aggregation, bool, 0600);
 MODULE_PARM_DESC(dma_aggregation, "Enable DMA packet aggregation");
 module_param_named(dma_agg_timeout, rtl8xxxu_dma_agg_timeout, int, 0600);
@@ -4896,8 +4893,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                                sgi = 1;
 
                        highest_rate = fls(ramask) - 1;
-                       if (rtl8xxxu_ht40_2g &&
-                           (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40))
+                       if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)
                                bw = RATE_INFO_BW_40;
                        else
                                bw = RATE_INFO_BW_20;
@@ -7851,7 +7847,8 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
        sband->ht_cap.ht_supported = true;
        sband->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
        sband->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16;
-       sband->ht_cap.cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40;
+       sband->ht_cap.cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 |
+                           IEEE80211_HT_CAP_SUP_WIDTH_20_40;
        memset(&sband->ht_cap.mcs, 0, sizeof(sband->ht_cap.mcs));
        sband->ht_cap.mcs.rx_mask[0] = 0xff;
        sband->ht_cap.mcs.rx_mask[4] = 0x01;
@@ -7860,15 +7857,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
                sband->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
        }
        sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
-       /*
-        * Some APs will negotiate HT20_40 in a noisy environment leading
-        * to miserable performance. Rather than defaulting to this, only
-        * enable it if explicitly requested at module load time.
-        */
-       if (rtl8xxxu_ht40_2g) {
-               dev_info(&udev->dev, "Enabling HT_20_40 on the 2.4GHz band\n");
-               sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
-       }
+
        hw->wiphy->bands[NL80211_BAND_2GHZ] = sband;
 
        hw->wiphy->rts_threshold = 2347;