diff options
author | Allan Stephens <Allan.Stephens@windriver.com> | 2011-01-07 11:43:40 -0500 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-02-23 18:04:27 -0500 |
commit | 23dd4cce387124ec3ea06ca30d17854ae4d9b772 (patch) | |
tree | 3d33e41a44bec6cdc5ba67ead1c76903a46945dd /net/tipc/link.c | |
parent | dee9f4bceb5fd9dbfcc1567148fccdbf16d6a38a (diff) |
tipc: Combine port structure with tipc_port structure
Merge two distinct structures containing information about a TIPC port
into a single structure. The structures were previously kept separate
so that public information about a port could be made available to
applications using TIPC's native API, while the remaining information
was kept private for use by TIPC itself. However, now that the native
API has been removed there is no longer any need for this somewhat
confusing arrangement.
Since one of the structures was already embedded within the other, the
change largely involves replacing instances of "publ.foo" with "foo".
The changes do not otherwise alter the operation of TIPC ports.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index 18702f58d111..e30770d007f5 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/tipc/link.c: TIPC link code | 2 | * net/tipc/link.c: TIPC link code |
3 | * | 3 | * |
4 | * Copyright (c) 1996-2007, Ericsson AB | 4 | * Copyright (c) 1996-2007, Ericsson AB |
5 | * Copyright (c) 2004-2007, Wind River Systems | 5 | * Copyright (c) 2004-2007, 2010-2011, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -90,7 +90,7 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, | |||
90 | static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf); | 90 | static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf); |
91 | static int link_recv_changeover_msg(struct link **l_ptr, struct sk_buff **buf); | 91 | static int link_recv_changeover_msg(struct link **l_ptr, struct sk_buff **buf); |
92 | static void link_set_supervision_props(struct link *l_ptr, u32 tolerance); | 92 | static void link_set_supervision_props(struct link *l_ptr, u32 tolerance); |
93 | static int link_send_sections_long(struct port *sender, | 93 | static int link_send_sections_long(struct tipc_port *sender, |
94 | struct iovec const *msg_sect, | 94 | struct iovec const *msg_sect, |
95 | u32 num_sect, u32 destnode); | 95 | u32 num_sect, u32 destnode); |
96 | static void link_check_defragm_bufs(struct link *l_ptr); | 96 | static void link_check_defragm_bufs(struct link *l_ptr); |
@@ -406,7 +406,7 @@ static void link_start(struct link *l_ptr) | |||
406 | 406 | ||
407 | static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) | 407 | static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) |
408 | { | 408 | { |
409 | struct port *p_ptr; | 409 | struct tipc_port *p_ptr; |
410 | 410 | ||
411 | spin_lock_bh(&tipc_port_list_lock); | 411 | spin_lock_bh(&tipc_port_list_lock); |
412 | p_ptr = tipc_port_lock(origport); | 412 | p_ptr = tipc_port_lock(origport); |
@@ -415,7 +415,7 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) | |||
415 | goto exit; | 415 | goto exit; |
416 | if (!list_empty(&p_ptr->wait_list)) | 416 | if (!list_empty(&p_ptr->wait_list)) |
417 | goto exit; | 417 | goto exit; |
418 | p_ptr->publ.congested = 1; | 418 | p_ptr->congested = 1; |
419 | p_ptr->waiting_pkts = 1 + ((sz - 1) / l_ptr->max_pkt); | 419 | p_ptr->waiting_pkts = 1 + ((sz - 1) / l_ptr->max_pkt); |
420 | list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); | 420 | list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); |
421 | l_ptr->stats.link_congs++; | 421 | l_ptr->stats.link_congs++; |
@@ -428,8 +428,8 @@ exit: | |||
428 | 428 | ||
429 | void tipc_link_wakeup_ports(struct link *l_ptr, int all) | 429 | void tipc_link_wakeup_ports(struct link *l_ptr, int all) |
430 | { | 430 | { |
431 | struct port *p_ptr; | 431 | struct tipc_port *p_ptr; |
432 | struct port *temp_p_ptr; | 432 | struct tipc_port *temp_p_ptr; |
433 | int win = l_ptr->queue_limit[0] - l_ptr->out_queue_size; | 433 | int win = l_ptr->queue_limit[0] - l_ptr->out_queue_size; |
434 | 434 | ||
435 | if (all) | 435 | if (all) |
@@ -445,11 +445,11 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all) | |||
445 | if (win <= 0) | 445 | if (win <= 0) |
446 | break; | 446 | break; |
447 | list_del_init(&p_ptr->wait_list); | 447 | list_del_init(&p_ptr->wait_list); |
448 | spin_lock_bh(p_ptr->publ.lock); | 448 | spin_lock_bh(p_ptr->lock); |
449 | p_ptr->publ.congested = 0; | 449 | p_ptr->congested = 0; |
450 | p_ptr->wakeup(&p_ptr->publ); | 450 | p_ptr->wakeup(p_ptr); |
451 | win -= p_ptr->waiting_pkts; | 451 | win -= p_ptr->waiting_pkts; |
452 | spin_unlock_bh(p_ptr->publ.lock); | 452 | spin_unlock_bh(p_ptr->lock); |
453 | } | 453 | } |
454 | 454 | ||
455 | exit: | 455 | exit: |
@@ -1027,12 +1027,12 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) | |||
1027 | * except for total message length. | 1027 | * except for total message length. |
1028 | * Returns user data length or errno. | 1028 | * Returns user data length or errno. |
1029 | */ | 1029 | */ |
1030 | int tipc_link_send_sections_fast(struct port *sender, | 1030 | int tipc_link_send_sections_fast(struct tipc_port *sender, |
1031 | struct iovec const *msg_sect, | 1031 | struct iovec const *msg_sect, |
1032 | const u32 num_sect, | 1032 | const u32 num_sect, |
1033 | u32 destaddr) | 1033 | u32 destaddr) |
1034 | { | 1034 | { |
1035 | struct tipc_msg *hdr = &sender->publ.phdr; | 1035 | struct tipc_msg *hdr = &sender->phdr; |
1036 | struct link *l_ptr; | 1036 | struct link *l_ptr; |
1037 | struct sk_buff *buf; | 1037 | struct sk_buff *buf; |
1038 | struct tipc_node *node; | 1038 | struct tipc_node *node; |
@@ -1045,7 +1045,7 @@ again: | |||
1045 | * (Must not hold any locks while building message.) | 1045 | * (Must not hold any locks while building message.) |
1046 | */ | 1046 | */ |
1047 | 1047 | ||
1048 | res = tipc_msg_build(hdr, msg_sect, num_sect, sender->publ.max_pkt, | 1048 | res = tipc_msg_build(hdr, msg_sect, num_sect, sender->max_pkt, |
1049 | !sender->user_port, &buf); | 1049 | !sender->user_port, &buf); |
1050 | 1050 | ||
1051 | read_lock_bh(&tipc_net_lock); | 1051 | read_lock_bh(&tipc_net_lock); |
@@ -1056,7 +1056,7 @@ again: | |||
1056 | if (likely(l_ptr)) { | 1056 | if (likely(l_ptr)) { |
1057 | if (likely(buf)) { | 1057 | if (likely(buf)) { |
1058 | res = link_send_buf_fast(l_ptr, buf, | 1058 | res = link_send_buf_fast(l_ptr, buf, |
1059 | &sender->publ.max_pkt); | 1059 | &sender->max_pkt); |
1060 | if (unlikely(res < 0)) | 1060 | if (unlikely(res < 0)) |
1061 | buf_discard(buf); | 1061 | buf_discard(buf); |
1062 | exit: | 1062 | exit: |
@@ -1075,7 +1075,7 @@ exit: | |||
1075 | if (link_congested(l_ptr) || | 1075 | if (link_congested(l_ptr) || |
1076 | !list_empty(&l_ptr->b_ptr->cong_links)) { | 1076 | !list_empty(&l_ptr->b_ptr->cong_links)) { |
1077 | res = link_schedule_port(l_ptr, | 1077 | res = link_schedule_port(l_ptr, |
1078 | sender->publ.ref, res); | 1078 | sender->ref, res); |
1079 | goto exit; | 1079 | goto exit; |
1080 | } | 1080 | } |
1081 | 1081 | ||
@@ -1084,12 +1084,12 @@ exit: | |||
1084 | * then re-try fast path or fragment the message | 1084 | * then re-try fast path or fragment the message |
1085 | */ | 1085 | */ |
1086 | 1086 | ||
1087 | sender->publ.max_pkt = l_ptr->max_pkt; | 1087 | sender->max_pkt = l_ptr->max_pkt; |
1088 | tipc_node_unlock(node); | 1088 | tipc_node_unlock(node); |
1089 | read_unlock_bh(&tipc_net_lock); | 1089 | read_unlock_bh(&tipc_net_lock); |
1090 | 1090 | ||
1091 | 1091 | ||
1092 | if ((msg_hdr_sz(hdr) + res) <= sender->publ.max_pkt) | 1092 | if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt) |
1093 | goto again; | 1093 | goto again; |
1094 | 1094 | ||
1095 | return link_send_sections_long(sender, msg_sect, | 1095 | return link_send_sections_long(sender, msg_sect, |
@@ -1123,14 +1123,14 @@ exit: | |||
1123 | * | 1123 | * |
1124 | * Returns user data length or errno. | 1124 | * Returns user data length or errno. |
1125 | */ | 1125 | */ |
1126 | static int link_send_sections_long(struct port *sender, | 1126 | static int link_send_sections_long(struct tipc_port *sender, |
1127 | struct iovec const *msg_sect, | 1127 | struct iovec const *msg_sect, |
1128 | u32 num_sect, | 1128 | u32 num_sect, |
1129 | u32 destaddr) | 1129 | u32 destaddr) |
1130 | { | 1130 | { |
1131 | struct link *l_ptr; | 1131 | struct link *l_ptr; |
1132 | struct tipc_node *node; | 1132 | struct tipc_node *node; |
1133 | struct tipc_msg *hdr = &sender->publ.phdr; | 1133 | struct tipc_msg *hdr = &sender->phdr; |
1134 | u32 dsz = msg_data_sz(hdr); | 1134 | u32 dsz = msg_data_sz(hdr); |
1135 | u32 max_pkt, fragm_sz, rest; | 1135 | u32 max_pkt, fragm_sz, rest; |
1136 | struct tipc_msg fragm_hdr; | 1136 | struct tipc_msg fragm_hdr; |
@@ -1142,7 +1142,7 @@ static int link_send_sections_long(struct port *sender, | |||
1142 | 1142 | ||
1143 | again: | 1143 | again: |
1144 | fragm_no = 1; | 1144 | fragm_no = 1; |
1145 | max_pkt = sender->publ.max_pkt - INT_H_SIZE; | 1145 | max_pkt = sender->max_pkt - INT_H_SIZE; |
1146 | /* leave room for tunnel header in case of link changeover */ | 1146 | /* leave room for tunnel header in case of link changeover */ |
1147 | fragm_sz = max_pkt - INT_H_SIZE; | 1147 | fragm_sz = max_pkt - INT_H_SIZE; |
1148 | /* leave room for fragmentation header in each fragment */ | 1148 | /* leave room for fragmentation header in each fragment */ |
@@ -1157,7 +1157,7 @@ again: | |||
1157 | 1157 | ||
1158 | tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, | 1158 | tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, |
1159 | INT_H_SIZE, msg_destnode(hdr)); | 1159 | INT_H_SIZE, msg_destnode(hdr)); |
1160 | msg_set_link_selector(&fragm_hdr, sender->publ.ref); | 1160 | msg_set_link_selector(&fragm_hdr, sender->ref); |
1161 | msg_set_size(&fragm_hdr, max_pkt); | 1161 | msg_set_size(&fragm_hdr, max_pkt); |
1162 | msg_set_fragm_no(&fragm_hdr, 1); | 1162 | msg_set_fragm_no(&fragm_hdr, 1); |
1163 | 1163 | ||
@@ -1238,13 +1238,13 @@ error: | |||
1238 | node = tipc_node_find(destaddr); | 1238 | node = tipc_node_find(destaddr); |
1239 | if (likely(node)) { | 1239 | if (likely(node)) { |
1240 | tipc_node_lock(node); | 1240 | tipc_node_lock(node); |
1241 | l_ptr = node->active_links[sender->publ.ref & 1]; | 1241 | l_ptr = node->active_links[sender->ref & 1]; |
1242 | if (!l_ptr) { | 1242 | if (!l_ptr) { |
1243 | tipc_node_unlock(node); | 1243 | tipc_node_unlock(node); |
1244 | goto reject; | 1244 | goto reject; |
1245 | } | 1245 | } |
1246 | if (l_ptr->max_pkt < max_pkt) { | 1246 | if (l_ptr->max_pkt < max_pkt) { |
1247 | sender->publ.max_pkt = l_ptr->max_pkt; | 1247 | sender->max_pkt = l_ptr->max_pkt; |
1248 | tipc_node_unlock(node); | 1248 | tipc_node_unlock(node); |
1249 | for (; buf_chain; buf_chain = buf) { | 1249 | for (; buf_chain; buf_chain = buf) { |
1250 | buf = buf_chain->next; | 1250 | buf = buf_chain->next; |