Commit 4621ceb2 authored by Mintz, Yuval's avatar Mintz, Yuval Committed by David S. Miller

qed: Free previous connections when releasing iSCSI

Fixes: fc831825 ("qed: Add support for hardware offloaded iSCSI")
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 752ecb2d
...@@ -786,6 +786,23 @@ static void qed_iscsi_release_connection(struct qed_hwfn *p_hwfn, ...@@ -786,6 +786,23 @@ static void qed_iscsi_release_connection(struct qed_hwfn *p_hwfn,
spin_unlock_bh(&p_hwfn->p_iscsi_info->lock); spin_unlock_bh(&p_hwfn->p_iscsi_info->lock);
} }
void qed_iscsi_free_connection(struct qed_hwfn *p_hwfn,
struct qed_iscsi_conn *p_conn)
{
qed_chain_free(p_hwfn->cdev, &p_conn->xhq);
qed_chain_free(p_hwfn->cdev, &p_conn->uhq);
qed_chain_free(p_hwfn->cdev, &p_conn->r2tq);
dma_free_coherent(&p_hwfn->cdev->pdev->dev,
sizeof(struct tcp_upload_params),
p_conn->tcp_upload_params_virt_addr,
p_conn->tcp_upload_params_phys_addr);
dma_free_coherent(&p_hwfn->cdev->pdev->dev,
sizeof(struct scsi_terminate_extra_params),
p_conn->queue_cnts_virt_addr,
p_conn->queue_cnts_phys_addr);
kfree(p_conn);
}
struct qed_iscsi_info *qed_iscsi_alloc(struct qed_hwfn *p_hwfn) struct qed_iscsi_info *qed_iscsi_alloc(struct qed_hwfn *p_hwfn)
{ {
struct qed_iscsi_info *p_iscsi_info; struct qed_iscsi_info *p_iscsi_info;
...@@ -807,6 +824,17 @@ void qed_iscsi_setup(struct qed_hwfn *p_hwfn, ...@@ -807,6 +824,17 @@ void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
void qed_iscsi_free(struct qed_hwfn *p_hwfn, void qed_iscsi_free(struct qed_hwfn *p_hwfn,
struct qed_iscsi_info *p_iscsi_info) struct qed_iscsi_info *p_iscsi_info)
{ {
struct qed_iscsi_conn *p_conn = NULL;
while (!list_empty(&p_hwfn->p_iscsi_info->free_list)) {
p_conn = list_first_entry(&p_hwfn->p_iscsi_info->free_list,
struct qed_iscsi_conn, list_entry);
if (p_conn) {
list_del(&p_conn->list_entry);
qed_iscsi_free_connection(p_hwfn, p_conn);
}
}
kfree(p_iscsi_info); kfree(p_iscsi_info);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment