Skip to content

Commit

Permalink
rtw88/rtw89: add module_param to enable/disable HT/VHT and EHT
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Bjoern A. Zeeb authored and fichtner committed Feb 18, 2025
1 parent 43d7574 commit c8d1d54
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
22 changes: 22 additions & 0 deletions sys/contrib/dev/rtw88/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,},
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
30 changes: 30 additions & 0 deletions sys/contrib/dev/rtw89/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit c8d1d54

Please sign in to comment.