svn commit: r202298 - stable/7/sys/dev/ste
Pyun YongHyeon
yongari at FreeBSD.org
Thu Jan 14 20:40:37 UTC 2010
Author: yongari
Date: Thu Jan 14 20:40:37 2010
New Revision: 202298
URL: http://svn.freebsd.org/changeset/base/202298
Log:
Partial merge r199559:
- Add a private timer to drive the transmit watchdog instead of using
if_watchdog and if_timer.
- Fix some issues in detach for sn(4), ste(4), and ti(4). Primarily this
means calling ether_ifdetach() before anything else.
Modified:
stable/7/sys/dev/ste/if_ste.c
stable/7/sys/dev/ste/if_stereg.h
Modified: stable/7/sys/dev/ste/if_ste.c
==============================================================================
--- stable/7/sys/dev/ste/if_ste.c Thu Jan 14 20:38:40 2010 (r202297)
+++ stable/7/sys/dev/ste/if_ste.c Thu Jan 14 20:40:37 2010 (r202298)
@@ -108,7 +108,7 @@ static int ste_ioctl(struct ifnet *, u_l
static int ste_encap(struct ste_softc *, struct ste_chain *, struct mbuf *);
static void ste_start(struct ifnet *);
static void ste_start_locked(struct ifnet *);
-static void ste_watchdog(struct ifnet *);
+static void ste_watchdog(struct ste_softc *);
static int ste_shutdown(device_t);
static int ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *,
struct mbuf *);
@@ -919,7 +919,7 @@ ste_txeof(sc)
sc->ste_cdata.ste_tx_cons = idx;
if (idx == sc->ste_cdata.ste_tx_prod)
- ifp->if_timer = 0;
+ sc->ste_timer = 0;
}
static void
@@ -955,6 +955,8 @@ ste_stats_update(xsc)
}
}
+ if (sc->ste_timer > 0 && --sc->ste_timer == 0)
+ ste_watchdog(sc);
callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc);
return;
@@ -1089,7 +1091,6 @@ ste_attach(dev)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = ste_ioctl;
ifp->if_start = ste_start;
- ifp->if_watchdog = ste_watchdog;
ifp->if_init = ste_init;
IFQ_SET_MAXLEN(&ifp->if_snd, STE_TX_LIST_CNT - 1);
ifp->if_snd.ifq_drv_maxlen = STE_TX_LIST_CNT - 1;
@@ -1154,11 +1155,11 @@ ste_detach(dev)
/* These should only be active if attach succeeded */
if (device_is_attached(dev)) {
+ ether_ifdetach(ifp);
STE_LOCK(sc);
ste_stop(sc);
STE_UNLOCK(sc);
callout_drain(&sc->ste_stat_callout);
- ether_ifdetach(ifp);
}
if (sc->ste_miibus)
device_delete_child(dev, sc->ste_miibus);
@@ -1703,7 +1704,7 @@ ste_start_locked(ifp)
BPF_MTAP(ifp, cur_tx->ste_mbuf);
STE_INC(idx, STE_TX_LIST_CNT);
- ifp->if_timer = 5;
+ sc->ste_timer = 5;
}
sc->ste_cdata.ste_tx_prod = idx;
@@ -1711,13 +1712,12 @@ ste_start_locked(ifp)
}
static void
-ste_watchdog(ifp)
- struct ifnet *ifp;
+ste_watchdog(struct ste_softc *sc)
{
- struct ste_softc *sc;
+ struct ifnet *ifp;
- sc = ifp->if_softc;
- STE_LOCK(sc);
+ ifp = sc->ste_ifp;
+ STE_LOCK_ASSERT(sc);
ifp->if_oerrors++;
if_printf(ifp, "watchdog timeout\n");
@@ -1731,7 +1731,6 @@ ste_watchdog(ifp)
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
ste_start_locked(ifp);
- STE_UNLOCK(sc);
return;
}
Modified: stable/7/sys/dev/ste/if_stereg.h
==============================================================================
--- stable/7/sys/dev/ste/if_stereg.h Thu Jan 14 20:38:40 2010 (r202297)
+++ stable/7/sys/dev/ste/if_stereg.h Thu Jan 14 20:40:37 2010 (r202298)
@@ -517,6 +517,7 @@ struct ste_softc {
int ste_tx_thresh;
u_int8_t ste_link;
int ste_if_flags;
+ int ste_timer;
struct ste_chain *ste_tx_prev;
struct ste_list_data *ste_ldata;
struct ste_chain_data ste_cdata;
More information about the svn-src-stable-7
mailing list