staging: rtl8723bs: add get_channel implementation
v2 cover staging: rtl8723bs: add get_channel implementation
This patchset adds cfg80211 get_channel implementation. One of the benefits is having displayed channel info in iw dev output.
Done some code cleaning as well.
Tested-on: Lenovo Ideapad MiiX-300-10IBY
Fabio Aiuto (10):
staging: rtl8723bs: add get_channel cfg80211 implementation
staging: rtl8723bs: convert IsSupportedHT to snake_case
staging: rtl8723bs: fix camel case issue
staging: rtl8723bs: fix camel case name in macro IsLegacyOnly()
staging: rtl8723bs: fix camel case in argument of macro is_legacy_only
staging: rtl8723bs: fix camel case name in macro IsSupported24G
staging: rtl8723bs: fix post-commit camel case issues
staging: rtl8723bs: remove unused macros in include/ieee80211.h
staging: rtl8723bs: fix camel case name in macro IsSupportedTxCCK
staging: rtl8723bs: fix camel case argument name in macro
is_supported_tx_cck
drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- .../staging/rtl8723bs/core/rtw_ioctl_set.c | 2 +- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- .../staging/rtl8723bs/core/rtw_wlan_util.c | 4 +- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- drivers/staging/rtl8723bs/hal/hal_com.c | 4 +- drivers/staging/rtl8723bs/include/ieee80211.h | 16 ++---- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 53 ++++++++++++++++++- 8 files changed, 64 insertions(+), 21 deletions(-)
Signature · 1 line
2.20.1
PATCH v2 1/10 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
--- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +52 -1
@@ -2100,7 +2100,58 @@ void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned charcfg80211_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,
Signature · 1 line
2.20.1
PATCH v2 2/10 staging: rtl8723bs: convert IsSupportedHT to snake_case
In reply to Fabio Aiutoconvert IsSupportedHT to snake case is_supported_ht.
--- drivers/staging/rtl8723bs/core/rtw_ioctl_set.c | 2 +- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +- drivers/staging/rtl8723bs/include/ieee80211.h | 2 +- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +1 -1
@@ -554,7 +554,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) short_GI =query_ra_short_GI (psta); -if (IsSupportedHT (psta->wireless_mode)) { +if (is_supported_ht (psta->wireless_mode)) {rtw_hal_get_hwreg (adapter,HW_VAR_RF_TYPE , (u8 *)(&rf_type)); max_rate = rtw_mcs_rate(rf_type,
drivers/staging/rtl8723bs/core/rtw_wlan_util.c +1 -1
@@ -55,7 +55,7 @@ u8 networktype_to_raid_ex(struct adapter *adapter, struct sta_info *psta)if (cur_rf_type ==RF_1T1R ) { rf_type =RF_1T1R ; - }else if (IsSupportedHT (psta->wireless_mode)) { + }else if (is_supported_ht (psta->wireless_mode)) {if (psta->ra_mask &0xfff00000 ) rf_type =RF_2T2R ; }
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
@@ -167,7 +167,7 @@ enum network_type {#define IsSupportedTxCCK (NetType) (((NetType) & (WIRELESS_11B)) ? true : false)#define IsSupportedTxOFDM (NetType) (((NetType) & (WIRELESS_11G) ? true : false) -#define IsSupportedHT (NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false) +#define is_supported_ht (NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false)struct ieee_param {u32 cmd;
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +1 -1
@@ -2106,7 +2106,7 @@ static u8 rtw_get_chan_type(struct adapter *adapter)switch (mlme_ext->cur_bwmode) {case CHANNEL_WIDTH_20 : -if (IsSupportedHT (adapter->registrypriv.wireless_mode)) +if (is_supported_ht (adapter->registrypriv.wireless_mode))return NL80211_CHAN_HT20 ;else return NL80211_CHAN_NO_HT ;
Signature · 1 line
2.20.1
PATCH v2 3/10 staging: rtl8723bs: fix camel case issue
In reply to Fabio Aiutofix following post commit hook checkpatch issue:
CHECK: Avoid CamelCase: <NetType>
45: FILE: drivers/staging/rtl8723bs/include/ieee80211.h:170:
+#define is_supported_ht(NetType) (((NetType)
& (WIRELESS_11_24N)) ? true : false)
--- drivers/staging/rtl8723bs/include/ieee80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
@@ -167,7 +167,7 @@ enum network_type {#define IsSupportedTxCCK (NetType) (((NetType) & (WIRELESS_11B)) ? true : false)#define IsSupportedTxOFDM (NetType) (((NetType) & (WIRELESS_11G) ? true : false) -#define is_supported_ht (NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false) +#define is_supported_ht (net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)struct ieee_param {u32 cmd;
Signature · 1 line
2.20.1
PATCH v2 4/10 staging: rtl8723bs: fix camel case name in macro IsLegacyOnly()
In reply to Fabio Aiutofix camel case name in macro IsLegacyOnly()
--- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +- drivers/staging/rtl8723bs/include/ieee80211.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/hal_btcoex.c +1 -1
@@ -401,7 +401,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf)break ;case BTC_GET_U4_WIFI_BW : -if (IsLegacyOnly (mlmeext->cur_wireless_mode)) +if (is_legacy_only (mlmeext->cur_wireless_mode)) *pU4Tmp =BTC_WIFI_BW_LEGACY ;else if (pHalData->CurrentChannelBW ==CHANNEL_WIDTH_20 ) *pU4Tmp =BTC_WIFI_BW_HT20 ;
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
@@ -154,7 +154,7 @@ enum network_type {#define SUPPORTED_24G_NETTYPE_MSK (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N) -#define IsLegacyOnly (NetType) ((NetType) == ((NetType) & (WIRELESS_11BG))) +#define is_legacy_only (NetType) ((NetType) == ((NetType) & (WIRELESS_11BG)))#define IsSupported24G (NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false)
Signature · 1 line
2.20.1
PATCH v2 5/10 staging: rtl8723bs: fix camel case in argument of macro is_legacy_only
In reply to Fabio Aiutofix camel case in argument of macro is_legacy_only
--- drivers/staging/rtl8723bs/include/ieee80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
@@ -154,7 +154,7 @@ enum network_type {#define SUPPORTED_24G_NETTYPE_MSK (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N) -#define is_legacy_only (NetType) ((NetType) == ((NetType) & (WIRELESS_11BG))) +#define is_legacy_only (net_type) ((net_type) == ((net_type) & (WIRELESS_11BG)))#define IsSupported24G (NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false)
Signature · 1 line
2.20.1
PATCH v2 6/10 staging: rtl8723bs: fix camel case name in macro IsSupported24G
In reply to Fabio Aiutofix camel case name in macro IsSupported24G
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +- drivers/staging/rtl8723bs/hal/hal_com.c | 2 +- drivers/staging/rtl8723bs/include/ieee80211.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1 -1
@@ -343,7 +343,7 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_cif (ChannelPlan >=RT_CHANNEL_DOMAIN_MAX && ChannelPlan !=RT_CHANNEL_DOMAIN_REALTEK_DEFINE )return chanset_size; -if (IsSupported24G (padapter->registrypriv.wireless_mode)) { +if (is_supported_24g (padapter->registrypriv.wireless_mode)) { b2_4GBand = true;if (RT_CHANNEL_DOMAIN_REALTEK_DEFINE == ChannelPlan) Index2G =RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE .Index2G;
drivers/staging/rtl8723bs/hal/hal_com.c +1 -1
@@ -149,7 +149,7 @@ bool HAL_IsLegalChannel(struct adapter *Adapter, u32 Channel)bool bLegalChannel = true;if ((Channel <=14 ) && (Channel >=1 )) { -if (IsSupported24G (Adapter->registrypriv.wireless_mode) == false) +if (is_supported_24g (Adapter->registrypriv.wireless_mode) == false) bLegalChannel = false; }else { bLegalChannel = false;
drivers/staging/rtl8723bs/include/ieee80211.h +2 -2
@@ -156,9 +156,9 @@ enum network_type {#define is_legacy_only (net_type) ((net_type) == ((net_type) & (WIRELESS_11BG))) -#define IsSupported24G (NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false) +#define is_supported_24g (NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false) -#define IsEnableHWCCK (NetType) IsSupported24G(NetType) +#define IsEnableHWCCK (NetType) is_supported_24g(NetType)#define IsEnableHWOFDM (NetType) (((NetType) & (WIRELESS_11G|WIRELESS_11_24N)) ? true : false)#define IsSupportedRxCCK (NetType) IsEnableHWCCK(NetType)
Signature · 1 line
2.20.1
PATCH v2 7/10 staging: rtl8723bs: fix post-commit camel case issues
In reply to Fabio Aiutofix the following post-commit camel case issues:
CHECK: Avoid CamelCase: <Adapter>
33: FILE: drivers/staging/rtl8723bs/hal/hal_com.c:152:
+ if (is_supported_24g(Adapter->
registrypriv.wireless_mode) == false)
CHECK: Avoid CamelCase: <NetType>
46: FILE: drivers/staging/rtl8723bs/include/ieee80211.h:159:
+#define is_supported_24g(NetType)
((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false)
CHECK: Avoid CamelCase: <IsEnableHWCCK>
49: FILE: drivers/staging/rtl8723bs/include/ieee80211.h:161:
+#define IsEnableHWCCK(NetType)
is_supported_24g(NetType)
--- drivers/staging/rtl8723bs/hal/hal_com.c | 4 ++-- drivers/staging/rtl8723bs/include/ieee80211.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +2 -2
@@ -144,12 +144,12 @@ u8 hal_com_config_channel_plan(return chnlPlan; } -bool HAL_IsLegalChannel (struct adapter *Adapter,u32 Channel) +bool HAL_IsLegalChannel (struct adapter *adapter,u32 Channel) {bool bLegalChannel = true;if ((Channel <=14 ) && (Channel >=1 )) { -if (is_supported_24g (Adapter->registrypriv.wireless_mode) == false) +if (is_supported_24g (adapter->registrypriv.wireless_mode) == false) bLegalChannel = false; }else { bLegalChannel = false;
drivers/staging/rtl8723bs/include/ieee80211.h +2 -2
@@ -156,9 +156,9 @@ enum network_type {#define is_legacy_only (net_type) ((net_type) == ((net_type) & (WIRELESS_11BG))) -#define is_supported_24g (NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false) +#define is_supported_24g (net_type) ((net_type) & SUPPORTED_24G_NETTYPE_MSK ? true : false) -#define IsEnableHWCCK (NetType) is_supported_24g(NetType) +#define IsEnableHWCCK (net_type) is_supported_24g(net_type)#define IsEnableHWOFDM (NetType) (((NetType) & (WIRELESS_11G|WIRELESS_11_24N)) ? true : false)#define IsSupportedRxCCK (NetType) IsEnableHWCCK(NetType)
Signature · 1 line
2.20.1
PATCH v2 8/10 staging: rtl8723bs: remove unused macros in include/ieee80211.h
In reply to Fabio Aiutoremove unused macros in include/ieee80211.h
--- drivers/staging/rtl8723bs/include/ieee80211.h | 8 -------- 1 file changed, 8 deletions(-)
drivers/staging/rtl8723bs/include/ieee80211.h +0 -8
@@ -158,15 +158,7 @@ enum network_type {#define is_supported_24g (net_type) ((net_type) & SUPPORTED_24G_NETTYPE_MSK ? true : false) -#define IsEnableHWCCK (net_type) is_supported_24g(net_type) -#define IsEnableHWOFDM (NetType) (((NetType) & (WIRELESS_11G|WIRELESS_11_24N)) ? true : false) - -#define IsSupportedRxCCK (NetType) IsEnableHWCCK(NetType) -#define IsSupportedRxOFDM (NetType) IsEnableHWOFDM(NetType) -#define IsSupportedRxHT (NetType) IsEnableHWOFDM(NetType) -#define IsSupportedTxCCK (NetType) (((NetType) & (WIRELESS_11B)) ? true : false) -#define IsSupportedTxOFDM (NetType) (((NetType) & (WIRELESS_11G) ? true : false)#define is_supported_ht (net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)struct ieee_param {
Signature · 1 line
2.20.1
PATCH v2 9/10 staging: rtl8723bs: fix camel case name in macro IsSupportedTxCCK
In reply to Fabio Aiutofix camel case name in macro IsSupportedTxCCK
--- drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +- drivers/staging/rtl8723bs/include/ieee80211.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -402,7 +402,7 @@ void update_bmc_sta(struct adapter *padapter) supportRateNum, pcur_network->Configuration.DSConfig ); -if (IsSupportedTxCCK (network_type)) { +if (is_supported_tx_cck (network_type)) { network_type =WIRELESS_11B ; }else if (network_type ==WIRELESS_INVALID ) {/* error handling */
drivers/staging/rtl8723bs/core/rtw_wlan_util.c +1 -1
@@ -1661,7 +1661,7 @@ void update_wireless_mode(struct adapter *padapter)void update_sta_basic_rate (struct sta_info *psta,u8 wireless_mode) { -if (IsSupportedTxCCK (wireless_mode)) { +if (is_supported_tx_cck (wireless_mode)) {/* Only B, B/G, and B/G/N AP could use CCK rate */ memcpy (psta->bssrateset, rtw_basic_rate_cck,4 ); psta->bssratelen =4 ;
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
@@ -158,7 +158,7 @@ enum network_type {#define is_supported_24g (net_type) ((net_type) & SUPPORTED_24G_NETTYPE_MSK ? true : false) -#define IsSupportedTxCCK (NetType) (((NetType) & (WIRELESS_11B)) ? true : false) +#define is_supported_tx_cck (NetType) (((NetType) & (WIRELESS_11B)) ? true : false)#define is_supported_ht (net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)struct ieee_param {
Signature · 1 line
2.20.1
PATCH v2 10/10 staging: rtl8723bs: fix camel case argument name in macro is_supported_tx_cck
In reply to Fabio Aiutofix camel case argument name in is_supported_tx_cck
--- drivers/staging/rtl8723bs/include/ieee80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
@@ -158,7 +158,7 @@ enum network_type {#define is_supported_24g (net_type) ((net_type) & SUPPORTED_24G_NETTYPE_MSK ? true : false) -#define is_supported_tx_cck (NetType) (((NetType) & (WIRELESS_11B)) ? true : false) +#define is_supported_tx_cck (net_type) (((net_type) & (WIRELESS_11B)) ? true : false)#define is_supported_ht (net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)struct ieee_param {
Signature · 1 line
2.20.1