summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2001-11-17 00:56:04 +0000
committerthorpej <thorpej@NetBSD.org>2001-11-17 00:56:04 +0000
commit1466b9ca1dfcccd511ca66fb2867ac003726f505 (patch)
tree6ee17a8e9061699c05f049d6e6a20763c98fafd6 /sys/dev
parentb2b2b2b448327f211e12880a3864532bb1869054 (diff)
Back out the last two changes I made to this driver -- some people
have reported lossage.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/gem.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 1561284c813..8648ce58962 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gem.c,v 1.10 2001/11/13 13:14:37 lukem Exp $ */
+/* $NetBSD: gem.c,v 1.11 2001/11/17 00:56:04 thorpej Exp $ */
/*
*
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.10 2001/11/13 13:14:37 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.11 2001/11/17 00:56:04 thorpej Exp $");
#include "bpfilter.h"
@@ -788,7 +788,10 @@ gem_init(struct ifnet *ifp)
bus_space_write_4(t, h, GEM_RX_BLANKING, (2<<12)|6);
/* step 11. Configure Media */
- (void) gem_mediachange(ifp);
+ gem_mii_statchg(&sc->sc_dev);
+
+/* XXXX Serial link needs a whole different setup. */
+
/* step 12. RX_MAC Configuration Register */
v = bus_space_read_4(t, h, GEM_MAC_RX_CONFIG);
@@ -926,7 +929,8 @@ gem_start(ifp)
* until we drain the queue, or use up all available transmit
* descriptors.
*/
- for (;;) {
+ while ((txs = SIMPLEQ_FIRST(&sc->sc_txfreeq)) != NULL &&
+ sc->sc_txfree != 0) {
/*
* Grab a packet off the queue.
*/
@@ -935,12 +939,6 @@ gem_start(ifp)
break;
m = NULL;
- /* Get a work queue entry. */
- if ((txs = SIMPLEQ_FIRST(&sc->sc_txfreeq)) == NULL) {
- /* We've run out. */
- break;
- }
-
dmamap = txs->txs_dmamap;
/*
@@ -979,11 +977,9 @@ gem_start(ifp)
/*
* Ensure we have enough descriptors free to describe
- * the packet. Note, we always reserve one descriptor
- * at the end of the ring as a termination point, to
- * prevent wrap-around.
+ * the packet.
*/
- if (dmamap->dm_nsegs > (sc->sc_txfree - 1)) {
+ if (dmamap->dm_nsegs > sc->sc_txfree) {
/*
* Not enough free descriptors to transmit this
* packet. We haven't committed to anything yet,
@@ -1651,7 +1647,8 @@ gem_mediachange(ifp)
{
struct gem_softc *sc = ifp->if_softc;
- /* XXX Add support for serial media. */
+ if (IFM_TYPE(sc->sc_media.ifm_media) != IFM_ETHER)
+ return (EINVAL);
return (mii_mediachg(&sc->sc_mii));
}