diff mbox series

[v4,4/4] mt76: mt76x02: add channel switch support for usb interfaces

Message ID 20191118221540.14886-5-markus.theil@tu-ilmenau.de (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series mt76: channel switch support for USB devices | expand

Commit Message

Markus Theil Nov. 18, 2019, 10:15 p.m. UTC
This patch enables channel switch support on mt76 usb interfaces.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | 7 +++++++
 drivers/net/wireless/mediatek/mt76/mt76x02_util.c     | 2 +-
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c  | 7 +++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

Comments

Stanislaw Gruszka Nov. 19, 2019, 11:19 a.m. UTC | #1
On Mon, Nov 18, 2019 at 11:15:40PM +0100, Markus Theil wrote:
> +static void mt76x2u_channel_switch_beacon(struct ieee80211_hw *hw,
> +					  struct ieee80211_vif *vif,
> +					  struct cfg80211_chan_def *chandef)
> +{
> +}
> +
>  const struct ieee80211_ops mt76x2u_ops = {
>  	.tx = mt76x02_tx,
>  	.start = mt76x2u_start,
> @@ -121,4 +127,5 @@ const struct ieee80211_ops mt76x2u_ops = {
>  	.get_survey = mt76_get_survey,
>  	.set_tim = mt76_set_tim,
>  	.release_buffered_frames = mt76_release_buffered_frames,
> +	.channel_switch_beacon = mt76x2u_channel_switch_beacon,

Is this needed ? Seems mac80211 check against this op being NULL
in drv_channel_switch_beacon() and it is not used otherwise.
 
Stanislaw
Markus Theil Nov. 19, 2019, 12:12 p.m. UTC | #2
On 11/19/19 12:19 PM, Stanislaw Gruszka wrote:
> On Mon, Nov 18, 2019 at 11:15:40PM +0100, Markus Theil wrote:
>> +static void mt76x2u_channel_switch_beacon(struct ieee80211_hw *hw,
>> +					  struct ieee80211_vif *vif,
>> +					  struct cfg80211_chan_def *chandef)
>> +{
>> +}
>> +
>>  const struct ieee80211_ops mt76x2u_ops = {
>>  	.tx = mt76x02_tx,
>>  	.start = mt76x2u_start,
>> @@ -121,4 +127,5 @@ const struct ieee80211_ops mt76x2u_ops = {
>>  	.get_survey = mt76_get_survey,
>>  	.set_tim = mt76_set_tim,
>>  	.release_buffered_frames = mt76_release_buffered_frames,
>> +	.channel_switch_beacon = mt76x2u_channel_switch_beacon,
> Is this needed ? Seems mac80211 check against this op being NULL
> in drv_channel_switch_beacon() and it is not used otherwise.
>  
> Stanislaw
I checked if this call is really needed and you're right, it is not
needed. I'll send v5 with this fix.
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
index 8a2a90fb5663..891825043117 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
@@ -182,6 +182,12 @@  static void mt76x02u_pre_tbtt_work(struct work_struct *work)
 	/* Prevent corrupt transmissions during update */
 	mt76_set(dev, MT_BCN_BYPASS_MASK, 0xffff);
 
+	mt76_csa_check(&dev->mt76);
+	if (dev->mt76.csa_complete) {
+		mt76_csa_finish(&dev->mt76);
+		goto out;
+	}
+
 	ieee80211_iterate_active_interfaces(mt76_hw(dev),
 		IEEE80211_IFACE_ITER_RESUME_ALL,
 		mt76x02_update_beacon_iter, dev);
@@ -196,6 +202,7 @@  static void mt76x02u_pre_tbtt_work(struct work_struct *work)
 
 	mt76x02_mac_set_beacon_finish(dev);
 
+out:
 	mt76x02u_restart_pre_tbtt_timer(dev);
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 414b22399d93..3f95e5b24e1d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -174,7 +174,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->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 
 		/* init led callbacks */
 		if (IS_ENABLED(CONFIG_MT76_LEDS)) {
@@ -184,6 +183,7 @@  void mt76x02_init_device(struct mt76x02_dev *dev)
 		}
 	}
 
+	wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
 
 	hw->sta_data_size = sizeof(struct mt76x02_sta);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index eb73cb856c81..a236b5249a86 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -100,6 +100,12 @@  mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
 	return err;
 }
 
+static void mt76x2u_channel_switch_beacon(struct ieee80211_hw *hw,
+					  struct ieee80211_vif *vif,
+					  struct cfg80211_chan_def *chandef)
+{
+}
+
 const struct ieee80211_ops mt76x2u_ops = {
 	.tx = mt76x02_tx,
 	.start = mt76x2u_start,
@@ -121,4 +127,5 @@  const struct ieee80211_ops mt76x2u_ops = {
 	.get_survey = mt76_get_survey,
 	.set_tim = mt76_set_tim,
 	.release_buffered_frames = mt76_release_buffered_frames,
+	.channel_switch_beacon = mt76x2u_channel_switch_beacon,
 };