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 More of ipw(4) converted to phil- stack.
details: https://anonhg.NetBSD.org/src-all/rev/67c31699153e
branches: trunk
changeset: 375216:67c31699153e
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Tue Mar 01 23:07:22 2022 +1100
description:
More of ipw(4) converted to phil- stack.
Remove ioctl.
Add parent fuction.
Change arguments for ipw_init and ipw_stop to match pci/if_rtwn.c.
diffstat:
sys/dev/pci/if_ipw.c | 56 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 35 insertions(+), 21 deletions(-)
diffs (178 lines):
diff -r fc1bf632e8b8 -r 67c31699153e sys/dev/pci/if_ipw.c
--- a/sys/dev/pci/if_ipw.c Tue Mar 01 22:17:10 2022 +1100
+++ b/sys/dev/pci/if_ipw.c Tue Mar 01 23:07:22 2022 +1100
@@ -97,6 +97,7 @@ static int ipw_match(device_t, cfdata_t,
static void ipw_attach(device_t, device_t, void *);
static int ipw_detach(device_t, int);
+static void ipw_parent(struct ieee80211com *);
static int ipw_media_change(struct ifnet *);
static void ipw_media_status(struct ifnet *, struct ifmediareq *);
static int ipw_newstate(struct ieee80211com *, enum ieee80211_state, int);
@@ -115,7 +116,6 @@ static int ipw_tx_start(struct ifnet *,
struct ieee80211_node *);
static void ipw_start(struct ifnet *);
static void ipw_watchdog(struct ifnet *);
-static int ipw_ioctl(struct ifnet *, u_long, void *);
static int ipw_get_table1(struct ipw_softc *, uint32_t *);
static int ipw_get_radio(struct ipw_softc *, int *);
static void ipw_stop_master(struct ipw_softc *);
@@ -125,8 +125,8 @@ static int ipw_load_firmware(struct ipw_
static int ipw_cache_firmware(struct ipw_softc *);
static void ipw_free_firmware(struct ipw_softc *);
static int ipw_config(struct ipw_softc *);
-static int ipw_init(struct ifnet *);
-static void ipw_stop(struct ifnet *, int);
+static int ipw_init(struct ipw_softc *);
+static void ipw_stop(struct ipw_softc *, int);
static uint32_t ipw_read_table1(struct ipw_softc *, uint32_t);
static void ipw_write_table1(struct ipw_softc *, uint32_t, uint32_t);
static int ipw_read_table2(struct ipw_softc *, uint32_t, void *, uint32_t *);
@@ -246,9 +246,6 @@ ipw_attach(device_t parent, device_t sel
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_init = ipw_init;
- ifp->if_stop = ipw_stop;
- ifp->if_ioctl = ipw_ioctl;
ifp->if_start = ipw_start;
ifp->if_watchdog = ipw_watchdog;
IFQ_SET_READY(&ifp->if_snd);
@@ -348,7 +345,7 @@ ipw_detach(device_t self, int flags)
struct ifnet *ifp = &sc->sc_if;
if (ifp->if_softc) {
- ipw_stop(ifp, 1);
+ ipw_stop(sc, 1);
ipw_free_firmware(sc);
bpf_detach(ifp);
@@ -845,6 +842,28 @@ ipw_newstate(struct ieee80211com *ic, en
return 0;
}
+static void
+ipw_parent(struct ieee80211com *ic)
+{
+ struct ipw_softc *sc = ic->ic_softc;
+ bool startall = false;
+
+ if (ic->ic_nrunning > 0) {
+ if ((sc->sc_flags & IPW_FLAG_FW_INITED) == 0) {
+ ipw_init(sc);
+ startall = true;
+ } else {
+ /* update filters or whatever */
+ }
+ } else {
+ ipw_stop(sc);
+ }
+
+ if (startall)
+ ieee80211_start_all(ic);
+}
+
+
/*
* Read 16 bits at address 'addr' from the serial EEPROM.
*/
@@ -922,7 +941,6 @@ static void
ipw_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
{
struct ieee80211com *ic = &sc->sc_ic;
- struct ifnet *ifp = sc->sc_ic.ic_ifp;
uint32_t state;
int s;
@@ -959,7 +977,7 @@ ipw_newstate_intr(struct ipw_softc *sc,
case IPW_STATE_RADIO_DISABLED:
ic->ic_ifp->if_flags &= ~IFF_UP;
- ipw_stop(ifp, 1);
+ ipw_stop(sc, 1);
break;
}
@@ -1281,7 +1299,7 @@ ipw_softintr(void *arg)
aprint_error_dev(sc->sc_dev, "fatal error\n");
s = splnet();
sc->sc_ic.ic_ifp->if_flags &= ~IFF_UP;
- ipw_stop(&sc->sc_if, 1);
+ ipw_stop(sc, 1);
splx(s);
}
@@ -1575,7 +1593,7 @@ ipw_watchdog(struct ifnet *ifp)
aprint_error_dev(sc->sc_dev, "device timeout\n");
if_statinc(ifp, if_oerrors);
ifp->if_flags &= ~IFF_UP;
- ipw_stop(ifp, 1);
+ ipw_stop(sc, 1);
return;
}
ifp->if_timer = 1;
@@ -1627,6 +1645,7 @@ ipw_get_radio(struct ipw_softc *sc, int
return copyout(&data, ret, sizeof(data));
}
+#if 0
static int
ipw_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
@@ -1698,6 +1717,7 @@ ipw_ioctl(struct ifnet *ifp, u_long cmd,
return error;
#undef IS_RUNNING
}
+#endif
static uint32_t
ipw_read_table1(struct ipw_softc *sc, uint32_t off)
@@ -2180,9 +2200,8 @@ ipw_config(struct ipw_softc *sc)
}
static int
-ipw_init(struct ifnet *ifp)
+ipw_init(struct ipw_softc *sc)
{
- struct ipw_softc *sc = ifp->if_softc;
struct ipw_firmware *fw = &sc->fw;
if (!(sc->flags & IPW_FLAG_FW_CACHED)) {
@@ -2194,7 +2213,7 @@ ipw_init(struct ifnet *ifp)
}
}
- ipw_stop(ifp, 0);
+ ipw_stop(sc, 0);
if (ipw_reset(sc) != 0) {
aprint_error_dev(sc->sc_dev, "could not reset adapter\n");
@@ -2252,15 +2271,14 @@ ipw_init(struct ifnet *ifp)
return 0;
fail: ifp->if_flags &= ~IFF_UP;
- ipw_stop(ifp, 0);
+ ipw_stop(sc, 0);
return EIO;
}
static void
-ipw_stop(struct ifnet *ifp, int disable)
+ipw_stop(struct ipw_softc *sc, int disable)
{
- struct ipw_softc *sc = ifp->if_softc;
struct ieee80211com *ic = &sc->sc_ic;
int i;
@@ -2275,10 +2293,6 @@ ipw_stop(struct ifnet *ifp, int disable)
ipw_release_sbd(sc, &sc->stbd_list[i]);
sc->sc_tx_timer = 0;
- ifp->if_timer = 0;
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-
- ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
}
static void
Home |
Main Index |
Thread Index |
Old Index