Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/phil-wifi]: src/sys State save:
details: https://anonhg.NetBSD.org/src/rev/6006250bad1f
branches: phil-wifi
changeset: 320803:6006250bad1f
user: phil <phil%NetBSD.org@localhost>
date: Fri Jul 20 20:33:05 2018 +0000
description:
State save:
urtwn: ifp->if_softc points to a vap, not the urtwn softc, fix code for this.
add missing routines, need to get them filled out correctly.
80211: Add back some NetBSD ioctls, start working on the sysctl tree.
diffstat:
sys/dev/usb/if_urtwn.c | 134 ++++++++++++++++++++++++++++++-------
sys/net80211/ieee80211.c | 33 ++++-----
sys/net80211/ieee80211_amrr.c | 10 +-
sys/net80211/ieee80211_ioctl.c | 75 +++++++++++++++++++-
sys/net80211/ieee80211_ioctl.h | 4 +-
sys/net80211/ieee80211_netbsd.c | 129 ++++++++++++++++++++++++++++++++++--
sys/net80211/ieee80211_netbsd.h | 9 ++-
sys/net80211/ieee80211_proto.c | 12 ++-
sys/net80211/ieee80211_rssadapt.c | 10 +-
sys/net80211/ieee80211_scan_sw.c | 9 ++-
sys/net80211/ieee80211_var.h | 6 +-
11 files changed, 359 insertions(+), 72 deletions(-)
diffs (truncated from 955 to 300 lines):
diff -r 70077198073f -r 6006250bad1f sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Mon Jul 16 20:11:11 2018 +0000
+++ b/sys/dev/usb/if_urtwn.c Fri Jul 20 20:33:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urtwn.c,v 1.59.2.2 2018/07/16 20:11:11 phil Exp $ */
+/* $NetBSD: if_urtwn.c,v 1.59.2.3 2018/07/20 20:33:05 phil Exp $ */
/* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */
/*-
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.2 2018/07/16 20:11:11 phil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.3 2018/07/20 20:33:05 phil Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -311,6 +311,7 @@
static void urtwn_chip_stop(struct urtwn_softc *);
static void urtwn_newassoc(struct ieee80211_node *, int);
static void urtwn_delay_ms(struct urtwn_softc *, int ms);
+/* Functions for wifi refresh */
static struct ieee80211vap *
urtwn_vap_create(struct ieee80211com *,
const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
@@ -318,6 +319,14 @@
const uint8_t [IEEE80211_ADDR_LEN]);
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_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_raw_xmit(struct ieee80211_node *, struct mbuf *,
+ const struct ieee80211_bpf_params *);
+
/* Aliases. */
#define urtwn_bb_write urtwn_write_4
@@ -357,6 +366,9 @@
sc->sc_dev = self;
sc->sc_udev = uaa->uaa_device;
+ /* Name the ic. */
+ ic->ic_name = "urtwn";
+
sc->chip = 0;
dev = urtwn_lookup(urtwn_devs, uaa->uaa_vendor, uaa->uaa_product);
if (dev != NULL && ISSET(dev->flags, FLAG_RTL8188E))
@@ -491,6 +503,13 @@
ic->ic_wme.wme_update = urtwn_wme_update;
ic->ic_vap_create = urtwn_vap_create;
ic->ic_vap_delete = urtwn_vap_delete;
+ ic->ic_parent = urtwn_parent;
+ ic->ic_scan_start = urtwn_scan_start;
+ ic->ic_scan_end = urtwn_scan_end;
+ ic->ic_set_channel = urtwn_set_channel;
+ ic->ic_transmit = urtwn_transmit;
+ ic->ic_raw_xmit = urtwn_raw_xmit;
+
/* Shouldn't do it, but call vap_create??? */
uint8_t bssid[IEEE80211_ADDR_LEN] = {0};
@@ -507,6 +526,9 @@
goto fail;
}
+ /* Debug all! NNN */
+ vap->iv_debug = IEEE80211_MSG_ANY;
+
bpf_attach2(vap->iv_ifp, DLT_IEEE802_11_RADIO,
sizeof(struct ieee80211_frame) + IEEE80211_RADIOTAP_HDRLEN,
&sc->sc_drvbpf);
@@ -1489,7 +1511,8 @@
urtwn_media_change(struct ifnet *ifp)
{
#ifdef URTWN_DEBUG
- struct urtwn_softc *sc = ifp->if_softc;
+ struct ieee80211vap *vap = ifp->if_softc;
+ struct urtwn_softc *sc = vap->iv_ic->ic_softc;
#endif
int error;
@@ -1808,6 +1831,7 @@
static void
urtwn_next_scan(void *arg)
{
+ printf ("urtwn_next_scan called....\n");
#ifdef notyet
struct urtwn_softc *sc = arg;
int s;
@@ -1942,6 +1966,7 @@
case IEEE80211_S_CAC:
case IEEE80211_S_CSA:
case IEEE80211_S_SLEEP:
+ printf ("URTWN UNKNOWN oSTATE: %d\n", ostate);
/* NNN what do we do in these states? XXX */
break;
}
@@ -2151,6 +2176,7 @@
case IEEE80211_S_CSA:
case IEEE80211_S_SLEEP:
/* NNN what do we do in these states? XXX */
+ printf ("URTWN UNKNOWN nSTATE: %d\n", nstate);
break;
}
@@ -2824,12 +2850,12 @@
static void
urtwn_start(struct ifnet *ifp)
{
- struct urtwn_softc *sc = ifp->if_softc;
- struct ieee80211com *ic = &sc->sc_ic;
+ struct ieee80211vap *vap = ifp->if_softc;
+ struct ieee80211com *ic = vap->iv_ic;
+ struct urtwn_softc *sc = ic->ic_softc;
struct urtwn_tx_data *data;
struct ether_header *eh;
struct ieee80211_node *ni;
- struct ieee80211vap *vap;
struct mbuf *m;
DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
@@ -2837,15 +2863,6 @@
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
return;
- /* Find the associated vap. NEED A BETTER WAY! */
- vap = TAILQ_FIRST(&ic->ic_vaps);
- while (vap != NULL) {
- if (vap->iv_ifp == ifp)
- break;
- vap = TAILQ_NEXT(vap, iv_next);
- }
- KASSERT(vap != NULL);
-
data = NULL;
for (;;) {
/* Send pending management frames first. */
@@ -2939,7 +2956,8 @@
static void
urtwn_watchdog(struct ifnet *ifp)
{
- struct urtwn_softc *sc = ifp->if_softc;
+ struct ieee80211vap *vap = ifp->if_softc;
+ struct urtwn_softc *sc = vap->iv_ic->ic_softc;
DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
@@ -2955,7 +2973,7 @@
}
ifp->if_timer = 1;
}
-//NNN ieee80211_watchdog(&sc->sc_ic); Not sure what is happening!
+ // ieee80211_watchdog(&sc->sc_ic);
}
/*
@@ -2998,12 +3016,10 @@
ifp->if_ioctl = urtwn_ioctl;
ifp->if_start = urtwn_start;
ifp->if_watchdog = urtwn_watchdog;
+ ifp->if_extflags |= IFEF_MPSAFE;
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
- /* NNN needed ??? */
- /* if_attach(ifp); */
-
/* Override state transition machine. */
sc->sc_newstate = vap->iv_newstate;
vap->iv_newstate = urtwn_newstate;
@@ -3031,6 +3047,69 @@
kmem_free(vap, sizeof(struct ieee80211vap));
}
+static void
+urtwn_parent(struct ieee80211com *ic)
+{
+ struct urtwn_softc *sc __unused = ic->ic_softc;
+
+ DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+ /* Not sure what to do here yet. */
+}
+
+static void
+urtwn_scan_start(struct ieee80211com *ic)
+{
+ struct urtwn_softc *sc __unused = ic->ic_softc;
+
+ DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+ /* Not sure what to do here yet. */
+}
+
+static void
+urtwn_scan_end(struct ieee80211com *ic)
+{
+ struct urtwn_softc *sc __unused = ic->ic_softc;
+
+ DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+ /* Not sure what to do here yet. */
+}
+
+static void
+urtwn_set_channel(struct ieee80211com *ic)
+{
+ struct urtwn_softc *sc = ic->ic_softc;
+
+ DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+ urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE);
+}
+
+static int
+urtwn_transmit(struct ieee80211com *ic, struct mbuf *m)
+{
+ struct urtwn_softc *sc = ic->ic_softc;
+
+ DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+ return EIO;
+}
+
+static int
+urtwn_raw_xmit(struct ieee80211_node *ni , struct mbuf *m,
+ const struct ieee80211_bpf_params *bpfp)
+{
+ struct ieee80211com *ic = ni->ni_ic;
+ struct urtwn_softc *sc = ic->ic_softc;
+
+ DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+ return EIO;
+}
+
+
static int
urtwn_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
@@ -3050,11 +3129,14 @@
break;
switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
case IFF_UP | IFF_RUNNING:
+ printf (" up and running...\n");
break;
case IFF_UP:
+ printf (" just up ... will start\n");
urtwn_init(ifp);
break;
case IFF_RUNNING:
+ printf (" just running .. will stop\n");
urtwn_stop(ifp, 1);
break;
case 0:
@@ -4765,9 +4847,9 @@
static int
urtwn_init(struct ifnet *ifp)
{
- struct urtwn_softc *sc = ifp->if_softc;
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+ struct ieee80211vap *vap = ifp->if_softc;
+ struct ieee80211com *ic = vap->iv_ic;
+ struct urtwn_softc *sc = ic->ic_softc;
struct urtwn_rx_data *data;
uint32_t reg;
size_t i;
@@ -5036,9 +5118,9 @@
static void
urtwn_stop(struct ifnet *ifp, int disable)
{
- struct urtwn_softc *sc = ifp->if_softc;
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+ struct ieee80211vap *vap = ifp->if_softc;
+ struct ieee80211com *ic = vap->iv_ic;
+ struct urtwn_softc *sc = ic->ic_softc;
size_t i;
int s;
diff -r 70077198073f -r 6006250bad1f sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c Mon Jul 16 20:11:11 2018 +0000
+++ b/sys/net80211/ieee80211.c Fri Jul 20 20:33:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211.c,v 1.56.18.3 2018/07/16 20:11:11 phil Exp $ */
+/* $NetBSD: ieee80211.c,v 1.56.18.4 2018/07/20 20:33:05 phil Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -48,6 +48,7 @@
#ifdef __FreeBSD__
#include <machine/stdarg.h>
#elif __NetBSD__
+#include <sys/once.h>
#include <sys/stdarg.h>
Home |
Main Index |
Thread Index |
Old Index