From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D2DFF1075 for ; Tue, 21 Mar 2017 19:32:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490121155; x=1521657155; h=from:to:cc:subject:date:message-id; bh=qpb1aQ+2irrSmr8ccaNGD4a4wL5ijHCl3KcrSqyw8+M=; b=OUZVAM2WGqUxJfXGqTmiXCvaap7XV+ObjVbyQISQ3jpHcY69jcOodjaV osYOpJpSAf7jEyrMGVqbZDVrO1ytTA==; Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2017 11:32:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,200,1486454400"; d="scan'208";a="79073459" Received: from bwalker-desk.ch.intel.com ([143.182.136.68]) by fmsmga005.fm.intel.com with ESMTP; 21 Mar 2017 11:32:19 -0700 From: Ben Walker To: dev@dpdk.org Cc: Ben Walker Date: Tue, 21 Mar 2017 11:32:15 -0700 Message-Id: <20170321183215.8357-1-benjamin.walker@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [dpdk-dev] [PATCH] eal: Fix device registration on FreeBSD X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Mar 2017 18:32:35 -0000 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); } -- 2.9.3