Whamcloud - gitweb
LU-5928 obdclass: fix export of nodemap to procfs
[fs/lustre-release.git] / lnet / klnds / mxlnd / mxlnd_modparams.c
index 40e59ed..5da8d89 100644 (file)
@@ -1,7 +1,4 @@
 /*
- * -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -17,8 +14,8 @@
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
@@ -27,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
  * Copyright (C) 2006 Myricom, Inc.
@@ -48,9 +45,10 @@ static int n_waitd = MXLND_N_SCHED;
 CFS_MODULE_PARM(n_waitd, "i", int, 0444,
                 "# of completion daemons");
 
+/* this was used to allocate global rxs which are no londer used */
 static int max_peers = MXLND_MAX_PEERS;
 CFS_MODULE_PARM(max_peers, "i", int, 0444,
-                "maximum number of peers that may connect");
+                "Unused - was maximum number of peers that may connect");
 
 static int cksum = MXLND_CKSUM;
 CFS_MODULE_PARM(cksum, "i", int, 0644,
@@ -60,9 +58,14 @@ static int ntx = MXLND_NTX;
 CFS_MODULE_PARM(ntx, "i", int, 0444,
                 "# of total tx message descriptors");
 
-static int credits = MXLND_MSG_QUEUE_DEPTH;
+/* this duplicates ntx */
+static int credits = MXLND_NTX;
 CFS_MODULE_PARM(credits, "i", int, 0444,
-                "# concurrent sends");
+                "Unused - was # concurrent sends to all peers");
+
+static int peercredits = MXLND_MSG_QUEUE_DEPTH;
+CFS_MODULE_PARM(peercredits, "i", int, 0444,
+                "# concurrent sends to one peer");
 
 static int board = MXLND_MX_BOARD;
 CFS_MODULE_PARM(board, "i", int, 0444,
@@ -71,13 +74,17 @@ CFS_MODULE_PARM(board, "i", int, 0444,
 static int ep_id = MXLND_MX_EP_ID;
 CFS_MODULE_PARM(ep_id, "i", int, 0444, "MX endpoint ID");
 
+static char *ipif_name = "myri0";
+CFS_MODULE_PARM(ipif_name, "s", charp, 0444,
+                "IPoMX interface name");
+
 static int polling = MXLND_POLLING;
 CFS_MODULE_PARM(polling, "i", int, 0444,
                 "Use 0 to block (wait). A value > 0 will poll that many times before blocking");
 
 static char *hosts = NULL;
 CFS_MODULE_PARM(hosts, "s", charp, 0444,
-                "IP-to-hostname resolution file");
+                "Unused - was IP-to-hostname resolution file");
 
 kmx_tunables_t kmxlnd_tunables = {
         .kmx_n_waitd            = &n_waitd,
@@ -85,8 +92,162 @@ kmx_tunables_t kmxlnd_tunables = {
         .kmx_cksum              = &cksum,
         .kmx_ntx                = &ntx,
         .kmx_credits            = &credits,
+        .kmx_peercredits        = &peercredits,
         .kmx_board              = &board,
         .kmx_ep_id              = &ep_id,
-        .kmx_polling            = &polling,
-        .kmx_hosts              = &hosts
+        .kmx_default_ipif       = &ipif_name,
+        .kmx_polling            = &polling
+};
+
+#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+
+static char ipif_basename_space[32];
+
+static struct ctl_table kmxlnd_ctl_table[] = {
+       {
+               INIT_CTL_NAME
+               .procname       = "n_waitd",
+               .data           = &n_waitd,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "max_peers",
+               .data           = &max_peers,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "cksum",
+               .data           = &cksum,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "ntx",
+               .data           = &ntx,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "credits",
+               .data           = &credits,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "peercredits",
+               .data           = &peercredits,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "board",
+               .data           = &board,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "ep_id",
+               .data           = &ep_id,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       {
+               .procname       = "ipif_name",
+               .data           = ipif_basename_space,
+               .maxlen         = sizeof(ipif_basename_space),
+               .mode           = 0444,
+               .proc_handler   = &proc_dostring
+       },
+       {
+               INIT_CTL_NAME
+               .procname       = "polling",
+               .data           = &polling,
+               .maxlen         = sizeof(int),
+               .mode           = 0444,
+               .proc_handler   = &proc_dointvec
+       },
+       { 0 }
 };
+
+static struct ctl_table kmxlnd_top_ctl_table[] = {
+        {
+               INIT_CTL_NAME
+               .procname       = "mxlnd",
+               .data           = NULL,
+               .maxlen         = 0,
+               .mode           = 0555,
+               .child          = kmxlnd_ctl_table
+       },
+       { 0 }
+};
+
+void
+kmxlnd_initstrtunable(char *space, char *str, int size)
+{
+        strncpy(space, str, size);
+        space[size-1] = 0;
+}
+
+void
+kmxlnd_sysctl_init (void)
+{
+       kmxlnd_initstrtunable(ipif_basename_space, ipif_name,
+                             sizeof(ipif_basename_space));
+
+       kmxlnd_tunables.kib_sysctl =
+               register_sysctl_table(kmxlnd_top_ctl_table);
+
+       if (kmxlnd_tunables.kib_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
+}
+
+void
+kmxlnd_sysctl_fini (void)
+{
+       if (kmxlnd_tunables.kib_sysctl != NULL)
+               unregister_sysctl_table(kmxlnd_tunables.kib_sysctl);
+}
+
+#else
+
+void
+kmxlnd_sysctl_init (void)
+{
+}
+
+void
+kmxlnd_sysctl_fini (void)
+{
+}
+
+#endif
+
+int
+kmxlnd_tunables_init (void)
+{
+        kmxlnd_sysctl_init();
+        return 0;
+}
+
+void
+kmxlnd_tunables_fini (void)
+{
+        kmxlnd_sysctl_fini();
+}