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 iwn_transmit and raw_xmit fuctions from ur...



details:   https://anonhg.NetBSD.org/src-all/rev/df2e910f7613
branches:  trunk
changeset: 1026884:df2e910f7613
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Mon May 18 23:32:42 2020 +1000

description:
iwn_transmit and raw_xmit fuctions from urtwn.

diffstat:

 sys/dev/pci/if_iwn.c |  79 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)

diffs (103 lines):

diff -r 497a9f962dd0 -r df2e910f7613 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Mon May 18 22:46:41 2020 +1000
+++ b/sys/dev/pci/if_iwn.c      Mon May 18 23:32:42 2020 +1000
@@ -254,6 +254,9 @@
 static void    iwn_scan_mindwell(struct ieee80211_scan_state *);
 static void    iwn_next_scan(void *);
 static int     iwn_reset(struct ieee80211vap *, u_long);
+static int     iwn_transmit(struct ieee80211com *, struct mbuf *);
+static int     iwn_raw_xmit(struct ieee80211_node *, struct mbuf *,
+                   const struct ieee80211_bpf_params *);
 
 #ifdef IWN_DEBUG
 static void    iwn4965_print_power_group(struct iwn_softc *, int);
@@ -745,6 +748,8 @@
        ic->ic_scan_curchan = iwn_scan_curchan;
        ic->ic_scan_mindwell = iwn_scan_mindwell;
        ic->ic_newassoc = iwn_newassoc;
+       ic->ic_transmit = iwn_transmit;
+       ic->ic_raw_xmit = iwn_raw_xmit;
 #ifdef IWN_HWCRYPTO
        ic->ic_crypto.cs_key_set = iwn_set_key;
        ic->ic_crypto.cs_key_delete = iwn_delete_key;
@@ -3243,6 +3248,80 @@
 #endif
 
 static int
+iwn_transmit(struct ieee80211com *ic, struct mbuf *m)
+{
+       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+       int s;
+       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__));
+
+       s = splnet();
+
+       IF_ENQUEUE(&ic->ic_mgtq, m);
+        if_statadd(vap->iv_ifp, if_obytes, pktlen);
+        if (mcast)
+                if_statinc(vap->iv_ifp, if_omcasts);
+
+        if ((vap->iv_ifp->if_flags & IFF_OACTIVE) == 0)
+                if_start_lock(vap->iv_ifp);
+        splx(s);
+
+       iwn_start(vap->iv_ifp);
+
+        return 0;
+}
+
+#if 0
+static int
+iwn_send_mgmt(struct ieee80211_node *ni, int arg1, int arg2) {
+#ifdef IWN_DEBUG
+       // struct ieee80211vap *vap = ni->ni_vap;
+       struct ieee80211com *ic = ni->ni_ic;
+       struct iwn_softc *sc = ic->ic_softc;
+#endif
+
+       DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+       /* Don't know what to do right now. */
+       return ENOTTY;
+}
+#endif 
+
+
+static int
+iwn_raw_xmit(struct ieee80211_node *ni , struct mbuf *m,
+    const struct ieee80211_bpf_params *bpfp)
+{
+       struct ieee80211vap *vap = ni->ni_vap;
+       struct ieee80211com *ic = ni->ni_ic;
+       struct iwn_softc *sc = ic->ic_softc;
+       int error;
+
+       DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+       KASSERT(vap != NULL);   /*  NNN need these? */
+       KASSERT(ic != NULL);
+       KASSERT(sc != NULL);
+       KASSERT(m != NULL);
+
+
+        bpf_mtap3(vap->iv_rawbpf, m, BPF_D_OUT);
+
+       error = iwn_tx(sc, m, ni, 0);
+       if (error != 0) {
+                if_statinc(vap->iv_ifp, if_oerrors);
+       } else {
+               sc->sc_tx_timer = 5;
+               vap->iv_ifp->if_timer = 1;
+       }
+       m_freem(m);
+       ieee80211_free_node(ni);
+       return error;
+}
+
+static int
 iwn_tx(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
 {
        struct ieee80211com *ic = &sc->sc_ic;



Home | Main Index | Thread Index | Old Index