diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2012-08-09 14:46:52 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2012-08-09 14:46:52 +0000 |
| commit | 2f70fca5ec36443dabec4ee0e5a8560bdd9f0066 (patch) | |
| tree | 9478ced7c05bbacea87efaedad30f80a7b235b51 /sys/dev | |
| parent | e5ecae38fc043a6afcf65d1568c9b22ef0e035a7 (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/netmap/netmap.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index ba86780c87f3e..05b369fad4fd8 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -356,13 +356,20 @@ netmap_dtor_locked(void *data) lim = na->tx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) netmap_free_buf(nifp, ring->slot[j].buf_idx); + /* knlist_destroy(&na->tx_rings[i].si.si_note); */ + mtx_destroy(&na->tx_rings[i].q_lock); } for (i = 0; i < na->num_rx_rings + 1; i++) { struct netmap_ring *ring = na->rx_rings[i].ring; lim = na->rx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) netmap_free_buf(nifp, ring->slot[j].buf_idx); + /* knlist_destroy(&na->rx_rings[i].si.si_note); */ + mtx_destroy(&na->rx_rings[i].q_lock); } + /* XXX kqueue(9) needed; these will mirror knlist_init. */ + /* knlist_destroy(&na->tx_si.si_note); */ + /* knlist_destroy(&na->rx_si.si_note); */ NMA_UNLOCK(); netmap_free_rings(na); wakeup(na); @@ -1318,13 +1325,14 @@ netmap_attach(struct netmap_adapter *na, int num_queues) ifp->if_capabilities |= IFCAP_NETMAP; na = buf; + /* Core lock initialized here. Others are initialized after + * netmap_if_new. + */ + mtx_init(&na->core_lock, "netmap core lock", MTX_NETWORK_LOCK, + MTX_DEF); if (na->nm_lock == NULL) { ND("using default locks for %s", ifp->if_xname); na->nm_lock = netmap_lock_wrapper; - /* core lock initialized here. - * others initialized after netmap_if_new - */ - mtx_init(&na->core_lock, "netmap core lock", MTX_NETWORK_LOCK, MTX_DEF); } } #ifdef linux @@ -1348,22 +1356,13 @@ netmap_attach(struct netmap_adapter *na, int num_queues) void netmap_detach(struct ifnet *ifp) { - u_int i; struct netmap_adapter *na = NA(ifp); if (!na) return; - for (i = 0; i < na->num_tx_rings + 1; i++) { - knlist_destroy(&na->tx_rings[i].si.si_note); - mtx_destroy(&na->tx_rings[i].q_lock); - } - for (i = 0; i < na->num_rx_rings + 1; i++) { - knlist_destroy(&na->rx_rings[i].si.si_note); - mtx_destroy(&na->rx_rings[i].q_lock); - } - knlist_destroy(&na->tx_si.si_note); - knlist_destroy(&na->rx_si.si_note); + mtx_destroy(&na->core_lock); + bzero(na, sizeof(*na)); WNA(ifp) = NULL; free(na, M_DEVBUF); |
