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 /sys/altq/altq_hfsc.c | |
parent | 05fac4d8fd89533ada575fcedaac2375eb557fab (diff) |
KNF
Diffstat (limited to 'sys/altq/altq_hfsc.c')
-rw-r--r-- | sys/altq/altq_hfsc.c | 96 |
1 files changed, 48 insertions, 48 deletions
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); |