RDMA/iw_cxgb4: clean up c4iw_reject_cr()
Get rid of unneeded code, and refactor things a bit. For MPA version 0 we abort the connection. For > 0, we attempt to send an MPA_START/REJECT Reply, and then disconnect gracefully. If the send of the MPA message fails, then we abort the connection. We can ignore c4iw_ep_disconnect() errors here because it will clean up the endpoint if there are failures. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
68cebcab59
commit
bce2841f5a
|
|
@ -3037,9 +3037,9 @@ out:
|
||||||
|
|
||||||
int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
|
int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int abort;
|
||||||
int disconnect = 0;
|
|
||||||
struct c4iw_ep *ep = to_ep(cm_id);
|
struct c4iw_ep *ep = to_ep(cm_id);
|
||||||
|
|
||||||
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
|
||||||
|
|
||||||
mutex_lock(&ep->com.mutex);
|
mutex_lock(&ep->com.mutex);
|
||||||
|
|
@ -3050,16 +3050,13 @@ int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
|
||||||
}
|
}
|
||||||
set_bit(ULP_REJECT, &ep->com.history);
|
set_bit(ULP_REJECT, &ep->com.history);
|
||||||
if (mpa_rev == 0)
|
if (mpa_rev == 0)
|
||||||
disconnect = 2;
|
abort = 1;
|
||||||
else {
|
else
|
||||||
err = send_mpa_reject(ep, pdata, pdata_len);
|
abort = send_mpa_reject(ep, pdata, pdata_len);
|
||||||
disconnect = 1;
|
|
||||||
}
|
|
||||||
mutex_unlock(&ep->com.mutex);
|
mutex_unlock(&ep->com.mutex);
|
||||||
if (disconnect) {
|
|
||||||
stop_ep_timer(ep);
|
stop_ep_timer(ep);
|
||||||
err = c4iw_ep_disconnect(ep, disconnect == 2, GFP_KERNEL);
|
c4iw_ep_disconnect(ep, abort != 0, GFP_KERNEL);
|
||||||
}
|
|
||||||
c4iw_put_ep(&ep->com);
|
c4iw_put_ep(&ep->com);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue