X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fnfb%2Fnfb_rx.h;h=cf3899b2fb7d298258d89670d98b265066db68bf;hb=3c537ca7f403262f5ef64390af6d9f1234d46b31;hp=88a03074fb273ed8d44bf329390ad6a076f5fed5;hpb=6435f9a0ac222ad8a1c53a2a039891c6f46cadb3;p=dpdk.git diff --git a/drivers/net/nfb/nfb_rx.h b/drivers/net/nfb/nfb_rx.h index 88a03074fb..cf3899b2fb 100644 --- a/drivers/net/nfb/nfb_rx.h +++ b/drivers/net/nfb/nfb_rx.h @@ -13,11 +13,14 @@ #include #include +#define NFB_TIMESTAMP_FLAG (1 << 0) + struct ndp_rx_queue { struct nfb_device *nfb; /* nfb dev structure */ struct ndp_queue *queue; /* rx queue */ uint16_t rx_queue_id; /* index */ uint8_t in_port; /* port */ + uint8_t flags; /* setup flags */ struct rte_mempool *mb_pool; /* memory pool to allocate packets */ uint16_t buf_size; /* mbuf size */ @@ -129,6 +132,7 @@ nfb_eth_ndp_rx(void *queue, uint16_t nb_pkts) { struct ndp_rx_queue *ndp = queue; + uint8_t timestamping_enabled; uint16_t packet_size; uint64_t num_bytes = 0; uint16_t num_rx; @@ -146,6 +150,8 @@ nfb_eth_ndp_rx(void *queue, return 0; } + timestamping_enabled = ndp->flags & NFB_TIMESTAMP_FLAG; + /* returns either all or nothing */ i = rte_pktmbuf_alloc_bulk(ndp->mb_pool, mbufs, nb_pkts); if (unlikely(i != 0)) @@ -181,6 +187,21 @@ nfb_eth_ndp_rx(void *queue, mbuf->pkt_len = packet_size; mbuf->port = ndp->in_port; + mbuf->ol_flags = 0; + + if (timestamping_enabled) { + /* nanoseconds */ + mbuf->timestamp = + rte_le_to_cpu_32(*((uint32_t *) + (packets[i].header + 4))); + mbuf->timestamp <<= 32; + /* seconds */ + mbuf->timestamp |= + rte_le_to_cpu_32(*((uint32_t *) + (packets[i].header + 8))); + mbuf->ol_flags |= PKT_RX_TIMESTAMP; + } + bufs[num_rx++] = mbuf; num_bytes += packet_size; } else {