From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: Rakesh Venkatesh <rakeshv.com@gmail.com>,
"users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] Determining port type using API's
Date: Wed, 20 Jan 2016 09:03:26 +0000 [thread overview]
Message-ID: <E923DB57A917B54B9182A2E928D00FA61285C1C5@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <CACcw_-ma6Mj+KhzY3XXvVYKVL-Li+2+tO5AyM1ShU954r5yOeQ@mail.gmail.com>
> 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
prev parent reply other threads:[~2016-01-20 9:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 23:40 Rakesh Venkatesh
2016-01-20 9:03 ` Van Haaren, Harry [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E923DB57A917B54B9182A2E928D00FA61285C1C5@IRSMSX102.ger.corp.intel.com \
--to=harry.van.haaren@intel.com \
--cc=rakeshv.com@gmail.com \
--cc=users@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).