diff options
author | Ying Xue <ying.xue@windriver.com> | 2014-05-07 20:54:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-09 01:41:01 -0400 |
commit | aecb9bb89cbc08366c50a98d2d4751b381a6dc3b (patch) | |
tree | d7290c509698b82d49ae68ccb292d32dd2ce5bbb | |
parent | 1b5d35358effb776b1ef47b26ec0df54af79d842 (diff) |
tipc: rename enum names of node flags
Rename node flags to action_flags as well as its enum names so
that they can reflect its real meanings.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/tipc/link.c | 6 | ||||
-rw-r--r-- | net/tipc/node.c | 17 | ||||
-rw-r--r-- | net/tipc/node.h | 29 |
3 files changed, 25 insertions, 27 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index dce2bef81720..26abb16e86ab 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1489,12 +1489,12 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr) | |||
1489 | goto unlock_discard; | 1489 | goto unlock_discard; |
1490 | 1490 | ||
1491 | /* Verify that communication with node is currently allowed */ | 1491 | /* Verify that communication with node is currently allowed */ |
1492 | if ((n_ptr->flags & TIPC_NODE_DOWN) && | 1492 | if ((n_ptr->action_flags & TIPC_WAIT_PEER_LINKS_DOWN) && |
1493 | msg_user(msg) == LINK_PROTOCOL && | 1493 | msg_user(msg) == LINK_PROTOCOL && |
1494 | (msg_type(msg) == RESET_MSG || | 1494 | (msg_type(msg) == RESET_MSG || |
1495 | msg_type(msg) == ACTIVATE_MSG) && | 1495 | msg_type(msg) == ACTIVATE_MSG) && |
1496 | !msg_redundant_link(msg)) | 1496 | !msg_redundant_link(msg)) |
1497 | n_ptr->flags &= ~TIPC_NODE_DOWN; | 1497 | n_ptr->action_flags &= ~TIPC_WAIT_PEER_LINKS_DOWN; |
1498 | 1498 | ||
1499 | if (tipc_node_blocked(n_ptr)) | 1499 | if (tipc_node_blocked(n_ptr)) |
1500 | goto unlock_discard; | 1500 | goto unlock_discard; |
@@ -1853,7 +1853,7 @@ static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf) | |||
1853 | * peer has lost contact -- don't allow peer's links | 1853 | * peer has lost contact -- don't allow peer's links |
1854 | * to reactivate before we recognize loss & clean up | 1854 | * to reactivate before we recognize loss & clean up |
1855 | */ | 1855 | */ |
1856 | l_ptr->owner->flags = TIPC_NODE_RESET; | 1856 | l_ptr->owner->action_flags = TIPC_WAIT_OWN_LINKS_DOWN; |
1857 | } | 1857 | } |
1858 | 1858 | ||
1859 | link_state_event(l_ptr, RESET_MSG); | 1859 | link_state_event(l_ptr, RESET_MSG); |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 74efebc1cb7a..bb66a268b139 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -108,7 +108,7 @@ struct tipc_node *tipc_node_create(u32 addr) | |||
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | list_add_tail_rcu(&n_ptr->list, &temp_node->list); | 110 | list_add_tail_rcu(&n_ptr->list, &temp_node->list); |
111 | n_ptr->flags = TIPC_NODE_DOWN; | 111 | n_ptr->action_flags = TIPC_WAIT_PEER_LINKS_DOWN; |
112 | n_ptr->signature = INVALID_NODE_SIG; | 112 | n_ptr->signature = INVALID_NODE_SIG; |
113 | 113 | ||
114 | tipc_num_nodes++; | 114 | tipc_num_nodes++; |
@@ -267,7 +267,7 @@ void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | |||
267 | 267 | ||
268 | static void node_established_contact(struct tipc_node *n_ptr) | 268 | static void node_established_contact(struct tipc_node *n_ptr) |
269 | { | 269 | { |
270 | n_ptr->flags |= TIPC_NODE_UP; | 270 | n_ptr->action_flags |= TIPC_NOTIFY_NODE_UP; |
271 | n_ptr->bclink.oos_state = 0; | 271 | n_ptr->bclink.oos_state = 0; |
272 | n_ptr->bclink.acked = tipc_bclink_get_last_sent(); | 272 | n_ptr->bclink.acked = tipc_bclink_get_last_sent(); |
273 | tipc_bclink_add_node(n_ptr->addr); | 273 | tipc_bclink_add_node(n_ptr->addr); |
@@ -311,7 +311,8 @@ static void node_lost_contact(struct tipc_node *n_ptr) | |||
311 | /* Notify subscribers and prevent re-contact with node until | 311 | /* Notify subscribers and prevent re-contact with node until |
312 | * cleanup is done. | 312 | * cleanup is done. |
313 | */ | 313 | */ |
314 | n_ptr->flags = TIPC_NODE_DOWN | TIPC_NODE_LOST; | 314 | n_ptr->action_flags = TIPC_WAIT_PEER_LINKS_DOWN | |
315 | TIPC_NOTIFY_NODE_DOWN; | ||
315 | } | 316 | } |
316 | 317 | ||
317 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | 318 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) |
@@ -459,18 +460,18 @@ void tipc_node_unlock(struct tipc_node *node) | |||
459 | int pkt_sz = 0; | 460 | int pkt_sz = 0; |
460 | u32 addr = 0; | 461 | u32 addr = 0; |
461 | 462 | ||
462 | if (likely(!node->flags)) { | 463 | if (likely(!node->action_flags)) { |
463 | spin_unlock_bh(&node->lock); | 464 | spin_unlock_bh(&node->lock); |
464 | return; | 465 | return; |
465 | } | 466 | } |
466 | 467 | ||
467 | if (node->flags & TIPC_NODE_LOST) { | 468 | if (node->action_flags & TIPC_NOTIFY_NODE_DOWN) { |
468 | list_replace_init(&node->nsub, &nsub_list); | 469 | list_replace_init(&node->nsub, &nsub_list); |
469 | node->flags &= ~TIPC_NODE_LOST; | 470 | node->action_flags &= ~TIPC_NOTIFY_NODE_DOWN; |
470 | } | 471 | } |
471 | if (node->flags & TIPC_NODE_UP) { | 472 | if (node->action_flags & TIPC_NOTIFY_NODE_UP) { |
472 | link = node->active_links[0]; | 473 | link = node->active_links[0]; |
473 | node->flags &= ~TIPC_NODE_UP; | 474 | node->action_flags &= ~TIPC_NOTIFY_NODE_UP; |
474 | if (link) { | 475 | if (link) { |
475 | pkt_sz = ((link->max_pkt - INT_H_SIZE) / ITEM_SIZE) * | 476 | pkt_sz = ((link->max_pkt - INT_H_SIZE) / ITEM_SIZE) * |
476 | ITEM_SIZE; | 477 | ITEM_SIZE; |
diff --git a/net/tipc/node.h b/net/tipc/node.h index 38f710fb75dc..5454edf994c3 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -47,20 +47,17 @@ | |||
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 | * TIPC_NODE_DOWN: indicate node is down and it's used to block the node's | 51 | * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down |
52 | * links until RESET or ACTIVE message arrives | 52 | * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down |
53 | * TIPC_NODE_RESET: indicate node is reset | 53 | * TIPC_NOTIFY_NODE_DOWN: notify node is down |
54 | * TIPC_NODE_LOST: indicate node is lost and it's used to notify subscriptions | 54 | * TIPC_NOTIFY_NODE_UP: notify node is up |
55 | * when node lock is released | ||
56 | * TIPC_NODE_UP: indicate node is up and it's used to deliver local name table | ||
57 | * when node lock is released | ||
58 | */ | 55 | */ |
59 | enum { | 56 | enum { |
60 | TIPC_NODE_DOWN = (1 << 1), | 57 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), |
61 | TIPC_NODE_RESET = (1 << 2), | 58 | TIPC_WAIT_OWN_LINKS_DOWN = (1 << 2), |
62 | TIPC_NODE_LOST = (1 << 3), | 59 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), |
63 | TIPC_NODE_UP = (1 << 4) | 60 | TIPC_NOTIFY_NODE_UP = (1 << 4) |
64 | }; | 61 | }; |
65 | 62 | ||
66 | /** | 63 | /** |
@@ -96,7 +93,7 @@ struct tipc_node_bclink { | |||
96 | * @hash: links to adjacent nodes in unsorted hash chain | 93 | * @hash: links to adjacent nodes in unsorted hash chain |
97 | * @active_links: pointers to active links to node | 94 | * @active_links: pointers to active links to node |
98 | * @links: pointers to all links to node | 95 | * @links: pointers to all links to node |
99 | * @flags: bit mask of conditions preventing link establishment to node | 96 | * @action_flags: bit mask of different types of node actions |
100 | * @bclink: broadcast-related info | 97 | * @bclink: broadcast-related info |
101 | * @list: links to adjacent nodes in sorted list of cluster's nodes | 98 | * @list: links to adjacent nodes in sorted list of cluster's nodes |
102 | * @working_links: number of working links to node (both active and standby) | 99 | * @working_links: number of working links to node (both active and standby) |
@@ -111,7 +108,7 @@ struct tipc_node { | |||
111 | struct hlist_node hash; | 108 | struct hlist_node hash; |
112 | struct tipc_link *active_links[2]; | 109 | struct tipc_link *active_links[2]; |
113 | struct tipc_link *links[MAX_BEARERS]; | 110 | struct tipc_link *links[MAX_BEARERS]; |
114 | unsigned int flags; | 111 | unsigned int action_flags; |
115 | struct tipc_node_bclink bclink; | 112 | struct tipc_node_bclink bclink; |
116 | struct list_head list; | 113 | struct list_head list; |
117 | int link_cnt; | 114 | int link_cnt; |
@@ -144,8 +141,8 @@ static inline void tipc_node_lock(struct tipc_node *node) | |||
144 | 141 | ||
145 | static inline bool tipc_node_blocked(struct tipc_node *node) | 142 | static inline bool tipc_node_blocked(struct tipc_node *node) |
146 | { | 143 | { |
147 | return (node->flags & (TIPC_NODE_DOWN | TIPC_NODE_LOST | | 144 | return (node->action_flags & (TIPC_WAIT_PEER_LINKS_DOWN | |
148 | TIPC_NODE_RESET)); | 145 | TIPC_NOTIFY_NODE_DOWN | TIPC_WAIT_OWN_LINKS_DOWN)); |
149 | } | 146 | } |
150 | 147 | ||
151 | #endif | 148 | #endif |