Whamcloud - gitweb
- merge 0.7rc1 from b_devel to HEAD (20030612 merge point)
[fs/lustre-release.git] / lustre / portals / router / router.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2002 Cluster File Systems, Inc.
5  *
6  *   This file is part of Portals
7  *   http://sourceforge.net/projects/sandiaportals/
8  *
9  *   Portals is free software; you can redistribute it and/or
10  *   modify it under the terms of version 2 of the GNU General Public
11  *   License as published by the Free Software Foundation.
12  *
13  *   Portals is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with Portals; if not, write to the Free Software
20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */
23
24 #ifndef _KPTLROUTER_H
25 #define _KPTLROUTER_H
26 #define EXPORT_SYMTAB
27
28 #include <linux/config.h>
29 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/mm.h>
32 #include <linux/string.h>
33 #include <linux/errno.h>
34 #include <linux/proc_fs.h>
35 #include <linux/init.h>
36
37 #define DEBUG_SUBSYSTEM S_PTLROUTER
38
39 #include <linux/kp30.h>
40 #include <portals/p30.h>
41 #include <portals/lib-p30.h>
42
43 typedef struct
44 {
45         struct list_head        kpne_list;
46         kpr_nal_interface_t     kpne_interface;
47         atomic_t                kpne_refcount;
48         int                     kpne_shutdown;
49 } kpr_nal_entry_t;
50
51 typedef struct
52 {
53         struct list_head        kpre_list;
54         int                     kpre_gateway_nalid;
55         ptl_nid_t               kpre_gateway_nid;
56         ptl_nid_t               kpre_lo_nid;
57         ptl_nid_t               kpre_hi_nid;
58 } kpr_route_entry_t;
59
60 extern int kpr_register_nal (kpr_nal_interface_t *nalif, void **argp);
61 extern int kpr_lookup_target (void *arg, ptl_nid_t target_nid, ptl_nid_t *gateway_nidp);
62 extern void kpr_forward_packet (void *arg, kpr_fwd_desc_t *fwd);
63 extern void kpr_complete_packet (void *arg, kpr_fwd_desc_t *fwd, int error);
64 extern void kpr_shutdown_nal (void *arg);
65 extern void kpr_deregister_nal (void *arg);
66
67 extern void kpr_proc_init (void);
68 extern void kpr_proc_fini (void);
69
70 extern int kpr_add_route (int gateway_nal, ptl_nid_t gateway_nid, 
71                           ptl_nid_t lo_nid, ptl_nid_t hi_nid);
72 extern int kpr_del_route (ptl_nid_t nid);
73 extern int kpr_get_route (int idx, int *gateway_nal, ptl_nid_t *gateway_nid, 
74                           ptl_nid_t *lo_nid, ptl_nid_t *hi_nid);
75
76 extern unsigned long long kpr_fwd_bytes;
77 extern unsigned long      kpr_fwd_packets;
78 extern unsigned long      kpr_fwd_errors;
79 extern atomic_t           kpr_queue_depth;
80
81 #endif /* _KPLROUTER_H */