[Midnightbsd-cvs] src [10038] trunk/sys/dev/vr: sync vr
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun May 27 18:28:04 EDT 2018
Revision: 10038
http://svnweb.midnightbsd.org/src/?rev=10038
Author: laffer1
Date: 2018-05-27 18:28:03 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync vr
Modified Paths:
--------------
trunk/sys/dev/vr/if_vr.c
trunk/sys/dev/vr/if_vrreg.h
Modified: trunk/sys/dev/vr/if_vr.c
===================================================================
--- trunk/sys/dev/vr/if_vr.c 2018-05-27 22:27:38 UTC (rev 10037)
+++ trunk/sys/dev/vr/if_vr.c 2018-05-27 22:28:03 UTC (rev 10038)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997, 1998
* Bill Paul <wpaul at ctr.columbia.edu>. All rights reserved.
@@ -31,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/vr/if_vr.c 243857 2012-12-04 09:32:43Z glebius $");
/*
* VIA Rhine fast ethernet PCI NIC driver
@@ -165,7 +166,8 @@
static void vr_tick(void *);
static int vr_error(struct vr_softc *, uint16_t);
static void vr_tx_underrun(struct vr_softc *);
-static void vr_intr(void *);
+static int vr_intr(void *);
+static void vr_int_task(void *, int);
static void vr_start(struct ifnet *);
static void vr_start_locked(struct ifnet *);
static int vr_encap(struct vr_softc *, struct mbuf **);
@@ -658,6 +660,8 @@
ifp->if_snd.ifq_maxlen = VR_TX_RING_CNT - 1;
IFQ_SET_READY(&ifp->if_snd);
+ TASK_INIT(&sc->vr_inttask, 0, vr_int_task, sc);
+
/* Configure Tx FIFO threshold. */
sc->vr_txthresh = VR_TXTHRESH_MIN;
if (sc->vr_revid < REV_ID_VT6105_A0) {
@@ -784,7 +788,7 @@
/* Hook interrupt last to avoid having to lock softc. */
error = bus_setup_intr(dev, sc->vr_irq, INTR_TYPE_NET | INTR_MPSAFE,
- NULL, vr_intr, sc, &sc->vr_intrhand);
+ vr_intr, NULL, sc, &sc->vr_intrhand);
if (error) {
device_printf(dev, "couldn't set up irq\n");
@@ -826,6 +830,7 @@
vr_stop(sc);
VR_UNLOCK(sc);
callout_drain(&sc->vr_stat_callout);
+ taskqueue_drain(taskqueue_fast, &sc->vr_inttask);
ether_ifdetach(ifp);
}
if (sc->vr_miibus)
@@ -1653,10 +1658,30 @@
vr_tx_start(sc);
}
-static void
+static int
vr_intr(void *arg)
{
struct vr_softc *sc;
+ uint16_t status;
+
+ sc = (struct vr_softc *)arg;
+
+ status = CSR_READ_2(sc, VR_ISR);
+ if (status == 0 || status == 0xffff || (status & VR_INTRS) == 0)
+ return (FILTER_STRAY);
+
+ /* Disable interrupts. */
+ CSR_WRITE_2(sc, VR_IMR, 0x0000);
+
+ taskqueue_enqueue_fast(taskqueue_fast, &sc->vr_inttask);
+
+ return (FILTER_HANDLED);
+}
+
+static void
+vr_int_task(void *arg, int npending)
+{
+ struct vr_softc *sc;
struct ifnet *ifp;
uint16_t status;
@@ -1668,9 +1693,6 @@
goto done_locked;
status = CSR_READ_2(sc, VR_ISR);
- if (status == 0 || status == 0xffff || (status & VR_INTRS) == 0)
- goto done_locked;
-
ifp = sc->vr_ifp;
#ifdef DEVICE_POLLING
if ((ifp->if_capenable & IFCAP_POLLING) != 0)
@@ -1685,9 +1707,6 @@
goto done_locked;
}
- /* Disable interrupts. */
- CSR_WRITE_2(sc, VR_IMR, 0x0000);
-
for (; (status & VR_INTRS) != 0;) {
CSR_WRITE_2(sc, VR_ISR, status);
if ((status & (VR_ISR_BUSERR | VR_ISR_LINKSTAT2 |
@@ -1707,6 +1726,10 @@
vr_rx_start(sc);
}
vr_txeof(sc);
+
+ if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+ vr_start_locked(ifp);
+
status = CSR_READ_2(sc, VR_ISR);
}
@@ -1713,9 +1736,6 @@
/* Re-enable interrupts. */
CSR_WRITE_2(sc, VR_IMR, VR_INTRS);
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- vr_start_locked(ifp);
-
done_locked:
VR_UNLOCK(sc);
}
Modified: trunk/sys/dev/vr/if_vrreg.h
===================================================================
--- trunk/sys/dev/vr/if_vrreg.h 2018-05-27 22:27:38 UTC (rev 10037)
+++ trunk/sys/dev/vr/if_vrreg.h 2018-05-27 22:28:03 UTC (rev 10038)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997, 1998
* Bill Paul <wpaul at ctr.columbia.edu>. All rights reserved.
@@ -29,7 +30,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/vr/if_vrreg.h 235334 2012-05-12 14:37:25Z rpaulo $
*/
/*
@@ -738,6 +739,7 @@
#ifdef DEVICE_POLLING
int rxcycles;
#endif
+ struct task vr_inttask;
};
#define VR_LOCK(_sc) mtx_lock(&(_sc)->vr_mtx)
More information about the Midnightbsd-cvs
mailing list