2 * Copyright (C) 2009-2012 Cray, Inc.
4 * Copyright (c) 2014, Intel Corporation.
6 * Author: Nic Henke <nic@cray.com>, James Shimek <jshimek@cray.com>
8 * This file is part of Lustre, http://www.lustre.org.
10 * Lustre is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * Lustre is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with Lustre; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _GNILND_ARIES_H
25 #define _GNILND_ARIES_H
27 #include <lnet/lib-lnet.h>
29 #ifndef _GNILND_HSS_OPS_H
30 # error "must include gnilnd_hss_ops.h first"
33 /* Set HW related values */
35 #include <aries/aries_timeouts_gpl.h>
37 /* from aries_timeouts_gpl.h when building for generic kernel */
38 #define TIMEOUT_SECS(x) ((uint64_t)(((x) / 1000.0) + 0.5))
39 #ifndef TO_GNILND_timeout
40 #define TO_GNILND_timeout (60000.000000)
41 #endif /* TO_GNILND_timeout */
42 #endif /* CONFIG_CRAY_XT */
44 #define GNILND_BASE_TIMEOUT TIMEOUT_SECS(TO_GNILND_timeout)
45 #define GNILND_CHECKSUM_DEFAULT 0 /* all off for Aries */
47 #if defined(CONFIG_CRAY_COMPUTE)
48 #define GNILND_REVERSE_RDMA GNILND_REVERSE_PUT
49 #define GNILND_RDMA_DLVR_OPTION GNI_DLVMODE_PERFORMANCE
51 #define GNILND_REVERSE_RDMA GNILND_REVERSE_GET
52 #define GNILND_RDMA_DLVR_OPTION GNI_DLVMODE_PERFORMANCE
53 #define GNILND_SCHED_THREADS 7 /* scheduler threads */
56 /* Thread-safe kgni implemented in minor ver 45, code rev 0xb9 */
57 #define GNILND_KGNI_TS_MINOR_VER 0x45
58 #define GNILND_TS_ENABLE 1
60 /* register some memory to allocate a shared mdd */
61 static inline gni_return_t
62 kgnilnd_register_smdd_buf(kgn_device_t *dev)
64 __u32 flags = GNI_MEM_READWRITE;
66 if (*kgnilnd_tunables.kgn_bte_relaxed_ordering) {
67 flags |= GNI_MEM_RELAXED_PI_ORDERING;
70 LIBCFS_ALLOC(dev->gnd_smdd_hold_buf, PAGE_SIZE);
71 if (!dev->gnd_smdd_hold_buf) {
72 CERROR("Can't allocate smdd hold buffer\n");
73 return GNI_RC_ERROR_RESOURCE;
76 return kgnilnd_mem_register(dev->gnd_handle,
77 (__u64)dev->gnd_smdd_hold_buf,
78 PAGE_SIZE, NULL, flags,
79 &dev->gnd_smdd_hold_hndl);
82 static inline gni_return_t
83 kgnilnd_deregister_smdd_buf(kgn_device_t *dev)
85 gni_return_t rc = kgnilnd_mem_deregister(dev->gnd_handle,
86 &dev->gnd_smdd_hold_hndl, 0);
87 LIBCFS_FREE(dev->gnd_smdd_hold_buf, PAGE_SIZE);
92 #endif /* _GNILND_ARIES_H */