diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2002-11-26 01:03:35 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2002-11-26 01:03:35 +0000 |
commit | 6e34af6845f853564bb8caf7777e4661efd210f2 (patch) | |
tree | c5504d10e8fe59138eecacf64165c556eda9ca9c | |
parent | 05fac4d8fd89533ada575fcedaac2375eb557fab (diff) |
KNF
-rw-r--r-- | sys/altq/altq_afmap.c | 16 | ||||
-rw-r--r-- | sys/altq/altq_blue.c | 24 | ||||
-rw-r--r-- | sys/altq/altq_blue.h | 4 | ||||
-rw-r--r-- | sys/altq/altq_cbq.c | 14 | ||||
-rw-r--r-- | sys/altq/altq_cbq.h | 16 | ||||
-rw-r--r-- | sys/altq/altq_cdnr.c | 32 | ||||
-rw-r--r-- | sys/altq/altq_cdnr.h | 6 | ||||
-rw-r--r-- | sys/altq/altq_classq.h | 18 | ||||
-rw-r--r-- | sys/altq/altq_conf.c | 14 | ||||
-rw-r--r-- | sys/altq/altq_fifoq.c | 6 | ||||
-rw-r--r-- | sys/altq/altq_fifoq.h | 4 | ||||
-rw-r--r-- | sys/altq/altq_hfsc.c | 96 | ||||
-rw-r--r-- | sys/altq/altq_hfsc.h | 8 | ||||
-rw-r--r-- | sys/altq/altq_localq.c | 4 | ||||
-rw-r--r-- | sys/altq/altq_priq.c | 24 | ||||
-rw-r--r-- | sys/altq/altq_priq.h | 6 | ||||
-rw-r--r-- | sys/altq/altq_red.c | 56 | ||||
-rw-r--r-- | sys/altq/altq_red.h | 4 | ||||
-rw-r--r-- | sys/altq/altq_rio.c | 16 | ||||
-rw-r--r-- | sys/altq/altq_rio.h | 8 | ||||
-rw-r--r-- | sys/altq/altq_rmclass.c | 66 | ||||
-rw-r--r-- | sys/altq/altq_rmclass.h | 4 | ||||
-rw-r--r-- | sys/altq/altq_rmclass_debug.h | 4 | ||||
-rw-r--r-- | sys/altq/altq_subr.c | 16 | ||||
-rw-r--r-- | sys/altq/altq_wfq.c | 22 | ||||
-rw-r--r-- | sys/altq/altq_wfq.h | 4 | ||||
-rw-r--r-- | sys/altq/if_altq.h | 4 |
27 files changed, 248 insertions, 248 deletions
diff --git a/sys/altq/altq_afmap.c b/sys/altq/altq_afmap.c index 61354151781..d718226e2c1 100644 --- a/sys/altq/altq_afmap.c +++ b/sys/altq/altq_afmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_afmap.c,v 1.3 2002/03/14 01:26:26 millert Exp $ */ +/* $OpenBSD: altq_afmap.c,v 1.4 2002/11/26 01:03:33 henning Exp $ */ /* $KAME: altq_afmap.c,v 1.7 2000/12/14 08:12:45 thorpej Exp $ */ /* @@ -72,7 +72,7 @@ afm_alloc(ifp) struct ifnet *ifp; { struct afm_head *head; - + MALLOC(head, struct afm_head *, sizeof(struct afm_head), M_DEVBUF, M_WAITOK); if (head == NULL) @@ -83,10 +83,10 @@ afm_alloc(ifp) LIST_INIT(&head->afh_head); head->afh_ifp = ifp; - + /* add this afm_head to the chain */ LIST_INSERT_HEAD(&afhead_chain, head, afh_chain); - + return (0); } @@ -123,7 +123,7 @@ afm_top(ifp) break; if (head == NULL) return NULL; - + return (head->afh_head.lh_first); } @@ -167,7 +167,7 @@ int afm_add(ifp, flowmap) return 0; } -int +int afm_remove(afm) struct afm *afm; { @@ -176,7 +176,7 @@ afm_remove(afm) return (0); } -int +int afm_removeall(ifp) struct ifnet *ifp; { @@ -388,7 +388,7 @@ afmioctl(dev, cmd, addr, flag, p) /* lookup interface */ flowmap = (struct atm_flowmap *)addr; - flowmap->af_ifname[IFNAMSIZ-1] = '\0'; + flowmap->af_ifname[IFNAMSIZ-1] = '\0'; ifp = ifunit(flowmap->af_ifname); if (ifp == NULL || ifp->if_ioctl == NULL || (ifp->if_flags & IFF_RUNNING) == 0) diff --git a/sys/altq/altq_blue.c b/sys/altq/altq_blue.c index 085f6f04d65..d08ab09ebf4 100644 --- a/sys/altq/altq_blue.c +++ b/sys/altq/altq_blue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_blue.c,v 1.6 2002/06/14 21:34:58 todd Exp $ */ +/* $OpenBSD: altq_blue.c,v 1.7 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_blue.c,v 1.9 2002/04/03 05:38:50 kjc Exp $ */ /* @@ -168,7 +168,7 @@ blueioctl(dev, cmd, addr, flag, p) #endif break; } - + switch (cmd) { case BLUE_ENABLE: @@ -204,7 +204,7 @@ blueioctl(dev, cmd, addr, flag, p) M_DEVBUF, M_WAITOK); bzero(rqp->rq_q, sizeof(class_queue_t)); - MALLOC(rqp->rq_blue, blue_t *, sizeof(blue_t), M_DEVBUF, M_WAITOK); + MALLOC(rqp->rq_blue, blue_t *, sizeof(blue_t), M_DEVBUF, M_WAITOK); bzero(rqp->rq_blue, sizeof(blue_t)); rqp->rq_ifq = &ifp->if_snd; @@ -291,7 +291,7 @@ blueioctl(dev, cmd, addr, flag, p) if (fc->blue_hold_time > 0) rqp->rq_blue->blue_hold_time = fc->blue_hold_time; rqp->rq_blue->blue_flags = fc->blue_flags; - + blue_init(rqp->rq_blue, rqp->rq_blue->blue_flags, rqp->rq_blue->blue_pkttime, rqp->rq_blue->blue_max_pmark, @@ -340,7 +340,7 @@ static int blue_detach(rqp) * blue support routines */ -int +int blue_init(rp, flags, pkttime, blue_max_pmark, blue_hold_time) blue_t *rp; int flags; @@ -349,7 +349,7 @@ blue_init(rp, flags, pkttime, blue_max_pmark, blue_hold_time) int blue_hold_time; { int npkts_per_sec; - + rp->blue_idle = 1; rp->blue_flags = flags; rp->blue_pkttime = pkttime; @@ -403,11 +403,11 @@ blue_addq(rp, q, m, pktattr) struct altq_pktattr *pktattr; { int droptype; - + /* * if we were idle, this is an enqueue onto an empty queue * and we should decrement marking probability - * + * */ if (rp->blue_idle) { struct timeval now; @@ -438,7 +438,7 @@ blue_addq(rp, q, m, pktattr) #ifdef BLUE_STATS rp->blue_stats.marked_packets++; #endif - } else { + } else { /* unforced drop by blue */ droptype = DTYPE_EARLY; } @@ -538,7 +538,7 @@ mark_ecn(m, pktattr, flags) struct ip *ip = (struct ip *)pktattr->pattr_hdr; u_int8_t otos; int sum; - + if (ip->ip_v != 4) return (0); /* version mismatch! */ if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_NOTECT) @@ -612,7 +612,7 @@ blue_dequeue(ifq, op) if (op == ALTDQ_POLL) return (qhead(rqp->rq_q)); - + m = blue_getq(rqp->rq_blue, rqp->rq_q); if (m != NULL) ifq->ifq_len--; @@ -624,7 +624,7 @@ struct mbuf *blue_getq(rp, q) class_queue_t *q; { struct mbuf *m; - + if ((m = _getq(q)) == NULL) { if (rp->blue_idle == 0) { rp->blue_idle = 1; diff --git a/sys/altq/altq_blue.h b/sys/altq/altq_blue.h index c816aa659cb..e2cb567bf80 100644 --- a/sys/altq/altq_blue.h +++ b/sys/altq/altq_blue.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_blue.h,v 1.3 2002/03/14 03:15:50 millert Exp $ */ +/* $OpenBSD: altq_blue.h,v 1.4 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_blue.h,v 1.5 2000/12/14 08:12:45 thorpej Exp $ */ /* @@ -64,7 +64,7 @@ struct blue_conf { #define BLUEF_ECN6 0x02 /* use packet marking for IPv6 packets */ #define BLUEF_ECN (BLUEF_ECN4 | BLUEF_ECN6) -/* +/* * IOCTLs for BLUE */ #define BLUE_IF_ATTACH _IOW('Q', 1, struct blue_interface) diff --git a/sys/altq/altq_cbq.c b/sys/altq/altq_cbq.c index 97864cbffa1..ac467528809 100644 --- a/sys/altq/altq_cbq.c +++ b/sys/altq/altq_cbq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_cbq.c,v 1.6 2002/10/11 09:30:30 kjc Exp $ */ +/* $OpenBSD: altq_cbq.c,v 1.7 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_cbq.c,v 1.9 2000/12/14 08:12:45 thorpej Exp $ */ /* @@ -27,7 +27,7 @@ * SUN MICROSYSTEMS DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE OR THE * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software is * provided "as is" without express or implied warranty of any kind. - * + * * These notices must be retained in any copies of any part of this software. */ @@ -363,11 +363,11 @@ cbq_delete_filter(dfp) { char *ifacename; cbq_state_t *cbqp; - + ifacename = dfp->cbq_iface.cbq_ifacename; if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) return (EBADF); - + return acc_delete_filter(&cbqp->cbq_classifier, dfp->cbq_filter_handle); } @@ -909,7 +909,7 @@ cbq_ifattach(ifacep) bzero(new_cbqp->cbq_class_tbl, sizeof(struct rm_class *) * CBQ_MAX_CLASSES); new_cbqp->cbq_qlen = 0; new_cbqp->ifnp.ifq_ = &ifp->if_snd; /* keep the ifq */ - + /* * set CBQ to this ifnet structure. */ @@ -1005,7 +1005,7 @@ cbq_enqueue(ifq, m, pktattr) struct m_tag *t; t = m_tag_find(m, PACKET_TAG_PF_QID, NULL); - if (t == NULL || + if (t == NULL || (cl = clh_to_clp(cbqp, ((struct altq_tag *)(t+1))->qid)) == NULL) { cl = cbqp->ifnp.default_; @@ -1234,7 +1234,7 @@ static void cbq_class_dump(i) return; } cl = cbq_list->cbq_class_tbl[i]; - + printf("class %d cl=%p\n", i, cl); if (cl != NULL) { s = &cl->stats_; diff --git a/sys/altq/altq_cbq.h b/sys/altq/altq_cbq.h index 5c9ab0a96dc..a8f62807490 100644 --- a/sys/altq/altq_cbq.h +++ b/sys/altq/altq_cbq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_cbq.h,v 1.3 2002/10/11 09:30:30 kjc Exp $ */ +/* $OpenBSD: altq_cbq.h,v 1.4 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_cbq.h,v 1.5 2000/12/02 13:44:40 kjc Exp $ */ /* @@ -27,7 +27,7 @@ * SUN MICROSYSTEMS DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE OR THE * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software is * provided "as is" without express or implied warranty of any kind. - * + * * These notices must be retained in any copies of any part of this software. */ @@ -44,7 +44,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif /* * Define a well known class handles @@ -72,7 +72,7 @@ typedef struct cbq_class_spec { u_int nano_sec_per_byte; u_int maxq; u_int maxidle; - int minidle; + int minidle; u_int offtime; u_int32_t parent_class_handle; u_int32_t borrow_class_handle; @@ -104,7 +104,7 @@ typedef struct cbq_class_spec { struct cbq_add_class { struct cbq_interface cbq_iface; - cbq_class_spec_t cbq_class; + cbq_class_spec_t cbq_class; u_int32_t cbq_class_handle; }; @@ -116,7 +116,7 @@ struct cbq_delete_class { struct cbq_modify_class { struct cbq_interface cbq_iface; - cbq_class_spec_t cbq_class; + cbq_class_spec_t cbq_class; u_int32_t cbq_class_handle; }; @@ -168,7 +168,7 @@ struct cbq_getstats { class_stats_t *stats; }; -/* +/* * Define IOCTLs for CBQ. */ #define CBQ_IF_ATTACH _IOW('Q', 1, struct cbq_interface) @@ -216,6 +216,6 @@ typedef struct cbqstate { #ifdef __cplusplus } -#endif +#endif #endif /* !_ALTQ_ALTQ_CBQ_H_ */ diff --git a/sys/altq/altq_cdnr.c b/sys/altq/altq_cdnr.c index bc6d2ac776a..a9059f37e06 100644 --- a/sys/altq/altq_cdnr.c +++ b/sys/altq/altq_cdnr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_cdnr.c,v 1.4 2002/03/14 03:15:50 millert Exp $ */ +/* $OpenBSD: altq_cdnr.c,v 1.5 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_cdnr.c,v 1.8 2000/12/14 08:12:45 thorpej Exp $ */ /* @@ -144,7 +144,7 @@ altq_cdnr_input(m, af) #ifdef INET6 if (af == AF_INET6) { u_int32_t flowlabel; - + flowlabel = ((struct ip6_hdr *)ip)->ip6_flow; pktinfo.pkt_dscp = (ntohl(flowlabel) >> 20) & DSCP_MASK; } else @@ -163,7 +163,7 @@ altq_cdnr_input(m, af) while (1) { PKTCNTR_ADD(&top->tc_cnts[tca->tca_code], pktinfo.pkt_len); - + switch (tca->tca_code) { case TCACODE_PASS: return (1); @@ -221,7 +221,7 @@ cdnr_handle2cb(handle) cb = (struct cdnr_block *)handle; if (handle != ALIGN(cb)) return (NULL); - + if (cb == NULL || cb->cb_handle != handle) return (NULL); return (cb); @@ -268,7 +268,7 @@ cdnr_cballoc(top, type, input_func) if (cb == NULL) return (NULL); bzero(cb, size); - + cb->cb_len = size; cb->cb_type = type; cb->cb_ref = 0; @@ -449,7 +449,7 @@ top_destroy(top) if (cb != NULL) generic_element_destroy(cb); } - + LIST_REMOVE(top, tc_next); cdnr_cbdestroy(top); @@ -566,7 +566,7 @@ tbm_destroy(tbm) cdnr_cbdestroy(tbm); return (0); } - + static struct tc_action * tbm_input(cb, pktinfo) struct cdnr_block *cb; @@ -575,7 +575,7 @@ tbm_input(cb, pktinfo) struct tbmeter *tbm = (struct tbmeter *)cb; u_int64_t len; u_int64_t interval, now; - + len = TB_SCALE(pktinfo->pkt_len); if (tbm->tb.token < len) { @@ -590,7 +590,7 @@ tbm_input(cb, pktinfo) } tbm->tb.last = now; } - + if (tbm->tb.token < len) { PKTCNTR_ADD(&tbm->out_cnt, pktinfo->pkt_len); return (&tbm->out_action); @@ -664,7 +664,7 @@ trtcm_destroy(tcm) cdnr_cbdestroy(tcm); return (0); } - + static struct tc_action * trtcm_input(cb, pktinfo) struct cdnr_block *cb; @@ -708,7 +708,7 @@ trtcm_input(cb, pktinfo) } tcm->peak_tb.last = now; } - + if (color == tcm->red_dscp || tcm->peak_tb.token < len) { pktinfo->pkt_dscp = tcm->red_dscp; PKTCNTR_ADD(&tcm->red_cnt, pktinfo->pkt_len); @@ -831,7 +831,7 @@ tswtcm_input(cb, pktinfo) */ if (avg_rate > tsw->cmtd_rate) { u_int32_t randval = random() % avg_rate; - + if (avg_rate > tsw->peak_rate) { if (randval < avg_rate - tsw->peak_rate) { /* mark red */ @@ -1050,13 +1050,13 @@ cdnrcmd_tcm_stats(ap) if (cb->cb_type == TCETYPE_TRTCM) { struct trtcm *tcm = (struct trtcm *)cb; - + ap->green_cnt = tcm->green_cnt; ap->yellow_cnt = tcm->yellow_cnt; ap->red_cnt = tcm->red_cnt; } else if (cb->cb_type == TCETYPE_TSWTCM) { struct tswtcm *tsw = (struct tswtcm *)cb; - + ap->green_cnt = tsw->green_cnt; ap->yellow_cnt = tsw->yellow_cnt; ap->red_cnt = tsw->red_cnt; @@ -1248,10 +1248,10 @@ cdnrioctl(dev, cmd, addr, flag, p) return (error); break; } - + s = splimp(); switch (cmd) { - + case CDNR_IF_ATTACH: ifacep = (struct cdnr_interface *)addr; error = cdnrcmd_if_attach(ifacep->cdnr_ifname); diff --git a/sys/altq/altq_cdnr.h b/sys/altq/altq_cdnr.h index d1a1b526fd5..7ad53bd5bd5 100644 --- a/sys/altq/altq_cdnr.h +++ b/sys/altq/altq_cdnr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_cdnr.h,v 1.1 2001/06/27 05:28:35 kjc Exp $ */ +/* $OpenBSD: altq_cdnr.h,v 1.2 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_cdnr.h,v 1.6 2000/12/14 08:12:45 thorpej Exp $ */ /* @@ -117,7 +117,7 @@ struct cdnr_tbmeter_stats { struct cdnr_add_trtcm { struct cdnr_interface iface; struct tb_profile cmtd_profile; /* profile for committed tb */ - struct tb_profile peak_profile; /* profile for peak tb */ + struct tb_profile peak_profile; /* profile for peak tb */ struct tc_action green_action; /* action for green packets */ struct tc_action yellow_action; /* action for yellow packets */ struct tc_action red_action; /* action for red packets */ @@ -130,7 +130,7 @@ struct cdnr_modify_trtcm { struct cdnr_interface iface; u_long cdnr_handle; struct tb_profile cmtd_profile; /* profile for committed tb */ - struct tb_profile peak_profile; /* profile for peak tb */ + struct tb_profile peak_profile; /* profile for peak tb */ int coloraware; /* color-aware/color-blind */ }; diff --git a/sys/altq/altq_classq.h b/sys/altq/altq_classq.h index 2de696af502..5be1a15245b 100644 --- a/sys/altq/altq_classq.h +++ b/sys/altq/altq_classq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_classq.h,v 1.1 2001/06/27 05:28:35 kjc Exp $ */ +/* $OpenBSD: altq_classq.h,v 1.2 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_classq.h,v 1.4 2001/02/09 07:20:40 kjc Exp $ */ /* @@ -89,11 +89,11 @@ extern void _flushq(class_queue_t *); /* * inlined versions */ -static __inline void +static __inline void _addq(class_queue_t *q, struct mbuf *m) { struct mbuf *m0; - + if ((m0 = qtail(q)) != NULL) m->m_nextpkt = m0->m_nextpkt; else @@ -107,7 +107,7 @@ static __inline struct mbuf * _getq(class_queue_t *q) { struct mbuf *m, *m0; - + if ((m = qtail(q)) == NULL) return (NULL); if ((m0 = m->m_nextpkt) != m) @@ -116,7 +116,7 @@ _getq(class_queue_t *q) qtail(q) = NULL; qlen(q)--; m0->m_nextpkt = NULL; - return (m0); + return (m0); } /* drop a packet at the tail of the queue */ @@ -132,7 +132,7 @@ _getq_tail(class_queue_t *q) m0 = m0->m_nextpkt; } while (m0 != m); prev->m_nextpkt = m->m_nextpkt; - if (prev == m) + if (prev == m) qtail(q) = NULL; else qtail(q) = prev; @@ -154,7 +154,7 @@ _getq_random(class_queue_t *q) qtail(q) = NULL; else { struct mbuf *prev = NULL; - + n = random() % qlen(q) + 1; for (i = 0; i < n; i++) { prev = m; @@ -173,14 +173,14 @@ static __inline void _removeq(class_queue_t *q, struct mbuf *m) { struct mbuf *m0, *prev; - + m0 = qtail(q); do { prev = m0; m0 = m0->m_nextpkt; } while (m0 != m); prev->m_nextpkt = m->m_nextpkt; - if (prev == m) + if (prev == m) qtail(q) = NULL; else if (qtail(q) == m) qtail(q) = prev; diff --git a/sys/altq/altq_conf.c b/sys/altq/altq_conf.c index de8c057cce5..1a5a5b51205 100644 --- a/sys/altq/altq_conf.c +++ b/sys/altq/altq_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_conf.c,v 1.3 2002/03/14 01:26:26 millert Exp $ */ +/* $OpenBSD: altq_conf.c,v 1.4 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_conf.c,v 1.11 2001/06/21 11:00:36 kjc Exp $ */ /* @@ -158,14 +158,14 @@ void altqattach(int); #define CDEV_MAJOR 96 /* FreeBSD official number */ #if (__FreeBSD_version < 400000) -static struct cdevsw altq_cdevsw = +static struct cdevsw altq_cdevsw = { altqopen, altqclose, noread, nowrite, altqioctl, nostop, nullreset, nodevtotty, seltrue, nommap, NULL, "altq", NULL, -1 }; #else -static struct cdevsw altq_cdevsw = +static struct cdevsw altq_cdevsw = { altqopen, altqclose, noread, nowrite, - altqioctl, seltrue, nommap, nostrategy, + altqioctl, seltrue, nommap, nostrategy, "altq", CDEV_MAJOR, nodump, nopsize, 0, -1 }; #endif #endif /* FreeBSD */ @@ -353,7 +353,7 @@ void altq_module_declref(type) altq_modules[type]->ref--; } -static int +static int altq_module_register(mdata) struct altq_module_data *mdata; { @@ -368,7 +368,7 @@ altq_module_register(mdata) return (0); } -static int +static int altq_module_deregister(mdata) struct altq_module_data *mdata; { @@ -410,5 +410,5 @@ altq_module_handler(mod, cmd, arg) return(error); } - + #endif /* ALTQ_KLD */ diff --git a/sys/altq/altq_fifoq.c b/sys/altq/altq_fifoq.c index 3177e9f62aa..ccb6075b73d 100644 --- a/sys/altq/altq_fifoq.c +++ b/sys/altq/altq_fifoq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_fifoq.c,v 1.4 2002/03/14 03:15:50 millert Exp $ */ +/* $OpenBSD: altq_fifoq.c,v 1.5 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_fifoq.c,v 1.7 2000/12/14 08:12:45 thorpej Exp $ */ /* @@ -137,7 +137,7 @@ fifoqioctl(dev, cmd, addr, flag, p) #endif break; } - + switch (cmd) { case FIFOQ_ENABLE: ifacep = (struct fifoq_interface *)addr; @@ -315,7 +315,7 @@ fifoq_dequeue(ifq, op) if (op == ALTDQ_POLL) return (q->q_head); - + if ((m = q->q_head) == NULL) return (NULL); diff --git a/sys/altq/altq_fifoq.h b/sys/altq/altq_fifoq.h index 13c2e53aff3..7774eff6d3a 100644 --- a/sys/altq/altq_fifoq.h +++ b/sys/altq/altq_fifoq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_fifoq.h,v 1.2 2002/06/14 21:34:58 todd Exp $ */ +/* $OpenBSD: altq_fifoq.h,v 1.3 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_fifoq.h,v 1.6 2000/12/14 08:12:45 thorpej Exp $ */ /* @@ -67,7 +67,7 @@ struct fifoq_conf { #define FIFOQ_LIMIT 50 /* default max queue length */ -/* +/* * IOCTLs for FIFOQ */ #define FIFOQ_IF_ATTACH _IOW('Q', 1, struct fifoq_interface) diff --git a/sys/altq/altq_hfsc.c b/sys/altq/altq_hfsc.c index 98d436bec99..d9c45b80c33 100644 --- a/sys/altq/altq_hfsc.c +++ b/sys/altq/altq_hfsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_hfsc.c,v 1.5 2002/05/17 07:19:44 kjc Exp $ */ +/* $OpenBSD: altq_hfsc.c,v 1.6 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_hfsc.c,v 1.13 2002/05/16 11:02:58 kjc Exp $ */ /* @@ -35,7 +35,7 @@ */ /* * H-FSC is described in Proceedings of SIGCOMM'97, - * "A Hierarchical Fair Service Curve Algorithm for Link-Sharing, + * "A Hierarchical Fair Service Curve Algorithm for Link-Sharing, * Real-Time and Priority Service" * by Ion Stoica, Hui Zhang, and T. S. Eugene Ng. */ @@ -193,7 +193,7 @@ hfsc_detach(hif) hif_list = hif->hif_next; else { struct hfsc_if *h; - + for (h = hif_list; h != NULL; h = h->hif_next) if (h->hif_next == hif) { h->hif_next = hif->hif_next; @@ -235,7 +235,7 @@ hfsc_clear_interface(hif) } } } - + return (0); } @@ -556,7 +556,7 @@ hfsc_nextclass(cl) * hfsc_enqueue is an enqueue function to be registered to * (*altq_enqueue) in struct ifaltq. */ -static int +static int hfsc_enqueue(ifq, m, pktattr) struct ifaltq *ifq; struct mbuf *m; @@ -616,7 +616,7 @@ hfsc_dequeue(ifq, op) if (op == ALTDQ_REMOVE && hif->hif_pollcache != NULL) { u_int64_t cur_time; - + cl = hif->hif_pollcache; hif->hif_pollcache = NULL; /* check if the class was scheduled by real-time criteria */ @@ -666,7 +666,7 @@ hfsc_dequeue(ifq, op) if (cl->cl_rsc != NULL) { /* update ed */ next_len = m_pktlen(qhead(cl->cl_q)); - + if (realtime) update_ed(cl, next_len); else @@ -748,11 +748,11 @@ hfsc_purgeq(cl) m_freem(m); } ASSERT(qlen(cl->cl_q) == 0); - + set_passive(cl); } -static void +static void set_active(cl, len) struct hfsc_class *cl; int len; @@ -765,7 +765,7 @@ set_active(cl, len) cl->cl_stats.period++; } -static void +static void set_passive(cl) struct hfsc_class *cl; { @@ -787,7 +787,7 @@ set_passive(cl) } } -static void +static void init_ed(cl, next_len) struct hfsc_class *cl; int next_len; @@ -817,7 +817,7 @@ init_ed(cl, next_len) ellist_insert(cl); } -static void +static void update_ed(cl, next_len) struct hfsc_class *cl; int next_len; @@ -828,7 +828,7 @@ update_ed(cl, next_len) ellist_update(cl); } -static void +static void update_d(cl, next_len) struct hfsc_class *cl; int next_len; @@ -836,7 +836,7 @@ update_d(cl, next_len) cl->cl_d = rtsc_y2x(&cl->cl_deadline, cl->cl_cumul + next_len); } -static void +static void init_v(cl, len) struct hfsc_class *cl; int len; @@ -844,7 +844,7 @@ init_v(cl, len) struct hfsc_class *min_cl, *max_cl; while (cl->cl_parent != NULL) { - + if (cl->cl_nactive++ > 0) /* already active */ break; @@ -890,7 +890,7 @@ init_v(cl, len) } } -static void +static void update_v(cl, len) struct hfsc_class *cl; int len; @@ -924,7 +924,7 @@ static ellist_t * ellist_alloc() { ellist_t *head; - + MALLOC(head, ellist_t *, sizeof(ellist_t), M_DEVBUF, M_WAITOK); TAILQ_INIT(head); return (head); @@ -937,7 +937,7 @@ ellist_destroy(head) FREE(head, M_DEVBUF); } -static void +static void ellist_insert(cl) struct hfsc_class *cl; { @@ -960,16 +960,16 @@ ellist_insert(cl) ASSERT(0); /* should not reach here */ } -static void +static void ellist_remove(cl) struct hfsc_class *cl; { struct hfsc_if *hif = cl->cl_hif; - + TAILQ_REMOVE(hif->hif_eligible, cl, cl_ellist); } -static void +static void ellist_update(cl) struct hfsc_class *cl; { @@ -1035,7 +1035,7 @@ static actlist_t * actlist_alloc() { actlist_t *head; - + MALLOC(head, actlist_t *, sizeof(actlist_t), M_DEVBUF, M_WAITOK); TAILQ_INIT(head); return (head); @@ -1047,7 +1047,7 @@ actlist_destroy(head) { FREE(head, M_DEVBUF); } -static void +static void actlist_insert(cl) struct hfsc_class *cl; { @@ -1069,7 +1069,7 @@ actlist_insert(cl) ASSERT(0); /* should not reach here */ } -static void +static void actlist_remove(cl) struct hfsc_class *cl; { @@ -1135,7 +1135,7 @@ actlist_update(cl) * bytes/nsec 12.5e-6 125e-6 1250e-6 12500e-6 125000e-6 * sm(500MHz) 25.0e-6 250e-6 2500e-6 25000e-6 250000e-6 * sm(200MHz) 62.5e-6 625e-6 6250e-6 62500e-6 625000e-6 - * + * * nsec/byte 80000 8000 800 80 8 * ism(500MHz) 40000 4000 400 40 4 * ism(200MHz) 16000 1600 160 16 1.6 @@ -1146,7 +1146,7 @@ actlist_update(cl) #define SC_LARGEVAL (1LL << 32) #define SC_INFINITY 0xffffffffffffffffLL -static __inline u_int64_t +static __inline u_int64_t seg_x2y(x, sm) u_int64_t x; u_int64_t sm; @@ -1160,7 +1160,7 @@ seg_x2y(x, sm) return (y); } -static __inline u_int64_t +static __inline u_int64_t seg_y2x(y, ism) u_int64_t y; u_int64_t ism; @@ -1178,7 +1178,7 @@ seg_y2x(y, ism) return (x); } -static __inline u_int64_t +static __inline u_int64_t m2sm(m) u_int m; { @@ -1188,7 +1188,7 @@ m2sm(m) return (sm); } -static __inline u_int64_t +static __inline u_int64_t m2ism(m) u_int m; { @@ -1201,17 +1201,17 @@ m2ism(m) return (ism); } -static __inline u_int64_t +static __inline u_int64_t d2dx(d) u_int d; { u_int64_t dx; - + dx = ((u_int64_t)d * machclk_freq) / 1000; return (dx); } -static u_int +static u_int sm2m(sm) u_int64_t sm; { @@ -1221,7 +1221,7 @@ sm2m(sm) return ((u_int)m); } -static u_int +static u_int dx2d(dx) u_int64_t dx; { @@ -1231,7 +1231,7 @@ dx2d(dx) return ((u_int)d); } -static void +static void sc2isc(sc, isc) struct service_curve *sc; struct internal_sc *isc; @@ -1248,7 +1248,7 @@ sc2isc(sc, isc) * initialize the runtime service curve with the given internal * service curve starting at (x, y). */ -static void +static void rtsc_init(rtsc, isc, x, y) struct runtime_sc *rtsc; struct internal_sc *isc; @@ -1268,7 +1268,7 @@ rtsc_init(rtsc, isc, x, y) * calculate the y-projection of the runtime service curve by the * given x-projection value */ -static u_int64_t +static u_int64_t rtsc_y2x(rtsc, y) struct runtime_sc *rtsc; u_int64_t y; @@ -1291,7 +1291,7 @@ rtsc_y2x(rtsc, y) return (x); } -static u_int64_t +static u_int64_t rtsc_x2y(rtsc, x) struct runtime_sc *rtsc; u_int64_t x; @@ -1314,7 +1314,7 @@ rtsc_x2y(rtsc, x) * update the runtime service curve by taking the minimum of the current * runtime service curve and the service curve starting at (x, y). */ -static void +static void rtsc_min(rtsc, isc, x, y) struct runtime_sc *rtsc; struct internal_sc *isc; @@ -1365,7 +1365,7 @@ rtsc_min(rtsc, isc, x, y) /* * check if (x, y1) belongs to the 1st segment of rtsc. * if so, add the offset. - */ + */ if (rtsc->x + rtsc->dx > x) dx += rtsc->x + rtsc->dx - x; dy = seg_x2y(dx, isc->sm1); @@ -1448,7 +1448,7 @@ hfscioctl(dev, cmd, addr, flag, p) #endif break; } - + switch (cmd) { case HFSC_IF_ATTACH: @@ -1530,13 +1530,13 @@ hfsccmd_if_attach(ap) struct hfsc_if *hif; struct ifnet *ifp; int error; - + if ((ifp = ifunit(ap->iface.hfsc_ifname)) == NULL) return (ENXIO); if ((hif = hfsc_attach(&ifp->if_snd, ap->bandwidth)) == NULL) return (ENOMEM); - + /* * set HFSC to this ifnet structure. */ @@ -1557,7 +1557,7 @@ hfsccmd_if_detach(ap) if ((hif = altq_lookup(ap->hfsc_ifname, ALTQT_HFSC)) == NULL) return (EBADF); - + if (ALTQ_IS_ENABLED(hif->hif_ifq)) altq_disable(hif->hif_ifq); @@ -1583,11 +1583,11 @@ hfsccmd_add_class(ap) else return (EINVAL); } - + if ((cl = hfsc_class_create(hif, &ap->service_curve, parent, ap->qlimit, ap->flags)) == NULL) return (ENOMEM); - + /* return a class handle to the user */ ap->class_handle = clp_to_clh(cl); return (0); @@ -1605,7 +1605,7 @@ hfsccmd_delete_class(ap) if ((cl = clh_to_clp(hif, ap->class_handle)) == NULL) return (EINVAL); - + return hfsc_class_destroy(cl); } @@ -1677,7 +1677,7 @@ hfsccmd_class_stats(ap) struct hfsc_class *cl; struct class_stats stats, *usp; int n, nclasses, error; - + if ((hif = altq_lookup(ap->iface.hfsc_ifname, ALTQT_HFSC)) == NULL) return (EBADF); @@ -1699,7 +1699,7 @@ hfsccmd_class_stats(ap) for (n = 0; cl != NULL && n < nclasses; cl = hfsc_nextclass(cl), n++) { get_class_stats(&stats, cl); - + if ((error = copyout((caddr_t)&stats, (caddr_t)usp++, sizeof(stats))) != 0) return (error); diff --git a/sys/altq/altq_hfsc.h b/sys/altq/altq_hfsc.h index edcac261a5e..f11bea3877d 100644 --- a/sys/altq/altq_hfsc.h +++ b/sys/altq/altq_hfsc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_hfsc.h,v 1.1 2001/06/27 05:28:35 kjc Exp $ */ +/* $OpenBSD: altq_hfsc.h,v 1.2 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_hfsc.h,v 1.6 2000/12/14 08:12:46 thorpej Exp $ */ /* @@ -43,7 +43,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif struct hfsc_interface { char hfsc_ifname[IFNAMSIZ]; /* interface name (e.g., fxp0) */ @@ -264,7 +264,7 @@ struct hfsc_if { u_int hif_classes; /* # of classes in the tree */ u_int hif_packets; /* # of packets in the tree */ u_int hif_classid; /* class id sequence number */ - + ellist_t *hif_eligible; /* eligible list */ struct acc_classifier hif_classifier; @@ -274,6 +274,6 @@ struct hfsc_if { #ifdef __cplusplus } -#endif +#endif #endif /* _ALTQ_ALTQ_HFSC_H_ */ diff --git a/sys/altq/altq_localq.c b/sys/altq/altq_localq.c index f692597819a..6538e9360fe 100644 --- a/sys/altq/altq_localq.c +++ b/sys/altq/altq_localq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_localq.c,v 1.3 2001/08/16 13:05:24 kjc Exp $ */ +/* $OpenBSD: altq_localq.c,v 1.4 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_localq.c,v 1.4 2001/08/16 11:28:25 kjc Exp $ */ /* * a skeleton file for implementing a new queueing discipline. @@ -51,7 +51,7 @@ localqioctl(dev, cmd, addr, flag, p) struct proc *p; { int error = 0; - + return error; } diff --git a/sys/altq/altq_priq.c b/sys/altq/altq_priq.c index 9d704184a54..994a89b6afd 100644 --- a/sys/altq/altq_priq.c +++ b/sys/altq/altq_priq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_priq.c,v 1.4 2002/03/14 01:26:26 millert Exp $ */ +/* $OpenBSD: altq_priq.c,v 1.5 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_priq.c,v 1.1 2000/10/18 09:15:23 kjc Exp $ */ /* * Copyright (C) 2000 @@ -119,7 +119,7 @@ priq_detach(pif) pif_list = pif->pif_next; else { struct priq_if *p; - + for (p = pif_list; p != NULL; p = p->pif_next) if (p->pif_next == pif) { p->pif_next = pif->pif_next; @@ -266,7 +266,7 @@ priq_class_create(pif, pri, qlimit, flags) red_flags, red_pkttime); if (cl->cl_red != NULL) qtype(cl->cl_q) = Q_RIO; - } else + } else #endif if (flags & PRCF_RED) { cl->cl_red = red_alloc(0, 0, 0, 0, @@ -343,7 +343,7 @@ priq_class_destroy(cl) * priq_enqueue is an enqueue function to be registered to * (*altq_enqueue) in struct ifaltq. */ -static int +static int priq_enqueue(ifq, m, pktattr) struct ifaltq *ifq; struct mbuf *m; @@ -431,7 +431,7 @@ priq_addq(cl, m) m_freem(m); return (-1); } - + if (cl->cl_flags & PRCF_CLEARDSCP) write_dsfield(m, cl->cl_pktattr, 0); @@ -541,7 +541,7 @@ priqioctl(dev, cmd, addr, flag, p) #endif break; } - + switch (cmd) { case PRIQ_IF_ATTACH: @@ -622,13 +622,13 @@ priqcmd_if_attach(ap) struct priq_if *pif; struct ifnet *ifp; int error; - + if ((ifp = ifunit(ap->ifname)) == NULL) return (ENXIO); if ((pif = priq_attach(&ifp->if_snd, ap->arg)) == NULL) return (ENOMEM); - + /* * set PRIQ to this ifnet structure. */ @@ -649,7 +649,7 @@ priqcmd_if_detach(ap) if ((pif = altq_lookup(ap->ifname, ALTQT_PRIQ)) == NULL) return (EBADF); - + if (ALTQ_IS_ENABLED(pif->pif_ifq)) altq_disable(pif->pif_ifq); @@ -675,7 +675,7 @@ priqcmd_add_class(ap) if ((cl = priq_class_create(pif, ap->pri, ap->qlimit, ap->flags)) == NULL) return (ENOMEM); - + /* return a class handle to the user */ ap->class_handle = clp_to_clh(cl); return (0); @@ -693,7 +693,7 @@ priqcmd_delete_class(ap) if ((cl = clh_to_clp(pif, ap->class_handle)) == NULL) return (EINVAL); - + return priq_class_destroy(cl); } @@ -769,7 +769,7 @@ priqcmd_class_stats(ap) struct priq_class *cl; struct class_stats stats, *usp; int pri, error; - + if ((pif = altq_lookup(ap->iface.ifname, ALTQT_PRIQ)) == NULL) return (EBADF); diff --git a/sys/altq/altq_priq.h b/sys/altq/altq_priq.h index 12395f945fa..1bdc0533d28 100644 --- a/sys/altq/altq_priq.h +++ b/sys/altq/altq_priq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_priq.h,v 1.1 2001/06/27 05:28:35 kjc Exp $ */ +/* $OpenBSD: altq_priq.h,v 1.2 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_priq.h,v 1.1 2000/10/18 09:15:23 kjc Exp $ */ /* * Copyright (C) 2000 @@ -36,7 +36,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif #define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */ @@ -156,6 +156,6 @@ struct priq_if { #ifdef __cplusplus } -#endif +#endif #endif /* _ALTQ_ALTQ_PRIQ_H_ */ diff --git a/sys/altq/altq_red.c b/sys/altq/altq_red.c index 196989daac3..08dd2a703c1 100644 --- a/sys/altq/altq_red.c +++ b/sys/altq/altq_red.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_red.c,v 1.6 2002/10/11 09:30:30 kjc Exp $ */ +/* $OpenBSD: altq_red.c,v 1.7 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_red.c,v 1.10 2002/04/03 05:38:51 kjc Exp $ */ /* @@ -111,7 +111,7 @@ * linterm=30 * dropmech=drop-tail * bytes=false (can't be handled by 32-bit fixed-point) - * doubleq=false dqthresh=false + * doubleq=false dqthresh=false * wait=true */ /* @@ -263,7 +263,7 @@ redioctl(dev, cmd, addr, flag, p) return (error); break; } - + switch (cmd) { case RED_ENABLE: @@ -454,7 +454,7 @@ redioctl(dev, cmd, addr, flag, p) default_inv_pmax = rp->inv_pmax; } while (0); break; - + default: error = EINVAL; break; @@ -505,7 +505,7 @@ red_alloc(weight, inv_pmax, th_min, th_max, flags, pkttime) red_t *rp; int w, i; int npkts_per_sec; - + MALLOC(rp, red_t *, sizeof(red_t), M_DEVBUF, M_WAITOK); if (rp == NULL) return (NULL); @@ -536,7 +536,7 @@ red_alloc(weight, inv_pmax, th_min, th_max, flags, pkttime) if (pkttime == 0) /* default packet time: 1000 bytes / 10Mbps * 8 * 1000000 */ rp->red_pkttime = 800; - else + else rp->red_pkttime = pkttime; if (weight == 0) { @@ -562,7 +562,7 @@ red_alloc(weight, inv_pmax, th_min, th_max, flags, pkttime) rp->red_weight, w); rp->red_weight = w; } - + /* * thmin_s and thmax_s are scaled versions of th_min and th_max * to be compared with avg. @@ -601,7 +601,7 @@ red_destroy(rp) FREE(rp, M_DEVBUF); } -void +void red_getstats(rp, sp) red_t *rp; struct redstats *sp; @@ -713,7 +713,7 @@ red_addq(rp, q, m, pktattr) #ifdef RED_STATS rp->red_stats.marked_packets++; #endif - } else { + } else { /* unforced drop by red */ droptype = DTYPE_EARLY; } @@ -950,7 +950,7 @@ red_getq(rp, q) class_queue_t *q; { struct mbuf *m; - + if ((m = _getq(q)) == NULL) { if (rp->red_idle == 0) { rp->red_idle = 1; @@ -1031,7 +1031,7 @@ wtab_alloc(weight) return (w); } -int +int wtab_destroy(w) struct wtab *w; { @@ -1052,7 +1052,7 @@ wtab_destroy(w) return (0); } -int32_t +int32_t pow_w(w, n) struct wtab *w; int n; @@ -1095,7 +1095,7 @@ pow_w(w, n) #define FV_N 10 /* update fve_f every FV_N packets */ #define FV_BACKOFFTHRESH 1 /* backoff threshold interval in second */ -#define FV_TTHRESH 3 /* time threshold to delete fve */ +#define FV_TTHRESH 3 /* time threshold to delete fve */ #define FV_ALPHA 5 /* extra packet count */ #define FV_STATS @@ -1121,21 +1121,21 @@ pow_w(w, n) #define BRTT_PMAX (1 << (FV_PSHIFT + FP_SHIFT)) const int brtt_tab[BRTT_SIZE] = { - 0, 1262010, 877019, 703694, 598706, 525854, 471107, 427728, - 392026, 361788, 335598, 312506, 291850, 273158, 256081, 240361, - 225800, 212247, 199585, 187788, 178388, 169544, 161207, 153333, - 145888, 138841, 132165, 125836, 119834, 114141, 108739, 103612, - 98747, 94129, 89746, 85585, 81637, 77889, 74333, 70957, - 67752, 64711, 61824, 59084, 56482, 54013, 51667, 49440, - 47325, 45315, 43406, 41591, 39866, 38227, 36667, 35184, - 33773, 32430, 31151, 29933, 28774, 27668, 26615, 25611, - 24653, 23740, 22868, 22035, 21240, 20481, 19755, 19062, - 18399, 17764, 17157, 16576, 16020, 15487, 14976, 14487, - 14017, 13567, 13136, 12721, 12323, 11941, 11574, 11222, - 10883, 10557, 10243, 9942, 9652, 9372, 9103, 8844, - 8594, 8354, 8122, 7898, 7682, 7474, 7273, 7079, - 6892, 6711, 6536, 6367, 6204, 6046, 5893, 5746, - 5603, 5464, 5330, 5201, 5075, 4954, 4836, 4722, + 0, 1262010, 877019, 703694, 598706, 525854, 471107, 427728, + 392026, 361788, 335598, 312506, 291850, 273158, 256081, 240361, + 225800, 212247, 199585, 187788, 178388, 169544, 161207, 153333, + 145888, 138841, 132165, 125836, 119834, 114141, 108739, 103612, + 98747, 94129, 89746, 85585, 81637, 77889, 74333, 70957, + 67752, 64711, 61824, 59084, 56482, 54013, 51667, 49440, + 47325, 45315, 43406, 41591, 39866, 38227, 36667, 35184, + 33773, 32430, 31151, 29933, 28774, 27668, 26615, 25611, + 24653, 23740, 22868, 22035, 21240, 20481, 19755, 19062, + 18399, 17764, 17157, 16576, 16020, 15487, 14976, 14487, + 14017, 13567, 13136, 12721, 12323, 11941, 11574, 11222, + 10883, 10557, 10243, 9942, 9652, 9372, 9103, 8844, + 8594, 8354, 8122, 7898, 7682, 7474, 7273, 7079, + 6892, 6711, 6536, 6367, 6204, 6046, 5893, 5746, + 5603, 5464, 5330, 5201, 5075, 4954, 4836, 4722, 4611, 4504, 4400, 4299, 4201, 4106, 4014, 3924 }; diff --git a/sys/altq/altq_red.h b/sys/altq/altq_red.h index 08edbabd624..ef6fd036204 100644 --- a/sys/altq/altq_red.h +++ b/sys/altq/altq_red.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_red.h,v 1.2 2002/03/14 01:26:26 millert Exp $ */ +/* $OpenBSD: altq_red.h,v 1.3 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_red.h,v 1.5 2000/12/14 08:12:46 thorpej Exp $ */ /* @@ -99,7 +99,7 @@ struct redstats { }; -/* +/* * IOCTLs for RED */ #define RED_IF_ATTACH _IOW('Q', 1, struct red_interface) diff --git a/sys/altq/altq_rio.c b/sys/altq/altq_rio.c index f68ed7c5837..329bd129657 100644 --- a/sys/altq/altq_rio.c +++ b/sys/altq/altq_rio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_rio.c,v 1.4 2002/06/14 21:34:58 todd Exp $ */ +/* $OpenBSD: altq_rio.c,v 1.5 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_rio.c,v 1.8 2000/12/14 08:12:46 thorpej Exp $ */ /* @@ -99,7 +99,7 @@ /* * AF DS (differentiated service) codepoints. * (classes can be mapped to CBQ or H-FSC classes.) - * + * * 0 1 2 3 4 5 6 7 * +---+---+---+---+---+---+---+---+ * | CLASS |DropPre| 0 | CU | @@ -237,7 +237,7 @@ rioioctl(dev, cmd, addr, flag, p) #endif break; } - + switch (cmd) { case RIO_ENABLE: @@ -485,7 +485,7 @@ rio_alloc(weight, params, flags, pkttime) rio_t *rp; int w, i; int npkts_per_sec; - + MALLOC(rp, rio_t *, sizeof(rio_t), M_DEVBUF, M_WAITOK); if (rp == NULL) return (NULL); @@ -495,7 +495,7 @@ rio_alloc(weight, params, flags, pkttime) if (pkttime == 0) /* default packet time: 1000 bytes / 10Mbps * 8 * 1000000 */ rp->rio_pkttime = 800; - else + else rp->rio_pkttime = pkttime; if (weight != 0) @@ -577,13 +577,13 @@ rio_destroy(rp) FREE(rp, M_DEVBUF); } -void +void rio_getstats(rp, sp) rio_t *rp; struct redstats *sp; { int i; - + for (i = 0; i < RIO_NDROPPREC; i++) { bcopy(&rp->q_stats[i], sp, sizeof(struct redstats)); sp->q_avg = rp->rio_precstate[i].avg >> rp->rio_wshift; @@ -696,7 +696,7 @@ rio_addq(rp, q, m, pktattr) prec = &rp->rio_precstate[dpindex]; avg = prec->avg; - + /* see if we drop early */ droptype = DTYPE_NODROP; if (avg >= prec->th_min_s && prec->qlen > 1) { diff --git a/sys/altq/altq_rio.h b/sys/altq/altq_rio.h index e96411f7a1b..fdc39fb9fe5 100644 --- a/sys/altq/altq_rio.h +++ b/sys/altq/altq_rio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_rio.h,v 1.2 2002/03/14 01:26:26 millert Exp $ */ +/* $OpenBSD: altq_rio.h,v 1.3 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_rio.h,v 1.5 2000/12/14 08:12:46 thorpej Exp $ */ /* @@ -69,7 +69,7 @@ struct rio_conf { #define RIOF_ECN (RIOF_ECN4 | RIOF_ECN6) #define RIOF_CLEARDSCP 0x200 /* clear diffserv codepoint */ -/* +/* * IOCTLs for RIO */ #define RIO_IF_ATTACH _IOW('Q', 1, struct rio_interface) @@ -103,7 +103,7 @@ typedef struct rio { int old; /* avg is above th_min */ struct timeval last; /* timestamp when queue becomes idle */ } rio_precstate[RIO_NDROPPREC]; - + int rio_wshift; /* log(red_weight) */ int rio_weight; /* weight for EWMA */ struct wtab *rio_wtab; /* weight table */ @@ -114,7 +114,7 @@ typedef struct rio { u_int8_t rio_codepoint; /* codepoint value to tag packets */ u_int8_t rio_codepointmask; /* codepoint mask bits */ - + struct redstats q_stats[RIO_NDROPPREC]; /* statistics */ } rio_t; diff --git a/sys/altq/altq_rmclass.c b/sys/altq/altq_rmclass.c index 447a6af8b34..d9186f8ce6a 100644 --- a/sys/altq/altq_rmclass.c +++ b/sys/altq/altq_rmclass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_rmclass.c,v 1.3 2002/03/14 01:26:26 millert Exp $ */ +/* $OpenBSD: altq_rmclass.c,v 1.4 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_rmclass.c,v 1.10 2001/02/09 07:20:40 kjc Exp $ */ /* @@ -170,8 +170,8 @@ static void rmc_root_overlimit(struct rm_class *, struct rm_class *); * maxidle = maxidle * 2^RM_FILTER_GAIN * 8 / (1000 * nsecPerByte) * offtime = offtime * 8 / (1000 * nsecPerByte) * - * When USE_HRTIME is employed, then maxidle and offtime become: - * maxidle = maxilde * (8.0 / nsecPerByte); + * When USE_HRTIME is employed, then maxidle and offtime become: + * maxidle = maxilde * (8.0 / nsecPerByte); * offtime = offtime * (8.0 / nsecPerByte); */ @@ -509,7 +509,7 @@ rmc_depth_recompute(rm_class_t *cl) p->depth_ = cdepth + 1; } - + p = p->parent_; } #else @@ -525,7 +525,7 @@ rmc_depth_recompute(rm_class_t *cl) t = t->next_; } } else - rmc_depth_compute(cl); + rmc_depth_compute(cl); } #endif } @@ -551,7 +551,7 @@ rmc_delete_class(ifd, cl) if (cl->sleeping_) CALLOUT_STOP(&cl->callout_); - + s = splimp(); /* * Free packets in the packet queue. @@ -679,7 +679,7 @@ rmc_init(ifq, ifd, nsecPerByte, restart, maxq, maxqueued, maxidle, /* * Initialize the CBQ traciing/debug facility. */ - CBQTRACEINIT(); + CBQTRACEINIT(); bzero((char *)ifd, sizeof (*ifd)); mtu = ifq->altq_ifp->if_mtu; @@ -768,7 +768,7 @@ rmc_queue_packet(cl, m) /* * the class is overlimit. if the class has * underlimit ancestors, set cutoff to the lowest - * depth among them. + * depth among them. */ struct rm_class *borrow = cl->borrow_; @@ -781,7 +781,7 @@ rmc_queue_packet(cl, m) } borrow = borrow->borrow_; } - } + } #else /* !ALTQ */ else if ((ifd->cutoff_ > 1) && cl->borrow_) { if (TV_LT(&cl->borrow_->undertime_, &now)) { @@ -789,7 +789,7 @@ rmc_queue_packet(cl, m) CBQTRACE(rmc_queue_packet, 'ffob', cl->borrow_->depth_); } - } + } #endif /* !ALTQ */ } @@ -831,7 +831,7 @@ rmc_tl_satisfied(ifd, now) if (!rmc_satisfied(p, now)) { ifd->cutoff_ = p->depth_; return; - } + } p = p->peer_; } while (p != bp); } @@ -858,7 +858,7 @@ rmc_satisfied(cl, now) if (cl->depth_ == 0) { if (!cl->sleeping_ && (qlen(cl->q_) > cl->qthresh_)) return (0); - else + else return (1); } if (cl->children_ != NULL) { @@ -925,7 +925,7 @@ rmc_under_limit(cl, now) */ if (cl != NULL) { /* cutoff is taking effect, use this class as top. */ - top = cl; + top = cl; CBQTRACE(rmc_under_limit, 'ffou', ifd->cutoff_); } if (top != NULL && top->avgidle_ == top->minidle_) @@ -1038,13 +1038,13 @@ _rmc_wrr_dequeue_next(ifd, op) cl->bytes_alloc_ = 0; cl = cl->peer_; } while (cl != ifd->active_[cpri]); - + if (deficit == 1) { /* first loop found an underlimit class with deficit */ /* Loop on same priority level, with new deficit. */ deficit = 2; goto _wrr_loop; - } + } } #ifdef ADJUST_CUTOFF @@ -1351,7 +1351,7 @@ rmc_update_class_util(ifd) avgidle = cl->avgidle_; avgidle += idle - (avgidle >> RM_FILTER_GAIN); cl->avgidle_ = avgidle; - + /* Are we overlimit ? */ if (avgidle <= 0) { CBQTRACE(rmc_update_class_util, 'milo', cl->stats_.handle); @@ -1395,7 +1395,7 @@ rmc_update_class_util(ifd) #endif cl = cl->parent_; - } + } /* * Check to see if cutoff needs to set to a new level. @@ -1406,7 +1406,7 @@ rmc_update_class_util(ifd) if ((qlen(cl->q_) <= 0) || TV_LT(nowp, &borrowed->undertime_)) { rmc_tl_satisfied(ifd, nowp); CBQTRACE(rmc_update_class_util, 'broe', ifd->cutoff_); - } else { + } else { ifd->cutoff_ = borrowed->depth_; CBQTRACE(rmc_update_class_util, 'ffob', borrowed->depth_); } @@ -1417,7 +1417,7 @@ rmc_update_class_util(ifd) rmc_tl_satisfied(ifd, &now); #endif CBQTRACE(rmc_update_class_util, 'broe', ifd->cutoff_); - } else { + } else { ifd->cutoff_ = borrowed->depth_; CBQTRACE(rmc_update_class_util, 'ffob', borrowed->depth_); } @@ -1459,10 +1459,10 @@ void rmc_dropall(cl) struct rm_class *cl; { struct rm_ifdat *ifd = cl->ifdat_; - + if (!qempty(cl->q_)) { _flushq(cl->q_); - + ifd->na_[cl->pri_]--; } } @@ -1542,7 +1542,7 @@ rmc_delay_action(cl, borrow) * short time so we have to wait for at least two ticks. * NOTE: If there's no other traffic, we need the timer as * a 'backstop' to restart this class. - */ + */ if (delay > tick * 2) { #ifdef __FreeBSD__ /* FreeBSD rounds up the tick */ @@ -1622,11 +1622,11 @@ _rmc_addq(cl, m) mbuf_t *m; { #ifdef ALTQ_RIO - if (q_is_rio(cl->q_)) + if (q_is_rio(cl->q_)) return rio_addq((rio_t *)cl->red_, cl->q_, m, cl->pktattr_); #endif #ifdef ALTQ_RED - if (q_is_red(cl->q_)) + if (q_is_red(cl->q_)) return red_addq(cl->red_, cl->q_, m, cl->pktattr_); #endif /* ALTQ_RED */ @@ -1687,7 +1687,7 @@ static char *rmc_funcname(void *); static struct rmc_funcs { void *func; char *name; -} rmc_funcs[] = +} rmc_funcs[] = { rmc_init, "rmc_init", rmc_queue_packet, "rmc_queue_packet", @@ -1718,7 +1718,7 @@ void cbqtrace_dump(counter) counter = counter % NCBQTRACE; p = (int *)&cbqtrace_buffer[counter]; - + for (i=0; i<20; i++) { printf("[0x%x] ", *p++); printf("%s: ", rmc_funcname((void *)*p++)); @@ -1735,13 +1735,13 @@ void cbqtrace_dump(counter) #if defined(ALTQ_CBQ) || defined(ALTQ_RED) || defined(ALTQ_RIO) || defined(ALTQ_HFSC) || defined(ALTQ_PRIQ) #if !defined(__GNUC__) || defined(ALTQ_DEBUG) -void +void _addq(q, m) class_queue_t *q; mbuf_t *m; { mbuf_t *m0; - + if ((m0 = qtail(q)) != NULL) m->m_nextpkt = m0->m_nextpkt; else @@ -1756,7 +1756,7 @@ _getq(q) class_queue_t *q; { mbuf_t *m, *m0; - + if ((m = qtail(q)) == NULL) return (NULL); if ((m0 = m->m_nextpkt) != m) @@ -1767,7 +1767,7 @@ _getq(q) } qlen(q)--; m0->m_nextpkt = NULL; - return (m0); + return (m0); } /* drop a packet at the tail of the queue */ @@ -1809,7 +1809,7 @@ _getq_random(q) qtail(q) = NULL; } else { struct mbuf *prev = NULL; - + n = random() % qlen(q) + 1; for (i = 0; i < n; i++) { prev = m; @@ -1830,14 +1830,14 @@ _removeq(q, m) mbuf_t *m; { mbuf_t *m0, *prev; - + m0 = qtail(q); do { prev = m0; m0 = m0->m_nextpkt; } while (m0 != m); prev->m_nextpkt = m->m_nextpkt; - if (prev == m) + if (prev == m) qtail(q) = NULL; else if (qtail(q) == m) qtail(q) = prev; diff --git a/sys/altq/altq_rmclass.h b/sys/altq/altq_rmclass.h index 91cf4b29ef9..95cd0b615dd 100644 --- a/sys/altq/altq_rmclass.h +++ b/sys/altq/altq_rmclass.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_rmclass.h,v 1.4 2002/03/14 03:15:50 millert Exp $ */ +/* $OpenBSD: altq_rmclass.h,v 1.5 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_rmclass.h,v 1.6 2000/12/09 09:22:44 kjc Exp $ */ /* @@ -137,7 +137,7 @@ typedef struct _rm_class_stats_ { */ struct rm_class { class_queue_t *q_; /* Queue of packets */ - rm_ifdat_t *ifdat_; + rm_ifdat_t *ifdat_; int pri_; /* Class priority. */ int depth_; /* Class depth */ u_int ns_per_byte_; /* NanoSeconds per byte. */ diff --git a/sys/altq/altq_rmclass_debug.h b/sys/altq/altq_rmclass_debug.h index 1ff4f595252..a8811057b99 100644 --- a/sys/altq/altq_rmclass_debug.h +++ b/sys/altq/altq_rmclass_debug.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_rmclass_debug.h,v 1.1 2001/06/27 05:28:36 kjc Exp $ */ +/* $OpenBSD: altq_rmclass_debug.h,v 1.2 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_rmclass_debug.h,v 1.2 2000/02/22 14:00:35 itojun Exp $ */ /* @@ -27,7 +27,7 @@ * SUN MICROSYSTEMS DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE OR THE * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software is * provided "as is" without express or implied warranty of any kind. - * + * * These notices must be retained in any copies of any part of this software. */ diff --git a/sys/altq/altq_subr.c b/sys/altq/altq_subr.c index 042b4dbe343..f6fa7f72ae9 100644 --- a/sys/altq/altq_subr.c +++ b/sys/altq/altq_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_subr.c,v 1.9 2002/10/11 09:30:30 kjc Exp $ */ +/* $OpenBSD: altq_subr.c,v 1.10 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_subr.c,v 1.11 2002/01/11 08:11:49 kjc Exp $ */ /* @@ -197,7 +197,7 @@ altq_enable(ifq) struct ifaltq *ifq; { int s; - + if (!ALTQ_IS_READY(ifq)) return ENXIO; if (ALTQ_IS_ENABLED(ifq)) @@ -219,7 +219,7 @@ altq_disable(ifq) struct ifaltq *ifq; { int s; - + if (!ALTQ_IS_ENABLED(ifq)) return 0; @@ -317,7 +317,7 @@ tbr_set(ifq, profile) printf("tbr_set: no cpu clock available!\n"); return (ENXIO); } - + if (profile->rate == 0) { /* delete this tbr */ if ((tbr = ifq->altq_tbr) == NULL) @@ -472,7 +472,7 @@ altq_pfdetach(struct pf_altq *a) { struct ifnet *ifp; int s, error = 0; - + if ((ifp = ifunit(a->ifname)) == NULL) return (EINVAL); @@ -599,13 +599,13 @@ altq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes) #define IPPROTO_AH 51 /* authentication header */ #endif -/* +/* * extract flow information from a given packet. * filt_mask shows flowinfo fields required. * we assume the ip header is in one mbuf, and addresses and ports are * in network byte order. */ -int +int altq_extractflow(m, af, flow, filt_bmask) struct mbuf *m; int af; @@ -1674,7 +1674,7 @@ extern u_int64_t cpu_tsc_freq; #endif void -init_machclk(void) +init_machclk(void) { /* sanity check */ #ifdef __i386__ diff --git a/sys/altq/altq_wfq.c b/sys/altq/altq_wfq.c index 95b613639a0..afc9ed91108 100644 --- a/sys/altq/altq_wfq.c +++ b/sys/altq/altq_wfq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_wfq.c,v 1.3 2002/03/14 01:26:26 millert Exp $ */ +/* $OpenBSD: altq_wfq.c,v 1.4 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_wfq.c,v 1.7 2000/12/14 08:12:46 thorpej Exp $ */ /* @@ -28,7 +28,7 @@ */ /* * March 27, 1997. Written by Hiroshi Kyusojin of Keio University - * (kyu@mt.cs.keio.ac.jp). + * (kyu@mt.cs.keio.ac.jp). */ #include <sys/types.h> @@ -187,7 +187,7 @@ wfq_ifdetach(ifacep) /* remove WFQ from the ifnet structure. */ (void)altq_disable(wfqp->ifq); (void)altq_detach(wfqp->ifq); - + /* remove from the wfqstate list */ if (wfq_list == wfqp) wfq_list = wfqp->next; @@ -200,7 +200,7 @@ wfq_ifdetach(ifacep) } } while ((wp = wp->next) != NULL); } - + /* deallocate wfq_state_t */ FREE(wfqp->queue, M_DEVBUF); FREE(wfqp, M_DEVBUF); @@ -316,7 +316,7 @@ wfq_ifenqueue(ifq, mp, pktattr) } return error; } - + static u_long wfq_hash(flow, n) struct flowinfo *flow; @@ -433,14 +433,14 @@ wfq_ifdequeue(ifq, op) if ((wfqp->bytes == 0) || ((queue = wfqp->rrp) == NULL)) /* no packet in the queues */ return NULL; - + while (1) { if (queue->quota > 0) { if (queue->bytes <= 0) { /* this queue no longer has packet. remove the queue from the active list. */ if (queue->next == queue){ - /* no other active queue + /* no other active queue -- this case never happens in this algorithm. */ queue->next = queue->prev = NULL; @@ -479,7 +479,7 @@ wfq_ifdequeue(ifq, op) the queue will be removed from the active list at the next round */ } - + /* advance the round-robin pointer */ queue = wfqp->rrp = queue->next; WFQ_ADDQUOTA(queue); @@ -495,7 +495,7 @@ wfq_getqid(gqidp) if ((wfqp = altq_lookup(gqidp->iface.wfq_ifacename, ALTQT_WFQ)) == NULL) return (EBADF); - + gqidp->qid = (*wfqp->hash_func)(&gqidp->flow, wfqp->nums); return 0; } @@ -644,7 +644,7 @@ wfqclose(dev, flag, fmt, p) struct wfq_interface iface; wfq_state_t *wfqp; int s; - + s = splimp(); while ((wfqp = wfq_list) != NULL) { ifp = wfqp->ifq->altq_ifp; @@ -688,7 +688,7 @@ wfqioctl(dev, cmd, addr, flag, p) s = splimp(); switch (cmd) { - + case WFQ_ENABLE: error = wfq_setenable((struct wfq_interface *)addr, ENABLE); break; diff --git a/sys/altq/altq_wfq.h b/sys/altq/altq_wfq.h index 1fe215f0f02..8c42000e08c 100644 --- a/sys/altq/altq_wfq.h +++ b/sys/altq/altq_wfq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: altq_wfq.h,v 1.1 2001/06/27 05:28:36 kjc Exp $ */ +/* $OpenBSD: altq_wfq.h,v 1.2 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: altq_wfq.h,v 1.5 2000/12/14 08:12:46 thorpej Exp $ */ /* @@ -28,7 +28,7 @@ */ /* * March 27, 1997. Written by Hiroshi Kyusojin of Keio University - * (kyu@mt.cs.keio.ac.jp). + * (kyu@mt.cs.keio.ac.jp). */ #ifndef _ALTQ_ALTQ_WFQ_H_ diff --git a/sys/altq/if_altq.h b/sys/altq/if_altq.h index aae4dd9839c..4df577faf4a 100644 --- a/sys/altq/if_altq.h +++ b/sys/altq/if_altq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_altq.h,v 1.5 2002/10/08 05:12:08 kjc Exp $ */ +/* $OpenBSD: if_altq.h,v 1.6 2002/11/26 01:03:34 henning Exp $ */ /* $KAME: if_altq.h,v 1.6 2001/01/29 19:59:09 itojun Exp $ */ /* @@ -161,7 +161,7 @@ struct tb_regulator { extern int altq_attach(struct ifaltq *, int, void *, int (*)(struct ifaltq *, struct mbuf *, struct altq_pktattr *), - struct mbuf *(*)(struct ifaltq *, int), + struct mbuf *(*)(struct ifaltq *, int), int (*)(struct ifaltq *, int, void *), void *, void *(*)(void *, struct mbuf *, int)); |