Date: Mon, 11 Jan 2010 16:31:30 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r202088 - in user/luigi/ipfw3-head/sys: conf modules/dummynet netinet/ipfw Message-ID: <201001111631.o0BGVUvv014050@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Mon Jan 11 16:31:29 2010 New Revision: 202088 URL: http://svn.freebsd.org/changeset/base/202088 Log: add dn_sched_wf2q.c and glue for modules Modified: user/luigi/ipfw3-head/sys/conf/files user/luigi/ipfw3-head/sys/modules/dummynet/Makefile user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Modified: user/luigi/ipfw3-head/sys/conf/files ============================================================================== --- user/luigi/ipfw3-head/sys/conf/files Mon Jan 11 16:30:09 2010 (r202087) +++ user/luigi/ipfw3-head/sys/conf/files Mon Jan 11 16:31:29 2010 (r202088) @@ -2451,6 +2451,7 @@ netinet/in_rmx.c optional inet netinet/ip_divert.c optional inet ipdivert ipfirewall netinet/ipfw/dn_heap.c optional inet dummynet netinet/ipfw/dn_sched_fifo.c optional inet dummynet +netinet/ipfw/dn_sched_wf2q.c optional inet dummynet netinet/ipfw/ip_dummynet.c optional inet dummynet netinet/ipfw/ip_dn_io.c optional inet dummynet netinet/ip_ecn.c optional inet | inet6 Modified: user/luigi/ipfw3-head/sys/modules/dummynet/Makefile ============================================================================== --- user/luigi/ipfw3-head/sys/modules/dummynet/Makefile Mon Jan 11 16:30:09 2010 (r202087) +++ user/luigi/ipfw3-head/sys/modules/dummynet/Makefile Mon Jan 11 16:31:29 2010 (r202088) @@ -4,7 +4,7 @@ .PATH: ${.CURDIR}/../../netinet/ipfw KMOD= dummynet -SRCS= ip_dummynet.c +SRCS= ip_dummynet.c ip_dn_io.c dn_sched_fifo.c dn_sched_wf2q.c SRCS+= opt_inet6.h .if !defined(KERNBUILDDIR) Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Mon Jan 11 16:30:09 2010 (r202087) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched.h Mon Jan 11 16:31:29 2010 (r202088) @@ -43,7 +43,7 @@ struct dn_sched { int type; /* the scheduler type */ const char *name; /* scheduler name */ - int ref_count; /* number of instances in the system */ + int ref_count; /* XXX number of instances in the system */ /* * The following define the size of 4 optional data structures @@ -205,10 +205,11 @@ static __inline struct mbuf* dn_return_packet(struct new_queue *q) { struct mbuf *m = q->mq.head; + KASSERT(m != NULL, ("empty queue to dn_return_packet")); q->mq.head = m->m_nextpkt; q->lenght--; q->len_bytes -= m->m_pkthdr.len; - if (q->mq.head == NULL && q->fs->kflags & DN_DELETE) + if (q->mq.head == NULL && q->fs && q->fs->kflags & DN_DELETE) dn_delete_queue(q); return m; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Mon Jan 11 16:30:09 2010 (r202087) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Mon Jan 11 16:31:29 2010 (r202088) @@ -85,7 +85,7 @@ struct dn_parms dn_cfg = { .red_lookup_depth = 256, /* RED - default lookup table depth */ .red_avg_pkt_size = 512, /* RED - default medium packet size */ .red_max_pkt_size = 1500, /* RED - default max packet size */ - .hmask = (1<<4) - 1. + .hmask = (1<<4) - 1, }; static long tick_last; /* Last tick duration (usec). */ @@ -317,6 +317,7 @@ extra_bits(struct mbuf *m, struct new_pi return bits; } +#if 0 /* Insert packet pkt into delay line, adding the delay. * dt->output_time was already set */ static void @@ -327,6 +328,7 @@ move_pkt(struct mbuf *m, struct new_pipe dt->output_time += p->delay ; mq_append(&d->mq, m); } +#endif /* Do masking depending of flow id */ static struct ipfw_flow_id * @@ -441,7 +443,6 @@ create_si(struct new_schk *s, int slot) int ret; int l = sizeof(*si) + s->fp->sch_inst_len; -printf("%s start slot %d\n", __FUNCTION__, slot); si = malloc(l, M_DUMMYNET, M_NOWAIT | M_ZERO); if (si == NULL) @@ -484,7 +485,6 @@ find_sch_inst(struct new_schk *s, struct int i; struct ipfw_flow_id id_t; -printf("%s start id %p\n", __FUNCTION__, id); if ( 0 == (s->sch.flags & DN_HAVE_MASK) ) { i = 0; si = SLIST_FIRST(&s->ht[0]); @@ -537,7 +537,8 @@ serve_sched(struct mq *q, struct new_sch (m->m_pkthdr.len * 8 + extra_bits(m, &s->pipe)); si->credit -= len_scaled; /* Move packet in the delay line */ - move_pkt(m, &s->pipe, &si->dline); + dn_tag_get(m)->output_time += s->pipe.delay ; + mq_append(&si->dline.mq, m); } if (si->credit >= 0) { /* Instance is idle, because it did not return @@ -551,7 +552,7 @@ serve_sched(struct mq *q, struct new_sch * of the last packet, which is 'tosend' */ dn_key t; - KASSERT (bw > 0, "bw=0 and credit<0 ?"); + KASSERT (bw > 0, ("bw=0 and credit<0 ?")); t = (bw - 1 - si->credit) / bw; /* Delay output time because under credit */ if (m) @@ -622,10 +623,8 @@ dummynet_task(void *context, int pending p = HEAP_TOP(&dn_cfg.system_heap)->object; heap_extract(&dn_cfg.system_heap, NULL); } else { - p = NULL; - } - if (p == NULL) break; + } if (p->type == DN_SCH_I) { serve_sched(&q, (struct new_sch_inst *)p, curr_time); @@ -823,7 +822,6 @@ dummynet_io(struct mbuf **m0, int dir, s if (dn_cfg.io_fast && m == *m0 && (dir & PROTO_LAYER2) == 0 ) { /* fast io */ io_pkt_fast++; - printf("dummynet TEST: ** IOFAST **\n"); if (m->m_nextpkt != NULL) { printf("dummynet: fast io: pkt chain detected!\n"); m->m_nextpkt = NULL;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001111631.o0BGVUvv014050>