linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76x2u: init: use common routines for wcid/key initialization
       [not found] <cover.1540847490.git.lorenzo.bianconi@redhat.com>
@ 2018-10-29 21:16 ` Lorenzo Bianconi
  2018-11-05 17:00   ` Felix Fietkau
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2018-10-29 21:16 UTC (permalink / raw)
  To: nbd; +Cc: sgruszka, linux-wireless

Use mt76x02_mac_wcid_setup and mt76x02_mac_shared_key_setup for
shared keys and wcid table initialization and remove duplicated
code

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 .../wireless/mediatek/mt76/mt76x2/usb_init.c  | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
index c338ac0433ad..94a4b58fddc1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
@@ -166,11 +166,7 @@ static void mt76x2u_init_beacon_offsets(struct mt76x02_dev *dev)
 
 int mt76x2u_init_hardware(struct mt76x02_dev *dev)
 {
-	const struct mt76_wcid_addr addr = {
-		.macaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
-		.ba_mask = 0,
-	};
-	int i, err;
+	int i, k, err;
 
 	mt76x2_reset_wlan(dev, true);
 	mt76x2u_power_on(dev);
@@ -210,15 +206,14 @@ int mt76x2u_init_hardware(struct mt76x02_dev *dev)
 		return -ETIMEDOUT;
 
 	/* reset wcid table */
-	for (i = 0; i < 254; i++)
-		mt76_wr_copy(dev, MT_WCID_ADDR(i), &addr,
-			     sizeof(struct mt76_wcid_addr));
+	for (i = 0; i < 256; i++)
+		mt76x02_mac_wcid_setup(dev, i, 0, NULL);
 
 	/* reset shared key table and pairwise key table */
-	for (i = 0; i < 4; i++)
-		mt76_wr(dev, MT_SKEY_MODE_BASE_0 + 4 * i, 0);
-	for (i = 0; i < 256; i++)
-		mt76_wr(dev, MT_WCID_ATTR(i), 1);
+	for (i = 0; i < 16; i++) {
+		for (k = 0; k < 4; k++)
+			mt76x02_mac_shared_key_setup(dev, i, k, NULL);
+	}
 
 	mt76_clear(dev, MT_BEACON_TIME_CFG,
 		   MT_BEACON_TIME_CFG_TIMER_EN |
-- 
2.19.1


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

* Re: [PATCH] mt76x2u: init: use common routines for wcid/key initialization
  2018-10-29 21:16 ` [PATCH] mt76x2u: init: use common routines for wcid/key initialization Lorenzo Bianconi
@ 2018-11-05 17:00   ` Felix Fietkau
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Fietkau @ 2018-11-05 17:00 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: sgruszka, linux-wireless

On 2018-10-29 22:16, Lorenzo Bianconi wrote:
> Use mt76x02_mac_wcid_setup and mt76x02_mac_shared_key_setup for
> shared keys and wcid table initialization and remove duplicated
> code
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Applied, thanks.

- Felix

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

end of thread, other threads:[~2018-11-05 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1540847490.git.lorenzo.bianconi@redhat.com>
2018-10-29 21:16 ` [PATCH] mt76x2u: init: use common routines for wcid/key initialization Lorenzo Bianconi
2018-11-05 17:00   ` Felix Fietkau

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