diff options
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r-- | net/tipc/port.c | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index 72aae52bfec1..67e96cb1e825 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -54,8 +54,8 @@ | |||
54 | 54 | ||
55 | #define MAX_REJECT_SIZE 1024 | 55 | #define MAX_REJECT_SIZE 1024 |
56 | 56 | ||
57 | static struct sk_buff *msg_queue_head = 0; | 57 | static struct sk_buff *msg_queue_head = NULL; |
58 | static struct sk_buff *msg_queue_tail = 0; | 58 | static struct sk_buff *msg_queue_tail = NULL; |
59 | 59 | ||
60 | spinlock_t tipc_port_list_lock = SPIN_LOCK_UNLOCKED; | 60 | spinlock_t tipc_port_list_lock = SPIN_LOCK_UNLOCKED; |
61 | static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED; | 61 | static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED; |
@@ -67,27 +67,22 @@ static struct sk_buff* port_build_peer_abort_msg(struct port *,u32 err); | |||
67 | static void port_timeout(unsigned long ref); | 67 | static void port_timeout(unsigned long ref); |
68 | 68 | ||
69 | 69 | ||
70 | static inline u32 port_peernode(struct port *p_ptr) | 70 | static u32 port_peernode(struct port *p_ptr) |
71 | { | 71 | { |
72 | return msg_destnode(&p_ptr->publ.phdr); | 72 | return msg_destnode(&p_ptr->publ.phdr); |
73 | } | 73 | } |
74 | 74 | ||
75 | static inline u32 port_peerport(struct port *p_ptr) | 75 | static u32 port_peerport(struct port *p_ptr) |
76 | { | 76 | { |
77 | return msg_destport(&p_ptr->publ.phdr); | 77 | return msg_destport(&p_ptr->publ.phdr); |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline u32 port_out_seqno(struct port *p_ptr) | 80 | static u32 port_out_seqno(struct port *p_ptr) |
81 | { | 81 | { |
82 | return msg_transp_seqno(&p_ptr->publ.phdr); | 82 | return msg_transp_seqno(&p_ptr->publ.phdr); |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline void port_set_out_seqno(struct port *p_ptr, u32 seqno) | 85 | static void port_incr_out_seqno(struct port *p_ptr) |
86 | { | ||
87 | msg_set_transp_seqno(&p_ptr->publ.phdr,seqno); | ||
88 | } | ||
89 | |||
90 | static inline void port_incr_out_seqno(struct port *p_ptr) | ||
91 | { | 86 | { |
92 | struct tipc_msg *m = &p_ptr->publ.phdr; | 87 | struct tipc_msg *m = &p_ptr->publ.phdr; |
93 | 88 | ||
@@ -258,11 +253,11 @@ u32 tipc_createport_raw(void *usr_handle, | |||
258 | p_ptr->publ.usr_handle = usr_handle; | 253 | p_ptr->publ.usr_handle = usr_handle; |
259 | INIT_LIST_HEAD(&p_ptr->wait_list); | 254 | INIT_LIST_HEAD(&p_ptr->wait_list); |
260 | INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list); | 255 | INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list); |
261 | p_ptr->congested_link = 0; | 256 | p_ptr->congested_link = NULL; |
262 | p_ptr->max_pkt = MAX_PKT_DEFAULT; | 257 | p_ptr->max_pkt = MAX_PKT_DEFAULT; |
263 | p_ptr->dispatcher = dispatcher; | 258 | p_ptr->dispatcher = dispatcher; |
264 | p_ptr->wakeup = wakeup; | 259 | p_ptr->wakeup = wakeup; |
265 | p_ptr->user_port = 0; | 260 | p_ptr->user_port = NULL; |
266 | k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); | 261 | k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); |
267 | spin_lock_bh(&tipc_port_list_lock); | 262 | spin_lock_bh(&tipc_port_list_lock); |
268 | INIT_LIST_HEAD(&p_ptr->publications); | 263 | INIT_LIST_HEAD(&p_ptr->publications); |
@@ -276,9 +271,9 @@ u32 tipc_createport_raw(void *usr_handle, | |||
276 | int tipc_deleteport(u32 ref) | 271 | int tipc_deleteport(u32 ref) |
277 | { | 272 | { |
278 | struct port *p_ptr; | 273 | struct port *p_ptr; |
279 | struct sk_buff *buf = 0; | 274 | struct sk_buff *buf = NULL; |
280 | 275 | ||
281 | tipc_withdraw(ref, 0, 0); | 276 | tipc_withdraw(ref, 0, NULL); |
282 | p_ptr = tipc_port_lock(ref); | 277 | p_ptr = tipc_port_lock(ref); |
283 | if (!p_ptr) | 278 | if (!p_ptr) |
284 | return -EINVAL; | 279 | return -EINVAL; |
@@ -329,13 +324,13 @@ void *tipc_get_handle(const u32 ref) | |||
329 | 324 | ||
330 | p_ptr = tipc_port_lock(ref); | 325 | p_ptr = tipc_port_lock(ref); |
331 | if (!p_ptr) | 326 | if (!p_ptr) |
332 | return 0; | 327 | return NULL; |
333 | handle = p_ptr->publ.usr_handle; | 328 | handle = p_ptr->publ.usr_handle; |
334 | tipc_port_unlock(p_ptr); | 329 | tipc_port_unlock(p_ptr); |
335 | return handle; | 330 | return handle; |
336 | } | 331 | } |
337 | 332 | ||
338 | static inline int port_unreliable(struct port *p_ptr) | 333 | static int port_unreliable(struct port *p_ptr) |
339 | { | 334 | { |
340 | return msg_src_droppable(&p_ptr->publ.phdr); | 335 | return msg_src_droppable(&p_ptr->publ.phdr); |
341 | } | 336 | } |
@@ -364,7 +359,7 @@ int tipc_set_portunreliable(u32 ref, unsigned int isunreliable) | |||
364 | return TIPC_OK; | 359 | return TIPC_OK; |
365 | } | 360 | } |
366 | 361 | ||
367 | static inline int port_unreturnable(struct port *p_ptr) | 362 | static int port_unreturnable(struct port *p_ptr) |
368 | { | 363 | { |
369 | return msg_dest_droppable(&p_ptr->publ.phdr); | 364 | return msg_dest_droppable(&p_ptr->publ.phdr); |
370 | } | 365 | } |
@@ -475,7 +470,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) | |||
475 | 470 | ||
476 | /* send self-abort message when rejecting on a connected port */ | 471 | /* send self-abort message when rejecting on a connected port */ |
477 | if (msg_connected(msg)) { | 472 | if (msg_connected(msg)) { |
478 | struct sk_buff *abuf = 0; | 473 | struct sk_buff *abuf = NULL; |
479 | struct port *p_ptr = tipc_port_lock(msg_destport(msg)); | 474 | struct port *p_ptr = tipc_port_lock(msg_destport(msg)); |
480 | 475 | ||
481 | if (p_ptr) { | 476 | if (p_ptr) { |
@@ -510,7 +505,7 @@ int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, | |||
510 | static void port_timeout(unsigned long ref) | 505 | static void port_timeout(unsigned long ref) |
511 | { | 506 | { |
512 | struct port *p_ptr = tipc_port_lock(ref); | 507 | struct port *p_ptr = tipc_port_lock(ref); |
513 | struct sk_buff *buf = 0; | 508 | struct sk_buff *buf = NULL; |
514 | 509 | ||
515 | if (!p_ptr || !p_ptr->publ.connected) | 510 | if (!p_ptr || !p_ptr->publ.connected) |
516 | return; | 511 | return; |
@@ -540,7 +535,7 @@ static void port_timeout(unsigned long ref) | |||
540 | static void port_handle_node_down(unsigned long ref) | 535 | static void port_handle_node_down(unsigned long ref) |
541 | { | 536 | { |
542 | struct port *p_ptr = tipc_port_lock(ref); | 537 | struct port *p_ptr = tipc_port_lock(ref); |
543 | struct sk_buff* buf = 0; | 538 | struct sk_buff* buf = NULL; |
544 | 539 | ||
545 | if (!p_ptr) | 540 | if (!p_ptr) |
546 | return; | 541 | return; |
@@ -555,7 +550,7 @@ static struct sk_buff *port_build_self_abort_msg(struct port *p_ptr, u32 err) | |||
555 | u32 imp = msg_importance(&p_ptr->publ.phdr); | 550 | u32 imp = msg_importance(&p_ptr->publ.phdr); |
556 | 551 | ||
557 | if (!p_ptr->publ.connected) | 552 | if (!p_ptr->publ.connected) |
558 | return 0; | 553 | return NULL; |
559 | if (imp < TIPC_CRITICAL_IMPORTANCE) | 554 | if (imp < TIPC_CRITICAL_IMPORTANCE) |
560 | imp++; | 555 | imp++; |
561 | return port_build_proto_msg(p_ptr->publ.ref, | 556 | return port_build_proto_msg(p_ptr->publ.ref, |
@@ -575,7 +570,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err) | |||
575 | u32 imp = msg_importance(&p_ptr->publ.phdr); | 570 | u32 imp = msg_importance(&p_ptr->publ.phdr); |
576 | 571 | ||
577 | if (!p_ptr->publ.connected) | 572 | if (!p_ptr->publ.connected) |
578 | return 0; | 573 | return NULL; |
579 | if (imp < TIPC_CRITICAL_IMPORTANCE) | 574 | if (imp < TIPC_CRITICAL_IMPORTANCE) |
580 | imp++; | 575 | imp++; |
581 | return port_build_proto_msg(port_peerport(p_ptr), | 576 | return port_build_proto_msg(port_peerport(p_ptr), |
@@ -594,8 +589,8 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) | |||
594 | struct tipc_msg *msg = buf_msg(buf); | 589 | struct tipc_msg *msg = buf_msg(buf); |
595 | struct port *p_ptr = tipc_port_lock(msg_destport(msg)); | 590 | struct port *p_ptr = tipc_port_lock(msg_destport(msg)); |
596 | u32 err = TIPC_OK; | 591 | u32 err = TIPC_OK; |
597 | struct sk_buff *r_buf = 0; | 592 | struct sk_buff *r_buf = NULL; |
598 | struct sk_buff *abort_buf = 0; | 593 | struct sk_buff *abort_buf = NULL; |
599 | 594 | ||
600 | msg_dbg(msg, "PORT<RECV<:"); | 595 | msg_dbg(msg, "PORT<RECV<:"); |
601 | 596 | ||
@@ -804,7 +799,7 @@ static void port_dispatcher_sigh(void *dummy) | |||
804 | 799 | ||
805 | spin_lock_bh(&queue_lock); | 800 | spin_lock_bh(&queue_lock); |
806 | buf = msg_queue_head; | 801 | buf = msg_queue_head; |
807 | msg_queue_head = 0; | 802 | msg_queue_head = NULL; |
808 | spin_unlock_bh(&queue_lock); | 803 | spin_unlock_bh(&queue_lock); |
809 | 804 | ||
810 | while (buf) { | 805 | while (buf) { |
@@ -991,8 +986,8 @@ static void port_wakeup_sh(unsigned long ref) | |||
991 | { | 986 | { |
992 | struct port *p_ptr; | 987 | struct port *p_ptr; |
993 | struct user_port *up_ptr; | 988 | struct user_port *up_ptr; |
994 | tipc_continue_event cb = 0; | 989 | tipc_continue_event cb = NULL; |
995 | void *uh = 0; | 990 | void *uh = NULL; |
996 | 991 | ||
997 | p_ptr = tipc_port_lock(ref); | 992 | p_ptr = tipc_port_lock(ref); |
998 | if (p_ptr) { | 993 | if (p_ptr) { |
@@ -1016,7 +1011,7 @@ static void port_wakeup(struct tipc_port *p_ptr) | |||
1016 | void tipc_acknowledge(u32 ref, u32 ack) | 1011 | void tipc_acknowledge(u32 ref, u32 ack) |
1017 | { | 1012 | { |
1018 | struct port *p_ptr; | 1013 | struct port *p_ptr; |
1019 | struct sk_buff *buf = 0; | 1014 | struct sk_buff *buf = NULL; |
1020 | 1015 | ||
1021 | p_ptr = tipc_port_lock(ref); | 1016 | p_ptr = tipc_port_lock(ref); |
1022 | if (!p_ptr) | 1017 | if (!p_ptr) |
@@ -1062,7 +1057,7 @@ int tipc_createport(u32 user_ref, | |||
1062 | if (up_ptr == NULL) { | 1057 | if (up_ptr == NULL) { |
1063 | return -ENOMEM; | 1058 | return -ENOMEM; |
1064 | } | 1059 | } |
1065 | ref = tipc_createport_raw(0, port_dispatcher, port_wakeup, importance); | 1060 | ref = tipc_createport_raw(NULL, port_dispatcher, port_wakeup, importance); |
1066 | p_ptr = tipc_port_lock(ref); | 1061 | p_ptr = tipc_port_lock(ref); |
1067 | if (!p_ptr) { | 1062 | if (!p_ptr) { |
1068 | kfree(up_ptr); | 1063 | kfree(up_ptr); |
@@ -1273,7 +1268,7 @@ int tipc_disconnect(u32 ref) | |||
1273 | int tipc_shutdown(u32 ref) | 1268 | int tipc_shutdown(u32 ref) |
1274 | { | 1269 | { |
1275 | struct port *p_ptr; | 1270 | struct port *p_ptr; |
1276 | struct sk_buff *buf = 0; | 1271 | struct sk_buff *buf = NULL; |
1277 | 1272 | ||
1278 | p_ptr = tipc_port_lock(ref); | 1273 | p_ptr = tipc_port_lock(ref); |
1279 | if (!p_ptr) | 1274 | if (!p_ptr) |