* Re: [PATCH] mt76: mt7603: add debugfs knob to enable/disable edcca
From: Lorenzo Bianconi @ 2019-05-13 8:41 UTC (permalink / raw)
To: Kalle Valo; +Cc: nbd, lorenzo.bianconi, linux-wireless
In-Reply-To: <87r293ugia.fsf@purkki.adurom.net>
[-- Attachment #1: Type: text/plain, Size: 846 bytes --]
> Lorenzo Bianconi <lorenzo@kernel.org> writes:
>
> > Introduce a knob in mt7603 debugfs in order to enable/disable
> > edcca processing
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> It's good to explain what edcca does and how the file is used supposed
> to be used. In other words, have a small introduction for the user.
Hi Kalle,
edcca is used for adjusting energy detect based on CCA thresholds.
The code was already there so I just reported the acronym.
>
> > @@ -48,6 +77,7 @@ void mt7603_init_debugfs(struct mt7603_dev *dev)
> > if (!dir)
> > return;
> >
> > + debugfs_create_file("edcca", 0400, dir, dev, &fops_edcca);
>
> Why 0400 and not 0600?
yes, right. There is the same issue in mt76x02 code, I will fix both of them.
Thx.
Regards,
Lorenzo
>
> --
> Kalle Valo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply
* Re: [PATCH 3/4] mt76: mt76x2: move mutex_lock inside mt76x2_set_channel
From: Stanislaw Gruszka @ 2019-05-13 8:37 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: nbd, lorenzo.bianconi, linux-wireless
In-Reply-To: <1527e88fc4a307aa218f515811f2f2c15786caec.1557567465.git.lorenzo@kernel.org>
On Sat, May 11, 2019 at 12:17:53PM +0200, Lorenzo Bianconi wrote:
> This is a preliminary patch to run mt76x02_edcca_init atomically
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> .../wireless/mediatek/mt76/mt76x2/pci_main.c | 16 ++++++++------
> .../wireless/mediatek/mt76/mt76x2/usb_main.c | 22 ++++++++++---------
> 2 files changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> index e416eee6a306..3a1467326f4d 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
> @@ -54,14 +54,14 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
> int ret;
>
> cancel_delayed_work_sync(&dev->cal_work);
Since now you use mutex in mt76x2_phy_calibrate() you can remove
cancel_delayed_work_sync() and drop other changes from this patch
as releasing mutex just to acquire it in almost next step make
no sense.
Stanislaw
^ permalink raw reply
* RE: [PATCH v2 3/7] lib/hexdump.c: Optionally suppress lines of repeated bytes
From: Alastair D'Silva @ 2019-05-13 7:35 UTC (permalink / raw)
To: 'Geert Uytterhoeven', 'Alastair D'Silva'
Cc: 'Jani Nikula', 'Joonas Lahtinen',
'Rodrigo Vivi', 'David Airlie',
'Daniel Vetter', 'Dan Carpenter',
'Karsten Keil', 'Jassi Brar',
'Tom Lendacky', 'David S. Miller',
'Jose Abreu', 'Kalle Valo',
'Stanislaw Gruszka', 'Benson Leung',
'Enric Balletbo i Serra', 'James E.J. Bottomley',
'Martin K. Petersen', 'Greg Kroah-Hartman',
'Alexander Viro', 'Petr Mladek',
'Sergey Senozhatsky', 'Steven Rostedt',
'David Laight', 'Andrew Morton',
'Intel Graphics Development', 'DRI Development',
'Linux Kernel Mailing List', 'netdev', ath10k,
'linux-wireless', 'scsi',
'Linux Fbdev development list', 'driverdevel',
'Linux FS Devel'
In-Reply-To: <CAMuHMdVefYTgHzGKBc0ebku1z8V3wsM0ydN+6-S2nFKaB8eH_Q@mail.gmail.com>
> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: Monday, 13 May 2019 5:01 PM
> To: Alastair D'Silva <alastair@au1.ibm.com>
> Cc: alastair@d-silva.org; Jani Nikula <jani.nikula@linux.intel.com>; Joonas
> Lahtinen <joonas.lahtinen@linux.intel.com>; Rodrigo Vivi
> <rodrigo.vivi@intel.com>; David Airlie <airlied@linux.ie>; Daniel Vetter
> <daniel@ffwll.ch>; Dan Carpenter <dan.carpenter@oracle.com>; Karsten
> Keil <isdn@linux-pingi.de>; Jassi Brar <jassisinghbrar@gmail.com>; Tom
> Lendacky <thomas.lendacky@amd.com>; David S. Miller
> <davem@davemloft.net>; Jose Abreu <Jose.Abreu@synopsys.com>; Kalle
> Valo <kvalo@codeaurora.org>; Stanislaw Gruszka <sgruszka@redhat.com>;
> Benson Leung <bleung@chromium.org>; Enric Balletbo i Serra
> <enric.balletbo@collabora.com>; James E.J. Bottomley
> <jejb@linux.ibm.com>; Martin K. Petersen <martin.petersen@oracle.com>;
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Alexander Viro
> <viro@zeniv.linux.org.uk>; Petr Mladek <pmladek@suse.com>; Sergey
> Senozhatsky <sergey.senozhatsky@gmail.com>; Steven Rostedt
> <rostedt@goodmis.org>; David Laight <David.Laight@aculab.com>; Andrew
> Morton <akpm@linux-foundation.org>; Intel Graphics Development <intel-
> gfx@lists.freedesktop.org>; DRI Development <dri-
> devel@lists.freedesktop.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; netdev <netdev@vger.kernel.org>;
> ath10k@lists.infradead.org; linux-wireless <linux-wireless@vger.kernel.org>;
> scsi <linux-scsi@vger.kernel.org>; Linux Fbdev development list <linux-
> fbdev@vger.kernel.org>; driverdevel <devel@driverdev.osuosl.org>; Linux
> FS Devel <linux-fsdevel@vger.kernel.org>
> Subject: Re: [PATCH v2 3/7] lib/hexdump.c: Optionally suppress lines of
> repeated bytes
>
> Hi Alastair,
>
> Thanks for your patch!
And thanks for your politeness :)
>
> On Wed, May 8, 2019 at 9:04 AM Alastair D'Silva <alastair@au1.ibm.com>
> wrote:
> > From: Alastair D'Silva <alastair@d-silva.org>
> >
> > Some buffers may only be partially filled with useful data, while the
> > rest is padded (typically with 0x00 or 0xff).
> >
> > This patch introduces a flag to allow the supression of lines of
> > repeated bytes,
>
> Given print_hex_dump() operates on entities of groupsize (1, 2, 4, or 8)
> bytes, wouldn't it make more sense to consider repeated groups instead of
> repeated bytes?
Maybe, it would mean that subsequent addresses may not be a multiple of rowsize though, which is useful.
> > which are replaced with '** Skipped %u bytes of value 0x%x **'
>
> Using a custom message instead of just "*", like "hexdump" uses, will require
> preprocessing the output when recovering the original binary data by
> feeding it to e.g. "xxd".
> This may sound worse than it is, though, as I never got "xxd" to work without
> preprocessing anyway ;-)
I think showing the details of the skipped values is useful when reading the output directly. In situations where binary extracts are desired, the feature can always be disabled.
--
Alastair D'Silva mob: 0423 762 819
skype: alastair_dsilva msn: alastair@d-silva.org
blog: http://alastair.d-silva.org Twitter: @EvilDeece
^ permalink raw reply
* Re: [PATCH v2 3/7] lib/hexdump.c: Optionally suppress lines of repeated bytes
From: Geert Uytterhoeven @ 2019-05-13 7:01 UTC (permalink / raw)
To: Alastair D'Silva
Cc: alastair, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
David Airlie, Daniel Vetter, Dan Carpenter, Karsten Keil,
Jassi Brar, Tom Lendacky, David S. Miller, Jose Abreu, Kalle Valo,
Stanislaw Gruszka, Benson Leung, Enric Balletbo i Serra,
James E.J. Bottomley, Martin K. Petersen, Greg Kroah-Hartman,
Alexander Viro, Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
David Laight, Andrew Morton, Intel Graphics Development,
DRI Development, Linux Kernel Mailing List, netdev, ath10k,
linux-wireless, scsi, Linux Fbdev development list, driverdevel,
Linux FS Devel
In-Reply-To: <20190508070148.23130-4-alastair@au1.ibm.com>
Hi Alastair,
Thanks for your patch!
On Wed, May 8, 2019 at 9:04 AM Alastair D'Silva <alastair@au1.ibm.com> wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> Some buffers may only be partially filled with useful data, while the rest
> is padded (typically with 0x00 or 0xff).
>
> This patch introduces a flag to allow the supression of lines of repeated
> bytes,
Given print_hex_dump() operates on entities of groupsize (1, 2, 4, or 8)
bytes, wouldn't it make more sense to consider repeated groups instead
of repeated bytes?
> which are replaced with '** Skipped %u bytes of value 0x%x **'
Using a custom message instead of just "*", like "hexdump" uses, will
require preprocessing the output when recovering the original binary
data by feeding it to e.g. "xxd".
This may sound worse than it is, though, as I never got "xxd" to work
without preprocessing anyway ;-)
$ cat $(type -p unhexdump)
#!/bin/sh
sed 's/^[0-9a-f]*//' $1 | xxd -r -p | dd conv=swab
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH 03/16] lib,treewide: add new match_string() helper/macro
From: Ardelean, Alexandru @ 2019-05-13 7:00 UTC (permalink / raw)
To: andriy.shevchenko@linux.intel.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-ide@vger.kernel.org, linux-usb@vger.kernel.org,
linux-mmc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
cgroups@vger.kernel.org, intel-gfx@lists.freedesktop.org,
linux-pm@vger.kernel.org, linux-mm@kvack.org,
linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-security-module@vger.kernel.org, devel@driverdev.osuosl.org,
linux-mtd@lists.infradead.org, linux-integrity@vger.kernel.org,
dri-devel@lists.freedesktop.org,
linux-rpi-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org,
gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org,
linux-tegra@vger.kernel.org, netdev@vger.kernel.org,
linux-rockchip@lists.infradead.org, alsa-devel@alsa-project.org,
linux-pci@vger.kernel.org, linux-wireless@vger.kernel.org,
linux-clk@vger.kernel.org
In-Reply-To: <20190510143407.GA9224@smile.fi.intel.com>
On Fri, 2019-05-10 at 17:34 +0300, andriy.shevchenko@linux.intel.com wrote:
> [External]
>
>
> On Fri, May 10, 2019 at 09:15:27AM +0000, Ardelean, Alexandru wrote:
> > On Wed, 2019-05-08 at 16:22 +0300, Alexandru Ardelean wrote:
> > > On Wed, 2019-05-08 at 15:18 +0200, Greg KH wrote:
> > > > On Wed, May 08, 2019 at 04:11:28PM +0300, Andy Shevchenko wrote:
> > > > > On Wed, May 08, 2019 at 02:28:29PM +0300, Alexandru Ardelean
> > > > > wrote:
> > > > > Can you split include/linux/ change from the rest?
> > > >
> > > > That would break the build, why do you want it split out? This
> > > > makes
> > > > sense all as a single patch to me.
> > > >
> > >
> > > Not really.
> > > It would be just be the new match_string() helper/macro in a new
> > > commit.
> > > And the conversions of the simple users of match_string() (the ones
> > > using
> > > ARRAY_SIZE()) in another commit.
> > >
> >
> > I should have asked in my previous reply.
> > Leave this as-is or re-formulate in 2 patches ?
>
> Depends on on what you would like to spend your time: collecting Acks for
> all
> pieces in treewide patch or send new API first followed up by per driver
> /
> module update in next cycle.
I actually would have preferred new API first, with the current
`match_string()` -> `__match_string()` rename from the start, but I wasn't
sure. I am still navigating through how feedbacks are working in this
realm.
I'll send a V2 with the API change-first/only; should be a smaller list.
Then see about follow-ups/changes per subsystems.
>
> I also have no strong preference.
> And I think it's good to add Heikki Krogerus to Cc list for both patch
> series,
> since he is the author of sysfs variant and may have something to comment
> on
> the rest.
Thanks for the reference.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply
* Re: [PATCH] mac80211: remove warning message
From: Yibo Zhao @ 2019-05-13 6:20 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless, ath10k, Zhi Chen
In-Reply-To: <7119f24f-5b88-629a-d507-73776b841f65@candelatech.com>
On 2019-05-10 22:04, Ben Greear wrote:
> On 05/10/2019 12:01 AM, Yibo Zhao wrote:
>> In multiple SSID cases, it takes time to prepare every AP interface
>> to be ready in initializing phase. If a sta already knows everything
>> it
>> needs to join one of the APs and sends authentication to the AP which
>> is not fully prepared at this point of time, AP's channel context
>> could be NULL. As a result, warning message occurs.
>>
>> Even worse, if the AP is under attack via tools such as MDK3 and
>> massive
>> authentication requests are received in a very short time, console
>> will
>> be hung due to kernel warning messages.
>
> Since it is a WARN_ON_ONCE, how it the console hang due to warnings?
> You should
> get no more than once per boot?
>
Hi Ben,
I was planning to use WARN_ON_ONCE() in the first place to replace
WARN_ON() then after some discussion, we think removing it could be
better. So the patch was based on my first version. Sorry for the
confusing. Will raise another one.
> I have no problem with removing it though. Seems a harmless splat and
> I removed
> it from my tree some time back as well.
>
> Thanks,
> Ben
>
>>
>> If this case can be hit during normal functionality, there should be
>> no
>> WARN_ON(). Those should be reserved to cases that are not supposed to
>> be
>> hit at all or some other more specific cases like indicating obsolete
>> interface.
>>
>> Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
>> Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
>> ---
>> net/mac80211/ieee80211_i.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
>> index 2ae0364..f39c289 100644
>> --- a/net/mac80211/ieee80211_i.h
>> +++ b/net/mac80211/ieee80211_i.h
>> @@ -1435,7 +1435,7 @@ struct ieee80211_local {
>> rcu_read_lock();
>> chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
>>
>> - if (WARN_ON_ONCE(!chanctx_conf)) {
>> + if (!chanctx_conf) {
>> rcu_read_unlock();
>> return NULL;
>> }
>>
--
Yibo
^ permalink raw reply
* Re: [PATCH] mt76: mt7603: add debugfs knob to enable/disable edcca
From: Kalle Valo @ 2019-05-13 4:26 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: nbd, lorenzo.bianconi, linux-wireless
In-Reply-To: <0691acb931e963cb6028d4687cdd61032d0aaf52.1557591530.git.lorenzo@kernel.org>
Lorenzo Bianconi <lorenzo@kernel.org> writes:
> Introduce a knob in mt7603 debugfs in order to enable/disable
> edcca processing
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
It's good to explain what edcca does and how the file is used supposed
to be used. In other words, have a small introduction for the user.
> @@ -48,6 +77,7 @@ void mt7603_init_debugfs(struct mt7603_dev *dev)
> if (!dir)
> return;
>
> + debugfs_create_file("edcca", 0400, dir, dev, &fops_edcca);
Why 0400 and not 0600?
--
Kalle Valo
^ permalink raw reply
* [PATCH] mt76: mt7603: add debugfs knob to enable/disable edcca
From: Lorenzo Bianconi @ 2019-05-11 16:38 UTC (permalink / raw)
To: nbd; +Cc: lorenzo.bianconi, linux-wireless
In-Reply-To: <cover.1557591530.git.lorenzo@kernel.org>
Introduce a knob in mt7603 debugfs in order to enable/disable
edcca processing
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
.../wireless/mediatek/mt76/mt7603/debugfs.c | 30 +++++++++++++++++++
.../net/wireless/mediatek/mt76/mt7603/init.c | 4 ++-
.../net/wireless/mediatek/mt76/mt7603/main.c | 3 +-
.../wireless/mediatek/mt76/mt7603/mt7603.h | 6 +++-
4 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c
index f8b3b6ab6297..efc1cf5ae870 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c
@@ -40,6 +40,35 @@ mt7603_radio_read(struct seq_file *s, void *data)
return 0;
}
+static int
+mt7603_edcca_set(void *data, u64 val)
+{
+ struct mt7603_dev *dev = data;
+
+ mutex_lock(&dev->mt76.mutex);
+
+ dev->ed_monitor_enabled = !!val;
+ dev->ed_monitor = dev->ed_monitor_enabled &&
+ dev->region == NL80211_DFS_ETSI;
+ mt7603_init_edcca(dev);
+
+ mutex_unlock(&dev->mt76.mutex);
+
+ return 0;
+}
+
+static int
+mt7603_edcca_get(void *data, u64 *val)
+{
+ struct mt7603_dev *dev = data;
+
+ *val = dev->ed_monitor_enabled;
+ return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(fops_edcca, mt7603_edcca_get,
+ mt7603_edcca_set, "%lld\n");
+
void mt7603_init_debugfs(struct mt7603_dev *dev)
{
struct dentry *dir;
@@ -48,6 +77,7 @@ void mt7603_init_debugfs(struct mt7603_dev *dev)
if (!dir)
return;
+ debugfs_create_file("edcca", 0400, dir, dev, &fops_edcca);
debugfs_create_u32("reset_test", 0600, dir, &dev->reset_test);
debugfs_create_devm_seqfile(dev->mt76.dev, "reset", dir,
mt7603_reset_read);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
index 78cdbb70e178..4e269044f8a4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
@@ -437,7 +437,9 @@ mt7603_regd_notifier(struct wiphy *wiphy,
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct mt7603_dev *dev = hw->priv;
- dev->ed_monitor = request->dfs_region == NL80211_DFS_ETSI;
+ dev->region = request->dfs_region;
+ dev->ed_monitor = dev->ed_monitor_enabled &&
+ dev->region == NL80211_DFS_ETSI;
}
static int
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
index 0a0334dc40d5..e931af92af43 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
@@ -103,8 +103,7 @@ mt7603_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_unlock(&dev->mt76.mutex);
}
-static void
-mt7603_init_edcca(struct mt7603_dev *dev)
+void mt7603_init_edcca(struct mt7603_dev *dev)
{
/* Set lower signal level to -65dBm */
mt76_rmw_field(dev, MT_RXTD(8), MT_RXTD_8_LOWER_SIGNAL, 0x23);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
index fa64bbaab0d2..944dc9a11a15 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
@@ -117,8 +117,11 @@ struct mt7603_dev {
u8 mac_work_count;
u8 mcu_running;
- u8 ed_monitor;
+ enum nl80211_dfs_regions region;
+
+ u8 ed_monitor_enabled;
+ u8 ed_monitor;
s8 ed_trigger;
u8 ed_strict_mode;
u8 ed_strong_signal;
@@ -241,4 +244,5 @@ void mt7603_update_channel(struct mt76_dev *mdev);
void mt7603_edcca_set_strict(struct mt7603_dev *dev, bool val);
void mt7603_cca_stats_reset(struct mt7603_dev *dev);
+void mt7603_init_edcca(struct mt7603_dev *dev);
#endif
--
2.20.1
^ permalink raw reply related
* [PATCH v2 4/4] mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
From: Lorenzo Bianconi @ 2019-05-11 15:30 UTC (permalink / raw)
To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557587336.git.lorenzo@kernel.org>
Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
concurrently with calibration work and mt76x2_set_channel.
Moreover perform phy calibration atomically
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c | 4 ++++
drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c | 6 ++++++
drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
index 7853078e8ca4..f412c779d8e2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
@@ -122,11 +122,15 @@ mt76_edcca_set(void *data, u64 val)
struct mt76x02_dev *dev = data;
enum nl80211_dfs_regions region = dev->dfs_pd.region;
+ mutex_lock(&dev->mt76.mutex);
+
dev->ed_monitor_enabled = !!val;
dev->ed_monitor = dev->ed_monitor_enabled &&
region == NL80211_DFS_ETSI;
mt76x02_edcca_init(dev);
+ mutex_unlock(&dev->mt76.mutex);
+
return 0;
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
index 7a39a390a7ac..2edf1bd0c18c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
@@ -294,10 +294,16 @@ void mt76x2_phy_calibrate(struct work_struct *work)
struct mt76x02_dev *dev;
dev = container_of(work, struct mt76x02_dev, cal_work.work);
+
+ mutex_lock(&dev->mt76.mutex);
+
mt76x2_phy_channel_calibrate(dev, false);
mt76x2_phy_tssi_compensate(dev);
mt76x2_phy_temp_compensate(dev);
mt76x2_phy_update_channel_gain(dev);
+
+ mutex_unlock(&dev->mt76.mutex);
+
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
MT_CALIBRATE_INTERVAL);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
index c7208c5375ac..dfd54f9b0e97 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
@@ -55,10 +55,15 @@ void mt76x2u_phy_calibrate(struct work_struct *work)
struct mt76x02_dev *dev;
dev = container_of(work, struct mt76x02_dev, cal_work.work);
+
+ mutex_lock(&dev->mt76.mutex);
+
mt76x2u_phy_channel_calibrate(dev, false);
mt76x2_phy_tssi_compensate(dev);
mt76x2_phy_update_channel_gain(dev);
+ mutex_unlock(&dev->mt76.mutex);
+
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
MT_CALIBRATE_INTERVAL);
}
--
2.20.1
^ permalink raw reply related
* Re: [PATCH 4/4] mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
From: Felix Fietkau @ 2019-05-11 14:30 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <CAJ0CqmW8RyBmn1_-M0gQGvLOsTd45kAji7wmurs-GHBLac9Dyg@mail.gmail.com>
On 2019-05-11 16:29, Lorenzo Bianconi wrote:
>>
>> On 2019-05-11 12:17, Lorenzo Bianconi wrote:
>> > Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
>> > concurrently with calibration work and mt76x2_set_channel.
>> > Introduce __mt76x02_edcca_init helper routine
>> >
>> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>> I don't think this is enough. To prevent issues with calibration, we
>> probably need to hold the mutex for the duration of the calibration
>> anyway. Otherwise it might get enabled right in the middle of it and
>> screw things up.
>> Also, it probably simplifies the patch if you don't add the wrapper
>> function that takes the mutex, and instead just explicitly take the
>> mutex where needed.
>
> So IIUC it would be better to hold the mutex during
> mt76x2_phy_calibrate processing, right?
Right.
> If so, do I need to repost all the series or just this patch?
Feel free to repost just this patch.
Thanks,
- Felix
^ permalink raw reply
* Re: [PATCH 4/4] mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
From: Lorenzo Bianconi @ 2019-05-11 14:29 UTC (permalink / raw)
To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless, Stanislaw Gruszka
In-Reply-To: <97ef0073-6dae-f9d1-e97f-9aadaa629628@nbd.name>
>
> On 2019-05-11 12:17, Lorenzo Bianconi wrote:
> > Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
> > concurrently with calibration work and mt76x2_set_channel.
> > Introduce __mt76x02_edcca_init helper routine
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> I don't think this is enough. To prevent issues with calibration, we
> probably need to hold the mutex for the duration of the calibration
> anyway. Otherwise it might get enabled right in the middle of it and
> screw things up.
> Also, it probably simplifies the patch if you don't add the wrapper
> function that takes the mutex, and instead just explicitly take the
> mutex where needed.
So IIUC it would be better to hold the mutex during
mt76x2_phy_calibrate processing, right?
If so, do I need to repost all the series or just this patch?
Regards,
Lorenzo
>
> - Felix
^ permalink raw reply
* Re: [PATCH] mt76: mt7615: add static qualifier to mt7615_rx_poll_complete
From: Felix Fietkau @ 2019-05-11 14:25 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee, royluo
In-Reply-To: <bc9f70d1975df2890df58606ade7d8a783ea8ec8.1557219723.git.lorenzo@kernel.org>
On 2019-05-07 11:03, Lorenzo Bianconi wrote:
> Make mt7615_rx_poll_complete static since it is used just in pci.c
> to initialize rx_poll_complete function pointer
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied, thanks.
- Felix
^ permalink raw reply
* Re: [PATCH] mt76: mt7615: rearrange cleanup operations in mt7615_unregister_device
From: Felix Fietkau @ 2019-05-11 14:25 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee, royluo
In-Reply-To: <2523f264daef250a141d8047f5f92a60ac6acc69.1557059004.git.lorenzo@kernel.org>
On 2019-05-05 17:17, Lorenzo Bianconi wrote:
> Cleanup tx/rx napi before releasing pending idrs.
> Moreover unmap txwi_cache running mt76_free_device routine
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied, thanks.
- Felix
^ permalink raw reply
* Re: [PATCH] mt76: mt7603: stop mac80211 queues before setting the channel
From: Felix Fietkau @ 2019-05-11 14:24 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless
In-Reply-To: <31a4fa56c854a64a25f2e7aa37cba23e9d3fb3d6.1557016660.git.lorenzo@kernel.org>
On 2019-05-05 02:53, Lorenzo Bianconi wrote:
> Suspend data transmission during channel switch
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>Applied, thanks.
- Felix
^ permalink raw reply
* Re: [PATCH] mt76: mt7615: Make mt7615_irq_handler static
From: Felix Fietkau @ 2019-05-11 14:24 UTC (permalink / raw)
To: YueHaibing, lorenzo.bianconi83, ryder.lee, royluo, kvalo,
matthias.bgg
Cc: linux-kernel, netdev, linux-mediatek, linux-arm-kernel,
linux-wireless
In-Reply-To: <20190504102247.43720-1-yuehaibing@huawei.com>
On 2019-05-04 12:22, YueHaibing wrote:
> Fix sparse warning:
>
> drivers/net/wireless/mediatek/mt76/mt7615/pci.c:37:13:
> warning: symbol 'mt7615_irq_handler' was not declared. Should it be static?
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied, thanks.
- Felix
^ permalink raw reply
* Re: [PATCH 4/4] mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
From: Felix Fietkau @ 2019-05-11 14:22 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <436469e1a4c1e0c11ae43a0b002378708d31f15d.1557567465.git.lorenzo@kernel.org>
On 2019-05-11 12:17, Lorenzo Bianconi wrote:
> Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
> concurrently with calibration work and mt76x2_set_channel.
> Introduce __mt76x02_edcca_init helper routine
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
I don't think this is enough. To prevent issues with calibration, we
probably need to hold the mutex for the duration of the calibration
anyway. Otherwise it might get enabled right in the middle of it and
screw things up.
Also, it probably simplifies the patch if you don't add the wrapper
function that takes the mutex, and instead just explicitly take the
mutex where needed.
- Felix
^ permalink raw reply
* Re: [PATCH 00/17] use standard signature for mt7615 mcu api
From: Felix Fietkau @ 2019-05-11 14:00 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee, royluo
In-Reply-To: <cover.1556981521.git.lorenzo@kernel.org>
On 2019-05-04 17:28, Lorenzo Bianconi wrote:
> Introduce mt76_mcu_ops data structure in mt7615 mcu code in order
> to reuse the code with other bus types and unify the code with mt7603
> driver
>
> Changes since RFC:
> - rebase ontop of https://patchwork.kernel.org/patch/10928753/
> - fix net_type initialization in mt7615_mcu_set_bss_info
>
> Lorenzo Bianconi (17):
> mt7615: mcu: simplify __mt7615_mcu_set_wtbl
> mt7615: mcu: simplify __mt7615_mcu_set_sta_rec
> mt7615: mcu: remove bss_info_convert_vif_type routine
> mt7615: mcu: use proper msg size in mt7615_mcu_add_wtbl_bmc
> mt7615: mcu: use proper msg size in mt7615_mcu_add_wtbl
> mt7615: mcu: unify mt7615_mcu_add_wtbl_bmc and mt7615_mcu_del_wtbl_bmc
> mt7615: mcu: remove unused parameter in mt7615_mcu_del_wtbl
> mt7615: remove query from mt7615_mcu_msg_send signature
> mt7615: remove dest from mt7615_mcu_msg_send signature
> mt7615: mcu: remove skb_ret from mt7615_mcu_msg_send
> mt7615: mcu: unify __mt7615_mcu_set_dev_info and
> mt7615_mcu_set_dev_info
> mt7615: mcu: do not use function pointers whenever possible
> mt7615: mcu: remove unused structure in mcu.h
> mt7615: mcu: use standard signature for mt7615_mcu_msg_send
> mt7615: initialize mt76_mcu_ops data structure
> mt7615: mcu: init mcu_restart function pointer
> mt7615: mcu: run __mt76_mcu_send_msg in mt7615_mcu_send_firmware
Applied (including updated patch 12/17), thanks.
- Felix
^ permalink raw reply
* Re: [PATCH][next] mt76: fix less than zero check on a u8 variable
From: Felix Fietkau @ 2019-05-11 13:31 UTC (permalink / raw)
To: Colin King, Roy Luo, Kalle Valo, David S . Miller,
Matthias Brugger, linux-wireless, netdev, linux-arm-kernel,
linux-mediatek
Cc: kernel-janitors, linux-kernel
In-Reply-To: <20190505213135.3895-1-colin.king@canonical.com>
On 2019-05-05 23:31, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The signed return from the call to get_omac_idx is being assigned to the
> u8 variable mac_idx and then checked for a negative error condition
> which is always going to be false. Fix this by assigning the return to
> the int variable ret and checking this instead.
>
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Already fixed by a similar patch by Dan Carpenter.
- Felix
^ permalink raw reply
* Re: [PATCH] mt76: Fix a signedness bug in mt7615_add_interface()
From: Felix Fietkau @ 2019-05-11 13:28 UTC (permalink / raw)
To: Dan Carpenter, Ryder Lee
Cc: Lorenzo Bianconi, Roy Luo, Kalle Valo, Matthias Brugger,
linux-wireless, linux-mediatek, kernel-janitors
In-Reply-To: <20190502212341.GA31847@mwanda>
On 2019-05-03 14:54, Dan Carpenter wrote:
> The problem is that "mvif->omac_idx" is a u8 so it can't be negative
> and the error handling won't work. The get_omac_idx() function returns
> -1 on error.
>
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks.
- Felix
^ permalink raw reply
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Oleg Zhurakivskyy @ 2019-05-11 13:27 UTC (permalink / raw)
To: sedat.dilek; +Cc: Samuel Ortiz, Andy Shevchenko, linux-wireless, linux-nfc
In-Reply-To: <CA+icZUWhBeup95PTP_k58xs8Lf2Ofqb0S_gkdBfbuc0-wdpF-w@mail.gmail.com>
Hi Sedat,
On 5/10/19 10:40 PM, Sedat Dilek wrote:
> Can you guide me how to do that?
I try and then decide whether this is help or not.
If I remember correctly, support for PN547 was done by multiple parties for some Broadwell based designs through the upstream, both on the kernel and neard side.
Assuming the integration details of PN547 didn’t deviate much, this might be:
- From relatively simple, i.e. getting the relevant data from ACPI and hinting the kernel/driver with a minimally sufficient changes. Most likely, once you sort the basic details (i2c, gpio, etc), everything would just work.
- To more laborious and would require a working and ideally open source reference. An option here might be Broadwell based Chromebooks with PN547 (just not sure whether plain or OEMs).
Regards,
Oleg
^ permalink raw reply
* Re: [PATCH 0/4] mt76: add tx napi polling support to mt7603/mt7615
From: Felix Fietkau @ 2019-05-11 13:27 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee
In-Reply-To: <cover.1556718795.git.lorenzo@kernel.org>
On 2019-05-01 16:06, Lorenzo Bianconi wrote:
> Use napi polling for tx cleanup in mt7603 and mt7615 drivers in order
> to allow tx scheduling and tx cleanup to run concurrently
>
> Lorenzo Bianconi (4):
> mt76: move tx_napi in mt76_dev
> mt76: mt7603: use napi polling for tx cleanup
> mt76: mt7615: use napi polling for tx cleanup
> mt76: move netif_napi_del in mt76_dma_cleanup
Applied, thanks.
- Felix
^ permalink raw reply
* Re: [PATCH] mt76: mt76x02: remove useless return in mt76x02_resync_beacon_timer
From: Felix Fietkau @ 2019-05-11 13:22 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <b6e845207d947ce62161d98ea79a011211709062.1556717431.git.lorenzo@kernel.org>
On 2019-05-01 15:44, Lorenzo Bianconi wrote:
> Remove useless return statment in mt76x02_resync_beacon_timer routine
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied, thanks.
- Felix
^ permalink raw reply
* [PATCH 4/4] mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557567465.git.lorenzo@kernel.org>
Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
concurrently with calibration work and mt76x2_set_channel.
Introduce __mt76x02_edcca_init helper routine
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x02.h | 7 +++++++
.../net/wireless/mediatek/mt76/mt76x02_debugfs.c | 6 +++++-
drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 4 ++--
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 1 -
.../net/wireless/mediatek/mt76/mt76x2/pci_phy.c | 15 ++++++++++-----
.../net/wireless/mediatek/mt76/mt76x2/usb_phy.c | 15 ++++++++++-----
8 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index 800ebbfc3055..115961a054e3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -33,7 +33,7 @@ mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
mt76_rr(dev, MT_CH_IDLE);
mt76_rr(dev, MT_CH_BUSY);
- mt76x02_edcca_init(dev);
+ __mt76x02_edcca_init(dev);
if (mt76_is_mmio(dev)) {
mt76x02_dfs_init_params(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index f7fd53a1738a..e028c1a4cf88 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -268,4 +268,11 @@ mt76x02_rx_get_sta_wcid(struct mt76x02_sta *sta, bool unicast)
return &sta->vif->group_wcid;
}
+void __mt76x02_edcca_init(struct mt76x02_dev *dev);
+static inline void mt76x02_edcca_init(struct mt76x02_dev *dev)
+{
+ mutex_lock(&dev->mt76.mutex);
+ __mt76x02_edcca_init(dev);
+ mutex_unlock(&dev->mt76.mutex);
+}
#endif /* __MT76x02_H */
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
index 7853078e8ca4..501794a6076b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
@@ -122,10 +122,14 @@ mt76_edcca_set(void *data, u64 val)
struct mt76x02_dev *dev = data;
enum nl80211_dfs_regions region = dev->dfs_pd.region;
+ mutex_lock(&dev->mt76.mutex);
+
dev->ed_monitor_enabled = !!val;
dev->ed_monitor = dev->ed_monitor_enabled &&
region == NL80211_DFS_ETSI;
- mt76x02_edcca_init(dev);
+ __mt76x02_edcca_init(dev);
+
+ mutex_unlock(&dev->mt76.mutex);
return 0;
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
index 84b845647881..e372621c3798 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
@@ -887,7 +887,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev,
dev->ed_monitor = dev->ed_monitor_enabled &&
region == NL80211_DFS_ETSI;
- mt76x02_edcca_init(dev);
+ __mt76x02_edcca_init(dev);
dfs_pd->region = region;
mt76x02_dfs_init_params(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index ee4a86971be7..ac29422b5335 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -945,7 +945,7 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool enable)
dev->ed_tx_blocked = !enable;
}
-void mt76x02_edcca_init(struct mt76x02_dev *dev)
+void __mt76x02_edcca_init(struct mt76x02_dev *dev)
{
dev->ed_trigger = 0;
dev->ed_silent = 0;
@@ -979,7 +979,7 @@ void mt76x02_edcca_init(struct mt76x02_dev *dev)
mt76_rr(dev, MT_ED_CCA_TIMER);
dev->ed_time = ktime_get_boottime();
}
-EXPORT_SYMBOL_GPL(mt76x02_edcca_init);
+EXPORT_SYMBOL_GPL(__mt76x02_edcca_init);
#define MT_EDCCA_TH 92
#define MT_EDCCA_BLOCK_TH 2
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
index cb39da79527a..ce73c60c579a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
@@ -209,5 +209,4 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
struct ieee80211_vif *vif, bool val);
-void mt76x02_edcca_init(struct mt76x02_dev *dev);
#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
index 7a39a390a7ac..818c4f051df3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
@@ -43,17 +43,17 @@ mt76x2_phy_tssi_init_cal(struct mt76x02_dev *dev)
return true;
}
-static void
+static bool
mt76x2_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
{
struct ieee80211_channel *chan = dev->mt76.chandef.chan;
bool is_5ghz = chan->band == NL80211_BAND_5GHZ;
if (dev->cal.channel_cal_done)
- return;
+ return false;
if (mt76x2_channel_silent(dev))
- return;
+ return false;
if (!dev->cal.tssi_cal_done)
mt76x2_phy_tssi_init_cal(dev);
@@ -74,9 +74,10 @@ mt76x2_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
mt76x2_mac_resume(dev);
mt76x2_apply_gain_adj(dev);
- mt76x02_edcca_init(dev);
dev->cal.channel_cal_done = true;
+
+ return true;
}
void mt76x2_phy_set_antenna(struct mt76x02_dev *dev)
@@ -245,6 +246,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
return 0;
mt76x2_phy_channel_calibrate(dev, true);
+ __mt76x02_edcca_init(dev);
mt76x02_init_agc_gain(dev);
/* init default values for temp compensation */
@@ -292,9 +294,12 @@ mt76x2_phy_temp_compensate(struct mt76x02_dev *dev)
void mt76x2_phy_calibrate(struct work_struct *work)
{
struct mt76x02_dev *dev;
+ bool ret;
dev = container_of(work, struct mt76x02_dev, cal_work.work);
- mt76x2_phy_channel_calibrate(dev, false);
+ ret = mt76x2_phy_channel_calibrate(dev, false);
+ if (ret)
+ mt76x02_edcca_init(dev);
mt76x2_phy_tssi_compensate(dev);
mt76x2_phy_temp_compensate(dev);
mt76x2_phy_update_channel_gain(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
index c7208c5375ac..2576654f2920 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
@@ -18,17 +18,17 @@
#include "eeprom.h"
#include "../mt76x02_phy.h"
-static void
+static bool
mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
{
struct ieee80211_channel *chan = dev->mt76.chandef.chan;
bool is_5ghz = chan->band == NL80211_BAND_5GHZ;
if (dev->cal.channel_cal_done)
- return;
+ return false;
if (mt76x2_channel_silent(dev))
- return;
+ return false;
if (!mac_stopped)
mt76x2u_mac_stop(dev);
@@ -45,17 +45,21 @@ mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
if (!mac_stopped)
mt76x2_mac_resume(dev);
mt76x2_apply_gain_adj(dev);
- mt76x02_edcca_init(dev);
dev->cal.channel_cal_done = true;
+
+ return true;
}
void mt76x2u_phy_calibrate(struct work_struct *work)
{
struct mt76x02_dev *dev;
+ bool ret;
dev = container_of(work, struct mt76x02_dev, cal_work.work);
- mt76x2u_phy_channel_calibrate(dev, false);
+ ret = mt76x2u_phy_channel_calibrate(dev, false);
+ if (ret)
+ mt76x02_edcca_init(dev);
mt76x2_phy_tssi_compensate(dev);
mt76x2_phy_update_channel_gain(dev);
@@ -177,6 +181,7 @@ int mt76x2u_phy_set_channel(struct mt76x02_dev *dev,
return 0;
mt76x2u_phy_channel_calibrate(dev, true);
+ __mt76x02_edcca_init(dev);
mt76x02_init_agc_gain(dev);
if (mt76x2_tssi_enabled(dev)) {
--
2.20.1
^ permalink raw reply related
* [PATCH 3/4] mt76: mt76x2: move mutex_lock inside mt76x2_set_channel
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557567465.git.lorenzo@kernel.org>
This is a preliminary patch to run mt76x02_edcca_init atomically
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
.../wireless/mediatek/mt76/mt76x2/pci_main.c | 16 ++++++++------
.../wireless/mediatek/mt76/mt76x2/usb_main.c | 22 ++++++++++---------
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
index e416eee6a306..3a1467326f4d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
@@ -54,14 +54,14 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
int ret;
cancel_delayed_work_sync(&dev->cal_work);
+ tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
+ tasklet_disable(&dev->dfs_pd.dfs_tasklet);
+ mutex_lock(&dev->mt76.mutex);
set_bit(MT76_RESET, &dev->mt76.state);
mt76_set_channel(&dev->mt76);
- tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
- tasklet_disable(&dev->dfs_pd.dfs_tasklet);
-
mt76x2_mac_stop(dev, true);
ret = mt76x2_phy_set_channel(dev, chandef);
@@ -72,10 +72,12 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
mt76x02_dfs_init_params(dev);
mt76x2_mac_resume(dev);
- tasklet_enable(&dev->dfs_pd.dfs_tasklet);
- tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
clear_bit(MT76_RESET, &dev->mt76.state);
+ mutex_unlock(&dev->mt76.mutex);
+
+ tasklet_enable(&dev->dfs_pd.dfs_tasklet);
+ tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
mt76_txq_schedule_all(&dev->mt76);
@@ -111,14 +113,14 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
}
}
+ mutex_unlock(&dev->mt76.mutex);
+
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
ieee80211_stop_queues(hw);
ret = mt76x2_set_channel(dev, &hw->conf.chandef);
ieee80211_wake_queues(hw);
}
- mutex_unlock(&dev->mt76.mutex);
-
return ret;
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 3351b736603d..e4dfc3bea3c5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -48,21 +48,23 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
int err;
cancel_delayed_work_sync(&dev->cal_work);
+ dev->beacon_ops->pre_tbtt_enable(dev, false);
+
+ mutex_lock(&dev->mt76.mutex);
set_bit(MT76_RESET, &dev->mt76.state);
mt76_set_channel(&dev->mt76);
- dev->beacon_ops->pre_tbtt_enable(dev, false);
-
mt76x2_mac_stop(dev, false);
err = mt76x2u_phy_set_channel(dev, chandef);
mt76x2_mac_resume(dev);
- dev->beacon_ops->pre_tbtt_enable(dev, true);
-
clear_bit(MT76_RESET, &dev->mt76.state);
+ mutex_unlock(&dev->mt76.mutex);
+
+ dev->beacon_ops->pre_tbtt_enable(dev, true);
mt76_txq_schedule_all(&dev->mt76);
return err;
@@ -84,12 +86,6 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter);
}
- if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
- ieee80211_stop_queues(hw);
- err = mt76x2u_set_channel(dev, &hw->conf.chandef);
- ieee80211_wake_queues(hw);
- }
-
if (changed & IEEE80211_CONF_CHANGE_POWER) {
dev->mt76.txpower_conf = hw->conf.power_level * 2;
@@ -102,6 +98,12 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
mutex_unlock(&dev->mt76.mutex);
+ if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
+ ieee80211_stop_queues(hw);
+ err = mt76x2u_set_channel(dev, &hw->conf.chandef);
+ ieee80211_wake_queues(hw);
+ }
+
return err;
}
--
2.20.1
^ permalink raw reply related
* [PATCH 2/4] mt76: mt76x2u: remove mt76x02_edcca_init in mt76x2u_set_channel
From: Lorenzo Bianconi @ 2019-05-11 10:17 UTC (permalink / raw)
To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557567465.git.lorenzo@kernel.org>
Remove mt76x02_edcca_init in mt76x2u_set_channel since it is already
run by mt76x2u_phy_channel_calibrate performing channel calibration
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 6657693edc3e..3351b736603d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -59,7 +59,6 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
err = mt76x2u_phy_set_channel(dev, chandef);
mt76x2_mac_resume(dev);
- mt76x02_edcca_init(dev);
dev->beacon_ops->pre_tbtt_enable(dev, true);
--
2.20.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox