diff options
author | Fabio Aiuto <fabioaiuto83@gmail.com> | 2021-07-17 16:56:42 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-21 10:21:59 +0200 |
commit | 5402cc178c5ddcac871456eacbf8bc5ad72d41e9 (patch) | |
tree | 0ce6da5a8f4d0cc482270a0182b537dfc651bdd3 | |
parent | b658acbf64ae38b8fca982c2929ccc0bf4eb1ea2 (diff) | |
download | linux-stable-5402cc178c5ddcac871456eacbf8bc5ad72d41e9.tar.gz linux-stable-5402cc178c5ddcac871456eacbf8bc5ad72d41e9.tar.bz2 linux-stable-5402cc178c5ddcac871456eacbf8bc5ad72d41e9.zip |
staging: rtl8723bs: add get_channel cfg80211 implementation
add get_channel cfg80211 implementation to let userspace
programs rely on nl80211 protocol to display channel
information.
Old iw dev output:
phy#0
Interface wlan0
ifindex 2
wdev 0x1
addr 34:c3:d2:73:eb:c7
ssid Fabio
type managed
txpower 12.00 dBm
Fixed output:
phy#0
Interface wlan0
ifindex 2
wdev 0x1
addr 34:c3:d2:73:eb:c7
ssid Fabio
type managed
new--> channel 11 (2462 MHz), width: 20 MHz, center1: 2462 Mhz
txpower 12.00 dBm
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/2f00479d8369b82b590291bb0edf27bc3041b0f0.1626533647.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index fd747c8d920e..d198d10ec272 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -2100,7 +2100,58 @@ void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char cfg80211_del_sta(ndev, da, GFP_ATOMIC); } +static u8 rtw_get_chan_type(struct adapter *adapter) +{ + struct mlme_ext_priv *mlme_ext = &adapter->mlmeextpriv; + + switch (mlme_ext->cur_bwmode) { + case CHANNEL_WIDTH_20: + if (IsSupportedHT(adapter->registrypriv.wireless_mode)) + return NL80211_CHAN_HT20; + else + return NL80211_CHAN_NO_HT; + case CHANNEL_WIDTH_40: + if (mlme_ext->cur_ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) + return NL80211_CHAN_HT40PLUS; + else + return NL80211_CHAN_HT40MINUS; + default: + return NL80211_CHAN_HT20; + } + return NL80211_CHAN_HT20; +} + +static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, + struct cfg80211_chan_def *chandef) +{ + struct adapter *adapter = wiphy_to_adapter(wiphy); + struct registry_priv *registrypriv = &adapter->registrypriv; + enum nl80211_channel_type chan_type; + struct ieee80211_channel *chan = NULL; + int channel; + int freq; + + if (!adapter->rtw_wdev) + return -ENODEV; + + channel = rtw_get_oper_ch(adapter); + if (!channel) + return -ENODATA; + + freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); + + chan = ieee80211_get_channel(adapter->rtw_wdev->wiphy, freq); + + if (registrypriv->ht_enable) { + chan_type = rtw_get_chan_type(adapter); + cfg80211_chandef_create(chandef, chan, chan_type); + } else { + cfg80211_chandef_create(chandef, chan, NL80211_CHAN_NO_HT); + } + + return 0; +} static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev) { @@ -2838,7 +2889,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .set_pmksa = cfg80211_rtw_set_pmksa, .del_pmksa = cfg80211_rtw_del_pmksa, .flush_pmksa = cfg80211_rtw_flush_pmksa, - + .get_channel = cfg80211_rtw_get_channel, .add_virtual_intf = cfg80211_rtw_add_virtual_intf, .del_virtual_intf = cfg80211_rtw_del_virtual_intf, |