Whamcloud - gitweb
b=2776
[fs/lustre-release.git] / lnet / klnds / scimaclnd / scimacnal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:cindent:
3  *
4  * Copyright (C) 2003 High Performance Computing Center North (HPC2N)
5  *   Author: Niklas Edmundsson <nikke@hpc2n.umu.se>
6  */
7
8
9 #ifndef _SCIMACNAL_H
10 #define _SCIMACNAL_H
11
12 #include <linux/config.h>
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/mm.h>
16 #include <linux/string.h>
17 #include <linux/stat.h>
18 #include <linux/errno.h>
19 #include <linux/locks.h>
20 #include <linux/unistd.h>
21 #include <linux/init.h>
22
23 #include <asm/system.h>
24 #include <asm/uaccess.h>
25
26 #include <linux/fs.h>
27 #include <linux/file.h>
28 #include <linux/stat.h>
29 #include <linux/list.h>
30 #include <asm/uaccess.h>
31 #include <asm/segment.h>
32 #include <asm/page.h>            /* For PAGE_SIZE */
33
34 #define DEBUG_SUBSYSTEM S_UNDEFINED
35
36 #include <linux/kp30.h>
37 #include <linux/kpr.h>
38 #include <portals/p30.h>
39 #include <portals/lib-p30.h>
40
41 #include <scamac.h>
42
43 #ifndef MAC_SAPID_LUSTRE
44 #define MAC_SAPID_LUSTRE MAC_SAPID_TEST1
45 #endif /* MAC_SAPID_LUSTRE */
46
47 /* scimac has an annoying MTU limit of 64k */
48 #define SCIMACNAL_MTU 65536
49 #if PTL_MTU > SCIMACNAL_MTU
50 #error Max MTU of ScaMAC is 64k, PTL_MTU is bigger.
51 #endif
52
53 typedef struct {
54         mac_handle_t    *handle;
55         mac_mblk_t      *msg;
56         mac_msg_type_t   type;
57         void            *userdata;
58 }  kscimacnal_rx_t;
59
60
61 typedef struct {
62         nal_cb_t        *ktx_nal;
63         void            *ktx_private;
64         lib_msg_t       *ktx_cookie;
65         ptl_hdr_t       ktx_hdr;
66         /* To be able to kunmap() kmap():ed pages */
67         struct page     *ktx_kpages[PTL_MD_MAX_IOV];
68         int              ktx_nmapped;
69 }  kscimacnal_tx_t;
70
71
72 typedef struct {
73         char              ksci_init;
74         char              ksci_shuttingdown;
75         ptl_nid_t         ksci_nid;
76         nal_cb_t         *ksci_cb;
77         spinlock_t        ksci_dispatch_lock;
78         mac_handle_t     *ksci_machandle;
79 }  kscimacnal_data_t;
80
81 extern kscimacnal_data_t   kscimacnal_data;
82 extern nal_t            kscimacnal_api;
83 extern nal_cb_t         kscimacnal_lib;
84
85 void kscimacnal_fwd_packet (void *arg, kpr_fwd_desc_t *fwd);
86 void kscimacnal_rx(mac_handle_t *handle, mac_mblk_t *msg, mac_msg_type_t type, void *userdata);
87
88
89 #endif  /* _SCIMACNAL_H */