diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/infiniband/core/cm.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/infiniband/core/cm.c')
-rw-r--r-- | drivers/infiniband/core/cm.c | 84 |
1 files changed, 30 insertions, 54 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 394fea2ba1b..fc0f2bd9ca8 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
37 | #include <linux/dma-mapping.h> | 37 | #include <linux/dma-mapping.h> |
38 | #include <linux/device.h> | 38 | #include <linux/device.h> |
39 | #include <linux/module.h> | ||
40 | #include <linux/err.h> | 39 | #include <linux/err.h> |
41 | #include <linux/idr.h> | 40 | #include <linux/idr.h> |
42 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
@@ -390,7 +389,7 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv) | |||
390 | ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, | 389 | ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, |
391 | next_id, &id); | 390 | next_id, &id); |
392 | if (!ret) | 391 | if (!ret) |
393 | next_id = ((unsigned) id + 1) & MAX_IDR_MASK; | 392 | next_id = ((unsigned) id + 1) & MAX_ID_MASK; |
394 | spin_unlock_irqrestore(&cm.lock, flags); | 393 | spin_unlock_irqrestore(&cm.lock, flags); |
395 | } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) ); | 394 | } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) ); |
396 | 395 | ||
@@ -890,8 +889,6 @@ retest: | |||
890 | break; | 889 | break; |
891 | case IB_CM_ESTABLISHED: | 890 | case IB_CM_ESTABLISHED: |
892 | spin_unlock_irq(&cm_id_priv->lock); | 891 | spin_unlock_irq(&cm_id_priv->lock); |
893 | if (cm_id_priv->qp_type == IB_QPT_XRC_TGT) | ||
894 | break; | ||
895 | ib_send_cm_dreq(cm_id, NULL, 0); | 892 | ib_send_cm_dreq(cm_id, NULL, 0); |
896 | goto retest; | 893 | goto retest; |
897 | case IB_CM_DREQ_SENT: | 894 | case IB_CM_DREQ_SENT: |
@@ -1011,6 +1008,7 @@ static void cm_format_req(struct cm_req_msg *req_msg, | |||
1011 | req_msg->service_id = param->service_id; | 1008 | req_msg->service_id = param->service_id; |
1012 | req_msg->local_ca_guid = cm_id_priv->id.device->node_guid; | 1009 | req_msg->local_ca_guid = cm_id_priv->id.device->node_guid; |
1013 | cm_req_set_local_qpn(req_msg, cpu_to_be32(param->qp_num)); | 1010 | cm_req_set_local_qpn(req_msg, cpu_to_be32(param->qp_num)); |
1011 | cm_req_set_resp_res(req_msg, param->responder_resources); | ||
1014 | cm_req_set_init_depth(req_msg, param->initiator_depth); | 1012 | cm_req_set_init_depth(req_msg, param->initiator_depth); |
1015 | cm_req_set_remote_resp_timeout(req_msg, | 1013 | cm_req_set_remote_resp_timeout(req_msg, |
1016 | param->remote_cm_response_timeout); | 1014 | param->remote_cm_response_timeout); |
@@ -1019,16 +1017,12 @@ static void cm_format_req(struct cm_req_msg *req_msg, | |||
1019 | cm_req_set_starting_psn(req_msg, cpu_to_be32(param->starting_psn)); | 1017 | cm_req_set_starting_psn(req_msg, cpu_to_be32(param->starting_psn)); |
1020 | cm_req_set_local_resp_timeout(req_msg, | 1018 | cm_req_set_local_resp_timeout(req_msg, |
1021 | param->local_cm_response_timeout); | 1019 | param->local_cm_response_timeout); |
1020 | cm_req_set_retry_count(req_msg, param->retry_count); | ||
1022 | req_msg->pkey = param->primary_path->pkey; | 1021 | req_msg->pkey = param->primary_path->pkey; |
1023 | cm_req_set_path_mtu(req_msg, param->primary_path->mtu); | 1022 | cm_req_set_path_mtu(req_msg, param->primary_path->mtu); |
1023 | cm_req_set_rnr_retry_count(req_msg, param->rnr_retry_count); | ||
1024 | cm_req_set_max_cm_retries(req_msg, param->max_cm_retries); | 1024 | cm_req_set_max_cm_retries(req_msg, param->max_cm_retries); |
1025 | 1025 | cm_req_set_srq(req_msg, param->srq); | |
1026 | if (param->qp_type != IB_QPT_XRC_INI) { | ||
1027 | cm_req_set_resp_res(req_msg, param->responder_resources); | ||
1028 | cm_req_set_retry_count(req_msg, param->retry_count); | ||
1029 | cm_req_set_rnr_retry_count(req_msg, param->rnr_retry_count); | ||
1030 | cm_req_set_srq(req_msg, param->srq); | ||
1031 | } | ||
1032 | 1026 | ||
1033 | if (pri_path->hop_limit <= 1) { | 1027 | if (pri_path->hop_limit <= 1) { |
1034 | req_msg->primary_local_lid = pri_path->slid; | 1028 | req_msg->primary_local_lid = pri_path->slid; |
@@ -1086,8 +1080,7 @@ static int cm_validate_req_param(struct ib_cm_req_param *param) | |||
1086 | if (!param->primary_path) | 1080 | if (!param->primary_path) |
1087 | return -EINVAL; | 1081 | return -EINVAL; |
1088 | 1082 | ||
1089 | if (param->qp_type != IB_QPT_RC && param->qp_type != IB_QPT_UC && | 1083 | if (param->qp_type != IB_QPT_RC && param->qp_type != IB_QPT_UC) |
1090 | param->qp_type != IB_QPT_XRC_INI) | ||
1091 | return -EINVAL; | 1084 | return -EINVAL; |
1092 | 1085 | ||
1093 | if (param->private_data && | 1086 | if (param->private_data && |
@@ -1608,24 +1601,18 @@ static void cm_format_rep(struct cm_rep_msg *rep_msg, | |||
1608 | cm_format_mad_hdr(&rep_msg->hdr, CM_REP_ATTR_ID, cm_id_priv->tid); | 1601 | cm_format_mad_hdr(&rep_msg->hdr, CM_REP_ATTR_ID, cm_id_priv->tid); |
1609 | rep_msg->local_comm_id = cm_id_priv->id.local_id; | 1602 | rep_msg->local_comm_id = cm_id_priv->id.local_id; |
1610 | rep_msg->remote_comm_id = cm_id_priv->id.remote_id; | 1603 | rep_msg->remote_comm_id = cm_id_priv->id.remote_id; |
1604 | cm_rep_set_local_qpn(rep_msg, cpu_to_be32(param->qp_num)); | ||
1611 | cm_rep_set_starting_psn(rep_msg, cpu_to_be32(param->starting_psn)); | 1605 | cm_rep_set_starting_psn(rep_msg, cpu_to_be32(param->starting_psn)); |
1612 | rep_msg->resp_resources = param->responder_resources; | 1606 | rep_msg->resp_resources = param->responder_resources; |
1607 | rep_msg->initiator_depth = param->initiator_depth; | ||
1613 | cm_rep_set_target_ack_delay(rep_msg, | 1608 | cm_rep_set_target_ack_delay(rep_msg, |
1614 | cm_id_priv->av.port->cm_dev->ack_delay); | 1609 | cm_id_priv->av.port->cm_dev->ack_delay); |
1615 | cm_rep_set_failover(rep_msg, param->failover_accepted); | 1610 | cm_rep_set_failover(rep_msg, param->failover_accepted); |
1611 | cm_rep_set_flow_ctrl(rep_msg, param->flow_control); | ||
1616 | cm_rep_set_rnr_retry_count(rep_msg, param->rnr_retry_count); | 1612 | cm_rep_set_rnr_retry_count(rep_msg, param->rnr_retry_count); |
1613 | cm_rep_set_srq(rep_msg, param->srq); | ||
1617 | rep_msg->local_ca_guid = cm_id_priv->id.device->node_guid; | 1614 | rep_msg->local_ca_guid = cm_id_priv->id.device->node_guid; |
1618 | 1615 | ||
1619 | if (cm_id_priv->qp_type != IB_QPT_XRC_TGT) { | ||
1620 | rep_msg->initiator_depth = param->initiator_depth; | ||
1621 | cm_rep_set_flow_ctrl(rep_msg, param->flow_control); | ||
1622 | cm_rep_set_srq(rep_msg, param->srq); | ||
1623 | cm_rep_set_local_qpn(rep_msg, cpu_to_be32(param->qp_num)); | ||
1624 | } else { | ||
1625 | cm_rep_set_srq(rep_msg, 1); | ||
1626 | cm_rep_set_local_eecn(rep_msg, cpu_to_be32(param->qp_num)); | ||
1627 | } | ||
1628 | |||
1629 | if (param->private_data && param->private_data_len) | 1616 | if (param->private_data && param->private_data_len) |
1630 | memcpy(rep_msg->private_data, param->private_data, | 1617 | memcpy(rep_msg->private_data, param->private_data, |
1631 | param->private_data_len); | 1618 | param->private_data_len); |
@@ -1673,7 +1660,7 @@ int ib_send_cm_rep(struct ib_cm_id *cm_id, | |||
1673 | cm_id_priv->initiator_depth = param->initiator_depth; | 1660 | cm_id_priv->initiator_depth = param->initiator_depth; |
1674 | cm_id_priv->responder_resources = param->responder_resources; | 1661 | cm_id_priv->responder_resources = param->responder_resources; |
1675 | cm_id_priv->rq_psn = cm_rep_get_starting_psn(rep_msg); | 1662 | cm_id_priv->rq_psn = cm_rep_get_starting_psn(rep_msg); |
1676 | cm_id_priv->local_qpn = cpu_to_be32(param->qp_num & 0xFFFFFF); | 1663 | cm_id_priv->local_qpn = cm_rep_get_local_qpn(rep_msg); |
1677 | 1664 | ||
1678 | out: spin_unlock_irqrestore(&cm_id_priv->lock, flags); | 1665 | out: spin_unlock_irqrestore(&cm_id_priv->lock, flags); |
1679 | return ret; | 1666 | return ret; |
@@ -1744,7 +1731,7 @@ error: spin_unlock_irqrestore(&cm_id_priv->lock, flags); | |||
1744 | } | 1731 | } |
1745 | EXPORT_SYMBOL(ib_send_cm_rtu); | 1732 | EXPORT_SYMBOL(ib_send_cm_rtu); |
1746 | 1733 | ||
1747 | static void cm_format_rep_event(struct cm_work *work, enum ib_qp_type qp_type) | 1734 | static void cm_format_rep_event(struct cm_work *work) |
1748 | { | 1735 | { |
1749 | struct cm_rep_msg *rep_msg; | 1736 | struct cm_rep_msg *rep_msg; |
1750 | struct ib_cm_rep_event_param *param; | 1737 | struct ib_cm_rep_event_param *param; |
@@ -1753,7 +1740,7 @@ static void cm_format_rep_event(struct cm_work *work, enum ib_qp_type qp_type) | |||
1753 | param = &work->cm_event.param.rep_rcvd; | 1740 | param = &work->cm_event.param.rep_rcvd; |
1754 | param->remote_ca_guid = rep_msg->local_ca_guid; | 1741 | param->remote_ca_guid = rep_msg->local_ca_guid; |
1755 | param->remote_qkey = be32_to_cpu(rep_msg->local_qkey); | 1742 | param->remote_qkey = be32_to_cpu(rep_msg->local_qkey); |
1756 | param->remote_qpn = be32_to_cpu(cm_rep_get_qpn(rep_msg, qp_type)); | 1743 | param->remote_qpn = be32_to_cpu(cm_rep_get_local_qpn(rep_msg)); |
1757 | param->starting_psn = be32_to_cpu(cm_rep_get_starting_psn(rep_msg)); | 1744 | param->starting_psn = be32_to_cpu(cm_rep_get_starting_psn(rep_msg)); |
1758 | param->responder_resources = rep_msg->initiator_depth; | 1745 | param->responder_resources = rep_msg->initiator_depth; |
1759 | param->initiator_depth = rep_msg->resp_resources; | 1746 | param->initiator_depth = rep_msg->resp_resources; |
@@ -1821,7 +1808,7 @@ static int cm_rep_handler(struct cm_work *work) | |||
1821 | return -EINVAL; | 1808 | return -EINVAL; |
1822 | } | 1809 | } |
1823 | 1810 | ||
1824 | cm_format_rep_event(work, cm_id_priv->qp_type); | 1811 | cm_format_rep_event(work); |
1825 | 1812 | ||
1826 | spin_lock_irq(&cm_id_priv->lock); | 1813 | spin_lock_irq(&cm_id_priv->lock); |
1827 | switch (cm_id_priv->id.state) { | 1814 | switch (cm_id_priv->id.state) { |
@@ -1836,7 +1823,7 @@ static int cm_rep_handler(struct cm_work *work) | |||
1836 | 1823 | ||
1837 | cm_id_priv->timewait_info->work.remote_id = rep_msg->local_comm_id; | 1824 | cm_id_priv->timewait_info->work.remote_id = rep_msg->local_comm_id; |
1838 | cm_id_priv->timewait_info->remote_ca_guid = rep_msg->local_ca_guid; | 1825 | cm_id_priv->timewait_info->remote_ca_guid = rep_msg->local_ca_guid; |
1839 | cm_id_priv->timewait_info->remote_qpn = cm_rep_get_qpn(rep_msg, cm_id_priv->qp_type); | 1826 | cm_id_priv->timewait_info->remote_qpn = cm_rep_get_local_qpn(rep_msg); |
1840 | 1827 | ||
1841 | spin_lock(&cm.lock); | 1828 | spin_lock(&cm.lock); |
1842 | /* Check for duplicate REP. */ | 1829 | /* Check for duplicate REP. */ |
@@ -1863,7 +1850,7 @@ static int cm_rep_handler(struct cm_work *work) | |||
1863 | 1850 | ||
1864 | cm_id_priv->id.state = IB_CM_REP_RCVD; | 1851 | cm_id_priv->id.state = IB_CM_REP_RCVD; |
1865 | cm_id_priv->id.remote_id = rep_msg->local_comm_id; | 1852 | cm_id_priv->id.remote_id = rep_msg->local_comm_id; |
1866 | cm_id_priv->remote_qpn = cm_rep_get_qpn(rep_msg, cm_id_priv->qp_type); | 1853 | cm_id_priv->remote_qpn = cm_rep_get_local_qpn(rep_msg); |
1867 | cm_id_priv->initiator_depth = rep_msg->resp_resources; | 1854 | cm_id_priv->initiator_depth = rep_msg->resp_resources; |
1868 | cm_id_priv->responder_resources = rep_msg->initiator_depth; | 1855 | cm_id_priv->responder_resources = rep_msg->initiator_depth; |
1869 | cm_id_priv->sq_psn = cm_rep_get_starting_psn(rep_msg); | 1856 | cm_id_priv->sq_psn = cm_rep_get_starting_psn(rep_msg); |
@@ -3505,8 +3492,7 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv, | |||
3505 | qp_attr->path_mtu = cm_id_priv->path_mtu; | 3492 | qp_attr->path_mtu = cm_id_priv->path_mtu; |
3506 | qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn); | 3493 | qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn); |
3507 | qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn); | 3494 | qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn); |
3508 | if (cm_id_priv->qp_type == IB_QPT_RC || | 3495 | if (cm_id_priv->qp_type == IB_QPT_RC) { |
3509 | cm_id_priv->qp_type == IB_QPT_XRC_TGT) { | ||
3510 | *qp_attr_mask |= IB_QP_MAX_DEST_RD_ATOMIC | | 3496 | *qp_attr_mask |= IB_QP_MAX_DEST_RD_ATOMIC | |
3511 | IB_QP_MIN_RNR_TIMER; | 3497 | IB_QP_MIN_RNR_TIMER; |
3512 | qp_attr->max_dest_rd_atomic = | 3498 | qp_attr->max_dest_rd_atomic = |
@@ -3551,21 +3537,15 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv, | |||
3551 | if (cm_id_priv->id.lap_state == IB_CM_LAP_UNINIT) { | 3537 | if (cm_id_priv->id.lap_state == IB_CM_LAP_UNINIT) { |
3552 | *qp_attr_mask = IB_QP_STATE | IB_QP_SQ_PSN; | 3538 | *qp_attr_mask = IB_QP_STATE | IB_QP_SQ_PSN; |
3553 | qp_attr->sq_psn = be32_to_cpu(cm_id_priv->sq_psn); | 3539 | qp_attr->sq_psn = be32_to_cpu(cm_id_priv->sq_psn); |
3554 | switch (cm_id_priv->qp_type) { | 3540 | if (cm_id_priv->qp_type == IB_QPT_RC) { |
3555 | case IB_QPT_RC: | 3541 | *qp_attr_mask |= IB_QP_TIMEOUT | IB_QP_RETRY_CNT | |
3556 | case IB_QPT_XRC_INI: | 3542 | IB_QP_RNR_RETRY | |
3557 | *qp_attr_mask |= IB_QP_RETRY_CNT | IB_QP_RNR_RETRY | | ||
3558 | IB_QP_MAX_QP_RD_ATOMIC; | 3543 | IB_QP_MAX_QP_RD_ATOMIC; |
3544 | qp_attr->timeout = cm_id_priv->av.timeout; | ||
3559 | qp_attr->retry_cnt = cm_id_priv->retry_count; | 3545 | qp_attr->retry_cnt = cm_id_priv->retry_count; |
3560 | qp_attr->rnr_retry = cm_id_priv->rnr_retry_count; | 3546 | qp_attr->rnr_retry = cm_id_priv->rnr_retry_count; |
3561 | qp_attr->max_rd_atomic = cm_id_priv->initiator_depth; | 3547 | qp_attr->max_rd_atomic = |
3562 | /* fall through */ | 3548 | cm_id_priv->initiator_depth; |
3563 | case IB_QPT_XRC_TGT: | ||
3564 | *qp_attr_mask |= IB_QP_TIMEOUT; | ||
3565 | qp_attr->timeout = cm_id_priv->av.timeout; | ||
3566 | break; | ||
3567 | default: | ||
3568 | break; | ||
3569 | } | 3549 | } |
3570 | if (cm_id_priv->alt_av.ah_attr.dlid) { | 3550 | if (cm_id_priv->alt_av.ah_attr.dlid) { |
3571 | *qp_attr_mask |= IB_QP_PATH_MIG_STATE; | 3551 | *qp_attr_mask |= IB_QP_PATH_MIG_STATE; |
@@ -3659,7 +3639,7 @@ static struct kobj_type cm_port_obj_type = { | |||
3659 | .release = cm_release_port_obj | 3639 | .release = cm_release_port_obj |
3660 | }; | 3640 | }; |
3661 | 3641 | ||
3662 | static char *cm_devnode(struct device *dev, umode_t *mode) | 3642 | static char *cm_devnode(struct device *dev, mode_t *mode) |
3663 | { | 3643 | { |
3664 | if (mode) | 3644 | if (mode) |
3665 | *mode = 0666; | 3645 | *mode = 0666; |
@@ -3848,28 +3828,24 @@ static int __init ib_cm_init(void) | |||
3848 | INIT_LIST_HEAD(&cm.timewait_list); | 3828 | INIT_LIST_HEAD(&cm.timewait_list); |
3849 | 3829 | ||
3850 | ret = class_register(&cm_class); | 3830 | ret = class_register(&cm_class); |
3851 | if (ret) { | 3831 | if (ret) |
3852 | ret = -ENOMEM; | 3832 | return -ENOMEM; |
3853 | goto error1; | ||
3854 | } | ||
3855 | 3833 | ||
3856 | cm.wq = create_workqueue("ib_cm"); | 3834 | cm.wq = create_workqueue("ib_cm"); |
3857 | if (!cm.wq) { | 3835 | if (!cm.wq) { |
3858 | ret = -ENOMEM; | 3836 | ret = -ENOMEM; |
3859 | goto error2; | 3837 | goto error1; |
3860 | } | 3838 | } |
3861 | 3839 | ||
3862 | ret = ib_register_client(&cm_client); | 3840 | ret = ib_register_client(&cm_client); |
3863 | if (ret) | 3841 | if (ret) |
3864 | goto error3; | 3842 | goto error2; |
3865 | 3843 | ||
3866 | return 0; | 3844 | return 0; |
3867 | error3: | ||
3868 | destroy_workqueue(cm.wq); | ||
3869 | error2: | 3845 | error2: |
3870 | class_unregister(&cm_class); | 3846 | destroy_workqueue(cm.wq); |
3871 | error1: | 3847 | error1: |
3872 | idr_destroy(&cm.local_id_table); | 3848 | class_unregister(&cm_class); |
3873 | return ret; | 3849 | return ret; |
3874 | } | 3850 | } |
3875 | 3851 | ||