diff mbox series

mt76: mt7603: add debugfs knob to enable/disable edcca

Message ID 0691acb931e963cb6028d4687cdd61032d0aaf52.1557591530.git.lorenzo@kernel.org (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series mt76: mt7603: add debugfs knob to enable/disable edcca | expand

Commit Message

Lorenzo Bianconi May 11, 2019, 4:38 p.m. UTC
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(-)

Comments

Kalle Valo May 13, 2019, 4:26 a.m. UTC | #1
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?
Lorenzo Bianconi May 13, 2019, 8:41 a.m. UTC | #2
> 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
Stanislaw Gruszka May 13, 2019, 9:48 a.m. UTC | #3
On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > 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.

What for it is needed ?

Stanislaw
Kalle Valo May 13, 2019, 12:37 p.m. UTC | #4
Lorenzo Bianconi <lorenzo@kernel.org> writes:

>> 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.

A lot of people read commit logs but not everyone (myself included) are
familiar with mt76 internals so please try to explain the acronyms and
the background of the patch. Also you should explain in the commit log
_why_ you are adding the debugfs file, how it helps the user and how to
use it.
Lorenzo Bianconi May 13, 2019, 3:41 p.m. UTC | #5
> Lorenzo Bianconi <lorenzo@kernel.org> writes:
> 
> >> 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.
> 
> A lot of people read commit logs but not everyone (myself included) are
> familiar with mt76 internals so please try to explain the acronyms and
> the background of the patch. Also you should explain in the commit log
> _why_ you are adding the debugfs file, how it helps the user and how to
> use it.

sorry for not been so clear.
ED/CCA is used to control tx power according to the CCA MIB counters (e.g do not
transmit if the channel busy time is higher than 90% for given amount of time
in a row).
As already done in commit 643749d4a82b ("mt76: mt76x02: disable ED/CCA by default"),
this patch adds the possibility to enable/disable the processing according to an
entry in the debugfs. The reason behind this patch is ED/CCA caused
instability in the past so it could be useful to disable it.

Regards,
Lorenzo

> 
> -- 
> Kalle Valo
Stanislaw Gruszka May 15, 2019, 9:33 a.m. UTC | #6
On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > 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.
> 
> What for it is needed ?

Care to comment why EDCCA is needed at all ?

Taking that debugfs file that enable it is read-only, it looks like
feature that nobody needs nor tests.

Stanislaw
Lorenzo Bianconi May 15, 2019, 9:43 a.m. UTC | #7
> On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > 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.
> > 
> > What for it is needed ?
> 
> Care to comment why EDCCA is needed at all ?
> 
> Taking that debugfs file that enable it is read-only, it looks like
> feature that nobody needs nor tests.

already fixed in v2
https://patchwork.kernel.org/patch/10940645/

Lorenzo

> 
> Stanislaw
Stanislaw Gruszka May 15, 2019, 9:54 a.m. UTC | #8
On Wed, May 15, 2019 at 11:43:55AM +0200, Lorenzo Bianconi wrote:
> > On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > > 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.
> > > 
> > > What for it is needed ?
> > 
> > Care to comment why EDCCA is needed at all ?
> > 
> > Taking that debugfs file that enable it is read-only, it looks like
> > feature that nobody needs nor tests.
> 
> already fixed in v2
> https://patchwork.kernel.org/patch/10940645/

I'm aware of this patch and other one for mt76x02. But so far in the
sources EDCCA is disabled for mt76x02 without possibility to enable it
(and this permission file issue was pointed by Kalle during review, not
by someone who want to test EDCCA). So again, what for EDCCA is needed ?

Stanislaw
Lorenzo Bianconi May 15, 2019, 10:03 a.m. UTC | #9
> On Wed, May 15, 2019 at 11:43:55AM +0200, Lorenzo Bianconi wrote:
> > > On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > > > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > > > 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.
> > > > 
> > > > What for it is needed ?
> > > 
> > > Care to comment why EDCCA is needed at all ?
> > > 
> > > Taking that debugfs file that enable it is read-only, it looks like
> > > feature that nobody needs nor tests.
> > 
> > already fixed in v2
> > https://patchwork.kernel.org/patch/10940645/
> 
> I'm aware of this patch and other one for mt76x02. But so far in the
> sources EDCCA is disabled for mt76x02 without possibility to enable it
> (and this permission file issue was pointed by Kalle during review, not
> by someone who want to test EDCCA). So again, what for EDCCA is needed ?

As I have already written in a previous email, ED/CCA is used to control tx power
according to the CCA MIB counters (e.g do not transmit if the channel busy time
is higher than 90% for given amount of time in a row). I guess it is required
by ETSI regulatory.
Regarding file permission for mt76x02 debugfs edcca node is a typo.

Lorenzo

> 
> Stanislaw
Stanislaw Gruszka May 15, 2019, 10:33 a.m. UTC | #10
On Wed, May 15, 2019 at 12:03:44PM +0200, Lorenzo Bianconi wrote:
> > On Wed, May 15, 2019 at 11:43:55AM +0200, Lorenzo Bianconi wrote:
> > > > On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > > > > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > > > > 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.
> > > > > 
> > > > > What for it is needed ?
> > > > 
> > > > Care to comment why EDCCA is needed at all ?
> > > > 
> > > > Taking that debugfs file that enable it is read-only, it looks like
> > > > feature that nobody needs nor tests.
> > > 
> > > already fixed in v2
> > > https://patchwork.kernel.org/patch/10940645/
> > 
> > I'm aware of this patch and other one for mt76x02. But so far in the
> > sources EDCCA is disabled for mt76x02 without possibility to enable it
> > (and this permission file issue was pointed by Kalle during review, not
> > by someone who want to test EDCCA). So again, what for EDCCA is needed ?
> 
> As I have already written in a previous email, ED/CCA is used to control tx power
> according to the CCA MIB counters (e.g do not transmit if the channel busy time
> is higher than 90% for given amount of time in a row). I guess it is required
> by ETSI regulatory.
But what is user case for that, i.e. who need this (it wasn't implemented in
mt76x2 since you added it on Dec 2018). What will happen if it will be removed?

> Regarding file permission for mt76x02 debugfs edcca node is a typo.
Typo or not, effectively disable the feature and show nobody is
testing it.

The reason I'm asking is that seems EDCCA is the main reason to
implement watchod for mt76x2, it wasn't necessary to have a watchdog
as seems devices did not hung before EDCCA was added.

Stanislaw
Lorenzo Bianconi May 15, 2019, 11:13 a.m. UTC | #11
> On Wed, May 15, 2019 at 12:03:44PM +0200, Lorenzo Bianconi wrote:
> > > On Wed, May 15, 2019 at 11:43:55AM +0200, Lorenzo Bianconi wrote:
> > > > > On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > > > > > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > > > > > 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.
> > > > > > 
> > > > > > What for it is needed ?
> > > > > 
> > > > > Care to comment why EDCCA is needed at all ?
> > > > > 
> > > > > Taking that debugfs file that enable it is read-only, it looks like
> > > > > feature that nobody needs nor tests.
> > > > 
> > > > already fixed in v2
> > > > https://patchwork.kernel.org/patch/10940645/
> > > 
> > > I'm aware of this patch and other one for mt76x02. But so far in the
> > > sources EDCCA is disabled for mt76x02 without possibility to enable it
> > > (and this permission file issue was pointed by Kalle during review, not
> > > by someone who want to test EDCCA). So again, what for EDCCA is needed ?
> > 
> > As I have already written in a previous email, ED/CCA is used to control tx power
> > according to the CCA MIB counters (e.g do not transmit if the channel busy time
> > is higher than 90% for given amount of time in a row). I guess it is required
> > by ETSI regulatory.
> But what is user case for that, i.e. who need this (it wasn't implemented in
> mt76x2 since you added it on Dec 2018). What will happen if it will be removed?
> 
> > Regarding file permission for mt76x02 debugfs edcca node is a typo.
> Typo or not, effectively disable the feature and show nobody is
> testing it.
> 
> The reason I'm asking is that seems EDCCA is the main reason to
> implement watchod for mt76x2, it wasn't necessary to have a watchdog
> as seems devices did not hung before EDCCA was added.

IIRC I added the first watchdog implementation to fix tx hangs that occur
under heavy load even using FCC regulatory (so when EDCCA processing is
disabled)

Regards,
Lorenzo

> 
> Stanislaw
Stanislaw Gruszka May 15, 2019, 11:46 a.m. UTC | #12
On Wed, May 15, 2019 at 01:13:49PM +0200, Lorenzo Bianconi wrote:
> > On Wed, May 15, 2019 at 12:03:44PM +0200, Lorenzo Bianconi wrote:
> > > > On Wed, May 15, 2019 at 11:43:55AM +0200, Lorenzo Bianconi wrote:
> > > > > > On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > > > > > > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > > > > > > 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.
> > > > > > > 
> > > > > > > What for it is needed ?
> > > > > > 
> > > > > > Care to comment why EDCCA is needed at all ?
> > > > > > 
> > > > > > Taking that debugfs file that enable it is read-only, it looks like
> > > > > > feature that nobody needs nor tests.
> > > > > 
> > > > > already fixed in v2
> > > > > https://patchwork.kernel.org/patch/10940645/
> > > > 
> > > > I'm aware of this patch and other one for mt76x02. But so far in the
> > > > sources EDCCA is disabled for mt76x02 without possibility to enable it
> > > > (and this permission file issue was pointed by Kalle during review, not
> > > > by someone who want to test EDCCA). So again, what for EDCCA is needed ?
> > > 
> > > As I have already written in a previous email, ED/CCA is used to control tx power
> > > according to the CCA MIB counters (e.g do not transmit if the channel busy time
> > > is higher than 90% for given amount of time in a row). I guess it is required
> > > by ETSI regulatory.
> > But what is user case for that, i.e. who need this (it wasn't implemented in
> > mt76x2 since you added it on Dec 2018). What will happen if it will be removed?
> > 
> > > Regarding file permission for mt76x02 debugfs edcca node is a typo.
> > Typo or not, effectively disable the feature and show nobody is
> > testing it.
> > 
> > The reason I'm asking is that seems EDCCA is the main reason to
> > implement watchod for mt76x2, it wasn't necessary to have a watchdog
> > as seems devices did not hung before EDCCA was added.
> 
> IIRC I added the first watchdog implementation to fix tx hangs that occur
> under heavy load even using FCC regulatory (so when EDCCA processing is
> disabled)

There was changes in various registers programming introduced by EDCCA
support, even with EDCCA disabled. It's rally not convenient that
watchdog and EDCCA are not related, since you added tx hung watchdog
2 weeks after adding EDCCA.

You can look at this report:
https://github.com/openwrt/mt76/issues/246
Before mt76x2e worked without hungs & watchodg. Now, even with EDCCA
disabled watchdog and HW restarts are required to fix hungs on runtime.

Stanislaw
Lorenzo Bianconi May 15, 2019, 12:07 p.m. UTC | #13
> On Wed, May 15, 2019 at 01:13:49PM +0200, Lorenzo Bianconi wrote:
> > > On Wed, May 15, 2019 at 12:03:44PM +0200, Lorenzo Bianconi wrote:
> > > > > On Wed, May 15, 2019 at 11:43:55AM +0200, Lorenzo Bianconi wrote:
> > > > > > > On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > > > > > > > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > > > > > > > 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.
> > > > > > > > 
> > > > > > > > What for it is needed ?
> > > > > > > 
> > > > > > > Care to comment why EDCCA is needed at all ?
> > > > > > > 
> > > > > > > Taking that debugfs file that enable it is read-only, it looks like
> > > > > > > feature that nobody needs nor tests.
> > > > > > 
> > > > > > already fixed in v2
> > > > > > https://patchwork.kernel.org/patch/10940645/
> > > > > 
> > > > > I'm aware of this patch and other one for mt76x02. But so far in the
> > > > > sources EDCCA is disabled for mt76x02 without possibility to enable it
> > > > > (and this permission file issue was pointed by Kalle during review, not
> > > > > by someone who want to test EDCCA). So again, what for EDCCA is needed ?
> > > > 
> > > > As I have already written in a previous email, ED/CCA is used to control tx power
> > > > according to the CCA MIB counters (e.g do not transmit if the channel busy time
> > > > is higher than 90% for given amount of time in a row). I guess it is required
> > > > by ETSI regulatory.
> > > But what is user case for that, i.e. who need this (it wasn't implemented in
> > > mt76x2 since you added it on Dec 2018). What will happen if it will be removed?
> > > 
> > > > Regarding file permission for mt76x02 debugfs edcca node is a typo.
> > > Typo or not, effectively disable the feature and show nobody is
> > > testing it.
> > > 
> > > The reason I'm asking is that seems EDCCA is the main reason to
> > > implement watchod for mt76x2, it wasn't necessary to have a watchdog
> > > as seems devices did not hung before EDCCA was added.
> > 
> > IIRC I added the first watchdog implementation to fix tx hangs that occur
> > under heavy load even using FCC regulatory (so when EDCCA processing is
> > disabled)
> 
> There was changes in various registers programming introduced by EDCCA
> support, even with EDCCA disabled. It's rally not convenient that
> watchdog and EDCCA are not related, since you added tx hung watchdog
> 2 weeks after adding EDCCA.
> 
> You can look at this report:
> https://github.com/openwrt/mt76/issues/246
> Before mt76x2e worked without hungs & watchodg. Now, even with EDCCA
> disabled watchdog and HW restarts are required to fix hungs on runtime.

Tx hangs occur in very particular conditions (e.g 200Mbps bidirectional
traffic) and moreover they do not always occur so I am not convinced they
are always EDCCA related and so I am not confident to remove the watchdog

Lorenzo

> 
> Stanislaw
Stanislaw Gruszka May 15, 2019, 1:48 p.m. UTC | #14
On Wed, May 15, 2019 at 02:07:42PM +0200, Lorenzo Bianconi wrote:
> > On Wed, May 15, 2019 at 01:13:49PM +0200, Lorenzo Bianconi wrote:
> > > > On Wed, May 15, 2019 at 12:03:44PM +0200, Lorenzo Bianconi wrote:
> > > > > > On Wed, May 15, 2019 at 11:43:55AM +0200, Lorenzo Bianconi wrote:
> > > > > > > > On Mon, May 13, 2019 at 11:48:37AM +0200, Stanislaw Gruszka wrote:
> > > > > > > > > On Mon, May 13, 2019 at 10:41:28AM +0200, Lorenzo Bianconi wrote:
> > > > > > > > > > > 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.
> > > > > > > > > 
> > > > > > > > > What for it is needed ?
> > > > > > > > 
> > > > > > > > Care to comment why EDCCA is needed at all ?
> > > > > > > > 
> > > > > > > > Taking that debugfs file that enable it is read-only, it looks like
> > > > > > > > feature that nobody needs nor tests.
> > > > > > > 
> > > > > > > already fixed in v2
> > > > > > > https://patchwork.kernel.org/patch/10940645/
> > > > > > 
> > > > > > I'm aware of this patch and other one for mt76x02. But so far in the
> > > > > > sources EDCCA is disabled for mt76x02 without possibility to enable it
> > > > > > (and this permission file issue was pointed by Kalle during review, not
> > > > > > by someone who want to test EDCCA). So again, what for EDCCA is needed ?
> > > > > 
> > > > > As I have already written in a previous email, ED/CCA is used to control tx power
> > > > > according to the CCA MIB counters (e.g do not transmit if the channel busy time
> > > > > is higher than 90% for given amount of time in a row). I guess it is required
> > > > > by ETSI regulatory.
> > > > But what is user case for that, i.e. who need this (it wasn't implemented in
> > > > mt76x2 since you added it on Dec 2018). What will happen if it will be removed?
> > > > 
> > > > > Regarding file permission for mt76x02 debugfs edcca node is a typo.
> > > > Typo or not, effectively disable the feature and show nobody is
> > > > testing it.
> > > > 
> > > > The reason I'm asking is that seems EDCCA is the main reason to
> > > > implement watchod for mt76x2, it wasn't necessary to have a watchdog
> > > > as seems devices did not hung before EDCCA was added.
> > > 
> > > IIRC I added the first watchdog implementation to fix tx hangs that occur
> > > under heavy load even using FCC regulatory (so when EDCCA processing is
> > > disabled)
> > 
> > There was changes in various registers programming introduced by EDCCA
> > support, even with EDCCA disabled. It's rally not convenient that
> > watchdog and EDCCA are not related, since you added tx hung watchdog
> > 2 weeks after adding EDCCA.
> > 
> > You can look at this report:
> > https://github.com/openwrt/mt76/issues/246
> > Before mt76x2e worked without hungs & watchodg. Now, even with EDCCA
> > disabled watchdog and HW restarts are required to fix hungs on runtime.
> 
> Tx hangs occur in very particular conditions (e.g 200Mbps bidirectional
> traffic) and moreover they do not always occur so I am not convinced they
> are always EDCCA related and so I am not confident to remove the watchdog

I'm not opting for watchdog removal, but for full EDCCA removal.
Apparently nobody cares, if it can be enabled or not.

Stanislaw
Stanislaw Gruszka May 15, 2019, 1:59 p.m. UTC | #15
On Wed, May 15, 2019 at 03:48:29PM +0200, Stanislaw Gruszka wrote:
> > Tx hangs occur in very particular conditions (e.g 200Mbps bidirectional
> > traffic) and moreover they do not always occur so I am not convinced they
> > are always EDCCA related and so I am not confident to remove the watchdog
> 
> I'm not opting for watchdog removal, but for full EDCCA removal.
On mt76x02, on other chips/firmwares it can work just fine.

Stanislaw
diff mbox series

Patch

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