The branch stable/13 has been updated by bz:

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

commit 24c2117bafdba3c6998ddd407d643e142c5deda5
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2022-03-22 15:02:45 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2022-03-27 18:08:58 +0000

    LinuxKPI: 802.11: implement ieee80211_beacon_loss()
    
    Implement ieee80211_beacon_loss() similar to
    ieee80211_connection_loss() with different state handling.
    While here leave a comment in connection_loss() about the state
    change argument.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit bb81db90f7e00f56df9ea14132a54ee983e7177f)
---
 sys/compat/linuxkpi/common/include/net/mac80211.h |  3 ++-
 sys/compat/linuxkpi/common/src/linux_80211.c      | 28 ++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h 
b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 11e8b031a97e..14404d4723f8 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -904,6 +904,7 @@ void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq 
*, uint64_t *,
     uint64_t *);
 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);
 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);
+void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);
 
 /* -------------------------------------------------------------------------- 
*/
 
@@ -1403,7 +1404,7 @@ ieee80211_beacon_get_template(struct ieee80211_hw *hw,
 static __inline void
 ieee80211_beacon_loss(struct ieee80211_vif *vif)
 {
-       TODO();
+       linuxkpi_ieee80211_beacon_loss(vif);
 }
 
 static __inline void
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c 
b/sys/compat/linuxkpi/common/src/linux_80211.c
index 2fe8b4ebddd0..ceb9c626c507 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -3708,13 +3708,39 @@ linuxkpi_ieee80211_connection_loss(struct ieee80211_vif 
*vif)
         * Let the statemachine handle all neccessary changes.
         */
        nstate = IEEE80211_S_INIT;
-       arg = 0;
+       arg = 0;        /* Not a valid reason. */
 
        if (debug_80211 & D80211_TRACE)
                ic_printf(vap->iv_ic, "%s: vif %p\n", __func__, vif);
        ieee80211_new_state(vap, nstate, arg);
 }
 
+void
+linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *vif)
+{
+       struct lkpi_vif *lvif;
+       struct ieee80211vap *vap;
+       enum ieee80211_state nstate;
+       int arg;
+
+       lvif = VIF_TO_LVIF(vif);
+       vap = LVIF_TO_VAP(lvif);
+
+       /*
+        * Go to scan; otherwise we need to elaborately check state and
+        * handle accordingly, e.g., if in RUN we could call iv_bmiss.
+        * Let the statemachine handle all neccessary changes.
+        */
+       nstate = IEEE80211_S_SCAN;
+       arg = 0;
+
+       /* We should be in RUN.  Can we assert that? */
+       if (debug_80211 & D80211_TRACE || vap->iv_state != IEEE80211_S_RUN)
+               ic_printf(vap->iv_ic, "%s: vif %p vap %p state %s\n", __func__,
+                   vif, vap, ieee80211_state_name[vap->iv_state]);
+       ieee80211_new_state(vap, nstate, arg);
+}
+
 MODULE_VERSION(linuxkpi_wlan, 1);
 MODULE_DEPEND(linuxkpi_wlan, linuxkpi, 1, 1, 1);
 MODULE_DEPEND(linuxkpi_wlan, wlan, 1, 1, 1);

Reply via email to