diff options
| author | Kristof Provost <kp@FreeBSD.org> | 2016-05-14 06:07:15 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2016-05-14 06:07:15 +0000 |
| commit | 3fcb1aaef1a55302712175d189dc0b52901d60fe (patch) | |
| tree | 18581c99d7ebd3cb40ba0c1107cd3202e3ad72e6 /sys/dev/virtio | |
| parent | 8a53d16bd7e6c38226c5a08a46459bb86c3d5bef (diff) | |
Notes
Diffstat (limited to 'sys/dev/virtio')
| -rw-r--r-- | sys/dev/virtio/network/if_vtnet.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index d9874af9a36a..6b89b869242e 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -311,21 +311,22 @@ MODULE_DEPEND(vtnet, netmap, 1, 1, 1); static int vtnet_modevent(module_t mod, int type, void *unused) { - int error; - - error = 0; + int error = 0; + static int loaded = 0; switch (type) { case MOD_LOAD: - vtnet_tx_header_zone = uma_zcreate("vtnet_tx_hdr", - sizeof(struct vtnet_tx_header), - NULL, NULL, NULL, NULL, 0, 0); + if (loaded++ == 0) + vtnet_tx_header_zone = uma_zcreate("vtnet_tx_hdr", + sizeof(struct vtnet_tx_header), + NULL, NULL, NULL, NULL, 0, 0); break; case MOD_QUIESCE: - case MOD_UNLOAD: if (uma_zone_get_cur(vtnet_tx_header_zone) > 0) error = EBUSY; - else if (type == MOD_UNLOAD) { + break; + case MOD_UNLOAD: + if (--loaded == 0) { uma_zdestroy(vtnet_tx_header_zone); vtnet_tx_header_zone = NULL; } |
