X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Finfiniband%2Fhw%2Fmthca%2Fmthca_provider.c;h=e88e39aef85a3cd3794c7de290c9332ab2ebfb50;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=a2eae8a30167e3d9cc076b6885028c54485a8285;hpb=9464c7cf61b9433057924c36e6e02f303a00e768;p=linux-2.6.git diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index a2eae8a30..e88e39aef 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved. * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. + * Copyright (c) 2005 Cisco Systems. All rights reserved. * Copyright (c) 2005 Mellanox Technologies. All rights reserved. * Copyright (c) 2004 Voltaire, Inc. All rights reserved. * @@ -106,14 +106,14 @@ static int mthca_query_device(struct ib_device *ibdev, props->max_res_rd_atom = props->max_qp_rd_atom * props->max_qp; props->max_srq = mdev->limits.num_srqs - mdev->limits.reserved_srqs; props->max_srq_wr = mdev->limits.max_srq_wqes; - props->max_srq_sge = mdev->limits.max_srq_sge; + props->max_srq_sge = mdev->limits.max_sg; props->local_ca_ack_delay = mdev->limits.local_ca_ack_delay; - props->atomic_cap = mdev->limits.flags & DEV_LIM_FLAG_ATOMIC ? + props->atomic_cap = mdev->limits.flags & DEV_LIM_FLAG_ATOMIC ? IB_ATOMIC_HCA : IB_ATOMIC_NONE; props->max_pkeys = mdev->limits.pkey_table_len; props->max_mcast_grp = mdev->limits.num_mgms + mdev->limits.num_amgms; props->max_mcast_qp_attach = MTHCA_QP_PER_MGM; - props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * + props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * props->max_mcast_grp; err = 0; @@ -176,23 +176,6 @@ static int mthca_query_port(struct ib_device *ibdev, return err; } -static int mthca_modify_device(struct ib_device *ibdev, - int mask, - struct ib_device_modify *props) -{ - if (mask & ~IB_DEVICE_MODIFY_NODE_DESC) - return -EOPNOTSUPP; - - if (mask & IB_DEVICE_MODIFY_NODE_DESC) { - if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) - return -ERESTARTSYS; - memcpy(ibdev->node_desc, props->node_desc, 64); - mutex_unlock(&to_mdev(ibdev)->cap_mask_mutex); - } - - return 0; -} - static int mthca_modify_port(struct ib_device *ibdev, u8 port, int port_modify_mask, struct ib_port_modify *props) @@ -306,7 +289,7 @@ static int mthca_query_gid(struct ib_device *ibdev, u8 port, goto out; } - memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8); + memcpy(gid->raw + 8, out_mad->data + (index % 8) * 16, 8); out: kfree(in_mad); @@ -686,9 +669,9 @@ static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries, } if (context) { - cq->buf.mr.ibmr.lkey = ucmd.lkey; - cq->set_ci_db_index = ucmd.set_db_index; - cq->arm_db_index = ucmd.arm_db_index; + cq->mr.ibmr.lkey = ucmd.lkey; + cq->set_ci_db_index = ucmd.set_db_index; + cq->arm_db_index = ucmd.arm_db_index; } for (nent = 1; nent <= entries; nent <<= 1) @@ -706,8 +689,6 @@ static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries, goto err_free; } - cq->resize_buf = NULL; - return &cq->ibcq; err_free: @@ -726,121 +707,6 @@ err_unmap_set: return ERR_PTR(err); } -static int mthca_alloc_resize_buf(struct mthca_dev *dev, struct mthca_cq *cq, - int entries) -{ - int ret; - - spin_lock_irq(&cq->lock); - if (cq->resize_buf) { - ret = -EBUSY; - goto unlock; - } - - cq->resize_buf = kmalloc(sizeof *cq->resize_buf, GFP_ATOMIC); - if (!cq->resize_buf) { - ret = -ENOMEM; - goto unlock; - } - - cq->resize_buf->state = CQ_RESIZE_ALLOC; - - ret = 0; - -unlock: - spin_unlock_irq(&cq->lock); - - if (ret) - return ret; - - ret = mthca_alloc_cq_buf(dev, &cq->resize_buf->buf, entries); - if (ret) { - spin_lock_irq(&cq->lock); - kfree(cq->resize_buf); - cq->resize_buf = NULL; - spin_unlock_irq(&cq->lock); - return ret; - } - - cq->resize_buf->cqe = entries - 1; - - spin_lock_irq(&cq->lock); - cq->resize_buf->state = CQ_RESIZE_READY; - spin_unlock_irq(&cq->lock); - - return 0; -} - -static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) -{ - struct mthca_dev *dev = to_mdev(ibcq->device); - struct mthca_cq *cq = to_mcq(ibcq); - struct mthca_resize_cq ucmd; - u32 lkey; - u8 status; - int ret; - - if (entries < 1 || entries > dev->limits.max_cqes) - return -EINVAL; - - entries = roundup_pow_of_two(entries + 1); - if (entries == ibcq->cqe + 1) - return 0; - - if (cq->is_kernel) { - ret = mthca_alloc_resize_buf(dev, cq, entries); - if (ret) - return ret; - lkey = cq->resize_buf->buf.mr.ibmr.lkey; - } else { - if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) - return -EFAULT; - lkey = ucmd.lkey; - } - - ret = mthca_RESIZE_CQ(dev, cq->cqn, lkey, long_log2(entries), &status); - if (status) - ret = -EINVAL; - - if (ret) { - if (cq->resize_buf) { - mthca_free_cq_buf(dev, &cq->resize_buf->buf, - cq->resize_buf->cqe); - kfree(cq->resize_buf); - spin_lock_irq(&cq->lock); - cq->resize_buf = NULL; - spin_unlock_irq(&cq->lock); - } - return ret; - } - - if (cq->is_kernel) { - struct mthca_cq_buf tbuf; - int tcqe; - - spin_lock_irq(&cq->lock); - if (cq->resize_buf->state == CQ_RESIZE_READY) { - mthca_cq_resize_copy_cqes(cq); - tbuf = cq->buf; - tcqe = cq->ibcq.cqe; - cq->buf = cq->resize_buf->buf; - cq->ibcq.cqe = cq->resize_buf->cqe; - } else { - tbuf = cq->resize_buf->buf; - tcqe = cq->resize_buf->cqe; - } - - kfree(cq->resize_buf); - cq->resize_buf = NULL; - spin_unlock_irq(&cq->lock); - - mthca_free_cq_buf(dev, &tbuf, tcqe); - } else - ibcq->cqe = entries - 1; - - return 0; -} - static int mthca_destroy_cq(struct ib_cq *cq) { if (cq->uobject) { @@ -1204,20 +1070,6 @@ static int mthca_init_node_data(struct mthca_dev *dev) goto out; init_query_mad(in_mad); - in_mad->attr_id = IB_SMP_ATTR_NODE_DESC; - - err = mthca_MAD_IFC(dev, 1, 1, - 1, NULL, NULL, in_mad, out_mad, - &status); - if (err) - goto out; - if (status) { - err = -EINVAL; - goto out; - } - - memcpy(dev->ib_dev.node_desc, out_mad->data, 64); - in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; err = mthca_MAD_IFC(dev, 1, 1, @@ -1261,17 +1113,14 @@ int mthca_register_device(struct mthca_dev *dev) (1ull << IB_USER_VERBS_CMD_DEREG_MR) | (1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) | (1ull << IB_USER_VERBS_CMD_CREATE_CQ) | - (1ull << IB_USER_VERBS_CMD_RESIZE_CQ) | (1ull << IB_USER_VERBS_CMD_DESTROY_CQ) | (1ull << IB_USER_VERBS_CMD_CREATE_QP) | - (1ull << IB_USER_VERBS_CMD_QUERY_QP) | (1ull << IB_USER_VERBS_CMD_MODIFY_QP) | (1ull << IB_USER_VERBS_CMD_DESTROY_QP) | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST) | (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) | (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) | - (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ); dev->ib_dev.node_type = IB_NODE_CA; dev->ib_dev.phys_port_cnt = dev->limits.num_ports; @@ -1279,7 +1128,6 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.class_dev.dev = &dev->pdev->dev; dev->ib_dev.query_device = mthca_query_device; dev->ib_dev.query_port = mthca_query_port; - dev->ib_dev.modify_device = mthca_modify_device; dev->ib_dev.modify_port = mthca_modify_port; dev->ib_dev.query_pkey = mthca_query_pkey; dev->ib_dev.query_gid = mthca_query_gid; @@ -1289,13 +1137,11 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.alloc_pd = mthca_alloc_pd; dev->ib_dev.dealloc_pd = mthca_dealloc_pd; dev->ib_dev.create_ah = mthca_ah_create; - dev->ib_dev.query_ah = mthca_ah_query; dev->ib_dev.destroy_ah = mthca_ah_destroy; if (dev->mthca_flags & MTHCA_FLAG_SRQ) { dev->ib_dev.create_srq = mthca_create_srq; - dev->ib_dev.modify_srq = mthca_modify_srq; - dev->ib_dev.query_srq = mthca_query_srq; + dev->ib_dev.modify_srq = mthca_modify_srq; dev->ib_dev.destroy_srq = mthca_destroy_srq; if (mthca_is_memfree(dev)) @@ -1306,10 +1152,8 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.create_qp = mthca_create_qp; dev->ib_dev.modify_qp = mthca_modify_qp; - dev->ib_dev.query_qp = mthca_query_qp; dev->ib_dev.destroy_qp = mthca_destroy_qp; dev->ib_dev.create_cq = mthca_create_cq; - dev->ib_dev.resize_cq = mthca_resize_cq; dev->ib_dev.destroy_cq = mthca_destroy_cq; dev->ib_dev.poll_cq = mthca_poll_cq; dev->ib_dev.get_dma_mr = mthca_get_dma_mr;