linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Theil <markus.theil@tu-ilmenau.de>
To: nbd@nbd.name
Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com,
	Stanislaw Gruszka <sgruszka@redhat.com>,
	Markus Theil <markus.theil@tu-ilmenau.de>
Subject: [PATCH 4/4] mt76: mt76x02: add channel switch support for usb interfaces
Date: Sat, 16 Nov 2019 12:17:09 +0100	[thread overview]
Message-ID: <20191116111709.4686-5-markus.theil@tu-ilmenau.de> (raw)
In-Reply-To: <20191116111709.4686-1-markus.theil@tu-ilmenau.de>

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  | 5 +++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
index aedab4cc8d40..32e6c37aa80d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
@@ -179,6 +179,12 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work)
 
 	mt76x02_resync_beacon_timer(dev);
 
+	mt76_csa_check(&dev->mt76);
+	if (dev->mt76.csa_complete) {
+		mt76_csa_finish(&dev->mt76);
+		goto out;
+	}
+
 	mt76x02_mac_set_beacon_prepare(dev);
 
 	ieee80211_iterate_active_interfaces(mt76_hw(dev),
@@ -195,6 +201,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..2f2c39a6a9e6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -100,6 +100,10 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
 	return err;
 }
 
+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 +125,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,
 };
-- 
2.24.0


  parent reply	other threads:[~2019-11-16 11:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-16 11:17 [PATCH 0/4] mt76: channel switch support for USB devices Markus Theil
2019-11-16 11:17 ` [PATCH 1/4] mt76: mt76x02: ommit beacon slot clearing Markus Theil
2019-11-16 11:44   ` Markus Theil
2019-11-16 11:17 ` [PATCH 2/4] mt76: mt76x02: split beaconing Markus Theil
2019-11-16 12:51   ` Lorenzo Bianconi
2019-11-16 11:17 ` [PATCH 3/4] mt76: speed up usb bulk copy Markus Theil
2019-11-16 11:43   ` Lorenzo Bianconi
2019-11-19 10:58     ` Stanislaw Gruszka
2019-11-16 11:17 ` Markus Theil [this message]
2019-11-16 11:45   ` [PATCH 4/4] mt76: mt76x02: add channel switch support for usb interfaces Lorenzo Bianconi
2019-11-16 12:13     ` Markus Theil
2019-11-16 12:43       ` Lorenzo Bianconi
2019-11-17  3:44   ` kbuild test robot
2019-11-17  3:44   ` [RFC PATCH] mt76: mt76x02: mt76x2u_channel_switch_beacon() can be static kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191116111709.4686-5-markus.theil@tu-ilmenau.de \
    --to=markus.theil@tu-ilmenau.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=sgruszka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).