OpenMPI  0.1.1
btl_tcp_proc.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2006 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 #ifndef MCA_BTL_TCP_PROC_H
21 #define MCA_BTL_TCP_PROC_H
22 
23 #include "opal/class/opal_object.h"
24 #include "ompi/proc/proc.h"
25 #include "orte/types.h"
26 #include "btl_tcp.h"
27 #include "btl_tcp_addr.h"
28 #include "btl_tcp_endpoint.h"
29 
30 BEGIN_C_DECLS
31 
32 /**
33  * Represents the state of a remote process and the set of addresses
34  * that it exports. Also cache an instance of mca_btl_base_endpoint_t for
35  * each
36  * BTL instance that attempts to open a connection to the process.
37  */
40  /**< allow proc to be placed on a list */
41 
43  /**< pointer to corresponding ompi_proc_t */
44 
46  /**< array of addresses exported by peer */
47 
48  size_t proc_addr_count;
49  /**< number of addresses published by endpoint */
50 
52  /**< array of endpoints that have been created to access this proc */
53 
55  /**< number of endpoints */
56 
58  /**< lock to protect against concurrent access to proc state */
59 };
62 
63 /* the highest possible interface kernel index we can handle */
64 #define MAX_KERNEL_INTERFACE_INDEX 65536
65 
66 /* the maximum number of kernel interfaces we can handle */
67 #define MAX_KERNEL_INTERFACES 8
68 
69 /* The maximum number of interfaces that we can have and use the
70  * recursion code for determining the best set of connections. When
71  * the number is greater than this, we switch to a simpler algorithm
72  * to speed things up. */
73 #define MAX_PERMUTATION_INTERFACES 8
74 
75 /*
76  * FIXME: this should probably be part of an ompi list, so we need the
77  * appropriate definitions
78  */
79 
81  struct sockaddr_storage* ipv4_address;
82  struct sockaddr_storage* ipv6_address;
83  mca_btl_tcp_addr_t* ipv4_endpoint_addr;
84  mca_btl_tcp_addr_t* ipv6_endpoint_addr;
85  uint32_t ipv4_netmask;
86  uint32_t ipv6_netmask;
87  int kernel_index;
88  int peer_interface;
89  int index;
90  int inuse;
91 };
92 
94 
95 /*
96  * describes the quality of a possible connection between a local and
97  * a remote network interface
98  */
99 enum mca_btl_tcp_connection_quality {
100  CQ_NO_CONNECTION,
101  CQ_PRIVATE_DIFFERENT_NETWORK,
102  CQ_PRIVATE_SAME_NETWORK,
103  CQ_PUBLIC_DIFFERENT_NETWORK,
104  CQ_PUBLIC_SAME_NETWORK
105 };
106 
107 
108 mca_btl_tcp_proc_t* mca_btl_tcp_proc_create(ompi_proc_t* ompi_proc);
109 mca_btl_tcp_proc_t* mca_btl_tcp_proc_lookup(const orte_process_name_t* name);
110 int mca_btl_tcp_proc_insert(mca_btl_tcp_proc_t*, mca_btl_base_endpoint_t*);
111 int mca_btl_tcp_proc_remove(mca_btl_tcp_proc_t*, mca_btl_base_endpoint_t*);
112 bool mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t*, struct sockaddr*, int);
113 bool mca_btl_tcp_proc_tosocks(mca_btl_tcp_addr_t*, struct sockaddr_storage*);
114 
115 /**
116  * Inlined function to return local TCP proc instance.
117  */
118 
119 static inline mca_btl_tcp_proc_t* mca_btl_tcp_proc_local(void)
120 {
121  if(NULL == mca_btl_tcp_component.tcp_local)
122  mca_btl_tcp_component.tcp_local = mca_btl_tcp_proc_create(ompi_proc_local());
123  return mca_btl_tcp_component.tcp_local;
124 }
125 
126 END_C_DECLS
127 #endif
opal_mutex_t proc_lock
lock to protect against concurrent access to proc state
Definition: btl_tcp_proc.h:57
size_t proc_addr_count
number of addresses published by endpoint
Definition: btl_tcp_proc.h:48
static ompi_proc_t * ompi_proc_local(void)
Returns a pointer to the local process.
Definition: proc.h:225
Definition: types.h:146
struct mca_btl_tcp_addr_t * proc_addrs
array of addresses exported by peer
Definition: btl_tcp_proc.h:45
ompi_proc_t * proc_ompi
pointer to corresponding ompi_proc_t
Definition: btl_tcp_proc.h:42
Definition: mutex_unix.h:53
Represents the state of a remote process and the set of addresses that it exports.
Definition: btl_tcp_proc.h:38
Structure used to publish TCP connection information to peers.
Definition: btl_tcp_addr.h:39
Process identification structure interface.
Remote Open MPI process structure.
Definition: proc.h:56
Definition: opal_list.h:98
Definition: util-internal.h:214
State of ELAN endpoint connection.
Definition: btl_elan_endpoint.h:33
struct mca_btl_base_endpoint_t ** proc_endpoints
array of endpoints that have been created to access this proc
Definition: btl_tcp_proc.h:51
Definition: btl_tcp_proc.h:80
size_t proc_endpoint_count
number of endpoints
Definition: btl_tcp_proc.h:54
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
struct mca_btl_tcp_proc_t * tcp_local
local proc struct
Definition: btl_tcp.h:59
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
opal_list_item_t super
allow proc to be placed on a list
Definition: btl_tcp_proc.h:39