* [PATCH] mt76x0: run calibration after scanning
@ 2018-10-29 10:16 Stanislaw Gruszka
2018-10-29 14:25 ` Kalle Valo
2018-10-30 9:39 ` Stanislaw Gruszka
0 siblings, 2 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2018-10-29 10:16 UTC (permalink / raw)
To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless
If we are associated and scanning is performed , sw_scan_complete callback
is done after we get back to operating channel, so we do not perform
phy calibration and queue cal work. Fix this by run calibration from
sw_scan_complete().
Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
This is for 4.20
drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 19 +++++++++++++++++++
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 ++
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | 2 +-
4 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index a803a9b6a4c5..896a9d46bb76 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -78,3 +78,22 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
return ret;
}
EXPORT_SYMBOL_GPL(mt76x0_config);
+
+void mt76x0_sw_scan_complete(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif)
+{
+ struct mt76x02_dev *dev = hw->priv;
+
+ mutex_lock(&dev->mt76.mutex);
+ if (vif->bss_conf.assoc) {
+ mt76x0_phy_calibrate(dev, false);
+ mt76x0_phy_set_txpower(dev);
+
+ ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
+ MT_CALIBRATE_INTERVAL);
+ }
+ mutex_unlock(&dev->mt76.mutex);
+
+ mt76x02_sw_scan_complete(hw, vif);
+}
+EXPORT_SYMBOL_GPL(mt76x0_sw_scan_complete);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index 46629f61673b..d850a6702598 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -62,6 +62,8 @@ int mt76x0_mac_start(struct mt76x02_dev *dev);
void mt76x0_mac_stop(struct mt76x02_dev *dev);
int mt76x0_config(struct ieee80211_hw *hw, u32 changed);
+void mt76x0_sw_scan_complete(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif);
/* PHY */
void mt76x0_phy_init(struct mt76x02_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
index 757816d2b1ab..854d882f775b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
@@ -95,7 +95,7 @@ static const struct ieee80211_ops mt76x0e_ops = {
.set_key = mt76x02_set_key,
.conf_tx = mt76x02_conf_tx,
.sw_scan_start = mt76x02_sw_scan,
- .sw_scan_complete = mt76x02_sw_scan_complete,
+ .sw_scan_complete = mt76x0_sw_scan_complete,
.ampdu_action = mt76x02_ampdu_action,
.sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
.wake_tx_queue = mt76_wake_tx_queue,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index 35b98661632a..9a83d9f62012 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -151,7 +151,7 @@ static const struct ieee80211_ops mt76x0u_ops = {
.set_key = mt76x02_set_key,
.conf_tx = mt76x02_conf_tx,
.sw_scan_start = mt76x02_sw_scan,
- .sw_scan_complete = mt76x02_sw_scan_complete,
+ .sw_scan_complete = mt76x0_sw_scan_complete,
.ampdu_action = mt76x02_ampdu_action,
.sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
.set_rts_threshold = mt76x02_set_rts_threshold,
--
2.7.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mt76x0: run calibration after scanning
2018-10-29 10:16 [PATCH] mt76x0: run calibration after scanning Stanislaw Gruszka
@ 2018-10-29 14:25 ` Kalle Valo
2018-10-30 9:36 ` Stanislaw Gruszka
2018-10-30 9:39 ` Stanislaw Gruszka
1 sibling, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2018-10-29 14:25 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Felix Fietkau, Lorenzo Bianconi, linux-wireless
Stanislaw Gruszka <sgruszka@redhat.com> writes:
> If we are associated and scanning is performed , sw_scan_complete callback
> is done after we get back to operating channel, so we do not perform
> phy calibration and queue cal work. Fix this by run calibration from
> sw_scan_complete().
>
> Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> This is for 4.20
So what are the symptoms from user's point of view? Is this a
regression?
I'm just trying to understand if this really is needed for 4.20. There
are so many mt76 patches flowing to -next that the bar for mt76 -rc
patches is even higher than normally.
--
Kalle Valo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mt76x0: run calibration after scanning
2018-10-29 14:25 ` Kalle Valo
@ 2018-10-30 9:36 ` Stanislaw Gruszka
2018-10-30 10:23 ` Kalle Valo
0 siblings, 1 reply; 5+ messages in thread
From: Stanislaw Gruszka @ 2018-10-30 9:36 UTC (permalink / raw)
To: Kalle Valo; +Cc: Felix Fietkau, Lorenzo Bianconi, linux-wireless
On Mon, Oct 29, 2018 at 04:25:31PM +0200, Kalle Valo wrote:
> Stanislaw Gruszka <sgruszka@redhat.com> writes:
>
> > If we are associated and scanning is performed , sw_scan_complete callback
> > is done after we get back to operating channel, so we do not perform
> > phy calibration and queue cal work. Fix this by run calibration from
> > sw_scan_complete().
> >
> > Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > ---
> > This is for 4.20
>
> So what are the symptoms from user's point of view? Is this a
> regression?
We do not perform gain calibration any longer if somebody will
request scan after association. This is formally a regression,
but calibration code changed a lot, so perhaps this can be dropped
for 4.20 and eventually go through -stable if I can confirm
it fixes performance problems.
Thanks
Stanislaw
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mt76x0: run calibration after scanning
2018-10-29 10:16 [PATCH] mt76x0: run calibration after scanning Stanislaw Gruszka
2018-10-29 14:25 ` Kalle Valo
@ 2018-10-30 9:39 ` Stanislaw Gruszka
1 sibling, 0 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2018-10-30 9:39 UTC (permalink / raw)
To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless
On Mon, Oct 29, 2018 at 11:16:53AM +0100, Stanislaw Gruszka wrote:
> If we are associated and scanning is performed , sw_scan_complete callback
> is done after we get back to operating channel, so we do not perform
> phy calibration and queue cal work. Fix this by run calibration from
> sw_scan_complete().
>
> Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> This is for 4.20
>
> drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 19 +++++++++++++++++++
> drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 ++
> drivers/net/wireless/mediatek/mt76/mt76x0/pci.c | 2 +-
> drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | 2 +-
> 4 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
> index a803a9b6a4c5..896a9d46bb76 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
> @@ -78,3 +78,22 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
> return ret;
> }
> EXPORT_SYMBOL_GPL(mt76x0_config);
> +
> +void mt76x0_sw_scan_complete(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif)
> +{
> + struct mt76x02_dev *dev = hw->priv;
> +
> + mutex_lock(&dev->mt76.mutex);
> + if (vif->bss_conf.assoc) {
> + mt76x0_phy_calibrate(dev, false);
> + mt76x0_phy_set_txpower(dev);
Actually I don't think this part is needed, it is done after channel
switch just before we associate, and that seems to be sufficient.
> +
> + ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
> + MT_CALIBRATE_INTERVAL);
We just have to schedule this work, and mt76x2 suffer from similar
issue, so this can be done in mt76x02_sw_scan_complete(). Will
post v2.
Thanks
Stanislaw
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mt76x0: run calibration after scanning
2018-10-30 9:36 ` Stanislaw Gruszka
@ 2018-10-30 10:23 ` Kalle Valo
0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-10-30 10:23 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Felix Fietkau, Lorenzo Bianconi, linux-wireless
Stanislaw Gruszka <sgruszka@redhat.com> writes:
> On Mon, Oct 29, 2018 at 04:25:31PM +0200, Kalle Valo wrote:
>> Stanislaw Gruszka <sgruszka@redhat.com> writes:
>>
>> > If we are associated and scanning is performed , sw_scan_complete callback
>> > is done after we get back to operating channel, so we do not perform
>> > phy calibration and queue cal work. Fix this by run calibration from
>> > sw_scan_complete().
>> >
>> > Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
>> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
>> > ---
>> > This is for 4.20
>>
>> So what are the symptoms from user's point of view? Is this a
>> regression?
>
> We do not perform gain calibration any longer if somebody will
> request scan after association. This is formally a regression,
> but calibration code changed a lot, so perhaps this can be dropped
> for 4.20 and eventually go through -stable if I can confirm
> it fixes performance problems.
To me that would be a much better option, less conflicts that way.
--
Kalle Valo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-10-30 10:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-29 10:16 [PATCH] mt76x0: run calibration after scanning Stanislaw Gruszka
2018-10-29 14:25 ` Kalle Valo
2018-10-30 9:36 ` Stanislaw Gruszka
2018-10-30 10:23 ` Kalle Valo
2018-10-30 9:39 ` Stanislaw Gruszka
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).