Skip to content

Commit b786e2b

Browse files
Jon Paul Maloydavem330
authored andcommitted
tipc: let port protocol senders use new link send function
Several functions in port.c, related to the port protocol and connection shutdown, need to send messages. We now convert them to use the new link send function. Signed-off-by: Jon Maloy <[email protected]> Reviewed-by: Erik Hugne <[email protected]> Reviewed-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4ccfe5e commit b786e2b

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

net/tipc/port.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ u32 tipc_port_init(struct tipc_port *p_ptr,
236236
void tipc_port_destroy(struct tipc_port *p_ptr)
237237
{
238238
struct sk_buff *buf = NULL;
239+
struct tipc_msg *msg = NULL;
240+
u32 peer;
239241

240242
tipc_withdraw(p_ptr, 0, NULL);
241243

@@ -247,14 +249,15 @@ void tipc_port_destroy(struct tipc_port *p_ptr)
247249
if (p_ptr->connected) {
248250
buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
249251
tipc_nodesub_unsubscribe(&p_ptr->subscription);
252+
msg = buf_msg(buf);
253+
peer = msg_destnode(msg);
254+
tipc_link_xmit2(buf, peer, msg_link_selector(msg));
250255
}
251-
252256
spin_lock_bh(&tipc_port_list_lock);
253257
list_del(&p_ptr->port_list);
254258
list_del(&p_ptr->wait_list);
255259
spin_unlock_bh(&tipc_port_list_lock);
256260
k_term_timer(&p_ptr->timer);
257-
tipc_net_route_msg(buf);
258261
}
259262

260263
/*
@@ -276,6 +279,7 @@ static struct sk_buff *port_build_proto_msg(struct tipc_port *p_ptr,
276279
msg_set_destport(msg, tipc_port_peerport(p_ptr));
277280
msg_set_origport(msg, p_ptr->ref);
278281
msg_set_msgcnt(msg, ack);
282+
buf->next = NULL;
279283
}
280284
return buf;
281285
}
@@ -284,6 +288,7 @@ static void port_timeout(unsigned long ref)
284288
{
285289
struct tipc_port *p_ptr = tipc_port_lock(ref);
286290
struct sk_buff *buf = NULL;
291+
struct tipc_msg *msg = NULL;
287292

288293
if (!p_ptr)
289294
return;
@@ -302,20 +307,23 @@ static void port_timeout(unsigned long ref)
302307
k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
303308
}
304309
tipc_port_unlock(p_ptr);
305-
tipc_net_route_msg(buf);
310+
msg = buf_msg(buf);
311+
tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg));
306312
}
307313

308314

309315
static void port_handle_node_down(unsigned long ref)
310316
{
311317
struct tipc_port *p_ptr = tipc_port_lock(ref);
312318
struct sk_buff *buf = NULL;
319+
struct tipc_msg *msg = NULL;
313320

314321
if (!p_ptr)
315322
return;
316323
buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE);
317324
tipc_port_unlock(p_ptr);
318-
tipc_net_route_msg(buf);
325+
msg = buf_msg(buf);
326+
tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg));
319327
}
320328

321329

@@ -327,6 +335,7 @@ static struct sk_buff *port_build_self_abort_msg(struct tipc_port *p_ptr, u32 er
327335
struct tipc_msg *msg = buf_msg(buf);
328336
msg_swap_words(msg, 4, 5);
329337
msg_swap_words(msg, 6, 7);
338+
buf->next = NULL;
330339
}
331340
return buf;
332341
}
@@ -351,6 +360,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *p_ptr, u32 er
351360
if (imp < TIPC_CRITICAL_IMPORTANCE)
352361
msg_set_importance(msg, ++imp);
353362
msg_set_errcode(msg, err);
363+
buf->next = NULL;
354364
}
355365
return buf;
356366
}
@@ -401,7 +411,7 @@ void tipc_port_proto_rcv(struct sk_buff *buf)
401411
p_ptr->probing_state = CONFIRMED;
402412
tipc_port_unlock(p_ptr);
403413
exit:
404-
tipc_net_route_msg(r_buf);
414+
tipc_link_xmit2(r_buf, msg_destnode(msg), msg_link_selector(msg));
405415
kfree_skb(buf);
406416
}
407417

@@ -496,6 +506,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
496506
{
497507
struct tipc_port *p_ptr;
498508
struct sk_buff *buf = NULL;
509+
struct tipc_msg *msg;
499510

500511
p_ptr = tipc_port_lock(ref);
501512
if (!p_ptr)
@@ -505,7 +516,10 @@ void tipc_acknowledge(u32 ref, u32 ack)
505516
buf = port_build_proto_msg(p_ptr, CONN_ACK, ack);
506517
}
507518
tipc_port_unlock(p_ptr);
508-
tipc_net_route_msg(buf);
519+
if (!buf)
520+
return;
521+
msg = buf_msg(buf);
522+
tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg));
509523
}
510524

511525
int tipc_publish(struct tipc_port *p_ptr, unsigned int scope,
@@ -656,6 +670,7 @@ int tipc_port_disconnect(u32 ref)
656670
*/
657671
int tipc_port_shutdown(u32 ref)
658672
{
673+
struct tipc_msg *msg;
659674
struct tipc_port *p_ptr;
660675
struct sk_buff *buf = NULL;
661676

@@ -665,6 +680,7 @@ int tipc_port_shutdown(u32 ref)
665680

666681
buf = port_build_peer_abort_msg(p_ptr, TIPC_CONN_SHUTDOWN);
667682
tipc_port_unlock(p_ptr);
668-
tipc_net_route_msg(buf);
683+
msg = buf_msg(buf);
684+
tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg));
669685
return tipc_port_disconnect(ref);
670686
}

0 commit comments

Comments
 (0)