summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_tht.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/if_tht.c')
-rw-r--r--sys/dev/pci/if_tht.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c
index 16f54402881..9a84a5c2795 100644
--- a/sys/dev/pci/if_tht.c
+++ b/sys/dev/pci/if_tht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tht.c,v 1.112 2008/02/02 20:34:42 brad Exp $ */
+/* $OpenBSD: if_tht.c,v 1.113 2008/04/04 11:05:04 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -37,6 +37,7 @@
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/rwlock.h>
+#include <sys/time.h>
#include <machine/bus.h>
@@ -482,6 +483,7 @@ struct tht_softc {
struct arpcom sc_ac;
struct ifmedia sc_media;
+ struct timeval sc_mediacheck;
u_int16_t sc_lladdr[3];
@@ -1761,9 +1763,13 @@ tht_fw_tick(void *arg)
void
tht_link_state(struct tht_softc *sc)
{
+ static const struct timeval interval = { 0, 10000 };
struct ifnet *ifp = &sc->sc_ac.ac_if;
int link_state = LINK_STATE_DOWN;
+ if (!ratecheck(&sc->sc_mediacheck, &interval))
+ return;
+
if (tht_read(sc, THT_REG_MAC_LNK_STAT) & THT_REG_MAC_LNK_STAT_LINK)
link_state = LINK_STATE_UP;