From: Srikanth Akula <srikanth044@gmail.com>
To: Tetsuya Mukawa <mukawa@igel.co.jp>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Hotplug
Date: Wed, 7 Oct 2015 17:06:02 -0700 [thread overview]
Message-ID: <CA+8eA5mDRYmeGFnBcGqAdxTv9kjMg_x1+B6X+NSYSiKL7Ce29Q@mail.gmail.com> (raw)
In-Reply-To: <5615AE9D.7070103@igel.co.jp>
Hi Tetsuya ,
Thank you for your inputs .
I have thought about this API , but looks like it takes interface name as
argument ( which is a unique name from the rte_pci_dev instance) . But i am
looking to check if the device is attached based on the PCI address .
But ,I am going to test this too
Regards,
Srikanth
On Wed, Oct 7, 2015 at 4:45 PM, Tetsuya Mukawa <mukawa@igel.co.jp> wrote:
> On 2015/10/07 22:16, Srikanth Akula wrote:
> > Thank you for the inputs .
> >
> > I was able to solve the problem of device notification from my control
> > plane.
> >
> > I would like to know if we have any way to know if the PCI device is
> > already attached before we try to attach it ( if the device is already
> > attached pci probe will result an error ) .
> > But i want to know before hand to verify if the device is already
> attached
> > or not .
>
> Hi Srikanth,
>
> I guess below API may help you.
> (Unfortunately, I am out of office now, so I haven't checked it, but I
> guess it works.)
>
> - struct rte_eth_dev *rte_eth_dev_allocated(const char *name)
>
> If none NULL value is returned, a device has been already attached.
> If you want to check a physical NIC, above 'name' parameter will be like
> below.
>
> snprintf(name, size, "%d:%d.%d",
> pci_dev->addr.bus, pci_dev->addr.devid,
> pci_dev->addr.function);
>
> Thanks,
> Tetsuya
>
> >
> > I came with small API which can be used to check if the pci device is
> > already bound to any driver .
> >
> > +int
> > +rte_eal_pci_is_attached(const char *devargs)
> > +{
> > + struct rte_pci_device *dev = NULL;
> > + struct rte_pci_addr addr;
> > + memset(&addr,0,sizeof(struct rte_pci_addr));
> > +
> > + if (eal_parse_pci_DomBDF(devargs, &addr) == 0)
> > + {
> > + TAILQ_FOREACH(dev, &pci_device_list, next) {
> > + if (!rte_eal_compare_pci_addr(&dev->addr, &addr))
> > + {
> > + if (dev->driver)
> > + {
> > + /*pci_dump_one_device(stdout,dev);*/
> > + RTE_LOG(WARNING, EAL, "Requested device "
> PCI_PRI_FMT
> > + " cannot be used\n", dev->addr.domain,
> dev->addr.bus,
> > + dev->addr.devid, dev->addr.function);
> > + return -1;
> > + }
> > + }
> > + }
> > + }
> > + return 0;
> > +}
> > +
> >
> > Could you please let me know if it is good to have such APIs
> >
> > Regards,
> > _Srikanth_
> >
> >
> > On Mon, Sep 28, 2015 at 9:44 PM, Stephen Hemminger <
> > stephen@networkplumber.org> wrote:
> >
> >> On Mon, 28 Sep 2015 21:12:50 -0700
> >> Srikanth Akula <srikanth044@gmail.com> wrote:
> >>
> >>> Hello ,
> >>>
> >>> I am trying to write an application based on DPDK port hotplug feature
> .
> >> My
> >>> requirement is to get an event when a new PCI devices gets added to the
> >>> system on the go.
> >>>
> >>> Do we have any in-built mechanism in DPDK (UIO/e1000/vfio drivers )
> that
> >> i
> >>> can use to get notifications when a new device gets added . I know the
> >>> alternatives such as inotify etc .
> >>>
> >>> But i am more interested to get equivalent support in dpdk drivers .
> >>>
> >>> Please let me know .
> >>>
> >>> Srikanth
> >> Implementing hotplug requires integration with the OS more than any
> >> additional
> >> DPDK support. What the Brocade vRouter does is leverage the existing
> Linux
> >> udev infrastructure to send a message to the router application which
> then
> >> initializes and sets up the new hardware. Most of the DPDK changes are
> >> upstream
> >> already and involve being able to dynamically add ports on the fly.
> >>
> >>
>
>
prev parent reply other threads:[~2015-10-08 0:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 11:04 [dpdk-dev] [PATCH] doc: updated release notes for r2.1 John McNamara
2015-08-13 11:04 ` John McNamara
2015-08-13 13:02 ` Iremonger, Bernard
2015-08-17 17:10 ` Thomas Monjalon
2015-09-29 4:12 ` Srikanth Akula
2015-09-29 4:44 ` [dpdk-dev] Hotplug Stephen Hemminger
2015-10-07 21:16 ` Srikanth Akula
2015-10-07 23:45 ` Tetsuya Mukawa
2015-10-08 0:06 ` Srikanth Akula [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=CA+8eA5mDRYmeGFnBcGqAdxTv9kjMg_x1+B6X+NSYSiKL7Ce29Q@mail.gmail.com \
--to=srikanth044@gmail.com \
--cc=dev@dpdk.org \
--cc=mukawa@igel.co.jp \
/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).