1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (c) 2003 Los Alamos National Laboratory (LANL)
6 * This file is part of Lustre, http://www.lustre.org/
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 * -1 indicates default value.
27 * This is 1 thread per cpu
28 * See start_kernel_threads
30 int num_rx_threads = -1;
35 gmnal_cmd(struct portals_cfg *pcfg, void *private)
37 gmnal_ni_t *gmnalni = NULL;
41 gm_status_t gm_status;
44 CDEBUG(D_TRACE, "gmnal_cmd [%d] private [%p]\n",
45 pcfg->pcfg_command, private);
46 gmnalni = (gmnal_ni_t*)private;
47 switch(pcfg->pcfg_command) {
49 * just reuse already defined GET_NID. Should define GMNAL version
51 case(GMNAL_IOC_GET_GNID):
53 PORTAL_ALLOC(name, pcfg->pcfg_plen1);
54 copy_from_user(name, PCFG_PBUF(pcfg, 1), pcfg->pcfg_plen1);
56 spin_lock(&gmnalni->gmni_gm_lock);
57 //nid = gm_host_name_to_node_id(gmnalni->gmni_port, name);
58 gm_status = gm_host_name_to_node_id_ex(gmnalni->gmni_port, 0,
60 spin_unlock(&gmnalni->gmni_gm_lock);
61 if (gm_status != GM_SUCCESS) {
62 CDEBUG(D_NET, "gm_host_name_to_node_id_ex(...host %s) "
63 "failed[%d]\n", name, gm_status);
66 CDEBUG(D_NET, "Local node %s id is [%d]\n", name, nid);
67 spin_lock(&gmnalni->gmni_gm_lock);
68 gm_status = gm_node_id_to_global_id(gmnalni->gmni_port,
70 spin_unlock(&gmnalni->gmni_gm_lock);
71 if (gm_status != GM_SUCCESS) {
72 CDEBUG(D_NET, "gm_node_id_to_global_id failed[%d]\n",
76 CDEBUG(D_NET, "Global node is is [%u][%x]\n", gmid, gmid);
77 copy_to_user(PCFG_PBUF(pcfg, 2), &gmid, pcfg->pcfg_plen2);
80 CDEBUG(D_NET, "gmnal_cmd UNKNOWN[%d]\n", pcfg->pcfg_command);
93 CDEBUG(D_TRACE, "This is the gmnal module initialisation routine\n");
96 CDEBUG(D_NET, "Calling gmnal_init\n");
97 status = gmnal_init();
98 if (status == PTL_OK) {
99 CDEBUG(D_NET, "Portals GMNAL initialised ok\n");
101 CDEBUG(D_NET, "Portals GMNAL Failed to initialise\n");
105 CDEBUG(D_NET, "This is the end of the gmnal init routine");
119 module_init(gmnal_load);
121 module_exit(gmnal_unload);
123 MODULE_PARM(num_rx_threads, "i");
124 MODULE_PARM(num_stxds, "i");
125 MODULE_PARM(gm_port_id, "i");
127 MODULE_AUTHOR("Morgan Doyle");
129 MODULE_DESCRIPTION("A Portals kernel NAL for Myrinet GM.");
131 MODULE_LICENSE("GPL");