xen-netfront: release grant references used for the shared rings

Just calling gnttab_end_foreign_access_ref doesn't free the references,
instead call gnttab_end_foreign_access with a NULL page argument in order to
have the grant references freed. The code that maps the ring
(xenbus_map_ring) already uses gnttab_grant_foreign_access which takes care
of allocating a grant reference.

Reviewed by:		Wei Liu <wei.liu2@citrix.com>
Sponsored by:		Citrix Systems R&D
Differential revision:	https://reviews.freebsd.org/D6608
This commit is contained in:
Roger Pau Monné 2016-06-02 11:19:16 +00:00
parent c21b47d8c9
commit d039b0700b

View File

@ -663,7 +663,7 @@ disconnect_rxq(struct netfront_rxq *rxq)
xn_release_rx_bufs(rxq);
gnttab_free_grant_references(rxq->gref_head);
gnttab_end_foreign_access_ref(rxq->ring_ref);
gnttab_end_foreign_access(rxq->ring_ref, NULL);
/*
* No split event channel support at the moment, handle will
* be unbound in tx. So no need to call xen_intr_unbind here,
@ -765,7 +765,7 @@ disconnect_txq(struct netfront_txq *txq)
xn_release_tx_bufs(txq);
gnttab_free_grant_references(txq->gref_head);
gnttab_end_foreign_access_ref(txq->ring_ref);
gnttab_end_foreign_access(txq->ring_ref, NULL);
xen_intr_unbind(&txq->xen_intr_handle);
}
@ -877,7 +877,7 @@ setup_txqs(device_t dev, struct netfront_info *info,
fail_start_thread:
buf_ring_free(txq->br, M_DEVBUF);
taskqueue_free(txq->tq);
gnttab_end_foreign_access_ref(txq->ring_ref);
gnttab_end_foreign_access(txq->ring_ref, NULL);
fail_grant_ring:
gnttab_free_grant_references(txq->gref_head);
free(txq->ring.sring, M_DEVBUF);