diff options
author | Sean Hefty <sean.hefty@intel.com> | 2005-10-17 18:33:47 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-10-17 18:33:47 -0400 |
commit | 595e726a1f28420c5fc7970b1a87cbce77a1cd45 (patch) | |
tree | 743f39eb3f33c9f0a58a96cf4c7213ca06af50a9 /drivers/infiniband | |
parent | 67cdb40ca444c09853ab4d8a41cf547ac26a4de4 (diff) |
[IB] merge ucm.h into ucm.c
Eliminate ucm.h. Replace ucm_dbg with direct call to printk KERN_ERR.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/ucm.c | 62 | ||||
-rw-r--r-- | drivers/infiniband/core/ucm.h | 83 |
2 files changed, 41 insertions, 104 deletions
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index d0f0b0a2edd3..b7470f0fe83b 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -41,19 +41,52 @@ | |||
41 | #include <linux/file.h> | 41 | #include <linux/file.h> |
42 | #include <linux/mount.h> | 42 | #include <linux/mount.h> |
43 | #include <linux/cdev.h> | 43 | #include <linux/cdev.h> |
44 | #include <linux/idr.h> | ||
44 | 45 | ||
45 | #include <asm/uaccess.h> | 46 | #include <asm/uaccess.h> |
46 | 47 | ||
47 | #include "ucm.h" | 48 | #include <rdma/ib_cm.h> |
49 | #include <rdma/ib_user_cm.h> | ||
48 | 50 | ||
49 | MODULE_AUTHOR("Libor Michalek"); | 51 | MODULE_AUTHOR("Libor Michalek"); |
50 | MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access"); | 52 | MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access"); |
51 | MODULE_LICENSE("Dual BSD/GPL"); | 53 | MODULE_LICENSE("Dual BSD/GPL"); |
52 | 54 | ||
53 | static int ucm_debug_level; | 55 | struct ib_ucm_file { |
56 | struct semaphore mutex; | ||
57 | struct file *filp; | ||
54 | 58 | ||
55 | module_param_named(debug_level, ucm_debug_level, int, 0644); | 59 | struct list_head ctxs; /* list of active connections */ |
56 | MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0"); | 60 | struct list_head events; /* list of pending events */ |
61 | wait_queue_head_t poll_wait; | ||
62 | }; | ||
63 | |||
64 | struct ib_ucm_context { | ||
65 | int id; | ||
66 | wait_queue_head_t wait; | ||
67 | atomic_t ref; | ||
68 | int events_reported; | ||
69 | |||
70 | struct ib_ucm_file *file; | ||
71 | struct ib_cm_id *cm_id; | ||
72 | __u64 uid; | ||
73 | |||
74 | struct list_head events; /* list of pending events. */ | ||
75 | struct list_head file_list; /* member in file ctx list */ | ||
76 | }; | ||
77 | |||
78 | struct ib_ucm_event { | ||
79 | struct ib_ucm_context *ctx; | ||
80 | struct list_head file_list; /* member in file event list */ | ||
81 | struct list_head ctx_list; /* member in ctx event list */ | ||
82 | |||
83 | struct ib_cm_id *cm_id; | ||
84 | struct ib_ucm_event_resp resp; | ||
85 | void *data; | ||
86 | void *info; | ||
87 | int data_len; | ||
88 | int info_len; | ||
89 | }; | ||
57 | 90 | ||
58 | enum { | 91 | enum { |
59 | IB_UCM_MAJOR = 231, | 92 | IB_UCM_MAJOR = 231, |
@@ -62,17 +95,10 @@ enum { | |||
62 | 95 | ||
63 | #define IB_UCM_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_MINOR) | 96 | #define IB_UCM_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_MINOR) |
64 | 97 | ||
65 | #define PFX "UCM: " | ||
66 | |||
67 | #define ucm_dbg(format, arg...) \ | ||
68 | do { \ | ||
69 | if (ucm_debug_level > 0) \ | ||
70 | printk(KERN_DEBUG PFX format, ## arg); \ | ||
71 | } while (0) | ||
72 | |||
73 | static struct semaphore ctx_id_mutex; | 98 | static struct semaphore ctx_id_mutex; |
74 | static struct idr ctx_id_table; | 99 | static struct idr ctx_id_table; |
75 | 100 | ||
101 | |||
76 | static struct ib_ucm_context *ib_ucm_ctx_get(struct ib_ucm_file *file, int id) | 102 | static struct ib_ucm_context *ib_ucm_ctx_get(struct ib_ucm_file *file, int id) |
77 | { | 103 | { |
78 | struct ib_ucm_context *ctx; | 104 | struct ib_ucm_context *ctx; |
@@ -152,7 +178,6 @@ static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file) | |||
152 | goto error; | 178 | goto error; |
153 | 179 | ||
154 | list_add_tail(&ctx->file_list, &file->ctxs); | 180 | list_add_tail(&ctx->file_list, &file->ctxs); |
155 | ucm_dbg("Allocated CM ID <%d>\n", ctx->id); | ||
156 | return ctx; | 181 | return ctx; |
157 | 182 | ||
158 | error: | 183 | error: |
@@ -1184,9 +1209,6 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf, | |||
1184 | if (copy_from_user(&hdr, buf, sizeof(hdr))) | 1209 | if (copy_from_user(&hdr, buf, sizeof(hdr))) |
1185 | return -EFAULT; | 1210 | return -EFAULT; |
1186 | 1211 | ||
1187 | ucm_dbg("Write. cmd <%d> in <%d> out <%d> len <%Zu>\n", | ||
1188 | hdr.cmd, hdr.in, hdr.out, len); | ||
1189 | |||
1190 | if (hdr.cmd < 0 || hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) | 1212 | if (hdr.cmd < 0 || hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) |
1191 | return -EINVAL; | 1213 | return -EINVAL; |
1192 | 1214 | ||
@@ -1232,8 +1254,6 @@ static int ib_ucm_open(struct inode *inode, struct file *filp) | |||
1232 | filp->private_data = file; | 1254 | filp->private_data = file; |
1233 | file->filp = filp; | 1255 | file->filp = filp; |
1234 | 1256 | ||
1235 | ucm_dbg("Created struct\n"); | ||
1236 | |||
1237 | return 0; | 1257 | return 0; |
1238 | } | 1258 | } |
1239 | 1259 | ||
@@ -1281,7 +1301,7 @@ static int __init ib_ucm_init(void) | |||
1281 | 1301 | ||
1282 | result = register_chrdev_region(IB_UCM_DEV, 1, "infiniband_cm"); | 1302 | result = register_chrdev_region(IB_UCM_DEV, 1, "infiniband_cm"); |
1283 | if (result) { | 1303 | if (result) { |
1284 | ucm_dbg("Error <%d> registering dev\n", result); | 1304 | printk(KERN_ERR "ucm: Error <%d> registering dev\n", result); |
1285 | goto err_chr; | 1305 | goto err_chr; |
1286 | } | 1306 | } |
1287 | 1307 | ||
@@ -1289,14 +1309,14 @@ static int __init ib_ucm_init(void) | |||
1289 | 1309 | ||
1290 | result = cdev_add(&ib_ucm_cdev, IB_UCM_DEV, 1); | 1310 | result = cdev_add(&ib_ucm_cdev, IB_UCM_DEV, 1); |
1291 | if (result) { | 1311 | if (result) { |
1292 | ucm_dbg("Error <%d> adding cdev\n", result); | 1312 | printk(KERN_ERR "ucm: Error <%d> adding cdev\n", result); |
1293 | goto err_cdev; | 1313 | goto err_cdev; |
1294 | } | 1314 | } |
1295 | 1315 | ||
1296 | ib_ucm_class = class_create(THIS_MODULE, "infiniband_cm"); | 1316 | ib_ucm_class = class_create(THIS_MODULE, "infiniband_cm"); |
1297 | if (IS_ERR(ib_ucm_class)) { | 1317 | if (IS_ERR(ib_ucm_class)) { |
1298 | result = PTR_ERR(ib_ucm_class); | 1318 | result = PTR_ERR(ib_ucm_class); |
1299 | ucm_dbg("Error <%d> creating class\n", result); | 1319 | printk(KERN_ERR "Error <%d> creating class\n", result); |
1300 | goto err_class; | 1320 | goto err_class; |
1301 | } | 1321 | } |
1302 | 1322 | ||
diff --git a/drivers/infiniband/core/ucm.h b/drivers/infiniband/core/ucm.h deleted file mode 100644 index f46f37bc1201..000000000000 --- a/drivers/infiniband/core/ucm.h +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Topspin Communications. All rights reserved. | ||
3 | * Copyright (c) 2005 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the | ||
9 | * OpenIB.org BSD license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or | ||
12 | * without modification, are permitted provided that the following | ||
13 | * conditions are met: | ||
14 | * | ||
15 | * - Redistributions of source code must retain the above | ||
16 | * copyright notice, this list of conditions and the following | ||
17 | * disclaimer. | ||
18 | * | ||
19 | * - Redistributions in binary form must reproduce the above | ||
20 | * copyright notice, this list of conditions and the following | ||
21 | * disclaimer in the documentation and/or other materials | ||
22 | * provided with the distribution. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
31 | * SOFTWARE. | ||
32 | * | ||
33 | * $Id: ucm.h 2208 2005-04-22 23:24:31Z libor $ | ||
34 | */ | ||
35 | |||
36 | #ifndef UCM_H | ||
37 | #define UCM_H | ||
38 | |||
39 | #include <linux/fs.h> | ||
40 | #include <linux/device.h> | ||
41 | #include <linux/cdev.h> | ||
42 | #include <linux/idr.h> | ||
43 | |||
44 | #include <rdma/ib_cm.h> | ||
45 | #include <rdma/ib_user_cm.h> | ||
46 | |||
47 | struct ib_ucm_file { | ||
48 | struct semaphore mutex; | ||
49 | struct file *filp; | ||
50 | |||
51 | struct list_head ctxs; /* list of active connections */ | ||
52 | struct list_head events; /* list of pending events */ | ||
53 | wait_queue_head_t poll_wait; | ||
54 | }; | ||
55 | |||
56 | struct ib_ucm_context { | ||
57 | int id; | ||
58 | wait_queue_head_t wait; | ||
59 | atomic_t ref; | ||
60 | int events_reported; | ||
61 | |||
62 | struct ib_ucm_file *file; | ||
63 | struct ib_cm_id *cm_id; | ||
64 | __u64 uid; | ||
65 | |||
66 | struct list_head events; /* list of pending events. */ | ||
67 | struct list_head file_list; /* member in file ctx list */ | ||
68 | }; | ||
69 | |||
70 | struct ib_ucm_event { | ||
71 | struct ib_ucm_context *ctx; | ||
72 | struct list_head file_list; /* member in file event list */ | ||
73 | struct list_head ctx_list; /* member in ctx event list */ | ||
74 | |||
75 | struct ib_cm_id *cm_id; | ||
76 | struct ib_ucm_event_resp resp; | ||
77 | void *data; | ||
78 | void *info; | ||
79 | int data_len; | ||
80 | int info_len; | ||
81 | }; | ||
82 | |||
83 | #endif /* UCM_H */ | ||