From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by dpdk.org (Postfix) with ESMTP id 31FB95961 for ; Thu, 8 Oct 2015 01:45:35 +0200 (CEST) Received: by wicge5 with SMTP id ge5so2307019wic.0 for ; Wed, 07 Oct 2015 16:45:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=gpnC8rdvziwfkB9Oot5SoRjk/1rxBsOoyFe+YdcK5bE=; b=HMHcXUg7Y15ydA/k5RW5hGJ9ONT7dOapk7zaPVXDLi+T8SrWb0kyTyL4Wwl+0cKK87 kJSlSzDnP8tuKkMcgz62agIZY3Rck4/9CjR3Ifm6Ck3oJkfUM7OhlALWAamHnXc5LeIb UxMwIdvcl0aw6AQkoviORUNdTNaa3QKd/MOPPPqfIiVhtyurVQMF7Ua7SqBJNNn4aY0Z srEpOt94km8pljlHTrJzLRsiPG2JC7SFKybjHhLDLNeCsqBO9Nhg/5AylguyWKKfpHth E6qXyndCYR8aViQVoa3ejQeCvboFBxsUsZY9BOctKgY/PJFX+UeEYVqZ6I2y+9XLi1o3 BJZg== X-Gm-Message-State: ALoCoQkuAbwE7+0SQ6VAFthbqnYO9M5Wm995iT76uM2BEkIW0Lui7IpNduuWudTTicrUJCUpZU6j X-Received: by 10.194.103.130 with SMTP id fw2mr4552110wjb.121.1444261535016; Wed, 07 Oct 2015 16:45:35 -0700 (PDT) Received: from [10.10.10.15] ([185.61.0.42]) by smtp.googlemail.com with ESMTPSA id gt4sm4638144wib.21.2015.10.07.16.45.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Oct 2015 16:45:34 -0700 (PDT) To: Srikanth Akula References: <1439463883-19689-1-git-send-email-john.mcnamara@intel.com> <1439463883-19689-2-git-send-email-john.mcnamara@intel.com> <8CEF83825BEC744B83065625E567D7C219F39EE3@IRSMSX108.ger.corp.intel.com> <20150928214434.1c8c9c33@urahara> From: Tetsuya Mukawa X-Enigmail-Draft-Status: N1110 Message-ID: <5615AE9D.7070103@igel.co.jp> Date: Thu, 8 Oct 2015 00:45:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Hotplug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Oct 2015 23:45:35 -0000 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 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. >> >>