Whamcloud - gitweb
Land b1_2 onto HEAD (20040304_171022)
[fs/lustre-release.git] / lnet / ulnds / procbridge.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (c) 2002 Cray Inc.
5  *  Copyright (c) 2003 Cluster File Systems, Inc.
6  *
7  *   This file is part of Portals, http://www.sf.net/projects/sandiaportals/
8  */
9
10 #ifndef _PROCBRIDGE_H_
11 #define _PROCBRIDGE_H_
12
13 #include <pthread.h>
14 #include <bridge.h>
15 #include <ipmap.h>
16
17
18 #define NAL_FLAG_RUNNING        1
19 #define NAL_FLAG_STOPPING       2
20 #define NAL_FLAG_STOPPED        4
21
22 typedef struct procbridge {
23     /* sync between user threads and nal thread */
24     pthread_t t;
25     pthread_cond_t cond;
26     pthread_mutex_t mutex;
27
28     /* socket pair used to notify nal thread */
29     int notifier[2];
30
31     int nal_flags;
32
33     pthread_mutex_t nal_cb_lock;
34 } *procbridge;
35
36 typedef struct nal_init_args {
37     ptl_pid_t        nia_requested_pid;
38     ptl_ni_limits_t *nia_limits;
39     int              nia_nal_type;
40     bridge           nia_bridge;
41 } nal_init_args_t;
42
43 extern void *nal_thread(void *);
44
45
46 #define PTL_INIT        (LIB_MAX_DISPATCH+1)
47 #define PTL_FINI        (LIB_MAX_DISPATCH+2)
48
49 #define MAX_ACLS        1
50 #define MAX_PTLS        128
51
52 extern void set_address(bridge t,ptl_pid_t pidrequest);
53 extern nal_t *procbridge_interface(int num_interface,
54                                    ptl_pt_index_t ptl_size,
55                                    ptl_ac_index_t acl_size,
56                                    ptl_pid_t requested_pid);
57 extern void procbridge_wakeup_nal(procbridge p);
58
59 #endif