> From: users [mailto:users-bounces at dpdk.org] On Behalf Of Rakesh Venkatesh > Sent: Tuesday, January 19, 2016 11:41 PM > Hello
Hi Rakesh, > I have a VM running in our company lab which has two ports in it named > "int" and "ext" which is binded using dpdk. The port is initialized either > as virtio or sriov mode. My question is how do I determine the port type > using a C program? Are there any dpdk api's which tells me whether its > sriov or virtio based? The rte_eth_dev_info struct contains various information about a port. The function rte_eth_dev_info_get() takes a port number as integer, and pointer to a rte_eth_dev_info struct, which it will fill in all the available information. If you need to just support virtio and SRIOV of a specific NIC, you can do a string-compare on the driver_name. > Using the shell script I can run "lspci" command and grep for keywords to > identify the port type but I am not finding a simpler way to do this from a > C program. Any help would be appreciated. > > If I run "lspci", I get the following output > > 00:03.0 Ethernet controller: Red Hat, Inc Virtio network device <<<<<<<<< > virtio based > 00:06.0 Ethernet controller: Intel Corporation 82599 Ethernet Controller > Virtual Function (rev 01) <<<<<<<<<sriov based > > By running grep command on this output and matching the keywords, I can > identify the port type. If PCI information is easier to apply your logic to, a struct rte_pci_device is also available in the rte_eth_dev_info. Hope that helps, -Harry
