From abd6189c82aaadabf193285dd101b1cafc7019a1 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 6 Jun 2023 16:57:10 +0800
Subject: [PATCH] wifi: mt76: mt7996: add support for runtime set in-band
 discovery

with this patch, AP can runtime set inband discovery via hostapd_cli

Usage:
Enable FILS: hostapd_cli -i [interface] inband_discovery 2 20
Enable UBPR: hostapd_cli -i [interface] inband_discovery 1 20
Disable inband discovery: hostapd_cli -i [interface] inband_discovery 0 0

Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
---
 mt7996/mcu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mt7996/mcu.c b/mt7996/mcu.c
index 2412a00..8fc0b66 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -2510,8 +2510,7 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
 	if (IS_ERR(rskb))
 		return PTR_ERR(rskb);
 
-	if (changed & BSS_CHANGED_FILS_DISCOVERY &&
-	    vif->bss_conf.fils_discovery.max_interval) {
+	if (changed & BSS_CHANGED_FILS_DISCOVERY) {
 		interval = vif->bss_conf.fils_discovery.max_interval;
 		skb = ieee80211_get_fils_discovery_tmpl(hw, vif);
 	} else if (changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP &&
@@ -2547,7 +2546,7 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
 	discov->tx_type = !!(changed & BSS_CHANGED_FILS_DISCOVERY);
 	discov->tx_interval = interval;
 	discov->prob_rsp_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
-	discov->enable = true;
+	discov->enable = !!(interval);
 	discov->wcid = cpu_to_le16(MT7996_WTBL_RESERVED);
 
 	buf = (u8 *)tlv + sizeof(*discov);
-- 
2.39.0

