All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mt76x0: fix hw key table initialization
@ 2018-10-29  0:36 Lorenzo Bianconi
  2018-10-29  0:36 ` [PATCH 1/2] mt76x2: move wcid_tx_rate conf at bootstrap Lorenzo Bianconi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-10-29  0:36 UTC (permalink / raw)
  To: nbd; +Cc: sgruszka, linux-wireless

Fix wrong mt76x0 hw key table initialization in AP mode.
Remove duplicated code.

This patchset is based on top of 'mt76x0: init: use
mt76x02_mac_shared_key_setup in mt76x0_init_hardware'
https://patchwork.kernel.org/patch/10658721/

Lorenzo Bianconi (2):
  mt76x2: move wcid_tx_rate conf at bootstrap
  mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration

 .../net/wireless/mediatek/mt76/mt76x0/init.c  | 45 +------------------
 .../net/wireless/mediatek/mt76/mt76x02_mac.c  |  3 --
 .../wireless/mediatek/mt76/mt76x2/pci_init.c  |  5 ++-
 3 files changed, 6 insertions(+), 47 deletions(-)

-- 
2.19.1


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

* [PATCH 1/2] mt76x2: move wcid_tx_rate conf at bootstrap
  2018-10-29  0:36 [PATCH 0/2] mt76x0: fix hw key table initialization Lorenzo Bianconi
@ 2018-10-29  0:36 ` Lorenzo Bianconi
  2018-10-29  0:37 ` [PATCH 2/2] mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration Lorenzo Bianconi
  2018-11-05 16:58 ` [PATCH 0/2] mt76x0: fix hw key table initialization Felix Fietkau
  2 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-10-29  0:36 UTC (permalink / raw)
  To: nbd; +Cc: sgruszka, linux-wireless

Move WCID tx rate configuration at device bootstrap since
the related register are always set to 0

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c     | 3 ---
 drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c | 5 ++++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index 4fb9f095ffec..b0b04415703f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -106,9 +106,6 @@ void mt76x02_mac_wcid_setup(struct mt76x02_dev *dev, u8 idx,
 
 	mt76_wr(dev, MT_WCID_ATTR(idx), attr);
 
-	mt76_wr(dev, MT_WCID_TX_RATE(idx), 0);
-	mt76_wr(dev, MT_WCID_TX_RATE(idx) + 4, 0);
-
 	if (idx >= 128)
 		return;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index f6e8af6432c1..7b53b2be28c2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -129,8 +129,11 @@ static int mt76x2_mac_reset(struct mt76x02_dev *dev, bool hard)
 	for (i = 0; i < 256 / 32; i++)
 		mt76_wr(dev, MT_WCID_DROP_BASE + i * 4, 0);
 
-	for (i = 0; i < 256; i++)
+	for (i = 0; i < 256; i++) {
 		mt76x02_mac_wcid_setup(dev, i, 0, NULL);
+		mt76_wr(dev, MT_WCID_TX_RATE(i), 0);
+		mt76_wr(dev, MT_WCID_TX_RATE(i) + 4, 0);
+	}
 
 	for (i = 0; i < MT_MAX_VIFS; i++)
 		mt76x02_mac_wcid_setup(dev, MT_VIF_WCID(i), i, NULL);
-- 
2.19.1


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

* [PATCH 2/2] mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration
  2018-10-29  0:36 [PATCH 0/2] mt76x0: fix hw key table initialization Lorenzo Bianconi
  2018-10-29  0:36 ` [PATCH 1/2] mt76x2: move wcid_tx_rate conf at bootstrap Lorenzo Bianconi
@ 2018-10-29  0:37 ` Lorenzo Bianconi
  2018-11-05 16:58 ` [PATCH 0/2] mt76x0: fix hw key table initialization Felix Fietkau
  2 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-10-29  0:37 UTC (permalink / raw)
  To: nbd; +Cc: sgruszka, linux-wireless

Use mt76x02_mac_wcid_setup utility routine for wcid init configuration
and remove duplicated code. This patch fixes a mt76x0 AP issue since
hw key table selection was set to pairwise by default

Fixes: dbad2adcb2c7 ("mt76x0: pci: enable AP support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 .../net/wireless/mediatek/mt76/mt76x0/init.c  | 45 +------------------
 1 file changed, 2 insertions(+), 43 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
index 23ff29990ff7..55db5a15410e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
@@ -157,42 +157,6 @@ static void mt76x0_init_mac_registers(struct mt76x02_dev *dev)
 	mt76_rmw(dev, MT_WMM_CTRL, 0x3ff, 0x201);
 }
 
-static int mt76x0_init_wcid_mem(struct mt76x02_dev *dev)
-{
-	u32 *vals;
-	int i;
-
-	vals = kmalloc(sizeof(*vals) * MT76_N_WCIDS * 2, GFP_KERNEL);
-	if (!vals)
-		return -ENOMEM;
-
-	for (i = 0; i < MT76_N_WCIDS; i++)  {
-		vals[i * 2] = 0xffffffff;
-		vals[i * 2 + 1] = 0x00ffffff;
-	}
-
-	mt76_wr_copy(dev, MT_WCID_ADDR_BASE, vals, MT76_N_WCIDS * 2);
-	kfree(vals);
-	return 0;
-}
-
-static int mt76x0_init_wcid_attr_mem(struct mt76x02_dev *dev)
-{
-	u32 *vals;
-	int i;
-
-	vals = kmalloc(sizeof(*vals) * MT76_N_WCIDS * 2, GFP_KERNEL);
-	if (!vals)
-		return -ENOMEM;
-
-	for (i = 0; i < MT76_N_WCIDS * 2; i++)
-		vals[i] = 1;
-
-	mt76_wr_copy(dev, MT_WCID_ATTR_BASE, vals, MT76_N_WCIDS * 2);
-	kfree(vals);
-	return 0;
-}
-
 static void mt76x0_reset_counters(struct mt76x02_dev *dev)
 {
 	mt76_rr(dev, MT_RX_STAT_0);
@@ -278,17 +242,12 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev)
 
 	dev->mt76.rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG);
 
-	ret = mt76x0_init_wcid_mem(dev);
-	if (ret)
-		return ret;
-
 	for (i = 0; i < 16; i++)
 		for (k = 0; k < 4; k++)
 			mt76x02_mac_shared_key_setup(dev, i, k, NULL);
 
-	ret = mt76x0_init_wcid_attr_mem(dev);
-	if (ret)
-		return ret;
+	for (i = 0; i < 256; i++)
+		mt76x02_mac_wcid_setup(dev, i, 0, NULL);
 
 	mt76x0_reset_counters(dev);
 
-- 
2.19.1


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

* Re: [PATCH 0/2] mt76x0: fix hw key table initialization
  2018-10-29  0:36 [PATCH 0/2] mt76x0: fix hw key table initialization Lorenzo Bianconi
  2018-10-29  0:36 ` [PATCH 1/2] mt76x2: move wcid_tx_rate conf at bootstrap Lorenzo Bianconi
  2018-10-29  0:37 ` [PATCH 2/2] mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration Lorenzo Bianconi
@ 2018-11-05 16:58 ` Felix Fietkau
  2 siblings, 0 replies; 4+ messages in thread
From: Felix Fietkau @ 2018-11-05 16:58 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: sgruszka, linux-wireless

On 2018-10-29 01:36, Lorenzo Bianconi wrote:
> Fix wrong mt76x0 hw key table initialization in AP mode.
> Remove duplicated code.
> 
> This patchset is based on top of 'mt76x0: init: use
> mt76x02_mac_shared_key_setup in mt76x0_init_hardware'
> https://patchwork.kernel.org/patch/10658721/
Applied, thanks.

- Felix

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29  0:36 [PATCH 0/2] mt76x0: fix hw key table initialization Lorenzo Bianconi
2018-10-29  0:36 ` [PATCH 1/2] mt76x2: move wcid_tx_rate conf at bootstrap Lorenzo Bianconi
2018-10-29  0:37 ` [PATCH 2/2] mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration Lorenzo Bianconi
2018-11-05 16:58 ` [PATCH 0/2] mt76x0: fix hw key table initialization Felix Fietkau

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.