Lines Matching defs:pd

254 static int dpdk_init_timer(struct pcap_dpdk *pd){
255 gettimeofday(&(pd->ts_helper.start_time),NULL);
256 pd->ts_helper.start_cycles = rte_get_timer_cycles();
257 pd->ts_helper.hz = rte_get_timer_hz();
258 if (pd->ts_helper.hz == 0){
287 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv);
291 if (pd->nonblock){
293 nb_rx = (int)rte_eth_rx_burst(pd->portid, 0, pkts_burst, burst_cnt);
298 nb_rx = (int)rte_eth_rx_burst(pd->portid, 0, pkts_burst, burst_cnt);
317 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv);
363 if (pd->nonblock){
380 calculate_timestamp(&(pd->ts_helper),&(pcap_header.ts));
397 gather_len = dpdk_gather_data(pd->pcap_tmp_buf, RTE_ETH_PCAP_SNAPLEN, m);
398 bp = pd->pcap_tmp_buf;
411 pd->bpf_drop++;
436 struct pcap_dpdk *pd = p->priv;
437 if (pd==NULL)
441 if (pd->must_clear_promisc)
443 rte_eth_promiscuous_disable(pd->portid);
445 rte_eth_dev_stop(pd->portid);
446 rte_eth_dev_close(pd->portid);
450 static void nic_stats_display(struct pcap_dpdk *pd)
452 uint16_t portid = pd->portid;
458 RTE_LOG(INFO,USER1, "portid:%d, RX-PPS: %-10"PRIu64" RX-Mbps: %.2lf\n", portid, pd->pps, pd->bps/1e6f );
463 struct pcap_dpdk *pd = p->priv;
464 calculate_timestamp(&(pd->ts_helper), &(pd->curr_ts));
465 rte_eth_stats_get(pd->portid,&(pd->curr_stats));
467 ps->ps_recv = pd->curr_stats.ipackets;
468 ps->ps_drop = pd->curr_stats.ierrors;
469 ps->ps_drop += pd->bpf_drop;
470 ps->ps_ifdrop = pd->curr_stats.imissed;
472 uint64_t delta_pkt = pd->curr_stats.ipackets - pd->prev_stats.ipackets;
474 timersub(&(pd->curr_ts),&(pd->prev_ts), &delta_tm);
476 uint64_t delta_bit = (pd->curr_stats.ibytes-pd->prev_stats.ibytes)*8;
478 pd->pps = (uint64_t)(delta_pkt*1e6f/delta_usec);
479 pd->bps = (uint64_t)(delta_bit*1e6f/delta_usec);
480 nic_stats_display(pd);
481 pd->prev_stats = pd->curr_stats;
482 pd->prev_ts = pd->curr_ts;
487 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv);
488 pd->nonblock = nonblock;
493 struct pcap_dpdk *pd = (struct pcap_dpdk*)(p->priv);
494 return pd->nonblock;
754 struct pcap_dpdk *pd = p->priv;
755 pd->orig = p;
788 ret = dpdk_init_timer(pd);
816 pd->portid = portid;
823 pd->pktmbuf_pool = rte_pktmbuf_pool_create(MBUF_POOL_NAME, nb_mbufs,
826 if (pd->pktmbuf_pool == NULL)
863 rte_eth_macaddr_get(portid, &(pd->eth_addr));
864 eth_addr_str(&(pd->eth_addr), pd->mac_addr, DPDK_MAC_ADDR_SIZE-1);
872 pd->pktmbuf_pool);
923 pd->must_clear_promisc=1;
935 rte_eth_stats_reset(pd->portid);
936 calculate_timestamp(&(pd->ts_helper), &(pd->prev_ts));
937 rte_eth_stats_get(pd->portid,&(pd->prev_stats));
939 pd->portid = portid;
940 p->fd = pd->portid;
959 pd->required_select_timeout.tv_sec = 0;
960 pd->required_select_timeout.tv_usec = DPDK_DEF_MIN_SLEEP_MS*1000;
961 p->required_select_timeout = &pd->required_select_timeout;
969 rte_eth_dev_get_name_by_port(portid,pd->pci_addr);
970 RTE_LOG(INFO, USER1,"Port %d device: %s, MAC:%s, PCI:%s\n", portid, p->opt.device, pd->mac_addr, pd->pci_addr);