aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb3/iwch_qp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/cxgb3/iwch_qp.c')
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_qp.c69
1 files changed, 38 insertions, 31 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c
index 0a472c9b44db..714dddbc9a98 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_qp.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c
@@ -471,43 +471,62 @@ int iwch_bind_mw(struct ib_qp *qp,
471 return err; 471 return err;
472} 472}
473 473
474static void build_term_codes(int t3err, u8 *layer_type, u8 *ecode, int tagged) 474static inline void build_term_codes(struct respQ_msg_t *rsp_msg,
475 u8 *layer_type, u8 *ecode)
475{ 476{
476 switch (t3err) { 477 int status = TPT_ERR_INTERNAL_ERR;
478 int tagged = 0;
479 int opcode = -1;
480 int rqtype = 0;
481 int send_inv = 0;
482
483 if (rsp_msg) {
484 status = CQE_STATUS(rsp_msg->cqe);
485 opcode = CQE_OPCODE(rsp_msg->cqe);
486 rqtype = RQ_TYPE(rsp_msg->cqe);
487 send_inv = (opcode == T3_SEND_WITH_INV) ||
488 (opcode == T3_SEND_WITH_SE_INV);
489 tagged = (opcode == T3_RDMA_WRITE) ||
490 (rqtype && (opcode == T3_READ_RESP));
491 }
492
493 switch (status) {
477 case TPT_ERR_STAG: 494 case TPT_ERR_STAG:
478 if (tagged == 1) { 495 if (send_inv) {
479 *layer_type = LAYER_DDP|DDP_TAGGED_ERR; 496 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_OP;
480 *ecode = DDPT_INV_STAG; 497 *ecode = RDMAP_CANT_INV_STAG;
481 } else if (tagged == 2) { 498 } else {
482 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT; 499 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
483 *ecode = RDMAP_INV_STAG; 500 *ecode = RDMAP_INV_STAG;
484 } 501 }
485 break; 502 break;
486 case TPT_ERR_PDID: 503 case TPT_ERR_PDID:
504 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
505 if ((opcode == T3_SEND_WITH_INV) ||
506 (opcode == T3_SEND_WITH_SE_INV))
507 *ecode = RDMAP_CANT_INV_STAG;
508 else
509 *ecode = RDMAP_STAG_NOT_ASSOC;
510 break;
487 case TPT_ERR_QPID: 511 case TPT_ERR_QPID:
512 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
513 *ecode = RDMAP_STAG_NOT_ASSOC;
514 break;
488 case TPT_ERR_ACCESS: 515 case TPT_ERR_ACCESS:
489 if (tagged == 1) { 516 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
490 *layer_type = LAYER_DDP|DDP_TAGGED_ERR; 517 *ecode = RDMAP_ACC_VIOL;
491 *ecode = DDPT_STAG_NOT_ASSOC;
492 } else if (tagged == 2) {
493 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
494 *ecode = RDMAP_STAG_NOT_ASSOC;
495 }
496 break; 518 break;
497 case TPT_ERR_WRAP: 519 case TPT_ERR_WRAP:
498 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT; 520 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
499 *ecode = RDMAP_TO_WRAP; 521 *ecode = RDMAP_TO_WRAP;
500 break; 522 break;
501 case TPT_ERR_BOUND: 523 case TPT_ERR_BOUND:
502 if (tagged == 1) { 524 if (tagged) {
503 *layer_type = LAYER_DDP|DDP_TAGGED_ERR; 525 *layer_type = LAYER_DDP|DDP_TAGGED_ERR;
504 *ecode = DDPT_BASE_BOUNDS; 526 *ecode = DDPT_BASE_BOUNDS;
505 } else if (tagged == 2) { 527 } else {
506 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT; 528 *layer_type = LAYER_RDMAP|RDMAP_REMOTE_PROT;
507 *ecode = RDMAP_BASE_BOUNDS; 529 *ecode = RDMAP_BASE_BOUNDS;
508 } else {
509 *layer_type = LAYER_DDP|DDP_UNTAGGED_ERR;
510 *ecode = DDPU_MSG_TOOBIG;
511 } 530 }
512 break; 531 break;
513 case TPT_ERR_INVALIDATE_SHARED_MR: 532 case TPT_ERR_INVALIDATE_SHARED_MR:
@@ -591,8 +610,6 @@ int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg)
591{ 610{
592 union t3_wr *wqe; 611 union t3_wr *wqe;
593 struct terminate_message *term; 612 struct terminate_message *term;
594 int status;
595 int tagged = 0;
596 struct sk_buff *skb; 613 struct sk_buff *skb;
597 614
598 PDBG("%s %d\n", __FUNCTION__, __LINE__); 615 PDBG("%s %d\n", __FUNCTION__, __LINE__);
@@ -610,17 +627,7 @@ int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg)
610 627
611 /* immediate data starts here. */ 628 /* immediate data starts here. */
612 term = (struct terminate_message *)wqe->send.sgl; 629 term = (struct terminate_message *)wqe->send.sgl;
613 if (rsp_msg) { 630 build_term_codes(rsp_msg, &term->layer_etype, &term->ecode);
614 status = CQE_STATUS(rsp_msg->cqe);
615 if (CQE_OPCODE(rsp_msg->cqe) == T3_RDMA_WRITE)
616 tagged = 1;
617 if ((CQE_OPCODE(rsp_msg->cqe) == T3_READ_REQ) ||
618 (CQE_OPCODE(rsp_msg->cqe) == T3_READ_RESP))
619 tagged = 2;
620 } else {
621 status = TPT_ERR_INTERNAL_ERR;
622 }
623 build_term_codes(status, &term->layer_etype, &term->ecode, tagged);
624 build_fw_riwrh((void *)wqe, T3_WR_SEND, 631 build_fw_riwrh((void *)wqe, T3_WR_SEND,
625 T3_COMPLETION_FLAG | T3_NOTIFY_FLAG, 1, 632 T3_COMPLETION_FLAG | T3_NOTIFY_FLAG, 1,
626 qhp->ep->hwtid, 5); 633 qhp->ep->hwtid, 5);