From owner-p4-projects@FreeBSD.ORG Thu Jan 5 19:54:11 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 8B25516A423; Thu, 5 Jan 2006 19:54:10 +0000 (GMT) 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 4611516A420 for ; Thu, 5 Jan 2006 19:54:10 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 018BB43D91 for ; Thu, 5 Jan 2006 19:54:00 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k05Js03e033196 for ; Thu, 5 Jan 2006 19:54:00 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k05Js0VL033187 for perforce@freebsd.org; Thu, 5 Jan 2006 19:54:00 GMT (envelope-from kmacy@freebsd.org) Date: Thu, 5 Jan 2006 19:54:00 GMT Message-Id: <200601051954.k05Js0VL033187@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 89228 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: Thu, 05 Jan 2006 19:54:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=89228 Change 89228 by kmacy@kmacy:freebsd7_xen3 on 2006/01/05 19:53:06 fix networking performance problems: xn_start needs to be called from xn_intr rx.sring->rsp_event needs to be reset or we won't get interrupts on receive Affected files ... .. //depot/projects/xen3/src/sys/dev/xen/netfront/netfront.c#3 edit Differences ... ==== //depot/projects/xen3/src/sys/dev/xen/netfront/netfront.c#3 (text+ko) ==== @@ -521,10 +521,7 @@ info->irq = bind_evtchn_to_irqhandler( info->evtchn, "xn", xn_intr, info, INTR_TYPE_NET | INTR_MPSAFE); -#if 0 - /* XXX need this for re-location to work well */ - (void)send_fake_arp(netdev); -#endif + show_device(info); return 0; @@ -676,6 +673,7 @@ rx_mcl[i].args[0] = (unsigned long)mtod(m_new,vm_offset_t); rx_mcl[i].args[1] = 0; rx_mcl[i].args[2] = 0; + rx_mcl[i].args[2] = 0; } @@ -750,7 +748,7 @@ rx = RING_GET_RESPONSE(&np->rx, i); KASSERT(rx->id != 0, ("xn_rxeof: found free receive index of 0\n")); - /* + /* * This definitely indicates a bug, either in this driver or * in the backend driver. In future this should flag the bad * situation to the system controller to reboot the backed. @@ -862,6 +860,8 @@ network_alloc_rx_buffers(np); + np->rx.sring->rsp_event = i + 1; + } static void @@ -943,27 +943,24 @@ { struct netfront_info *np = xsc; struct ifnet *ifp = np->xn_ifp; - TRACE_ENTER; - /* XXX this seems like a recipe for poor performance if not livelock */ - XN_RX_LOCK(np); - - /* sometimes we seem to lose packets. stay in the interrupt handler while - * there is stuff to process: continually recheck the response producer. - */ - do { - if (np->rx.rsp_cons != np->rx.sring->rsp_prod && - np->user_state == UST_OPEN) - xn_rxeof(np); - - } while (np->rx.rsp_cons != np->rx.sring->rsp_prod && - np->user_state == UST_OPEN); - - XN_RX_UNLOCK(np); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - xn_start(ifp); + while (np->rx.rsp_cons != np->rx.sring->rsp_prod && + np->user_state == UST_OPEN && + ifp->if_drv_flags & IFF_DRV_RUNNING) { + + XN_RX_LOCK(np); + xn_rxeof(np); + XN_RX_UNLOCK(np); + if (np->tx.rsp_cons != np->tx.sring->rsp_prod) { + XN_TX_LOCK(np); + xn_txeof(np); + XN_TX_UNLOCK(np); + } + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + xn_start(ifp); + } return; } @@ -1057,6 +1054,7 @@ RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&sc->tx, notify); if (notify) notify_remote_via_irq(sc->irq); + xn_txeof(sc); if (RING_FULL(&sc->tx)) {