summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/rapid
AgeCommit message (Expand)AuthorFilesLines
2021-06-21Add support for multisocket memory reservationYury Kylulin3-16/+38
2021-06-08fix container image and use latest codeLuc Provoost1-10/+4
2021-05-12Fix latency buckets with multiple lat coresLuc Provoost3-66/+98
2021-05-10Reinstate installation of igb_uioLuc Provoost2-1/+9
2021-05-10Fixing rapidxt for XtestingLuc Provoost5-4/+25
2021-05-05New test case: gen versus swap via gatewayLuc Provoost4-10/+134
2021-04-30Do not run after_boot.sh by defaultLuc Provoost1-10/+12
2021-04-28Default use of rapid_rsa_keyLuc Provoost6-23/+35
2021-04-22Fix error in sut throughput measurementLuc Provoost1-1/+1
2021-04-16Adding documentation in the test filesLuc Provoost16-15/+239
2021-04-15Rework of statistics reportingLuc Provoost28-200/+305
2021-04-12Code improvementsLuc Provoost5-280/+268
2021-04-08cgnat test case addedLuc Provoost6-20/+346
2021-04-07Log ssh & scp related issues also on screenLuc Provoost1-10/+3
2021-03-15Fix the tuned optimizationsLuc Provoost8-30/+55
2021-03-10Remove useless site.retry from treeCédric Ollivier1-1/+0
2021-02-25Preparation for packet mis-ordering statsLuc Provoost5-14/+18
2021-02-11Add support for native Kubernetes CPU Manager0.0.1Yury Kylulin33-21/+132
2021-02-01Fix the default test fileLuc Provoost1-1/+1
2021-01-29Add rapid script sources in the imageYury Kylulin2-17/+22
2021-01-27creation of tests and configs subdirectoriesLuc Provoost40-58/+136
2021-01-27Add default SSH keysYury Kylulin2-0/+50
2020-12-28Improved PROX cleanup when exitingLuc Provoost23-167/+232
2020-12-10Fix for new config file structureYury Kylulin3-1/+21
2020-12-10Moving to python 3 for kubernetes scriptsYury Kylulin4-13/+11
2020-12-08Reporting test details for all testsopnfv-10.0.0stable/jermaLuc Provoost8-60/+44
2020-11-18Support for xtestingLuc Provoost12-15/+197
2020-11-13Fix for latency reporting and log file handlerLuc Provoost3-5/+5
2020-10-19Support dataplane subnet mask & latency histogramLuc Provoost16-36/+76
2020-09-29New PROX version, background traffic reportingLuc Provoost18-86/+89
2020-09-17Using python concurrent futuresLuc Provoost3-63/+29
2020-09-16ramp generator traffic & prox.log copyLuc Provoost6-1/+75
2020-09-07deploycentostools.sh to use latest PROXLuc Provoost1-1/+1
2020-08-20Allow latency thresholds for TST009 testingLuc Provoost2-3/+4
2020-08-06fix: IPV6 packet generation, packet loss reportingLuc Provoost10-28/+70
2020-08-03Improved IRQ measurements and pushing resultsLuc Provoost12-134/+373
2020-07-24Fix execution in the Kubernetes environmentYury Kylulin3-3/+14
2020-07-10Fixed compilation issue on dpdk 19.08 (and more recent)Xavier Simonart1-0/+5
2020-07-05Adding vdev support and vfioLuc Provoost30-112/+179
2020-06-05Clean up for the test podsYury Kylulin2-10/+31
2020-06-03Fix for containers to use /opt/rapidYury Kylulin5-10/+12
2020-06-02Using /opt/rapid to run proxLuc Provoost4-12/+17
2020-05-29Fixing some more copyright datesLuc Provoost14-13/+30
2020-05-29Fix for container .env file and small updatesLuc Provoost17-104/+69
2020-05-28IPV6 testing & minor changes and fixesLuc Provoost20-92/+362
2020-05-15Support for imix packet sizesLuc Provoost18-41/+69
2020-05-15createrapid.py is now using heat templates yamlLuc Provoost17-465/+523
2020-05-15Code rewrite and Python3 supportLuc Provoost35-1415/+1860
2020-03-23Improved variable init and bug fixesLuc Provoost1-62/+41
2020-01-31Add support for kubernetes deployment in rapid scripts.Yury Kylulin26-95/+1251
fs, MAX_PKT_BURST); if (multi) { n = nb_rx; while (n != 0 && MAX_PKT_BURST - nb_rx >= MIN_PMD_RX) { n = rte_eth_rx_burst(pq->port, pq->queue, mbufs + nb_rx, MIN_PMD_RX); nb_rx += n; PROX_PANIC(nb_rx > 64, "Received %d packets while expecting maximum %d\n", n, MIN_PMD_RX); } } return nb_rx; } static void next_port(struct rx_params_hw *rx_params_hw) { ++rx_params_hw->last_read_portid; if (unlikely(rx_params_hw->last_read_portid == rx_params_hw->nb_rxports)) { rx_params_hw->last_read_portid = 0; } } static void next_port_pow2(struct rx_params_hw *rx_params_hw) { rx_params_hw->last_read_portid = (rx_params_hw->last_read_portid + 1) & rx_params_hw->rxport_mask; } static inline void dump_l3(struct task_base *tbase, struct rte_mbuf *mbuf) { if (unlikely(tbase->aux->task_rt_dump.n_print_rx)) { if ((tbase->aux->task_rt_dump.input == NULL) || (tbase->aux->task_rt_dump.input->reply == NULL)) { plogdx_info(mbuf, "RX: "); } else { struct input *input = tbase->aux->task_rt_dump.input; char tmp[128]; int strlen; #if RTE_VERSION >= RTE_VERSION_NUM(1,8,0,0) int port_id = mbuf->port; #else int port_id = mbuf->pkt.in_port; #endif strlen = snprintf(tmp, sizeof(tmp), "pktdump,%d,%d\n", port_id, rte_pktmbuf_pkt_len(mbuf)); input->reply(input, tmp, strlen); input->reply(input, rte_pktmbuf_mtod(mbuf, char *), rte_pktmbuf_pkt_len(mbuf)); input->reply(input, "\n", 1); } tbase->aux->task_rt_dump.n_print_rx --; if (0 == tbase->aux->task_rt_dump.n_print_rx) { task_base_del_rx_pkt_function(tbase, rx_pkt_dump); } } if (unlikely(tbase->aux->task_rt_dump.n_trace)) { plogdx_info(mbuf, "RX: "); tbase->aux->task_rt_dump.n_trace--; } } static inline void handle_ipv4(struct task_base *tbase, struct rte_mbuf **mbufs, int i, prox_rte_ipv4_hdr *pip, int *skip) { prox_rte_tcp_hdr *tcp = (prox_rte_tcp_hdr *)(pip + 1); if (pip->next_proto_id == IPPROTO_ICMP) { dump_l3(tbase, mbufs[i]); tx_ring(tbase, tbase->l3.ctrl_plane_ring, ICMP_TO_MASTER, mbufs[i]); (*skip)++; } else if ((tcp->src_port == TCP_PORT_BGP) || (tcp->dst_port == TCP_PORT_BGP)) { dump_l3(tbase, mbufs[i]); tx_ring(tbase, tbase->l3.ctrl_plane_ring, BGP_TO_MASTER, mbufs[i]); (*skip)++; } else if (unlikely(*skip)) { mbufs[i - *skip] = mbufs[i]; } } static inline int handle_l3(struct task_base *tbase, uint16_t nb_rx, struct rte_mbuf ***mbufs_ptr) { struct rte_mbuf **mbufs = *mbufs_ptr; int i; struct ether_hdr_arp *hdr_arp[MAX_PKT_BURST]; prox_rte_ether_hdr *hdr; prox_rte_ipv4_hdr *pip; prox_rte_vlan_hdr *vlan; int skip = 0; for (i = 0; i < nb_rx; i++) { PREFETCH0(mbufs[i]); } for (i = 0; i < nb_rx; i++) { hdr_arp[i] = rte_pktmbuf_mtod(mbufs[i], struct ether_hdr_arp *); PREFETCH0(hdr_arp[i]); } for (i = 0; i < nb_rx; i++) { if (likely(hdr_arp[i]->ether_hdr.ether_type == ETYPE_IPv4)) { hdr = (prox_rte_ether_hdr *)hdr_arp[i]; pip = (prox_rte_ipv4_hdr *)(hdr + 1); handle_ipv4(tbase, mbufs, i, pip, &skip); } else { switch (hdr_arp[i]->ether_hdr.ether_type) { case ETYPE_VLAN: hdr = (prox_rte_ether_hdr *)hdr_arp[i]; vlan = (prox_rte_vlan_hdr *)(hdr + 1); if (vlan->eth_proto == ETYPE_IPv4) { pip = (prox_rte_ipv4_hdr *)(vlan + 1); handle_ipv4(tbase, mbufs, i, pip, &skip); } else if (vlan->eth_proto == ETYPE_ARP) { dump_l3(tbase, mbufs[i]); tx_ring(tbase, tbase->l3.ctrl_plane_ring, ARP_PKT_FROM_NET_TO_MASTER, mbufs[i]); skip++; } break; case ETYPE_ARP: dump_l3(tbase, mbufs[i]); tx_ring(tbase, tbase->l3.ctrl_plane_ring, ARP_PKT_FROM_NET_TO_MASTER, mbufs[i]); skip++; break; default: if (unlikely(skip)) { mbufs[i - skip] = mbufs[i]; } } } } return skip; } static inline int handle_ndp(struct task_base *tbase, uint16_t nb_rx, struct rte_mbuf ***mbufs_ptr) { struct rte_mbuf **mbufs = *mbufs_ptr; prox_rte_ipv6_hdr *ipv6_hdr; int i; prox_rte_ether_hdr *hdr[MAX_PKT_BURST]; int skip = 0; uint16_t vlan = 0; for (i = 0; i < nb_rx; i++) { PREFETCH0(mbufs[i]); } for (i = 0; i < nb_rx; i++) { hdr[i] = rte_pktmbuf_mtod(mbufs[i], prox_rte_ether_hdr *); PREFETCH0(hdr[i]); } for (i = 0; i < nb_rx; i++) { ipv6_hdr = prox_get_ipv6_hdr(hdr[i], rte_pktmbuf_pkt_len(mbufs[i]), &vlan); if (unlikely((ipv6_hdr) && (ipv6_hdr->proto == ICMPv6))) { dump_l3(tbase, mbufs[i]); tx_ring(tbase, tbase->l3.ctrl_plane_ring, NDP_PKT_FROM_NET_TO_MASTER, mbufs[i]); skip++; } else if (unlikely(skip)) { mbufs[i - skip] = mbufs[i]; } } return skip; } static uint16_t rx_pkt_hw_param(struct task_base *tbase, struct rte_mbuf ***mbufs_ptr, int multi, void (*next)(struct rx_params_hw *rx_param_hw), int l3_ndp) { uint8_t last_read_portid; uint16_t nb_rx, ret; int skip = 0; START_EMPTY_MEASSURE(); *mbufs_ptr = tbase->ws_mbuf->mbuf[0] + (RTE_ALIGN_CEIL(tbase->ws_mbuf->idx[0].prod, 2) & WS_MBUF_MASK); last_read_portid = tbase->rx_params_hw.last_read_portid; struct port_queue *pq = &tbase->rx_params_hw.rx_pq[last_read_portid]; nb_rx = rx_pkt_hw_port_queue(pq, *mbufs_ptr, multi); next(&tbase->rx_params_hw); if (l3_ndp == PROX_L3) skip = handle_l3(tbase, nb_rx, mbufs_ptr); else if (l3_ndp == PROX_NDP) skip = handle_ndp(tbase, nb_rx, mbufs_ptr); if (skip) TASK_STATS_ADD_RX_NON_DP(&tbase->aux->stats, skip); if (likely(nb_rx > 0)) { TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx - skip; } TASK_STATS_ADD_IDLE(&tbase->aux->stats, rte_rdtsc() - cur_tsc); return 0; } static inline uint16_t rx_pkt_hw1_param(struct task_base *tbase, struct rte_mbuf ***mbufs_ptr, int multi, int l3_ndp) { uint16_t nb_rx, n; int skip = 0; START_EMPTY_MEASSURE(); *mbufs_ptr = tbase->ws_mbuf->mbuf[0] + (RTE_ALIGN_CEIL(tbase->ws_mbuf->idx[0].prod, 2) & WS_MBUF_MASK); nb_rx = rte_eth_rx_burst(tbase->rx_params_hw1.rx_pq.port, tbase->rx_params_hw1.rx_pq.queue, *mbufs_ptr, MAX_PKT_BURST); if (multi) { n = nb_rx; while ((n != 0) && (MAX_PKT_BURST - nb_rx >= MIN_PMD_RX)) { n = rte_eth_rx_burst(tbase->rx_params_hw1.rx_pq.port, tbase->rx_params_hw1.rx_pq.queue, *mbufs_ptr + nb_rx, MIN_PMD_RX); nb_rx += n; PROX_PANIC(nb_rx > 64, "Received %d packets while expecting maximum %d\n", n, MIN_PMD_RX); } } if (unlikely(nb_rx == 0)) { TASK_STATS_ADD_IDLE(&tbase->aux->stats, rte_rdtsc() - cur_tsc); return 0; } if (l3_ndp == PROX_L3) skip = handle_l3(tbase, nb_rx, mbufs_ptr); else if (l3_ndp == PROX_NDP) skip = handle_ndp(tbase, nb_rx, mbufs_ptr); if (skip) TASK_STATS_ADD_RX_NON_DP(&tbase->aux->stats, skip); TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx - skip; } uint16_t rx_pkt_hw(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 0, next_port, 0); } uint16_t rx_pkt_hw_pow2(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 0, next_port_pow2, 0); } uint16_t rx_pkt_hw1(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw1_param(tbase, mbufs, 0, 0); } uint16_t rx_pkt_hw_multi(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 1, next_port, 0); } uint16_t rx_pkt_hw_pow2_multi(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 1, next_port_pow2, 0); } uint16_t rx_pkt_hw1_multi(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw1_param(tbase, mbufs, 1, 0); } uint16_t rx_pkt_hw_l3(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 0, next_port, PROX_L3); } uint16_t rx_pkt_hw_ndp(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 0, next_port, PROX_NDP); } uint16_t rx_pkt_hw_pow2_l3(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 0, next_port_pow2, PROX_L3); } uint16_t rx_pkt_hw_pow2_ndp(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 0, next_port_pow2, PROX_NDP); } uint16_t rx_pkt_hw1_l3(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw1_param(tbase, mbufs, 0, PROX_L3); } uint16_t rx_pkt_hw1_ndp(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw1_param(tbase, mbufs, 0, PROX_NDP); } uint16_t rx_pkt_hw_multi_l3(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 1, next_port, PROX_L3); } uint16_t rx_pkt_hw_multi_ndp(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 1, next_port, PROX_NDP); } uint16_t rx_pkt_hw_pow2_multi_l3(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 1, next_port_pow2, PROX_L3); } uint16_t rx_pkt_hw_pow2_multi_ndp(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw_param(tbase, mbufs, 1, next_port_pow2, PROX_NDP); } uint16_t rx_pkt_hw1_multi_l3(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw1_param(tbase, mbufs, 1, PROX_L3); } uint16_t rx_pkt_hw1_multi_ndp(struct task_base *tbase, struct rte_mbuf ***mbufs) { return rx_pkt_hw1_param(tbase, mbufs, 1, PROX_NDP); } /* The following functions implement ring access */ uint16_t ring_deq(struct rte_ring *r, struct rte_mbuf **mbufs) { void **v_mbufs = (void **)mbufs; #ifdef BRAS_RX_BULK #if RTE_VERSION < RTE_VERSION_NUM(17,5,0,1) return rte_ring_sc_dequeue_bulk(r, v_mbufs, MAX_RING_BURST) < 0? 0 : MAX_RING_BURST; #else return rte_ring_sc_dequeue_bulk(r, v_mbufs, MAX_RING_BURST, NULL); #endif #else #if RTE_VERSION < RTE_VERSION_NUM(17,5,0,1) return rte_ring_sc_dequeue_burst(r, v_mbufs, MAX_RING_BURST); #else return rte_ring_sc_dequeue_burst(r, v_mbufs, MAX_RING_BURST, NULL); #endif #endif } uint16_t rx_pkt_sw(struct task_base *tbase, struct rte_mbuf ***mbufs) { START_EMPTY_MEASSURE(); *mbufs = tbase->ws_mbuf->mbuf[0] + (tbase->ws_mbuf->idx[0].prod & WS_MBUF_MASK); uint8_t lr = tbase->rx_params_sw.last_read_ring; uint16_t nb_rx; do { nb_rx = ring_deq(tbase->rx_params_sw.rx_rings[lr], *mbufs); lr = lr + 1 == tbase->rx_params_sw.nb_rxrings? 0 : lr + 1; } while(!nb_rx && lr != tbase->rx_params_sw.last_read_ring); tbase->rx_params_sw.last_read_ring = lr; if (nb_rx != 0) { TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx; } else { TASK_STATS_ADD_IDLE(&tbase->aux->stats, rte_rdtsc() - cur_tsc); return 0; } } /* Same as rx_pkt_sw expect with a mask for the number of receive rings (can only be used if nb_rxring is a power of 2). */ uint16_t rx_pkt_sw_pow2(struct task_base *tbase, struct rte_mbuf ***mbufs) { START_EMPTY_MEASSURE(); *mbufs = tbase->ws_mbuf->mbuf[0] + (tbase->ws_mbuf->idx[0].prod & WS_MBUF_MASK); uint8_t lr = tbase->rx_params_sw.last_read_ring; uint16_t nb_rx; do { nb_rx = ring_deq(tbase->rx_params_sw.rx_rings[lr], *mbufs); lr = (lr + 1) & tbase->rx_params_sw.rxrings_mask; } while(!nb_rx && lr != tbase->rx_params_sw.last_read_ring); tbase->rx_params_sw.last_read_ring = lr; if (nb_rx != 0) { TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx; } else { TASK_STATS_ADD_IDLE(&tbase->aux->stats, rte_rdtsc() - cur_tsc); return 0; } } uint16_t rx_pkt_self(struct task_base *tbase, struct rte_mbuf ***mbufs) { START_EMPTY_MEASSURE(); uint16_t nb_rx = tbase->ws_mbuf->idx[0].nb_rx; if (nb_rx) { tbase->ws_mbuf->idx[0].nb_rx = 0; *mbufs = tbase->ws_mbuf->mbuf[0] + (tbase->ws_mbuf->idx[0].prod & WS_MBUF_MASK); TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx; } else { TASK_STATS_ADD_IDLE(&tbase->aux->stats, rte_rdtsc() - cur_tsc); return 0; } } /* Used for tasks that do not receive packets (i.e. Packet generation). Always returns 1 but never returns packets and does not increment statistics. This function allows to use the same code path as for tasks that actually receive packets. */ uint16_t rx_pkt_dummy(__attribute__((unused)) struct task_base *tbase, __attribute__((unused)) struct rte_mbuf ***mbufs) { return 1; } /* After the system has been configured, it is known if there is only one RX ring. If this is the case, a more specialized version of the function above can be used to save cycles. */ uint16_t rx_pkt_sw1(struct task_base *tbase, struct rte_mbuf ***mbufs) { START_EMPTY_MEASSURE(); *mbufs = tbase->ws_mbuf->mbuf[0] + (tbase->ws_mbuf->idx[0].prod & WS_MBUF_MASK); uint16_t nb_rx = ring_deq(tbase->rx_params_sw1.rx_ring, *mbufs); if (nb_rx != 0) { TASK_STATS_ADD_RX(&tbase->aux->stats, nb_rx); return nb_rx; } else { TASK_STATS_ADD_IDLE(&tbase->aux->stats, rte_rdtsc() - cur_tsc); return 0; } } static uint16_t call_prev_rx_pkt(struct task_base *tbase, struct rte_mbuf ***mbufs) { uint16_t ret; tbase->aux->rx_prev_idx++; ret = tbase->aux->rx_pkt_prev[tbase->aux->rx_prev_idx - 1](tbase, mbufs); tbase->aux->rx_prev_idx--; return ret; } /* Only used when there are packets to be dumped. This function is meant as a debugging tool and is therefore not optimized. When the number of packets to dump falls back to 0, the original (optimized) rx function is restored. This allows to support dumping packets without any performance impact if the feature is not used. */ uint16_t rx_pkt_dump(struct task_base *tbase, struct rte_mbuf ***mbufs) { uint16_t ret = call_prev_rx_pkt(tbase, mbufs); if (ret) { uint32_t n_dump = tbase->aux->task_rt_dump.n_print_rx; n_dump = ret < n_dump? ret : n_dump; if ((tbase->aux->task_rt_dump.input == NULL) || (tbase->aux->task_rt_dump.input->reply == NULL)) { for (uint32_t i = 0; i < n_dump; ++i) { plogdx_info((*mbufs)[i], "RX: "); } } else { struct input *input = tbase->aux->task_rt_dump.input; for (uint32_t i = 0; i < n_dump; ++i) { /* TODO: Execute callback with full data in a single call. */ char tmp[128]; int strlen; #if RTE_VERSION >= RTE_VERSION_NUM(1,8,0,0) int port_id = ((*mbufs)[i])->port; #else int port_id = ((*mbufs)[i])->pkt.in_port; #endif strlen = snprintf(tmp, sizeof(tmp), "pktdump,%d,%d\n", port_id, rte_pktmbuf_pkt_len((*mbufs)[i])); input->reply(input, tmp, strlen); input->reply(input, rte_pktmbuf_mtod((*mbufs)[i], char *), rte_pktmbuf_pkt_len((*mbufs)[i])); input->reply(input, "\n", 1); } } tbase->aux->task_rt_dump.n_print_rx -= n_dump; if (0 == tbase->aux->task_rt_dump.n_print_rx) { task_base_del_rx_pkt_function(tbase, rx_pkt_dump); } } return ret; } uint16_t rx_pkt_trace(struct task_base *tbase, struct rte_mbuf ***mbufs) { tbase->aux->task_rt_dump.cur_trace = 0; uint16_t ret = call_prev_rx_pkt(tbase, mbufs); if (ret) { uint32_t n_trace = tbase->aux->task_rt_dump.n_trace; n_trace = ret < n_trace? ret : n_trace; n_trace = n_trace <= MAX_RING_BURST ? n_trace : MAX_RING_BURST; for (uint32_t i = 0; i < n_trace; ++i) { uint8_t *pkt = rte_pktmbuf_mtod((*mbufs)[i], uint8_t *); rte_memcpy(tbase->aux->task_rt_dump.pkt_cpy[i], pkt, sizeof(tbase->aux->task_rt_dump.pkt_cpy[i])); tbase->aux->task_rt_dump.pkt_cpy_len[i] = rte_pktmbuf_pkt_len((*mbufs)[i]); tbase->aux->task_rt_dump.pkt_mbuf_addr[i] = (*mbufs)[i]; } tbase->aux->task_rt_dump.cur_trace += n_trace; tbase->aux->task_rt_dump.n_trace -= n_trace; /* Unset by TX when n_trace = 0 */ } return ret; } /* Gather the distribution of the number of packets that have been received from one RX call. Since the value is only modified by the task that receives the packet, no atomic operation is needed. */ uint16_t rx_pkt_distr(struct task_base *tbase, struct rte_mbuf ***mbufs) { uint16_t ret = call_prev_rx_pkt(tbase, mbufs); if (likely(ret < RX_BUCKET_SIZE)) tbase->aux->rx_bucket[ret]++; else tbase->aux->rx_bucket[RX_BUCKET_SIZE - 1]++; return ret; } uint16_t rx_pkt_bw(struct task_base *tbase, struct rte_mbuf ***mbufs) { uint16_t ret = call_prev_rx_pkt(tbase, mbufs); uint32_t tot_bytes = 0; for (uint16_t i = 0; i < ret; ++i) { tot_bytes += mbuf_wire_size((*mbufs)[i]); } TASK_STATS_ADD_RX_BYTES(&tbase->aux->stats, tot_bytes); return ret; } uint16_t rx_pkt_tsc(struct task_base *tbase, struct rte_mbuf ***mbufs) { uint64_t before = rte_rdtsc(); uint16_t ret = call_prev_rx_pkt(tbase, mbufs); uint64_t after = rte_rdtsc(); tbase->aux->tsc_rx.before = before; tbase->aux->tsc_rx.after = after; return ret; }