All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] mt76 fixes
@ 2017-12-14 15:39 Felix Fietkau
  2017-12-14 15:39 ` [PATCH 01/14] mt76: fix debugfs_simple_attr.cocci warnings Felix Fietkau
                   ` (13 more replies)
  0 siblings, 14 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Felix Fietkau (10):
  mt76x2: remove some harmless WARN_ONs in tx status and rx path
  mt76x2: fix transmission of encrypted management frames
  mt76x2: increase OFDM SIFS time
  mt76x2: add channel argument to eeprom tx power functions
  mt76x2: initialize channel power limits at probe time
  mt76x2: convert between per-chain tx power and combined output
  mt76x2: remove MAC address limitation for multi-vif setups
  mt76x2: clean up MAC/BSSID address initialization
  mt76x2: drop wiphy->addresses
  mt76x2: configure rx filter based on monitor mode setting

Fengguang Wu (2):
  mt76: fix debugfs_simple_attr.cocci warnings
  mt76: fix returnvar.cocci warnings

Lorenzo Bianconi (2):
  mt76x2: init: disable APCLI by default
  mt76x2: init: fix rx filter default value during init

 drivers/net/wireless/mediatek/mt76/debugfs.c       |  7 +-
 drivers/net/wireless/mediatek/mt76/mt76.h          |  1 +
 drivers/net/wireless/mediatek/mt76/mt76x2.h        |  3 +-
 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c | 41 ++++++++---
 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h |  7 +-
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c   | 67 ++++++++++-------
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c    | 85 +++++++++++++++++-----
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.h    |  1 +
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c   | 57 +++++++++------
 drivers/net/wireless/mediatek/mt76/mt76x2_phy.c    | 30 ++------
 drivers/net/wireless/mediatek/mt76/mt76x2_regs.h   |  8 ++
 drivers/net/wireless/mediatek/mt76/mt76x2_tx.c     |  6 +-
 12 files changed, 204 insertions(+), 109 deletions(-)

-- 
2.14.2

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

* [PATCH 01/14] mt76: fix debugfs_simple_attr.cocci warnings
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2018-01-08 17:26   ` [01/14] " Kalle Valo
  2017-12-14 15:39 ` [PATCH 02/14] mt76: fix returnvar.cocci warnings Felix Fietkau
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

From: Fengguang Wu <fengguang.wu@intel.com>

drivers/net/wireless/mediatek/mt76/debugfs.c:36:0-23: WARNING: fops_regval should be defined with DEFINE_DEBUGFS_ATTRIBUTE

 Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
 for debugfs files.

Semantic patch information:
 Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
 imposes some significant overhead as compared to
 DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Fixes: a5f6039c8f9c ("mt76: add driver code for MT76x2e")
CC: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 drivers/net/wireless/mediatek/mt76/debugfs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/debugfs.c b/drivers/net/wireless/mediatek/mt76/debugfs.c
index 7c3612aaa8c4..c121b502a462 100644
--- a/drivers/net/wireless/mediatek/mt76/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/debugfs.c
@@ -33,7 +33,8 @@ mt76_reg_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set,
+			 "0x%08llx\n");
 
 static int
 mt76_queues_read(struct seq_file *s, void *data)
@@ -65,8 +66,8 @@ struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
 
 	debugfs_create_u8("led_pin", S_IRUSR | S_IWUSR, dir, &dev->led_pin);
 	debugfs_create_u32("regidx", S_IRUSR | S_IWUSR, dir, &dev->debugfs_reg);
-	debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev,
-			    &fops_regval);
+	debugfs_create_file_unsafe("regval", S_IRUSR | S_IWUSR, dir, dev,
+				   &fops_regval);
 	debugfs_create_blob("eeprom", S_IRUSR, dir, &dev->eeprom);
 	if (dev->otp.data)
 		debugfs_create_blob("otp", S_IRUSR, dir, &dev->otp);
-- 
2.14.2

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

* [PATCH 02/14] mt76: fix returnvar.cocci warnings
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
  2017-12-14 15:39 ` [PATCH 01/14] mt76: fix debugfs_simple_attr.cocci warnings Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 03/14] mt76x2: remove some harmless WARN_ONs in tx status and rx path Felix Fietkau
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

From: Fengguang Wu <fengguang.wu@intel.com>

drivers/net/wireless/mediatek/mt76/mt76x2_main.c:86:5-8: Unneeded variable: "ret". Return "0" on line 112

 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Fixes: a5f6039c8f9c ("mt76: add driver code for MT76x2e")
CC: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
index 33469e32567b..88fe5e0de0b9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
@@ -83,7 +83,6 @@ mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	struct mt76x2_dev *dev = hw->priv;
 	struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
 	unsigned int idx = 0;
-	int ret = 0;
 
 	if (vif->addr[0] & BIT(1))
 		idx = 1 + (((dev->mt76.macaddr[0] ^ vif->addr[0]) >> 2) & 7);
@@ -109,7 +108,7 @@ mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	mvif->group_wcid.hw_key_idx = -1;
 	mt76x2_txq_init(dev, vif->txq);
 
-	return ret;
+	return 0;
 }
 
 static void
-- 
2.14.2

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

* [PATCH 03/14] mt76x2: remove some harmless WARN_ONs in tx status and rx path
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
  2017-12-14 15:39 ` [PATCH 01/14] mt76: fix debugfs_simple_attr.cocci warnings Felix Fietkau
  2017-12-14 15:39 ` [PATCH 02/14] mt76: fix returnvar.cocci warnings Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 04/14] mt76x2: fix transmission of encrypted management frames Felix Fietkau
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Discard affected packets instead. Should reduce the frequency of bogus
bug reports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 28 ++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
index a1f695e9b51c..f7c0df0759f7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
@@ -28,7 +28,7 @@ void mt76x2_mac_set_bssid(struct mt76x2_dev *dev, u8 idx, const u8 *addr)
 		       get_unaligned_le16(addr + 4));
 }
 
-static void
+static int
 mt76x2_mac_process_rate(struct ieee80211_rx_status *status, u16 rate)
 {
 	u8 idx = FIELD_GET(MT_RXWI_RATE_INDEX, rate);
@@ -42,7 +42,7 @@ mt76x2_mac_process_rate(struct ieee80211_rx_status *status, u16 rate)
 			idx += 4;
 
 		status->rate_idx = idx;
-		return;
+		return 0;
 	case MT_PHY_TYPE_CCK:
 		if (idx >= 8) {
 			idx -= 8;
@@ -53,7 +53,7 @@ mt76x2_mac_process_rate(struct ieee80211_rx_status *status, u16 rate)
 			idx = 0;
 
 		status->rate_idx = idx;
-		return;
+		return 0;
 	case MT_PHY_TYPE_HT_GF:
 		status->enc_flags |= RX_ENC_FLAG_HT_GF;
 		/* fall through */
@@ -67,8 +67,7 @@ mt76x2_mac_process_rate(struct ieee80211_rx_status *status, u16 rate)
 		status->nss = FIELD_GET(MT_RATE_INDEX_VHT_NSS, idx) + 1;
 		break;
 	default:
-		WARN_ON(1);
-		return;
+		return -EINVAL;
 	}
 
 	if (rate & MT_RXWI_RATE_LDPC)
@@ -92,6 +91,8 @@ mt76x2_mac_process_rate(struct ieee80211_rx_status *status, u16 rate)
 	default:
 		break;
 	}
+
+	return 0;
 }
 
 static __le16
@@ -272,12 +273,10 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
 	status->freq = dev->mt76.chandef.chan->center_freq;
 	status->band = dev->mt76.chandef.chan->band;
 
-	mt76x2_mac_process_rate(status, rate);
-
-	return 0;
+	return mt76x2_mac_process_rate(status, rate);
 }
 
-static void
+static int
 mt76x2_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate,
 			   enum nl80211_band band)
 {
@@ -293,13 +292,13 @@ mt76x2_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate,
 			idx += 4;
 
 		txrate->idx = idx;
-		return;
+		return 0;
 	case MT_PHY_TYPE_CCK:
 		if (idx >= 8)
 			idx -= 8;
 
 		txrate->idx = idx;
-		return;
+		return 0;
 	case MT_PHY_TYPE_HT_GF:
 		txrate->flags |= IEEE80211_TX_RC_GREEN_FIELD;
 		/* fall through */
@@ -312,8 +311,7 @@ mt76x2_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate,
 		txrate->idx = idx;
 		break;
 	default:
-		WARN_ON(1);
-		return;
+		return -EINVAL;
 	}
 
 	switch (FIELD_GET(MT_RXWI_RATE_BW, rate)) {
@@ -326,12 +324,14 @@ mt76x2_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate,
 		txrate->flags |= IEEE80211_TX_RC_80_MHZ_WIDTH;
 		break;
 	default:
-		WARN_ON(1);
+		return -EINVAL;
 		break;
 	}
 
 	if (rate & MT_RXWI_RATE_SGI)
 		txrate->flags |= IEEE80211_TX_RC_SHORT_GI;
+
+	return 0;
 }
 
 static void
-- 
2.14.2

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

* [PATCH 04/14] mt76x2: fix transmission of encrypted management frames
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (2 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 03/14] mt76x2: remove some harmless WARN_ONs in tx status and rx path Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2018-01-08 17:27   ` [04/14] " Kalle Valo
  2017-12-14 15:39 ` [PATCH 05/14] mt76x2: increase OFDM SIFS time Felix Fietkau
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Hardware encryption seems to break encrypted unicast mgmt tx.
Unfortunately the hardware TXWI header does not have a bit to indicate
that a frame is software encrypted, so sw-encrypted frames need to use a
different WCID. For that to work, the CCMP PN needs to be generated in
software, which makes things a bit slower, so only do it for keys that
also need to tx management frames.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76.h        |  1 +
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c  | 16 ++++++++++++++++
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c |  8 +++++++-
 drivers/net/wireless/mediatek/mt76/mt76x2_tx.c   |  6 ++++--
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index aa0880bbea7f..f88d9a15210a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -129,6 +129,7 @@ struct mt76_wcid {
 	bool tx_rate_set;
 	u8 tx_rate_nss;
 	s8 max_txpwr_adj;
+	bool sw_iv;
 };
 
 struct mt76_txq {
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
index f7c0df0759f7..a7416a01baa4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
@@ -171,10 +171,12 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi,
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_tx_rate *rate = &info->control.rates[0];
+	struct ieee80211_key_conf *key = info->control.hw_key;
 	u16 rate_ht_mask = FIELD_PREP(MT_RXWI_RATE_PHY, BIT(1) | BIT(2));
 	u16 txwi_flags = 0;
 	u8 nss;
 	s8 txpwr_adj, max_txpwr_adj;
+	u8 ccmp_pn[8];
 
 	memset(txwi, 0, sizeof(*txwi));
 
@@ -185,6 +187,20 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi,
 
 	txwi->pktid = 1;
 
+	if (wcid && wcid->sw_iv && key) {
+		u64 pn = atomic64_inc_return(&key->tx_pn);
+		ccmp_pn[0] = pn;
+		ccmp_pn[1] = pn >> 8;
+		ccmp_pn[2] = 0;
+		ccmp_pn[3] = 0x20 | (key->keyidx << 6);
+		ccmp_pn[4] = pn >> 16;
+		ccmp_pn[5] = pn >> 24;
+		ccmp_pn[6] = pn >> 32;
+		ccmp_pn[7] = pn >> 40;
+		txwi->iv = *((u32 *) &ccmp_pn[0]);
+		txwi->eiv = *((u32 *) &ccmp_pn[1]);
+	}
+
 	spin_lock_bh(&dev->mt76.lock);
 	if (wcid && (rate->idx < 0 || !rate->count)) {
 		txwi->rate = wcid->tx_rate;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
index 88fe5e0de0b9..02dd2cafa52f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
@@ -343,9 +343,15 @@ mt76x2_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	if (cmd == SET_KEY) {
 		key->hw_key_idx = wcid->idx;
 		wcid->hw_key_idx = idx;
+		if (key->flags & IEEE80211_KEY_FLAG_RX_MGMT) {
+			key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
+			wcid->sw_iv = true;
+		}
 	} else {
-		if (idx == wcid->hw_key_idx)
+		if (idx == wcid->hw_key_idx) {
 			wcid->hw_key_idx = -1;
+			wcid->sw_iv = true;
+		}
 
 		key = NULL;
 	}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
index 1a32e1fb8743..534e4bf9a34c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c
@@ -36,7 +36,9 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
 
 		msta = (struct mt76x2_sta *) control->sta->drv_priv;
 		wcid = &msta->wcid;
-	} else if (vif) {
+	}
+
+	if (vif || (!info->control.hw_key && wcid->hw_key_idx != -1)) {
 		struct mt76x2_vif *mvif;
 
 		mvif = (struct mt76x2_vif *) vif->drv_priv;
@@ -166,7 +168,7 @@ int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi,
 	*tx_info = FIELD_PREP(MT_TXD_INFO_QSEL, qsel) |
 		   MT_TXD_INFO_80211;
 
-	if (!wcid || wcid->hw_key_idx == 0xff)
+	if (!wcid || wcid->hw_key_idx == 0xff || wcid->sw_iv)
 		*tx_info |= MT_TXD_INFO_WIV;
 
 	return 0;
-- 
2.14.2

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

* [PATCH 05/14] mt76x2: increase OFDM SIFS time
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (3 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 04/14] mt76x2: fix transmission of encrypted management frames Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 06/14] mt76x2: add channel argument to eeprom tx power functions Felix Fietkau
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Fixes throughput issues in combination with LDPC

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_phy.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
index 126497172284..fe3a4b6a19cc 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
@@ -325,8 +325,7 @@ mt76x2_configure_tx_delay(struct mt76x2_dev *dev, enum nl80211_band band, u8 bw)
 	mt76_wr(dev, MT_TX_SW_CFG0, cfg0);
 	mt76_wr(dev, MT_TX_SW_CFG1, cfg1);
 
-	mt76_rmw_field(dev, MT_XIFS_TIME_CFG, MT_XIFS_TIME_CFG_CCK_SIFS,
-		       13 + (bw ? 1 : 0));
+	mt76_rmw_field(dev, MT_XIFS_TIME_CFG, MT_XIFS_TIME_CFG_OFDM_SIFS, 15);
 }
 
 static void
@@ -559,7 +558,6 @@ int mt76x2_phy_set_channel(struct mt76x2_dev *dev,
 	u8 bw, bw_index;
 	int freq, freq1;
 	int ret;
-	u8 sifs = 13;
 
 	dev->cal.channel_cal_done = false;
 	freq = chandef->chan->center_freq;
@@ -611,11 +609,6 @@ int mt76x2_phy_set_channel(struct mt76x2_dev *dev,
 		  MT_EXT_CCA_CFG_CCA_MASK),
 		 ext_cca_chan[ch_group_index]);
 
-	if (chandef->width >= NL80211_CHAN_WIDTH_40)
-		sifs++;
-
-	mt76_rmw_field(dev, MT_XIFS_TIME_CFG, MT_XIFS_TIME_CFG_OFDM_SIFS, sifs);
-
 	ret = mt76x2_mcu_set_channel(dev, channel, bw, bw_index, scan);
 	if (ret)
 		return ret;
-- 
2.14.2

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

* [PATCH 06/14] mt76x2: add channel argument to eeprom tx power functions
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (4 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 05/14] mt76x2: increase OFDM SIFS time Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 07/14] mt76x2: initialize channel power limits at probe time Felix Fietkau
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Preparation for exposing maximum power to mac80211

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c | 30 +++++++++++++---------
 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h |  6 +++--
 drivers/net/wireless/mediatek/mt76/mt76x2_phy.c    |  7 ++---
 3 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c
index 29dc52ef629d..8fef400cb58e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c
@@ -425,12 +425,13 @@ mt76x2_rate_power_val(u8 val)
 	return mt76x2_sign_extend_optional(val, 7);
 }
 
-void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t)
+void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t,
+			   struct ieee80211_channel *chan)
 {
 	bool is_5ghz;
 	u16 val;
 
-	is_5ghz = dev->mt76.chandef.chan->band == NL80211_BAND_5GHZ;
+	is_5ghz = chan->band == NL80211_BAND_5GHZ;
 
 	memset(t, 0, sizeof(*t));
 
@@ -484,9 +485,9 @@ void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t)
 
 static void
 mt76x2_get_power_info_2g(struct mt76x2_dev *dev, struct mt76x2_tx_power_info *t,
-		       int chain, int offset)
+		         struct ieee80211_channel *chan, int chain, int offset)
 {
-	int channel = dev->mt76.chandef.chan->hw_value;
+	int channel = chan->hw_value;
 	int delta_idx;
 	u8 data[6];
 	u16 val;
@@ -511,9 +512,9 @@ mt76x2_get_power_info_2g(struct mt76x2_dev *dev, struct mt76x2_tx_power_info *t,
 
 static void
 mt76x2_get_power_info_5g(struct mt76x2_dev *dev, struct mt76x2_tx_power_info *t,
-		       int chain, int offset)
+		         struct ieee80211_channel *chan, int chain, int offset)
 {
-	int channel = dev->mt76.chandef.chan->hw_value;
+	int channel = chan->hw_value;
 	enum mt76x2_cal_channel_group group;
 	int delta_idx;
 	u16 val;
@@ -559,7 +560,8 @@ mt76x2_get_power_info_5g(struct mt76x2_dev *dev, struct mt76x2_tx_power_info *t,
 }
 
 void mt76x2_get_power_info(struct mt76x2_dev *dev,
-			   struct mt76x2_tx_power_info *t)
+			   struct mt76x2_tx_power_info *t,
+			   struct ieee80211_channel *chan)
 {
 	u16 bw40, bw80;
 
@@ -568,13 +570,17 @@ void mt76x2_get_power_info(struct mt76x2_dev *dev,
 	bw40 = mt76x2_eeprom_get(dev, MT_EE_TX_POWER_DELTA_BW40);
 	bw80 = mt76x2_eeprom_get(dev, MT_EE_TX_POWER_DELTA_BW80);
 
-	if (dev->mt76.chandef.chan->band == NL80211_BAND_5GHZ) {
+	if (chan->band == NL80211_BAND_5GHZ) {
 		bw40 >>= 8;
-		mt76x2_get_power_info_5g(dev, t, 0, MT_EE_TX_POWER_0_START_5G);
-		mt76x2_get_power_info_5g(dev, t, 1, MT_EE_TX_POWER_1_START_5G);
+		mt76x2_get_power_info_5g(dev, t, chan, 0,
+					 MT_EE_TX_POWER_0_START_5G);
+		mt76x2_get_power_info_5g(dev, t, chan, 1,
+					 MT_EE_TX_POWER_1_START_5G);
 	} else {
-		mt76x2_get_power_info_2g(dev, t, 0, MT_EE_TX_POWER_0_START_2G);
-		mt76x2_get_power_info_2g(dev, t, 1, MT_EE_TX_POWER_1_START_2G);
+		mt76x2_get_power_info_2g(dev, t, chan, 0,
+					 MT_EE_TX_POWER_0_START_2G);
+		mt76x2_get_power_info_2g(dev, t, chan, 1,
+					 MT_EE_TX_POWER_1_START_2G);
 	}
 
 	if (mt76x2_tssi_enabled(dev) || !field_valid(t->target_power))
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h
index 063d6c8451c9..6db2c6e47569 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h
@@ -146,9 +146,11 @@ mt76x2_eeprom_get(struct mt76x2_dev *dev, enum mt76x2_eeprom_field field)
 	return get_unaligned_le16(dev->mt76.eeprom.data + field);
 }
 
-void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t);
+void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t,
+			   struct ieee80211_channel *chan);
 void mt76x2_get_power_info(struct mt76x2_dev *dev,
-			   struct mt76x2_tx_power_info *t);
+			   struct mt76x2_tx_power_info *t,
+			   struct ieee80211_channel *chan);
 int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t);
 bool mt76x2_ext_pa_enabled(struct mt76x2_dev *dev, enum nl80211_band band);
 void mt76x2_read_rx_gain(struct mt76x2_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
index fe3a4b6a19cc..81cea7e8414e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
@@ -117,11 +117,12 @@ mt76x2_get_max_power(struct mt76_rate_power *r)
 void mt76x2_phy_set_txpower(struct mt76x2_dev *dev)
 {
 	enum nl80211_chan_width width = dev->mt76.chandef.width;
+	struct ieee80211_channel *chan = dev->mt76.chandef.chan;
 	struct mt76x2_tx_power_info txp;
 	int txp_0, txp_1, delta = 0;
 	struct mt76_rate_power t = {};
 
-	mt76x2_get_power_info(dev, &txp);
+	mt76x2_get_power_info(dev, &txp, chan);
 
 	if (width == NL80211_CHAN_WIDTH_40)
 		delta = txp.delta_bw40;
@@ -131,7 +132,7 @@ void mt76x2_phy_set_txpower(struct mt76x2_dev *dev)
 	if (txp.target_power > dev->txpower_conf)
 		delta -= txp.target_power - dev->txpower_conf;
 
-	mt76x2_get_rate_power(dev, &t);
+	mt76x2_get_rate_power(dev, &t, chan);
 	mt76x2_add_rate_power_offset(&t, txp.chain[0].target_power +
 				   txp.chain[0].delta);
 	mt76x2_limit_rate_power(&t, dev->txpower_conf);
@@ -675,7 +676,7 @@ mt76x2_phy_tssi_compensate(struct mt76x2_dev *dev)
 			return;
 
 		dev->cal.tssi_comp_pending = false;
-		mt76x2_get_power_info(dev, &txp);
+		mt76x2_get_power_info(dev, &txp, chan);
 
 		if (mt76x2_ext_pa_enabled(dev, chan->band))
 			t.pa_mode = 1;
-- 
2.14.2

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

* [PATCH 07/14] mt76x2: initialize channel power limits at probe time
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (5 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 06/14] mt76x2: add channel argument to eeprom tx power functions Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 08/14] mt76x2: convert between per-chain tx power and combined output Felix Fietkau
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

This allows user space to query the real hardware limits directly

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c | 11 ++++++++
 drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h |  1 +
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c   | 30 ++++++++++++++++++++++
 drivers/net/wireless/mediatek/mt76/mt76x2_phy.c    | 14 +---------
 4 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c
index 8fef400cb58e..9c9bf3e785ba 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c
@@ -483,6 +483,17 @@ void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t,
 	t->vht[8] = t->vht[9] = mt76x2_rate_power_val(val >> 8);
 }
 
+int mt76x2_get_max_rate_power(struct mt76_rate_power *r)
+{
+	int i;
+	s8 ret = 0;
+
+	for (i = 0; i < sizeof(r->all); i++)
+		ret = max(ret, r->all[i]);
+
+	return ret;
+}
+
 static void
 mt76x2_get_power_info_2g(struct mt76x2_dev *dev, struct mt76x2_tx_power_info *t,
 		         struct ieee80211_channel *chan, int chain, int offset)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h
index 6db2c6e47569..d79122728dca 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h
@@ -148,6 +148,7 @@ mt76x2_eeprom_get(struct mt76x2_dev *dev, enum mt76x2_eeprom_field field)
 
 void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t,
 			   struct ieee80211_channel *chan);
+int mt76x2_get_max_rate_power(struct mt76_rate_power *r);
 void mt76x2_get_power_info(struct mt76x2_dev *dev,
 			   struct mt76x2_tx_power_info *t,
 			   struct ieee80211_channel *chan);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index d3f03a8aee90..0755b451829e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -760,6 +760,34 @@ static void mt76x2_led_set_brightness(struct led_classdev *led_cdev,
 		mt76x2_led_set_config(mt76, 0xff, 0);
 }
 
+static void
+mt76x2_init_txpower(struct mt76x2_dev *dev,
+		    struct ieee80211_supported_band *sband)
+{
+	struct ieee80211_channel *chan;
+	struct mt76x2_tx_power_info txp;
+	struct mt76_rate_power t = {};
+	int target_power;
+	int i;
+
+	for (i = 0; i < sband->n_channels; i++) {
+		chan = &sband->channels[i];
+
+		mt76x2_get_power_info(dev, &txp, chan);
+
+		target_power = max_t(int, (txp.chain[0].target_power +
+					   txp.chain[0].delta),
+					  (txp.chain[1].target_power +
+					   txp.chain[1].delta));
+
+		mt76x2_get_rate_power(dev, &t, chan);
+
+		chan->max_power = mt76x2_get_max_rate_power(&t) +
+				  target_power;
+		chan->max_power /= 2;
+	}
+}
+
 int mt76x2_register_device(struct mt76x2_dev *dev)
 {
 	struct ieee80211_hw *hw = mt76_hw(dev);
@@ -828,6 +856,8 @@ int mt76x2_register_device(struct mt76x2_dev *dev)
 		goto fail;
 
 	mt76x2_init_debugfs(dev);
+	mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband);
+	mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband);
 
 	return 0;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
index 81cea7e8414e..5b742749d5de 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c
@@ -102,18 +102,6 @@ mt76x2_limit_rate_power(struct mt76_rate_power *r, int limit)
 			r->all[i] = limit;
 }
 
-static int
-mt76x2_get_max_power(struct mt76_rate_power *r)
-{
-	int i;
-	s8 ret = 0;
-
-	for (i = 0; i < sizeof(r->all); i++)
-		ret = max(ret, r->all[i]);
-
-	return ret;
-}
-
 void mt76x2_phy_set_txpower(struct mt76x2_dev *dev)
 {
 	enum nl80211_chan_width width = dev->mt76.chandef.width;
@@ -136,7 +124,7 @@ void mt76x2_phy_set_txpower(struct mt76x2_dev *dev)
 	mt76x2_add_rate_power_offset(&t, txp.chain[0].target_power +
 				   txp.chain[0].delta);
 	mt76x2_limit_rate_power(&t, dev->txpower_conf);
-	dev->txpower_cur = mt76x2_get_max_power(&t);
+	dev->txpower_cur = mt76x2_get_max_rate_power(&t);
 	mt76x2_add_rate_power_offset(&t, -(txp.chain[0].target_power +
 					 txp.chain[0].delta + delta));
 	dev->target_power = txp.chain[0].target_power;
-- 
2.14.2

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

* [PATCH 08/14] mt76x2: convert between per-chain tx power and combined output
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (6 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 07/14] mt76x2: initialize channel power limits at probe time Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 09/14] mt76x2: remove MAC address limitation for multi-vif setups Felix Fietkau
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Using both chains adds max. 3 dBm. A similar worst-case calculation is
being used in ath9k as well to ensure that the hardware stays within
regulatory limits

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 3 +++
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index 0755b451829e..3e3a01b6f2ce 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -785,6 +785,9 @@ mt76x2_init_txpower(struct mt76x2_dev *dev,
 		chan->max_power = mt76x2_get_max_rate_power(&t) +
 				  target_power;
 		chan->max_power /= 2;
+
+		/* convert to combined output power on 2x2 devices */
+		chan->max_power += 3;
 	}
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
index 02dd2cafa52f..8098a2b82c5b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
@@ -155,6 +155,9 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
 		dev->txpower_conf = hw->conf.power_level * 2;
 
+		/* convert to per-chain power for 2x2 devices */
+		dev->txpower_conf -= 6;
+
 		if (test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) {
 			mt76x2_phy_set_txpower(dev);
 			mt76x2_tx_set_txpwr_auto(dev, dev->txpower_conf);
@@ -443,6 +446,10 @@ mt76x2_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int *dbm)
 	struct mt76x2_dev *dev = hw->priv;
 
 	*dbm = dev->txpower_cur / 2;
+
+	/* convert from per-chain power to combined output on 2x2 devices */
+	*dbm += 3;
+
 	return 0;
 }
 
-- 
2.14.2

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

* [PATCH 09/14] mt76x2: remove MAC address limitation for multi-vif setups
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (7 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 08/14] mt76x2: convert between per-chain tx power and combined output Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-17 10:43   ` Felix Fietkau
  2017-12-18 13:43   ` [09/14] " Kalle Valo
  2017-12-14 15:39 ` [PATCH 10/14] mt76x2: clean up MAC/BSSID address initialization Felix Fietkau
                   ` (4 subsequent siblings)
  13 siblings, 2 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

The hardware has a separate set of registers to configure a
per-interface MAC address.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2.h      |  1 +
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c |  2 ++
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c  | 27 +++++++++++++++++----
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.h  |  1 +
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 30 ++++++++++--------------
 drivers/net/wireless/mediatek/mt76/mt76x2_regs.h |  8 +++++++
 6 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2.h
index a12dfce8c0d1..a993cc09cd1b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2.h
@@ -90,6 +90,7 @@ struct mt76x2_dev {
 
 	const u16 *beacon_offsets;
 	unsigned long wcid_mask[128 / BITS_PER_LONG];
+	unsigned long vif_mask;
 
 	int txpower_conf;
 	int txpower_cur;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index 3e3a01b6f2ce..ac4eeaf2c993 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -279,6 +279,8 @@ int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard)
 		FIELD_PREP(MT_MAC_BSSID_DW1_MBSS_MODE, 3) | /* 8 beacons */
 		MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT);
 
+	mt76_set(dev, MT_MAC_ADDR_EXT_CTL, MT_MAC_ADDR_EXT_CTL_EN);
+
 	/* Fire a pre-TBTT interrupt 8 ms before TBTT */
 	mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_PRE_TBTT,
 		       8 << 4);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
index a7416a01baa4..60cee4abed7c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
@@ -22,10 +22,29 @@
 
 void mt76x2_mac_set_bssid(struct mt76x2_dev *dev, u8 idx, const u8 *addr)
 {
-	idx &= 7;
-	mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), get_unaligned_le32(addr));
-	mt76_rmw_field(dev, MT_MAC_APC_BSSID_H(idx), MT_MAC_APC_BSSID_H_ADDR,
-		       get_unaligned_le16(addr + 4));
+	u32 lo = 0, hi = 0;
+
+	if (addr) {
+		lo = get_unaligned_le32(addr);
+		hi = get_unaligned_le16(addr + 4);
+		hi |= MT_MAC_APC_BSSID0_H_EN;
+	}
+
+	mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), lo);
+	mt76_wr(dev, MT_MAC_APC_BSSID_H(idx), hi);
+}
+
+void mt76x2_mac_set_ext_mac(struct mt76x2_dev *dev, u8 idx, const u8 *addr)
+{
+	u32 lo = 0, hi = 0;
+
+	if (addr) {
+		lo = get_unaligned_le32(addr);
+		hi = get_unaligned_le16(addr + 4);
+	}
+
+	mt76_wr(dev, MT_MAC_ADDR_EXT_L(idx), lo);
+	mt76_wr(dev, MT_MAC_ADDR_EXT_H(idx), hi);
 }
 
 static int
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h
index 8a8a25e32d5f..a993c383d9e7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h
@@ -162,6 +162,7 @@ int mt76x2_mac_start(struct mt76x2_dev *dev);
 void mt76x2_mac_stop(struct mt76x2_dev *dev, bool force);
 void mt76x2_mac_resume(struct mt76x2_dev *dev);
 void mt76x2_mac_set_bssid(struct mt76x2_dev *dev, u8 idx, const u8 *addr);
+void mt76x2_mac_set_ext_mac(struct mt76x2_dev *dev, u8 idx, const u8 *addr);
 
 int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb,
 			  void *rxi);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
index 8098a2b82c5b..240e11508ecd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
@@ -82,26 +82,15 @@ mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	struct mt76x2_dev *dev = hw->priv;
 	struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
-	unsigned int idx = 0;
+	unsigned int idx;
 
-	if (vif->addr[0] & BIT(1))
-		idx = 1 + (((dev->mt76.macaddr[0] ^ vif->addr[0]) >> 2) & 7);
+	idx = ffs(~dev->vif_mask);
+	if (!idx || idx > 8)
+		return -ENOSPC;
 
-	/*
-	 * Client mode typically only has one configurable BSSID register,
-	 * which is used for bssidx=0. This is linked to the MAC address.
-	 * Since mac80211 allows changing interface types, and we cannot
-	 * force the use of the primary MAC address for a station mode
-	 * interface, we need some other way of configuring a per-interface
-	 * remote BSSID.
-	 * The hardware provides an AP-Client feature, where bssidx 0-7 are
-	 * used for AP mode and bssidx 8-15 for client mode.
-	 * We shift the station interface bss index by 8 to force the
-	 * hardware to recognize the BSSID.
-	 * The resulting bssidx mismatch for unicast frames is ignored by hw.
-	 */
-	if (vif->type == NL80211_IFTYPE_STATION)
-		idx += 8;
+	idx--;
+	dev->vif_mask |= BIT(idx);
+	mt76x2_mac_set_ext_mac(dev, idx, vif->addr);
 
 	mvif->idx = idx;
 	mvif->group_wcid.idx = 254 - idx;
@@ -114,8 +103,13 @@ mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 static void
 mt76x2_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
+	struct mt76x2_vif *mvif = (struct mt76x2_vif *)vif->drv_priv;
 	struct mt76x2_dev *dev = hw->priv;
+	int idx = mvif->idx;
 
+	mt76x2_mac_set_bssid(dev, mvif->idx, NULL);
+	mt76x2_mac_set_ext_mac(dev, idx, NULL);
+	dev->vif_mask &= ~BIT(idx);
 	mt76_txq_remove(&dev->mt76, vif->txq);
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_regs.h b/drivers/net/wireless/mediatek/mt76/mt76x2_regs.h
index ce3ab85c8b0f..95c1e9559f1c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_regs.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_regs.h
@@ -438,6 +438,14 @@
 
 #define MT_TX_SW_CFG3			0x1478
 
+#define MT_MAC_ADDR_EXT_CTL		0x147c
+#define MT_MAC_ADDR_EXT_CTL_EN		BIT(0)
+
+#define MT_MAC_ADDR_EXT_BASE		0x1480
+#define MT_MAC_ADDR_EXT_L(_n)		(MT_MAC_ADDR_EXT_BASE + ((_n) * 8))
+#define MT_MAC_ADDR_EXT_H(_n)		(MT_MAC_ADDR_EXT_BASE + ((_n) * 8 + 4))
+#define MT_MAC_ADDR_EXT_H_MASK		GENMASK(15, 0)
+
 #define MT_PN_PAD_MODE			0x150c
 
 #define MT_TXOP_HLDR_ET			0x1608
-- 
2.14.2

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

* [PATCH 10/14] mt76x2: clean up MAC/BSSID address initialization
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (8 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 09/14] mt76x2: remove MAC address limitation for multi-vif setups Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 11/14] mt76x2: drop wiphy->addresses Felix Fietkau
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Drop the use of the EEPROM address entirely, rely on interface address
only

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 11 ++++-------
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c  | 14 ++++++++++++++
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index ac4eeaf2c993..f54dc67a13d0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -231,7 +231,6 @@ mt76x2_init_beacon_offsets(struct mt76x2_dev *dev)
 int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard)
 {
 	static const u8 null_addr[ETH_ALEN] = {};
-	const u8 *macaddr = dev->mt76.macaddr;
 	u32 val;
 	int i, k;
 
@@ -271,13 +270,11 @@ int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard)
 	mt76_wr(dev, MT_MCU_CLOCK_CTL, 0x1401);
 	mt76_clear(dev, MT_FCE_L2_STUFF, MT_FCE_L2_STUFF_WR_MPDU_LEN_EN);
 
-	mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(macaddr));
-	mt76_wr(dev, MT_MAC_ADDR_DW1, get_unaligned_le16(macaddr + 4));
+	mt76_wr(dev, MT_MAC_ADDR_DW0, 0);
+	mt76_wr(dev, MT_MAC_ADDR_DW1, 0);
 
-	mt76_wr(dev, MT_MAC_BSSID_DW0, get_unaligned_le32(macaddr));
-	mt76_wr(dev, MT_MAC_BSSID_DW1, get_unaligned_le16(macaddr + 4) |
-		FIELD_PREP(MT_MAC_BSSID_DW1_MBSS_MODE, 3) | /* 8 beacons */
-		MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT);
+	mt76_wr(dev, MT_MAC_BSSID_DW0, 0);
+	mt76_wr(dev, MT_MAC_BSSID_DW1, 0);
 
 	mt76_set(dev, MT_MAC_ADDR_EXT_CTL, MT_MAC_ADDR_EXT_CTL_EN);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
index 60cee4abed7c..d2ae093b7092 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
@@ -27,6 +27,15 @@ void mt76x2_mac_set_bssid(struct mt76x2_dev *dev, u8 idx, const u8 *addr)
 	if (addr) {
 		lo = get_unaligned_le32(addr);
 		hi = get_unaligned_le16(addr + 4);
+
+		if (!idx) {
+			mt76_wr(dev, MT_MAC_BSSID_DW0, lo);
+
+			mt76_rmw_field(dev, MT_MAC_BSSID_DW1,
+				       MT_MAC_BSSID_DW1_ADDR,
+				       hi);
+		}
+
 		hi |= MT_MAC_APC_BSSID0_H_EN;
 	}
 
@@ -41,6 +50,11 @@ void mt76x2_mac_set_ext_mac(struct mt76x2_dev *dev, u8 idx, const u8 *addr)
 	if (addr) {
 		lo = get_unaligned_le32(addr);
 		hi = get_unaligned_le16(addr + 4);
+
+		if (!idx) {
+			mt76_wr(dev, MT_MAC_ADDR_DW0, lo);
+			mt76_wr(dev, MT_MAC_ADDR_DW1, hi);
+		}
 	}
 
 	mt76_wr(dev, MT_MAC_ADDR_EXT_L(idx), lo);
-- 
2.14.2

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

* [PATCH 11/14] mt76x2: drop wiphy->addresses
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (9 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 10/14] mt76x2: clean up MAC/BSSID address initialization Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 12/14] mt76x2: init: disable APCLI by default Felix Fietkau
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Now that the MAC address limitation is resolved, we no longer need a MAC
address list

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2.h      |  2 --
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 16 +---------------
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2.h
index a993cc09cd1b..7f961cc4504a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2.h
@@ -84,8 +84,6 @@ struct mt76x2_calibration {
 struct mt76x2_dev {
 	struct mt76_dev mt76; /* must be first */
 
-	struct mac_address macaddr_list[8];
-
 	struct mutex mutex;
 
 	const u16 *beacon_offsets;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index f54dc67a13d0..818164d1ed7a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -796,7 +796,7 @@ int mt76x2_register_device(struct mt76x2_dev *dev)
 	struct wiphy *wiphy = hw->wiphy;
 	void *status_fifo;
 	int fifo_size;
-	int i, ret;
+	int ret;
 
 	fifo_size = roundup_pow_of_two(32 * sizeof(struct mt76x2_tx_status));
 	status_fifo = devm_kzalloc(dev->mt76.dev, fifo_size, GFP_KERNEL);
@@ -818,20 +818,6 @@ int mt76x2_register_device(struct mt76x2_dev *dev)
 	hw->sta_data_size = sizeof(struct mt76x2_sta);
 	hw->vif_data_size = sizeof(struct mt76x2_vif);
 
-	for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) {
-		u8 *addr = dev->macaddr_list[i].addr;
-
-		memcpy(addr, dev->mt76.macaddr, ETH_ALEN);
-
-		if (!i)
-			continue;
-
-		addr[0] |= BIT(1);
-		addr[0] ^= ((i - 1) << 2);
-	}
-	wiphy->addresses = dev->macaddr_list;
-	wiphy->n_addresses = ARRAY_SIZE(dev->macaddr_list);
-
 	wiphy->iface_combinations = if_comb;
 	wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
 
-- 
2.14.2

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

* [PATCH 12/14] mt76x2: init: disable APCLI by default
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (10 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 11/14] mt76x2: drop wiphy->addresses Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 13/14] mt76x2: configure rx filter based on monitor mode setting Felix Fietkau
  2017-12-14 15:39 ` [PATCH 14/14] mt76x2: init: fix rx filter default value during init Felix Fietkau
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

It is no longer necessary for client mode operation, vif index entries
8-16 are no longer used

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index 818164d1ed7a..ad17f9462358 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -307,8 +307,6 @@ int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard)
 	for (i = 0; i < 16; i++)
 		mt76_rr(dev, MT_TX_STAT_FIFO);
 
-	mt76_set(dev, MT_MAC_APC_BSSID_H(0), MT_MAC_APC_BSSID0_H_EN);
-
 	mt76_wr(dev, MT_CH_TIME_CFG,
 		MT_CH_TIME_CFG_TIMER_EN |
 		MT_CH_TIME_CFG_TX_AS_BUSY |
-- 
2.14.2

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

* [PATCH 13/14] mt76x2: configure rx filter based on monitor mode setting
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (11 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 12/14] mt76x2: init: disable APCLI by default Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  2017-12-14 15:39 ` [PATCH 14/14] mt76x2: init: fix rx filter default value during init Felix Fietkau
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

Due to an unrelated issue, the MT_RX_FILTR_CFG_PROMISC flag is currently
unset, which means that monitor mode is unconditionally enabled.
Toggle this flag based on the mac80211 monitor mode setting instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
index 240e11508ecd..a69d441d9a47 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c
@@ -146,6 +146,15 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
 
 	mutex_lock(&dev->mutex);
 
+	if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
+		if (!(hw->conf.flags & IEEE80211_CONF_MONITOR))
+			dev->rxfilter |= MT_RX_FILTR_CFG_PROMISC;
+		else
+			dev->rxfilter &= ~MT_RX_FILTR_CFG_PROMISC;
+
+		mt76_wr(dev, MT_RX_FILTR_CFG, dev->rxfilter);
+	}
+
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
 		dev->txpower_conf = hw->conf.power_level * 2;
 
-- 
2.14.2

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

* [PATCH 14/14] mt76x2: init: fix rx filter default value during init
  2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
                   ` (12 preceding siblings ...)
  2017-12-14 15:39 ` [PATCH 13/14] mt76x2: configure rx filter based on monitor mode setting Felix Fietkau
@ 2017-12-14 15:39 ` Felix Fietkau
  13 siblings, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-14 15:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

mt76x2_mac_start writes dev->rxfilter to the hardware. It also happens
during init, before dev->rxfilter is filled with the initval register
value, leading to issues like promisc mode being enabled
unconditionally.

Fix this by reading the default value into dev->rxfilter earlier

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index ad17f9462358..62d702164dfe 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -583,6 +583,8 @@ int mt76x2_init_hardware(struct mt76x2_dev *dev)
 	if (ret)
 		return ret;
 
+	dev->rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG);
+
 	ret = mt76x2_dma_init(dev);
 	if (ret)
 		return ret;
@@ -597,7 +599,6 @@ int mt76x2_init_hardware(struct mt76x2_dev *dev)
 		return ret;
 
 	mt76x2_mac_stop(dev, false);
-	dev->rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG);
 
 	return 0;
 }
-- 
2.14.2

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

* Re: [PATCH 09/14] mt76x2: remove MAC address limitation for multi-vif setups
  2017-12-14 15:39 ` [PATCH 09/14] mt76x2: remove MAC address limitation for multi-vif setups Felix Fietkau
@ 2017-12-17 10:43   ` Felix Fietkau
  2017-12-18 13:43   ` [09/14] " Kalle Valo
  1 sibling, 0 replies; 19+ messages in thread
From: Felix Fietkau @ 2017-12-17 10:43 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo

On 2017-12-14 16:39, Felix Fietkau wrote:
> The hardware has a separate set of registers to configure a
> per-interface MAC address.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Please drop patches 09-11, I'm currently investigating a performance
regression. The rest should be fine.

- Felix

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

* Re: [09/14] mt76x2: remove MAC address limitation for multi-vif setups
  2017-12-14 15:39 ` [PATCH 09/14] mt76x2: remove MAC address limitation for multi-vif setups Felix Fietkau
  2017-12-17 10:43   ` Felix Fietkau
@ 2017-12-18 13:43   ` Kalle Valo
  1 sibling, 0 replies; 19+ messages in thread
From: Kalle Valo @ 2017-12-18 13:43 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless

Felix Fietkau <nbd@nbd.name> wrote:

> The hardware has a separate set of registers to configure a
> per-interface MAC address.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Dropped per Felix request

3 patches set to Changes Requested.

10112557 [09/14] mt76x2: remove MAC address limitation for multi-vif setups
10112559 [10/14] mt76x2: clean up MAC/BSSID address initialization
10112571 [11/14] mt76x2: drop wiphy->addresses

-- 
https://patchwork.kernel.org/patch/10112557/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [01/14] mt76: fix debugfs_simple_attr.cocci warnings
  2017-12-14 15:39 ` [PATCH 01/14] mt76: fix debugfs_simple_attr.cocci warnings Felix Fietkau
@ 2018-01-08 17:26   ` Kalle Valo
  0 siblings, 0 replies; 19+ messages in thread
From: Kalle Valo @ 2018-01-08 17:26 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless

Felix Fietkau <nbd@nbd.name> wrote:

> From: Fengguang Wu <fengguang.wu@intel.com>
> 
> drivers/net/wireless/mediatek/mt76/debugfs.c:36:0-23: WARNING: fops_regval should be defined with DEFINE_DEBUGFS_ATTRIBUTE
> 
>  Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
>  for debugfs files.
> 
> Semantic patch information:
>  Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
>  imposes some significant overhead as compared to
>  DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
> 
> Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
> 
> Fixes: a5f6039c8f9c ("mt76: add driver code for MT76x2e")
> CC: Felix Fietkau <nbd@nbd.name>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

10 patches applied to wireless-drivers-next.git, thanks.

1a2b3666da58 mt76: fix debugfs_simple_attr.cocci warnings
34152a809d8c mt76: fix returnvar.cocci warnings
c2d4c8723dbf mt76x2: remove some harmless WARN_ONs in tx status and rx path
ed6b43708116 mt76x2: increase OFDM SIFS time
60e2434c5f5a mt76x2: add channel argument to eeprom tx power functions
984ea50324ec mt76x2: initialize channel power limits at probe time
53aa29b274ba mt76x2: convert between per-chain tx power and combined output
eb46e5b7be0d mt76x2: init: disable APCLI by default
e8be626d794b mt76x2: configure rx filter based on monitor mode setting
a86af66f9b0c mt76x2: init: fix rx filter default value during init

-- 
https://patchwork.kernel.org/patch/10112577/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [04/14] mt76x2: fix transmission of encrypted management frames
  2017-12-14 15:39 ` [PATCH 04/14] mt76x2: fix transmission of encrypted management frames Felix Fietkau
@ 2018-01-08 17:27   ` Kalle Valo
  0 siblings, 0 replies; 19+ messages in thread
From: Kalle Valo @ 2018-01-08 17:27 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless

Felix Fietkau <nbd@nbd.name> wrote:

> Hardware encryption seems to break encrypted unicast mgmt tx.
> Unfortunately the hardware TXWI header does not have a bit to indicate
> that a frame is software encrypted, so sw-encrypted frames need to use a
> different WCID. For that to work, the CCMP PN needs to be generated in
> software, which makes things a bit slower, so only do it for keys that
> also need to tx management frames.
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Failed to apply:

fatal: sha1 information is lacking or useless (drivers/net/wireless/mediatek/mt76/mt76x2_mac.c).
error: could not build fake ancestor
Applying: mt76x2: fix transmission of encrypted management frames
Patch failed at 0001 mt76x2: fix transmission of encrypted management frames
The copy of the patch that failed is found in: .git/rebase-apply/patch

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/patch/10112573/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2018-01-08 17:27 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14 15:39 [PATCH 00/14] mt76 fixes Felix Fietkau
2017-12-14 15:39 ` [PATCH 01/14] mt76: fix debugfs_simple_attr.cocci warnings Felix Fietkau
2018-01-08 17:26   ` [01/14] " Kalle Valo
2017-12-14 15:39 ` [PATCH 02/14] mt76: fix returnvar.cocci warnings Felix Fietkau
2017-12-14 15:39 ` [PATCH 03/14] mt76x2: remove some harmless WARN_ONs in tx status and rx path Felix Fietkau
2017-12-14 15:39 ` [PATCH 04/14] mt76x2: fix transmission of encrypted management frames Felix Fietkau
2018-01-08 17:27   ` [04/14] " Kalle Valo
2017-12-14 15:39 ` [PATCH 05/14] mt76x2: increase OFDM SIFS time Felix Fietkau
2017-12-14 15:39 ` [PATCH 06/14] mt76x2: add channel argument to eeprom tx power functions Felix Fietkau
2017-12-14 15:39 ` [PATCH 07/14] mt76x2: initialize channel power limits at probe time Felix Fietkau
2017-12-14 15:39 ` [PATCH 08/14] mt76x2: convert between per-chain tx power and combined output Felix Fietkau
2017-12-14 15:39 ` [PATCH 09/14] mt76x2: remove MAC address limitation for multi-vif setups Felix Fietkau
2017-12-17 10:43   ` Felix Fietkau
2017-12-18 13:43   ` [09/14] " Kalle Valo
2017-12-14 15:39 ` [PATCH 10/14] mt76x2: clean up MAC/BSSID address initialization Felix Fietkau
2017-12-14 15:39 ` [PATCH 11/14] mt76x2: drop wiphy->addresses Felix Fietkau
2017-12-14 15:39 ` [PATCH 12/14] mt76x2: init: disable APCLI by default Felix Fietkau
2017-12-14 15:39 ` [PATCH 13/14] mt76x2: configure rx filter based on monitor mode setting Felix Fietkau
2017-12-14 15:39 ` [PATCH 14/14] mt76x2: init: fix rx filter default value during init 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.