diff --git a/LINUX/mlx5_netmap_linux.h b/LINUX/mlx5_netmap_linux.h index a22fe6689..577e4639e 100644 --- a/LINUX/mlx5_netmap_linux.h +++ b/LINUX/mlx5_netmap_linux.h @@ -324,6 +324,9 @@ int mlx5e_netmap_txsync(struct netmap_kring *kring, int flags) { /* unpack slot number from skb pointer */ nm_i_done = (u32)((uintptr_t)skb & 0x00FFFFFF); + struct netmap_slot *slot = &ring->slot[nm_i_done]; + slot->flags |= NS_TIMESTAMP; + slot->ts = mlx5_timecounter_cyc2time(sq->clock, get_cqe_ts(cqe)); sqcc += num_wqebbs; kring->nr_hwtail = nm_prev(nm_i_done, lim); @@ -491,6 +494,9 @@ int mlx5e_netmap_rxsync(struct netmap_kring *kring, int flags) { ring->slot[nm_i].len = bytes_recv; ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags |= NS_TIMESTAMP; + ring->slot[nm_i].ts = mlx5_timecounter_cyc2time(rq->clock, get_cqe_ts(cqe)); + nm_i = nm_next(nm_i, lim); wq_cyc_pop: diff --git a/sys/net/netmap.h b/sys/net/netmap.h index 6561174e0..53306edd3 100644 --- a/sys/net/netmap.h +++ b/sys/net/netmap.h @@ -165,6 +165,7 @@ struct netmap_slot { uint16_t len; /* length for this slot */ uint16_t flags; /* buf changed, etc. */ uint64_t ptr; /* pointer for indirect buffers */ + uint64_t ts; /* timestamp of buffer */ }; /* @@ -224,6 +225,12 @@ struct netmap_slot { * ring of the monitored port */ +#define NS_TIMESTAMP 0x0080 + /* the packet has a receive or transmit timestamp + Note: this is using the NIC hardware clock and + not the PC clock + */ + #define NS_PORT_SHIFT 8 #define NS_PORT_MASK (0xff << NS_PORT_SHIFT) /*