Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hariprasad S and committed by
Doug Ledford
bce2841f 68cebcab

+8 -11
+8 -11
drivers/infiniband/hw/cxgb4/cm.c
··· 3037 3037 3038 3038 int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len) 3039 3039 { 3040 - int err = 0; 3041 - int disconnect = 0; 3040 + int abort; 3042 3041 struct c4iw_ep *ep = to_ep(cm_id); 3042 + 3043 3043 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); 3044 3044 3045 3045 mutex_lock(&ep->com.mutex); ··· 3050 3050 } 3051 3051 set_bit(ULP_REJECT, &ep->com.history); 3052 3052 if (mpa_rev == 0) 3053 - disconnect = 2; 3054 - else { 3055 - err = send_mpa_reject(ep, pdata, pdata_len); 3056 - disconnect = 1; 3057 - } 3053 + abort = 1; 3054 + else 3055 + abort = send_mpa_reject(ep, pdata, pdata_len); 3058 3056 mutex_unlock(&ep->com.mutex); 3059 - if (disconnect) { 3060 - stop_ep_timer(ep); 3061 - err = c4iw_ep_disconnect(ep, disconnect == 2, GFP_KERNEL); 3062 - } 3057 + 3058 + stop_ep_timer(ep); 3059 + c4iw_ep_disconnect(ep, abort != 0, GFP_KERNEL); 3063 3060 c4iw_put_ep(&ep->com); 3064 3061 return 0; 3065 3062 }