Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/net80211 Simplify/fix link state handling.



details:   https://anonhg.NetBSD.org/src-all/rev/f6cf87f6d4fc
branches:  trunk
changeset: 376967:f6cf87f6d4fc
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Sun Dec 20 12:38:00 2020 +0100

description:
Simplify/fix link state handling.

We start off (by default from if_init) with carrier UNKNOWN and
transition to ACTIVE or DOWN if in BSS mode when joining or leaving.
It is unclear if "carrier" makes sense in other modes at all and we
might change this if we discover userland needs for other modes later.

diffstat:

 sys/net80211/ieee80211.c        |   1 -
 sys/net80211/ieee80211_netbsd.c |  24 ------------------------
 sys/net80211/ieee80211_netbsd.h |   1 -
 sys/net80211/ieee80211_proto.c  |   5 -----
 4 files changed, 0 insertions(+), 31 deletions(-)

diffs (68 lines):

diff -r 427a21bc86ca -r f6cf87f6d4fc sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c  Sat Dec 19 19:14:55 2020 +0100
+++ b/sys/net80211/ieee80211.c  Sun Dec 20 12:38:00 2020 +0100
@@ -827,7 +827,6 @@ ieee80211_vap_attach(struct ieee80211vap
 
 #if __NetBSD__
        if_register(ifp);
-       ieee80211_link_state_change(vap);
 #endif
 
        return 1;
diff -r 427a21bc86ca -r f6cf87f6d4fc sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c   Sat Dec 19 19:14:55 2020 +0100
+++ b/sys/net80211/ieee80211_netbsd.c   Sun Dec 20 12:38:00 2020 +0100
@@ -1565,27 +1565,3 @@ ieee80211_if_attach(struct ifnet *ifp, c
        ifp->if_broadcastaddr = etherbroadcastaddr;
        bpf_attach(ifp, DLT_EN10MB, sizeof(struct ether_header));
 }
-
-void
-ieee80211_link_state_change(struct ieee80211vap *vap)
-{
-       struct ifnet *ifp = vap->iv_ifp;
-
-       /*
-        * Link state does not make sense in IBSS or HOSTAP modes.
-        * We know that the link in MONITOR mode is DOWN as we cannot
-        * transmit, only monitor.
-        * That leaves BSS mode, which starts off DOWN and will
-        * transition to UP when it joins a node.
-        */
-       switch (vap->iv_opmode) {
-       case IEEE80211_M_AHDEMO:
-       case IEEE80211_M_HOSTAP:
-       case IEEE80211_M_IBSS:
-               if_link_state_change(ifp, LINK_STATE_UNKNOWN);
-               break;
-       default:
-               if_link_state_change(ifp, LINK_STATE_DOWN);
-               break;
-       }
-}
diff -r 427a21bc86ca -r f6cf87f6d4fc sys/net80211/ieee80211_netbsd.h
--- a/sys/net80211/ieee80211_netbsd.h   Sat Dec 19 19:14:55 2020 +0100
+++ b/sys/net80211/ieee80211_netbsd.h   Sun Dec 20 12:38:00 2020 +0100
@@ -1087,7 +1087,6 @@ static __inline void m_clrprotoflags(str
 }
 
 int ieee80211_activate(struct ieee80211com *, enum devact act);
-void ieee80211_link_state_change(struct ieee80211vap*);
 
 /*-
  * Macro for type conversion: convert mbuf pointer to data pointer of correct
diff -r 427a21bc86ca -r f6cf87f6d4fc sys/net80211/ieee80211_proto.c
--- a/sys/net80211/ieee80211_proto.c    Sat Dec 19 19:14:55 2020 +0100
+++ b/sys/net80211/ieee80211_proto.c    Sun Dec 20 12:38:00 2020 +0100
@@ -2295,11 +2295,6 @@ ieee80211_newstate_cb(void *xvap, int np
                 * XXX TODO: ic/vap queue flush
                 */
        }
-
-#if __NetBSD__
-       ieee80211_link_state_change(vap);
-#endif
-
 done:
        IEEE80211_UNLOCK(ic);
 }



Home | Main Index | Thread Index | Old Index