Date: Mon, 15 Jun 2009 17:14:47 +0000 (UTC) From: Oleg Bulyzhin <oleg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r194245 - head/sys/netinet/ipfw Message-ID: <200906151714.n5FHEl4F095688@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oleg Date: Mon Jun 15 17:14:47 2009 New Revision: 194245 URL: http://svn.freebsd.org/changeset/base/194245 Log: Since dn_pipe.numbytes is int64_t now - remove unnecessary overflow detection code in ready_event_wfq(). Modified: head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Mon Jun 15 16:51:07 2009 (r194244) +++ head/sys/netinet/ipfw/ip_dummynet.c Mon Jun 15 17:14:47 2009 (r194245) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); * include files marked with XXX are probably not needed */ -#include <sys/limits.h> #include <sys/param.h> #include <sys/systm.h> #include <sys/malloc.h> @@ -686,16 +685,11 @@ ready_event_wfq(struct dn_pipe *p, struc int p_was_empty = (p->head == NULL); struct dn_heap *sch = &(p->scheduler_heap); struct dn_heap *neh = &(p->not_eligible_heap); - int64_t p_numbytes = p->numbytes; DUMMYNET_LOCK_ASSERT(); if (p->if_name[0] == 0) /* tx clock is simulated */ - /* - * Since result may not fit into p->numbytes (32bit) we - * are using 64bit var here. - */ - p_numbytes += (curr_time - p->sched_time) * p->bandwidth; + p->numbytes += (curr_time - p->sched_time) * p->bandwidth; else { /* * tx clock is for real, * the ifq must be empty or this is a NOP. @@ -712,7 +706,7 @@ ready_event_wfq(struct dn_pipe *p, struc * While we have backlogged traffic AND credit, we need to do * something on the queue. */ - while (p_numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) { + while (p->numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) { if (sch->elements > 0) { /* Have some eligible pkts to send out. */ struct dn_flow_queue *q = sch->p[0].object; @@ -722,7 +716,7 @@ ready_event_wfq(struct dn_pipe *p, struc int len_scaled = p->bandwidth ? len * 8 * hz : 0; heap_extract(sch, NULL); /* Remove queue from heap. */ - p_numbytes -= len_scaled; + p->numbytes -= len_scaled; move_pkt(pkt, q, p, len); p->V += (len << MY_M) / p->sum; /* Update V. */ @@ -763,11 +757,11 @@ ready_event_wfq(struct dn_pipe *p, struc } if (p->if_name[0] != '\0') { /* Tx clock is from a real thing */ - p_numbytes = -1; /* Mark not ready for I/O. */ + p->numbytes = -1; /* Mark not ready for I/O. */ break; } } - if (sch->elements == 0 && neh->elements == 0 && p_numbytes >= 0 && + if (sch->elements == 0 && neh->elements == 0 && p->numbytes >= 0 && p->idle_heap.elements > 0) { /* * No traffic and no events scheduled. @@ -790,11 +784,11 @@ ready_event_wfq(struct dn_pipe *p, struc * If we are under credit, schedule the next ready event. * Also fix the delivery time of the last packet. */ - if (p->if_name[0]==0 && p_numbytes < 0) { /* This implies bw > 0. */ + if (p->if_name[0]==0 && p->numbytes < 0) { /* This implies bw > 0. */ dn_key t = 0; /* Number of ticks i have to wait. */ if (p->bandwidth > 0) - t = (p->bandwidth - 1 - p_numbytes) / p->bandwidth; + t = (p->bandwidth - 1 - p->numbytes) / p->bandwidth; dn_tag_get(p->tail)->output_time += t; p->sched_time = curr_time; heap_insert(&wfq_ready_heap, curr_time + t, (void *)p); @@ -804,14 +798,6 @@ ready_event_wfq(struct dn_pipe *p, struc */ } - /* Fit (adjust if necessary) 64bit result into 32bit variable. */ - if (p_numbytes > INT_MAX) - p->numbytes = INT_MAX; - else if (p_numbytes < INT_MIN) - p->numbytes = INT_MIN; - else - p->numbytes = p_numbytes; - /* * If the delay line was empty call transmit_event() now. * Otherwise, the scheduler will take care of it.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906151714.n5FHEl4F095688>