Skip to content

Commit c06a9fa

Browse files
Steve Wisegregkh
authored andcommitted
RDMA/iwcm: Use a default listen backlog if needed
commit 2f0304d upstream. 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> Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ad70570 commit c06a9fa

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎drivers/infiniband/core/iwcm.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <linux/completion.h>
4747
#include <linux/slab.h>
4848
#include <linux/module.h>
49+
#include <linux/sysctl.h>
4950

5051
#include <rdma/iw_cm.h>
5152
#include <rdma/ib_addr.h>
@@ -65,6 +66,20 @@ struct iwcm_work {
6566
struct list_head free_list;
6667
};
6768

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+
6883
/*
6984
* The following services provide a mechanism for pre-allocating iwcm_work
7085
* 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)
425440

426441
cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);
427442

443+
if (!backlog)
444+
backlog = default_backlog;
445+
428446
ret = alloc_work_entries(cm_id_priv, backlog);
429447
if (ret)
430448
return ret;
@@ -1030,11 +1048,20 @@ static int __init iw_cm_init(void)
10301048
if (!iwcm_wq)
10311049
return -ENOMEM;
10321050

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+
10331059
return 0;
10341060
}
10351061

10361062
static void __exit iw_cm_cleanup(void)
10371063
{
1064+
unregister_net_sysctl_table(iwcm_ctl_table_hdr);
10381065
destroy_workqueue(iwcm_wq);
10391066
}
10401067

0 commit comments

Comments
 (0)