diff options
| -rw-r--r-- | drivers/infiniband/core/ucma.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index ac7edc24165c..b2748a673989 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include <linux/in6.h> | 40 | #include <linux/in6.h> |
| 41 | #include <linux/miscdevice.h> | 41 | #include <linux/miscdevice.h> |
| 42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
| 43 | #include <linux/sysctl.h> | ||
| 43 | 44 | ||
| 44 | #include <rdma/rdma_user_cm.h> | 45 | #include <rdma/rdma_user_cm.h> |
| 45 | #include <rdma/ib_marshall.h> | 46 | #include <rdma/ib_marshall.h> |
| @@ -50,8 +51,24 @@ MODULE_AUTHOR("Sean Hefty"); | |||
| 50 | MODULE_DESCRIPTION("RDMA Userspace Connection Manager Access"); | 51 | MODULE_DESCRIPTION("RDMA Userspace Connection Manager Access"); |
| 51 | MODULE_LICENSE("Dual BSD/GPL"); | 52 | MODULE_LICENSE("Dual BSD/GPL"); |
| 52 | 53 | ||
| 53 | enum { | 54 | static unsigned int max_backlog = 1024; |
| 54 | UCMA_MAX_BACKLOG = 128 | 55 | |
| 56 | static struct ctl_table_header *ucma_ctl_table_hdr; | ||
| 57 | static ctl_table ucma_ctl_table[] = { | ||
| 58 | { | ||
| 59 | .procname = "max_backlog", | ||
| 60 | .data = &max_backlog, | ||
| 61 | .maxlen = sizeof max_backlog, | ||
| 62 | .mode = 0644, | ||
| 63 | .proc_handler = proc_dointvec, | ||
| 64 | }, | ||
| 65 | { } | ||
| 66 | }; | ||
| 67 | |||
| 68 | static struct ctl_path ucma_ctl_path[] = { | ||
| 69 | { .procname = "net" }, | ||
| 70 | { .procname = "rdma_ucm" }, | ||
| 71 | { } | ||
| 55 | }; | 72 | }; |
| 56 | 73 | ||
| 57 | struct ucma_file { | 74 | struct ucma_file { |
| @@ -686,8 +703,8 @@ static ssize_t ucma_listen(struct ucma_file *file, const char __user *inbuf, | |||
| 686 | if (IS_ERR(ctx)) | 703 | if (IS_ERR(ctx)) |
| 687 | return PTR_ERR(ctx); | 704 | return PTR_ERR(ctx); |
| 688 | 705 | ||
| 689 | ctx->backlog = cmd.backlog > 0 && cmd.backlog < UCMA_MAX_BACKLOG ? | 706 | ctx->backlog = cmd.backlog > 0 && cmd.backlog < max_backlog ? |
| 690 | cmd.backlog : UCMA_MAX_BACKLOG; | 707 | cmd.backlog : max_backlog; |
| 691 | ret = rdma_listen(ctx->cm_id, ctx->backlog); | 708 | ret = rdma_listen(ctx->cm_id, ctx->backlog); |
| 692 | ucma_put_ctx(ctx); | 709 | ucma_put_ctx(ctx); |
| 693 | return ret; | 710 | return ret; |
| @@ -1279,16 +1296,26 @@ static int __init ucma_init(void) | |||
| 1279 | ret = device_create_file(ucma_misc.this_device, &dev_attr_abi_version); | 1296 | ret = device_create_file(ucma_misc.this_device, &dev_attr_abi_version); |
| 1280 | if (ret) { | 1297 | if (ret) { |
| 1281 | printk(KERN_ERR "rdma_ucm: couldn't create abi_version attr\n"); | 1298 | printk(KERN_ERR "rdma_ucm: couldn't create abi_version attr\n"); |
| 1282 | goto err; | 1299 | goto err1; |
| 1300 | } | ||
| 1301 | |||
| 1302 | ucma_ctl_table_hdr = register_sysctl_paths(ucma_ctl_path, ucma_ctl_table); | ||
| 1303 | if (!ucma_ctl_table_hdr) { | ||
| 1304 | printk(KERN_ERR "rdma_ucm: couldn't register sysctl paths\n"); | ||
| 1305 | ret = -ENOMEM; | ||
| 1306 | goto err2; | ||
| 1283 | } | 1307 | } |
| 1284 | return 0; | 1308 | return 0; |
| 1285 | err: | 1309 | err2: |
| 1310 | device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); | ||
| 1311 | err1: | ||
| 1286 | misc_deregister(&ucma_misc); | 1312 | misc_deregister(&ucma_misc); |
| 1287 | return ret; | 1313 | return ret; |
| 1288 | } | 1314 | } |
| 1289 | 1315 | ||
| 1290 | static void __exit ucma_cleanup(void) | 1316 | static void __exit ucma_cleanup(void) |
| 1291 | { | 1317 | { |
| 1318 | unregister_sysctl_table(ucma_ctl_table_hdr); | ||
| 1292 | device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); | 1319 | device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); |
| 1293 | misc_deregister(&ucma_misc); | 1320 | misc_deregister(&ucma_misc); |
| 1294 | idr_destroy(&ctx_idr); | 1321 | idr_destroy(&ctx_idr); |
