diff options
author | Hariprasad S <hariprasad@chelsio.com> | 2016-05-04 15:57:34 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-05-05 16:11:14 -0400 |
commit | eaf4c6d46a6948302b64be2b7149cce22131ee0d (patch) | |
tree | 8e0b0d1905303c07fe2c5702707a84096ca69e8b | |
parent | fef4422d00c135da4300d7d58e62cd0afe2af730 (diff) |
RDMA/iw_cxgb4: remove abort_connection() usage from accept/reject
Use c4iw_ep_disconnect() instead. This is part of getting rid of
abort_connection() altogether so we properly clean up on send_abort()
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>
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 864da9dec9f6..d862369b5dd7 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -2922,14 +2922,14 @@ int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len) | |||
2922 | set_bit(ULP_REJECT, &ep->com.history); | 2922 | set_bit(ULP_REJECT, &ep->com.history); |
2923 | BUG_ON(ep->com.state != MPA_REQ_RCVD); | 2923 | BUG_ON(ep->com.state != MPA_REQ_RCVD); |
2924 | if (mpa_rev == 0) | 2924 | if (mpa_rev == 0) |
2925 | abort_connection(ep, NULL, GFP_KERNEL); | 2925 | disconnect = 2; |
2926 | else { | 2926 | else { |
2927 | err = send_mpa_reject(ep, pdata, pdata_len); | 2927 | err = send_mpa_reject(ep, pdata, pdata_len); |
2928 | disconnect = 1; | 2928 | disconnect = 1; |
2929 | } | 2929 | } |
2930 | mutex_unlock(&ep->com.mutex); | 2930 | mutex_unlock(&ep->com.mutex); |
2931 | if (disconnect) | 2931 | if (disconnect) |
2932 | err = c4iw_ep_disconnect(ep, 0, GFP_KERNEL); | 2932 | err = c4iw_ep_disconnect(ep, disconnect == 2, GFP_KERNEL); |
2933 | c4iw_put_ep(&ep->com); | 2933 | c4iw_put_ep(&ep->com); |
2934 | return 0; | 2934 | return 0; |
2935 | } | 2935 | } |
@@ -2942,13 +2942,14 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2942 | struct c4iw_ep *ep = to_ep(cm_id); | 2942 | struct c4iw_ep *ep = to_ep(cm_id); |
2943 | struct c4iw_dev *h = to_c4iw_dev(cm_id->device); | 2943 | struct c4iw_dev *h = to_c4iw_dev(cm_id->device); |
2944 | struct c4iw_qp *qp = get_qhp(h, conn_param->qpn); | 2944 | struct c4iw_qp *qp = get_qhp(h, conn_param->qpn); |
2945 | int abort = 0; | ||
2945 | 2946 | ||
2946 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | 2947 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); |
2947 | 2948 | ||
2948 | mutex_lock(&ep->com.mutex); | 2949 | mutex_lock(&ep->com.mutex); |
2949 | if (ep->com.state == DEAD) { | 2950 | if (ep->com.state == DEAD) { |
2950 | err = -ECONNRESET; | 2951 | err = -ECONNRESET; |
2951 | goto err; | 2952 | goto err_out; |
2952 | } | 2953 | } |
2953 | 2954 | ||
2954 | BUG_ON(ep->com.state != MPA_REQ_RCVD); | 2955 | BUG_ON(ep->com.state != MPA_REQ_RCVD); |
@@ -2957,9 +2958,8 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2957 | set_bit(ULP_ACCEPT, &ep->com.history); | 2958 | set_bit(ULP_ACCEPT, &ep->com.history); |
2958 | if ((conn_param->ord > cur_max_read_depth(ep->com.dev)) || | 2959 | if ((conn_param->ord > cur_max_read_depth(ep->com.dev)) || |
2959 | (conn_param->ird > cur_max_read_depth(ep->com.dev))) { | 2960 | (conn_param->ird > cur_max_read_depth(ep->com.dev))) { |
2960 | abort_connection(ep, NULL, GFP_KERNEL); | ||
2961 | err = -EINVAL; | 2961 | err = -EINVAL; |
2962 | goto err; | 2962 | goto err_abort; |
2963 | } | 2963 | } |
2964 | 2964 | ||
2965 | if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { | 2965 | if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { |
@@ -2971,9 +2971,8 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2971 | ep->ord = conn_param->ord; | 2971 | ep->ord = conn_param->ord; |
2972 | send_mpa_reject(ep, conn_param->private_data, | 2972 | send_mpa_reject(ep, conn_param->private_data, |
2973 | conn_param->private_data_len); | 2973 | conn_param->private_data_len); |
2974 | abort_connection(ep, NULL, GFP_KERNEL); | ||
2975 | err = -ENOMEM; | 2974 | err = -ENOMEM; |
2976 | goto err; | 2975 | goto err_abort; |
2977 | } | 2976 | } |
2978 | } | 2977 | } |
2979 | if (conn_param->ird < ep->ord) { | 2978 | if (conn_param->ird < ep->ord) { |
@@ -2981,9 +2980,8 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2981 | ep->ord <= h->rdev.lldi.max_ordird_qp) { | 2980 | ep->ord <= h->rdev.lldi.max_ordird_qp) { |
2982 | conn_param->ird = ep->ord; | 2981 | conn_param->ird = ep->ord; |
2983 | } else { | 2982 | } else { |
2984 | abort_connection(ep, NULL, GFP_KERNEL); | ||
2985 | err = -ENOMEM; | 2983 | err = -ENOMEM; |
2986 | goto err; | 2984 | goto err_abort; |
2987 | } | 2985 | } |
2988 | } | 2986 | } |
2989 | } | 2987 | } |
@@ -3024,23 +3022,26 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
3024 | err = c4iw_modify_qp(ep->com.qp->rhp, | 3022 | err = c4iw_modify_qp(ep->com.qp->rhp, |
3025 | ep->com.qp, mask, &attrs, 1); | 3023 | ep->com.qp, mask, &attrs, 1); |
3026 | if (err) | 3024 | if (err) |
3027 | goto err1; | 3025 | goto err_deref_cm_id; |
3028 | err = send_mpa_reply(ep, conn_param->private_data, | 3026 | err = send_mpa_reply(ep, conn_param->private_data, |
3029 | conn_param->private_data_len); | 3027 | conn_param->private_data_len); |
3030 | if (err) | 3028 | if (err) |
3031 | goto err1; | 3029 | goto err_deref_cm_id; |
3032 | 3030 | ||
3033 | __state_set(&ep->com, FPDU_MODE); | 3031 | __state_set(&ep->com, FPDU_MODE); |
3034 | established_upcall(ep); | 3032 | established_upcall(ep); |
3035 | mutex_unlock(&ep->com.mutex); | 3033 | mutex_unlock(&ep->com.mutex); |
3036 | c4iw_put_ep(&ep->com); | 3034 | c4iw_put_ep(&ep->com); |
3037 | return 0; | 3035 | return 0; |
3038 | err1: | 3036 | err_deref_cm_id: |
3039 | ep->com.cm_id = NULL; | 3037 | ep->com.cm_id = NULL; |
3040 | abort_connection(ep, NULL, GFP_KERNEL); | ||
3041 | cm_id->rem_ref(cm_id); | 3038 | cm_id->rem_ref(cm_id); |
3042 | err: | 3039 | err_abort: |
3040 | abort = 1; | ||
3041 | err_out: | ||
3043 | mutex_unlock(&ep->com.mutex); | 3042 | mutex_unlock(&ep->com.mutex); |
3043 | if (abort) | ||
3044 | c4iw_ep_disconnect(ep, 1, GFP_KERNEL); | ||
3044 | c4iw_put_ep(&ep->com); | 3045 | c4iw_put_ep(&ep->com); |
3045 | return err; | 3046 | return err; |
3046 | } | 3047 | } |