Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/pci Update to Matin's link state changes.



details:   https://anonhg.NetBSD.org/src-all/rev/6b84aef1afd3
branches:  trunk
changeset: 951836:6b84aef1afd3
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Fri Oct 09 17:14:42 2020 +1100

description:
Update to Matin's link state changes.

diffstat:

 sys/dev/pci/if_iwn.c            |   2 +-
 sys/dev/pci/if_iwnreg.h         |   2 +-
 sys/net80211/ieee80211.c        |   1 +
 sys/net80211/ieee80211_netbsd.c |  24 ++++++++++++++++++++++++
 sys/net80211/ieee80211_netbsd.h |   1 +
 sys/net80211/ieee80211_proto.c  |   5 +++++
 6 files changed, 33 insertions(+), 2 deletions(-)

diffs (92 lines):

diff -r c98429d4918d -r 6b84aef1afd3 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Sun Oct 04 20:53:03 2020 +1100
+++ b/sys/dev/pci/if_iwn.c      Fri Oct 09 17:14:42 2020 +1100
@@ -3213,7 +3213,7 @@
        size_t pktlen = m->m_pkthdr.len;
         bool mcast = (m->m_flags & M_MCAST) != 0;
 
-       DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+       DPRINTFN(DBG_FN, ("%s: %s\n",vap->iv_ic->ic_name, __func__));
 
        s = splnet();
 
diff -r c98429d4918d -r 6b84aef1afd3 sys/dev/pci/if_iwnreg.h
--- a/sys/dev/pci/if_iwnreg.h   Sun Oct 04 20:53:03 2020 +1100
+++ b/sys/dev/pci/if_iwnreg.h   Fri Oct 09 17:14:42 2020 +1100
@@ -1447,7 +1447,7 @@
        uint32_t        src_line;
        uint32_t        tsf;
        uint32_t        time[2];
-} __packed;
+};
 
 /* TLV firmware header. */
 struct iwn_fw_tlv_hdr {
diff -r c98429d4918d -r 6b84aef1afd3 sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c  Sun Oct 04 20:53:03 2020 +1100
+++ b/sys/net80211/ieee80211.c  Fri Oct 09 17:14:42 2020 +1100
@@ -831,6 +831,7 @@
 
 #if __NetBSD__
        if_register(ifp);
+       ieee80211_link_state_change(vap);
 #endif
 
        return 1;
diff -r c98429d4918d -r 6b84aef1afd3 sys/net80211/ieee80211_netbsd.c
--- a/sys/net80211/ieee80211_netbsd.c   Sun Oct 04 20:53:03 2020 +1100
+++ b/sys/net80211/ieee80211_netbsd.c   Fri Oct 09 17:14:42 2020 +1100
@@ -1551,3 +1551,27 @@
        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 c98429d4918d -r 6b84aef1afd3 sys/net80211/ieee80211_netbsd.h
--- a/sys/net80211/ieee80211_netbsd.h   Sun Oct 04 20:53:03 2020 +1100
+++ b/sys/net80211/ieee80211_netbsd.h   Fri Oct 09 17:14:42 2020 +1100
@@ -1026,6 +1026,7 @@
 }
 
 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 c98429d4918d -r 6b84aef1afd3 sys/net80211/ieee80211_proto.c
--- a/sys/net80211/ieee80211_proto.c    Sun Oct 04 20:53:03 2020 +1100
+++ b/sys/net80211/ieee80211_proto.c    Fri Oct 09 17:14:42 2020 +1100
@@ -2284,6 +2284,11 @@
                 * 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