eventdev: add Rx timestamp

Add timestamp to received packets before enqueuing to
event device if the timestamp is not already set. Adding
timestamp in the Rx adapter avoids additional latency due
to the event device.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
This commit is contained in:
Nikhil Rao 2018-02-20 06:30:54 -05:00 committed by Thomas Monjalon
parent 91f6191999
commit 569758758d
3 changed files with 21 additions and 3 deletions

View File

@ -12,7 +12,11 @@ be supported in hardware or require a software thread to receive packets from
the ethdev port using ethdev poll mode APIs and enqueue these as events to the
event device using the eventdev API. Both transfer mechanisms may be present on
the same platform depending on the particular combination of the ethdev and
the event device.
the event device. For SW based packet transfer, if the mbuf does not have a
timestamp set, the adapter adds a timestamp to the mbuf using
rte_get_tsc_cycles(), this provides a more accurate timestamp as compared to
if the application were to set the timestamp since it avoids event device
schedule latency.
The Event Ethernet Rx Adapter library is intended for the application code to
configure both transfer mechanisms using a common API. A capability API allows

View File

@ -434,11 +434,22 @@ fill_event_buffer(struct rte_event_eth_rx_adapter *rx_adapter,
uint32_t rss_mask;
uint32_t rss;
int do_rss;
uint64_t ts;
/* 0xffff ffff if PKT_RX_RSS_HASH is set, otherwise 0 */
rss_mask = ~(((m->ol_flags & PKT_RX_RSS_HASH) != 0) - 1);
do_rss = !rss_mask && !eth_rx_queue_info->flow_id_mask;
if ((m->ol_flags & PKT_RX_TIMESTAMP) == 0) {
ts = rte_get_tsc_cycles();
for (i = 0; i < num; i++) {
m = mbufs[i];
m->timestamp = ts;
m->ol_flags |= PKT_RX_TIMESTAMP;
}
}
for (i = 0; i < num; i++) {
m = mbufs[i];
struct rte_event *ev = &events[i];
@ -449,7 +460,6 @@ fill_event_buffer(struct rte_event_eth_rx_adapter *rx_adapter,
eth_rx_queue_info->flow_id &
eth_rx_queue_info->flow_id_mask;
flow_id |= rss & ~eth_rx_queue_info->flow_id_mask;
ev->flow_id = flow_id;
ev->op = RTE_EVENT_OP_NEW;
ev->sched_type = sched_type;

View File

@ -47,7 +47,11 @@
*
* The adapter uses a EAL service core function for SW based packet transfer
* and uses the eventdev PMD functions to configure HW based packet transfer
* between the ethernet device and the event device.
* between the ethernet device and the event device. For SW based packet
* transfer, if the mbuf does not have a timestamp set, the adapter adds a
* timestamp to the mbuf using rte_get_tsc_cycles(), this provides a more
* accurate timestamp as compared to if the application were to set the time
* stamp since it avoids event device schedule latency.
*
* The ethernet Rx event adapter's functions are:
* - rte_event_eth_rx_adapter_create_ext()