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.
25 int gmnal_small_msg_size = GMNAL_MSGHDR_SIZE + sizeof(ptl_hdr_t) + PTL_MTU + 928;
27 * -1 indicates default value.
28 * This is 1 thread per cpu
29 * See start_kernel_threads
31 int num_rx_threads = -1;
36 gmnal_cmd(struct portals_cfg *pcfg, void *private)
38 gmnal_data_t *nal_data = NULL;
42 gm_status_t gm_status;
45 CDEBUG(D_TRACE, "gmnal_cmd [%d] private [%p]\n",
46 pcfg->pcfg_command, private);
47 nal_data = (gmnal_data_t*)private;
48 switch(pcfg->pcfg_command) {
50 * just reuse already defined GET_NID. Should define GMNAL version
52 case(GMNAL_IOC_GET_GNID):
54 PORTAL_ALLOC(name, pcfg->pcfg_plen1);
55 copy_from_user(name, PCFG_PBUF(pcfg, 1), pcfg->pcfg_plen1);
57 GMNAL_GM_LOCK(nal_data);
58 //nid = gm_host_name_to_node_id(nal_data->gm_port, name);
59 gm_status = gm_host_name_to_node_id_ex(nal_data->gm_port, 0,
61 GMNAL_GM_UNLOCK(nal_data);
62 if (gm_status != GM_SUCCESS) {
63 CDEBUG(D_INFO, "gm_host_name_to_node_id_ex(...host %s) "
64 "failed[%d]\n", name, gm_status);
67 CDEBUG(D_INFO, "Local node %s id is [%d]\n", name, nid);
68 GMNAL_GM_LOCK(nal_data);
69 gm_status = gm_node_id_to_global_id(nal_data->gm_port,
71 GMNAL_GM_UNLOCK(nal_data);
72 if (gm_status != GM_SUCCESS) {
73 CDEBUG(D_INFO, "gm_node_id_to_global_id failed[%d]\n",
77 CDEBUG(D_INFO, "Global node is is [%u][%x]\n", gnid, gnid);
78 copy_to_user(PCFG_PBUF(pcfg, 2), &gnid, pcfg->pcfg_plen2);
81 CDEBUG(D_INFO, "gmnal_cmd UNKNOWN[%d]\n", pcfg->pcfg_command);
94 CDEBUG(D_TRACE, "This is the gmnal module initialisation routine\n");
97 CDEBUG(D_INFO, "Calling gmnal_init\n");
98 status = gmnal_init();
99 if (status == PTL_OK) {
100 CDEBUG(D_INFO, "Portals GMNAL initialised ok\n");
102 CDEBUG(D_INFO, "Portals GMNAL Failed to initialise\n");
106 CDEBUG(D_INFO, "This is the end of the gmnal init routine");
120 module_init(gmnal_load);
122 module_exit(gmnal_unload);
124 MODULE_PARM(gmnal_small_msg_size, "i");
125 MODULE_PARM(num_rx_threads, "i");
126 MODULE_PARM(num_stxds, "i");
127 MODULE_PARM(gm_port_id, "i");
129 MODULE_AUTHOR("Morgan Doyle");
131 MODULE_DESCRIPTION("A Portals kernel NAL for Myrinet GM.");
133 MODULE_LICENSE("GPL");