From a78673d5235309f176e8cb64ba21658ac0cfb39c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 15 May 2018 13:03:30 +0200 Subject: [PATCH] mt76: fix sending encrypted broadcast packets for secondary interfaces For encryption to work properly, the BSS index needs to be initialized for the WCID entry used for the interface. Signed-off-by: Felix Fietkau --- mt76x2.h | 3 +++ mt76x2_init.c | 3 +++ mt76x2_main.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mt76x2.h b/mt76x2.h index a5d1255e..dc12bbdb 100644 --- a/mt76x2.h +++ b/mt76x2.h @@ -39,6 +39,9 @@ #define MT_CALIBRATE_INTERVAL HZ +#define MT_MAX_VIFS 8 +#define MT_VIF_WCID(_n) (254 - ((_n) & 7)) + #include "mt76.h" #include "mt76x2_regs.h" #include "mt76x2_mac.h" diff --git a/mt76x2_init.c b/mt76x2_init.c index fc48f8ce..4268e2bf 100644 --- a/mt76x2_init.c +++ b/mt76x2_init.c @@ -298,6 +298,9 @@ static int mt76x2_mac_reset(struct mt76x2_dev *dev, bool hard) for (i = 0; i < 256; i++) mt76x2_mac_wcid_setup(dev, i, 0, NULL); + for (i = 0; i < MT_MAX_VIFS; i++) + mt76x2_mac_wcid_setup(dev, MT_VIF_WCID(i), i, NULL); + for (i = 0; i < 16; i++) { for (k = 0; k < 4; k++) mt76x2_mac_shared_key_setup(dev, i, k, NULL); diff --git a/mt76x2_main.c b/mt76x2_main.c index 81c58f86..5c0d1e12 100644 --- a/mt76x2_main.c +++ b/mt76x2_main.c @@ -104,7 +104,7 @@ mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) idx += 8; mvif->idx = idx; - mvif->group_wcid.idx = 254 - idx; + mvif->group_wcid.idx = MT_VIF_WCID(idx); mvif->group_wcid.hw_key_idx = -1; mt76x2_txq_init(dev, vif->txq);