Date: Sun, 31 Jan 2010 21:39:25 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r203321 - in user/luigi/ipfw3-head: sbin/ipfw sys/netinet sys/netinet/ipfw Message-ID: <201001312139.o0VLdPfY046479@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Sun Jan 31 21:39:25 2010 New Revision: 203321 URL: http://svn.freebsd.org/changeset/base/203321 Log: mega rename of new_* to dn_* for all data structures. Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Sun Jan 31 21:39:25 2010 (r203321) @@ -208,7 +208,7 @@ list_flow(struct dn_flow *ni) } static void -print_flowset_parms(struct new_fs *fs, char *prefix) +print_flowset_parms(struct dn_fs *fs, char *prefix) { int l; char qs[30]; @@ -255,7 +255,7 @@ print_flowset_parms(struct new_fs *fs, c } static void -print_extra_delay_parms(struct new_profile *p) +print_extra_delay_parms(struct dn_profile *p) { double loss; if (p->samples_no <= 0) @@ -321,7 +321,7 @@ list_pipes(struct dn_id *oid, struct dn_ printf("answer for cmd %d, len %d\n", oid->type, oid->id); break; case DN_SCH: { - struct new_sch *s = (struct new_sch *)oid; + struct dn_sch *s = (struct dn_sch *)oid; flush_buf(buf); printf(" sched %d type %s flags 0x%x %d buckets\n", s->sched_nr, @@ -362,11 +362,11 @@ list_pipes(struct dn_id *oid, struct dn_ break; case DN_FS: - print_flowset_parms((struct new_fs *)oid, buf); + print_flowset_parms((struct dn_fs *)oid, buf); break; case DN_PROFILE: flush_buf(buf); - print_extra_delay_parms((struct new_profile *)oid); + print_extra_delay_parms((struct dn_profile *)oid); } } flush_buf(buf); @@ -604,7 +604,7 @@ compare_points(const void *vp1, const vo #define ED_EFMT(s) EX_DATAERR,"error in %s at line %d: "#s,filename,lineno static void -load_extra_delays(const char *filename, struct new_profile *p) +load_extra_delays(const char *filename, struct dn_profile *p) { char line[ED_MAX_LINE_LEN]; FILE *f; @@ -774,10 +774,10 @@ ipfw_config_pipe(int ac, char **av) char *end; void *par = NULL; struct dn_id *buf, *base; - struct new_sch *sch = NULL; + struct dn_sch *sch = NULL; struct dn_link *p = NULL; - struct new_fs *fs = NULL; - struct new_profile *pf = NULL; + struct dn_fs *fs = NULL; + struct dn_profile *pf = NULL; struct ipfw_flow_id *mask = NULL; int lmax; int _foo = 0, *flags = &_foo; @@ -787,8 +787,8 @@ ipfw_config_pipe(int ac, char **av) * 1 scheduler, 1 link, 1 flowset, 1 profile */ lmax = sizeof(struct dn_id); /* command header */ - lmax += sizeof(struct new_sch) + sizeof(struct dn_link) + - sizeof(struct new_fs) + sizeof(struct new_profile); + lmax += sizeof(struct dn_sch) + sizeof(struct dn_link) + + sizeof(struct dn_fs) + sizeof(struct dn_profile); av++; ac--; /* Pipe number */ @@ -1251,7 +1251,7 @@ end_mask: p.fs.lookup_weight = (int)(weight * (1 << SCALE_RED)); } if (p.samples_no <= 0) { - struct new_profile *prof; + struct dn_profile *prof; prof = o_next(&o, sizeof(*prof), DN_PROFILE); i = do_cmd(IP_DUMMYNET_CONFIGURE, prof, sizeof *prof); } else Modified: user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Sun Jan 31 21:39:25 2010 (r203321) @@ -53,7 +53,7 @@ struct dn_id { uint16_t len; /* total obj len including this header */ uint8_t type; uint8_t subtype; - uintptr_t id; /* generic id or pointer */ + uint32_t id; /* generic id */ }; /* @@ -119,7 +119,7 @@ struct dn_link { * flow masks, buckets for the flow hash, and possibly scheduler- * specific parameters (weight, quantum and so on). */ -struct new_fs { +struct dn_fs { struct dn_id oid; uint32_t fs_nr; /* the flowset number */ int flags; /* userland flags */ @@ -129,7 +129,9 @@ struct new_fs { struct ipfw_flow_id flow_mask; uint32_t sched_nr; /* the scheduler we attach to */ - /* generic scheduler parameters. Leave them at -1 if unset */ + /* generic scheduler parameters. Leave them at -1 if unset. + * Now we use 0: weight, 1: lmax, 2: priority + */ int par[4]; }; @@ -140,13 +142,13 @@ struct new_fs { * of the parent object. */ struct dn_flow { - struct dn_id oid; - struct ipfw_flow_id fid; + struct dn_id oid; + struct ipfw_flow_id fid; + uint64_t tot_pkts; /* statistics counters */ + uint64_t tot_bytes; uint32_t length; /* Queue lenght, in packets */ uint32_t len_bytes; /* Queue lenght, in bytes */ uint32_t drops; - uint64_t tot_pkts; /* statistics counters */ - uint64_t tot_bytes; }; @@ -154,11 +156,11 @@ struct dn_flow { * Scheduler template, mostly indicating the name, number, * sched_mask and buckets. */ -struct new_sch { - struct dn_id oid; - int sched_nr; /* N, scheduler number */ - int buckets; /* number of buckets for the instances */ - int flags; /* have_mask, ... */ +struct dn_sch { + struct dn_id oid; + uint32_t sched_nr; /* N, scheduler number */ + uint32_t buckets; /* number of buckets for the instances */ + uint32_t flags; /* have_mask, ... */ char name[16]; /* null terminated */ /* mask to select the appropriate scheduler instance */ @@ -168,15 +170,15 @@ struct new_sch { /* A delay profile is attached to a link */ #define ED_MAX_SAMPLES_NO 1024 -struct new_profile { - struct dn_id oid; +struct dn_profile { + struct dn_id oid; /* fields to simulate a delay profile */ #define ED_MAX_NAME_LEN 32 - char name[ED_MAX_NAME_LEN]; - int link_nr; - int loss_level; - int bandwidth; - int samples_no; /* actual length of samples[] */ + char name[ED_MAX_NAME_LEN]; + int link_nr; + int loss_level; + int bandwidth; + int samples_no; /* actual length of samples[] */ int samples[ED_MAX_SAMPLES_NO]; /* may be shorter */ }; @@ -225,8 +227,8 @@ the objects used by dummynet: + dn_profile describes a delay profile; + dn_flow describes the flow status (flow id, statistics) - + new_sch describes a scheduler - + new_fs describes a flowset (msk, weight, queue parameters) + + dn_sch describes a scheduler + + dn_fs describes a flowset (msk, weight, queue parameters) * */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Sun Jan 31 21:39:25 2010 (r203321) @@ -102,18 +102,18 @@ struct dn_alg { * all the above. If the queue has data in it, also remove * from the scheduler. This can e.g. happen during a reconfigure. */ - int (*enqueue)(struct new_sch_inst *, struct new_queue *, + int (*enqueue)(struct dn_sch_inst *, struct dn_queue *, struct mbuf *); - struct mbuf * (*dequeue)(struct new_sch_inst *); + struct mbuf * (*dequeue)(struct dn_sch_inst *); - int (*config)(struct new_schk *); - int (*destroy)(struct new_schk*); - int (*new_sched)(struct new_sch_inst *); - int (*free_sched)(struct new_sch_inst *); - int (*new_fsk)(struct new_fsk *f); - int (*free_fsk)(struct new_fsk *f); - int (*new_queue)(struct new_queue *q); - int (*free_queue)(struct new_queue *q); + int (*config)(struct dn_schk *); + int (*destroy)(struct dn_schk*); + int (*new_sched)(struct dn_sch_inst *); + int (*free_sched)(struct dn_sch_inst *); + int (*new_fsk)(struct dn_fsk *f); + int (*free_fsk)(struct dn_fsk *f); + int (*new_queue)(struct dn_queue *q); + int (*free_queue)(struct dn_queue *q); }; /* @@ -121,7 +121,7 @@ struct dn_alg { * to be used by schedulers: */ void dn_free_pkts(struct mbuf *mnext); -int dn_enqueue(struct new_queue *q, struct mbuf* m, int drop); +int dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop); /* bound a variable between min and max */ int ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg); @@ -130,7 +130,7 @@ int ipdn_bound_var(int *v, int dflt, int * thing done on a dequeue as the queue itself may go away. */ static __inline struct mbuf* -dn_dequeue(struct new_queue *q) +dn_dequeue(struct dn_queue *q) { struct mbuf *m = q->mq.head; if (m == NULL) Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c Sun Jan 31 21:39:25 2010 (r203321) @@ -51,26 +51,26 @@ * Enqueue and dequeue use the default library functions. */ static int -fifo_enqueue(struct new_sch_inst *si, struct new_queue *q, struct mbuf *m) +fifo_enqueue(struct dn_sch_inst *si, struct dn_queue *q, struct mbuf *m) { /* XXX if called with q != NULL and m=NULL, this is a * re-enqueue from an existing scheduler, which we should * handle. */ - return dn_enqueue((struct new_queue *)(si+1), m, 0); + return dn_enqueue((struct dn_queue *)(si+1), m, 0); } static struct mbuf * -fifo_dequeue(struct new_sch_inst *si) +fifo_dequeue(struct dn_sch_inst *si) { - return dn_dequeue((struct new_queue *)(si + 1)); + return dn_dequeue((struct dn_queue *)(si + 1)); } static int -fifo_new_sched(struct new_sch_inst *si) +fifo_new_sched(struct dn_sch_inst *si) { /* This scheduler instance contains the queue */ - struct new_queue *q = (struct new_queue *)(si + 1); + struct dn_queue *q = (struct dn_queue *)(si + 1); set_oid(&q->ni.oid, DN_QUEUE, sizeof(*q)); q->_si = si; @@ -79,9 +79,9 @@ fifo_new_sched(struct new_sch_inst *si) } static int -fifo_free_sched(struct new_sch_inst *si) +fifo_free_sched(struct dn_sch_inst *si) { - struct new_queue *q = (struct new_queue *)(si + 1); + struct dn_queue *q = (struct dn_queue *)(si + 1); dn_free_pkts(q->mq.head); bzero(q, sizeof(*q)); return 0; @@ -96,7 +96,7 @@ static struct dn_alg fifo_desc = { .type = DN_SCHED_FIFO, .name = "FIFO", - .si_datalen = sizeof(struct new_queue), + .si_datalen = sizeof(struct dn_queue), .enqueue = fifo_enqueue, .dequeue = fifo_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_qfq.c Sun Jan 31 21:39:25 2010 (r203321) @@ -175,10 +175,10 @@ struct qfq_group; /* * additional queue info. Some of this info should come from * the flowset, we copy them here for faster processing. - * This is an overlay of the struct new_queue + * This is an overlay of the struct dn_queue */ struct qfq_class { - struct new_queue _q; + struct dn_queue _q; uint64_t S, F; /* flow timestamps (exact) */ struct qfq_class *next; /* Link for the slot list. */ @@ -277,7 +277,7 @@ out: * Validate and copy parameters from flowset. */ static int -qfq_new_queue(struct new_queue *_q) +qfq_new_queue(struct dn_queue *_q) { struct qfq_sched *q = (struct qfq_sched *)(_q->_si + 1); struct qfq_class *cl = (struct qfq_class *)_q; @@ -308,7 +308,7 @@ qfq_new_queue(struct new_queue *_q) /* remove an empty queue */ static int -qfq_free_queue(struct new_queue *_q) +qfq_free_queue(struct dn_queue *_q) { struct qfq_sched *q = (struct qfq_sched *)(_q->_si + 1); struct qfq_class *cl = (struct qfq_class *)_q; @@ -519,7 +519,7 @@ qfq_update_class(struct qfq_sched *q, st } static struct mbuf * -qfq_dequeue(struct new_sch_inst *si) +qfq_dequeue(struct dn_sch_inst *si) { struct qfq_sched *q = (struct qfq_sched *)(si + 1); struct qfq_group *grp; @@ -620,7 +620,7 @@ qfq_update_start(struct qfq_sched *q, st } static int -qfq_enqueue(struct new_sch_inst *si, struct new_queue *_q, struct mbuf *m) +qfq_enqueue(struct dn_sch_inst *si, struct dn_queue *_q, struct mbuf *m) { struct qfq_sched *q = (struct qfq_sched *)(si + 1); struct qfq_group *grp; @@ -763,7 +763,7 @@ qfq_deactivate_class(struct qfq_sched *q #endif static int -qfq_new_fsk(struct new_fsk *f) +qfq_new_fsk(struct dn_fsk *f) { ipdn_bound_var(&f->fs.par[0], 1, 1, QFQ_MAX_WEIGHT, "qfq weight"); ipdn_bound_var(&f->fs.par[1], 1500, 1, 2000, "qfq maxlen"); @@ -775,7 +775,7 @@ qfq_new_fsk(struct new_fsk *f) * initialize a new scheduler instance */ static int -qfq_new_sched(struct new_sch_inst *si) +qfq_new_sched(struct dn_sch_inst *si) { struct qfq_sched *q = (struct qfq_sched *)(si + 1); struct qfq_group *grp; @@ -799,7 +799,7 @@ static struct dn_alg qfq_desc = { .flags = DN_MULTIQUEUE, .si_datalen = sizeof(struct qfq_sched), - .q_datalen = sizeof(struct qfq_class) - sizeof(struct new_queue), + .q_datalen = sizeof(struct qfq_class) - sizeof(struct dn_queue), .enqueue = qfq_enqueue, .dequeue = qfq_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_rr.c Sun Jan 31 21:39:25 2010 (r203321) @@ -46,7 +46,7 @@ #define DN_SCHED_RR 3 // XXX Where? struct rr_queue { - struct new_queue q; /* Standard queue */ + struct dn_queue q; /* Standard queue */ int status; /* 1: queue is in the list */ int credit; /* Number of bytes to transmit */ int quantum; /* quantum * C */ @@ -54,7 +54,7 @@ struct rr_queue { }; /* struct rr_schk contains global config parameters - * and is right after new_schk + * and is right after dn_schk */ struct rr_schk { int min_q; /* Min quantum */ @@ -62,7 +62,7 @@ struct rr_schk { int q_bytes; /* Bytes per quantum */ }; -/* per-instance round robin list, right after new_sch_inst */ +/* per-instance round robin list, right after dn_sch_inst */ struct rr_si { struct rr_queue *head, *tail; /* Pointer to current queue */ }; @@ -137,7 +137,7 @@ next_pointer(struct rr_si *si) } static int -rr_enqueue(struct new_sch_inst *_si, struct new_queue *q, struct mbuf *m) +rr_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m) { struct rr_si *si; struct rr_queue *rrq; @@ -163,7 +163,7 @@ rr_enqueue(struct new_sch_inst *_si, str } static struct mbuf * -rr_dequeue(struct new_sch_inst *_si) +rr_dequeue(struct dn_sch_inst *_si) { /* Access scheduler instance private data */ struct rr_si *si = (struct rr_si *)(_si + 1); @@ -195,7 +195,7 @@ rr_dequeue(struct new_sch_inst *_si) } static int -rr_config(struct new_schk *_schk) +rr_config(struct dn_schk *_schk) { struct rr_schk *schk = (struct rr_schk *)(_schk + 1); ND("called"); @@ -209,7 +209,7 @@ rr_config(struct new_schk *_schk) } static int -rr_new_sched(struct new_sch_inst *_si) +rr_new_sched(struct dn_sch_inst *_si) { struct rr_si *si = (struct rr_si *)(_si + 1); @@ -220,7 +220,7 @@ rr_new_sched(struct new_sch_inst *_si) } static int -rr_free_sched(struct new_sch_inst *_si) +rr_free_sched(struct dn_sch_inst *_si) { ND("called"); /* Nothing to do? */ @@ -228,7 +228,7 @@ rr_free_sched(struct new_sch_inst *_si) } static int -rr_new_fsk(struct new_fsk *fs) +rr_new_fsk(struct dn_fsk *fs) { struct rr_schk *schk = (struct rr_schk *)(fs->sched + 1); /* par[0] is the weight, par[1] is the quantum step */ @@ -240,7 +240,7 @@ rr_new_fsk(struct new_fsk *fs) } static int -rr_new_queue(struct new_queue *_q) +rr_new_queue(struct dn_queue *_q) { struct rr_queue *q = (struct rr_queue *)_q; @@ -259,7 +259,7 @@ rr_new_queue(struct new_queue *_q) } static int -rr_free_queue(struct new_queue *_q) +rr_free_queue(struct dn_queue *_q) { struct rr_queue *q = (struct rr_queue *)_q; @@ -282,7 +282,7 @@ static struct dn_alg rr_desc = { .flags = DN_MULTIQUEUE, .si_datalen = sizeof(struct rr_si), - .q_datalen = sizeof(struct rr_queue) - sizeof(struct new_queue), + .q_datalen = sizeof(struct rr_queue) - sizeof(struct dn_queue), .enqueue = rr_enqueue, .dequeue = rr_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c Sun Jan 31 21:39:25 2010 (r203321) @@ -84,7 +84,7 @@ struct wf2qp_si { }; struct wf2qp_queue { - struct new_queue _q; + struct dn_queue _q; uint64_t S, F; /* start time, finish time */ uint32_t inv_w; /* ONE_FP / weight */ int32_t heap_pos; /* position (index) of struct in heap */ @@ -107,7 +107,7 @@ idle_check(struct wf2qp_si *si, int n, i struct dn_heap *h = &si->idle_heap; while (n-- > 0 && h->elements > 0 && (force || DN_KEY_LT(HEAP_TOP(h)->key, si->V))) { - struct new_queue *q = HEAP_TOP(h)->object; + struct dn_queue *q = HEAP_TOP(h)->object; struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; heap_extract(h, NULL); @@ -122,9 +122,9 @@ idle_check(struct wf2qp_si *si, int n, i } static int -wf2qp_enqueue(struct new_sch_inst *_si, struct new_queue *q, struct mbuf *m) +wf2qp_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m) { - struct new_fsk *fs = q->fs; + struct dn_fsk *fs = q->fs; struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); struct wf2qp_queue *alg_fq; uint64_t len = m->m_pkthdr.len; @@ -178,12 +178,12 @@ wf2qp_enqueue(struct new_sch_inst *_si, /* XXX invariant: sch > 0 || V >= min(S in neh) */ static struct mbuf * -wf2qp_dequeue(struct new_sch_inst *_si) +wf2qp_dequeue(struct dn_sch_inst *_si) { /* Access scheduler instance private data */ struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); struct mbuf *m; - struct new_queue *q; + struct dn_queue *q; struct dn_heap *sch = &si->sch_heap; struct dn_heap *neh = &si->ne_heap; struct wf2qp_queue *alg_fq; @@ -251,7 +251,7 @@ wf2qp_dequeue(struct new_sch_inst *_si) } static int -wf2qp_new_sched(struct new_sch_inst *_si) +wf2qp_new_sched(struct dn_sch_inst *_si) { struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); int ofs = offsetof(struct wf2qp_queue, heap_pos); @@ -269,7 +269,7 @@ wf2qp_new_sched(struct new_sch_inst *_si } static int -wf2qp_free_sched(struct new_sch_inst *_si) +wf2qp_free_sched(struct dn_sch_inst *_si) { struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1); @@ -281,7 +281,7 @@ wf2qp_free_sched(struct new_sch_inst *_s } static int -wf2qp_new_fsk(struct new_fsk *fs) +wf2qp_new_fsk(struct dn_fsk *fs) { ipdn_bound_var(&fs->fs.par[0], 1, 1, 100, "WF2Q+ weight"); @@ -289,7 +289,7 @@ wf2qp_new_fsk(struct new_fsk *fs) } static int -wf2qp_new_queue(struct new_queue *_q) +wf2qp_new_queue(struct dn_queue *_q) { struct wf2qp_queue *q = (struct wf2qp_queue *)_q; @@ -310,7 +310,7 @@ wf2qp_new_queue(struct new_queue *_q) * of weights. */ static int -wf2qp_free_queue(struct new_queue *q) +wf2qp_free_queue(struct dn_queue *q) { struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1); @@ -346,7 +346,7 @@ static struct dn_alg wf2qp_desc = { /* we need extra space in the si and the queue */ .si_datalen = sizeof(struct wf2qp_si), - .q_datalen = sizeof(struct wf2qp_queue) - sizeof(struct new_queue), + .q_datalen = sizeof(struct wf2qp_queue) - sizeof(struct dn_queue), .enqueue = wf2qp_enqueue, .dequeue = wf2qp_dequeue, Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_test.h Sun Jan 31 21:39:25 2010 (r203321) @@ -40,10 +40,10 @@ enum { struct dn_id { int type, subtype, len, id; }; -struct new_fs { +struct dn_fs { int par[1]; }; -struct new_sch { +struct dn_sch { }; struct dn_flow { struct dn_id oid; @@ -86,28 +86,28 @@ typedef struct _md_t moduledata_t; #include <ip_dn_private.h> #include <dn_sched.h> #else -struct new_queue { - struct new_fsk *fs; /* parent flowset. */ - struct new_sch_inst *_si; /* parent sched instance. */ -}; -struct new_schk { -}; -struct new_fsk { - struct new_fs fs; - struct new_schk *sched; +struct dn_queue { + struct dn_fsk *fs; /* parent flowset. */ + struct dn_sch_inst *_si; /* parent sched instance. */ +}; +struct dn_schk { +}; +struct dn_fsk { + struct dn_fs fs; + struct dn_schk *sched; }; -struct new_sch_inst { - struct new_schk *sched; +struct dn_sch_inst { + struct dn_schk *sched; }; struct dn_alg { int type; const char *name; void *enqueue, *dequeue; int q_datalen, si_datalen, schk_datalen; - int (*config)(struct new_schk *); - int (*new_sched)(struct new_sch_inst *); - int (*new_fsk)(struct new_fsk *); - int (*new_queue)(struct new_queue *q); + int (*config)(struct dn_schk *); + int (*new_sched)(struct dn_sch_inst *); + int (*new_fsk)(struct dn_fsk *); + int (*new_queue)(struct dn_queue *q); }; #endif Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt Sun Jan 31 21:39:25 2010 (r203321) @@ -84,15 +84,15 @@ USERLAND-KERNEL API (ip_dummynet.h) contains data about the physical link such as bandwith, delay, burst size; - struct new_profile: + struct dn_profile: fields to simulate a delay profile - struct new_sch: + struct dn_sch: defines a scheduler (and a link attached to it). Parameters include scheduler type, sched_mask, number of buckets, and possibly other scheduler-specific parameters, - struct new_fs: + struct dn_fs: describes a flowset, i.e. a template for queues. Main parameters are the scheduler we attach to, a flow_mask, buckets, queue size, plr, weight, and other scheduler-specific @@ -100,45 +100,45 @@ USERLAND-KERNEL API (ip_dummynet.h) KERNEL REPRESENTATION (ip_dn_private.h) - struct new_queue + struct dn_queue individual queue of packets, created by a flowset using flow_mask and attached to a scheduler instance selected through sched_mask. - A new_queue has a pointer to the new_fsk (which in turn counts + A dn_queue has a pointer to the dn_fsk (which in turn counts how many queues point to it), a pointer to the - new_sch_inst it attaches to, and is in a hash table in the + dn_sch_inst it attaches to, and is in a hash table in the flowset. scheduler instances also should store queues in their own containers used for scheduling (lists, trees, etc.) CREATE: done on packet arrivals when a flow matches a flowset. - DELETE: done only when deleting the parent new_sch_inst + DELETE: done only when deleting the parent dn_sch_inst or draining memory. - struct new_fsk - includes a new_fs; a pointer to the new_schk; a link field - for the list of new_fsk attached to the same scheduler, + struct dn_fsk + includes a dn_fs; a pointer to the dn_schk; a link field + for the list of dn_fsk attached to the same scheduler, or for the unlinked list; a refcount for the number of queues pointing to it; - The new_fsk is in a hash table, fshash. + The dn_fsk is in a hash table, fshash. CREATE: done on configuration commands. DELETE: on configuration commands. - struct new_sch_inst - a scheduler instance, created from a new_schk applying sched_mask. + struct dn_sch_inst + a scheduler instance, created from a dn_schk applying sched_mask. Contains a delay line, a reference to the parent, and scheduler- - specific info. Both new_sch_inst and its delay line can be in the + specific info. Both dn_sch_inst and its delay line can be in the evheap if they have events to be processed. - CREATE: created from a new_schk applying sched_mask + CREATE: created from a dn_schk applying sched_mask DELETE: configuration command delete a scheduler which in turn sweeps the hash table of instances deleting them - struct new_schk - includes new_sch, dn_link, a pointer to new_profile, - a hash table of new_sch_inst, a list of new_fsk + struct dn_schk + includes dn_sch, dn_link, a pointer to dn_profile, + a hash table of dn_sch_inst, a list of dn_fsk attached to it. CREATE: configuration command. If there are flowsets that refer to this number, they are attached and moved to the hash table - DELETE: manual, see new_sch_inst + DELETE: manual, see dn_sch_inst fshash schedhash @@ -148,11 +148,11 @@ KERNEL REPRESENTATION (ip_dn_private.h) |NEW_FSK |<----. | [dn_link] | +---------------+ | +--------------+ |qht (hash) | | | siht(hash) | - | [new_queue] | | | [new_si] | - | [new_queue] | | | [new_si] | + | [dn_queue] | | | [dn_si] | + | [dn_queue] | | | [dn_si] | | ... | | | ... | - | +---------+ | | | +---------+ | - | |new_queue| | | | |new_si | | + | +--------+ | | | +---------+ | + | |dn_queue| | | | |dn_si | | | | fs *----------' | | | | | | si *---------------------->| | | | +---------+ | | +---------+ | @@ -304,11 +304,11 @@ To create a pipe, queue or scheduler, th The userland side of dummynet will prepare a buffer contains data to pass to kernel side. The buffer contains all struct needed to configure an object. In more detail, -to configure a pipe all three structs (dn_link, new_sch, new_fs) are needed, +to configure a pipe all three structs (dn_link, dn_sch, dn_fs) are needed, plus the delay profile struct if the pipe has a delay profile. -If configuring a scheduler only the struct new_sch is wrote in the buffer, -while if configuring a flowset only the new_fs struct is wrote. +If configuring a scheduler only the struct dn_sch is wrote in the buffer, +while if configuring a flowset only the dn_fs struct is wrote. The first struct in the buffer contains the type of command request, that is if it is configuring a pipe, a queue, or a scheduler. Then there are structs @@ -627,15 +627,15 @@ How to implement a new scheduler ================================ In dummynet, a scheduler algorithm is represented by two main structs, some functions and other minor structs. -- A struct new_sch_xyz (where xyz is the 'type' of scheduler algorithm +- A struct dn_sch_xyz (where xyz is the 'type' of scheduler algorithm implemented) contains data relative to scheduler, as global parameter that are common to all instances of the scheduler -- A struct new_sch_inst_xyz contains data relative to a single scheduler +- A struct dn_sch_inst_xyz contains data relative to a single scheduler instance, as local status variable depending for example by flows that are linked with the scheduler, and so on. To add a scheduler to dummynet, the user should type a command like: 'ipfw pipe x config sched <type> [mask ... ...]' -This command creates a new struct new_sch_xyz of type <type>, and +This command creates a new struct dn_sch_xyz of type <type>, and store the optional parameter in that struct. The parameter mask determines how many scheduler instance of this @@ -646,7 +646,7 @@ If the mask is not set, all traffic goes When a packet arrives to a scheduler, the system search the corrected scheduler instance, and if it does not exist it is created now (the -struct new_sch_inst_xyz is allocated by the system, and the scheduler +struct dn_sch_inst_xyz is allocated by the system, and the scheduler fills the field correctly). It is a task of the scheduler to create the struct that contains all queues for a scheduler instance. Dummynet provides some function to create an hash table to store @@ -655,7 +655,7 @@ queues, but the schedule algorithm can c To link a flow to a scheduler, the user should type a command like: 'ipfw queue z config pipe x [mask... ...]' -This command creates a new 'new_fs' struct that will be inserted +This command creates a new 'dn_fs' struct that will be inserted in the system. If the scheduler x exists, this flowset will be linked to that scheduler and the flowset type become the same as the scheduler type. At this point, the function create_alg_fs_xyz() @@ -668,11 +668,11 @@ and assign it to a separate queue. This so it can ignore the mask if it wants. See now the two main structs: -struct new_sch_xyz { +struct dn_sch_xyz { struct gen g; /* important the name g */ /* global params */ }; -struct new_sch_inst_xyz { +struct dn_sch_inst_xyz { struct gen g; /* important the name g */ /* params of the instance */ }; @@ -703,20 +703,20 @@ The create_alg_fs_xyz() function is mand gen, but the delete_alg_fs_xyz() is mandatory only if the previous function has allocated some memory. -A struct new_queue contains packets belonging to a queue and some statistical +A struct dn_queue contains packets belonging to a queue and some statistical data. The scheduler could have to store data in this struct, so it must define -a new_queue_xyz struct: -struct new_queue_xyz { - struct new_queue q; +a dn_queue_xyz struct: +struct dn_queue_xyz { + struct dn_queue q; /* parameter for a queue */ } All structures are allocated by the system. To do so, the scheduler must set the size of its structs in the scheduler descriptor: -scheduler_size: sizeof(new_sch_xyz) -scheduler_i_size: sizeof(new_sch_inst_xyz) +scheduler_size: sizeof(dn_sch_xyz) +scheduler_i_size: sizeof(dn_sch_inst_xyz) flowset_size: sizeof(alg_fs_xyz) -queue_size: sizeof(new_queue_xyz); +queue_size: sizeof(dn_queue_xyz); The scheduler_size could be 0, but other struct must have at least a struct gen. @@ -731,7 +731,7 @@ scheduler functions. should be implemented to remove this memory. - int (*delete_scheduler_template)(void* sch); Delete a scheduler template. This function is mandatory if the scheduler - uses extra data respect the struct new_sch. + uses extra data respect the struct dn_sch. - int (*create_scheduler_instance)(void *s); Create a new scheduler instance. The system allocate the necessary memory and the schedulet can access it using the 's' pointer. @@ -776,10 +776,10 @@ scheduler functions. It is called when a flowset is deleting. Must remove the memory allocate by the create_alg_fs() function. -- int (*create_queue_alg)(struct new_queue *q, struct gen *f); +- int (*create_queue_alg)(struct dn_queue *q, struct gen *f); Called when a queue is created. The function should link the queue to the struct used by the scheduler instance to store all queues. -- int (*delete_queue_alg)(struct new_queue *q); +- int (*delete_queue_alg)(struct dn_queue *q); Called when a queue is deleting. The function should remove extra data and update the struct contains all queues in the scheduler instance. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Sun Jan 31 21:39:25 2010 (r203321) @@ -230,9 +230,9 @@ void dn_free_pkts(struct mbuf *mnext) * Return 0 on success, 1 on drop. The packet is consumed anyways. */ int -dn_enqueue(struct new_queue *q, struct mbuf* m, int drop) +dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop) { - struct new_fs *f; + struct dn_fs *f; struct dn_flow *ni; /* stats for scheduler instance */ uint64_t len; @@ -306,11 +306,11 @@ transmit_event(struct mq *q, struct dela * in milliseconds so we need to divide by 1000. */ static uint64_t -extra_bits(struct mbuf *m, struct new_schk *s) +extra_bits(struct mbuf *m, struct dn_schk *s) { int index; uint64_t bits; - struct new_profile *pf = s->profile; + struct dn_profile *pf = s->profile; if (!pf || pf->samples_no == 0) return 0; @@ -329,10 +329,10 @@ extra_bits(struct mbuf *m, struct new_sc * Return a pointer to the head of the queue. */ static struct mbuf * -serve_sched(struct mq *q, struct new_sch_inst *si, uint64_t now) +serve_sched(struct mq *q, struct dn_sch_inst *si, uint64_t now) { struct mq def_q; - struct new_schk *s = si->sched; + struct dn_schk *s = si->sched; struct mbuf *m = NULL; int delay_line_idle = (si->dline.mq.head == NULL); int done, bw; @@ -442,7 +442,7 @@ dummynet_task(void *context, int pending heap_extract(&dn_cfg.evheap, NULL); if (p->type == DN_SCH_I) { - serve_sched(&q, (struct new_sch_inst *)p, curr_time); + serve_sched(&q, (struct dn_sch_inst *)p, curr_time); } else { /* extracted a delay line */ transmit_event(&q, (struct delay_line *)p, curr_time); } @@ -583,9 +583,9 @@ int dummynet_io(struct mbuf **m0, int dir, struct ip_fw_args *fwa) { struct mbuf *m = *m0; - struct new_fsk *fs = NULL; - struct new_sch_inst *si; - struct new_queue *q = NULL; /* default */ + struct dn_fsk *fs = NULL; + struct dn_sch_inst *si; + struct dn_queue *q = NULL; /* default */ int fs_id = (fwa->rule.info & IPFW_INFO_MASK) + ((fwa->rule.info & IPFW_IS_PIPE) ? 2*DN_MAX_ID : 0); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Sun Jan 31 21:22:45 2010 (r203320) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Sun Jan 31 21:39:25 2010 (r203321) @@ -74,10 +74,10 @@ MALLOC_DECLARE(M_DUMMYNET); #define DN_BH_WUNLOCK() mtx_unlock(&dn_cfg.uh_mtx) #define DN_BH_LOCK_ASSERT() mtx_assert(&dn_cfg.uh_mtx, MA_OWNED) -SLIST_HEAD(new_schk_head, new_schk); -SLIST_HEAD(new_sch_inst_head, new_sch_inst); -SLIST_HEAD(new_fsk_head, new_fsk); -SLIST_HEAD(new_queue_head, new_queue); +SLIST_HEAD(dn_schk_head, dn_schk); +SLIST_HEAD(dn_sch_inst_head, dn_sch_inst); +SLIST_HEAD(dn_fsk_head, dn_fsk); +SLIST_HEAD(dn_queue_head, dn_queue); SLIST_HEAD(dn_alg_head, dn_alg); struct mq { /* a basic queue of packets*/ @@ -130,7 +130,7 @@ struct dn_parms { struct dn_ht *fshash; struct dn_ht *schedhash; /* list of flowsets without a scheduler -- use sch_chain */ - struct new_fsk_head fsu; /* list of unlinked flowsets */ + struct dn_fsk_head fsu; /* list of unlinked flowsets */ struct dn_alg_head schedlist; /* list of algorithms */ /* if the upper half is busy doing something long, @@ -141,14 +141,16 @@ struct dn_parms { struct mq pending; #ifdef _KERNEL - /* uh_mtx arbitrates between system calls and also + /* + * This file is normally used in the kernel, unless we do + * some userland tests, in which case we do not need a mtx. + * uh_mtx arbitrates between system calls and also * protects fshash, schedhash and fsunlinked. * These structures are readonly for the lower half. - */ - struct mtx uh_mtx; - /* bh_mtx protects all other structures which may be + * bh_mtx protects all other structures which may be * modified upon packet arrivals */ + struct mtx uh_mtx; struct mtx bh_mtx; #endif /* _KERNEL */ }; @@ -159,7 +161,7 @@ struct dn_parms { */ struct delay_line { struct dn_id oid; - struct new_sch_inst *si; + struct dn_sch_inst *si; struct mq mq; }; @@ -174,16 +176,16 @@ struct delay_line { * put them in external storage because the scheduler may not be * available when the fsk is created. */ -struct new_fsk { /* kernel side of a flowset */ - struct new_fs fs; - SLIST_ENTRY(new_fsk) fsk_next; /* hash chain for fshash */ +struct dn_fsk { /* kernel side of a flowset */ + struct dn_fs fs; + SLIST_ENTRY(dn_fsk) fsk_next; /* hash chain for fshash */ struct ipfw_flow_id fsk_mask; - /* hash table of queues, or just single queue */ - struct dn_ht *_qht; - struct new_schk *sched; /* Sched we are linked to */ - SLIST_ENTRY(new_fsk) sch_chain; /* list of fsk attached to sched */ + /* qht is a hash table of queues, or just a single queue */ + struct dn_ht *qht; + struct dn_schk *sched; /* Sched we are linked to */ + SLIST_ENTRY(dn_fsk) sch_chain; /* list of fsk attached to sched */ }; /* @@ -194,12 +196,12 @@ struct new_fsk { /* kernel side of a flo * detached from the scheduler -- in this case si == NULL and we * should not enqueue. *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001312139.o0VLdPfY046479>