Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/phil-wifi]: src/sys Final changes for 200 hour contract. Still a lot of...
details: https://anonhg.NetBSD.org/src/rev/f670cc752904
branches: phil-wifi
changeset: 363920:f670cc752904
user: phil <phil%NetBSD.org@localhost>
date: Wed Aug 15 17:07:02 2018 +0000
description:
Final changes for 200 hour contract. Still a lot of work to do.
With these changes, Station mode works with an open AP.
diffstat:
sys/arch/amd64/conf/TESTWIFI | 8 +-
sys/dev/usb/if_urtwn.c | 101 ++++++++++---------
sys/dev/usb/if_urtwnvar.h | 5 +-
sys/net80211/ieee80211.c | 5 +-
sys/net80211/ieee80211_input.c | 3 +-
sys/net80211/ieee80211_ioctl.c | 195 +++++++++++++++++++++++++++++++++++--
sys/net80211/ieee80211_ioctl.h | 28 +++++-
sys/net80211/ieee80211_netbsd.c | 14 +-
sys/net80211/ieee80211_netbsd.h | 6 +-
sys/net80211/ieee80211_node.c | 18 +-
sys/net80211/ieee80211_output.c | 4 +-
sys/net80211/ieee80211_proto.c | 30 +++--
sys/net80211/ieee80211_scan_sta.c | 5 +-
sys/net80211/ieee80211_sta.c | 4 +-
14 files changed, 315 insertions(+), 111 deletions(-)
diffs (truncated from 1015 to 300 lines):
diff -r 810ae25eadef -r f670cc752904 sys/arch/amd64/conf/TESTWIFI
--- a/sys/arch/amd64/conf/TESTWIFI Fri Aug 03 19:47:25 2018 +0000
+++ b/sys/arch/amd64/conf/TESTWIFI Wed Aug 15 17:07:02 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: TESTWIFI,v 1.1.2.2 2018/08/03 19:47:25 phil Exp $
+# $NetBSD: TESTWIFI,v 1.1.2.3 2018/08/15 17:07:02 phil Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.1.2.2 $"
+#ident "GENERIC-$Revision: 1.1.2.3 $"
maxusers 64 # estimated number of users
@@ -194,7 +194,7 @@
# Networking options
#options GATEWAY # packet forwarding
options INET # IP + ICMP + TCP + UDP
-options INET6 # IPV6
+#options INET6 # IPV6
options IPSEC # IP security
#options IPSEC_DEBUG # debug for IP security
#options MPLS # MultiProtocol Label Switching (needs mpls)
@@ -1306,7 +1306,7 @@
pseudo-device gif # IPv[46] over IPv[46] tunnel (RFC1933)
pseudo-device ipsecif # tunnel interface for routing based ipsec
#pseudo-device faith # IPv[46] tcp relay translation i/f
-pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation
+#pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation
pseudo-device vlan # IEEE 802.1q encapsulation
pseudo-device bridge # simple inter-network bridging
#options BRIDGE_IPF # bridge uses IP/IPv6 pfil hooks too
diff -r 810ae25eadef -r f670cc752904 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Fri Aug 03 19:47:25 2018 +0000
+++ b/sys/dev/usb/if_urtwn.c Wed Aug 15 17:07:02 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urtwn.c,v 1.59.2.5 2018/08/03 19:47:25 phil Exp $ */
+/* $NetBSD: if_urtwn.c,v 1.59.2.6 2018/08/15 17:07:02 phil Exp $ */
/* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */
/*-
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.5 2018/08/03 19:47:25 phil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.6 2018/08/15 17:07:02 phil Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -111,7 +111,7 @@
#define DBG_REG __BIT(6)
#define DBG_ALL 0xffffffffU
/* NNN Reset urtwn_debug to 0 when done debugging. */
-u_int urtwn_debug = DBG_FN;
+u_int urtwn_debug = 0;
#define DPRINTFN(n, s) \
do { if (urtwn_debug & (n)) printf s; } while (/*CONSTCOND*/0)
#else
@@ -342,15 +342,15 @@
static void urtwn_vap_delete(struct ieee80211vap *);
static int urtwn_ioctl(struct ifnet *, u_long, void *);
static void urtwn_parent(struct ieee80211com *);
+static void urtwn_getradiocaps(struct ieee80211com *, int, int *,
+ struct ieee80211_channel []);
static void urtwn_scan_start(struct ieee80211com *);
static void urtwn_scan_end(struct ieee80211com *);
static void urtwn_set_channel(struct ieee80211com *);
static int urtwn_transmit(struct ieee80211com *, struct mbuf *);
-static int urtwn_send_mgmt(struct ieee80211_node *, int, int);
static int urtwn_raw_xmit(struct ieee80211_node *, struct mbuf *,
const struct ieee80211_bpf_params *);
-static void urtwn_getradiocaps(struct ieee80211com *, int, int *,
- struct ieee80211_channel []);
+//static int urtwn_send_mgmt(struct ieee80211_node *, int, int);
/* Aliases. */
#define urtwn_bb_write urtwn_write_4
@@ -393,6 +393,14 @@
/* Name the ic. */
ic->ic_name = "urtwn";
+ /* Driver Send queue, separate from the if send queue*/
+ sc->sc_sendq.ifq_maxlen = 32;
+ /* NNN how should this be initialized? */
+ sc->sc_sendq.ifq_head = sc->sc_sendq.ifq_tail = NULL;
+ sc->sc_sendq.ifq_len = 0;
+ sc->sc_sendq.ifq_drops = 0;
+ IFQ_LOCK_INIT(&sc->sc_sendq);
+
sc->chip = 0;
dev = urtwn_lookup(urtwn_devs, uaa->uaa_vendor, uaa->uaa_product);
if (dev != NULL && ISSET(dev->flags, FLAG_RTL8188E))
@@ -554,7 +562,7 @@
}
/* Debug all! NNN */
- vap->iv_debug = IEEE80211_MSG_ANY;
+ // vap->iv_debug = IEEE80211_MSG_ANY;
bpf_attach2(vap->iv_ifp, DLT_IEEE802_11_RADIO,
sizeof(struct ieee80211_frame) + IEEE80211_RADIOTAP_HDRLEN,
@@ -611,6 +619,10 @@
urtwn_close_pipes(sc);
}
+ /* sendq destroy */
+ IFQ_PURGE(&sc->sc_sendq);
+ IFQ_LOCK_DESTROY(&sc->sc_sendq);
+
splx(s);
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
@@ -2082,7 +2094,7 @@
case IEEE80211_S_ASSOC:
break;
- case IEEE80211_S_RUN:
+ case IEEE80211_S_RUN:
ni = vap->iv_bss;
/* XXX: Set 20MHz mode */
@@ -2794,6 +2806,7 @@
/* Finalize mbuf. */
m_set_rcvif(m, ifp);
wh = (struct ieee80211_frame *)((uint8_t *)&stat[1] + infosz);
+
memcpy(mtod(m, uint8_t *), wh, pktlen);
m->m_pkthdr.len = m->m_len = pktlen;
@@ -2977,7 +2990,7 @@
}
ifp->if_opackets++;
- urtwn_start(ifp);
+ urtwn_start(ifp);
splx(s);
}
@@ -2997,11 +3010,6 @@
DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
- KASSERT(sc != NULL); // NNN
- KASSERT(m != NULL);
- KASSERT(ni != NULL);
- KASSERT(data != NULL);
-
wh = mtod(m, struct ieee80211_frame *);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
txd_len = sizeof(*txd);
@@ -3177,8 +3185,13 @@
xferlen = txd_len + m->m_pkthdr.len + padsize;
m_copydata(m, 0, m->m_pkthdr.len, (char *)&txd[0] + txd_len + padsize);
- printf ("urtwn_tx just before splnet()\n");
- KASSERT(data != NULL);
+ if (data->xfer == NULL) {
+ /* NNN Don't crash ... but what is going on! */
+ printf ("urtwn_tx: data->xfer is NULL\n");
+ m_print(m,"", printf);
+ return -1;
+ }
+
s = splnet();
usbd_setup_xfer(data->xfer, data, data->buf, xferlen,
USBD_FORCE_SHORT_XFER, URTWN_TX_TIMEOUT,
@@ -3192,7 +3205,6 @@
return error;
}
splx(s);
- printf ("urtwn_tx just before splnet()\n");
return 0;
}
@@ -3252,7 +3264,7 @@
break;
/* Encapsulate and send data frames. */
- IFQ_POLL(&ifp->if_snd, m);
+ IFQ_POLL(&sc->sc_sendq, m);
if (m == NULL)
break;
@@ -3275,7 +3287,7 @@
device_xname(sc->sc_dev)));
return;
}
- IFQ_DEQUEUE(&ifp->if_snd, m);
+ IFQ_DEQUEUE(&sc->sc_sendq, m);
if (m->m_len < (int)sizeof(*eh) &&
(m = m_pullup(m, sizeof(*eh))) == NULL) {
@@ -3292,17 +3304,9 @@
continue;
}
- bpf_mtap(ifp, m, BPF_D_OUT);
-
- if ((m = ieee80211_encap(vap, ni, m)) == NULL) {
- ieee80211_free_node(ni);
- printf("ERROR4\n");
- ifp->if_oerrors++;
- continue;
- }
+ //bpf_mtap(ifp, m, BPF_D_OUT);
+
sendit:
- bpf_mtap3(vap->iv_rawbpf, m, BPF_D_OUT);
-
if (urtwn_tx(sc, m, ni, data) != 0) {
m_freem(m);
ieee80211_free_node(ni);
@@ -3317,7 +3321,7 @@
}
}
-static void
+static __unused void
urtwn_watchdog(struct ifnet *ifp)
{
struct ieee80211vap *vap = ifp->if_softc;
@@ -3368,8 +3372,6 @@
return NULL;
}
- printf ("vap_create: after vap_setup\n");
-
/* Local setup */
vap->iv_reset = urtwn_reset;
@@ -3377,9 +3379,9 @@
ifp->if_init = urtwn_init;
ifp->if_ioctl = urtwn_ioctl;
ifp->if_start = urtwn_start;
- ifp->if_watchdog = urtwn_watchdog;
+ // ifp->if_watchdog = urtwn_watchdog; NNN
ifp->if_extflags |= IFEF_MPSAFE;
- IFQ_SET_READY(&ifp->if_snd);
+ // IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
/* Override state transition machine. */
@@ -3530,7 +3532,6 @@
struct urtwn_softc *sc = ic->ic_softc;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
int s;
- int error;
size_t pktlen = m->m_pkthdr.len;
bool mcast = (m->m_flags & M_MCAST) != 0;
@@ -3538,11 +3539,7 @@
s = splnet();
- IFQ_ENQUEUE(&vap->iv_ifp->if_snd, m, error);
- if (error != 0) {
- /* mbuf is already freed */
- goto out;
- }
+ IF_ENQUEUE(&sc->sc_sendq, m);
vap->iv_ifp->if_obytes += pktlen;
if (mcast)
@@ -3550,18 +3547,28 @@
if ((vap->iv_ifp->if_flags & IFF_OACTIVE) == 0)
if_start_lock(vap->iv_ifp);
-out:
splx(s);
- return error;
+ urtwn_start(vap->iv_ifp);
+
+ return 0;
}
-static __unused int urtwn_send_mgmt(struct ieee80211_node *ni, int type, int arg)
-{
- printf ("urtwn_send_mgmt: type %d, arg %d\n", type, arg);
- return ENOENT;
+#if 0
+static int
+urtwn_send_mgmt(struct ieee80211_node *ni, int arg1, int arg2) {
+#ifdef URTWN_DEBUG
+ // struct ieee80211vap *vap = ni->ni_vap;
+ struct ieee80211com *ic = ni->ni_ic;
+ struct urtwn_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;
}
-
Home |
Main Index |
Thread Index |
Old Index