[dpdk-users] Question on rte_eth_tx_burst

April Teodoro ateodoro at hotmail.ph
Wed Dec 28 02:45:23 CET 2016


Hello, I would like to follow up on this question.
rte_eth_tx_burst returns 1 which is expected

However, stats_get says there were 0 obytes


________________________________
From: users <users-bounces at dpdk.org> on behalf of April Teodoro <ateodoro at hotmail.ph>
Sent: Tuesday, December 27, 2016 6:50 PM
To: users at dpdk.org
Subject: [dpdk-users] Question on rte_eth_tx_burst

Hi, I am wondering what is causing the packet to be dropped. Please help me.

The mempool was created and retrieved via lookup

The port and queues have been verified to be correct.


However, according to stats, no packet is transmitted. I also do not receive anything on the receiving side.

532         if(mem == NULL)
533         {
534                 LOG <<"No mem";
535         }
536         else{
537                 LOG << "has mem";
538         }
539
540         rte_mbuf *mbufs = rte_pktmbuf_alloc(mem);
541         if(NULL == mbufs)
542 {
543         LOG << "ALLOCATION failed";
544 }
545  else
546 {
547    LOG << "ALLOCATION successful";
548 }
549
550         uint8_t* messageToSend = NULL;
551         LOG << "SENDRAW 2";
552         ether_addr addr;
553         rte_eth_macaddr_get(port, &addr);
554         LOG << "start port 2: " << rte_eth_dev_start(2);

569         ether_addr_copy(&addr, &hdr->s_addr);
570         hdr->ether_type = rte_cpu_to_be_16(0x9998);
571         mbufs->pkt_len = mbufs->data_len = 8;
572
573         messageToSend = (uint8_t*)&hdr[2];
574
575         for(auto i=0u; i < sendmsg.header.msgSize; ++i) {
576         messageToSend[i] = sendmsg.data[i];
577         }
578
579         LOG << "SENDRAW " << sendmsg.header.msgSize;
580         mbufs->pkt_len = sendmsg.header.msgSize;
581         LOG << "SENDRAW 5";
582         LOG << "SENDRAW 6";
583         rte_mbuf *mbufArray[] = {mbufs};
584         rte_pktmbuf_refcnt_update(mbufs, 1);
585         LOG << "SENDRAW 7";
586         //uint16_t nbPk = rte_eth_tx_burst(2, 0, mbufArray, 1);
587         uint32_t sent = 0;
588         struct rte_eth_dev_info dev_info;
589         struct rte_eth_stats stats;
590         LOG << "stats successful? " << rte_eth_stats_get(2, &stats);
591         rte_eth_dev_info_get(2, &dev_info);
592         LOG << "dev info: " << (dev_info.pci_dev->addr.bus);
593         while (1) {
594                 sent = rte_eth_tx_burst(2, 0, mbufArray, 1);
595                 if (sent > 0) {
596                      LOG << "opackets: " << stats.opackets;
597                      LOG << "obytes: " << stats.obytes;
598                      LOG << "oerrors: " << stats.oerrors;
599                      LOG << "packets transmitted "  << sent;
600                      return;
601                 }
602         }
603
604
605     }




More information about the users mailing list