From 5aa975b70c38b6a4bdee1f3880c8be78e61cfe09 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 6 Dec 2024 18:43:37 +0100 Subject: [PATCH] mediatek-sdk: fix roaming issue Fixes: WIFI-14321 Signed-off-by: Felix Fietkau --- .../mt76/patches/a02-roaming_fix.patch | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 feeds/mediatek-sdk/mt76/patches/a02-roaming_fix.patch diff --git a/feeds/mediatek-sdk/mt76/patches/a02-roaming_fix.patch b/feeds/mediatek-sdk/mt76/patches/a02-roaming_fix.patch new file mode 100644 index 000000000..284dfbbdd --- /dev/null +++ b/feeds/mediatek-sdk/mt76/patches/a02-roaming_fix.patch @@ -0,0 +1,81 @@ +--- a/mt7915/main.c ++++ b/mt7915/main.c +@@ -412,6 +412,13 @@ static int mt7915_set_key(struct ieee802 + int idx = key->keyidx; + int err = 0; + ++ if (sta && !wcid->sta) { ++ if (cmd != SET_KEY) ++ return 0; ++ ++ return -EOPNOTSUPP; ++ } ++ + /* The hardware does not support per-STA RX GTK, fallback + * to software mode for these. + */ +@@ -803,6 +810,56 @@ mt7915_event_callback(struct ieee80211_h + return; + } + ++struct drop_sta_iter { ++ struct mt7915_dev *dev; ++ struct ieee80211_hw *hw; ++ struct ieee80211_vif *vif; ++ u8 sta_addr[ETH_ALEN]; ++}; ++ ++static void ++__mt7915_drop_sta(void *ptr, u8 *mac, struct ieee80211_vif *vif) ++{ ++ struct drop_sta_iter *data = ptr; ++ struct ieee80211_sta *sta; ++ struct mt7915_sta *msta; ++ ++ if (vif == data->vif || vif->type != NL80211_IFTYPE_AP) ++ return; ++ ++ sta = ieee80211_find_sta_by_ifaddr(data->hw, data->sta_addr, mac); ++ if (!sta) ++ return; ++ ++ msta = (struct mt7915_sta *)sta->drv_priv; ++ mt7915_mcu_add_sta(data->dev, vif, sta, false); ++ msta->wcid.sta = 0; ++} ++ ++static void ++mt7915_drop_other_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta) ++{ ++ struct mt76_phy *ext_phy = dev->mt76.phys[MT_BAND1]; ++ struct drop_sta_iter data = { ++ .dev = dev, ++ .hw = dev->mphy.hw, ++ .vif = vif, ++ }; ++ ++ if (vif->type != NL80211_IFTYPE_AP) ++ return; ++ ++ memcpy(data.sta_addr, sta->addr, ETH_ALEN); ++ ieee80211_iterate_active_interfaces(data.hw, 0, __mt7915_drop_sta, &data); ++ ++ if (!ext_phy) ++ return; ++ ++ data.hw = ext_phy->hw; ++ ieee80211_iterate_active_interfaces(data.hw, 0, __mt7915_drop_sta, &data); ++} ++ + int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) + { +@@ -843,6 +900,7 @@ int mt7915_mac_sta_add(struct mt76_dev * + mt7915_mac_wtbl_update(dev, idx, + MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + ++ mt7915_drop_other_sta(dev, vif, sta); + ret = mt7915_mcu_add_sta(dev, vif, sta, true); + if (ret) + return ret;