From owner-p4-projects@FreeBSD.ORG Wed Sep 5 20:59:41 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 06D0616A41B; Wed, 5 Sep 2007 20:59:41 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD26D16A417 for ; Wed, 5 Sep 2007 20:59:40 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B382413C457 for ; Wed, 5 Sep 2007 20:59:40 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l85KxeE0006860 for ; Wed, 5 Sep 2007 20:59:40 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l85Kxe6p006857 for perforce@freebsd.org; Wed, 5 Sep 2007 20:59:40 GMT (envelope-from zec@FreeBSD.org) Date: Wed, 5 Sep 2007 20:59:40 GMT Message-Id: <200709052059.l85Kxe6p006857@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 126104 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: Wed, 05 Sep 2007 20:59:41 -0000 http://perforce.freebsd.org/chv.cgi?CH=126104 Change 126104 by zec@zec_tpx32 on 2007/09/05 20:58:48 Set / restore vnet context when pipe_dequeue() is invoked via a timer. While here, clean up some obsolete fields in struct hookinfo and a few chode chunks previously used by RED code which is not present in this version of ng_pipe. Affected files ... .. //depot/projects/vimage/src/sys/netgraph/ng_pipe.c#3 edit Differences ... ==== //depot/projects/vimage/src/sys/netgraph/ng_pipe.c#3 (text+ko) ==== @@ -36,6 +36,8 @@ * both directions can be set separately, except for delay. */ +#include "opt_vimage.h" + #include #include #include @@ -43,6 +45,7 @@ #include #include #include +#include #include @@ -77,29 +80,18 @@ u_int32_t packets; /* # of packets in this queue */ }; -#define TABLE_SIZE 20 /* XXX */ /* Per hook info */ struct hookinfo { hook_p hook; + int noqueue; LIST_ENTRY(hookinfo) hook_le; /* all active instances */ TAILQ_HEAD(, ngp_fifo) fifo_head; /* this hooks's FIFO queues */ TAILQ_HEAD(, ngp_hdr) qout_head; /* delay queue head */ - int noqueue; struct timeval qin_utime; - struct timeval q_time; /* used by RED */ - struct timeval ared_interval; struct ng_pipe_hookcfg cfg; struct ng_pipe_hookrun run; struct ng_pipe_hookstat stats; uint64_t *ber_p; /* loss_p(BER,psize) map */ - int64_t avg_octets; - int64_t avg_frames; - u_int64_t target; - int64_t max_p; - u_int64_t k[TABLE_SIZE]; /* used by RED */ -#ifdef XCP - struct xcp_router_state xcps; -#endif }; /* Per node info */ @@ -810,11 +802,6 @@ ngp_f->packets--; } - if (hinfo->run.qin_frames == 0) { - hinfo->q_time.tv_sec = now->tv_sec; - hinfo->q_time.tv_usec = now->tv_usec; - } - /* Calculate the serialization delay */ if (hinfo->cfg.bandwidth) { hinfo->qin_utime.tv_usec += ((uint64_t) m->m_pkthdr.len @@ -909,17 +896,6 @@ static void pipe_scheduler(void) { - static struct timeval old; - struct timeval new; - - microuptime(&new); - if (old.tv_sec > new.tv_sec) - printf ("ng_pipe: dsec=%d\n", old.tv_sec - new.tv_sec); - else if (old.tv_sec == new.tv_sec && old.tv_usec > new.tv_usec) - printf ("ng_pipe: dusec=%ld\n", old.tv_usec - new.tv_usec); - old.tv_sec = new.tv_sec; - old.tv_usec = new.tv_usec; - pipe_poll(); /* Reschedule */ @@ -927,6 +903,11 @@ } +/* + * Traverse the list of all active hooks and attempt to dequeue + * some packets. Hooks with empty queues are not traversed since + * they are not linked into this list. + */ static void pipe_poll(void) { @@ -935,8 +916,11 @@ microuptime(&now); mtx_lock(&ng_pipe_giant); - LIST_FOREACH(hinfo, &hook_head, hook_le) + LIST_FOREACH(hinfo, &hook_head, hook_le) { + CURVNET_SET(NG_HOOK_NODE(hinfo->hook)->nd_vnet); pipe_dequeue(hinfo, &now); + CURVNET_RESTORE(); + } mtx_unlock(&ng_pipe_giant); } @@ -1048,6 +1032,5 @@ break; } - printf("XXX ngp_modevent type = %d error = %d\n", type, error); return (error); }