if_nve.c (158651) | if_nve.c (158735) |
---|---|
1/*- 2 * Copyright (c) 2005 by David E. O'Brien <obrien@FreeBSD.org>. 3 * Copyright (c) 2003,2004 by Quinton Dolan <q@onthenet.com.au>. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 58 unchanged lines hidden (view full) --- 67 * as recent versions of DragonFly. 68 * 69 * Written by Quinton Dolan <q@onthenet.com.au> 70 * Portions based on existing FreeBSD network drivers. 71 * NVIDIA API usage derived from distributed NVIDIA NVNET driver source files. 72 */ 73 74#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005 by David E. O'Brien <obrien@FreeBSD.org>. 3 * Copyright (c) 2003,2004 by Quinton Dolan <q@onthenet.com.au>. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 58 unchanged lines hidden (view full) --- 67 * as recent versions of DragonFly. 68 * 69 * Written by Quinton Dolan <q@onthenet.com.au> 70 * Portions based on existing FreeBSD network drivers. 71 * NVIDIA API usage derived from distributed NVIDIA NVNET driver source files. 72 */ 73 74#include <sys/cdefs.h> |
75__FBSDID("$FreeBSD: head/sys/dev/nve/if_nve.c 158651 2006-05-16 14:37:58Z phk $"); | 75__FBSDID("$FreeBSD: head/sys/dev/nve/if_nve.c 158735 2006-05-18 23:19:44Z jhb $"); |
76 77#include <sys/param.h> 78#include <sys/systm.h> 79#include <sys/sockio.h> 80#include <sys/mbuf.h> 81#include <sys/malloc.h> 82#include <sys/kernel.h> 83#include <sys/socket.h> --- 783 unchanged lines hidden (view full) --- 867 868 /* Get next packet to send. */ 869 IF_DEQUEUE(&ifp->if_snd, m0); 870 871 /* If nothing to send, return. */ 872 if (m0 == NULL) 873 return; 874 | 76 77#include <sys/param.h> 78#include <sys/systm.h> 79#include <sys/sockio.h> 80#include <sys/mbuf.h> 81#include <sys/malloc.h> 82#include <sys/kernel.h> 83#include <sys/socket.h> --- 783 unchanged lines hidden (view full) --- 867 868 /* Get next packet to send. */ 869 IF_DEQUEUE(&ifp->if_snd, m0); 870 871 /* If nothing to send, return. */ 872 if (m0 == NULL) 873 return; 874 |
875 /* 876 * On nForce4, the chip doesn't interrupt on transmit, 877 * so try to flush transmitted packets from the queue 878 * if it's getting large (see note in nve_watchdog). 879 */ 880 if (sc->pending_txs > TX_RING_SIZE/2) { 881 sc->hwapi->pfnDisableInterrupts(sc->hwapi->pADCX); 882 sc->hwapi->pfnHandleInterrupt(sc->hwapi->pADCX); 883 sc->hwapi->pfnEnableInterrupts(sc->hwapi->pADCX); 884 } 885 |
|
875 /* Map MBUF for DMA access */ 876 error = bus_dmamap_load_mbuf(sc->mtag, buf->map, m0, 877 nve_dmamap_tx_cb, desc, BUS_DMA_NOWAIT); 878 879 if (error && error != EFBIG) { 880 m_freem(m0); 881 sc->tx_errors++; 882 continue; --- 387 unchanged lines hidden (view full) --- 1270 return; 1271} 1272 1273/* Watchdog timer to prevent PHY lockups */ 1274static void 1275nve_watchdog(struct ifnet *ifp) 1276{ 1277 struct nve_softc *sc = ifp->if_softc; | 886 /* Map MBUF for DMA access */ 887 error = bus_dmamap_load_mbuf(sc->mtag, buf->map, m0, 888 nve_dmamap_tx_cb, desc, BUS_DMA_NOWAIT); 889 890 if (error && error != EFBIG) { 891 m_freem(m0); 892 sc->tx_errors++; 893 continue; --- 387 unchanged lines hidden (view full) --- 1281 return; 1282} 1283 1284/* Watchdog timer to prevent PHY lockups */ 1285static void 1286nve_watchdog(struct ifnet *ifp) 1287{ 1288 struct nve_softc *sc = ifp->if_softc; |
1289 int pending_txs_start; |
|
1278 1279 NVE_LOCK(sc); 1280 1281 /* 1282 * The nvidia driver blob defers tx completion notifications. 1283 * Thus, sometimes the watchdog timer will go off when the 1284 * tx engine is fine, but the tx completions are just deferred. 1285 * Try kicking the driver blob to clear out any pending tx | 1290 1291 NVE_LOCK(sc); 1292 1293 /* 1294 * The nvidia driver blob defers tx completion notifications. 1295 * Thus, sometimes the watchdog timer will go off when the 1296 * tx engine is fine, but the tx completions are just deferred. 1297 * Try kicking the driver blob to clear out any pending tx |
1286 * completions. If that clears up all the pending tx | 1298 * completions. If that clears up any of the pending tx |
1287 * operations, then just return without printing the warning | 1299 * operations, then just return without printing the warning |
1288 * message or resetting the adapter. | 1300 * message or resetting the adapter, as we can then conclude 1301 * the chip hasn't actually crashed (it's still sending packets). |
1289 */ | 1302 */ |
1303 pending_txs_start = sc->pending_txs; |
|
1290 sc->hwapi->pfnDisableInterrupts(sc->hwapi->pADCX); 1291 sc->hwapi->pfnHandleInterrupt(sc->hwapi->pADCX); 1292 sc->hwapi->pfnEnableInterrupts(sc->hwapi->pADCX); | 1304 sc->hwapi->pfnDisableInterrupts(sc->hwapi->pADCX); 1305 sc->hwapi->pfnHandleInterrupt(sc->hwapi->pADCX); 1306 sc->hwapi->pfnEnableInterrupts(sc->hwapi->pADCX); |
1293 if (sc->pending_txs == 0) { | 1307 if (sc->pending_txs < pending_txs_start) { |
1294 NVE_UNLOCK(sc); 1295 return; 1296 } 1297 1298 device_printf(sc->dev, "device timeout (%d)\n", sc->pending_txs); 1299 1300 sc->tx_errors++; 1301 --- 460 unchanged lines hidden --- | 1308 NVE_UNLOCK(sc); 1309 return; 1310 } 1311 1312 device_printf(sc->dev, "device timeout (%d)\n", sc->pending_txs); 1313 1314 sc->tx_errors++; 1315 --- 460 unchanged lines hidden --- |