Deleted Added
full compact
if_wl.c (257176) if_wl.c (271849)
1/*-
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that the following conditions
4 * are met:
5 * 1. Redistributions of source code must retain all copyright
6 * notices, this list of conditions and the following disclaimer.
7 * 2. The names of the authors may not be used to endorse or promote products
8 * derived from this software without specific prior written permission

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

168IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
169CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
170LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
171NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
172WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
173*/
174
175#include <sys/cdefs.h>
1/*-
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that the following conditions
4 * are met:
5 * 1. Redistributions of source code must retain all copyright
6 * notices, this list of conditions and the following disclaimer.
7 * 2. The names of the authors may not be used to endorse or promote products
8 * derived from this software without specific prior written permission

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

168IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
169CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
170LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
171NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
172WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
173*/
174
175#include <sys/cdefs.h>
176__FBSDID("$FreeBSD: head/sys/dev/wl/if_wl.c 257176 2013-10-26 17:58:36Z glebius $");
176__FBSDID("$FreeBSD: head/sys/dev/wl/if_wl.c 271849 2014-09-19 03:51:26Z glebius $");
177
178/*
179 * NOTE:
180 * by rvb:
181 * 1. The best book on the 82586 is:
182 * LAN Components User's Manual by Intel
183 * The copy I found was dated 1984. This really tells you
184 * what the state machines are doing

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

1017 BPF_MTAP(ifp, m);
1018 sc->tbusy++;
1019 /* set the watchdog timer so that if the board
1020 * fails to interrupt we will restart
1021 */
1022 /* try 10 ticks, not very long */
1023 sc->watchdog_ch = timeout(wlwatchdog, sc, 10);
1024 sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
177
178/*
179 * NOTE:
180 * by rvb:
181 * 1. The best book on the 82586 is:
182 * LAN Components User's Manual by Intel
183 * The copy I found was dated 1984. This really tells you
184 * what the state machines are doing

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

1017 BPF_MTAP(ifp, m);
1018 sc->tbusy++;
1019 /* set the watchdog timer so that if the board
1020 * fails to interrupt we will restart
1021 */
1022 /* try 10 ticks, not very long */
1023 sc->watchdog_ch = timeout(wlwatchdog, sc, 10);
1024 sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1025 sc->ifp->if_opackets++;
1025 if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1);
1026 wlxmt(sc, m);
1027 } else {
1028 sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1029 }
1030 WL_UNLOCK(sc);
1031 return;
1032}
1033

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

1473static void
1474wlwatchdog(void *vsc)
1475{
1476 struct wl_softc *sc = vsc;
1477 int unit = sc->unit;
1478
1479 log(LOG_ERR, "wl%d: wavelan device timeout on xmit\n", unit);
1480 WL_LOCK(sc);
1026 wlxmt(sc, m);
1027 } else {
1028 sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1029 }
1030 WL_UNLOCK(sc);
1031 return;
1032}
1033

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

1473static void
1474wlwatchdog(void *vsc)
1475{
1476 struct wl_softc *sc = vsc;
1477 int unit = sc->unit;
1478
1479 log(LOG_ERR, "wl%d: wavelan device timeout on xmit\n", unit);
1480 WL_LOCK(sc);
1481 sc->ifp->if_oerrors++;
1481 if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
1482 wlinit(sc);
1483 WL_UNLOCK(sc);
1484}
1485
1486/*
1487 * wlintr:
1488 *
1489 * This function is the interrupt handler for the WaveLAN

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

1537 if ((int_type & int_type1) != int_type)
1538 printf("wlack() int bits disappeared : %04x != int_type %04x\n",
1539 int_type1, int_type);
1540 int_type = int_type1; /* go with the new status */
1541 /*
1542 * incoming packet
1543 */
1544 if (int_type & SCB_SW_FR) {
1482 wlinit(sc);
1483 WL_UNLOCK(sc);
1484}
1485
1486/*
1487 * wlintr:
1488 *
1489 * This function is the interrupt handler for the WaveLAN

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

1537 if ((int_type & int_type1) != int_type)
1538 printf("wlack() int bits disappeared : %04x != int_type %04x\n",
1539 int_type1, int_type);
1540 int_type = int_type1; /* go with the new status */
1541 /*
1542 * incoming packet
1543 */
1544 if (int_type & SCB_SW_FR) {
1545 sc->ifp->if_ipackets++;
1545 if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1);
1546 wlrcv(sc);
1547 }
1548 /*
1549 * receiver not ready
1550 */
1551 if (int_type & SCB_SW_RNR) {
1546 wlrcv(sc);
1547 }
1548 /*
1549 * receiver not ready
1550 */
1551 if (int_type & SCB_SW_RNR) {
1552 sc->ifp->if_ierrors++;
1552 if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1);
1553#ifdef WLDEBUG
1554 if (sc->ifp->if_flags & IFF_DEBUG)
1555 printf("wl%d intr(): receiver overrun! begin_fd = %x\n",
1556 sc->unit, sc->begin_fd);
1557#endif
1558 wlrustrt(sc);
1559 }
1560 /*

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

1605 }
1606 if (ac_status & TC_COLLISION) {
1607 printf("wl%d: too many collisions\n", sc->unit);
1608 }
1609 }
1610 /* if the transmit actually failed, or returned some status */
1611 if ((!(ac_status & AC_SW_OK)) || (ac_status & 0xfff)) {
1612 if (ac_status & (TC_COLLISION | TC_CLS | TC_DMA)) {
1553#ifdef WLDEBUG
1554 if (sc->ifp->if_flags & IFF_DEBUG)
1555 printf("wl%d intr(): receiver overrun! begin_fd = %x\n",
1556 sc->unit, sc->begin_fd);
1557#endif
1558 wlrustrt(sc);
1559 }
1560 /*

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

1605 }
1606 if (ac_status & TC_COLLISION) {
1607 printf("wl%d: too many collisions\n", sc->unit);
1608 }
1609 }
1610 /* if the transmit actually failed, or returned some status */
1611 if ((!(ac_status & AC_SW_OK)) || (ac_status & 0xfff)) {
1612 if (ac_status & (TC_COLLISION | TC_CLS | TC_DMA)) {
1613 sc->ifp->if_oerrors++;
1613 if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
1614 }
1615 /* count collisions */
1614 }
1615 /* count collisions */
1616 sc->ifp->if_collisions += (ac_status & 0xf);
1616 if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, (ac_status & 0xf));
1617 /* if TC_COLLISION set and collision count zero, 16 collisions */
1618 if ((ac_status & 0x20) == 0x20) {
1617 /* if TC_COLLISION set and collision count zero, 16 collisions */
1618 if ((ac_status & 0x20) == 0x20) {
1619 sc->ifp->if_collisions += 0x10;
1619 if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, 0x10);
1620 }
1621 }
1622 sc->tbusy = 0;
1623 untimeout(wlwatchdog, sc, sc->watchdog_ch);
1624 sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1625 wlstart(sc->ifp);
1626 }
1627 }

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

1666 return;
1667 } else if (status & AC_SW_C) {
1668 if (status == (RFD_DONE|RFD_RSC)) {
1669 /* lost one */
1670#ifdef WLDEBUG
1671 if (sc->ifp->if_flags & IFF_DEBUG)
1672 printf("wl%d RCV: RSC %x\n", sc->unit, status);
1673#endif
1620 }
1621 }
1622 sc->tbusy = 0;
1623 untimeout(wlwatchdog, sc, sc->watchdog_ch);
1624 sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1625 wlstart(sc->ifp);
1626 }
1627 }

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

1666 return;
1667 } else if (status & AC_SW_C) {
1668 if (status == (RFD_DONE|RFD_RSC)) {
1669 /* lost one */
1670#ifdef WLDEBUG
1671 if (sc->ifp->if_flags & IFF_DEBUG)
1672 printf("wl%d RCV: RSC %x\n", sc->unit, status);
1673#endif
1674 sc->ifp->if_ierrors++;
1674 if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1);
1675 } else if (!(status & RFD_OK)) {
1676 printf("wl%d RCV: !OK %x\n", sc->unit, status);
1675 } else if (!(status & RFD_OK)) {
1676 printf("wl%d RCV: !OK %x\n", sc->unit, status);
1677 sc->ifp->if_ierrors++;
1677 if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1);
1678 } else if (status & 0xfff) { /* can't happen */
1679 printf("wl%d RCV: ERRs %x\n", sc->unit, status);
1678 } else if (status & 0xfff) { /* can't happen */
1679 printf("wl%d RCV: ERRs %x\n", sc->unit, status);
1680 sc->ifp->if_ierrors++;
1680 if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1);
1681 } else if (!wlread(sc, fd_p))
1682 return;
1683
1684 if (!wlrequeue(sc, fd_p)) {
1685 /* abort on chain error */
1686 if (wlhwrst(sc) != TRUE)
1687 printf("wl%d rcv(): hwrst trouble.\n", sc->unit);
1688 return;

--- 956 unchanged lines hidden ---
1681 } else if (!wlread(sc, fd_p))
1682 return;
1683
1684 if (!wlrequeue(sc, fd_p)) {
1685 /* abort on chain error */
1686 if (wlhwrst(sc) != TRUE)
1687 printf("wl%d rcv(): hwrst trouble.\n", sc->unit);
1688 return;

--- 956 unchanged lines hidden ---