Linux-Wireless Archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mt76: connac: add support for passing the cipher field in bss_info
@ 2021-12-29 11:25 Felix Fietkau
  2021-12-29 11:25 ` [PATCH 2/3] mt76: mt7615: update bss_info with cipher after setting the group key Felix Fietkau
  2021-12-29 11:25 ` [PATCH 3/3] mt76: mt7915: " Felix Fietkau
  0 siblings, 2 replies; 3+ messages in thread
From: Felix Fietkau @ 2021-12-29 11:25 UTC (permalink / raw
  To: linux-wireless

Initialize it from a field in struct mt76_vif

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

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 4accfb5d5530..efe167f94c1c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -622,6 +622,7 @@ struct mt76_vif {
 	u8 band_idx;
 	u8 wmm_idx;
 	u8 scan_seq_num;
+	enum mt76_cipher_type cipher;
 };
 
 struct mt76_phy {
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index 1b2340e4ce0c..cdd82a62eeb1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -2701,6 +2701,7 @@ int mt76_connac_mcu_bss_basic_tlv(struct sk_buff *skb,
 	bss->bmc_wcid_hi = to_wcid_hi(wlan_idx);
 	bss->wmm_idx = mvif->wmm_idx;
 	bss->active = enable;
+	bss->cipher = mvif->cipher;
 
 	if (vif->type != NL80211_IFTYPE_MONITOR) {
 		struct cfg80211_chan_def *chandef = &phy->chandef;
-- 
2.34.1


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

* [PATCH 2/3] mt76: mt7615: update bss_info with cipher after setting the group key
  2021-12-29 11:25 [PATCH 1/3] mt76: connac: add support for passing the cipher field in bss_info Felix Fietkau
@ 2021-12-29 11:25 ` Felix Fietkau
  2021-12-29 11:25 ` [PATCH 3/3] mt76: mt7915: " Felix Fietkau
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2021-12-29 11:25 UTC (permalink / raw
  To: linux-wireless

In some cases, the WA firmware needs to know if encryption is used, in order
to set the protection bit of packets

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

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 82d625a16a62..9f7ac78f1222 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -365,6 +365,7 @@ static int mt7615_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 			  struct ieee80211_key_conf *key)
 {
 	struct mt7615_dev *dev = mt7615_hw_dev(hw);
+	struct mt7615_phy *phy = mt7615_hw_phy(hw);
 	struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
 	struct mt7615_sta *msta = sta ? (struct mt7615_sta *)sta->drv_priv :
 				  &mvif->sta;
@@ -403,6 +404,11 @@ static int mt7615_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 	mt7615_mutex_acquire(dev);
 
+	if (cmd == SET_KEY && !sta && !mvif->mt76.cipher) {
+		mvif->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher);
+		mt7615_mcu_add_bss_info(phy, vif, NULL, true);
+	}
+
 	if (cmd == SET_KEY)
 		*wcid_keyidx = idx;
 	else if (idx == *wcid_keyidx)
-- 
2.34.1


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

* [PATCH 3/3] mt76: mt7915: update bss_info with cipher after setting the group key
  2021-12-29 11:25 [PATCH 1/3] mt76: connac: add support for passing the cipher field in bss_info Felix Fietkau
  2021-12-29 11:25 ` [PATCH 2/3] mt76: mt7615: update bss_info with cipher after setting the group key Felix Fietkau
@ 2021-12-29 11:25 ` Felix Fietkau
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2021-12-29 11:25 UTC (permalink / raw
  To: linux-wireless

In some cases, the WA firmware needs to know if encryption is used, in order
to set the protection bit of packets

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

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index aed0a5303aa8..b45b75f98c4d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -367,6 +367,7 @@ static int mt7915_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 			  struct ieee80211_key_conf *key)
 {
 	struct mt7915_dev *dev = mt7915_hw_dev(hw);
+	struct mt7915_phy *phy = mt7915_hw_phy(hw);
 	struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
 	struct mt7915_sta *msta = sta ? (struct mt7915_sta *)sta->drv_priv :
 				  &mvif->sta;
@@ -406,6 +407,11 @@ static int mt7915_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 	mutex_lock(&dev->mt76.mutex);
 
+	if (cmd == SET_KEY && !sta && !mvif->mt76.cipher) {
+		mvif->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher);
+		mt7915_mcu_add_bss_info(phy, vif, true);
+	}
+
 	if (cmd == SET_KEY)
 		*wcid_keyidx = idx;
 	else if (idx == *wcid_keyidx)
-- 
2.34.1


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

end of thread, other threads:[~2021-12-29 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-29 11:25 [PATCH 1/3] mt76: connac: add support for passing the cipher field in bss_info Felix Fietkau
2021-12-29 11:25 ` [PATCH 2/3] mt76: mt7615: update bss_info with cipher after setting the group key Felix Fietkau
2021-12-29 11:25 ` [PATCH 3/3] mt76: mt7915: " 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 read-only IMAP folder(s) and NNTP newsgroup(s).