diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /net/tipc/node.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'net/tipc/node.h')
-rw-r--r-- | net/tipc/node.h | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/net/tipc/node.h b/net/tipc/node.h index 6f990da5d143..5c61afc7a0b9 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/tipc/node.h: Include file for TIPC node management routines | 2 | * net/tipc/node.h: Include file for TIPC node management routines |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2006, Ericsson AB |
5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005, 2010-2011, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -39,23 +39,22 @@ | |||
39 | 39 | ||
40 | #include "node_subscr.h" | 40 | #include "node_subscr.h" |
41 | #include "addr.h" | 41 | #include "addr.h" |
42 | #include "cluster.h" | 42 | #include "net.h" |
43 | #include "bearer.h" | 43 | #include "bearer.h" |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * struct tipc_node - TIPC node structure | 46 | * struct tipc_node - TIPC node structure |
47 | * @addr: network address of node | 47 | * @addr: network address of node |
48 | * @lock: spinlock governing access to structure | 48 | * @lock: spinlock governing access to structure |
49 | * @owner: pointer to cluster that node belongs to | 49 | * @hash: links to adjacent nodes in unsorted hash chain |
50 | * @next: pointer to next node in sorted list of cluster's nodes | 50 | * @list: links to adjacent nodes in sorted list of cluster's nodes |
51 | * @nsub: list of "node down" subscriptions monitoring node | 51 | * @nsub: list of "node down" subscriptions monitoring node |
52 | * @active_links: pointers to active links to node | 52 | * @active_links: pointers to active links to node |
53 | * @links: pointers to all links to node | 53 | * @links: pointers to all links to node |
54 | * @working_links: number of working links to node (both active and standby) | 54 | * @working_links: number of working links to node (both active and standby) |
55 | * @cleanup_required: non-zero if cleaning up after a prior loss of contact | ||
55 | * @link_cnt: number of links to node | 56 | * @link_cnt: number of links to node |
56 | * @permit_changeover: non-zero if node has redundant links to this system | 57 | * @permit_changeover: non-zero if node has redundant links to this system |
57 | * @routers: bitmap (used for multicluster communication) | ||
58 | * @last_router: (used for multicluster communication) | ||
59 | * @bclink: broadcast-related info | 58 | * @bclink: broadcast-related info |
60 | * @supported: non-zero if node supports TIPC b'cast capability | 59 | * @supported: non-zero if node supports TIPC b'cast capability |
61 | * @acked: sequence # of last outbound b'cast message acknowledged by node | 60 | * @acked: sequence # of last outbound b'cast message acknowledged by node |
@@ -71,16 +70,15 @@ | |||
71 | struct tipc_node { | 70 | struct tipc_node { |
72 | u32 addr; | 71 | u32 addr; |
73 | spinlock_t lock; | 72 | spinlock_t lock; |
74 | struct cluster *owner; | 73 | struct hlist_node hash; |
75 | struct tipc_node *next; | 74 | struct list_head list; |
76 | struct list_head nsub; | 75 | struct list_head nsub; |
77 | struct link *active_links[2]; | 76 | struct link *active_links[2]; |
78 | struct link *links[MAX_BEARERS]; | 77 | struct link *links[MAX_BEARERS]; |
79 | int link_cnt; | 78 | int link_cnt; |
80 | int working_links; | 79 | int working_links; |
80 | int cleanup_required; | ||
81 | int permit_changeover; | 81 | int permit_changeover; |
82 | u32 routers[512/32]; | ||
83 | int last_router; | ||
84 | struct { | 82 | struct { |
85 | int supported; | 83 | int supported; |
86 | u32 acked; | 84 | u32 acked; |
@@ -94,45 +92,35 @@ struct tipc_node { | |||
94 | } bclink; | 92 | } bclink; |
95 | }; | 93 | }; |
96 | 94 | ||
97 | extern struct tipc_node *tipc_nodes; | 95 | #define NODE_HTABLE_SIZE 512 |
96 | extern struct list_head tipc_node_list; | ||
97 | |||
98 | /* | ||
99 | * A trivial power-of-two bitmask technique is used for speed, since this | ||
100 | * operation is done for every incoming TIPC packet. The number of hash table | ||
101 | * entries has been chosen so that no hash chain exceeds 8 nodes and will | ||
102 | * usually be much smaller (typically only a single node). | ||
103 | */ | ||
104 | static inline unsigned int tipc_hashfn(u32 addr) | ||
105 | { | ||
106 | return addr & (NODE_HTABLE_SIZE - 1); | ||
107 | } | ||
108 | |||
98 | extern u32 tipc_own_tag; | 109 | extern u32 tipc_own_tag; |
99 | 110 | ||
111 | struct tipc_node *tipc_node_find(u32 addr); | ||
100 | struct tipc_node *tipc_node_create(u32 addr); | 112 | struct tipc_node *tipc_node_create(u32 addr); |
101 | void tipc_node_delete(struct tipc_node *n_ptr); | 113 | void tipc_node_delete(struct tipc_node *n_ptr); |
102 | struct tipc_node *tipc_node_attach_link(struct link *l_ptr); | 114 | void tipc_node_attach_link(struct tipc_node *n_ptr, struct link *l_ptr); |
103 | void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr); | 115 | void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr); |
104 | void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr); | 116 | void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr); |
105 | void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr); | 117 | void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr); |
106 | int tipc_node_has_active_links(struct tipc_node *n_ptr); | 118 | int tipc_node_active_links(struct tipc_node *n_ptr); |
107 | int tipc_node_has_redundant_links(struct tipc_node *n_ptr); | 119 | int tipc_node_redundant_links(struct tipc_node *n_ptr); |
108 | u32 tipc_node_select_router(struct tipc_node *n_ptr, u32 ref); | ||
109 | struct tipc_node *tipc_node_select_next_hop(u32 addr, u32 selector); | ||
110 | int tipc_node_is_up(struct tipc_node *n_ptr); | 120 | int tipc_node_is_up(struct tipc_node *n_ptr); |
111 | void tipc_node_add_router(struct tipc_node *n_ptr, u32 router); | ||
112 | void tipc_node_remove_router(struct tipc_node *n_ptr, u32 router); | ||
113 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); | 121 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); |
114 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); | 122 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); |
115 | 123 | ||
116 | static inline struct tipc_node *tipc_node_find(u32 addr) | ||
117 | { | ||
118 | if (likely(in_own_cluster(addr))) | ||
119 | return tipc_local_nodes[tipc_node(addr)]; | ||
120 | else if (tipc_addr_domain_valid(addr)) { | ||
121 | struct cluster *c_ptr = tipc_cltr_find(addr); | ||
122 | |||
123 | if (c_ptr) | ||
124 | return c_ptr->nodes[tipc_node(addr)]; | ||
125 | } | ||
126 | return NULL; | ||
127 | } | ||
128 | |||
129 | static inline struct tipc_node *tipc_node_select(u32 addr, u32 selector) | ||
130 | { | ||
131 | if (likely(in_own_cluster(addr))) | ||
132 | return tipc_local_nodes[tipc_node(addr)]; | ||
133 | return tipc_node_select_next_hop(addr, selector); | ||
134 | } | ||
135 | |||
136 | static inline void tipc_node_lock(struct tipc_node *n_ptr) | 124 | static inline void tipc_node_lock(struct tipc_node *n_ptr) |
137 | { | 125 | { |
138 | spin_lock_bh(&n_ptr->lock); | 126 | spin_lock_bh(&n_ptr->lock); |