From: Ben Walker <benjamin.walker@intel.com>
To: dev@dpdk.org
Cc: Ben Walker <benjamin.walker@intel.com>
Subject: [dpdk-dev] [PATCH] eal: Fix device registration on FreeBSD
Date: Tue, 21 Mar 2017 11:32:15 -0700 [thread overview]
Message-ID: <20170321183215.8357-1-benjamin.walker@intel.com> (raw)
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 <benjamin.walker@intel.com>
---
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
next reply other threads:[~2017-03-21 18:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-21 18:32 Ben Walker [this message]
2017-03-27 6:04 ` Shreyansh Jain
2017-03-27 10:01 ` Thomas Monjalon
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=20170321183215.8357-1-benjamin.walker@intel.com \
--to=benjamin.walker@intel.com \
--cc=dev@dpdk.org \
/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).