Page MenuHomeFreeBSD

D54655.diff
No OneTemporary

D54655.diff

diff --git a/lib/libbhyve/pci.c b/lib/libbhyve/pci.c
--- a/lib/libbhyve/pci.c
+++ b/lib/libbhyve/pci.c
@@ -129,3 +129,10 @@
/*
* Per-device file initialization routines.
*/
+static struct devinfo e1000_info = {
+ .name = "e1000",
+ .init_fds = netbe_init_fds,
+ .legacy_config = netbe_legacy_config,
+ .validate_hotplug_request = netbe_validate_hotplug_request
+};
+DATA_SET(pci_devinfo, e1000_info);
diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8
--- a/usr.sbin/bhyve/bhyve.8
+++ b/usr.sbin/bhyve/bhyve.8
@@ -516,6 +516,8 @@
Certain emulated devices may be added to a running virtual machine.
The following emulated devices are hotpluggable:
.Bl -bullet
+.It
+e1000
.El
.Ss Network device backends
.Sm off
diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c
--- a/usr.sbin/bhyve/pci_e82545.c
+++ b/usr.sbin/bhyve/pci_e82545.c
@@ -2351,6 +2351,8 @@
if (mac != NULL) {
err = net_parsemac(mac, sc->esc_mac.octet);
if (err) {
+ nvlist_add_string(nvl, "error",
+ "failed to parse MAC address");
free(sc);
return (err);
}
@@ -2371,6 +2373,31 @@
return (0);
}
+static int
+e82545_teardown(struct pci_devinst *pi)
+{
+ struct e82545_softc *sc;
+
+ sc = pi->pi_arg;
+
+ pthread_mutex_lock(&sc->esc_mtx);
+ netbe_rx_disable(sc->esc_be);
+ if (sc->esc_mevpitr != NULL)
+ mevent_delete(sc->esc_mevpitr);
+ pthread_mutex_unlock(&sc->esc_mtx);
+
+ pthread_cancel(sc->esc_tx_tid);
+ pthread_join(sc->esc_tx_tid, NULL);
+ pthread_cond_destroy(&sc->esc_rx_cond);
+ pthread_cond_destroy(&sc->esc_tx_cond);
+ pthread_mutex_destroy(&sc->esc_mtx);
+
+ netbe_cleanup(sc->esc_be);
+ free(sc);
+
+ return (0);
+}
+
#ifdef BHYVE_SNAPSHOT
static int
e82545_snapshot(struct vm_snapshot_meta *meta)
@@ -2528,6 +2555,7 @@
static const struct pci_devemu pci_de_e82545 = {
.pe_emu = "e1000",
.pe_init = e82545_init,
+ .pe_teardown = e82545_teardown,
.pe_legacy_config = netbe_legacy_config,
.pe_barwrite = e82545_write,
.pe_barread = e82545_read,

File Metadata

Mime Type
text/plain
Expires
Mon, Jun 8, 6:15 PM (7 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33816617
Default Alt Text
D54655.diff (1 KB)

Event Timeline