提交 b3437e0d 编写于 作者: I Ismail, Mustafa 提交者: Doug Ledford

RDMA/i40iw: Fix refused connections

Make sure cm_node is setup before sending SYN packet and
ORD/IRD negotiation.
Signed-off-by: NMustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 23ef48ad
...@@ -2852,7 +2852,6 @@ static struct i40iw_cm_node *i40iw_create_cm_node( ...@@ -2852,7 +2852,6 @@ static struct i40iw_cm_node *i40iw_create_cm_node(
void *private_data, void *private_data,
struct i40iw_cm_info *cm_info) struct i40iw_cm_info *cm_info)
{ {
int ret;
struct i40iw_cm_node *cm_node; struct i40iw_cm_node *cm_node;
struct i40iw_cm_listener *loopback_remotelistener; struct i40iw_cm_listener *loopback_remotelistener;
struct i40iw_cm_node *loopback_remotenode; struct i40iw_cm_node *loopback_remotenode;
...@@ -2922,29 +2921,6 @@ static struct i40iw_cm_node *i40iw_create_cm_node( ...@@ -2922,29 +2921,6 @@ static struct i40iw_cm_node *i40iw_create_cm_node(
memcpy(cm_node->pdata_buf, private_data, private_data_len); memcpy(cm_node->pdata_buf, private_data, private_data_len);
cm_node->state = I40IW_CM_STATE_SYN_SENT; cm_node->state = I40IW_CM_STATE_SYN_SENT;
ret = i40iw_send_syn(cm_node, 0);
if (ret) {
if (cm_node->ipv4)
i40iw_debug(cm_node->dev,
I40IW_DEBUG_CM,
"Api - connect() FAILED: dest addr=%pI4",
cm_node->rem_addr);
else
i40iw_debug(cm_node->dev, I40IW_DEBUG_CM,
"Api - connect() FAILED: dest addr=%pI6",
cm_node->rem_addr);
i40iw_rem_ref_cm_node(cm_node);
cm_node = NULL;
}
if (cm_node)
i40iw_debug(cm_node->dev,
I40IW_DEBUG_CM,
"Api - connect(): port=0x%04x, cm_node=%p, cm_id = %p.\n",
cm_node->rem_port,
cm_node,
cm_node->cm_id);
return cm_node; return cm_node;
} }
...@@ -3828,7 +3804,48 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -3828,7 +3804,48 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
conn_param->private_data_len, conn_param->private_data_len,
(void *)conn_param->private_data, (void *)conn_param->private_data,
&cm_info); &cm_info);
if (!cm_node) { if (!cm_node)
goto err;
i40iw_record_ird_ord(cm_node, (u16)conn_param->ird, (u16)conn_param->ord);
if (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO &&
!cm_node->ord_size)
cm_node->ord_size = 1;
cm_node->apbvt_set = apbvt_set;
cm_node->qhash_set = true;
iwqp->cm_node = cm_node;
cm_node->iwqp = iwqp;
iwqp->cm_id = cm_id;
i40iw_add_ref(&iwqp->ibqp);
if (cm_node->state == I40IW_CM_STATE_SYN_SENT) {
if (i40iw_send_syn(cm_node, 0)) {
i40iw_rem_ref_cm_node(cm_node);
goto err;
}
}
i40iw_debug(cm_node->dev,
I40IW_DEBUG_CM,
"Api - connect(): port=0x%04x, cm_node=%p, cm_id = %p.\n",
cm_node->rem_port,
cm_node,
cm_node->cm_id);
return 0;
err:
if (cm_node) {
if (cm_node->ipv4)
i40iw_debug(cm_node->dev,
I40IW_DEBUG_CM,
"Api - connect() FAILED: dest addr=%pI4",
cm_node->rem_addr);
else
i40iw_debug(cm_node->dev, I40IW_DEBUG_CM,
"Api - connect() FAILED: dest addr=%pI6",
cm_node->rem_addr);
}
i40iw_manage_qhash(iwdev, i40iw_manage_qhash(iwdev,
&cm_info, &cm_info,
I40IW_QHASH_TYPE_TCP_ESTABLISHED, I40IW_QHASH_TYPE_TCP_ESTABLISHED,
...@@ -3844,20 +3861,6 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -3844,20 +3861,6 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
cm_id->rem_ref(cm_id); cm_id->rem_ref(cm_id);
iwdev->cm_core.stats_connect_errs++; iwdev->cm_core.stats_connect_errs++;
return -ENOMEM; return -ENOMEM;
}
i40iw_record_ird_ord(cm_node, (u16)conn_param->ird, (u16)conn_param->ord);
if (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO &&
!cm_node->ord_size)
cm_node->ord_size = 1;
cm_node->apbvt_set = apbvt_set;
cm_node->qhash_set = true;
iwqp->cm_node = cm_node;
cm_node->iwqp = iwqp;
iwqp->cm_id = cm_id;
i40iw_add_ref(&iwqp->ibqp);
return 0;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册