Skip to content

Commit

Permalink
Add timestamp to netmap_slot
Browse files Browse the repository at this point in the history
  • Loading branch information
kierank committed Oct 5, 2022
1 parent 81d0e5a commit bfc5c73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions LINUX/mlx5_netmap_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions sys/net/netmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

/*
Expand Down Expand Up @@ -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)
/*
Expand Down

0 comments on commit bfc5c73

Please sign in to comment.