Examples/DpdkBridge/main.cpp
/**
 * Print to console all available DPDK ports. Used by the -l switch
 */
Print to console all available DPDK ports. Used by the -l switch
Print to console all available DPDK ports . Used by the - l switch
void listDpdkPorts()
{
	pcpp::CoreMask coreMaskToUse = pcpp::getCoreMaskForAllMachineCores();
	if (!pcpp::DpdkDeviceList::initDpdk(coreMaskToUse, DEFAULT_MBUF_POOL_SIZE))
	{
		EXIT_WITH_ERROR("couldn't initialize DPDK");
	}
	std::cout << "DPDK port list:" << std::endl;
	std::vector<pcpp::DpdkDevice*> deviceList = pcpp::DpdkDeviceList::getInstance().getDpdkDeviceList();
	for (std::vector<pcpp::DpdkDevice*>::iterator iter = deviceList.begin(); iter != deviceList.end(); iter++)
	{
		pcpp::DpdkDevice* dev = *iter;
		std::cout << "   "
			<< " Port #" << dev->getDeviceId() << ":"
			<< " MAC address='" << dev->getMacAddress() << "';"
			<< " PCI address='" << dev->getPciAddress() << "';"
			<< " PMD='" << dev->getPMDName() << "'"
			<< std::endl;
	}
}
void listDpdkPorts ( ) { pcpp :: CoreMask coreMaskToUse = pcpp :: getCoreMaskForAllMachineCores ( ) ; if ( ! pcpp :: DpdkDeviceList :: initDpdk ( coreMaskToUse , DEFAULT_MBUF_POOL_SIZE ) ) { EXIT_WITH_ERROR ( " " ) ; } std :: cout << " " << std :: endl ; std :: vector < pcpp :: DpdkDevice * > deviceList = pcpp :: DpdkDeviceList :: getInstance ( ) . getDpdkDeviceList ( ) ; for ( std :: vector < pcpp :: DpdkDevice * > :: iterator iter = deviceList . begin ( ) ; iter != deviceList . end ( ) ; iter ++ ) { pcpp :: DpdkDevice * dev = * iter ; std :: cout << " " << " " << dev -> getDeviceId ( ) << " " << " " << dev -> getMacAddress ( ) << " " << " " << dev -> getPciAddress ( ) << " " << " " << dev -> getPMDName ( ) << " " << std :: endl ; } }
Print to console all available DPDK ports.
Print to console all available DPDK ports .
// initialize DPDK // go over all available DPDK devices and print info for each one