DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Determining port type using API's
@ 2016-01-19 23:40 Rakesh Venkatesh
  2016-01-20  9:03 ` Van Haaren, Harry
  0 siblings, 1 reply; 2+ messages in thread
From: Rakesh Venkatesh @ 2016-01-19 23:40 UTC (permalink / raw)
  To: users

Hello


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?

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.

-- 
Thanks and regards

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-users] Determining port type using API's
  2016-01-19 23:40 [dpdk-users] Determining port type using API's Rakesh Venkatesh
@ 2016-01-20  9:03 ` Van Haaren, Harry
  0 siblings, 0 replies; 2+ messages in thread
From: Van Haaren, Harry @ 2016-01-20  9:03 UTC (permalink / raw)
  To: Rakesh Venkatesh, users

> From: users [mailto:users-bounces@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-20  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-19 23:40 [dpdk-users] Determining port type using API's Rakesh Venkatesh
2016-01-20  9:03 ` Van Haaren, Harry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).