am79900.c (6cec9cad762b6476313fb1f8e931a1647822db6b) am79900.c (c8dfaf382fa6df9dc6fd1e1c3356e0c8bf607e6a)
1/* $NetBSD: am79900.c,v 1.17 2005/12/24 20:27:29 perry Exp $ */
2
3/*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe.

--- 299 unchanged lines hidden (view full) ---

308 rmd.rmd2 = 0;
309 rmd.rmd3 = 0;
310 (*sc->sc_copytodesc)(sc, &rmd, rp, sizeof(rmd));
311
312 if (++bix == sc->sc_nrbuf)
313 bix = 0;
314
315 if (m != NULL) {
1/* $NetBSD: am79900.c,v 1.17 2005/12/24 20:27:29 perry Exp $ */
2
3/*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe.

--- 299 unchanged lines hidden (view full) ---

308 rmd.rmd2 = 0;
309 rmd.rmd3 = 0;
310 (*sc->sc_copytodesc)(sc, &rmd, rp, sizeof(rmd));
311
312 if (++bix == sc->sc_nrbuf)
313 bix = 0;
314
315 if (m != NULL) {
316 ifp->if_ipackets++;
316 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
317
318#if defined(__i386__) && !defined(PC98)
319 /*
320 * The VMware LANCE does not present IFF_SIMPLEX
321 * behavior on multicast packets. Thus drop the
322 * packet if it is from ourselves.
323 */
324 eh = mtod(m, struct ether_header *);
325 if (!ether_cmp(eh->ether_shost, sc->sc_enaddr)) {
326 m_freem(m);
327 continue;
328 }
329#endif
330
331 /* Pass the packet up. */
332 LE_UNLOCK(sc);
333 (*ifp->if_input)(ifp, m);
334 LE_LOCK(sc);
335 } else
317
318#if defined(__i386__) && !defined(PC98)
319 /*
320 * The VMware LANCE does not present IFF_SIMPLEX
321 * behavior on multicast packets. Thus drop the
322 * packet if it is from ourselves.
323 */
324 eh = mtod(m, struct ether_header *);
325 if (!ether_cmp(eh->ether_shost, sc->sc_enaddr)) {
326 m_freem(m);
327 continue;
328 }
329#endif
330
331 /* Pass the packet up. */
332 LE_UNLOCK(sc);
333 (*ifp->if_input)(ifp, m);
334 LE_LOCK(sc);
335 } else
336 ifp->if_ierrors++;
336 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
337 }
338
339 sc->sc_last_rd = bix;
340}
341
342static inline void
343am79900_tint(struct lance_softc *sc)
344{

--- 41 unchanged lines hidden (view full) ---

386 LINK_STATE_DOWN);
387 sc->sc_flags &= ~LE_CARRIER;
388 if (sc->sc_nocarrier)
389 (*sc->sc_nocarrier)(sc);
390 else
391 if_printf(ifp, "lost carrier\n");
392 }
393 if (tmd2 & LE_T2_LCOL)
337 }
338
339 sc->sc_last_rd = bix;
340}
341
342static inline void
343am79900_tint(struct lance_softc *sc)
344{

--- 41 unchanged lines hidden (view full) ---

386 LINK_STATE_DOWN);
387 sc->sc_flags &= ~LE_CARRIER;
388 if (sc->sc_nocarrier)
389 (*sc->sc_nocarrier)(sc);
390 else
391 if_printf(ifp, "lost carrier\n");
392 }
393 if (tmd2 & LE_T2_LCOL)
394 ifp->if_collisions++;
394 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
395 if (tmd2 & LE_T2_RTRY) {
396#ifdef LEDEBUG
397 if_printf(ifp, "excessive collisions\n");
398#endif
395 if (tmd2 & LE_T2_RTRY) {
396#ifdef LEDEBUG
397 if_printf(ifp, "excessive collisions\n");
398#endif
399 ifp->if_collisions += 16;
399 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16);
400 }
400 }
401 ifp->if_oerrors++;
401 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
402 } else {
403 if (tmd1 & LE_T1_ONE)
402 } else {
403 if (tmd1 & LE_T1_ONE)
404 ifp->if_collisions++;
404 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
405 else if (tmd1 & LE_T1_MORE)
406 /* Real number is unknown. */
405 else if (tmd1 & LE_T1_MORE)
406 /* Real number is unknown. */
407 ifp->if_collisions += 2;
408 ifp->if_opackets++;
407 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 2);
408 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
409 }
410
411 if (++bix == sc->sc_ntbuf)
412 bix = 0;
413
414 --sc->sc_no_td;
415 }
416

--- 10 unchanged lines hidden (view full) ---

427{
428 struct lance_softc *sc = arg;
429 struct ifnet *ifp = sc->sc_ifp;
430 uint16_t isr;
431
432 LE_LOCK(sc);
433
434 if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) {
409 }
410
411 if (++bix == sc->sc_ntbuf)
412 bix = 0;
413
414 --sc->sc_no_td;
415 }
416

--- 10 unchanged lines hidden (view full) ---

427{
428 struct lance_softc *sc = arg;
429 struct ifnet *ifp = sc->sc_ifp;
430 uint16_t isr;
431
432 LE_LOCK(sc);
433
434 if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) {
435 ifp->if_ierrors++;
435 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
436 lance_init_locked(sc);
437 LE_UNLOCK(sc);
438 return;
439 }
440
441 isr = (*sc->sc_rdcsr)(sc, LE_CSR0);
442#if defined(LEDEBUG) && LEDEBUG > 1
443 if (sc->sc_flags & LE_DEBUG)

--- 15 unchanged lines hidden (view full) ---

459 (*sc->sc_wrcsr)(sc, LE_CSR0, isr & ~(LE_C0_INEA | LE_C0_TDMD |
460 LE_C0_STOP | LE_C0_STRT | LE_C0_INIT));
461
462 if (isr & LE_C0_ERR) {
463 if (isr & LE_C0_BABL) {
464#ifdef LEDEBUG
465 if_printf(ifp, "babble\n");
466#endif
436 lance_init_locked(sc);
437 LE_UNLOCK(sc);
438 return;
439 }
440
441 isr = (*sc->sc_rdcsr)(sc, LE_CSR0);
442#if defined(LEDEBUG) && LEDEBUG > 1
443 if (sc->sc_flags & LE_DEBUG)

--- 15 unchanged lines hidden (view full) ---

459 (*sc->sc_wrcsr)(sc, LE_CSR0, isr & ~(LE_C0_INEA | LE_C0_TDMD |
460 LE_C0_STOP | LE_C0_STRT | LE_C0_INIT));
461
462 if (isr & LE_C0_ERR) {
463 if (isr & LE_C0_BABL) {
464#ifdef LEDEBUG
465 if_printf(ifp, "babble\n");
466#endif
467 ifp->if_oerrors++;
467 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
468 }
469#if 0
470 if (isr & LE_C0_CERR) {
471 if_printf(ifp, "collision error\n");
468 }
469#if 0
470 if (isr & LE_C0_CERR) {
471 if_printf(ifp, "collision error\n");
472 ifp->if_collisions++;
472 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
473 }
474#endif
475 if (isr & LE_C0_MISS) {
476#ifdef LEDEBUG
477 if_printf(ifp, "missed packet\n");
478#endif
473 }
474#endif
475 if (isr & LE_C0_MISS) {
476#ifdef LEDEBUG
477 if_printf(ifp, "missed packet\n");
478#endif
479 ifp->if_ierrors++;
479 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
480 }
481 if (isr & LE_C0_MERR) {
482 if_printf(ifp, "memory error\n");
483 lance_init_locked(sc);
484 LE_UNLOCK(sc);
485 return;
486 }
487 }
488
489 if ((isr & LE_C0_RXON) == 0) {
490 if_printf(ifp, "receiver disabled\n");
480 }
481 if (isr & LE_C0_MERR) {
482 if_printf(ifp, "memory error\n");
483 lance_init_locked(sc);
484 LE_UNLOCK(sc);
485 return;
486 }
487 }
488
489 if ((isr & LE_C0_RXON) == 0) {
490 if_printf(ifp, "receiver disabled\n");
491 ifp->if_ierrors++;
491 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
492 lance_init_locked(sc);
493 LE_UNLOCK(sc);
494 return;
495 }
496 if ((isr & LE_C0_TXON) == 0) {
497 if_printf(ifp, "transmitter disabled\n");
492 lance_init_locked(sc);
493 LE_UNLOCK(sc);
494 return;
495 }
496 if ((isr & LE_C0_TXON) == 0) {
497 if_printf(ifp, "transmitter disabled\n");
498 ifp->if_oerrors++;
498 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
499 lance_init_locked(sc);
500 LE_UNLOCK(sc);
501 return;
502 }
503
504 /*
505 * Pretend we have carrier; if we don't this will be cleared shortly.
506 */

--- 150 unchanged lines hidden ---
499 lance_init_locked(sc);
500 LE_UNLOCK(sc);
501 return;
502 }
503
504 /*
505 * Pretend we have carrier; if we don't this will be cleared shortly.
506 */

--- 150 unchanged lines hidden ---