git: 3c928ccadbb5 - main - iflib: Plumb per-packet RX hardware timestamps to mbufs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Sep 2026 00:51:21 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=3c928ccadbb5d7baa3ce18d33d09d9a1d2770397
commit 3c928ccadbb5d7baa3ce18d33d09d9a1d2770397
Author: Sumit Saxena <ssaxena@FreeBSD.org>
AuthorDate: 2026-09-02 19:36:43 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-03 00:49:30 +0000
iflib: Plumb per-packet RX hardware timestamps to mbufs
Add iri_rcv_tstmp to if_rxd_info so an isc_rxd_pkt_get() driver can
report a hardware RX timestamp. Copy it into m_pkthdr.rcv_tstmp,
reusing the generic mbuf timestamp path.
Widen iri_flags from uint8_t to uint32_t and define the flags drivers
may supply. Mask the flags before copying them into the mbuf so no
other mbuf state can leak through the driver callback.
Place the timestamp next to iri_frags to avoid an alignment hole, and
document its nanoseconds-since-boot representation and validity flags.
Bump __FreeBSD_version because changing if_rxd_info breaks KBI.
Reviewed by: gallatin
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Differential Revision: https://reviews.freebsd.org/D58638
---
UPDATING | 4 ++++
share/man/man9/iflibtxrx.9 | 22 ++++++++++++++++++----
sys/net/iflib.c | 3 ++-
sys/net/iflib.h | 10 +++++++++-
sys/sys/param.h | 2 +-
5 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/UPDATING b/UPDATING
index f8fc8620f740..de5b9024832f 100644
--- a/UPDATING
+++ b/UPDATING
@@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 16.x IS SLOW:
world, or to merely disable the most expensive debugging functionality
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
+20260902:
+ struct if_rxd_info now carries a receive timestamp. iflib drivers
+ must be rebuilt. __FreeBSD_version has been bumped to 1600022.
+
20260827:
<sys/videoio.h> now provides the V4L2 cropping, control menu and
overlay definitions. __FreeBSD_version has been bumped to 1600021
diff --git a/share/man/man9/iflibtxrx.9 b/share/man/man9/iflibtxrx.9
index df017dea0130..bbea0a3ed999 100644
--- a/share/man/man9/iflibtxrx.9
+++ b/share/man/man9/iflibtxrx.9
@@ -1,4 +1,4 @@
-.Dd December 17, 2020
+.Dd September 2, 2026
.Dt IFLIBTXTX 9
.Os
.Sh NAME
@@ -154,10 +154,24 @@ consumer queue.
.It Va iri_flowid
.Pq Vt "uint32_t"
Value of the RSS hash for the packet.
+.It Va iri_rcv_tstmp
+.Pq Vt "uint64_t"
+Receive timestamp in nanoseconds since boot.
+The driver must set
+.Dv M_TSTMP
+in
+.Va iri_flags
+when the timestamp is valid, and may additionally set
+.Dv M_TSTMP_HPREC
+when the timestamp was taken by hardware at the port.
.It Va iri_flags
-.Pq Vt "uint"
- Flags describing the operational parameters of the mbuf contained in the
- receive packet.
+.Pq Vt "uint32_t"
+Flags to copy to the received mbuf.
+Drivers may set only
+.Dv M_VLANTAG ,
+.Dv M_TSTMP ,
+and
+.Dv M_TSTMP_HPREC .
.It Va iri_csum_flags
.Pq Vt "uint32_t"
Flags describing the checksum value contained in the receive packet.
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 83a518462100..7a6e817f6073 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -3002,7 +3002,7 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri)
}
m->m_pkthdr.len = ri->iri_len;
m->m_pkthdr.rcvif = ri->iri_ifp;
- m->m_flags |= ri->iri_flags;
+ m->m_flags |= ri->iri_flags & IFLIB_IRI_VALID_FLAGS;
m->m_pkthdr.ether_vtag = ri->iri_vtag;
m->m_pkthdr.flowid = ri->iri_flowid;
#ifdef NUMA
@@ -3011,6 +3011,7 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri)
M_HASHTYPE_SET(m, ri->iri_rsstype);
m->m_pkthdr.csum_flags = ri->iri_csum_flags;
m->m_pkthdr.csum_data = ri->iri_csum_data;
+ m->m_pkthdr.rcv_tstmp = ri->iri_rcv_tstmp;
return (m);
}
diff --git a/sys/net/iflib.h b/sys/net/iflib.h
index 0f35f1080bad..84b1e8723737 100644
--- a/sys/net/iflib.h
+++ b/sys/net/iflib.h
@@ -66,6 +66,13 @@ typedef struct if_rxd_frag {
/* bnxt supports 64 with hardware LRO enabled */
#define IFLIB_MAX_RX_SEGS 64
+/*
+ * iri_flags bits an isc_rxd_pkt_get() driver callback is permitted to
+ * set. iflib masks iri_flags against this set before copying the flags
+ * into an mbuf.
+ */
+#define IFLIB_IRI_VALID_FLAGS (M_VLANTAG | M_TSTMP | M_TSTMP_HPREC)
+
typedef struct if_rxd_info {
/* set by iflib */
uint16_t iri_qsidx; /* qset index */
@@ -77,11 +84,12 @@ typedef struct if_rxd_info {
/* updated by driver */
if_rxd_frag_t iri_frags;
+ uint64_t iri_rcv_tstmp; /* nanoseconds since boot */
uint32_t iri_flowid; /* RSS hash for packet */
uint32_t iri_csum_flags; /* m_pkthdr csum flags */
uint32_t iri_csum_data; /* m_pkthdr csum data */
- uint8_t iri_flags; /* mbuf flags for packet */
+ uint32_t iri_flags; /* see IFLIB_IRI_VALID_FLAGS */
uint8_t iri_nfrags; /* number of fragments in packet */
uint8_t iri_rsstype; /* RSS hash type */
uint8_t iri_pad; /* any padding in the received data */
diff --git a/sys/sys/param.h b/sys/sys/param.h
index f593b87fe970..4bbf4aacb87b 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -74,7 +74,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1600021
+#define __FreeBSD_version 1600022
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,