Skip to content

Commit 1647011

Browse files
Erik Hugnedavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a21a584 commit 1647011

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

net/tipc/bearer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
336336
b_ptr->net_plane = bearer_id + 'A';
337337
b_ptr->priority = priority;
338338

339-
res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain);
339+
res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr);
340340
if (res) {
341341
bearer_disable(b_ptr, false);
342342
pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
@@ -363,7 +363,7 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
363363
pr_info("Resetting bearer <%s>\n", b_ptr->name);
364364
tipc_disc_delete(b_ptr->link_req);
365365
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);
367367
read_unlock_bh(&tipc_net_lock);
368368
return 0;
369369
}

net/tipc/discover.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
* struct tipc_link_req - information about an ongoing link setup request
4949
* @bearer: bearer issuing requests
5050
* @dest: destination address for request messages
51-
* @domain: network domain to which links can be established
5251
* @num_nodes: number of nodes currently discovered (i.e. with an active link)
5352
* @lock: spinlock for controlling access to requests
5453
* @buf: request message to be (repeatedly) sent
@@ -58,7 +57,6 @@
5857
struct tipc_link_req {
5958
struct tipc_bearer *bearer;
6059
struct tipc_media_addr dest;
61-
u32 domain;
6260
int num_nodes;
6361
spinlock_t lock;
6462
struct sk_buff *buf;
@@ -69,14 +67,13 @@ struct tipc_link_req {
6967
/**
7068
* tipc_disc_init_msg - initialize a link setup message
7169
* @type: message type (request or response)
72-
* @dest_domain: network domain of node(s) which should respond to message
7370
* @b_ptr: ptr to bearer issuing message
7471
*/
75-
static struct sk_buff *tipc_disc_init_msg(u32 type, u32 dest_domain,
76-
struct tipc_bearer *b_ptr)
72+
static struct sk_buff *tipc_disc_init_msg(u32 type, struct tipc_bearer *b_ptr)
7773
{
7874
struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE);
7975
struct tipc_msg *msg;
76+
u32 dest_domain = b_ptr->domain;
8077

8178
if (buf) {
8279
msg = buf_msg(buf);
@@ -149,7 +146,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
149146
}
150147
if (!tipc_in_scope(dest, tipc_own_addr))
151148
return;
152-
if (!tipc_in_scope(b_ptr->link_req->domain, orig))
149+
if (!tipc_in_scope(b_ptr->domain, orig))
153150
return;
154151

155152
/* Locate structure corresponding to requesting node */
@@ -242,7 +239,7 @@ void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr)
242239
link_fully_up = link_working_working(link);
243240

244241
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);
246243
if (rbuf) {
247244
tipc_bearer_send(b_ptr, rbuf, &media_addr);
248245
kfree_skb(rbuf);
@@ -306,7 +303,7 @@ static void disc_timeout(struct tipc_link_req *req)
306303
spin_lock_bh(&req->lock);
307304

308305
/* 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) {
310307
req->timer_intv = TIPC_LINK_REQ_INACTIVE;
311308
goto exit;
312309
}
@@ -342,24 +339,22 @@ static void disc_timeout(struct tipc_link_req *req)
342339
*
343340
* Returns 0 if successful, otherwise -errno.
344341
*/
345-
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
346-
u32 dest_domain)
342+
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest)
347343
{
348344
struct tipc_link_req *req;
349345

350346
req = kmalloc(sizeof(*req), GFP_ATOMIC);
351347
if (!req)
352348
return -ENOMEM;
353349

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);
355351
if (!req->buf) {
356352
kfree(req);
357353
return -ENOMSG;
358354
}
359355

360356
memcpy(&req->dest, dest, sizeof(*dest));
361357
req->bearer = b_ptr;
362-
req->domain = dest_domain;
363358
req->num_nodes = 0;
364359
req->timer_intv = TIPC_LINK_REQ_INIT;
365360
spin_lock_init(&req->lock);

net/tipc/discover.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939

4040
struct tipc_link_req;
4141

42-
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
43-
u32 dest_domain);
42+
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest);
4443
void tipc_disc_delete(struct tipc_link_req *req);
4544
void tipc_disc_add_dest(struct tipc_link_req *req);
4645
void tipc_disc_remove_dest(struct tipc_link_req *req);

0 commit comments

Comments
 (0)