Whamcloud - gitweb
- configurable stack size fo x86_64
[fs/lustre-release.git] / lnet / lnet / lib-ni.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * lib/lib-ni.c
5  * Network status registers and distance functions.
6  *
7  *  Copyright (c) 2001-2003 Cluster File Systems, Inc.
8  *  Copyright (c) 2001-2002 Sandia National Laboratories
9  *
10  *   This file is part of Lustre, http://www.sf.net/projects/lustre/
11  *
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.
15  *
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.
20  *
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.
24  */
25
26 #define DEBUG_SUBSYSTEM S_PORTALS
27 #include <portals/lib-p30.h>
28
29 #define MAX_DIST 18446744073709551615ULL
30
31 int lib_api_ni_status (nal_t *apinal, ptl_sr_index_t sr_idx,
32                        ptl_sr_value_t *status)
33 {
34         lib_nal_t      *nal = apinal->nal_data;
35         lib_ni_t       *ni = &nal->libnal_ni;
36         lib_counters_t *count = &ni->ni_counters;
37
38         switch (sr_idx) {
39         case PTL_SR_DROP_COUNT:
40                 *status = count->drop_count;
41                 return PTL_OK;
42         case PTL_SR_DROP_LENGTH:
43                 *status = count->drop_length;
44                 return PTL_OK;
45         case PTL_SR_RECV_COUNT:
46                 *status = count->recv_count;
47                 return PTL_OK;
48         case PTL_SR_RECV_LENGTH:
49                 *status = count->recv_length;
50                 return PTL_OK;
51         case PTL_SR_SEND_COUNT:
52                 *status = count->send_count;
53                 return PTL_OK;
54         case PTL_SR_SEND_LENGTH:
55                 *status = count->send_length;
56                 return PTL_OK;
57         case PTL_SR_MSGS_MAX:
58                 *status = count->msgs_max;
59                 return PTL_OK;
60         default:
61                 *status = 0;
62                 return PTL_SR_INDEX_INVALID;
63         }
64 }
65
66
67 int lib_api_ni_dist (nal_t *apinal, ptl_process_id_t *pid, unsigned long *dist)
68 {
69         lib_nal_t *nal = apinal->nal_data;
70
71         return (nal->libnal_dist(nal, pid->nid, dist));
72 }