Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev To fix panic at "ifconfig an0 down",
details: https://anonhg.NetBSD.org/src/rev/a20a05d49fa7
branches: trunk
changeset: 500433:a20a05d49fa7
user: onoe <onoe%NetBSD.org@localhost>
date: Mon Dec 11 23:58:55 2000 +0000
description:
To fix panic at "ifconfig an0 down",
define ANCACHE in if_an_pcmcia.c (XXX)
try not to access registers after interface down.
diffstat:
sys/dev/ic/an.c | 28 +++++++++-------------------
sys/dev/ic/anreg.h | 3 +--
sys/dev/pcmcia/if_an_pcmcia.c | 6 +++++-
3 files changed, 15 insertions(+), 22 deletions(-)
diffs (144 lines):
diff -r 2bfa7f2bc557 -r a20a05d49fa7 sys/dev/ic/an.c
--- a/sys/dev/ic/an.c Mon Dec 11 23:51:58 2000 +0000
+++ b/sys/dev/ic/an.c Mon Dec 11 23:58:55 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: an.c,v 1.1 2000/12/11 23:16:50 onoe Exp $ */
+/* $NetBSD: an.c,v 1.2 2000/12/11 23:58:55 onoe Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul%ctr.columbia.edu@localhost>. All rights reserved.
@@ -215,7 +215,6 @@
struct ifmediareq imr;
#endif
- sc->an_gone = 0;
sc->an_associated = 0;
/* Reset the NIC. */
@@ -526,7 +525,7 @@
sc = (struct an_softc*)xsc;
- if (sc->an_gone)
+ if (!sc->sc_enabled)
return 0;
ifp = &sc->arpcom.ec_if;
@@ -632,7 +631,7 @@
static void an_reset(sc)
struct an_softc *sc;
{
- if (sc->an_gone)
+ if (!sc->sc_enabled)
return;
an_cmd(sc, AN_CMD_ENABLE, 0);
@@ -975,11 +974,6 @@
sc = ifp->if_softc;
ifr = (struct ifreq *)data;
- if (sc->an_gone) {
- error = ENODEV;
- goto out;
- }
-
switch(command) {
case SIOCSIFFLAGS:
if ((ifp->if_flags & sc->an_if_flags &
@@ -1152,7 +1146,7 @@
int i;
int id;
- if (sc->an_gone)
+ if (!sc->sc_enabled)
return (0);
for (i = 0; i < AN_TX_RING_CNT; i++) {
@@ -1174,9 +1168,6 @@
{
struct an_softc *sc = (struct an_softc *)ifp->if_softc;
- if (sc->an_gone)
- return ENXIO;
-
if (ifp->if_flags & IFF_RUNNING)
an_stop(ifp, 0);
@@ -1271,7 +1262,7 @@
sc = ifp->if_softc;
- if (sc->an_gone)
+ if (!sc->sc_enabled)
return;
if (ifp->if_flags & IFF_OACTIVE)
@@ -1357,7 +1348,8 @@
struct an_softc *sc = (struct an_softc *)ifp->if_softc;
int i;
- if (sc->an_gone)
+ callout_stop(&sc->an_stat_ch);
+ if (!sc->sc_enabled)
return;
an_cmd(sc, AN_CMD_FORCE_SYNCLOSS, 0);
@@ -1367,11 +1359,9 @@
for (i = 0; i < AN_TX_RING_CNT; i++)
an_cmd(sc, AN_CMD_DEALLOC_MEM, sc->an_rdata.an_tx_fids[i]);
- callout_stop(&sc->an_stat_ch);
-
ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
- if (disable && sc->sc_enabled) {
+ if (disable) {
if (sc->sc_disable)
(*sc->sc_disable)(sc);
sc->sc_enabled = 0;
@@ -1386,7 +1376,7 @@
struct an_softc *sc;
sc = ifp->if_softc;
- if (sc->an_gone)
+ if (!sc->sc_enabled)
return;
printf("%s: device timeout\n", sc->an_dev.dv_xname);
diff -r 2bfa7f2bc557 -r a20a05d49fa7 sys/dev/ic/anreg.h
--- a/sys/dev/ic/anreg.h Mon Dec 11 23:51:58 2000 +0000
+++ b/sys/dev/ic/anreg.h Mon Dec 11 23:58:55 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: anreg.h,v 1.1 2000/12/11 23:16:50 onoe Exp $ */
+/* $NetBSD: anreg.h,v 1.2 2000/12/11 23:58:55 onoe Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul%ctr.columbia.edu@localhost>. All rights reserved.
@@ -824,7 +824,6 @@
struct an_ltv_key an_perm_keys;
int an_tx_rate;
int an_rxmode;
- int an_gone;
int an_if_flags;
u_int8_t an_txbuf[1536];
struct an_tx_ring_data an_rdata;
diff -r 2bfa7f2bc557 -r a20a05d49fa7 sys/dev/pcmcia/if_an_pcmcia.c
--- a/sys/dev/pcmcia/if_an_pcmcia.c Mon Dec 11 23:51:58 2000 +0000
+++ b/sys/dev/pcmcia/if_an_pcmcia.c Mon Dec 11 23:58:55 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_an_pcmcia.c,v 1.1 2000/12/11 23:16:50 onoe Exp $ */
+/* $NetBSD: if_an_pcmcia.c,v 1.2 2000/12/11 23:58:56 onoe Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -40,6 +40,10 @@
#include "opt_ns.h"
#include "bpfilter.h"
+#ifdef INET
+#define ANCACHE /* XXX: should be defined elsewhere */
+#endif
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
Home |
Main Index |
Thread Index |
Old Index