Whamcloud - gitweb
LU-7850 gnilnd: Fix niov calculation with offset kiov
[fs/lustre-release.git] / lnet / klnds / gnilnd / gnilnd_hss_ops.h
1 /*
2  * Copyright (C) 2009-2012 Cray, Inc.
3  *
4  *   Author: Nic Henke <nic@cray.com>
5  *   Author: James Shimek <jshimek@cray.com>
6  *
7  *   This file is part of Lustre, http://www.lustre.org.
8  *
9  *   Lustre 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  *   Lustre 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 Lustre; if not, write to the Free Software
20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */
23 #ifndef _GNILND_HSS_OPS_H
24 #define _GNILND_HSS_OPS_H
25
26 #include <linux/typecheck.h>
27
28 #if defined(GNILND_USE_RCA)
29 /* for krca nid & nic translation */
30 #include <krca_lib.h>
31
32 /* it isn't exported, so just point directly to it */
33 extern void send_hb_2_l0(void);
34
35 static inline void
36 kgnilnd_hw_hb(void)
37 {
38         send_hb_2_l0();
39 }
40
41 /* we use RCA types here to get the compiler to whine when we have
42  * mismatched types */
43 static inline int
44 kgnilnd_nid_to_nicaddrs(rca_nid_t nid, int numnic, nic_addr_t *nicaddrs)
45 {
46         int     rc;
47
48         /* compile time checks to ensure that the RCA types match
49          * the LNet idea of NID and NIC */
50         typecheck(__u32, nid);
51         typecheck(__u32, *nicaddrs);
52
53         rc = krca_nid_to_nicaddrs(nid, numnic, nicaddrs);
54
55         CDEBUG(D_NETTRACE, "RCA nid %d -> nic 0x%x, rc: %d\n",
56                nid, nicaddrs[0], rc);
57
58         RETURN(rc);
59 }
60
61 static inline int
62 kgnilnd_nicaddr_to_nid(nic_addr_t nicaddr, rca_nid_t *nid)
63 {
64         /* compile time checks to ensure that the RCA types match
65          * the LNet idea of NID and NIC */
66         typecheck(__u32, nicaddr);
67         typecheck(__u32, nid[0]);
68
69         return krca_nicaddr_to_nid(nicaddr, nid);
70 }
71
72 static inline int
73 kgnilnd_setup_nic_translation(__u32 device_id)
74 {
75         return 0;
76 }
77
78 #endif /* GNILND_USE_RCA */
79
80 #endif /* _GNILND_HSS_OPS_H */