]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mt76: mt7921: fix inappropriate WoW setup with the missing ARP informaiton
authorSean Wang <sean.wang@mediatek.com>
Tue, 6 Apr 2021 03:34:34 +0000 (11:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:52:53 +0000 (10:52 +0200)
[ Upstream commit 9c9d83213424679b087267600d53a35acfa0201f ]

Fix the Wake-on-WoWLAN failure should rely on ARP Information is being
updated in time to the firmware.

Fixes: ffa1bf97425b ("mt76: mt7921: introduce PM support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7921/main.c
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h

index 166c9c0eb5fd9d67a94064bc4715e5c6ea593d5b..cd9fd0e24e3e69c004d6941d5ae606165dc4d400 100644 (file)
@@ -587,6 +587,9 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
        if (changed & BSS_CHANGED_PS)
                mt7921_mcu_uni_bss_ps(dev, vif);
 
+       if (changed & BSS_CHANGED_ARP_FILTER)
+               mt7921_mcu_update_arp_filter(hw, vif, info);
+
        mt7921_mutex_release(dev);
 }
 
index b5cc72e7e81c3681d9bd111f603785090c532aaa..62afbad77596bf1d8fba8ed244b633162cbd45bc 100644 (file)
@@ -1304,3 +1304,47 @@ mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
                mt76_clear(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON);
        }
 }
+
+int mt7921_mcu_update_arp_filter(struct ieee80211_hw *hw,
+                                struct ieee80211_vif *vif,
+                                struct ieee80211_bss_conf *info)
+{
+       struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
+       struct mt7921_dev *dev = mt7921_hw_dev(hw);
+       struct sk_buff *skb;
+       int i, len = min_t(int, info->arp_addr_cnt,
+                          IEEE80211_BSS_ARP_ADDR_LIST_LEN);
+       struct {
+               struct {
+                       u8 bss_idx;
+                       u8 pad[3];
+               } __packed hdr;
+               struct mt76_connac_arpns_tlv arp;
+       } req_hdr = {
+               .hdr = {
+                       .bss_idx = mvif->mt76.idx,
+               },
+               .arp = {
+                       .tag = cpu_to_le16(UNI_OFFLOAD_OFFLOAD_ARP),
+                       .len = cpu_to_le16(sizeof(struct mt76_connac_arpns_tlv)),
+                       .ips_num = len,
+                       .mode = 2,  /* update */
+                       .option = 1,
+               },
+       };
+
+       skb = mt76_mcu_msg_alloc(&dev->mt76, NULL,
+                                sizeof(req_hdr) + len * sizeof(__be32));
+       if (!skb)
+               return -ENOMEM;
+
+       skb_put_data(skb, &req_hdr, sizeof(req_hdr));
+       for (i = 0; i < len; i++) {
+               u8 *addr = (u8 *)skb_put(skb, sizeof(__be32));
+
+               memcpy(addr, &info->arp_addr_list[i], sizeof(__be32));
+       }
+
+       return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_UNI_CMD_OFFLOAD,
+                                    true);
+}
index 2979d06ee0adb5445c3a783429cd26ec4a135355..25a1a6acb6baf158baf462068729c3703934e0d7 100644 (file)
@@ -339,4 +339,7 @@ int mt7921_mac_set_beacon_filter(struct mt7921_phy *phy,
                                 bool enable);
 void mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif);
 void mt7921_coredump_work(struct work_struct *work);
+int mt7921_mcu_update_arp_filter(struct ieee80211_hw *hw,
+                                struct ieee80211_vif *vif,
+                                struct ieee80211_bss_conf *info);
 #endif