From owner-p4-projects@FreeBSD.ORG Fri Jul 14 11:10:05 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E631416A4E1; Fri, 14 Jul 2006 11:10:04 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9072B16A4DE for ; Fri, 14 Jul 2006 11:10:04 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1523C43D4C for ; Fri, 14 Jul 2006 11:10:04 +0000 (GMT) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6EBA3fH070455 for ; Fri, 14 Jul 2006 11:10:03 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6EBA3u2070452 for perforce@freebsd.org; Fri, 14 Jul 2006 11:10:03 GMT (envelope-from piso@freebsd.org) Date: Fri, 14 Jul 2006 11:10:03 GMT Message-Id: <200607141110.k6EBA3u2070452@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to piso@freebsd.org using -f From: Paolo Pisati To: Perforce Change Reviews Cc: Subject: PERFORCE change 101538 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2006 11:10:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=101538 Change 101538 by piso@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;