aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-03-27 00:54:34 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-27 13:08:37 -0400
commitf47de12b06c95cfc38c1c79986210c7620f264c4 (patch)
tree93689afb676155b5f71aee2cc91423cde9e56c76 /net/tipc
parent3874ccbba80f3b3127e94b1e055fb3d502a44718 (diff)
tipc: remove active flag from tipc_bearer structure
After the allocation of tipc_bearer structure instance is converted from statical way to dynamical way, we identify whether a certain tipc_bearer structure pointer is valid by checking whether the pointer is NULL or not. So the active flag in tipc_bearer structure becomes redundant. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c2
-rw-r--r--net/tipc/bearer.c9
-rw-r--r--net/tipc/bearer.h2
-rw-r--r--net/tipc/link.c4
4 files changed, 5 insertions, 12 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index b4f8c62a2777..47bb07aac16c 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -669,7 +669,7 @@ void tipc_bcbearer_sort(void)
669 669
670 for (b_index = 0; b_index < MAX_BEARERS; b_index++) { 670 for (b_index = 0; b_index < MAX_BEARERS; b_index++) {
671 struct tipc_bearer *b = bearer_list[b_index]; 671 struct tipc_bearer *b = bearer_list[b_index];
672 if (!b || !b->active || !b->nodes.count) 672 if (!b || !b->nodes.count)
673 continue; 673 continue;
674 674
675 if (!bp_temp[b->priority].primary) 675 if (!bp_temp[b->priority].primary)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 7ff98efd4890..826b7010ab69 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -179,7 +179,7 @@ struct tipc_bearer *tipc_bearer_find(const char *name)
179 179
180 for (i = 0; i < MAX_BEARERS; i++) { 180 for (i = 0; i < MAX_BEARERS; i++) {
181 b_ptr = bearer_list[i]; 181 b_ptr = bearer_list[i];
182 if (b_ptr && b_ptr->active && (!strcmp(b_ptr->name, name))) 182 if (b_ptr && (!strcmp(b_ptr->name, name)))
183 return b_ptr; 183 return b_ptr;
184 } 184 }
185 return NULL; 185 return NULL;
@@ -204,7 +204,7 @@ struct sk_buff *tipc_bearer_get_names(void)
204 b = bearer_list[j]; 204 b = bearer_list[j];
205 if (!b) 205 if (!b)
206 continue; 206 continue;
207 if (b->active && (b->media == media_info_array[i])) { 207 if (b->media == media_info_array[i]) {
208 tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, 208 tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME,
209 b->name, 209 b->name,
210 strlen(b->name) + 1); 210 strlen(b->name) + 1);
@@ -288,7 +288,7 @@ restart:
288 with_this_prio = 1; 288 with_this_prio = 1;
289 for (i = MAX_BEARERS; i-- != 0; ) { 289 for (i = MAX_BEARERS; i-- != 0; ) {
290 b_ptr = bearer_list[i]; 290 b_ptr = bearer_list[i];
291 if (!b_ptr || !b_ptr->active) { 291 if (!b_ptr) {
292 bearer_id = i; 292 bearer_id = i;
293 continue; 293 continue;
294 } 294 }
@@ -333,7 +333,6 @@ restart:
333 b_ptr->tolerance = m_ptr->tolerance; 333 b_ptr->tolerance = m_ptr->tolerance;
334 b_ptr->window = m_ptr->window; 334 b_ptr->window = m_ptr->window;
335 b_ptr->net_plane = bearer_id + 'A'; 335 b_ptr->net_plane = bearer_id + 'A';
336 b_ptr->active = 1;
337 b_ptr->priority = priority; 336 b_ptr->priority = priority;
338 337
339 res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain); 338 res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain);
@@ -628,7 +627,7 @@ void tipc_bearer_stop(void)
628 627
629 for (i = 0; i < MAX_BEARERS; i++) { 628 for (i = 0; i < MAX_BEARERS; i++) {
630 b_ptr = bearer_list[i]; 629 b_ptr = bearer_list[i];
631 if (b_ptr && b_ptr->active) { 630 if (b_ptr) {
632 bearer_disable(b_ptr, true); 631 bearer_disable(b_ptr, true);
633 bearer_list[i] = NULL; 632 bearer_list[i] = NULL;
634 } 633 }
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index f4e72caccb21..3f6d7d0f059b 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -118,7 +118,6 @@ struct tipc_media {
118 * @tolerance: default link tolerance for bearer 118 * @tolerance: default link tolerance for bearer
119 * @identity: array index of this bearer within TIPC bearer array 119 * @identity: array index of this bearer within TIPC bearer array
120 * @link_req: ptr to (optional) structure making periodic link setup requests 120 * @link_req: ptr to (optional) structure making periodic link setup requests
121 * @active: non-zero if bearer structure is represents a bearer
122 * @net_plane: network plane ('A' through 'H') currently associated with bearer 121 * @net_plane: network plane ('A' through 'H') currently associated with bearer
123 * @nodes: indicates which nodes in cluster can be reached through bearer 122 * @nodes: indicates which nodes in cluster can be reached through bearer
124 * 123 *
@@ -138,7 +137,6 @@ struct tipc_bearer {
138 u32 tolerance; 137 u32 tolerance;
139 u32 identity; 138 u32 identity;
140 struct tipc_link_req *link_req; 139 struct tipc_link_req *link_req;
141 int active;
142 char net_plane; 140 char net_plane;
143 struct tipc_node_map nodes; 141 struct tipc_node_map nodes;
144}; 142};
diff --git a/net/tipc/link.c b/net/tipc/link.c
index a42f4a1d3cd1..882c5c9c52f9 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1458,10 +1458,6 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr)
1458 head = head->next; 1458 head = head->next;
1459 buf->next = NULL; 1459 buf->next = NULL;
1460 1460
1461 /* Ensure bearer is still enabled */
1462 if (unlikely(!b_ptr->active))
1463 goto discard;
1464
1465 /* Ensure message is well-formed */ 1461 /* Ensure message is well-formed */
1466 if (unlikely(!link_recv_buf_validate(buf))) 1462 if (unlikely(!link_recv_buf_validate(buf)))
1467 goto discard; 1463 goto discard;