diff options
-rw-r--r-- | sys/dev/cxgbe/t4_sge.c | 23 | ||||
-rw-r--r-- | sys/modules/cxgbe/if_cxgbe/Makefile | 3 |
2 files changed, 25 insertions, 1 deletions
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 5b96a7e..5440528 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -606,6 +606,12 @@ t4_evt_rx(void *arg) V_INGRESSQID(iq->cntxt_id) | V_SEINTARM(iq->intr_params)); } +#ifdef T4_PKT_TIMESTAMP +#define RX_COPY_THRESHOLD (MINCLSIZE - 8) +#else +#define RX_COPY_THRESHOLD MINCLSIZE +#endif + void t4_eth_rx(void *arg) { @@ -669,7 +675,22 @@ t4_eth_rx(void *arg) BUS_DMASYNC_POSTREAD); m_init(m0, NULL, 0, M_NOWAIT, MT_DATA, M_PKTHDR); - if (len < MINCLSIZE) { + +#ifdef T4_PKT_TIMESTAMP + *mtod(m0, uint64_t *) = + be64toh(ctrl->u.last_flit & 0xfffffffffffffff); + m0->m_data += 8; + + /* + * 60 bit timestamp value is *(uint64_t *)m0->m_pktdat. Note + * that it is in the leading free-space (see M_LEADINGSPACE) in + * the mbuf. The kernel can clobber it during a pullup, + * m_copymdata, etc. You need to make sure that the mbuf + * reaches you unmolested if you care about the timestamp. + */ +#endif + + if (len < RX_COPY_THRESHOLD) { /* copy data to mbuf, buffer will be recycled */ bcopy(sd->cl, mtod(m0, caddr_t), len); m0->m_len = len; diff --git a/sys/modules/cxgbe/if_cxgbe/Makefile b/sys/modules/cxgbe/if_cxgbe/Makefile index 5bfe646..a524cde 100644 --- a/sys/modules/cxgbe/if_cxgbe/Makefile +++ b/sys/modules/cxgbe/if_cxgbe/Makefile @@ -13,4 +13,7 @@ SRCS+= opt_inet.h CFLAGS+= -I${CXGBE} +# Provide the timestamp of a packet in its header mbuf. +#CFLAGS+= -DT4_PKT_TIMESTAMP + .include <bsd.kmod.mk> |