On Fri, Apr 28, 2017 at 07:54 -0600, Theo de Raadt wrote:
> > One of the prerequisites for FQ_CoDel is ability to track packet
> > enqueue time. To avoid allocating per-packet mbuf tags, I'd prefer
> > to include the timestamp directly into the packet header structure.
> > This can be later used for other purposes as well if need be. OK?
> >
> > diff --git sys/sys/mbuf.h sys/sys/mbuf.h
> > index 202ce8ced8b..daa9facf0dd 100644
> > --- sys/sys/mbuf.h
> > +++ sys/sys/mbuf.h
> > @@ -128,10 +128,11 @@ struct pkthdr {
> > u_int16_t csum_flags; /* checksum flags */
> > u_int16_t ether_vtag; /* Ethernet 802.1p+Q vlan tag */
> > u_int ph_rtableid; /* routing table id */
> > u_int ph_ifidx; /* rcv interface index */
> > u_int8_t ph_loopcnt; /* mbuf is looping in kernel */
> > + struct timeval ph_timestamp; /* packet timestamp */
> > struct pkthdr_pf pf;
> > };
>
> This packs quite poorly into the mbuf. Can you put the timeval ahead
> of ph_loopcnt? That will save a few bytes on some architectures.
Sure,
diff --git sys/sys/mbuf.h sys/sys/mbuf.h
index 202ce8ced8b..72b02e69250 100644
--- sys/sys/mbuf.h
+++ sys/sys/mbuf.h
@@ -127,10 +127,11 @@ struct pkthdr {
u_int16_t ph_flowid; /* pseudo unique flow id */
u_int16_t csum_flags; /* checksum flags */
u_int16_t ether_vtag; /* Ethernet 802.1p+Q vlan tag */
u_int ph_rtableid; /* routing table id */
u_int ph_ifidx; /* rcv interface index */
+ struct timeval ph_timestamp; /* packet timestamp */
u_int8_t ph_loopcnt; /* mbuf is looping in kernel */
struct pkthdr_pf pf;
};
/* description of external storage mapped into mbuf, valid if M_EXT set */