1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
5 * Network status registers and distance functions.
7 * Copyright (c) 2001-2003 Cluster File Systems, Inc.
8 * Copyright (c) 2001-2002 Sandia National Laboratories
10 * This file is part of Lustre, http://www.sf.net/projects/lustre/
12 * Lustre is free software; you can redistribute it and/or
13 * modify it under the terms of version 2 of the GNU General Public
14 * License as published by the Free Software Foundation.
16 * Lustre is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with Lustre; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #define DEBUG_SUBSYSTEM S_PORTALS
27 #include <portals/lib-p30.h>
28 #include <portals/arg-blocks.h>
30 #define MAX_DIST 18446744073709551615UL
32 int do_PtlNIDebug(nal_cb_t * nal, void *private, void *v_args, void *v_ret)
34 PtlNIDebug_in *args = v_args;
35 PtlNIDebug_out *ret = v_ret;
36 lib_ni_t *ni = &nal->ni;
39 ni->debug = args->mask_in;
44 int do_PtlNIStatus(nal_cb_t * nal, void *private, void *v_args, void *v_ret)
48 * ptl_handle_ni_t interface_in
49 * ptl_sr_index_t register_in
52 * ptl_sr_value_t * status_out
55 PtlNIStatus_in *args = v_args;
56 PtlNIStatus_out *ret = v_ret;
57 lib_ni_t *ni = &nal->ni;
58 lib_counters_t *count = &ni->counters;
61 return ret->rc = PTL_SEGV;
67 * I hate this sort of code.... Hash tables, offset lists?
68 * Treat the counters as an array of ints?
70 if (args->register_in == PTL_SR_DROP_COUNT)
71 ret->status_out = count->drop_count;
73 else if (args->register_in == PTL_SR_DROP_LENGTH)
74 ret->status_out = count->drop_length;
76 else if (args->register_in == PTL_SR_RECV_COUNT)
77 ret->status_out = count->recv_count;
79 else if (args->register_in == PTL_SR_RECV_LENGTH)
80 ret->status_out = count->recv_length;
82 else if (args->register_in == PTL_SR_SEND_COUNT)
83 ret->status_out = count->send_count;
85 else if (args->register_in == PTL_SR_SEND_LENGTH)
86 ret->status_out = count->send_length;
88 else if (args->register_in == PTL_SR_MSGS_MAX)
89 ret->status_out = count->msgs_max;
91 ret->rc = PTL_INV_SR_INDX;
97 int do_PtlNIDist(nal_cb_t * nal, void *private, void *v_args, void *v_ret)
101 * ptl_handle_ni_t interface_in
102 * ptl_process_id_t process_in
106 * unsigned long * distance_out
110 PtlNIDist_in *args = v_args;
111 PtlNIDist_out *ret = v_ret;
114 ptl_process_id_t id_in = args->process_in;
120 if ((rc = nal->cb_dist(nal, nid, &dist)) != 0) {
121 ret->distance_out = (unsigned long) MAX_DIST;
125 ret->distance_out = dist;
127 return ret->rc = PTL_OK;