diff options
author | Steve Wise <swise@opengridcomputing.com> | 2014-07-25 10:11:33 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-08-05 10:33:24 -0400 |
commit | 2f0304d21867476394cd51a54e97f7273d112261 (patch) | |
tree | 9149476b67dba506fbcebeec58f6f7788c00f274 /drivers/infiniband | |
parent | 64aa90f26c06e1cb2aacfb98a7d0eccfbd6c1a91 (diff) |
RDMA/iwcm: Use a default listen backlog if needed
If the user creates a listening cm_id with backlog of 0 the IWCM ends
up not allowing any connection requests at all. The correct behavior
is for the IWCM to pick a default value if the user backlog parameter
is zero.
Lustre from version 1.8.8 onward uses a backlog of 0, which breaks
iwarp support without this fix.
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/iwcm.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c index 3d2e489ab732..ff9163dc1596 100644 --- a/drivers/infiniband/core/iwcm.c +++ b/drivers/infiniband/core/iwcm.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/completion.h> | 46 | #include <linux/completion.h> |
47 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
48 | #include <linux/module.h> | 48 | #include <linux/module.h> |
49 | #include <linux/sysctl.h> | ||
49 | 50 | ||
50 | #include <rdma/iw_cm.h> | 51 | #include <rdma/iw_cm.h> |
51 | #include <rdma/ib_addr.h> | 52 | #include <rdma/ib_addr.h> |
@@ -65,6 +66,20 @@ struct iwcm_work { | |||
65 | struct list_head free_list; | 66 | struct list_head free_list; |
66 | }; | 67 | }; |
67 | 68 | ||
69 | static unsigned int default_backlog = 256; | ||
70 | |||
71 | static struct ctl_table_header *iwcm_ctl_table_hdr; | ||
72 | static struct ctl_table iwcm_ctl_table[] = { | ||
73 | { | ||
74 | .procname = "default_backlog", | ||
75 | .data = &default_backlog, | ||
76 | .maxlen = sizeof(default_backlog), | ||
77 | .mode = 0644, | ||
78 | .proc_handler = proc_dointvec, | ||
79 | }, | ||
80 | { } | ||
81 | }; | ||
82 | |||
68 | /* | 83 | /* |
69 | * The following services provide a mechanism for pre-allocating iwcm_work | 84 | * The following services provide a mechanism for pre-allocating iwcm_work |
70 | * elements. The design pre-allocates them based on the cm_id type: | 85 | * elements. The design pre-allocates them based on the cm_id type: |
@@ -425,6 +440,9 @@ int iw_cm_listen(struct iw_cm_id *cm_id, int backlog) | |||
425 | 440 | ||
426 | cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); | 441 | cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); |
427 | 442 | ||
443 | if (!backlog) | ||
444 | backlog = default_backlog; | ||
445 | |||
428 | ret = alloc_work_entries(cm_id_priv, backlog); | 446 | ret = alloc_work_entries(cm_id_priv, backlog); |
429 | if (ret) | 447 | if (ret) |
430 | return ret; | 448 | return ret; |
@@ -1030,11 +1048,20 @@ static int __init iw_cm_init(void) | |||
1030 | if (!iwcm_wq) | 1048 | if (!iwcm_wq) |
1031 | return -ENOMEM; | 1049 | return -ENOMEM; |
1032 | 1050 | ||
1051 | iwcm_ctl_table_hdr = register_net_sysctl(&init_net, "net/iw_cm", | ||
1052 | iwcm_ctl_table); | ||
1053 | if (!iwcm_ctl_table_hdr) { | ||
1054 | pr_err("iw_cm: couldn't register sysctl paths\n"); | ||
1055 | destroy_workqueue(iwcm_wq); | ||
1056 | return -ENOMEM; | ||
1057 | } | ||
1058 | |||
1033 | return 0; | 1059 | return 0; |
1034 | } | 1060 | } |
1035 | 1061 | ||
1036 | static void __exit iw_cm_cleanup(void) | 1062 | static void __exit iw_cm_cleanup(void) |
1037 | { | 1063 | { |
1064 | unregister_net_sysctl_table(iwcm_ctl_table_hdr); | ||
1038 | destroy_workqueue(iwcm_wq); | 1065 | destroy_workqueue(iwcm_wq); |
1039 | } | 1066 | } |
1040 | 1067 | ||