From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shreyansh Jain Subject: Re: [PATCH] eal: Fix device registration on FreeBSD Date: Mon, 27 Mar 2017 11:34:33 +0530 Message-ID: <0ff897d0-0541-652b-c77b-6369c3e41a67@nxp.com> References: <20170321183215.8357-1-benjamin.walker@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: To: Ben Walker Return-path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0088.outbound.protection.outlook.com [104.47.36.88]) by dpdk.org (Postfix) with ESMTP id 90F2CF964 for ; Mon, 27 Mar 2017 07:58:40 +0200 (CEST) In-Reply-To: <20170321183215.8357-1-benjamin.walker@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wednesday 22 March 2017 12:02 AM, Ben Walker wrote: > The FreeBSD implementation wasn't registering new devices > with the device framework on start up. However, common > code attempts to unregister them on shutdown which causes > a SEGFAULT. This fix makes the FreeBSD code do the same > thing as the Linux code for registration. > > Signed-off-by: Ben Walker > --- > lib/librte_eal/bsdapp/eal/eal_pci.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c > index 3a5c315..16a1743 100644 > --- a/lib/librte_eal/bsdapp/eal/eal_pci.c > +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c > @@ -314,6 +314,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) > > /* device is valid, add in list (sorted) */ > if (TAILQ_EMPTY(&pci_device_list)) { > + rte_eal_device_insert(&dev->device); > TAILQ_INSERT_TAIL(&pci_device_list, dev, next); > } > else { > @@ -326,7 +327,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) > continue; > else if (ret < 0) { > TAILQ_INSERT_BEFORE(dev2, dev, next); > - return 0; > + rte_eal_device_insert(&dev->device); > } else { /* already registered */ > dev2->kdrv = dev->kdrv; > dev2->max_vfs = dev->max_vfs; > @@ -334,9 +335,10 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) > dev->mem_resource, > sizeof(dev->mem_resource)); > free(dev); > - return 0; > } > + return 0; > } > + rte_eal_device_insert(&dev->device); > TAILQ_INSERT_TAIL(&pci_device_list, dev, next); > } > > I can't vouch for BSD as I don't have that environment to verify. But, the patch looks fine to me as compared to Linux changes. so, if my Ack makes sense: Acked-by: Shreyansh Jain