diff options
Diffstat (limited to 'net/tipc/node.h')
| -rw-r--r-- | net/tipc/node.h | 88 |
1 files changed, 51 insertions, 37 deletions
diff --git a/net/tipc/node.h b/net/tipc/node.h index 7cbb8cec1a93..9087063793f2 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
| @@ -47,62 +47,73 @@ | |||
| 47 | */ | 47 | */ |
| 48 | #define INVALID_NODE_SIG 0x10000 | 48 | #define INVALID_NODE_SIG 0x10000 |
| 49 | 49 | ||
| 50 | /* Flags used to block (re)establishment of contact with a neighboring node */ | 50 | /* Flags used to take different actions according to flag type |
| 51 | #define WAIT_PEER_DOWN 0x0001 /* wait to see that peer's links are down */ | 51 | * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down |
| 52 | #define WAIT_NAMES_GONE 0x0002 /* wait for peer's publications to be purged */ | 52 | * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down |
| 53 | #define WAIT_NODE_DOWN 0x0004 /* wait until peer node is declared down */ | 53 | * TIPC_NOTIFY_NODE_DOWN: notify node is down |
| 54 | * TIPC_NOTIFY_NODE_UP: notify node is up | ||
| 55 | */ | ||
| 56 | enum { | ||
| 57 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), | ||
| 58 | TIPC_WAIT_OWN_LINKS_DOWN = (1 << 2), | ||
| 59 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), | ||
| 60 | TIPC_NOTIFY_NODE_UP = (1 << 4) | ||
| 61 | }; | ||
| 62 | |||
| 63 | /** | ||
| 64 | * struct tipc_node_bclink - TIPC node bclink structure | ||
| 65 | * @acked: sequence # of last outbound b'cast message acknowledged by node | ||
| 66 | * @last_in: sequence # of last in-sequence b'cast message received from node | ||
| 67 | * @last_sent: sequence # of last b'cast message sent by node | ||
| 68 | * @oos_state: state tracker for handling OOS b'cast messages | ||
| 69 | * @deferred_size: number of OOS b'cast messages in deferred queue | ||
| 70 | * @deferred_head: oldest OOS b'cast message received from node | ||
| 71 | * @deferred_tail: newest OOS b'cast message received from node | ||
| 72 | * @reasm_buf: broadcast reassembly queue head from node | ||
| 73 | * @recv_permitted: true if node is allowed to receive b'cast messages | ||
| 74 | */ | ||
| 75 | struct tipc_node_bclink { | ||
| 76 | u32 acked; | ||
| 77 | u32 last_in; | ||
| 78 | u32 last_sent; | ||
| 79 | u32 oos_state; | ||
| 80 | u32 deferred_size; | ||
| 81 | struct sk_buff *deferred_head; | ||
| 82 | struct sk_buff *deferred_tail; | ||
| 83 | struct sk_buff *reasm_buf; | ||
| 84 | bool recv_permitted; | ||
| 85 | }; | ||
| 54 | 86 | ||
| 55 | /** | 87 | /** |
| 56 | * struct tipc_node - TIPC node structure | 88 | * struct tipc_node - TIPC node structure |
| 57 | * @addr: network address of node | 89 | * @addr: network address of node |
| 58 | * @lock: spinlock governing access to structure | 90 | * @lock: spinlock governing access to structure |
| 59 | * @hash: links to adjacent nodes in unsorted hash chain | 91 | * @hash: links to adjacent nodes in unsorted hash chain |
| 60 | * @list: links to adjacent nodes in sorted list of cluster's nodes | ||
| 61 | * @nsub: list of "node down" subscriptions monitoring node | ||
| 62 | * @active_links: pointers to active links to node | 92 | * @active_links: pointers to active links to node |
| 63 | * @links: pointers to all links to node | 93 | * @links: pointers to all links to node |
| 94 | * @action_flags: bit mask of different types of node actions | ||
| 95 | * @bclink: broadcast-related info | ||
| 96 | * @list: links to adjacent nodes in sorted list of cluster's nodes | ||
| 64 | * @working_links: number of working links to node (both active and standby) | 97 | * @working_links: number of working links to node (both active and standby) |
| 65 | * @block_setup: bit mask of conditions preventing link establishment to node | ||
| 66 | * @link_cnt: number of links to node | 98 | * @link_cnt: number of links to node |
| 67 | * @signature: node instance identifier | 99 | * @signature: node instance identifier |
| 68 | * @bclink: broadcast-related info | 100 | * @nsub: list of "node down" subscriptions monitoring node |
| 69 | * @rcu: rcu struct for tipc_node | 101 | * @rcu: rcu struct for tipc_node |
| 70 | * @acked: sequence # of last outbound b'cast message acknowledged by node | ||
| 71 | * @last_in: sequence # of last in-sequence b'cast message received from node | ||
| 72 | * @last_sent: sequence # of last b'cast message sent by node | ||
| 73 | * @oos_state: state tracker for handling OOS b'cast messages | ||
| 74 | * @deferred_size: number of OOS b'cast messages in deferred queue | ||
| 75 | * @deferred_head: oldest OOS b'cast message received from node | ||
| 76 | * @deferred_tail: newest OOS b'cast message received from node | ||
| 77 | * @reasm_head: broadcast reassembly queue head from node | ||
| 78 | * @reasm_tail: last broadcast fragment received from node | ||
| 79 | * @recv_permitted: true if node is allowed to receive b'cast messages | ||
| 80 | */ | 102 | */ |
| 81 | struct tipc_node { | 103 | struct tipc_node { |
| 82 | u32 addr; | 104 | u32 addr; |
| 83 | spinlock_t lock; | 105 | spinlock_t lock; |
| 84 | struct hlist_node hash; | 106 | struct hlist_node hash; |
| 85 | struct list_head list; | ||
| 86 | struct list_head nsub; | ||
| 87 | struct tipc_link *active_links[2]; | 107 | struct tipc_link *active_links[2]; |
| 88 | struct tipc_link *links[MAX_BEARERS]; | 108 | struct tipc_link *links[MAX_BEARERS]; |
| 109 | unsigned int action_flags; | ||
| 110 | struct tipc_node_bclink bclink; | ||
| 111 | struct list_head list; | ||
| 89 | int link_cnt; | 112 | int link_cnt; |
| 90 | int working_links; | 113 | int working_links; |
| 91 | int block_setup; | ||
| 92 | u32 signature; | 114 | u32 signature; |
| 115 | struct list_head nsub; | ||
| 93 | struct rcu_head rcu; | 116 | struct rcu_head rcu; |
| 94 | struct { | ||
| 95 | u32 acked; | ||
| 96 | u32 last_in; | ||
| 97 | u32 last_sent; | ||
| 98 | u32 oos_state; | ||
| 99 | u32 deferred_size; | ||
| 100 | struct sk_buff *deferred_head; | ||
| 101 | struct sk_buff *deferred_tail; | ||
| 102 | struct sk_buff *reasm_head; | ||
| 103 | struct sk_buff *reasm_tail; | ||
| 104 | bool recv_permitted; | ||
| 105 | } bclink; | ||
| 106 | }; | 117 | }; |
| 107 | 118 | ||
| 108 | extern struct list_head tipc_node_list; | 119 | extern struct list_head tipc_node_list; |
| @@ -118,15 +129,18 @@ int tipc_node_active_links(struct tipc_node *n_ptr); | |||
| 118 | int tipc_node_is_up(struct tipc_node *n_ptr); | 129 | int tipc_node_is_up(struct tipc_node *n_ptr); |
| 119 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); | 130 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); |
| 120 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); | 131 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); |
| 132 | int tipc_node_get_linkname(u32 bearer_id, u32 node, char *linkname, size_t len); | ||
| 133 | void tipc_node_unlock(struct tipc_node *node); | ||
| 121 | 134 | ||
| 122 | static inline void tipc_node_lock(struct tipc_node *n_ptr) | 135 | static inline void tipc_node_lock(struct tipc_node *node) |
| 123 | { | 136 | { |
| 124 | spin_lock_bh(&n_ptr->lock); | 137 | spin_lock_bh(&node->lock); |
| 125 | } | 138 | } |
| 126 | 139 | ||
| 127 | static inline void tipc_node_unlock(struct tipc_node *n_ptr) | 140 | static inline bool tipc_node_blocked(struct tipc_node *node) |
| 128 | { | 141 | { |
| 129 | spin_unlock_bh(&n_ptr->lock); | 142 | return (node->action_flags & (TIPC_WAIT_PEER_LINKS_DOWN | |
| 143 | TIPC_NOTIFY_NODE_DOWN | TIPC_WAIT_OWN_LINKS_DOWN)); | ||
| 130 | } | 144 | } |
| 131 | 145 | ||
| 132 | #endif | 146 | #endif |
