mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 13:18:00 +07:00
qed: iWARP - Use READ_ONCE and smp_store_release to access ep->state
Destroy QP waits for it's ep object state to be set to CLOSED
before proceeding. ep->state can be updated from a different
context. Add smp_store_release/READ_ONCE to synchronize.
Fixes: fc4c6065e6
("qed: iWARP implement disconnect flows")
Signed-off-by: Ariel Elior <ariel.elior@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1086ca3a63
commit
6117561e1b
@ -532,7 +532,8 @@ int qed_iwarp_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp)
|
||||
|
||||
/* Make sure ep is closed before returning and freeing memory. */
|
||||
if (ep) {
|
||||
while (ep->state != QED_IWARP_EP_CLOSED && wait_count++ < 200)
|
||||
while (READ_ONCE(ep->state) != QED_IWARP_EP_CLOSED &&
|
||||
wait_count++ < 200)
|
||||
msleep(100);
|
||||
|
||||
if (ep->state != QED_IWARP_EP_CLOSED)
|
||||
@ -1022,8 +1023,6 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn,
|
||||
|
||||
params.ep_context = ep;
|
||||
|
||||
ep->state = QED_IWARP_EP_CLOSED;
|
||||
|
||||
switch (fw_return_code) {
|
||||
case RDMA_RETURN_OK:
|
||||
ep->qp->max_rd_atomic_req = ep->cm_info.ord;
|
||||
@ -1083,6 +1082,10 @@ qed_iwarp_mpa_complete(struct qed_hwfn *p_hwfn,
|
||||
break;
|
||||
}
|
||||
|
||||
if (fw_return_code != RDMA_RETURN_OK)
|
||||
/* paired with READ_ONCE in destroy_qp */
|
||||
smp_store_release(&ep->state, QED_IWARP_EP_CLOSED);
|
||||
|
||||
ep->event_cb(ep->cb_context, ¶ms);
|
||||
|
||||
/* on passive side, if there is no associated QP (REJECT) we need to
|
||||
@ -2825,7 +2828,9 @@ static void qed_iwarp_qp_in_error(struct qed_hwfn *p_hwfn,
|
||||
params.status = (fw_return_code == IWARP_QP_IN_ERROR_GOOD_CLOSE) ?
|
||||
0 : -ECONNRESET;
|
||||
|
||||
ep->state = QED_IWARP_EP_CLOSED;
|
||||
/* paired with READ_ONCE in destroy_qp */
|
||||
smp_store_release(&ep->state, QED_IWARP_EP_CLOSED);
|
||||
|
||||
spin_lock_bh(&p_hwfn->p_rdma_info->iwarp.iw_lock);
|
||||
list_del(&ep->list_entry);
|
||||
spin_unlock_bh(&p_hwfn->p_rdma_info->iwarp.iw_lock);
|
||||
@ -2914,7 +2919,8 @@ qed_iwarp_tcp_connect_unsuccessful(struct qed_hwfn *p_hwfn,
|
||||
params.event = QED_IWARP_EVENT_ACTIVE_COMPLETE;
|
||||
params.ep_context = ep;
|
||||
params.cm_info = &ep->cm_info;
|
||||
ep->state = QED_IWARP_EP_CLOSED;
|
||||
/* paired with READ_ONCE in destroy_qp */
|
||||
smp_store_release(&ep->state, QED_IWARP_EP_CLOSED);
|
||||
|
||||
switch (fw_return_code) {
|
||||
case IWARP_CONN_ERROR_TCP_CONNECT_INVALID_PACKET:
|
||||
|
Loading…
Reference in New Issue
Block a user