git: 61a68e50d436 - main - LinuxKPI: 802.11 enahnce linuxkpi_ieee80211_iterate_interfaces()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 16 Feb 2022 03:59:06 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=61a68e50d436333396ffd2e1d6a4b5d2875f8118

commit 61a68e50d436333396ffd2e1d6a4b5d2875f8118
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-02-16 03:56:54 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-02-16 03:56:54 +0000

    LinuxKPI: 802.11 enahnce linuxkpi_ieee80211_iterate_interfaces()
    
    Add support for IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER in
    linuxkpi_ieee80211_iterate_interfaces() needed by a driver.
    
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 5267cbf385c0..6e5bf19d0aa1 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -2988,12 +2988,13 @@ linuxkpi_ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
 	struct lkpi_hw *lhw;
 	struct lkpi_vif *lvif;
 	struct ieee80211_vif *vif;
-	bool active, atomic;
+	bool active, atomic, nin_drv;
 
 	lhw = HW_TO_LHW(hw);
 
 	if (flags & ~(IEEE80211_IFACE_ITER_NORMAL|
 	    IEEE80211_IFACE_ITER_RESUME_ALL|
+	    IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER|
 	    IEEE80211_IFACE_ITER__ACTIVE|IEEE80211_IFACE_ITER__ATOMIC)) {
 		ic_printf(lhw->ic, "XXX TODO %s flags(%#x) not yet supported.\n",
 		    __func__, flags);
@@ -3001,6 +3002,7 @@ linuxkpi_ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
 
 	active = (flags & IEEE80211_IFACE_ITER__ACTIVE) != 0;
 	atomic = (flags & IEEE80211_IFACE_ITER__ATOMIC) != 0;
+	nin_drv = (flags & IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER) != 0;
 
 	if (atomic)
 		LKPI_80211_LHW_LOCK(lhw);
@@ -3019,6 +3021,13 @@ linuxkpi_ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
 		    (flags & IEEE80211_IFACE_ITER_RESUME_ALL) != 0)
 			continue;
 
+		/*
+		 * If we shall skip interfaces not added to the driver do so
+		 * if we haven't yet.
+		 */
+		if (nin_drv && !lvif->added_to_drv)
+			continue;
+
 		/*
 		 * Run the iterator function if we are either not asking
 		 * asking for active only or if the VAP is "running".