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

af_xdp: move rx timestamp read to support WODA #251

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
20 changes: 19 additions & 1 deletion src/lib/ciul/efxdp_vi.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,25 @@ static void efxdp_ef_vi_receive_push(ef_vi* vi)
static int efxdp_ef_vi_receive_get_timestamp(struct ef_vi* vi, const void* pkt,
ef_precisetime* ts_out)
{
return -EOPNOTSUPP;
const uint64_t ns_to_sec = 1000UL * 1000 * 1000;
const struct onload_xdp_rx_meta {
#define ONLOAD_XDP_RX_META_TSTAMP 0x1
uint64_t flags;
uint64_t tstamp;
} *meta = pkt;

/* pkt points to start of packet data. meta precedes that */
meta--;
if (!(meta->flags & ONLOAD_XDP_RX_META_TSTAMP)) {
*ts_out = (ef_precisetime) { 0 };
return -ENODATA;
}

ts_out->tv_sec = meta->tstamp / ns_to_sec;
ts_out->tv_nsec = meta->tstamp % ns_to_sec;
ts_out->tv_nsec_frac = 0;
ts_out->tv_flags = 0;
return 0;
}

static void efxdp_ef_eventq_prime(ef_vi* vi)
Expand Down
20 changes: 0 additions & 20 deletions src/lib/transport/ip/netif_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,26 +221,6 @@ static void get_rx_timestamp(ci_netif* netif, ci_ip_pkt_fmt* pkt)
ci_netif_state_nic_t* nsn = &netif->state->nic[pkt->intf_i];
ef_vi* vi = ci_netif_vi(netif, pkt->intf_i);

/* AF_XDP timestamps are read in ci_netif_poll_evq
* TODO: probably move here. we have all necessary data: vi and pkt */
if( vi->nic_type.arch == EF_VI_ARCH_AF_XDP ) {
struct onload_xdp_rx_meta {
#define ONLOAD_XDP_RX_META_TSTAMP 0x1
uint64_t flags;
uint64_t tstamp;
} *meta;
const uint64_t ns_to_sec = 1000UL * 1000 * 1000;

meta = ((struct onload_xdp_rx_meta *)(pkt->dma_start + pkt->pkt_start_off)) - 1;
if (meta->flags & ONLOAD_XDP_RX_META_TSTAMP) {
pkt->hw_stamp.tv_sec = meta->tstamp / ns_to_sec;
pkt->hw_stamp.tv_nsec = meta->tstamp % ns_to_sec;
pkt->hw_stamp.tv_nsec_frac = 0;
pkt->hw_stamp.tv_flags = 0;
}
return;
}

if( (vi->nic_type.arch != EF_VI_ARCH_EFCT) &&
(nsn->oo_vi_flags & OO_VI_FLAGS_RX_HW_TS_EN) ) {
ef_precisetime stamp;
Expand Down