* [PATCH 1/3] staging: rtl8723bs: add get_channel cfg80211 implementation
2021-07-14 15:11 [PATCH 0/3] staging: rtl8723bs: add get_channel implementation Fabio Aiuto
@ 2021-07-14 15:11 ` Fabio Aiuto
2021-07-14 15:11 ` [PATCH 2/3] staging: rtl8723bs: convert IsSupportedHT to snake_case Fabio Aiuto
2021-07-14 15:11 ` [PATCH 3/3] staging: rtl8723bs: fix camel case issue Fabio Aiuto
2 siblings, 0 replies; 8+ messages in thread
From: Fabio Aiuto @ 2021-07-14 15:11 UTC (permalink / raw)
To: gregkh; +Cc: hdegoede, Larry.Finger, linux-staging, linux-kernel
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>
---
.../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 53 ++++++++++++++++++-
1 file changed, 52 insertions(+), 1 deletion(-)
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,
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] staging: rtl8723bs: convert IsSupportedHT to snake_case
2021-07-14 15:11 [PATCH 0/3] staging: rtl8723bs: add get_channel implementation Fabio Aiuto
2021-07-14 15:11 ` [PATCH 1/3] staging: rtl8723bs: add get_channel cfg80211 implementation Fabio Aiuto
@ 2021-07-14 15:11 ` Fabio Aiuto
2021-07-14 15:11 ` [PATCH 3/3] staging: rtl8723bs: fix camel case issue Fabio Aiuto
2 siblings, 0 replies; 8+ messages in thread
From: Fabio Aiuto @ 2021-07-14 15:11 UTC (permalink / raw)
To: gregkh; +Cc: hdegoede, Larry.Finger, linux-staging, linux-kernel
convert IsSupportedHT to snake case is_supported_ht.
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
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(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
index bd5056507f53..fcbbdbe5448b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
@@ -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,
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index c06b74f6569a..56c5cb318fdf 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -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;
}
diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
index 378c21595e05..8eb0557a077a 100644
--- a/drivers/staging/rtl8723bs/include/ieee80211.h
+++ b/drivers/staging/rtl8723bs/include/ieee80211.h
@@ -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;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index d198d10ec272..368e575c24af 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -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;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] staging: rtl8723bs: fix camel case issue
2021-07-14 15:11 [PATCH 0/3] staging: rtl8723bs: add get_channel implementation Fabio Aiuto
2021-07-14 15:11 ` [PATCH 1/3] staging: rtl8723bs: add get_channel cfg80211 implementation Fabio Aiuto
2021-07-14 15:11 ` [PATCH 2/3] staging: rtl8723bs: convert IsSupportedHT to snake_case Fabio Aiuto
@ 2021-07-14 15:11 ` Fabio Aiuto
2021-07-14 15:26 ` Dan Carpenter
2 siblings, 1 reply; 8+ messages in thread
From: Fabio Aiuto @ 2021-07-14 15:11 UTC (permalink / raw)
To: gregkh; +Cc: hdegoede, Larry.Finger, linux-staging, linux-kernel
fix 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)
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
drivers/staging/rtl8723bs/include/ieee80211.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
index 8eb0557a077a..b2c1a7dafcee 100644
--- a/drivers/staging/rtl8723bs/include/ieee80211.h
+++ b/drivers/staging/rtl8723bs/include/ieee80211.h
@@ -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;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] staging: rtl8723bs: fix camel case issue
2021-07-14 15:11 ` [PATCH 3/3] staging: rtl8723bs: fix camel case issue Fabio Aiuto
@ 2021-07-14 15:26 ` Dan Carpenter
2021-07-14 19:04 ` Fabio Aiuto
0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2021-07-14 15:26 UTC (permalink / raw)
To: Fabio Aiuto; +Cc: gregkh, hdegoede, Larry.Finger, linux-staging, linux-kernel
On Wed, Jul 14, 2021 at 05:11:14PM +0200, Fabio Aiuto wrote:
> fix 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)
>
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> ---
> drivers/staging/rtl8723bs/include/ieee80211.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
> index 8eb0557a077a..b2c1a7dafcee 100644
> --- a/drivers/staging/rtl8723bs/include/ieee80211.h
> +++ b/drivers/staging/rtl8723bs/include/ieee80211.h
> @@ -167,7 +167,7 @@ enum network_type {
>
> #define IsSupportedTxCCK(NetType) (((NetType) & (WIRELESS_11B)) ? true : false)
> #define IsSupportedTxOFDM(NetType) (((NetType) & (WIRELESS_11G) ? true : false)
These are the same.
> -#define is_supported_ht(NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false)
> +#define is_supported_ht(net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)
>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] staging: rtl8723bs: fix camel case issue
2021-07-14 15:26 ` Dan Carpenter
@ 2021-07-14 19:04 ` Fabio Aiuto
2021-07-17 8:29 ` Dan Carpenter
0 siblings, 1 reply; 8+ messages in thread
From: Fabio Aiuto @ 2021-07-14 19:04 UTC (permalink / raw)
To: Dan Carpenter; +Cc: gregkh, hdegoede, Larry.Finger, linux-staging, linux-kernel
Hello Dan,
On Wed, Jul 14, 2021 at 06:26:05PM +0300, Dan Carpenter wrote:
> On Wed, Jul 14, 2021 at 05:11:14PM +0200, Fabio Aiuto wrote:
> > fix 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)
> >
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > ---
> > drivers/staging/rtl8723bs/include/ieee80211.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
> > index 8eb0557a077a..b2c1a7dafcee 100644
> > --- a/drivers/staging/rtl8723bs/include/ieee80211.h
> > +++ b/drivers/staging/rtl8723bs/include/ieee80211.h
> > @@ -167,7 +167,7 @@ enum network_type {
> >
> > #define IsSupportedTxCCK(NetType) (((NetType) & (WIRELESS_11B)) ? true : false)
> > #define IsSupportedTxOFDM(NetType) (((NetType) & (WIRELESS_11G) ? true : false)
>
> These are the same.
>
> > -#define is_supported_ht(NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false)
> > +#define is_supported_ht(net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)
> >
NetType -> net_type, or did you mean something else?
>
> regards,
> dan carpenter
thank you,
fabio
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] staging: rtl8723bs: fix camel case issue
2021-07-14 19:04 ` Fabio Aiuto
@ 2021-07-17 8:29 ` Dan Carpenter
2021-07-17 9:01 ` Fabio Aiuto
0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2021-07-17 8:29 UTC (permalink / raw)
To: Fabio Aiuto; +Cc: gregkh, hdegoede, Larry.Finger, linux-staging, linux-kernel
On Wed, Jul 14, 2021 at 09:04:57PM +0200, Fabio Aiuto wrote:
> Hello Dan,
>
> On Wed, Jul 14, 2021 at 06:26:05PM +0300, Dan Carpenter wrote:
> > On Wed, Jul 14, 2021 at 05:11:14PM +0200, Fabio Aiuto wrote:
> > > fix 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)
> > >
> > > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > > ---
> > > drivers/staging/rtl8723bs/include/ieee80211.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
> > > index 8eb0557a077a..b2c1a7dafcee 100644
> > > --- a/drivers/staging/rtl8723bs/include/ieee80211.h
> > > +++ b/drivers/staging/rtl8723bs/include/ieee80211.h
> > > @@ -167,7 +167,7 @@ enum network_type {
> > >
> > > #define IsSupportedTxCCK(NetType) (((NetType) & (WIRELESS_11B)) ? true : false)
> > > #define IsSupportedTxOFDM(NetType) (((NetType) & (WIRELESS_11G) ? true : false)
> >
> > These are the same.
> >
> > > -#define is_supported_ht(NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false)
> > > +#define is_supported_ht(net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)
> > >
>
> NetType -> net_type, or did you mean something else?
Yes. If you're going to change it then change the surrounding code as
well.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] staging: rtl8723bs: fix camel case issue
2021-07-17 8:29 ` Dan Carpenter
@ 2021-07-17 9:01 ` Fabio Aiuto
0 siblings, 0 replies; 8+ messages in thread
From: Fabio Aiuto @ 2021-07-17 9:01 UTC (permalink / raw)
To: Dan Carpenter; +Cc: gregkh, hdegoede, Larry.Finger, linux-staging, linux-kernel
Hi Dan,
On Sat, Jul 17, 2021 at 11:29:01AM +0300, Dan Carpenter wrote:
> On Wed, Jul 14, 2021 at 09:04:57PM +0200, Fabio Aiuto wrote:
> > Hello Dan,
> >
> > On Wed, Jul 14, 2021 at 06:26:05PM +0300, Dan Carpenter wrote:
> > > On Wed, Jul 14, 2021 at 05:11:14PM +0200, Fabio Aiuto wrote:
> > > > fix 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)
> > > >
> > > > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > > > ---
> > > > drivers/staging/rtl8723bs/include/ieee80211.h | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
> > > > index 8eb0557a077a..b2c1a7dafcee 100644
> > > > --- a/drivers/staging/rtl8723bs/include/ieee80211.h
> > > > +++ b/drivers/staging/rtl8723bs/include/ieee80211.h
> > > > @@ -167,7 +167,7 @@ enum network_type {
> > > >
> > > > #define IsSupportedTxCCK(NetType) (((NetType) & (WIRELESS_11B)) ? true : false)
> > > > #define IsSupportedTxOFDM(NetType) (((NetType) & (WIRELESS_11G) ? true : false)
> > >
> > > These are the same.
> > >
> > > > -#define is_supported_ht(NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false)
> > > > +#define is_supported_ht(net_type) (((net_type) & (WIRELESS_11_24N)) ? true : false)
> > > >
> >
> > NetType -> net_type, or did you mean something else?
>
> Yes. If you're going to change it then change the surrounding code as
> well.
>
> regards,
> dan carpenter
>
ok, will add a patch in next v2,
thank you,
fabio
^ permalink raw reply [flat|nested] 8+ messages in thread