From: Claudio Jeker Subject: Re: use nsecuptime() in fq_codel.c directly To: David Gwynne Cc: tech@openbsd.org Date: Mon, 28 Oct 2024 12:57:36 +0100 On Fri, Oct 25, 2024 at 03:48:31PM +1000, David Gwynne wrote: > codel uses nsecs for timestamps already, but uses nanouptime and some > maths to get them. it could just use nsecuptime(). > > ok? OK claudio > Index: fq_codel.c > =================================================================== > RCS file: /cvs/src/sys/net/fq_codel.c,v > diff -u -p -r1.15 fq_codel.c > --- fq_codel.c 2 Jan 2022 22:36:03 -0000 1.15 > +++ fq_codel.c 25 Oct 2024 05:46:50 -0000 > @@ -292,15 +292,6 @@ codel_freeparams(struct codel_params *cp > cp->intervals = NULL; > } > > -static inline void > -codel_gettime(int64_t *now) > -{ > - struct timespec tv; > - > - nanouptime(&tv); > - *now = tv.tv_sec * 1000000000LL + tv.tv_nsec; > -} > - > static inline unsigned int > codel_backlog(struct codel *cd) > { > @@ -543,7 +534,7 @@ fqcodel_enq(struct fqcodel *fqc, struct > if (flow == NULL) > return (m); > > - codel_gettime(&now); > + now = nsecuptime(); > codel_enqueue(&flow->cd, now, m); > fqc->qlength++; > > @@ -650,7 +641,7 @@ fqcodel_deq_begin(struct fqcodel *fqc, v > if ((fqc->flags & FQCF_FIXED_QUANTUM) == 0) > fqc->quantum = fqc->ifp->if_mtu + max_linkhdr; > > - codel_gettime(&now); > + now = nsecuptime(); > > for (flow = first_flow(fqc, &fq); flow != NULL; > flow = next_flow(fqc, flow, &fq)) { > -- :wq Claudio