/* This function frees a queue structure and the DMAable memeory used for the host resident queue. This function must be called after destroying the queue on the HBA.  */
void lpfc_sli4_queue_free(struct lpfc_queue *queue)
/* This function frees a queue structure and the DMAable memeory used for the host resident queue. This function must be called after destroying the queue on the HBA.  */
void lpfc_sli4_queue_free(struct lpfc_queue *queue)
{
	struct lpfc_dmabuf *dmabuf;
	if (!queue)
		return;
	while (!list_empty(&queue->page_list)) {
		list_remove_head(&queue->page_list, dmabuf, struct lpfc_dmabuf,
				 list);
		dma_free_coherent(&queue->phba->pcidev->dev, PAGE_SIZE,
				  dmabuf->virt, dmabuf->phys);
		kfree(dmabuf);
	}
	kfree(queue);
	return;
}