2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 #include <rte_cycles.h>
20 #include "task_base.h"
21 #include "task_init.h"
22 #include "thread_generic.h"
25 struct task_base base;
28 static int handle_bulk_tsc(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts)
30 struct task_tsc *task = (struct task_tsc *)tbase;
31 const uint64_t rx_tsc = rte_rdtsc();
33 for (uint16_t j = 0; j < n_pkts; ++j)
34 mbufs[j]->udata64 = rx_tsc;
36 return task->base.tx_pkt(&task->base, mbufs, n_pkts, NULL);
39 static struct task_init task_init = {
42 .handle = handle_bulk_tsc,
43 .flag_features = TASK_FEATURE_NEVER_DISCARDS|TASK_FEATURE_TXQ_FLAGS_NOOFFLOADS|TASK_FEATURE_TXQ_FLAGS_NOMULTSEGS|TASK_FEATURE_THROUGHPUT_OPT,
44 .size = sizeof(struct task_tsc),
45 .mbuf_size = 2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM,
48 __attribute__((constructor)) static void reg_task_nop(void)