1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
10 #include <rte_cycles.h>
11 #include <rte_ethdev.h>
12 #include <rte_byteorder.h>
13 #include <rte_atomic.h>
14 #include <rte_malloc.h>
15 #include "packet_burst_generator.h"
18 #define NB_ETHPORTS_USED (1)
19 #define NB_SOCKETS (2)
20 #define MEMPOOL_CACHE_SIZE 250
21 #define MAX_PKT_BURST (32)
22 #define RTE_TEST_RX_DESC_DEFAULT (1024)
23 #define RTE_TEST_TX_DESC_DEFAULT (1024)
24 #define RTE_PORT_ALL (~(uint16_t)0x0)
26 /* how long test would take at full line rate */
27 #define RTE_TEST_DURATION (2)
30 * RX and TX Prefetch, Host, and Write-back threshold values should be
31 * carefully set for optimal performance. Consult the network
32 * controller's datasheet and supporting DPDK documentation for guidance
33 * on how these parameters should be set.
35 #define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */
36 #define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */
37 #define RX_WTHRESH 0 /**< Default values of RX write-back threshold reg. */
40 * These default values are optimized for use with the Intel(R) 82599 10 GbE
41 * Controller and the DPDK ixgbe PMD. Consider using other values for other
42 * network controllers and/or network drivers.
44 #define TX_PTHRESH 32 /**< Default values of TX prefetch threshold reg. */
45 #define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */
46 #define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */
48 #define MAX_TRAFFIC_BURST 2048
50 #define NB_MBUF RTE_MAX( \
51 (unsigned)(nb_ports*nb_rx_queue*nb_rxd + \
52 nb_ports*nb_lcores*MAX_PKT_BURST + \
53 nb_ports*nb_tx_queue*nb_txd + \
54 nb_lcores*MEMPOOL_CACHE_SIZE + \
55 nb_ports*MAX_TRAFFIC_BURST), \
59 static struct rte_mempool *mbufpool[NB_SOCKETS];
60 /* ethernet addresses of ports */
61 static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
63 static struct rte_eth_conf port_conf = {
65 .mq_mode = ETH_MQ_RX_NONE,
66 .max_rx_pkt_len = ETHER_MAX_LEN,
68 .header_split = 0, /**< Header Split disabled */
69 .hw_ip_checksum = 0, /**< IP checksum offload enabled */
70 .hw_vlan_filter = 0, /**< VLAN filtering disabled */
71 .hw_vlan_strip = 0, /**< VLAN strip enabled. */
72 .hw_vlan_extend = 0, /**< Extended VLAN disabled. */
73 .jumbo_frame = 0, /**< Jumbo Frame Support disabled */
74 .hw_strip_crc = 1, /**< CRC stripped by hardware */
75 .enable_scatter = 0, /**< scatter rx disabled */
78 .mq_mode = ETH_MQ_TX_NONE,
80 .lpbk_mode = 1, /* enable loopback */
83 static struct rte_eth_rxconf rx_conf = {
85 .pthresh = RX_PTHRESH,
86 .hthresh = RX_HTHRESH,
87 .wthresh = RX_WTHRESH,
92 static struct rte_eth_txconf tx_conf = {
94 .pthresh = TX_PTHRESH,
95 .hthresh = TX_HTHRESH,
96 .wthresh = TX_WTHRESH,
98 .tx_free_thresh = 32, /* Use PMD default values */
99 .tx_rs_thresh = 32, /* Use PMD default values */
100 .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS |
101 ETH_TXQ_FLAGS_NOVLANOFFL |
102 ETH_TXQ_FLAGS_NOXSUMSCTP |
103 ETH_TXQ_FLAGS_NOXSUMUDP |
104 ETH_TXQ_FLAGS_NOXSUMTCP)
117 uint16_t portlist[RTE_MAX_ETHPORTS];
118 } __rte_cache_aligned;
120 struct lcore_conf lcore_conf[RTE_MAX_LCORE];
122 static uint64_t link_mbps;
130 static uint32_t sc_flag;
132 /* Check the link status of all ports in up to 3s, and print them finally */
134 check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
136 #define CHECK_INTERVAL 100 /* 100ms */
137 #define MAX_CHECK_TIME 30 /* 3s (30 * 100ms) in total */
139 uint8_t count, all_ports_up, print_flag = 0;
140 struct rte_eth_link link;
142 printf("Checking link statuses...\n");
144 for (count = 0; count <= MAX_CHECK_TIME; count++) {
146 for (portid = 0; portid < port_num; portid++) {
147 if ((port_mask & (1 << portid)) == 0)
149 memset(&link, 0, sizeof(link));
150 rte_eth_link_get_nowait(portid, &link);
151 /* print link status if flag set */
152 if (print_flag == 1) {
153 if (link.link_status) {
155 "Port%d Link Up. Speed %u Mbps - %s\n",
156 portid, link.link_speed,
157 (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
158 ("full-duplex") : ("half-duplex\n"));
160 link_mbps = link.link_speed;
162 printf("Port %d Link Down\n", portid);
165 /* clear all_ports_up flag if any link down */
166 if (link.link_status == ETH_LINK_DOWN) {
171 /* after finally printing all link status, get out */
175 if (all_ports_up == 0) {
177 rte_delay_ms(CHECK_INTERVAL);
180 /* set the print_flag if all ports up or timeout */
181 if (all_ports_up == 1 || count == (MAX_CHECK_TIME - 1))
187 print_ethaddr(const char *name, const struct ether_addr *eth_addr)
189 char buf[ETHER_ADDR_FMT_SIZE];
190 ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr);
191 printf("%s%s", name, buf);
195 init_traffic(struct rte_mempool *mp,
196 struct rte_mbuf **pkts_burst, uint32_t burst_size)
198 struct ether_hdr pkt_eth_hdr;
199 struct ipv4_hdr pkt_ipv4_hdr;
200 struct udp_hdr pkt_udp_hdr;
202 static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF };
203 static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA };
206 initialize_eth_header(&pkt_eth_hdr,
207 (struct ether_addr *)src_mac,
208 (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0);
210 pktlen = initialize_ipv4_header(&pkt_ipv4_hdr,
211 IPV4_ADDR(10, 0, 0, 1),
212 IPV4_ADDR(10, 0, 0, 2), 26);
213 printf("IPv4 pktlen %u\n", pktlen);
215 pktlen = initialize_udp_header(&pkt_udp_hdr, 0, 0, 18);
217 printf("UDP pktlen %u\n", pktlen);
219 return generate_packet_burst(mp, pkts_burst, &pkt_eth_hdr,
221 &pkt_udp_hdr, burst_size,
222 PACKET_BURST_GEN_PKT_LEN, 1);
230 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
231 lcore_conf[lcore_id].socketid =
232 rte_lcore_to_socket_id(lcore_id);
233 if (rte_lcore_is_enabled(lcore_id) == 0) {
234 lcore_conf[lcore_id].status = LCORE_INVALID;
237 lcore_conf[lcore_id].status = LCORE_AVAIL;
243 init_mbufpool(unsigned nb_mbuf)
249 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
250 if (rte_lcore_is_enabled(lcore_id) == 0)
253 socketid = rte_lcore_to_socket_id(lcore_id);
254 if (socketid >= NB_SOCKETS) {
255 rte_exit(EXIT_FAILURE,
256 "Socket %d of lcore %u is out of range %d\n",
257 socketid, lcore_id, NB_SOCKETS);
259 if (mbufpool[socketid] == NULL) {
260 snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
262 rte_pktmbuf_pool_create(s, nb_mbuf,
263 MEMPOOL_CACHE_SIZE, 0,
264 RTE_MBUF_DEFAULT_BUF_SIZE, socketid);
265 if (mbufpool[socketid] == NULL)
266 rte_exit(EXIT_FAILURE,
267 "Cannot init mbuf pool on socket %d\n",
270 printf("Allocated mbuf pool on socket %d\n",
278 alloc_lcore(uint16_t socketid)
282 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
283 if (LCORE_AVAIL != lcore_conf[lcore_id].status ||
284 lcore_conf[lcore_id].socketid != socketid ||
285 lcore_id == rte_get_master_lcore())
287 lcore_conf[lcore_id].status = LCORE_USED;
288 lcore_conf[lcore_id].nb_ports = 0;
295 static volatile uint64_t stop;
296 static uint64_t count;
297 static uint64_t drop;
298 static uint64_t idle;
309 stats_display(uint16_t port_id)
311 struct rte_eth_stats stats;
312 rte_eth_stats_get(port_id, &stats);
314 printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: "
316 stats.ipackets, stats.imissed, stats.ibytes);
317 printf(" RX-errors: %-10"PRIu64" RX-nombuf: %-10"PRIu64"\n",
318 stats.ierrors, stats.rx_nombuf);
319 printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: "
321 stats.opackets, stats.oerrors, stats.obytes);
325 signal_handler(int signum)
327 /* USR1 signal, stop testing */
328 if (signum == SIGUSR1) {
329 printf("Force Stop!\n");
333 /* USR2 signal, print stats */
334 if (signum == SIGUSR2)
338 struct rte_mbuf **tx_burst;
340 uint64_t (*do_measure)(struct lcore_conf *conf,
341 struct rte_mbuf *pkts_burst[],
342 uint64_t total_pkts);
345 measure_rxtx(struct lcore_conf *conf,
346 struct rte_mbuf *pkts_burst[],
349 unsigned i, portid, nb_rx, nb_tx;
350 uint64_t prev_tsc, cur_tsc;
352 prev_tsc = rte_rdtsc();
354 while (likely(!stop)) {
355 for (i = 0; i < conf->nb_ports; i++) {
356 portid = conf->portlist[i];
357 nb_rx = rte_eth_rx_burst(portid, 0,
358 pkts_burst, MAX_PKT_BURST);
359 if (unlikely(nb_rx == 0)) {
365 nb_tx = rte_eth_tx_burst(portid, 0, pkts_burst, nb_rx);
366 if (unlikely(nb_tx < nb_rx)) {
367 drop += (nb_rx - nb_tx);
369 rte_pktmbuf_free(pkts_burst[nb_tx]);
370 } while (++nb_tx < nb_rx);
373 if (unlikely(count >= total_pkts))
377 cur_tsc = rte_rdtsc();
379 return cur_tsc - prev_tsc;
383 measure_rxonly(struct lcore_conf *conf,
384 struct rte_mbuf *pkts_burst[],
387 unsigned i, portid, nb_rx, nb_tx;
388 uint64_t diff_tsc, cur_tsc;
391 while (likely(!stop)) {
392 for (i = 0; i < conf->nb_ports; i++) {
393 portid = conf->portlist[i];
395 cur_tsc = rte_rdtsc();
396 nb_rx = rte_eth_rx_burst(portid, 0,
397 pkts_burst, MAX_PKT_BURST);
398 if (unlikely(nb_rx == 0)) {
402 diff_tsc += rte_rdtsc() - cur_tsc;
405 nb_tx = rte_eth_tx_burst(portid, 0, pkts_burst, nb_rx);
406 if (unlikely(nb_tx < nb_rx)) {
407 drop += (nb_rx - nb_tx);
409 rte_pktmbuf_free(pkts_burst[nb_tx]);
410 } while (++nb_tx < nb_rx);
413 if (unlikely(count >= total_pkts))
421 measure_txonly(struct lcore_conf *conf,
422 struct rte_mbuf *pkts_burst[],
425 unsigned i, portid, nb_rx, nb_tx;
426 uint64_t diff_tsc, cur_tsc;
428 printf("do tx measure\n");
430 while (likely(!stop)) {
431 for (i = 0; i < conf->nb_ports; i++) {
432 portid = conf->portlist[i];
433 nb_rx = rte_eth_rx_burst(portid, 0,
434 pkts_burst, MAX_PKT_BURST);
435 if (unlikely(nb_rx == 0)) {
442 cur_tsc = rte_rdtsc();
443 nb_tx = rte_eth_tx_burst(portid, 0, pkts_burst, nb_rx);
444 if (unlikely(nb_tx < nb_rx)) {
445 drop += (nb_rx - nb_tx);
447 rte_pktmbuf_free(pkts_burst[nb_tx]);
448 } while (++nb_tx < nb_rx);
450 diff_tsc += rte_rdtsc() - cur_tsc;
452 if (unlikely(count >= total_pkts))
459 /* main processing loop */
461 main_loop(__rte_unused void *args)
463 #define PACKET_SIZE 64
465 #define MAC_PREAMBLE 8
466 struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
468 unsigned i, portid, nb_rx = 0, nb_tx = 0;
469 struct lcore_conf *conf;
472 uint64_t packets_per_second, total_packets;
474 lcore_id = rte_lcore_id();
475 conf = &lcore_conf[lcore_id];
476 if (conf->status != LCORE_USED)
479 pkt_per_port = MAX_TRAFFIC_BURST;
482 for (i = 0; i < conf->nb_ports; i++) {
483 int num = pkt_per_port;
484 portid = conf->portlist[i];
485 printf("inject %d packet to port %d\n", num, portid);
487 nb_tx = RTE_MIN(MAX_PKT_BURST, num);
488 nb_tx = rte_eth_tx_burst(portid, 0,
489 &tx_burst[idx], nb_tx);
494 printf("Total packets inject to prime ports = %u\n", idx);
496 packets_per_second = (link_mbps * 1000 * 1000) /
497 ((PACKET_SIZE + FRAME_GAP + MAC_PREAMBLE) * CHAR_BIT);
498 printf("Each port will do %"PRIu64" packets per second\n",
501 total_packets = RTE_TEST_DURATION * conf->nb_ports * packets_per_second;
502 printf("Test will stop after at least %"PRIu64" packets received\n",
505 diff_tsc = do_measure(conf, pkts_burst, total_packets);
507 for (i = 0; i < conf->nb_ports; i++) {
508 portid = conf->portlist[i];
509 int nb_free = pkt_per_port;
511 nb_rx = rte_eth_rx_burst(portid, 0,
512 pkts_burst, MAX_PKT_BURST);
514 while (nb_tx < nb_rx)
515 rte_pktmbuf_free(pkts_burst[nb_tx++]);
517 } while (nb_free != 0);
518 printf("free %d mbuf left in port %u\n", pkt_per_port, portid);
524 printf("%"PRIu64" packet, %"PRIu64" drop, %"PRIu64" idle\n",
526 printf("Result: %"PRIu64" cycles per packet\n", diff_tsc / count);
531 static rte_atomic64_t start;
534 poll_burst(void *args)
536 #define MAX_IDLE (10000)
538 struct rte_mbuf **pkts_burst;
539 uint64_t diff_tsc, cur_tsc;
540 uint16_t next[RTE_MAX_ETHPORTS];
541 struct lcore_conf *conf;
542 uint32_t pkt_per_port = *((uint32_t *)args);
543 unsigned i, portid, nb_rx = 0;
545 uint64_t timeout = MAX_IDLE;
546 int num[RTE_MAX_ETHPORTS];
548 lcore_id = rte_lcore_id();
549 conf = &lcore_conf[lcore_id];
550 if (conf->status != LCORE_USED)
553 total = pkt_per_port * conf->nb_ports;
554 printf("start to receive total expect %"PRIu64"\n", total);
556 pkts_burst = (struct rte_mbuf **)
557 rte_calloc_socket("poll_burst",
558 total, sizeof(void *),
559 RTE_CACHE_LINE_SIZE, conf->socketid);
563 for (i = 0; i < conf->nb_ports; i++) {
564 portid = conf->portlist[i];
565 next[portid] = i * pkt_per_port;
566 num[portid] = pkt_per_port;
569 while (!rte_atomic64_read(&start))
572 cur_tsc = rte_rdtsc();
574 for (i = 0; i < conf->nb_ports; i++) {
575 portid = conf->portlist[i];
576 nb_rx = rte_eth_rx_burst(portid, 0,
577 &pkts_burst[next[portid]],
578 RTE_MIN(MAX_PKT_BURST, num[portid]));
579 if (unlikely(nb_rx == 0)) {
581 if (unlikely(timeout == 0))
585 next[portid] += nb_rx;
586 num[portid] -= nb_rx;
591 diff_tsc = rte_rdtsc() - cur_tsc;
593 printf("%"PRIu64" packets lost, IDLE %"PRIu64" times\n",
594 total, MAX_IDLE - timeout);
596 total = pkt_per_port * conf->nb_ports - total;
597 for (i = 0; i < total; i++)
598 rte_pktmbuf_free(pkts_burst[i]);
600 rte_free(pkts_burst);
603 return diff_tsc / total;
609 exec_burst(uint32_t flags, int lcore)
611 unsigned i, portid, nb_tx = 0;
612 struct lcore_conf *conf;
613 uint32_t pkt_per_port;
617 conf = &lcore_conf[lcore];
619 pkt_per_port = MAX_TRAFFIC_BURST;
620 num = pkt_per_port * conf->nb_ports;
622 rte_atomic64_init(&start);
624 /* start polling thread, but not actually poll yet */
625 rte_eal_remote_launch(poll_burst,
626 (void *)&pkt_per_port, lcore);
628 /* Only when polling first */
629 if (flags == SC_BURST_POLL_FIRST)
630 rte_atomic64_set(&start, 1);
634 nb_tx = RTE_MIN(MAX_PKT_BURST, num);
635 for (i = 0; i < conf->nb_ports; i++) {
636 portid = conf->portlist[i];
637 nb_tx = rte_eth_tx_burst(portid, 0,
638 &tx_burst[idx], nb_tx);
647 /* only when polling second */
648 if (flags == SC_BURST_XMIT_FIRST)
649 rte_atomic64_set(&start, 1);
651 /* wait for polling finished */
652 diff_tsc = rte_eal_wait_lcore(lcore);
654 printf("exec_burst: Failed to measure cycles per packet\n");
658 printf("Result: %d cycles per packet\n", diff_tsc);
666 uint16_t nb_ports, num, nb_lcores, slave_id = (uint16_t)-1;
667 uint16_t nb_rxd = MAX_TRAFFIC_BURST;
668 uint16_t nb_txd = MAX_TRAFFIC_BURST;
670 uint16_t nb_rx_queue = 1, nb_tx_queue = 1;
674 printf("Start PMD RXTX cycles cost test.\n");
676 signal(SIGUSR1, signal_handler);
677 signal(SIGUSR2, signal_handler);
679 nb_ports = rte_eth_dev_count();
680 if (nb_ports < NB_ETHPORTS_USED) {
681 printf("At least %u port(s) used for perf. test\n",
686 nb_lcores = rte_lcore_count();
688 memset(lcore_conf, 0, sizeof(lcore_conf));
691 init_mbufpool(NB_MBUF);
693 if (sc_flag == SC_CONTINUOUS) {
694 nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
695 nb_txd = RTE_TEST_TX_DESC_DEFAULT;
697 printf("CONFIG RXD=%d TXD=%d\n", nb_rxd, nb_txd);
701 for (portid = 0; portid < nb_ports; portid++) {
702 if (socketid == -1) {
703 socketid = rte_eth_dev_socket_id(portid);
704 slave_id = alloc_lcore(socketid);
705 if (slave_id == (uint16_t)-1) {
706 printf("No avail lcore to run test\n");
709 printf("Performance test runs on lcore %u socket %u\n",
713 if (socketid != rte_eth_dev_socket_id(portid)) {
714 printf("Skip port %d\n", portid);
719 ret = rte_eth_dev_configure(portid, nb_rx_queue,
720 nb_tx_queue, &port_conf);
722 rte_exit(EXIT_FAILURE,
723 "Cannot configure device: err=%d, port=%d\n",
726 rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
727 printf("Port %u ", portid);
728 print_ethaddr("Address:", &ports_eth_addr[portid]);
732 ret = rte_eth_tx_queue_setup(portid, 0, nb_txd,
735 rte_exit(EXIT_FAILURE,
736 "rte_eth_tx_queue_setup: err=%d, "
737 "port=%d\n", ret, portid);
740 ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
744 rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d,"
745 "port=%d\n", ret, portid);
749 ret = rte_eth_dev_start(portid);
751 rte_exit(EXIT_FAILURE,
752 "rte_eth_dev_start: err=%d, port=%d\n",
755 /* always eanble promiscuous */
756 rte_eth_promiscuous_enable(portid);
758 lcore_conf[slave_id].portlist[num++] = portid;
759 lcore_conf[slave_id].nb_ports++;
761 check_all_ports_link_status(nb_ports, RTE_PORT_ALL);
763 if (tx_burst == NULL) {
764 tx_burst = (struct rte_mbuf **)
765 rte_calloc_socket("tx_buff",
766 MAX_TRAFFIC_BURST * nb_ports,
768 RTE_CACHE_LINE_SIZE, socketid);
773 init_traffic(mbufpool[socketid],
774 tx_burst, MAX_TRAFFIC_BURST * nb_ports);
776 printf("Generate %d packets @socket %d\n",
777 MAX_TRAFFIC_BURST * nb_ports, socketid);
779 if (sc_flag == SC_CONTINUOUS) {
780 /* do both rxtx by default */
781 if (NULL == do_measure)
782 do_measure = measure_rxtx;
784 rte_eal_remote_launch(main_loop, NULL, slave_id);
786 if (rte_eal_wait_lcore(slave_id) < 0)
788 } else if (sc_flag == SC_BURST_POLL_FIRST ||
789 sc_flag == SC_BURST_XMIT_FIRST)
790 if (exec_burst(sc_flag, slave_id) < 0)
794 for (portid = 0; portid < nb_ports; portid++) {
795 if (socketid != rte_eth_dev_socket_id(portid))
798 rte_eth_dev_stop(portid);
805 test_set_rxtx_conf(cmdline_fixed_string_t mode)
807 printf("mode switch to %s\n", mode);
809 if (!strcmp(mode, "vector")) {
811 tx_conf.txq_flags = 0xf01;
812 tx_conf.tx_rs_thresh = 32;
813 tx_conf.tx_free_thresh = 32;
814 port_conf.rxmode.hw_ip_checksum = 0;
815 port_conf.rxmode.enable_scatter = 0;
817 } else if (!strcmp(mode, "scalar")) {
818 /* bulk alloc rx, full-featured tx */
819 tx_conf.txq_flags = 0;
820 tx_conf.tx_rs_thresh = 32;
821 tx_conf.tx_free_thresh = 32;
822 port_conf.rxmode.hw_ip_checksum = 1;
823 port_conf.rxmode.enable_scatter = 0;
825 } else if (!strcmp(mode, "hybrid")) {
826 /* bulk alloc rx, vector tx
827 * when vec macro not define,
828 * using the same rx/tx as scalar
830 tx_conf.txq_flags = 0xf01;
831 tx_conf.tx_rs_thresh = 32;
832 tx_conf.tx_free_thresh = 32;
833 port_conf.rxmode.hw_ip_checksum = 1;
834 port_conf.rxmode.enable_scatter = 0;
836 } else if (!strcmp(mode, "full")) {
837 /* full feature rx,tx pair */
838 tx_conf.txq_flags = 0x0; /* must condition */
839 tx_conf.tx_rs_thresh = 32;
840 tx_conf.tx_free_thresh = 32;
841 port_conf.rxmode.hw_ip_checksum = 0;
842 port_conf.rxmode.enable_scatter = 1; /* must condition */
850 test_set_rxtx_anchor(cmdline_fixed_string_t type)
852 printf("type switch to %s\n", type);
854 if (!strcmp(type, "rxtx")) {
855 do_measure = measure_rxtx;
857 } else if (!strcmp(type, "rxonly")) {
858 do_measure = measure_rxonly;
860 } else if (!strcmp(type, "txonly")) {
861 do_measure = measure_txonly;
869 test_set_rxtx_sc(cmdline_fixed_string_t type)
871 printf("stream control switch to %s\n", type);
873 if (!strcmp(type, "continuous")) {
874 sc_flag = SC_CONTINUOUS;
876 } else if (!strcmp(type, "poll_before_xmit")) {
877 sc_flag = SC_BURST_POLL_FIRST;
879 } else if (!strcmp(type, "poll_after_xmit")) {
880 sc_flag = SC_BURST_XMIT_FIRST;
887 REGISTER_TEST_COMMAND(pmd_perf_autotest, test_pmd_perf);