Changeset View
Changeset View
Standalone View
Standalone View
sys/net/bpf.c
Show First 20 Lines • Show All 2,259 Lines • ▼ Show 20 Lines | if ((tstype & BPF_T_FAST) != 0) | ||||
return (BPF_TSTAMP_FAST); | return (BPF_TSTAMP_FAST); | ||||
return (BPF_TSTAMP_NORMAL); | return (BPF_TSTAMP_NORMAL); | ||||
} | } | ||||
static int | static int | ||||
bpf_gettime(struct bintime *bt, int tstype, struct mbuf *m) | bpf_gettime(struct bintime *bt, int tstype, struct mbuf *m) | ||||
{ | { | ||||
struct timespec ts; | |||||
struct m_tag *tag; | struct m_tag *tag; | ||||
int quality; | int quality; | ||||
quality = bpf_ts_quality(tstype); | quality = bpf_ts_quality(tstype); | ||||
if (quality == BPF_TSTAMP_NONE) | if (quality == BPF_TSTAMP_NONE) | ||||
return (quality); | return (quality); | ||||
if (m != NULL) { | if (m != NULL) { | ||||
if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR | M_TSTMP)) { | |||||
mbuf_tstmp2timespec(m, &ts); | |||||
timespec2bintime(&ts, bt); | |||||
kib: Please use mbuf_tstmp2timespec(), somebody might add more precision to it one day. | |||||
Done Inline ActionsThanks, I didn't see that. jkim: Thanks, I didn't see that. | |||||
return (BPF_TSTAMP_EXTERN); | |||||
} | |||||
tag = m_tag_locate(m, MTAG_BPF, MTAG_BPF_TIMESTAMP, NULL); | tag = m_tag_locate(m, MTAG_BPF, MTAG_BPF_TIMESTAMP, NULL); | ||||
if (tag != NULL) { | if (tag != NULL) { | ||||
*bt = *(struct bintime *)(tag + 1); | *bt = *(struct bintime *)(tag + 1); | ||||
return (BPF_TSTAMP_EXTERN); | return (BPF_TSTAMP_EXTERN); | ||||
} | } | ||||
} | } | ||||
if (quality == BPF_TSTAMP_NORMAL) | if (quality == BPF_TSTAMP_NORMAL) | ||||
binuptime(bt); | binuptime(bt); | ||||
▲ Show 20 Lines • Show All 880 Lines • Show Last 20 Lines |
Please use mbuf_tstmp2timespec(), somebody might add more precision to it one day.