Lines Matching +full:report +full:- +full:speed +full:- +full:hz
31 1. Pcap-dpdk provides libpcap the ability to use DPDK with the device name as dpdk:{portid}, such a…
33 3. The testprogs/capturetest provides 6.4Gbps/800,000 pps on Intel 10-Gigabit X540-AT2 with DPDK 18…
36 …port will be on if DPDK is available. Please set DIR for --with-dpdk[=DIR] with ./configure or -DD…
46 sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/' $RTE_SDK/$RTE_TARGET/.config
50 You shall learn how to bind nic with DPDK-compatible driver by $RTE_SDK/usertools/dpdk-devbind.py, …
51 And enable hugepages by dpdk-setup.sh
54 …TE_SDK/examples/l2fwd/$RTE_TARGET/l2fwd -dlibrte_pmd_e1000.so -dlibrte_pmd_ixgbe.so -dlibrte_mempo…
58 … which are used for compiling DPDK. And then pass $RTE_SDK/$RTE_TARGET to --with-dpdk or -DDPDK_DIR
65 ./configure --with-dpdk=$RTE_SDK/$RTE_TARGET && make -s all && make -s testprogs && make install
69 mkdir -p build && cd build && cmake -DDPDK_DIR=$RTE_SDK/$RTE_TARGET ../ && make -s all && make -s t…
75 env DPDK_CFG="--log-level=debug -l0 -dlibrte_pmd_e1000.so -dlibrte_pmd_ixgbe.so -dlibrte_mempool_ri…
114 #include "pcap-int.h"
115 #include "pcap-dpdk.h"
148 #define DPDK_DEF_CFG "--log-level=error -l0 -dlibrte_pmd_e1000.so -dlibrte_pmd_ixgbe.so -dlibrte_me…
175 uint64_t hz; member
232 /* No - just give them what we've produced. */ in dpdk_fmt_errmsg_for_rte_errno()
236 errbuflen_remaining = errbuflen - msglen; in dpdk_fmt_errmsg_for_rte_errno()
241 errbuflen_remaining -= 2; in dpdk_fmt_errmsg_for_rte_errno()
245 * rte_strerror() is thread-safe, at least as of dpdk 18.11, in dpdk_fmt_errmsg_for_rte_errno()
246 * unlike strerror() - it uses strerror_r() rather than strerror() in dpdk_fmt_errmsg_for_rte_errno()
247 * for UN*X errno values, and prints to what I assume is a per-thread in dpdk_fmt_errmsg_for_rte_errno()
255 gettimeofday(&(pd->ts_helper.start_time),NULL); in dpdk_init_timer()
256 pd->ts_helper.start_cycles = rte_get_timer_cycles(); in dpdk_init_timer()
257 pd->ts_helper.hz = rte_get_timer_hz(); in dpdk_init_timer()
258 if (pd->ts_helper.hz == 0){ in dpdk_init_timer()
259 return -1; in dpdk_init_timer()
268 cycles = rte_get_timer_cycles() - helper->start_cycles; in calculate_timestamp()
269 cur_time.tv_sec = (time_t)(cycles/helper->hz); in calculate_timestamp()
270 cur_time.tv_usec = (suseconds_t)((cycles%helper->hz)*1e6/helper->hz); in calculate_timestamp()
271 timeradd(&(helper->start_time), &cur_time, ts); in calculate_timestamp()
277 while (mbuf && (total_len+mbuf->data_len) < len ){ in dpdk_gather_data()
278 rte_memcpy(data+total_len, rte_pktmbuf_mtod(mbuf,void *),mbuf->data_len); in dpdk_gather_data()
279 total_len+=mbuf->data_len; in dpdk_gather_data()
280 mbuf=mbuf->next; in dpdk_gather_data()
287 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv); in dpdk_read_with_timeout()
289 int timeout_ms = p->opt.timeout; in dpdk_read_with_timeout()
291 if (pd->nonblock){ in dpdk_read_with_timeout()
292 // In non-blocking mode, just read once, no matter how many packets are captured. in dpdk_read_with_timeout()
293 nb_rx = (int)rte_eth_rx_burst(pd->portid, 0, pkts_burst, burst_cnt); in dpdk_read_with_timeout()
298 nb_rx = (int)rte_eth_rx_burst(pd->portid, 0, pkts_burst, burst_cnt); in dpdk_read_with_timeout()
302 if (p->break_loop){ in dpdk_read_with_timeout()
317 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv); in pcap_dpdk_dispatch()
331 int timeout_ms = p->opt.timeout; in pcap_dpdk_dispatch()
339 * return a too-low count. in pcap_dpdk_dispatch()
355 if (p->break_loop){ in pcap_dpdk_dispatch()
356 p->break_loop = 0; in pcap_dpdk_dispatch()
359 // read once in non-blocking mode, or try many times waiting for timeout_ms. in pcap_dpdk_dispatch()
363 if (pd->nonblock){ in pcap_dpdk_dispatch()
364 RTE_LOG(DEBUG, USER1, "dpdk: no packets available in non-blocking mode.\n"); in pcap_dpdk_dispatch()
366 if (p->break_loop){ in pcap_dpdk_dispatch()
368 p->break_loop = 0; in pcap_dpdk_dispatch()
374 // break if dpdk reads 0 packet, no matter in blocking(timeout) or non-blocking mode. in pcap_dpdk_dispatch()
380 calculate_timestamp(&(pd->ts_helper),&(pcap_header.ts)); in pcap_dpdk_dispatch()
382 // caplen = min(pkt_len, p->snapshot); in pcap_dpdk_dispatch()
384 caplen = pkt_len < (uint32_t)p->snapshot ? pkt_len: (uint32_t)p->snapshot; in pcap_dpdk_dispatch()
390 if (m->nb_segs == 1) in pcap_dpdk_dispatch()
397 gather_len = dpdk_gather_data(pd->pcap_tmp_buf, RTE_ETH_PCAP_SNAPLEN, m); in pcap_dpdk_dispatch()
398 bp = pd->pcap_tmp_buf; in pcap_dpdk_dispatch()
408 …if (p->fcode.bf_insns==NULL || pcapint_filter(p->fcode.bf_insns, bp, pcap_header.len, pcap_header.… in pcap_dpdk_dispatch()
411 pd->bpf_drop++; in pcap_dpdk_dispatch()
428 pcapint_strlcpy(p->errbuf, in pcap_dpdk_inject()
436 struct pcap_dpdk *pd = p->priv; in pcap_dpdk_close()
441 if (pd->must_clear_promisc) in pcap_dpdk_close()
443 rte_eth_promiscuous_disable(pd->portid); in pcap_dpdk_close()
445 rte_eth_dev_stop(pd->portid); in pcap_dpdk_close()
446 rte_eth_dev_close(pd->portid); in pcap_dpdk_close()
452 uint16_t portid = pd->portid; in nic_stats_display()
455 RTE_LOG(INFO,USER1, "portid:%d, RX-packets: %-10"PRIu64" RX-errors: %-10"PRIu64 in nic_stats_display()
456 … " RX-bytes: %-10"PRIu64" RX-Imissed: %-10"PRIu64"\n", portid, stats.ipackets, stats.ierrors, in nic_stats_display()
458 …RTE_LOG(INFO,USER1, "portid:%d, RX-PPS: %-10"PRIu64" RX-Mbps: %.2lf\n", portid, pd->pps, pd->bps/1… in nic_stats_display()
463 struct pcap_dpdk *pd = p->priv; in pcap_dpdk_stats()
464 calculate_timestamp(&(pd->ts_helper), &(pd->curr_ts)); in pcap_dpdk_stats()
465 rte_eth_stats_get(pd->portid,&(pd->curr_stats)); in pcap_dpdk_stats()
467 ps->ps_recv = pd->curr_stats.ipackets; in pcap_dpdk_stats()
468 ps->ps_drop = pd->curr_stats.ierrors; in pcap_dpdk_stats()
469 ps->ps_drop += pd->bpf_drop; in pcap_dpdk_stats()
470 ps->ps_ifdrop = pd->curr_stats.imissed; in pcap_dpdk_stats()
472 uint64_t delta_pkt = pd->curr_stats.ipackets - pd->prev_stats.ipackets; in pcap_dpdk_stats()
474 timersub(&(pd->curr_ts),&(pd->prev_ts), &delta_tm); in pcap_dpdk_stats()
476 uint64_t delta_bit = (pd->curr_stats.ibytes-pd->prev_stats.ibytes)*8; in pcap_dpdk_stats()
477 …RTE_LOG(DEBUG, USER1, "delta_usec: %-10"PRIu64" delta_pkt: %-10"PRIu64" delta_bit: %-10"PRIu64"\n"… in pcap_dpdk_stats()
478 pd->pps = (uint64_t)(delta_pkt*1e6f/delta_usec); in pcap_dpdk_stats()
479 pd->bps = (uint64_t)(delta_bit*1e6f/delta_usec); in pcap_dpdk_stats()
481 pd->prev_stats = pd->curr_stats; in pcap_dpdk_stats()
482 pd->prev_ts = pd->curr_ts; in pcap_dpdk_stats()
487 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv); in pcap_dpdk_setnonblock()
488 pd->nonblock = nonblock; in pcap_dpdk_setnonblock()
493 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv); in pcap_dpdk_getnonblock()
494 return pd->nonblock; in pcap_dpdk_getnonblock()
500 return plink->link_status == ETH_LINK_UP; in check_link_status()
506 snprintf(mac_str, len-1, DPDK_DEF_MAC_ADDR); in eth_addr_str()
517 snprintf(mac_str+offset, len-1-offset, "%02X",addrp->addr_bytes[i]); in eth_addr_str()
520 snprintf(mac_str+offset, len-1-offset, ":%02X", addrp->addr_bytes[i]); in eth_addr_str()
526 // return portid by device name, otherwise return -1
566 for (i=0;dpdk_cfg[i] && cnt<DPDK_ARGC_MAX-1;i++){ in parse_dpdk_cfg()
590 // If eaccess_not_fatal is non-zero, treat "a permissions issue" the way
626 snprintf(dpdk_cfg_buf,DPDK_CFG_MAX_LEN-1,"%s %s",DPDK_LIB_NAME,ptr_dpdk_cfg); in dpdk_pre_init()
629 if (ret == -1) in dpdk_pre_init()
634 is_dpdk_pre_inited = -rte_errno; in dpdk_pre_init()
642 switch (-is_dpdk_pre_inited) in dpdk_pre_init()
651 // Otherwise report a fatal error. in dpdk_pre_init()
693 // an out-of-memory condition." in dpdk_pre_init()
744 PCAP_ERRBUF_SIZE, -is_dpdk_pre_inited, in dpdk_pre_init()
754 struct pcap_dpdk *pd = p->priv; in pcap_dpdk_activate()
755 pd->orig = p; in pcap_dpdk_activate()
773 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_dpdk_activate()
775 p->opt.device, dpdk_pre_init_errbuf); in pcap_dpdk_activate()
782 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_dpdk_activate()
784 p->opt.device); in pcap_dpdk_activate()
791 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_dpdk_activate()
793 p->opt.device); in pcap_dpdk_activate()
801 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_dpdk_activate()
807 portid = portid_by_device(p->opt.device); in pcap_dpdk_activate()
809 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_dpdk_activate()
811 p->opt.device); in pcap_dpdk_activate()
816 pd->portid = portid; in pcap_dpdk_activate()
818 if (p->snapshot <= 0 || p->snapshot > MAXIMUM_SNAPLEN) in pcap_dpdk_activate()
820 p->snapshot = MAXIMUM_SNAPLEN; in pcap_dpdk_activate()
823 pd->pktmbuf_pool = rte_pktmbuf_pool_create(MBUF_POOL_NAME, nb_mbufs, in pcap_dpdk_activate()
826 if (pd->pktmbuf_pool == NULL) in pcap_dpdk_activate()
828 dpdk_fmt_errmsg_for_rte_errno(p->errbuf, in pcap_dpdk_activate()
844 dpdk_fmt_errmsg_for_rte_errno(p->errbuf, in pcap_dpdk_activate()
845 PCAP_ERRBUF_SIZE, -ret, in pcap_dpdk_activate()
855 dpdk_fmt_errmsg_for_rte_errno(p->errbuf, in pcap_dpdk_activate()
856 PCAP_ERRBUF_SIZE, -ret, in pcap_dpdk_activate()
863 rte_eth_macaddr_get(portid, &(pd->eth_addr)); in pcap_dpdk_activate()
864 eth_addr_str(&(pd->eth_addr), pd->mac_addr, DPDK_MAC_ADDR_SIZE-1); in pcap_dpdk_activate()
872 pd->pktmbuf_pool); in pcap_dpdk_activate()
875 dpdk_fmt_errmsg_for_rte_errno(p->errbuf, in pcap_dpdk_activate()
876 PCAP_ERRBUF_SIZE, -ret, in pcap_dpdk_activate()
891 dpdk_fmt_errmsg_for_rte_errno(p->errbuf, in pcap_dpdk_activate()
892 PCAP_ERRBUF_SIZE, -ret, in pcap_dpdk_activate()
904 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_dpdk_activate()
914 dpdk_fmt_errmsg_for_rte_errno(p->errbuf, in pcap_dpdk_activate()
915 PCAP_ERRBUF_SIZE, -ret, in pcap_dpdk_activate()
922 if (p->opt.promisc){ in pcap_dpdk_activate()
923 pd->must_clear_promisc=1; in pcap_dpdk_activate()
929 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_dpdk_activate()
935 rte_eth_stats_reset(pd->portid); in pcap_dpdk_activate()
936 calculate_timestamp(&(pd->ts_helper), &(pd->prev_ts)); in pcap_dpdk_activate()
937 rte_eth_stats_get(pd->portid,&(pd->prev_stats)); in pcap_dpdk_activate()
939 pd->portid = portid; in pcap_dpdk_activate()
940 p->fd = pd->portid; in pcap_dpdk_activate()
941 if (p->snapshot <=0 || p->snapshot> MAXIMUM_SNAPLEN) in pcap_dpdk_activate()
943 p->snapshot = MAXIMUM_SNAPLEN; in pcap_dpdk_activate()
945 p->linktype = DLT_EN10MB; // Ethernet, the 10MB is historical. in pcap_dpdk_activate()
946 p->selectable_fd = p->fd; in pcap_dpdk_activate()
947 p->read_op = pcap_dpdk_dispatch; in pcap_dpdk_activate()
948 p->inject_op = pcap_dpdk_inject; in pcap_dpdk_activate()
950 p->setfilter_op = pcapint_install_bpf_program; in pcap_dpdk_activate()
951 p->setdirection_op = NULL; in pcap_dpdk_activate()
952 p->set_datalink_op = NULL; in pcap_dpdk_activate()
953 p->getnonblock_op = pcap_dpdk_getnonblock; in pcap_dpdk_activate()
954 p->setnonblock_op = pcap_dpdk_setnonblock; in pcap_dpdk_activate()
955 p->stats_op = pcap_dpdk_stats; in pcap_dpdk_activate()
956 p->cleanup_op = pcap_dpdk_close; in pcap_dpdk_activate()
957 p->breakloop_op = pcapint_breakloop_common; in pcap_dpdk_activate()
959 pd->required_select_timeout.tv_sec = 0; in pcap_dpdk_activate()
960 pd->required_select_timeout.tv_usec = DPDK_DEF_MIN_SLEEP_MS*1000; in pcap_dpdk_activate()
961 p->required_select_timeout = &pd->required_select_timeout; in pcap_dpdk_activate()
969 rte_eth_dev_get_name_by_port(portid,pd->pci_addr); in pcap_dpdk_activate()
970 …INFO, USER1,"Port %d device: %s, MAC:%s, PCI:%s\n", portid, p->opt.device, pd->mac_addr, pd->pci_a… in pcap_dpdk_activate()
971 RTE_LOG(INFO, USER1,"Port %d Link Up. Speed %u Mbps - %s\n", in pcap_dpdk_activate()
974 ("full-duplex") : ("half-duplex\n")); in pcap_dpdk_activate()
993 p->activate_op = pcap_dpdk_activate; in pcap_dpdk_create()
1034 snprintf(dpdk_name, DPDK_DEV_NAME_MAX-1, in pcap_dpdk_findalldevs()
1041 …snprintf(dpdk_desc,DPDK_DEV_DESC_MAX-1,"%s %s, MAC:%s, PCI:%s", DPDK_DESC, dpdk_name, mac_addr, pc… in pcap_dpdk_findalldevs()
1082 return (PCAP_VERSION_STRING " (DPDK-only)"); in pcap_lib_version()