aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatyana Nikolova <Tatyana.E.Nikolova@intel.com>2014-03-11 15:17:25 -0400
committerRoland Dreier <roland@purestorage.com>2014-03-17 13:03:17 -0400
commit4ac79a70033cbb9b7fa2bb2f3770308359af8c12 (patch)
treebfa2f9023e5e270bd3143ad6067d8e1c40cb5ab7
parentcfbf8d4857c26a8a307fb7cd258074c9dcd8c691 (diff)
RDMA/nes: Fixes for IRD/ORD negotiation with MPA v2
Fixes to enable the negotiation of the supported IRD/ORD sizes with the peer when exchanging MPA v2 messages in connection establishment. Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c119
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.h3
2 files changed, 93 insertions, 29 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 9c9f2f57e960..e852a3a42b9e 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -128,6 +128,7 @@ static void build_mpa_v1(struct nes_cm_node *, void *, u8);
128static void build_rdma0_msg(struct nes_cm_node *, struct nes_qp **); 128static void build_rdma0_msg(struct nes_cm_node *, struct nes_qp **);
129 129
130static void print_core(struct nes_cm_core *core); 130static void print_core(struct nes_cm_core *core);
131static void record_ird_ord(struct nes_cm_node *, u16, u16);
131 132
132/* External CM API Interface */ 133/* External CM API Interface */
133/* instance of function pointers for client API */ 134/* instance of function pointers for client API */
@@ -317,7 +318,6 @@ static int parse_mpa(struct nes_cm_node *cm_node, u8 *buffer, u32 *type,
317 } 318 }
318 } 319 }
319 320
320
321 if (priv_data_len + mpa_hdr_len != len) { 321 if (priv_data_len + mpa_hdr_len != len) {
322 nes_debug(NES_DBG_CM, "The received ietf buffer was not right" 322 nes_debug(NES_DBG_CM, "The received ietf buffer was not right"
323 " complete (%x + %x != %x)\n", 323 " complete (%x + %x != %x)\n",
@@ -356,25 +356,57 @@ static int parse_mpa(struct nes_cm_node *cm_node, u8 *buffer, u32 *type,
356 /* send reset */ 356 /* send reset */
357 return -EINVAL; 357 return -EINVAL;
358 } 358 }
359 if (ird_size == IETF_NO_IRD_ORD || ord_size == IETF_NO_IRD_ORD)
360 cm_node->mpav2_ird_ord = IETF_NO_IRD_ORD;
359 361
360 if (cm_node->state != NES_CM_STATE_MPAREQ_SENT) { 362 if (cm_node->mpav2_ird_ord != IETF_NO_IRD_ORD) {
361 /* responder */ 363 /* responder */
362 if (cm_node->ord_size > ird_size) 364 if (cm_node->state != NES_CM_STATE_MPAREQ_SENT) {
363 cm_node->ord_size = ird_size; 365 /* we are still negotiating */
364 } else { 366 if (ord_size > NES_MAX_IRD) {
365 /* initiator */ 367 cm_node->ird_size = NES_MAX_IRD;
366 if (cm_node->ord_size > ird_size) 368 } else {
367 cm_node->ord_size = ird_size; 369 cm_node->ird_size = ord_size;
368 370 if (ord_size == 0 &&
369 if (cm_node->ird_size < ord_size) { 371 (rtr_ctrl_ord & IETF_RDMA0_READ)) {
370 /* no resources available */ 372 cm_node->ird_size = 1;
371 /* send terminate message */ 373 nes_debug(NES_DBG_CM,
372 return -EINVAL; 374 "%s: Remote peer doesn't support RDMA0_READ (ord=%u)\n",
375 __func__, ord_size);
376 }
377 }
378 if (ird_size > NES_MAX_ORD)
379 cm_node->ord_size = NES_MAX_ORD;
380 else
381 cm_node->ord_size = ird_size;
382 } else { /* initiator */
383 if (ord_size > NES_MAX_IRD) {
384 nes_debug(NES_DBG_CM,
385 "%s: Unable to support the requested (ord =%u)\n",
386 __func__, ord_size);
387 return -EINVAL;
388 }
389 cm_node->ird_size = ord_size;
390
391 if (ird_size > NES_MAX_ORD) {
392 cm_node->ord_size = NES_MAX_ORD;
393 } else {
394 if (ird_size == 0 &&
395 (rtr_ctrl_ord & IETF_RDMA0_READ)) {
396 nes_debug(NES_DBG_CM,
397 "%s: Remote peer doesn't support RDMA0_READ (ird=%u)\n",
398 __func__, ird_size);
399 return -EINVAL;
400 } else {
401 cm_node->ord_size = ird_size;
402 }
403 }
373 } 404 }
374 } 405 }
375 406
376 if (rtr_ctrl_ord & IETF_RDMA0_READ) { 407 if (rtr_ctrl_ord & IETF_RDMA0_READ) {
377 cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO; 408 cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO;
409
378 } else if (rtr_ctrl_ord & IETF_RDMA0_WRITE) { 410 } else if (rtr_ctrl_ord & IETF_RDMA0_WRITE) {
379 cm_node->send_rdma0_op = SEND_RDMA_WRITE_ZERO; 411 cm_node->send_rdma0_op = SEND_RDMA_WRITE_ZERO;
380 } else { /* Not supported RDMA0 operation */ 412 } else { /* Not supported RDMA0 operation */
@@ -514,6 +546,19 @@ static void print_core(struct nes_cm_core *core)
514 nes_debug(NES_DBG_CM, "-------------- end core ---------------\n"); 546 nes_debug(NES_DBG_CM, "-------------- end core ---------------\n");
515} 547}
516 548
549static void record_ird_ord(struct nes_cm_node *cm_node,
550 u16 conn_ird, u16 conn_ord)
551{
552 if (conn_ird > NES_MAX_IRD)
553 conn_ird = NES_MAX_IRD;
554
555 if (conn_ord > NES_MAX_ORD)
556 conn_ord = NES_MAX_ORD;
557
558 cm_node->ird_size = conn_ird;
559 cm_node->ord_size = conn_ord;
560}
561
517/** 562/**
518 * cm_build_mpa_frame - build a MPA V1 frame or MPA V2 frame 563 * cm_build_mpa_frame - build a MPA V1 frame or MPA V2 frame
519 */ 564 */
@@ -557,11 +602,13 @@ static void build_mpa_v2(struct nes_cm_node *cm_node,
557 mpa_frame->priv_data_len += htons(IETF_RTR_MSG_SIZE); 602 mpa_frame->priv_data_len += htons(IETF_RTR_MSG_SIZE);
558 603
559 /* initialize RTR msg */ 604 /* initialize RTR msg */
560 ctrl_ird = (cm_node->ird_size > IETF_NO_IRD_ORD) ? 605 if (cm_node->mpav2_ird_ord == IETF_NO_IRD_ORD) {
561 IETF_NO_IRD_ORD : cm_node->ird_size; 606 ctrl_ird = IETF_NO_IRD_ORD;
562 ctrl_ord = (cm_node->ord_size > IETF_NO_IRD_ORD) ? 607 ctrl_ord = IETF_NO_IRD_ORD;
563 IETF_NO_IRD_ORD : cm_node->ord_size; 608 } else {
564 609 ctrl_ird = cm_node->ird_size & IETF_NO_IRD_ORD;
610 ctrl_ord = cm_node->ord_size & IETF_NO_IRD_ORD;
611 }
565 ctrl_ird |= IETF_PEER_TO_PEER; 612 ctrl_ird |= IETF_PEER_TO_PEER;
566 ctrl_ird |= IETF_FLPDU_ZERO_LEN; 613 ctrl_ird |= IETF_FLPDU_ZERO_LEN;
567 614
@@ -1409,8 +1456,9 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
1409 1456
1410 cm_node->mpa_frame_rev = mpa_version; 1457 cm_node->mpa_frame_rev = mpa_version;
1411 cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO; 1458 cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO;
1412 cm_node->ird_size = IETF_NO_IRD_ORD; 1459 cm_node->mpav2_ird_ord = 0;
1413 cm_node->ord_size = IETF_NO_IRD_ORD; 1460 cm_node->ird_size = 0;
1461 cm_node->ord_size = 0;
1414 1462
1415 nes_debug(NES_DBG_CM, "Make node addresses : loc = %pI4:%x, rem = %pI4:%x\n", 1463 nes_debug(NES_DBG_CM, "Make node addresses : loc = %pI4:%x, rem = %pI4:%x\n",
1416 &cm_node->loc_addr, cm_node->loc_port, 1464 &cm_node->loc_addr, cm_node->loc_port,
@@ -3027,11 +3075,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
3027 rem_ref_cm_node(cm_node->cm_core, cm_node); 3075 rem_ref_cm_node(cm_node->cm_core, cm_node);
3028 return -ECONNRESET; 3076 return -ECONNRESET;
3029 } 3077 }
3030
3031 /* associate the node with the QP */ 3078 /* associate the node with the QP */
3032 nesqp->cm_node = (void *)cm_node; 3079 nesqp->cm_node = (void *)cm_node;
3033 cm_node->nesqp = nesqp; 3080 cm_node->nesqp = nesqp;
3034 3081
3082
3035 nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n", 3083 nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n",
3036 nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener); 3084 nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener);
3037 atomic_inc(&cm_accepts); 3085 atomic_inc(&cm_accepts);
@@ -3054,6 +3102,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
3054 if (cm_node->mpa_frame_rev == IETF_MPA_V1) 3102 if (cm_node->mpa_frame_rev == IETF_MPA_V1)
3055 mpa_frame_offset = 4; 3103 mpa_frame_offset = 4;
3056 3104
3105 if (cm_node->mpa_frame_rev == IETF_MPA_V1 ||
3106 cm_node->mpav2_ird_ord == IETF_NO_IRD_ORD) {
3107 record_ird_ord(cm_node, (u16)conn_param->ird, (u16)conn_param->ord);
3108 }