All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mt76: mt76x02: fix num slots in beacon config init
@ 2019-11-04 15:03 Markus Theil
  2019-11-04 15:45 ` Lorenzo Bianconi
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Theil @ 2019-11-04 15:03 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, sgruszka, linux-wireless, Markus Theil

mt76x02 mmio and usb devices use a different number of beacon slots (8
vs. 5). Consider this in mt76x02_init_beacon_config.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
index 4209209ac940..b7412953ff26 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
@@ -249,7 +249,7 @@ void mt76x02_init_beacon_config(struct mt76x02_dev *dev)
 	mt76_set(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_SYNC_MODE);
 	mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff);
 
-	for (i = 0; i < 8; i++)
+	for (i = 0; i < dev->beacon_ops->nslots; i++)
 		mt76x02_mac_set_beacon(dev, i, NULL);
 
 	mt76x02_set_beacon_offsets(dev);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mt76: mt76x02: fix num slots in beacon config init
  2019-11-04 15:03 [PATCH] mt76: mt76x02: fix num slots in beacon config init Markus Theil
@ 2019-11-04 15:45 ` Lorenzo Bianconi
  2019-11-04 16:07   ` Markus Theil
  0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2019-11-04 15:45 UTC (permalink / raw)
  To: Markus Theil; +Cc: nbd, sgruszka, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

> mt76x02 mmio and usb devices use a different number of beacon slots (8
> vs. 5). Consider this in mt76x02_init_beacon_config.
> 
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> ---
>  drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> index 4209209ac940..b7412953ff26 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> @@ -249,7 +249,7 @@ void mt76x02_init_beacon_config(struct mt76x02_dev *dev)
>  	mt76_set(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_SYNC_MODE);
>  	mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff);
>  
> -	for (i = 0; i < 8; i++)
> +	for (i = 0; i < dev->beacon_ops->nslots; i++)
>  		mt76x02_mac_set_beacon(dev, i, NULL);
>  
>  	mt76x02_set_beacon_offsets(dev);

Hi Markus,

mt76x02_init_beacon_config is run just at bootstrap and it is used to clean all
beacon RAM memory. It can't see any issue with the current code.

Regards,
Lorenzo

> -- 
> 2.17.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mt76: mt76x02: fix num slots in beacon config init
  2019-11-04 15:45 ` Lorenzo Bianconi
@ 2019-11-04 16:07   ` Markus Theil
  2019-11-04 16:17     ` Lorenzo Bianconi
  2019-11-05  8:53     ` Stanislaw Gruszka
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Theil @ 2019-11-04 16:07 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: nbd, sgruszka, linux-wireless

On 04.11.19 16:45, Lorenzo Bianconi wrote:
>> mt76x02 mmio and usb devices use a different number of beacon slots (8
>> vs. 5). Consider this in mt76x02_init_beacon_config.
>>
>> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
>> ---
>>  drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
>> index 4209209ac940..b7412953ff26 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
>> @@ -249,7 +249,7 @@ void mt76x02_init_beacon_config(struct mt76x02_dev *dev)
>>  	mt76_set(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_SYNC_MODE);
>>  	mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff);
>>  
>> -	for (i = 0; i < 8; i++)
>> +	for (i = 0; i < dev->beacon_ops->nslots; i++)
>>  		mt76x02_mac_set_beacon(dev, i, NULL);
>>  
>>  	mt76x02_set_beacon_offsets(dev);
> Hi Markus,
>
> mt76x02_init_beacon_config is run just at bootstrap and it is used to clean all
> beacon RAM memory. It can't see any issue with the current code.
>
> Regards,
> Lorenzo
>
>> -- 
>> 2.17.1
>>
Hi Lorenzo,

I just thought this function should overwrite all 8192 byte beacon RAM
memory. If the loop count is set to 8 it would overwrite 8 x 1024 = 8192
byte in the mmio case and 8 x 1638 = 13104 byte in the USB case. 1638 is
8192 / N_BCN_SLOTS. N_BCN_SLOTS is currently 5 for USB. mt76x02_beacon.c
has no further checks for beacon_ops->nslots in the case of setting a
beacon.

Markus



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mt76: mt76x02: fix num slots in beacon config init
  2019-11-04 16:07   ` Markus Theil
@ 2019-11-04 16:17     ` Lorenzo Bianconi
  2019-11-05  8:53     ` Stanislaw Gruszka
  1 sibling, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2019-11-04 16:17 UTC (permalink / raw)
  To: Markus Theil; +Cc: nbd, sgruszka, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]

On Nov 04, Markus Theil wrote:
> On 04.11.19 16:45, Lorenzo Bianconi wrote:
> >> mt76x02 mmio and usb devices use a different number of beacon slots (8
> >> vs. 5). Consider this in mt76x02_init_beacon_config.
> >>
> >> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> >> ---
> >>  drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> >> index 4209209ac940..b7412953ff26 100644
> >> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> >> @@ -249,7 +249,7 @@ void mt76x02_init_beacon_config(struct mt76x02_dev *dev)
> >>  	mt76_set(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_SYNC_MODE);
> >>  	mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff);
> >>  
> >> -	for (i = 0; i < 8; i++)
> >> +	for (i = 0; i < dev->beacon_ops->nslots; i++)
> >>  		mt76x02_mac_set_beacon(dev, i, NULL);
> >>  
> >>  	mt76x02_set_beacon_offsets(dev);
> > Hi Markus,
> >
> > mt76x02_init_beacon_config is run just at bootstrap and it is used to clean all
> > beacon RAM memory. It can't see any issue with the current code.
> >
> > Regards,
> > Lorenzo
> >
> >> -- 
> >> 2.17.1
> >>
> Hi Lorenzo,
> 
> I just thought this function should overwrite all 8192 byte beacon RAM
> memory. If the loop count is set to 8 it would overwrite 8 x 1024 = 8192
> byte in the mmio case and 8 x 1638 = 13104 byte in the USB case. 1638 is
> 8192 / N_BCN_SLOTS. N_BCN_SLOTS is currently 5 for USB. mt76x02_beacon.c
> has no further checks for beacon_ops->nslots in the case of setting a
> beacon.

ops..I did not notice beacon_len in __mt76x02_mac_set_beacon

Lorenzo

> 
> Markus
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mt76: mt76x02: fix num slots in beacon config init
  2019-11-04 16:07   ` Markus Theil
  2019-11-04 16:17     ` Lorenzo Bianconi
@ 2019-11-05  8:53     ` Stanislaw Gruszka
  1 sibling, 0 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2019-11-05  8:53 UTC (permalink / raw)
  To: Markus Theil; +Cc: Lorenzo Bianconi, nbd, linux-wireless

On Mon, Nov 04, 2019 at 05:07:16PM +0100, Markus Theil wrote:
> On 04.11.19 16:45, Lorenzo Bianconi wrote:
> >> mt76x02 mmio and usb devices use a different number of beacon slots (8
> >> vs. 5). Consider this in mt76x02_init_beacon_config.
> >>
> >> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> >> ---
> >>  drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> >> index 4209209ac940..b7412953ff26 100644
> >> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> >> @@ -249,7 +249,7 @@ void mt76x02_init_beacon_config(struct mt76x02_dev *dev)
> >>  	mt76_set(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_SYNC_MODE);
> >>  	mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff);
> >>  
> >> -	for (i = 0; i < 8; i++)
> >> +	for (i = 0; i < dev->beacon_ops->nslots; i++)
> >>  		mt76x02_mac_set_beacon(dev, i, NULL);
> >>  
> >>  	mt76x02_set_beacon_offsets(dev);
> > Hi Markus,
> >
> > mt76x02_init_beacon_config is run just at bootstrap and it is used to clean all
> > beacon RAM memory. It can't see any issue with the current code.
> >
> > Regards,
> > Lorenzo
> >
> >> -- 
> >> 2.17.1
> >>
> Hi Lorenzo,
> 
> I just thought this function should overwrite all 8192 byte beacon RAM
> memory. If the loop count is set to 8 it would overwrite 8 x 1024 = 8192
> byte in the mmio case and 8 x 1638 = 13104 byte in the USB case. 1638 is
> 8192 / N_BCN_SLOTS. N_BCN_SLOTS is currently 5 for USB. mt76x02_beacon.c
> has no further checks for beacon_ops->nslots in the case of setting a
> beacon.

We do not override beacon SRAM memory in mt76x02_init_beacon_config()
as bcn_idx increase only if !!dev->beacons[i], so we 8 times nullify
beacon 0 .

Patch is fine though, but things can be optimized more ...

We possibly can skip beacon SRAM nullification at all (even if there is
garbage in the memory, beacon will not be sent if blocked by
MT_BCN_BYPASS_MASK = 0xffff). Or nullify SRAM at once. And just set
proper MT_MAC_BSSID_DW1_MBEACON_N value.

Stanislaw


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-05  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 15:03 [PATCH] mt76: mt76x02: fix num slots in beacon config init Markus Theil
2019-11-04 15:45 ` Lorenzo Bianconi
2019-11-04 16:07   ` Markus Theil
2019-11-04 16:17     ` Lorenzo Bianconi
2019-11-05  8:53     ` Stanislaw Gruszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.