1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2009-2012 Cray, Inc.
5 * Author: Nic Henke <nic@cray.com>, James Shimek <jshimek@cray.com>
7 * This file is part of Lustre, http://www.lustre.org.
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.
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.
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.
23 #ifndef _GNILND_ARIES_H
24 #define _GNILND_ARIES_H
26 /* for libcfs_ipif_query */
27 #include <libcfs/libcfs.h>
29 #ifndef _GNILND_HSS_OPS_H
30 # error "must include gnilnd_hss_ops.h first"
33 /* Set HW related values */
34 #include <aries/aries_timeouts_gpl.h>
36 #define GNILND_BASE_TIMEOUT TIMEOUT_SECS(TO_GNILND_timeout)
37 #define GNILND_CHECKSUM_DEFAULT 0 /* all off for Aries */
39 #if defined(CONFIG_CRAY_COMPUTE)
40 #define GNILND_REVERSE_RDMA GNILND_REVERSE_PUT
41 #define GNILND_RDMA_DLVR_OPTION GNI_DLVMODE_PERFORMANCE
43 #define GNILND_REVERSE_RDMA GNILND_REVERSE_GET
44 #define GNILND_RDMA_DLVR_OPTION GNI_DLVMODE_PERFORMANCE
47 /* plug in our functions for use on the simulator */
48 #if !defined(GNILND_USE_RCA)
50 extern kgn_data_t kgnilnd_data;
52 #define kgnilnd_hw_hb() do {} while(0)
54 /* Aries Sim doesn't have hardcoded tables, so we'll hijack the nic_pe
55 * and decode our address and nic addr from that - the rest are just offsets */
58 kgnilnd_nid_to_nicaddrs(__u32 nid, int numnic, __u32 *nicaddr)
61 CERROR("manual nid2nic translation doesn't support"
62 "multiple nic addrs (you asked for %d)\n",
66 if (nid < kgnilnd_data.kgn_nid_trans_private) {
67 CERROR("Request for invalid nid translation %u, minimum %Lu\n",
68 nid, kgnilnd_data.kgn_nid_trans_private);
72 *nicaddr = nid - kgnilnd_data.kgn_nid_trans_private;
74 CDEBUG(D_NETTRACE, "Sim nid %d -> nic 0x%x\n", nid, *nicaddr);
80 kgnilnd_nicaddr_to_nid(__u32 nicaddr, __u32 *nid)
82 *nid = kgnilnd_data.kgn_nid_trans_private + nicaddr;
86 /* XXX Nic: This does not support multiple device!!!! */
88 kgnilnd_setup_nic_translation(__u32 device_id)
90 char *if_name = "ipogif0";
91 __u32 ipaddr, netmask, my_nid;
94 LCONSOLE_INFO("using Aries SIM IP info for RCA translation\n");
96 rc = libcfs_ipif_query(if_name, &up, &ipaddr, &netmask);
98 CERROR ("can't get IP interface for %s: %d\n", if_name, rc);
102 CERROR ("IP interface %s is down\n", if_name);
106 my_nid = ((ipaddr >> 8) & 0xFF) + (ipaddr & 0xFF);
108 kgnilnd_data.kgn_nid_trans_private = my_nid - device_id;
113 #endif /* GNILND_USE_RCA */
115 #endif /* _GNILND_ARIES_H */