[dpdk-dev] Hotplug
Srikanth Akula
srikanth044 at gmail.com
Wed Oct 7 23:16:12 CEST 2015
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 .
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 at networkplumber.org> wrote:
> On Mon, 28 Sep 2015 21:12:50 -0700
> Srikanth Akula <srikanth044 at 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.
>
>
More information about the dev
mailing list