Deleted Added
full compact
if_nfe.c (173377) if_nfe.c (173674)
1/* $OpenBSD: if_nfe.c,v 1.54 2006/04/07 12:38:12 jsg Exp $ */
2
3/*-
4 * Copyright (c) 2006 Shigeaki Tagashira <shigeaki@se.hiroshima-u.ac.jp>
5 * Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr>
6 * Copyright (c) 2005, 2006 Jonathan Gray <jsg@openbsd.org>
7 *
8 * Permission to use, copy, modify, and distribute this software for any

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

16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */
20
21/* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
22
23#include <sys/cdefs.h>
1/* $OpenBSD: if_nfe.c,v 1.54 2006/04/07 12:38:12 jsg Exp $ */
2
3/*-
4 * Copyright (c) 2006 Shigeaki Tagashira <shigeaki@se.hiroshima-u.ac.jp>
5 * Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr>
6 * Copyright (c) 2005, 2006 Jonathan Gray <jsg@openbsd.org>
7 *
8 * Permission to use, copy, modify, and distribute this software for any

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

16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */
20
21/* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
22
23#include <sys/cdefs.h>
24__FBSDID("$FreeBSD: head/sys/dev/nfe/if_nfe.c 173377 2007-11-06 01:01:38Z yongari $");
24__FBSDID("$FreeBSD: head/sys/dev/nfe/if_nfe.c 173674 2007-11-16 15:51:47Z sam $");
25
26#ifdef HAVE_KERNEL_OPTION_HEADERS
27#include "opt_device_polling.h"
28#endif
29
30#include <sys/param.h>
31#include <sys/endian.h>
32#include <sys/systm.h>

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

1684 }
1685
1686 if (sc->nfe_framesize > MCLBYTES - ETHER_HDR_LEN)
1687 nfe_jrxeof(sc, count);
1688 else
1689 nfe_rxeof(sc, count);
1690 nfe_txeof(sc);
1691 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
25
26#ifdef HAVE_KERNEL_OPTION_HEADERS
27#include "opt_device_polling.h"
28#endif
29
30#include <sys/param.h>
31#include <sys/endian.h>
32#include <sys/systm.h>

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

1684 }
1685
1686 if (sc->nfe_framesize > MCLBYTES - ETHER_HDR_LEN)
1687 nfe_jrxeof(sc, count);
1688 else
1689 nfe_rxeof(sc, count);
1690 nfe_txeof(sc);
1691 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1692 taskqueue_enqueue_fast(taskqueue_fast, &sc->nfe_tx_task);
1692 taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_tx_task);
1693
1694 if (cmd == POLL_AND_CHECK_STATUS) {
1695 if ((r = NFE_READ(sc, sc->nfe_irq_status)) == 0) {
1696 NFE_UNLOCK(sc);
1697 return;
1698 }
1699 NFE_WRITE(sc, sc->nfe_irq_status, r);
1700

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

1893 uint32_t status;
1894
1895 sc = (struct nfe_softc *)arg;
1896
1897 status = NFE_READ(sc, sc->nfe_irq_status);
1898 if (status == 0 || status == 0xffffffff)
1899 return (FILTER_STRAY);
1900 nfe_disable_intr(sc);
1693
1694 if (cmd == POLL_AND_CHECK_STATUS) {
1695 if ((r = NFE_READ(sc, sc->nfe_irq_status)) == 0) {
1696 NFE_UNLOCK(sc);
1697 return;
1698 }
1699 NFE_WRITE(sc, sc->nfe_irq_status, r);
1700

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

1893 uint32_t status;
1894
1895 sc = (struct nfe_softc *)arg;
1896
1897 status = NFE_READ(sc, sc->nfe_irq_status);
1898 if (status == 0 || status == 0xffffffff)
1899 return (FILTER_STRAY);
1900 nfe_disable_intr(sc);
1901 taskqueue_enqueue_fast(taskqueue_fast, &sc->nfe_int_task);
1901 taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_int_task);
1902
1903 return (FILTER_HANDLED);
1904}
1905
1906
1907static void
1908nfe_int_task(void *arg, int pending)
1909{

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

1947 if (sc->nfe_framesize > MCLBYTES - ETHER_HDR_LEN)
1948 domore = nfe_jrxeof(sc, sc->nfe_process_limit);
1949 else
1950 domore = nfe_rxeof(sc, sc->nfe_process_limit);
1951 /* check Tx ring */
1952 nfe_txeof(sc);
1953
1954 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1902
1903 return (FILTER_HANDLED);
1904}
1905
1906
1907static void
1908nfe_int_task(void *arg, int pending)
1909{

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

1947 if (sc->nfe_framesize > MCLBYTES - ETHER_HDR_LEN)
1948 domore = nfe_jrxeof(sc, sc->nfe_process_limit);
1949 else
1950 domore = nfe_rxeof(sc, sc->nfe_process_limit);
1951 /* check Tx ring */
1952 nfe_txeof(sc);
1953
1954 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1955 taskqueue_enqueue_fast(taskqueue_fast, &sc->nfe_tx_task);
1955 taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_tx_task);
1956
1957 NFE_UNLOCK(sc);
1958
1959 if (domore || (NFE_READ(sc, sc->nfe_irq_status) != 0)) {
1956
1957 NFE_UNLOCK(sc);
1958
1959 if (domore || (NFE_READ(sc, sc->nfe_irq_status) != 0)) {
1960 taskqueue_enqueue_fast(taskqueue_fast, &sc->nfe_int_task);
1960 taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_int_task);
1961 return;
1962 }
1963
1964 /* Reenable interrupts. */
1965 nfe_enable_intr(sc);
1966}
1967
1968

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

2803 return;
2804
2805 /* Check if we've lost Tx completion interrupt. */
2806 nfe_txeof(sc);
2807 if (sc->txq.queued == 0) {
2808 if_printf(ifp, "watchdog timeout (missed Tx interrupts) "
2809 "-- recovering\n");
2810 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1961 return;
1962 }
1963
1964 /* Reenable interrupts. */
1965 nfe_enable_intr(sc);
1966}
1967
1968

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

2803 return;
2804
2805 /* Check if we've lost Tx completion interrupt. */
2806 nfe_txeof(sc);
2807 if (sc->txq.queued == 0) {
2808 if_printf(ifp, "watchdog timeout (missed Tx interrupts) "
2809 "-- recovering\n");
2810 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
2811 taskqueue_enqueue_fast(taskqueue_fast,
2812 &sc->nfe_tx_task);
2811 taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_tx_task);
2813 return;
2814 }
2815 /* Check if we've lost start Tx command. */
2816 sc->nfe_force_tx++;
2817 if (sc->nfe_force_tx <= 3) {
2818 /*
2819 * If this is the case for watchdog timeout, the following
2820 * code should go to nfe_txeof().

--- 398 unchanged lines hidden ---
2812 return;
2813 }
2814 /* Check if we've lost start Tx command. */
2815 sc->nfe_force_tx++;
2816 if (sc->nfe_force_tx <= 3) {
2817 /*
2818 * If this is the case for watchdog timeout, the following
2819 * code should go to nfe_txeof().

--- 398 unchanged lines hidden ---