aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorErik Hugne <erik.hugne@ericsson.com>2014-03-28 05:32:09 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-28 14:46:29 -0400
commit16470111ed2aad67d2e2407aae2a8a53a4a38060 (patch)
tree09049ec1857214f78c7bee8040eef6e66c0a971e /net/tipc
parenta21a584d6720ce349b05795b9bcfab3de8e58419 (diff)
tipc: make discovery domain a bearer attribute
The node discovery domain is assigned when a bearer is enabled. In the previous commit we reflect this attribute directly in the bearer structure since it's needed to reinitialize the node discovery mechanism after a hardware address change. There's no need to replicate this attribute anywhere else, so we remove it from the tipc_link_req structure. Signed-off-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bearer.c4
-rw-r--r--net/tipc/discover.c19
-rw-r--r--net/tipc/discover.h3
3 files changed, 10 insertions, 16 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 3cd65d46b173..3fef7eb776dc 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -336,7 +336,7 @@ restart:
336 b_ptr->net_plane = bearer_id + 'A'; 336 b_ptr->net_plane = bearer_id + 'A';
337 b_ptr->priority = priority; 337 b_ptr->priority = priority;
338 338
339 res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain); 339 res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr);
340 if (res) { 340 if (res) {
341 bearer_disable(b_ptr, false); 341 bearer_disable(b_ptr, false);
342 pr_warn("Bearer <%s> rejected, discovery object creation failed\n", 342 pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
@@ -363,7 +363,7 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
363 pr_info("Resetting bearer <%s>\n", b_ptr->name); 363 pr_info("Resetting bearer <%s>\n", b_ptr->name);
364 tipc_disc_delete(b_ptr->link_req); 364 tipc_disc_delete(b_ptr->link_req);
365 tipc_link_reset_list(b_ptr->identity); 365 tipc_link_reset_list(b_ptr->identity);
366 tipc_disc_create(b_ptr, &b_ptr->bcast_addr, b_ptr->domain); 366 tipc_disc_create(b_ptr, &b_ptr->bcast_addr);
367 read_unlock_bh(&tipc_net_lock); 367 read_unlock_bh(&tipc_net_lock);
368 return 0; 368 return 0;
369} 369}
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index fa94da6db3d4..542fe3413dc4 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -48,7 +48,6 @@
48 * struct tipc_link_req - information about an ongoing link setup request 48 * struct tipc_link_req - information about an ongoing link setup request
49 * @bearer: bearer issuing requests 49 * @bearer: bearer issuing requests
50 * @dest: destination address for request messages 50 * @dest: destination address for request messages
51 * @domain: network domain to which links can be established
52 * @num_nodes: number of nodes currently discovered (i.e. with an active link) 51 * @num_nodes: number of nodes currently discovered (i.e. with an active link)
53 * @lock: spinlock for controlling access to requests 52 * @lock: spinlock for controlling access to requests
54 * @buf: request message to be (repeatedly) sent 53 * @buf: request message to be (repeatedly) sent
@@ -58,7 +57,6 @@
58struct tipc_link_req { 57struct tipc_link_req {
59 struct tipc_bearer *bearer; 58 struct tipc_bearer *bearer;
60 struct tipc_media_addr dest; 59 struct tipc_media_addr dest;
61 u32 domain;
62 int num_nodes; 60 int num_nodes;
63 spinlock_t lock; 61 spinlock_t lock;
64 struct sk_buff *buf; 62 struct sk_buff *buf;
@@ -69,14 +67,13 @@ struct tipc_link_req {
69/** 67/**
70 * tipc_disc_init_msg - initialize a link setup message 68 * tipc_disc_init_msg - initialize a link setup message
71 * @type: message type (request or response) 69 * @type: message type (request or response)
72 * @dest_domain: network domain of node(s) which should respond to message
73 * @b_ptr: ptr to bearer issuing message 70 * @b_ptr: ptr to bearer issuing message
74 */ 71 */
75static struct sk_buff *tipc_disc_init_msg(u32 type, u32 dest_domain, 72static struct sk_buff *tipc_disc_init_msg(u32 type, struct tipc_bearer *b_ptr)
76 struct tipc_bearer *b_ptr)
77{ 73{
78 struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE); 74 struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE);
79 struct tipc_msg *msg; 75 struct tipc_msg *msg;
76 u32 dest_domain = b_ptr->domain;
80 77
81 if (buf) { 78 if (buf) {
82 msg = buf_msg(buf); 79 msg = buf_msg(buf);
@@ -149,7 +146,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
149 } 146 }
150 if (!tipc_in_scope(dest, tipc_own_addr)) 147 if (!tipc_in_scope(dest, tipc_own_addr))
151 return; 148 return;
152 if (!tipc_in_scope(b_ptr->link_req->domain, orig)) 149 if (!tipc_in_scope(b_ptr->domain, orig))
153 return; 150 return;
154 151
155 /* Locate structure corresponding to requesting node */ 152 /* Locate structure corresponding to requesting node */
@@ -242,7 +239,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
242 link_fully_up = link_working_working(link); 239 link_fully_up = link_working_working(link);
243 240
244 if ((type == DSC_REQ_MSG) && !link_fully_up) { 241 if ((type == DSC_REQ_MSG) && !link_fully_up) {
245 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, orig, b_ptr); 242 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, b_ptr);
246 if (rbuf) { 243 if (rbuf) {
247 tipc_bearer_send(b_ptr, rbuf, &media_addr); 244 tipc_bearer_send(b_ptr, rbuf, &media_addr);
248 kfree_skb(rbuf); 245 kfree_skb(rbuf);
@@ -306,7 +303,7 @@ static void disc_timeout(struct tipc_link_req *req)
306 spin_lock_bh(&req->lock); 303 spin_lock_bh(&req->lock);
307 304
308 /* Stop searching if only desired node has been found */ 305 /* Stop searching if only desired node has been found */
309 if (tipc_node(req->domain) && req->num_nodes) { 306 if (tipc_node(req->bearer->domain) && req->num_nodes) {
310 req->timer_intv = TIPC_LINK_REQ_INACTIVE; 307 req->timer_intv = TIPC_LINK_REQ_INACTIVE;
311 goto exit; 308 goto exit;
312 } 309 }
@@ -342,8 +339,7 @@ exit:
342 * 339 *
343 * Returns 0 if successful, otherwise -errno. 340 * Returns 0 if successful, otherwise -errno.
344 */ 341 */
345int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest, 342int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest)
346 u32 dest_domain)
347{ 343{
348 struct tipc_link_req *req; 344 struct tipc_link_req *req;
349 345
@@ -351,7 +347,7 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
351 if (!req) 347 if (!req)
352 return -ENOMEM; 348 return -ENOMEM;
353 349
354 req->buf = tipc_disc_init_msg(DSC_REQ_MSG, dest_domain, b_ptr); 350 req->buf = tipc_disc_init_msg(DSC_REQ_MSG, b_ptr);
355 if (!req->buf) { 351 if (!req->buf) {
356 kfree(req); 352 kfree(req);
357 return -ENOMSG; 353 return -ENOMSG;
@@ -359,7 +355,6 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
359 355
360 memcpy(&req->dest, dest, sizeof(*dest)); 356 memcpy(&req->dest, dest, sizeof(*dest));
361 req->bearer = b_ptr; 357 req->bearer = b_ptr;
362 req->domain = dest_domain;
363 req->num_nodes = 0; 358 req->num_nodes = 0;
364 req->timer_intv = TIPC_LINK_REQ_INIT; 359 req->timer_intv = TIPC_LINK_REQ_INIT;
365 spin_lock_init(&req->lock); 360 spin_lock_init(&req->lock);
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index b4fc962c3623..07f34729459d 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -39,8 +39,7 @@
39 39
40struct tipc_link_req; 40struct tipc_link_req;
41 41
42int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest, 42int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest);
43 u32 dest_domain);
44void tipc_disc_delete(struct tipc_link_req *req); 43void tipc_disc_delete(struct tipc_link_req *req);
45void tipc_disc_add_dest(struct tipc_link_req *req); 44void tipc_disc_add_dest(struct tipc_link_req *req);
46void tipc_disc_remove_dest(struct tipc_link_req *req); 45void tipc_disc_remove_dest(struct tipc_link_req *req);