Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lnet / ulnds / ipmap.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (c) 2002 Cray Inc.
5  *
6  *   This file is part of Portals, http://www.sf.net/projects/sandiaportals/
7  */
8
9 #define DIRECT_IP_MODE
10 #ifdef DIRECT_IP_MODE
11 #define PNAL_NID(in_addr, port) (in_addr)
12 #define PNAL_PID(pid) (pid)
13 #define PNAL_IP(in_addr, port) (in_addr)
14 #define PNAL_PORT(nid, pid) (pid)
15 #else
16
17 #define PNAL_BASE_PORT 4096
18 #define PNAL_HOSTID_SHIFT 24
19 #define PNAL_HOSTID_MASK ((1 << PNAL_HOSTID_SHIFT) - 1)
20 #define PNAL_VNODE_SHIFT 8
21 #define PNAL_VNODE_MASK ((1 << PNAL_VNODE_SHIFT) - 1)
22 #define PNAL_PID_SHIFT 8
23 #define PNAL_PID_MASK ((1 << PNAL_PID_SHIFT) - 1)
24
25 #define PNAL_NID(in_addr, port) (((ntohl(in_addr) & PNAL_HOSTID_MASK) \
26                                     << PNAL_VNODE_SHIFT) \
27                                    | (((ntohs(port)-PNAL_BASE_PORT) >>\
28                                        PNAL_PID_SHIFT)))
29 #define PNAL_PID(port) ((ntohs(port) - PNAL_BASE_PORT)  & PNAL_PID_MASK)
30
31 #define PNAL_IP(nid,t)  (htonl((((unsigned)(nid))\
32                                 >> PNAL_VNODE_SHIFT)\
33                                | (t->iptop8 << PNAL_HOSTID_SHIFT)))
34 #define PNAL_PORT(nid, pid) (htons(((((nid) & PNAL_VNODE_MASK) \
35                                  << PNAL_VNODE_SHIFT) \
36                                 | ((pid) & PNAL_PID_MASK)) \
37                                + PNAL_BASE_PORT))
38 #endif