PERFORCE change 101538 for review

Paolo Pisati piso at FreeBSD.org
Fri Jul 14 11:10:05 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=101538

Change 101538 by piso at piso_newluxor on 2006/07/14 11:09:25

	Convert em to use system's interrupt filter framework
	instead of private taskqueue. 

Affected files ...

.. //depot/projects/soc2006/intr_filter/dev/em/if_em.c#6 edit
.. //depot/projects/soc2006/intr_filter/dev/em/if_em.h#2 edit

Differences ...

==== //depot/projects/soc2006/intr_filter/dev/em/if_em.c#6 (text+ko) ====

@@ -260,7 +260,7 @@
 static int	em_intr_fast(void *);
 static void	em_add_int_process_limit(struct em_softc *, const char *,
 		const char *, int *, int);
-static void	em_handle_rxtx(void *context, int pending);
+static void	em_handle_rxtx(void *context);
 static void	em_handle_link(void *context, int pending);
 #endif
 
@@ -1170,7 +1170,7 @@
 }
 
 static void
-em_handle_rxtx(void *context, int pending)
+em_handle_rxtx(void *context)
 {
 	struct em_softc	*sc = context;
 	struct ifnet	*ifp;
@@ -1183,8 +1183,7 @@
 	 * It should be possible to run the tx clean loop without the lock.
 	 */
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-		if (em_rxeof(sc, sc->rx_process_limit) != 0)
-			taskqueue_enqueue(sc->tq, &sc->rxtx_task);
+		em_rxeof(sc, sc->rx_process_limit);
 		EM_LOCK(sc);
 		em_txeof(sc);
 
@@ -1215,11 +1214,11 @@
 
 	/* Hot eject?  */
 	if (reg_icr == 0xffffffff)
-		return(FILTER_STRAY);
+		return (FILTER_STRAY);
 
 	/* Definitely not our interrupt.  */
 	if (reg_icr == 0x0)
-		return(FILTER_STRAY);
+		return (FILTER_STRAY);
 
 	/*
 	 * Starting with the 82571 chip, bit 31 should be used to
@@ -1227,7 +1226,7 @@
 	 */
 	if (sc->hw.mac_type >= em_82571 &&
 	    (reg_icr & E1000_ICR_INT_ASSERTED) == 0)
-		return(FILTER_STRAY);
+		return (FILTER_STRAY);
 
 	/*
 	 * Mask interrupts until the taskqueue is finished running.  This is
@@ -1235,7 +1234,6 @@
 	 * MSI message reordering errata on certain systems.
 	 */
 	em_disable_intr(sc);
-	taskqueue_enqueue(sc->tq, &sc->rxtx_task);
 
 	/* Link status change */
 	if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))
@@ -1243,7 +1241,7 @@
 
 	if (reg_icr & E1000_ICR_RXO)
 		sc->rx_overruns++;
-	return(FILTER_HANDLED);
+	return (FILTER_HANDLED | FILTER_SCHEDULE_THREAD);
 }
 #endif /* ! DEVICE_POLLING */
 
@@ -1986,19 +1984,12 @@
 	 * Try allocating a fast interrupt and the associated deferred
 	 * processing contexts.
 	 */
-	TASK_INIT(&sc->rxtx_task, 0, em_handle_rxtx, sc);
 	TASK_INIT(&sc->link_task, 0, em_handle_link, sc);
-	sc->tq = taskqueue_create_fast("em_taskq", M_NOWAIT,
-	    taskqueue_thread_enqueue, &sc->tq);
-	taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq",
-	    device_get_nameunit(sc->dev));
 	if ((error = bus_setup_intr(dev, sc->res_interrupt,
-	    INTR_TYPE_NET | INTR_FAST, em_intr_fast, NULL, sc,
+	    INTR_TYPE_NET | INTR_FAST, em_intr_fast, em_handle_rxtx, sc,
 	    &sc->int_handler_tag)) != 0) {
 		device_printf(dev, "Failed to register fast interrupt "
 			    "handler: %d\n", error);
-		taskqueue_free(sc->tq);
-		sc->tq = NULL;
 		return (error);
 	}
 #endif
@@ -2016,12 +2007,7 @@
 		bus_teardown_intr(dev, sc->res_interrupt, sc->int_handler_tag);
 		sc->int_handler_tag = NULL;
 	}
-	if (sc->tq != NULL) {
-		taskqueue_drain(sc->tq, &sc->rxtx_task);
-		taskqueue_drain(taskqueue_fast, &sc->link_task);
-		taskqueue_free(sc->tq);
-		sc->tq = NULL;
-	}
+	taskqueue_drain(taskqueue_fast, &sc->link_task);
 }
 
 static void

==== //depot/projects/soc2006/intr_filter/dev/em/if_em.h#2 (text+ko) ====

@@ -262,8 +262,6 @@
 	struct mtx	mtx;
 	int		em_insert_vlan_header;
 	struct task	link_task;
-	struct task	rxtx_task;
-	struct taskqueue *tq;		/* private task queue */
 
 	/* Info about the board itself */
 	uint32_t	part_num;


More information about the p4-projects mailing list