Date: Wed, 5 Sep 2007 20:59:40 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 126104 for review Message-ID: <200709052059.l85Kxe6p006857@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/param.h> #include <sys/errno.h> #include <sys/systm.h> @@ -43,6 +45,7 @@ #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/time.h> +#include <sys/vimage.h> #include <vm/uma.h> @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709052059.l85Kxe6p006857>