diff mbox series

[11/11] mt76x02: enable AP mode for USB

Message ID 1551692896-7062-12-git-send-email-sgruszka@redhat.com (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series mt76x02: AP support for USB with PS | expand

Commit Message

Stanislaw Gruszka March 4, 2019, 9:48 a.m. UTC
Enable AP mode. For now without multi-vif support, this will require
more testing and investigation.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lorenzo Bianconi March 4, 2019, 10:55 a.m. UTC | #1
> Enable AP mode. For now without multi-vif support, this will require
> more testing and investigation.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> index 38997076cb03..99c729f6701d 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> @@ -142,6 +142,7 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
>  
>  	wiphy->interface_modes =
>  		BIT(NL80211_IFTYPE_STATION) |
> +		BIT(NL80211_IFTYPE_AP) |
>  #ifdef CONFIG_MAC80211_MESH
>  		BIT(NL80211_IFTYPE_MESH_POINT) |

I think we need to disable DFS channels for the moment (for mt76x{0,2}u) since
dfs is not supported yet

Regards,
Lorenzo

>  #endif
> @@ -158,7 +159,6 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
>  		wiphy->reg_notifier = mt76x02_regd_notifier;
>  		wiphy->iface_combinations = mt76x02_if_comb;
>  		wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02_if_comb);
> -		wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP);
>  		wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
>  
>  		/* init led callbacks */
> -- 
> 2.20.1
>
Felix Fietkau March 4, 2019, 11 a.m. UTC | #2
On 2019-03-04 11:55, Lorenzo Bianconi wrote:
>> Enable AP mode. For now without multi-vif support, this will require
>> more testing and investigation.
>> 
>> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
>> ---
>>  drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
>> index 38997076cb03..99c729f6701d 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
>> @@ -142,6 +142,7 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
>>  
>>  	wiphy->interface_modes =
>>  		BIT(NL80211_IFTYPE_STATION) |
>> +		BIT(NL80211_IFTYPE_AP) |
>>  #ifdef CONFIG_MAC80211_MESH
>>  		BIT(NL80211_IFTYPE_MESH_POINT) |
> 
> I think we need to disable DFS channels for the moment (for mt76x{0,2}u) since
> dfs is not supported yet

We shouldn't disable the channels directly. We should have another
iface_combinations struct which does not set radar_detect_widths in
cases where the driver does not support it.

- Felix
Stanislaw Gruszka March 4, 2019, 11:04 a.m. UTC | #3
On Mon, Mar 04, 2019 at 11:55:07AM +0100, Lorenzo Bianconi wrote:
> > Enable AP mode. For now without multi-vif support, this will require
> > more testing and investigation.
> > 
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > ---
> >  drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> > index 38997076cb03..99c729f6701d 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> > @@ -142,6 +142,7 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
> >  
> >  	wiphy->interface_modes =
> >  		BIT(NL80211_IFTYPE_STATION) |
> > +		BIT(NL80211_IFTYPE_AP) |
> >  #ifdef CONFIG_MAC80211_MESH
> >  		BIT(NL80211_IFTYPE_MESH_POINT) |
> 
> I think we need to disable DFS channels for the moment (for mt76x{0,2}u) since
> dfs is not supported yet

How this should be done ? Is sufficient to check IEEE80211_CHAN_RADAR
and mt76_is_usb() on set channel end return -EINVAL error ? Or different
way ?

Stanislaw
Lorenzo Bianconi March 4, 2019, 11:08 a.m. UTC | #4
On Mar 04, Stanislaw Gruszka wrote:
> On Mon, Mar 04, 2019 at 11:55:07AM +0100, Lorenzo Bianconi wrote:
> > > Enable AP mode. For now without multi-vif support, this will require
> > > more testing and investigation.
> > > 
> > > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > > ---
> > >  drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> > > index 38997076cb03..99c729f6701d 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> > > @@ -142,6 +142,7 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
> > >  
> > >  	wiphy->interface_modes =
> > >  		BIT(NL80211_IFTYPE_STATION) |
> > > +		BIT(NL80211_IFTYPE_AP) |
> > >  #ifdef CONFIG_MAC80211_MESH
> > >  		BIT(NL80211_IFTYPE_MESH_POINT) |
> > 
> > I think we need to disable DFS channels for the moment (for mt76x{0,2}u) since
> > dfs is not supported yet
> 
> How this should be done ? Is sufficient to check IEEE80211_CHAN_RADAR
> and mt76_is_usb() on set channel end return -EINVAL error ? Or different
> way ?

Re-reading my email I was not so clear, sorry. I mean we need to clear
radar_detect_widths for mt76_usb or as suggested by Felix to have a new
iface_combinations for mt76_usb where we do not set radar_detect_widths

Regards,
Lorenzo

> 
> Stanislaw
> 
>
Stanislaw Gruszka March 4, 2019, 12:45 p.m. UTC | #5
On Mon, Mar 04, 2019 at 12:08:48PM +0100, Lorenzo Bianconi wrote:
> > How this should be done ? Is sufficient to check IEEE80211_CHAN_RADAR
> > and mt76_is_usb() on set channel end return -EINVAL error ? Or different
> > way ?
> 
> Re-reading my email I was not so clear, sorry. I mean we need to clear
> radar_detect_widths for mt76_usb or as suggested by Felix to have a new
> iface_combinations for mt76_usb where we do not set radar_detect_widths

This seems to be already handled by mac80211 if we do not set
iface combinations. On channels like this:

		Frequencies:
			* 5180 MHz [36] (23.0 dBm)
			* 5200 MHz [40] (23.0 dBm)
			* 5220 MHz [44] (23.0 dBm)
			* 5240 MHz [48] (23.0 dBm)
			* 5260 MHz [52] (23.0 dBm) (radar detection)
			  DFS state: usable (for 37 sec)
			* 5280 MHz [56] (23.0 dBm) (radar detection)
			  DFS state: usable (for 37 sec)
			* 5300 MHz [60] (23.0 dBm) (radar detection)
			  DFS state: usable (for 37 sec)
			* 5320 MHz [64] (23.0 dBm) (radar detection)


Hostap fails on channel=52 with error:

Mar 04 13:39:33 dhcp-27-155.brq.redhat.com hostapd[10902]: wlan0: IEEE 802.11 Configured channel (52) not found from the channel list of current mode (2) IEEE 802.11a
Mar 04 13:39:33 dhcp-27-155.brq.redhat.com hostapd[10902]: channel [4] (52) is disabled for use in AP mode, flags: 0x79 RADAR

On channel=36 hostapd succeed to start.

Stanislaw
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 38997076cb03..99c729f6701d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -142,6 +142,7 @@  void mt76x02_init_device(struct mt76x02_dev *dev)
 
 	wiphy->interface_modes =
 		BIT(NL80211_IFTYPE_STATION) |
+		BIT(NL80211_IFTYPE_AP) |
 #ifdef CONFIG_MAC80211_MESH
 		BIT(NL80211_IFTYPE_MESH_POINT) |
 #endif
@@ -158,7 +159,6 @@  void mt76x02_init_device(struct mt76x02_dev *dev)
 		wiphy->reg_notifier = mt76x02_regd_notifier;
 		wiphy->iface_combinations = mt76x02_if_comb;
 		wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02_if_comb);
-		wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP);
 		wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 
 		/* init led callbacks */