Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timestamp to netmap_slot #877

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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