if_ep.c (119418) | if_ep.c (119572) |
---|---|
1/* 2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep.c 119418 2003-08-24 17:55:58Z obrien $"); | 32__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep.c 119572 2003-08-30 08:10:58Z markm $"); |
33 34/* 35 * Modified from the FreeBSD 1.1.5.1 version by: 36 * Andres Vega Garcia 37 * INRIA - Sophia Antipolis, France 38 * avega@sophia.inria.fr 39 */ 40 --- 15 unchanged lines hidden (view full) --- 56 */ 57 58/* 59 * MAINTAINER: Matthew N. Dodd <winter@jurai.net> 60 * <mdodd@FreeBSD.org> 61 */ 62 63#include <sys/cdefs.h> | 33 34/* 35 * Modified from the FreeBSD 1.1.5.1 version by: 36 * Andres Vega Garcia 37 * INRIA - Sophia Antipolis, France 38 * avega@sophia.inria.fr 39 */ 40 --- 15 unchanged lines hidden (view full) --- 56 */ 57 58/* 59 * MAINTAINER: Matthew N. Dodd <winter@jurai.net> 60 * <mdodd@FreeBSD.org> 61 */ 62 63#include <sys/cdefs.h> |
64__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep.c 119418 2003-08-24 17:55:58Z obrien $"); | 64__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep.c 119572 2003-08-30 08:10:58Z markm $"); |
65 66#include <sys/param.h> 67#include <sys/systm.h> 68#include <sys/mbuf.h> 69#include <sys/socket.h> 70#include <sys/sockio.h> 71#include <sys/bus.h> 72 --- 194 unchanged lines hidden (view full) --- 267 int i; 268 int attached; 269 int error; 270 271 sc->gone = 0; 272 273 error = ep_get_macaddr(sc, (u_char *)&sc->arpcom.ac_enaddr); 274 if (error) { | 65 66#include <sys/param.h> 67#include <sys/systm.h> 68#include <sys/mbuf.h> 69#include <sys/socket.h> 70#include <sys/sockio.h> 71#include <sys/bus.h> 72 --- 194 unchanged lines hidden (view full) --- 267 int i; 268 int attached; 269 int error; 270 271 sc->gone = 0; 272 273 error = ep_get_macaddr(sc, (u_char *)&sc->arpcom.ac_enaddr); 274 if (error) { |
275 device_printf(sc->dev, "Unable to retrieve Ethernet address!\n"); | 275 device_printf(sc->dev, "Unable to get Ethernet address!\n"); |
276 return (ENXIO); 277 } 278 /* 279 * Setup the station address 280 */ 281 p = (u_short *)&sc->arpcom.ac_enaddr; 282 GO_WINDOW(2); 283 for (i = 0; i < 3; i++) --- 16 unchanged lines hidden (view full) --- 300 ifp->if_watchdog = ep_if_watchdog; 301 ifp->if_init = ep_if_init; 302 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 303 304 if (!sc->epb.mii_trans) { 305 ifmedia_init(&sc->ifmedia, 0, ep_ifmedia_upd, ep_ifmedia_sts); 306 307 if (sc->ep_connectors & AUI) | 276 return (ENXIO); 277 } 278 /* 279 * Setup the station address 280 */ 281 p = (u_short *)&sc->arpcom.ac_enaddr; 282 GO_WINDOW(2); 283 for (i = 0; i < 3; i++) --- 16 unchanged lines hidden (view full) --- 300 ifp->if_watchdog = ep_if_watchdog; 301 ifp->if_init = ep_if_init; 302 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; 303 304 if (!sc->epb.mii_trans) { 305 ifmedia_init(&sc->ifmedia, 0, ep_ifmedia_upd, ep_ifmedia_sts); 306 307 if (sc->ep_connectors & AUI) |
308 ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_5, 0, NULL); | 308 ifmedia_add(&sc->ifmedia, 309 IFM_ETHER | IFM_10_5, 0, NULL); |
309 if (sc->ep_connectors & UTP) | 310 if (sc->ep_connectors & UTP) |
310 ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_T, 0, NULL); | 311 ifmedia_add(&sc->ifmedia, 312 IFM_ETHER | IFM_10_T, 0, NULL); |
311 if (sc->ep_connectors & BNC) | 313 if (sc->ep_connectors & BNC) |
312 ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_2, 0, NULL); | 314 ifmedia_add(&sc->ifmedia, 315 IFM_ETHER | IFM_10_2, 0, NULL); |
313 if (!sc->ep_connectors) | 316 if (!sc->ep_connectors) |
314 ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_NONE, 0, NULL); | 317 ifmedia_add(&sc->ifmedia, 318 IFM_ETHER | IFM_NONE, 0, NULL); |
315 | 319 |
316 ifmedia_set(&sc->ifmedia, IFM_ETHER | ep_media2if_media[sc->ep_connector]); | 320 ifmedia_set(&sc->ifmedia, 321 IFM_ETHER | ep_media2if_media[sc->ep_connector]); |
317 318 ifm = &sc->ifmedia; 319 ifm->ifm_media = ifm->ifm_cur->ifm_media; 320 ep_ifmedia_upd(ifp); 321 } 322 if (!attached) 323 ether_ifattach(ifp, sc->arpcom.ac_enaddr); 324 --- 109 unchanged lines hidden (view full) --- 434 if (sc->top) { 435 m_freem(sc->top); 436 sc->top = sc->mcur = 0; 437 } 438 outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | RX_INIT_EARLY_THRESH); 439 outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16); 440 441 /* | 322 323 ifm = &sc->ifmedia; 324 ifm->ifm_media = ifm->ifm_cur->ifm_media; 325 ep_ifmedia_upd(ifp); 326 } 327 if (!attached) 328 ether_ifattach(ifp, sc->arpcom.ac_enaddr); 329 --- 109 unchanged lines hidden (view full) --- 439 if (sc->top) { 440 m_freem(sc->top); 441 sc->top = sc->mcur = 0; 442 } 443 outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | RX_INIT_EARLY_THRESH); 444 outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16); 445 446 /* |
442 * Store up a bunch of mbuf's for use later. (MAX_MBS). First we free up 443 * any that we had in case we're being called from intr or somewhere 444 * else. 445 */ | 447 * Store up a bunch of mbuf's for use later. (MAX_MBS). 448 * First we free up any that we had in case we're being 449 * called from intr or somewhere else. 450 */ |
446 447 GO_WINDOW(1); 448 ep_if_start(ifp); 449 450 splx(s); 451} 452 453static void --- 18 unchanged lines hidden (view full) --- 472 if (m0 == NULL) 473 return; 474 for (len = 0, m = m0; m != NULL; m = m->m_next) 475 len += m->m_len; 476 477 pad = (4 - len) & 3; 478 479 /* | 451 452 GO_WINDOW(1); 453 ep_if_start(ifp); 454 455 splx(s); 456} 457 458static void --- 18 unchanged lines hidden (view full) --- 477 if (m0 == NULL) 478 return; 479 for (len = 0, m = m0; m != NULL; m = m->m_next) 480 len += m->m_len; 481 482 pad = (4 - len) & 3; 483 484 /* |
480 * The 3c509 automatically pads short packets to minimum ethernet length, 481 * but we drop packets that are too large. Perhaps we should truncate 482 * them instead? 483 */ | 485 * The 3c509 automatically pads short packets to minimum 486 * ethernet length, but we drop packets that are too large. 487 * Perhaps we should truncate them instead? 488 */ |
484 if (len + pad > ETHER_MAX_LEN) { 485 /* packet is obviously too large: toss it */ 486 ifp->if_oerrors++; 487 m_freem(m0); 488 goto readcheck; 489 } 490 if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { 491 /* no room in FIFO */ 492 outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4)); 493 /* make sure */ 494 if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { 495 ifp->if_flags |= IFF_OACTIVE; 496 IF_PREPEND(&ifp->if_snd, m0); 497 return; 498 } 499 } else | 489 if (len + pad > ETHER_MAX_LEN) { 490 /* packet is obviously too large: toss it */ 491 ifp->if_oerrors++; 492 m_freem(m0); 493 goto readcheck; 494 } 495 if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { 496 /* no room in FIFO */ 497 outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4)); 498 /* make sure */ 499 if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { 500 ifp->if_flags |= IFF_OACTIVE; 501 IF_PREPEND(&ifp->if_snd, m0); 502 return; 503 } 504 } else |
500 outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | EP_THRESH_DISABLE); | 505 outw(BASE + EP_COMMAND, 506 SET_TX_AVAIL_THRESH | EP_THRESH_DISABLE); |
501 502 s = splhigh(); 503 504 outw(BASE + EP_W1_TX_PIO_WR_1, len); | 507 508 s = splhigh(); 509 510 outw(BASE + EP_W1_TX_PIO_WR_1, len); |
505 outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */ | 511 /* Second dword meaningless */ 512 outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); |
506 507 if (EP_FTST(sc, F_ACCESS_32_BITS)) { 508 for (m = m0; m != NULL; m = m->m_next) { 509 if (m->m_len > 3) 510 outsl(BASE + EP_W1_TX_PIO_WR_1, 511 mtod(m, caddr_t), m->m_len / 4); 512 if (m->m_len & 3) 513 outsb(BASE + EP_W1_TX_PIO_WR_1, | 513 514 if (EP_FTST(sc, F_ACCESS_32_BITS)) { 515 for (m = m0; m != NULL; m = m->m_next) { 516 if (m->m_len > 3) 517 outsl(BASE + EP_W1_TX_PIO_WR_1, 518 mtod(m, caddr_t), m->m_len / 4); 519 if (m->m_len & 3) 520 outsb(BASE + EP_W1_TX_PIO_WR_1, |
514 mtod(m, caddr_t)+(m->m_len & (~3)), m->m_len & 3); | 521 mtod(m, caddr_t)+(m->m_len & (~3)), 522 m->m_len & 3); |
515 } 516 } else { 517 for (m = m0; m != NULL; m = m->m_next) { 518 if (m->m_len > 1) 519 outsw(BASE + EP_W1_TX_PIO_WR_1, 520 mtod(m, caddr_t), m->m_len / 2); 521 if (m->m_len & 1) 522 outb(BASE + EP_W1_TX_PIO_WR_1, --- 8 unchanged lines hidden (view full) --- 531 532 BPF_MTAP(ifp, m0); 533 534 ifp->if_timer = 2; 535 ifp->if_opackets++; 536 m_freem(m0); 537 538 /* | 523 } 524 } else { 525 for (m = m0; m != NULL; m = m->m_next) { 526 if (m->m_len > 1) 527 outsw(BASE + EP_W1_TX_PIO_WR_1, 528 mtod(m, caddr_t), m->m_len / 2); 529 if (m->m_len & 1) 530 outb(BASE + EP_W1_TX_PIO_WR_1, --- 8 unchanged lines hidden (view full) --- 539 540 BPF_MTAP(ifp, m0); 541 542 ifp->if_timer = 2; 543 ifp->if_opackets++; 544 m_freem(m0); 545 546 /* |
539 * Is another packet coming in? We don't want to overflow the tiny RX 540 * fifo. 541 */ | 547 * Is another packet coming in? We don't want to overflow 548 * the tiny RX fifo. 549 */ |
542readcheck: 543 if (inw(BASE + EP_W1_RX_STATUS) & RX_BYTES_MASK) { 544 /* | 550readcheck: 551 if (inw(BASE + EP_W1_RX_STATUS) & RX_BYTES_MASK) { 552 /* |
545 * we check if we have packets left, in that case we prepare to come 546 * back later | 553 * we check if we have packets left, in that case 554 * we prepare to come back later |
547 */ 548 if (ifp->if_snd.ifq_head) 549 outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 8); 550 return; 551 } 552 goto startagain; 553} 554 --- 5 unchanged lines hidden (view full) --- 560 struct ifnet *ifp; 561 int x; 562 563 x = splbio(); 564 565 sc = (struct ep_softc *) arg; 566 567 /* | 555 */ 556 if (ifp->if_snd.ifq_head) 557 outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 8); 558 return; 559 } 560 goto startagain; 561} 562 --- 5 unchanged lines hidden (view full) --- 568 struct ifnet *ifp; 569 int x; 570 571 x = splbio(); 572 573 sc = (struct ep_softc *) arg; 574 575 /* |
568 * quick fix: Try to detect an interrupt when the card goes away. 569 */ | 576 * quick fix: Try to detect an interrupt when the card goes away. 577 */ |
570 if (sc->gone || inw(BASE + EP_STATUS) == 0xffff) { 571 splx(x); 572 return; 573 } 574 ifp = &sc->arpcom.ac_if; 575 576 outw(BASE + EP_COMMAND, SET_INTR_MASK); /* disable all Ints */ 577 --- 14 unchanged lines hidden (view full) --- 592 inw(BASE + EP_W1_FREE_TX); 593 ep_if_start(ifp); 594 } 595 if (status & S_CARD_FAILURE) { 596 ifp->if_timer = 0; 597#ifdef EP_LOCAL_STATS 598 printf("\nep%d:\n\tStatus: %x\n", sc->unit, status); 599 GO_WINDOW(4); | 578 if (sc->gone || inw(BASE + EP_STATUS) == 0xffff) { 579 splx(x); 580 return; 581 } 582 ifp = &sc->arpcom.ac_if; 583 584 outw(BASE + EP_COMMAND, SET_INTR_MASK); /* disable all Ints */ 585 --- 14 unchanged lines hidden (view full) --- 600 inw(BASE + EP_W1_FREE_TX); 601 ep_if_start(ifp); 602 } 603 if (status & S_CARD_FAILURE) { 604 ifp->if_timer = 0; 605#ifdef EP_LOCAL_STATS 606 printf("\nep%d:\n\tStatus: %x\n", sc->unit, status); 607 GO_WINDOW(4); |
600 printf("\tFIFO Diagnostic: %x\n", inw(BASE + EP_W4_FIFO_DIAG)); | 608 printf("\tFIFO Diagnostic: %x\n", 609 inw(BASE + EP_W4_FIFO_DIAG)); |
601 printf("\tStat: %x\n", sc->stat); 602 printf("\tIpackets=%d, Opackets=%d\n", 603 ifp->if_ipackets, ifp->if_opackets); 604 printf("\tNOF=%d, NOMB=%d, RXOF=%d, RXOL=%d, TXU=%d\n", 605 sc->rx_no_first, sc->rx_no_mbuf, sc->rx_overrunf, 606 sc->rx_overrunl, sc->tx_underrun); 607#else 608 609#ifdef DIAGNOSTIC | 610 printf("\tStat: %x\n", sc->stat); 611 printf("\tIpackets=%d, Opackets=%d\n", 612 ifp->if_ipackets, ifp->if_opackets); 613 printf("\tNOF=%d, NOMB=%d, RXOF=%d, RXOL=%d, TXU=%d\n", 614 sc->rx_no_first, sc->rx_no_mbuf, sc->rx_overrunf, 615 sc->rx_overrunl, sc->tx_underrun); 616#else 617 618#ifdef DIAGNOSTIC |
610 printf("ep%d: Status: %x (input buffer overflow)\n", sc->unit, status); | 619 printf("ep%d: Status: %x (input buffer overflow)\n", 620 sc->unit, status); |
611#else 612 ++ifp->if_ierrors; 613#endif 614 615#endif 616 ep_if_init(sc); 617 splx(x); 618 return; 619 } 620 if (status & S_TX_COMPLETE) { 621 ifp->if_timer = 0; | 621#else 622 ++ifp->if_ierrors; 623#endif 624 625#endif 626 ep_if_init(sc); 627 splx(x); 628 return; 629 } 630 if (status & S_TX_COMPLETE) { 631 ifp->if_timer = 0; |
622 /* we need ACK. we do it at the end */ | |
623 /* | 632 /* |
624 * We need to read TX_STATUS until we get a 0 status in order to 625 * turn off the interrupt flag. | 633 * We need ACK. We do it at the end. 634 * 635 * We need to read TX_STATUS until we get a 636 * 0 status in order to turn off the interrupt flag. |
626 */ | 637 */ |
627 while ((status = inb(BASE + EP_W1_TX_STATUS)) & TXS_COMPLETE) { | 638 while ((status = inb(BASE + EP_W1_TX_STATUS)) & 639 TXS_COMPLETE) { |
628 if (status & TXS_SUCCES_INTR_REQ); | 640 if (status & TXS_SUCCES_INTR_REQ); |
629 else if (status & (TXS_UNDERRUN | TXS_JABBER | TXS_MAX_COLLISION)) { | 641 else if (status & 642 (TXS_UNDERRUN | TXS_JABBER | 643 TXS_MAX_COLLISION)) { |
630 outw(BASE + EP_COMMAND, TX_RESET); 631 if (status & TXS_UNDERRUN) { 632#ifdef EP_LOCAL_STATS 633 sc->tx_underrun++; 634#endif 635 } else { 636 if (status & TXS_JABBER); | 644 outw(BASE + EP_COMMAND, TX_RESET); 645 if (status & TXS_UNDERRUN) { 646#ifdef EP_LOCAL_STATS 647 sc->tx_underrun++; 648#endif 649 } else { 650 if (status & TXS_JABBER); |
637 else /* TXS_MAX_COLLISION - 638 * we shouldn't get here */ | 651 else |
639 ++ifp->if_collisions; | 652 ++ifp->if_collisions; |
653 /* TXS_MAX_COLLISION 654 * we shouldn't get 655 * here 656 */ |
|
640 } 641 ++ifp->if_oerrors; 642 outw(BASE + EP_COMMAND, TX_ENABLE); 643 /* | 657 } 658 ++ifp->if_oerrors; 659 outw(BASE + EP_COMMAND, TX_ENABLE); 660 /* |
644 * To have a tx_avail_int but giving the chance to the 645 * Reception | 661 * To have a tx_avail_int but giving 662 * the chance to the Reception |
646 */ 647 if (ifp->if_snd.ifq_head) | 663 */ 664 if (ifp->if_snd.ifq_head) |
648 outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 8); | 665 outw(BASE + EP_COMMAND, 666 SET_TX_AVAIL_THRESH | 8); |
649 } | 667 } |
650 outb(BASE + EP_W1_TX_STATUS, 0x0); /* pops up the next 651 * status */ | 668 /* pops up the next status */ 669 outb(BASE + EP_W1_TX_STATUS, 0x0); |
652 } /* while */ 653 ifp->if_flags &= ~IFF_OACTIVE; 654 GO_WINDOW(1); 655 inw(BASE + EP_W1_FREE_TX); 656 ep_if_start(ifp); | 670 } /* while */ 671 ifp->if_flags &= ~IFF_OACTIVE; 672 GO_WINDOW(1); 673 inw(BASE + EP_W1_FREE_TX); 674 ep_if_start(ifp); |
657 } /* end TX_COMPLETE */ | 675 } /* end TX_COMPLETE */ |
658 } 659 660 outw(BASE + EP_COMMAND, C_INTR_LATCH); /* ACK int Latch */ 661 662 if ((status = inw(BASE + EP_STATUS)) & S_5_INTS) 663 goto rescan; 664 665 /* re-enable Ints */ --- 16 unchanged lines hidden (view full) --- 682 status = inw(BASE + EP_W1_RX_STATUS); 683 684read_again: 685 686 if (status & ERR_RX) { 687 ++ifp->if_ierrors; 688 if (status & ERR_RX_OVERRUN) { 689 /* | 676 } 677 678 outw(BASE + EP_COMMAND, C_INTR_LATCH); /* ACK int Latch */ 679 680 if ((status = inw(BASE + EP_STATUS)) & S_5_INTS) 681 goto rescan; 682 683 /* re-enable Ints */ --- 16 unchanged lines hidden (view full) --- 700 status = inw(BASE + EP_W1_RX_STATUS); 701 702read_again: 703 704 if (status & ERR_RX) { 705 ++ifp->if_ierrors; 706 if (status & ERR_RX_OVERRUN) { 707 /* |
690 * we can think the rx latency is actually greather than we 691 * expect | 708 * We can think the rx latency is actually 709 * greather than we expect |
692 */ 693#ifdef EP_LOCAL_STATS 694 if (EP_FTST(sc, F_RX_FIRST)) 695 sc->rx_overrunf++; 696 else 697 sc->rx_overrunl++; 698#endif 699 } --- 34 unchanged lines hidden (view full) --- 734 if (!m) 735 goto out; 736 if (rx_fifo >= MINCLSIZE) 737 MCLGET(m, M_DONTWAIT); 738 m->m_len = 0; 739 mcur->m_next = m; 740 lenthisone = min(rx_fifo, M_TRAILINGSPACE(m)); 741 } | 710 */ 711#ifdef EP_LOCAL_STATS 712 if (EP_FTST(sc, F_RX_FIRST)) 713 sc->rx_overrunf++; 714 else 715 sc->rx_overrunl++; 716#endif 717 } --- 34 unchanged lines hidden (view full) --- 752 if (!m) 753 goto out; 754 if (rx_fifo >= MINCLSIZE) 755 MCLGET(m, M_DONTWAIT); 756 m->m_len = 0; 757 mcur->m_next = m; 758 lenthisone = min(rx_fifo, M_TRAILINGSPACE(m)); 759 } |
742 if (EP_FTST(sc, F_ACCESS_32_BITS)) { /* default for EISA 743 * configured cards */ 744 insl(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t)+m->m_len, | 760 if (EP_FTST(sc, F_ACCESS_32_BITS)) { 761 /* default for EISA configured cards */ 762 insl(BASE + EP_W1_RX_PIO_RD_1, 763 mtod(m, caddr_t)+m->m_len, |
745 lenthisone / 4); 746 m->m_len += (lenthisone & ~3); 747 if (lenthisone & 3) 748 insb(BASE + EP_W1_RX_PIO_RD_1, | 764 lenthisone / 4); 765 m->m_len += (lenthisone & ~3); 766 if (lenthisone & 3) 767 insb(BASE + EP_W1_RX_PIO_RD_1, |
749 mtod(m, caddr_t)+m->m_len, 750 lenthisone & 3); | 768 mtod(m, caddr_t)+m->m_len, lenthisone & 3); |
751 m->m_len += (lenthisone & 3); 752 } else { | 769 m->m_len += (lenthisone & 3); 770 } else { |
753 insw(BASE + EP_W1_RX_PIO_RD_1, mtod(m, caddr_t)+m->m_len, 754 lenthisone / 2); | 771 insw(BASE + EP_W1_RX_PIO_RD_1, 772 mtod(m, caddr_t)+m->m_len, lenthisone / 2); |
755 m->m_len += lenthisone; 756 if (lenthisone & 1) | 773 m->m_len += lenthisone; 774 if (lenthisone & 1) |
757 *(mtod(m, caddr_t)+m->m_len - 1) = inb(BASE + EP_W1_RX_PIO_RD_1); | 775 *(mtod(m, caddr_t)+m->m_len - 1) = 776 inb(BASE + EP_W1_RX_PIO_RD_1); |
758 } 759 rx_fifo -= lenthisone; 760 } 761 | 777 } 778 rx_fifo -= lenthisone; 779 } 780 |
762 if (status & ERR_RX_INCOMPLETE) { /* we haven't received the 763 * complete packet */ | 781 if (status & ERR_RX_INCOMPLETE) { 782 /* we haven't received the complete packet */ |
764 sc->mcur = m; 765#ifdef EP_LOCAL_STATS | 783 sc->mcur = m; 784#ifdef EP_LOCAL_STATS |
766 sc->rx_no_first++; /* to know how often we come here */ | 785 /* to know how often we come here */ 786 sc->rx_no_first++; |
767#endif 768 EP_FRST(sc, F_RX_FIRST); | 787#endif 788 EP_FRST(sc, F_RX_FIRST); |
769 if (!((status = inw(BASE + EP_W1_RX_STATUS)) & ERR_RX_INCOMPLETE)) { | 789 status = inw(BASE + EP_W1_RX_STATUS); 790 if (!status & ERR_RX_INCOMPLETE) { |
770 /* | 791 /* |
771 * we see if by now, the packet has completly | 792 * We see if by now, the packet has completly |
772 * arrived 773 */ 774 goto read_again; 775 } | 793 * arrived 794 */ 795 goto read_again; 796 } |
776 outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | RX_NEXT_EARLY_THRESH); | 797 outw(BASE + EP_COMMAND, 798 SET_RX_EARLY_THRESH | RX_NEXT_EARLY_THRESH); |
777 return; 778 } 779 outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); 780 ++ifp->if_ipackets; 781 EP_FSET(sc, F_RX_FIRST); 782 top->m_pkthdr.rcvif = &sc->arpcom.ac_if; 783 top->m_pkthdr.len = sc->cur_len; 784 --- 123 unchanged lines hidden (view full) --- 908} 909 910static void 911ep_if_watchdog(struct ifnet *ifp) 912{ 913 struct ep_softc *sc = ifp->if_softc; 914 915/* | 799 return; 800 } 801 outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); 802 ++ifp->if_ipackets; 803 EP_FSET(sc, F_RX_FIRST); 804 top->m_pkthdr.rcvif = &sc->arpcom.ac_if; 805 top->m_pkthdr.len = sc->cur_len; 806 --- 123 unchanged lines hidden (view full) --- 930} 931 932static void 933ep_if_watchdog(struct ifnet *ifp) 934{ 935 struct ep_softc *sc = ifp->if_softc; 936 937/* |
916 printf("ep: watchdog\n"); | 938 printf("ep: watchdog\n"); |
917 918 log(LOG_ERR, "ep%d: watchdog\n", ifp->if_unit); 919 ifp->if_oerrors++; 920*/ 921 922 if (sc->gone) 923 return; 924 ifp->if_flags &= ~IFF_OACTIVE; --- 27 unchanged lines hidden --- | 939 940 log(LOG_ERR, "ep%d: watchdog\n", ifp->if_unit); 941 ifp->if_oerrors++; 942*/ 943 944 if (sc->gone) 945 return; 946 ifp->if_flags &= ~IFF_OACTIVE; --- 27 unchanged lines hidden --- |