git: fb8b8b6a1d3a - stable/13 - LinuxKPI: 802.11 enahnce linuxkpi_ieee80211_iterate_interfaces()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sun, 20 Feb 2022 18:15:44 UTC
The branch stable/13 has been updated by bz:

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

commit fb8b8b6a1d3a5c198399672ab83cf4cc5c083e4c
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-20 16:25:08 +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.
    
    (cherry picked from commit 61a68e50d436333396ffd2e1d6a4b5d2875f8118)
---
 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 c69df86c3fa2..8e5e948db5fa 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -2930,12 +2930,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);
@@ -2943,6 +2944,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);
@@ -2961,6 +2963,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".