rtw88/rtw89: add module_param to enable/disable HT/VHT and EHT

In order to better test HT and VHT support with LinuxKPI add (tunable)
options disabled by default to on-demand enable HT/VHT
and for rtw89 also EHT.

It is expected that we will remove this FreeBSD-specific code again in
the future.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7a5b55e3b448744b099c274763992cba2e3ebce5)
This commit is contained in:
Bjoern A. Zeeb 2025-01-26 00:26:14 +00:00 committed by Franco Fichtner
parent 43d7574526
commit c8d1d54f5b
2 changed files with 52 additions and 0 deletions

View File

@ -46,6 +46,16 @@ MODULE_PARM_DESC(disable_lps_deep, "Set Y to disable Deep PS");
MODULE_PARM_DESC(support_bf, "Set Y to enable beamformee support");
MODULE_PARM_DESC(debug_mask, "Debugging mask");
#if defined(__FreeBSD__)
static bool rtw_ht_support = false;
module_param_named(support_ht, rtw_ht_support, bool, 0644);
MODULE_PARM_DESC(support_ht, "Set to Y to enable HT support");
static bool rtw_vht_support = false;
module_param_named(support_vht, rtw_vht_support, bool, 0644);
MODULE_PARM_DESC(support_vht, "Set to Y to enable VHT support");
#endif
static struct ieee80211_channel rtw_channeltable_2g[] = {
{.center_freq = 2412, .hw_value = 1,},
{.center_freq = 2417, .hw_value = 2,},
@ -1666,7 +1676,11 @@ static void rtw_set_supported_band(struct ieee80211_hw *hw,
sband = kmemdup(&rtw_band_2ghz, sizeof(*sband), GFP_KERNEL);
if (!sband)
goto err_out;
#if defined(__linux__)
if (chip->ht_supported)
#elif defined(__FreeBSD__)
if (rtw_ht_support && chip->ht_supported)
#endif
rtw_init_ht_cap(rtwdev, &sband->ht_cap);
hw->wiphy->bands[NL80211_BAND_2GHZ] = sband;
}
@ -1675,9 +1689,17 @@ static void rtw_set_supported_band(struct ieee80211_hw *hw,
sband = kmemdup(&rtw_band_5ghz, sizeof(*sband), GFP_KERNEL);
if (!sband)
goto err_out;
#if defined(__linux__)
if (chip->ht_supported)
#elif defined(__FreeBSD__)
if (rtw_ht_support && chip->ht_supported)
#endif
rtw_init_ht_cap(rtwdev, &sband->ht_cap);
#if defined(__linux__)
if (chip->vht_supported)
#elif defined(__FreeBSD__)
if (rtw_vht_support && chip->vht_supported)
#endif
rtw_init_vht_cap(rtwdev, &sband->vht_cap);
hw->wiphy->bands[NL80211_BAND_5GHZ] = sband;
}

View File

@ -29,6 +29,21 @@ static bool rtw89_disable_ps_mode;
module_param_named(disable_ps_mode, rtw89_disable_ps_mode, bool, 0644);
MODULE_PARM_DESC(disable_ps_mode, "Set Y to disable low power mode");
#if defined(__FreeBSD__)
static bool rtw_ht_support = false;
module_param_named(support_ht, rtw_ht_support, bool, 0644);
MODULE_PARM_DESC(support_ht, "Set to Y to enable HT support");
static bool rtw_vht_support = false;
module_param_named(support_vht, rtw_vht_support, bool, 0644);
MODULE_PARM_DESC(support_vht, "Set to Y to enable VHT support");
static bool rtw_eht_support = false;
module_param_named(support_eht, rtw_eht_support, bool, 0644);
MODULE_PARM_DESC(support_eht, "Set to Y to enable EHT support");
#endif
#define RTW89_DEF_CHAN(_freq, _hw_val, _flags, _band) \
{ .center_freq = _freq, .hw_value = _hw_val, .flags = _flags, .band = _band, }
#define RTW89_DEF_CHAN_2G(_freq, _hw_val) \
@ -4006,7 +4021,13 @@ static int rtw89_core_set_supported_band(struct rtw89_dev *rtwdev)
sband_2ghz = kmemdup(&rtw89_sband_2ghz, size, GFP_KERNEL);
if (!sband_2ghz)
goto err;
#if defined(__FreeBSD__)
if (rtw_ht_support)
#endif
rtw89_init_ht_cap(rtwdev, &sband_2ghz->ht_cap);
#if defined(__FreeBSD__)
if (rtw_eht_support)
#endif
rtw89_init_he_eht_cap(rtwdev, NL80211_BAND_2GHZ, sband_2ghz);
hw->wiphy->bands[NL80211_BAND_2GHZ] = sband_2ghz;
}
@ -4015,8 +4036,17 @@ static int rtw89_core_set_supported_band(struct rtw89_dev *rtwdev)
sband_5ghz = kmemdup(&rtw89_sband_5ghz, size, GFP_KERNEL);
if (!sband_5ghz)
goto err;
#if defined(__FreeBSD__)
if (rtw_ht_support)
#endif
rtw89_init_ht_cap(rtwdev, &sband_5ghz->ht_cap);
#if defined(__FreeBSD__)
if (rtw_vht_support)
#endif
rtw89_init_vht_cap(rtwdev, &sband_5ghz->vht_cap);
#if defined(__FreeBSD__)
if (rtw_eht_support)
#endif
rtw89_init_he_eht_cap(rtwdev, NL80211_BAND_5GHZ, sband_5ghz);
hw->wiphy->bands[NL80211_BAND_5GHZ] = sband_5ghz;
}