Date: Mon, 11 Jan 2010 18:08:39 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r202096 - in user/luigi/ipfw3-head/sys/netinet: . ipfw Message-ID: <201001111808.o0BI8dBK035737@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Mon Jan 11 18:08:39 2010 New Revision: 202096 URL: http://svn.freebsd.org/changeset/base/202096 Log: pass more stats upstream Modified: user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h 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 Modified: user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Mon Jan 11 17:58:15 2010 (r202095) +++ user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Mon Jan 11 18:08:39 2010 (r202096) @@ -170,10 +170,12 @@ struct new_fs { */ struct new_inst { struct dn_id oid; + struct ipfw_flow_id id; uint32_t parent_nr; /* sched or flowset nr */ - uint32_t lenght; /* Queue lenght, in packets */ + uint32_t length; /* Queue lenght, in packets */ uint32_t len_bytes; /* Queue lenght, in bytes */ uint32_t drops; + int hash_slot; uint64_t tot_pkts; /* statistics counters */ uint64_t tot_bytes; }; 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 17:58:15 2010 (r202095) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c Mon Jan 11 18:08:39 2010 (r202096) @@ -244,11 +244,14 @@ int dn_queue_packet(struct new_queue *q, struct mbuf* m) { struct new_fs *f = &(q->fs->fs); + struct new_inst *ni = &q->si->ni; uint64_t len = m->m_pkthdr.len; /* Update statistics, then check reasons to drop pkt. */ - q->tot_bytes += m->m_pkthdr.len; + q->tot_bytes += len; q->tot_pkts++; + ni->tot_bytes += len; + ni->tot_pkts++; if (f->plr && random() < f->plr) goto drop; if (f->flags & DN_QSIZE_BYTES) { @@ -260,11 +263,14 @@ dn_queue_packet(struct new_queue *q, str mq_append(&q->mq, m); q->lenght++; q->len_bytes += len; + ni->length++; + ni->len_bytes += len; return 0; drop: io_pkt_drop++; q->drops++; + ni->drops++; FREE_PKT(m); return 1; } @@ -447,7 +453,10 @@ create_si(struct new_schk *s, int slot) if (si == NULL) goto error; - set_oid(&si->oid, DN_SCH_I, 0, l); + /* XXX note we set the length only for the initial part which + * is passed up to userland. + */ + set_oid(&si->ni.oid, DN_SCH_I, 0, sizeof(struct new_inst)); set_oid(&(si->dline.oid), DN_DELAY_LINE, 0, sizeof(struct delay_line)); si->sched = s; @@ -467,7 +476,7 @@ create_si(struct new_schk *s, int slot) si->idle_time = 0; /* Put entry in front of the hash list of the parent. */ SLIST_INSERT_HEAD(&s->ht[slot], si, next); - si->hash_slot = slot; + si->ni.hash_slot = slot; dn_cfg.si_count++; return si; @@ -497,7 +506,7 @@ find_sch_inst(struct new_schk *s, struct searches++; SLIST_FOREACH(si, &s->ht[i], next) { search_steps++; - if (!mask_are_equals(&id_t, &si->id)) + if (!mask_are_equals(&id_t, &si->ni.id)) break; /* found */ } } @@ -505,7 +514,7 @@ find_sch_inst(struct new_schk *s, struct if (si == NULL) { /* no match, need to allocate a new entry */ si = create_si(s, i); if (si && s->sch.flags & DN_HAVE_MASK) - si->id = id_t; + si->ni.id = id_t; } return si; } Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Mon Jan 11 17:58:15 2010 (r202095) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_private.h Mon Jan 11 18:08:39 2010 (r202096) @@ -196,12 +196,10 @@ SLIST_HEAD(new_queue_head, new_queue); * This struct is created a runtime. */ struct new_sch_inst { - struct dn_id oid; + struct new_inst ni; /* oid, id and stats */ SLIST_ENTRY(new_sch_inst) next; /* next item in the bucket */ struct delay_line dline; struct new_schk *sched; /* the template */ - int hash_slot; /* used to print the id of the scheduler instance */ - struct ipfw_flow_id id; /* flow-id for this instance */ int kflags; /* DN_SCHED_ACTIVE */ /* queues attached to this scheduler instance */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Jan 11 17:58:15 2010 (r202095) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Jan 11 18:08:39 2010 (r202096) @@ -134,7 +134,8 @@ destroy_si(struct new_sch_inst *si) struct delay_line *dl = &si->dline; struct new_queue *q; - if (si->oid.id >= 0) /* is in the heap */ + /* XXX below we use oid.id as a marker of presence in the sysheap */ + if (si->ni.oid.id >= 0) /* is in the heap */ heap_extract(&dn_cfg.system_heap, si); if (s->fp->free_sched) s->fp->free_sched(si); @@ -298,19 +299,22 @@ copy_data(char **start, char *end, int f struct new_schk *s; SLIST_FOREACH(s, &dn_cfg.schedhash[i], next) { if (flags & DN_C_PIPE) { - printf("copy pipe %d len %d\n", - s->pipe.pipe_nr, s->pipe.oid.len); if (copy_obj(start, end, &s->pipe)) return 1; } if (flags & DN_C_SCH) { - printf("copy sched %d\n", s->sch.sched_nr); if (copy_obj(start, end, &s->sch)) return 1; } if (flags & DN_C_SCH_INST) { - printf("copy shc_inst %d\n", s->sch.sched_nr); - /* scan the hashtable */ + int j; + struct new_sch_inst *si; + for (j = 0; j < s->ht_slots; j++) { + SLIST_FOREACH(si, &s->ht[j], next) { + if (copy_obj(start, end, &si->ni)) + return 1; + } + } } } } @@ -756,9 +760,10 @@ dummynet_get(struct sockopt *sopt) default: return EINVAL; case DN_SCH: /* pipe show */ - to_copy = DN_C_SCH | DN_C_PIPE; + to_copy = DN_C_SCH | DN_C_PIPE | DN_C_SCH_INST; need = dn_cfg.schk_count * (sizeof(struct new_sch) + sizeof(struct new_pipe)); + need += dn_cfg.si_count * sizeof(struct new_inst); break; case DN_FS: /* queue show */ to_copy = DN_C_FS;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001111808.o0BI8dBK035737>