Date: Mon, 18 Dec 2006 19:59:27 +0000 From: Bruce M Simpson <bms@incunabulum.net> To: freebsd-current@freebsd.org Subject: [PATCH] Remove watchdog warnings from ral(4) Message-ID: <4586F31F.4040001@incunabulum.net>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi all,
Here is a patch to update ral(4) for the removal of the if_watchdog ABI.
I have tested this with an RT2661 part and looks OK. If others could
test then I shall commit.
Regards,
BMS
[-- Attachment #2 --]
? .swp
Index: rt2560.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ral/rt2560.c,v
retrieving revision 1.8
diff -u -p -r1.8 rt2560.c
--- rt2560.c 7 Dec 2006 15:24:38 -0000 1.8
+++ rt2560.c 18 Dec 2006 19:55:05 -0000
@@ -119,7 +119,7 @@ static struct mbuf *rt2560_get_rts(stru
static int rt2560_tx_data(struct rt2560_softc *, struct mbuf *,
struct ieee80211_node *);
static void rt2560_start(struct ifnet *);
-static void rt2560_watchdog(struct ifnet *);
+static void rt2560_watchdog(void *);
static int rt2560_reset(struct ifnet *);
static int rt2560_ioctl(struct ifnet *, u_long, caddr_t);
static void rt2560_bbp_write(struct rt2560_softc *, uint8_t,
@@ -206,6 +206,7 @@ rt2560_attach(device_t dev, int id)
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
+ callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0);
callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0);
callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE);
@@ -266,7 +267,6 @@ rt2560_attach(device_t dev, int id)
ifp->if_init = rt2560_init;
ifp->if_ioctl = rt2560_ioctl;
ifp->if_start = rt2560_start;
- ifp->if_watchdog = rt2560_watchdog;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
IFQ_SET_READY(&ifp->if_snd);
@@ -386,6 +386,7 @@ rt2560_detach(void *xsc)
struct ifnet *ifp = ic->ic_ifp;
rt2560_stop(sc);
+ callout_stop(&sc->watchdog_ch);
callout_stop(&sc->scan_ch);
callout_stop(&sc->rssadapt_ch);
@@ -2080,36 +2081,29 @@ rt2560_start(struct ifnet *ifp)
}
sc->sc_tx_timer = 5;
- ifp->if_timer = 1;
+ callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog, sc);
}
RAL_UNLOCK(sc);
}
static void
-rt2560_watchdog(struct ifnet *ifp)
+rt2560_watchdog(void *arg)
{
- struct rt2560_softc *sc = ifp->if_softc;
+ struct rt2560_softc *sc = (struct rt2560_softc *)arg;
struct ieee80211com *ic = &sc->sc_ic;
- RAL_LOCK(sc);
-
- ifp->if_timer = 0;
-
if (sc->sc_tx_timer > 0) {
if (--sc->sc_tx_timer == 0) {
device_printf(sc->sc_dev, "device timeout\n");
rt2560_init(sc);
- ifp->if_oerrors++;
- RAL_UNLOCK(sc);
+ sc->sc_ifp->if_oerrors++;
return;
}
- ifp->if_timer = 1;
+ callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog, sc);
}
ieee80211_watchdog(ic);
-
- RAL_UNLOCK(sc);
}
/*
@@ -2769,7 +2763,6 @@ rt2560_stop(void *priv)
struct ifnet *ifp = ic->ic_ifp;
sc->sc_tx_timer = 0;
- ifp->if_timer = 0;
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
@@ -2837,7 +2830,7 @@ rt2560_raw_xmit(struct ieee80211_node *n
goto bad;
}
sc->sc_tx_timer = 5;
- ifp->if_timer = 1;
+ callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog, sc);
RAL_UNLOCK(sc);
Index: rt2560var.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/ral/rt2560var.h,v
retrieving revision 1.1
diff -u -p -r1.1 rt2560var.h
--- rt2560var.h 5 Mar 2006 20:36:56 -0000 1.1
+++ rt2560var.h 18 Dec 2006 19:55:05 -0000
@@ -108,6 +108,7 @@ struct rt2560_softc {
struct mtx sc_mtx;
+ struct callout watchdog_ch;
struct callout scan_ch;
struct callout rssadapt_ch;
Index: rt2661.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ral/rt2661.c,v
retrieving revision 1.9
diff -u -p -r1.9 rt2661.c
--- rt2661.c 7 Dec 2006 15:24:38 -0000 1.9
+++ rt2661.c 18 Dec 2006 19:55:10 -0000
@@ -117,7 +117,7 @@ static int rt2661_tx_data(struct rt2661
static int rt2661_tx_mgt(struct rt2661_softc *, struct mbuf *,
struct ieee80211_node *);
static void rt2661_start(struct ifnet *);
-static void rt2661_watchdog(struct ifnet *);
+static void rt2661_watchdog(void *);
static int rt2661_reset(struct ifnet *);
static int rt2661_ioctl(struct ifnet *, u_long, caddr_t);
static void rt2661_bbp_write(struct rt2661_softc *, uint8_t,
@@ -209,6 +209,7 @@ rt2661_attach(device_t dev, int id)
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
+ callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0);
callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0);
callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE);
@@ -293,7 +294,6 @@ rt2661_attach(device_t dev, int id)
ifp->if_init = rt2661_init;
ifp->if_ioctl = rt2661_ioctl;
ifp->if_start = rt2661_start;
- ifp->if_watchdog = rt2661_watchdog;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
IFQ_SET_READY(&ifp->if_snd);
@@ -407,6 +407,7 @@ rt2661_detach(void *xsc)
struct ifnet *ifp = ic->ic_ifp;
rt2661_stop(sc);
+ callout_stop(&sc->watchdog_ch);
callout_stop(&sc->scan_ch);
callout_stop(&sc->rssadapt_ch);
@@ -1853,36 +1854,29 @@ rt2661_start(struct ifnet *ifp)
}
sc->sc_tx_timer = 5;
- ifp->if_timer = 1;
+ callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc);
}
RAL_UNLOCK(sc);
}
static void
-rt2661_watchdog(struct ifnet *ifp)
+rt2661_watchdog(void *arg)
{
- struct rt2661_softc *sc = ifp->if_softc;
+ struct rt2661_softc *sc = (struct rt2661_softc *)arg;
struct ieee80211com *ic = &sc->sc_ic;
- RAL_LOCK(sc);
-
- ifp->if_timer = 0;
-
if (sc->sc_tx_timer > 0) {
if (--sc->sc_tx_timer == 0) {
device_printf(sc->sc_dev, "device timeout\n");
rt2661_init(sc);
- ifp->if_oerrors++;
- RAL_UNLOCK(sc);
+ sc->sc_ifp->if_oerrors++;
return;
}
- ifp->if_timer = 1;
+ callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc);
}
ieee80211_watchdog(ic);
-
- RAL_UNLOCK(sc);
}
/*
@@ -2619,7 +2613,6 @@ rt2661_stop(void *priv)
uint32_t tmp;
sc->sc_tx_timer = 0;
- ifp->if_timer = 0;
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
Index: rt2661var.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/ral/rt2661var.h,v
retrieving revision 1.1
diff -u -p -r1.1 rt2661var.h
--- rt2661var.h 5 Mar 2006 20:36:56 -0000 1.1
+++ rt2661var.h 18 Dec 2006 19:55:10 -0000
@@ -101,6 +101,7 @@ struct rt2661_softc {
struct mtx sc_mtx;
+ struct callout watchdog_ch;
struct callout scan_ch;
struct callout rssadapt_ch;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4586F31F.4040001>
