provider.c (1d21b1bf53f81256002f93387ec80ca13e3c5a8f) provider.c (cf38be6d61001b234d5b980d6e98702587638190)
1/*
2 * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 108 unchanged lines hidden (view full) ---

117 ret = -ENOMEM;
118 goto err;
119 }
120
121 c4iw_init_dev_ucontext(&rhp->rdev, &context->uctx);
122 INIT_LIST_HEAD(&context->mmaps);
123 spin_lock_init(&context->mmap_lock);
124
1/*
2 * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 108 unchanged lines hidden (view full) ---

117 ret = -ENOMEM;
118 goto err;
119 }
120
121 c4iw_init_dev_ucontext(&rhp->rdev, &context->uctx);
122 INIT_LIST_HEAD(&context->mmaps);
123 spin_lock_init(&context->mmap_lock);
124
125 if (udata->outlen < sizeof(uresp) - sizeof(uresp.reserved)) {
125 if (udata->outlen < sizeof(uresp)) {
126 if (!warned++)
127 pr_err(MOD "Warning - downlevel libcxgb4 (non-fatal), device status page disabled.");
128 rhp->rdev.flags |= T4_STATUS_PAGE_DISABLED;
129 } else {
130 mm = kmalloc(sizeof(*mm), GFP_KERNEL);
131 if (!mm) {
132 ret = -ENOMEM;
133 goto err_free;
134 }
135
136 uresp.status_page_size = PAGE_SIZE;
137
138 spin_lock(&context->mmap_lock);
139 uresp.status_page_key = context->key;
140 context->key += PAGE_SIZE;
141 spin_unlock(&context->mmap_lock);
142
126 if (!warned++)
127 pr_err(MOD "Warning - downlevel libcxgb4 (non-fatal), device status page disabled.");
128 rhp->rdev.flags |= T4_STATUS_PAGE_DISABLED;
129 } else {
130 mm = kmalloc(sizeof(*mm), GFP_KERNEL);
131 if (!mm) {
132 ret = -ENOMEM;
133 goto err_free;
134 }
135
136 uresp.status_page_size = PAGE_SIZE;
137
138 spin_lock(&context->mmap_lock);
139 uresp.status_page_key = context->key;
140 context->key += PAGE_SIZE;
141 spin_unlock(&context->mmap_lock);
142
143 ret = ib_copy_to_udata(udata, &uresp,
144 sizeof(uresp) - sizeof(uresp.reserved));
143 ret = ib_copy_to_udata(udata, &uresp, sizeof(uresp));
145 if (ret)
146 goto err_mm;
147
148 mm->key = uresp.status_page_key;
149 mm->addr = virt_to_phys(rhp->rdev.status_page);
150 mm->len = PAGE_SIZE;
151 insert_mmap(context, mm);
152 }

--- 342 unchanged lines hidden (view full) ---

495 (1ull << IB_USER_VERBS_CMD_QUERY_QP) |
496 (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
497 (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
498 (1ull << IB_USER_VERBS_CMD_POST_SEND) |
499 (1ull << IB_USER_VERBS_CMD_POST_RECV);
500 dev->ibdev.node_type = RDMA_NODE_RNIC;
501 memcpy(dev->ibdev.node_desc, C4IW_NODE_DESC, sizeof(C4IW_NODE_DESC));
502 dev->ibdev.phys_port_cnt = dev->rdev.lldi.nports;
144 if (ret)
145 goto err_mm;
146
147 mm->key = uresp.status_page_key;
148 mm->addr = virt_to_phys(rhp->rdev.status_page);
149 mm->len = PAGE_SIZE;
150 insert_mmap(context, mm);
151 }

--- 342 unchanged lines hidden (view full) ---

494 (1ull << IB_USER_VERBS_CMD_QUERY_QP) |
495 (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
496 (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
497 (1ull << IB_USER_VERBS_CMD_POST_SEND) |
498 (1ull << IB_USER_VERBS_CMD_POST_RECV);
499 dev->ibdev.node_type = RDMA_NODE_RNIC;
500 memcpy(dev->ibdev.node_desc, C4IW_NODE_DESC, sizeof(C4IW_NODE_DESC));
501 dev->ibdev.phys_port_cnt = dev->rdev.lldi.nports;
503 dev->ibdev.num_comp_vectors = 1;
502 dev->ibdev.num_comp_vectors = dev->rdev.lldi.nciq;
504 dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev);
505 dev->ibdev.query_device = c4iw_query_device;
506 dev->ibdev.query_port = c4iw_query_port;
507 dev->ibdev.query_pkey = c4iw_query_pkey;
508 dev->ibdev.query_gid = c4iw_query_gid;
509 dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
510 dev->ibdev.dealloc_ucontext = c4iw_dealloc_ucontext;
511 dev->ibdev.mmap = c4iw_mmap;

--- 75 unchanged lines hidden ---
503 dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev);
504 dev->ibdev.query_device = c4iw_query_device;
505 dev->ibdev.query_port = c4iw_query_port;
506 dev->ibdev.query_pkey = c4iw_query_pkey;
507 dev->ibdev.query_gid = c4iw_query_gid;
508 dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
509 dev->ibdev.dealloc_ucontext = c4iw_dealloc_ucontext;
510 dev->ibdev.mmap = c4iw_mmap;

--- 75 unchanged lines hidden ---