diff options
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r-- | net/tipc/port.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index e6841706967c..2ad37a4db376 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -75,7 +75,6 @@ static u32 port_peerport(struct tipc_port *p_ptr) | |||
75 | * Handles cases where the node's network address has changed from | 75 | * Handles cases where the node's network address has changed from |
76 | * the default of <0.0.0> to its configured setting. | 76 | * the default of <0.0.0> to its configured setting. |
77 | */ | 77 | */ |
78 | |||
79 | int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg) | 78 | int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg) |
80 | { | 79 | { |
81 | u32 peernode; | 80 | u32 peernode; |
@@ -94,7 +93,6 @@ int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg) | |||
94 | /** | 93 | /** |
95 | * tipc_multicast - send a multicast message to local and remote destinations | 94 | * tipc_multicast - send a multicast message to local and remote destinations |
96 | */ | 95 | */ |
97 | |||
98 | int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, | 96 | int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, |
99 | u32 num_sect, struct iovec const *msg_sect, | 97 | u32 num_sect, struct iovec const *msg_sect, |
100 | unsigned int total_len) | 98 | unsigned int total_len) |
@@ -111,7 +109,6 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, | |||
111 | return -EINVAL; | 109 | return -EINVAL; |
112 | 110 | ||
113 | /* Create multicast message */ | 111 | /* Create multicast message */ |
114 | |||
115 | hdr = &oport->phdr; | 112 | hdr = &oport->phdr; |
116 | msg_set_type(hdr, TIPC_MCAST_MSG); | 113 | msg_set_type(hdr, TIPC_MCAST_MSG); |
117 | msg_set_lookup_scope(hdr, TIPC_CLUSTER_SCOPE); | 114 | msg_set_lookup_scope(hdr, TIPC_CLUSTER_SCOPE); |
@@ -127,12 +124,10 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, | |||
127 | return res; | 124 | return res; |
128 | 125 | ||
129 | /* Figure out where to send multicast message */ | 126 | /* Figure out where to send multicast message */ |
130 | |||
131 | ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper, | 127 | ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper, |
132 | TIPC_NODE_SCOPE, &dports); | 128 | TIPC_NODE_SCOPE, &dports); |
133 | 129 | ||
134 | /* Send message to destinations (duplicate it only if necessary) */ | 130 | /* Send message to destinations (duplicate it only if necessary) */ |
135 | |||
136 | if (ext_targets) { | 131 | if (ext_targets) { |
137 | if (dports.count != 0) { | 132 | if (dports.count != 0) { |
138 | ibuf = skb_copy(buf, GFP_ATOMIC); | 133 | ibuf = skb_copy(buf, GFP_ATOMIC); |
@@ -163,7 +158,6 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, | |||
163 | * | 158 | * |
164 | * If there is no port list, perform a lookup to create one | 159 | * If there is no port list, perform a lookup to create one |
165 | */ | 160 | */ |
166 | |||
167 | void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp) | 161 | void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp) |
168 | { | 162 | { |
169 | struct tipc_msg *msg; | 163 | struct tipc_msg *msg; |
@@ -174,7 +168,6 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp) | |||
174 | msg = buf_msg(buf); | 168 | msg = buf_msg(buf); |
175 | 169 | ||
176 | /* Create destination port list, if one wasn't supplied */ | 170 | /* Create destination port list, if one wasn't supplied */ |
177 | |||
178 | if (dp == NULL) { | 171 | if (dp == NULL) { |
179 | tipc_nametbl_mc_translate(msg_nametype(msg), | 172 | tipc_nametbl_mc_translate(msg_nametype(msg), |
180 | msg_namelower(msg), | 173 | msg_namelower(msg), |
@@ -185,7 +178,6 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp) | |||
185 | } | 178 | } |
186 | 179 | ||
187 | /* Deliver a copy of message to each destination port */ | 180 | /* Deliver a copy of message to each destination port */ |
188 | |||
189 | if (dp->count != 0) { | 181 | if (dp->count != 0) { |
190 | msg_set_destnode(msg, tipc_own_addr); | 182 | msg_set_destnode(msg, tipc_own_addr); |
191 | if (dp->count == 1) { | 183 | if (dp->count == 1) { |
@@ -218,7 +210,6 @@ exit: | |||
218 | * | 210 | * |
219 | * Returns pointer to (locked) TIPC port, or NULL if unable to create it | 211 | * Returns pointer to (locked) TIPC port, or NULL if unable to create it |
220 | */ | 212 | */ |
221 | |||
222 | struct tipc_port *tipc_createport_raw(void *usr_handle, | 213 | struct tipc_port *tipc_createport_raw(void *usr_handle, |
223 | u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), | 214 | u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), |
224 | void (*wakeup)(struct tipc_port *), | 215 | void (*wakeup)(struct tipc_port *), |
@@ -257,7 +248,6 @@ struct tipc_port *tipc_createport_raw(void *usr_handle, | |||
257 | * to ensure a change to node's own network address doesn't result | 248 | * to ensure a change to node's own network address doesn't result |
258 | * in template containing out-dated network address information | 249 | * in template containing out-dated network address information |
259 | */ | 250 | */ |
260 | |||
261 | spin_lock_bh(&tipc_port_list_lock); | 251 | spin_lock_bh(&tipc_port_list_lock); |
262 | msg = &p_ptr->phdr; | 252 | msg = &p_ptr->phdr; |
263 | tipc_msg_init(msg, importance, TIPC_NAMED_MSG, NAMED_H_SIZE, 0); | 253 | tipc_msg_init(msg, importance, TIPC_NAMED_MSG, NAMED_H_SIZE, 0); |
@@ -390,7 +380,6 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) | |||
390 | u32 rmsg_sz; | 380 | u32 rmsg_sz; |
391 | 381 | ||
392 | /* discard rejected message if it shouldn't be returned to sender */ | 382 | /* discard rejected message if it shouldn't be returned to sender */ |
393 | |||
394 | if (WARN(!msg_isdata(msg), | 383 | if (WARN(!msg_isdata(msg), |
395 | "attempt to reject message with user=%u", msg_user(msg))) { | 384 | "attempt to reject message with user=%u", msg_user(msg))) { |
396 | dump_stack(); | 385 | dump_stack(); |
@@ -403,7 +392,6 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) | |||
403 | * construct returned message by copying rejected message header and | 392 | * construct returned message by copying rejected message header and |
404 | * data (or subset), then updating header fields that need adjusting | 393 | * data (or subset), then updating header fields that need adjusting |
405 | */ | 394 | */ |
406 | |||
407 | hdr_sz = msg_hdr_sz(msg); | 395 | hdr_sz = msg_hdr_sz(msg); |
408 | rmsg_sz = hdr_sz + min_t(u32, data_sz, MAX_REJECT_SIZE); | 396 | rmsg_sz = hdr_sz + min_t(u32, data_sz, MAX_REJECT_SIZE); |
409 | 397 | ||
@@ -442,7 +430,6 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) | |||
442 | } | 430 | } |
443 | 431 | ||
444 | /* send returned message & dispose of rejected message */ | 432 | /* send returned message & dispose of rejected message */ |
445 | |||
446 | src_node = msg_prevnode(msg); | 433 | src_node = msg_prevnode(msg); |
447 | if (in_own_node(src_node)) | 434 | if (in_own_node(src_node)) |
448 | tipc_port_recv_msg(rbuf); | 435 | tipc_port_recv_msg(rbuf); |
@@ -552,7 +539,6 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) | |||
552 | int wakeable; | 539 | int wakeable; |
553 | 540 | ||
554 | /* Validate connection */ | 541 | /* Validate connection */ |
555 | |||
556 | p_ptr = tipc_port_lock(destport); | 542 | p_ptr = tipc_port_lock(destport); |
557 | if (!p_ptr || !p_ptr->connected || !tipc_port_peer_msg(p_ptr, msg)) { | 543 | if (!p_ptr || !p_ptr->connected || !tipc_port_peer_msg(p_ptr, msg)) { |
558 | r_buf = tipc_buf_acquire(BASIC_H_SIZE); | 544 | r_buf = tipc_buf_acquire(BASIC_H_SIZE); |
@@ -570,7 +556,6 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) | |||
570 | } | 556 | } |
571 | 557 | ||
572 | /* Process protocol message sent by peer */ | 558 | /* Process protocol message sent by peer */ |
573 | |||
574 | switch (msg_type(msg)) { | 559 | switch (msg_type(msg)) { |
575 | case CONN_ACK: | 560 | case CONN_ACK: |
576 | wakeable = tipc_port_congested(p_ptr) && p_ptr->congested && | 561 | wakeable = tipc_port_congested(p_ptr) && p_ptr->congested && |
@@ -682,7 +667,6 @@ void tipc_port_reinit(void) | |||
682 | * port_dispatcher_sigh(): Signal handler for messages destinated | 667 | * port_dispatcher_sigh(): Signal handler for messages destinated |
683 | * to the tipc_port interface. | 668 | * to the tipc_port interface. |
684 | */ | 669 | */ |
685 | |||
686 | static void port_dispatcher_sigh(void *dummy) | 670 | static void port_dispatcher_sigh(void *dummy) |
687 | { | 671 | { |
688 | struct sk_buff *buf; | 672 | struct sk_buff *buf; |
@@ -843,7 +827,6 @@ reject: | |||
843 | * port_dispatcher(): Dispatcher for messages destinated | 827 | * port_dispatcher(): Dispatcher for messages destinated |
844 | * to the tipc_port interface. Called with port locked. | 828 | * to the tipc_port interface. Called with port locked. |
845 | */ | 829 | */ |
846 | |||
847 | static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) | 830 | static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) |
848 | { | 831 | { |
849 | buf->next = NULL; | 832 | buf->next = NULL; |
@@ -860,10 +843,8 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) | |||
860 | } | 843 | } |
861 | 844 | ||
862 | /* | 845 | /* |
863 | * Wake up port after congestion: Called with port locked, | 846 | * Wake up port after congestion: Called with port locked |
864 | * | ||
865 | */ | 847 | */ |
866 | |||
867 | static void port_wakeup_sh(unsigned long ref) | 848 | static void port_wakeup_sh(unsigned long ref) |
868 | { | 849 | { |
869 | struct tipc_port *p_ptr; | 850 | struct tipc_port *p_ptr; |
@@ -909,7 +890,6 @@ void tipc_acknowledge(u32 ref, u32 ack) | |||
909 | /* | 890 | /* |
910 | * tipc_createport(): user level call. | 891 | * tipc_createport(): user level call. |
911 | */ | 892 | */ |
912 | |||
913 | int tipc_createport(void *usr_handle, | 893 | int tipc_createport(void *usr_handle, |
914 | unsigned int importance, | 894 | unsigned int importance, |
915 | tipc_msg_err_event error_cb, | 895 | tipc_msg_err_event error_cb, |
@@ -918,7 +898,7 @@ int tipc_createport(void *usr_handle, | |||
918 | tipc_msg_event msg_cb, | 898 | tipc_msg_event msg_cb, |
919 | tipc_named_msg_event named_msg_cb, | 899 | tipc_named_msg_event named_msg_cb, |
920 | tipc_conn_msg_event conn_msg_cb, | 900 | tipc_conn_msg_event conn_msg_cb, |
921 | tipc_continue_event continue_event_cb,/* May be zero */ | 901 | tipc_continue_event continue_event_cb, /* May be zero */ |
922 | u32 *portref) | 902 | u32 *portref) |
923 | { | 903 | { |
924 | struct user_port *up_ptr; | 904 | struct user_port *up_ptr; |
@@ -1091,7 +1071,6 @@ exit: | |||
1091 | * | 1071 | * |
1092 | * Port must be locked. | 1072 | * Port must be locked. |
1093 | */ | 1073 | */ |
1094 | |||
1095 | int tipc_disconnect_port(struct tipc_port *tp_ptr) | 1074 | int tipc_disconnect_port(struct tipc_port *tp_ptr) |
1096 | { | 1075 | { |
1097 | int res; | 1076 | int res; |
@@ -1112,7 +1091,6 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr) | |||
1112 | * tipc_disconnect(): Disconnect port form peer. | 1091 | * tipc_disconnect(): Disconnect port form peer. |
1113 | * This is a node local operation. | 1092 | * This is a node local operation. |
1114 | */ | 1093 | */ |
1115 | |||
1116 | int tipc_disconnect(u32 ref) | 1094 | int tipc_disconnect(u32 ref) |
1117 | { | 1095 | { |
1118 | struct tipc_port *p_ptr; | 1096 | struct tipc_port *p_ptr; |
@@ -1147,7 +1125,6 @@ int tipc_shutdown(u32 ref) | |||
1147 | /** | 1125 | /** |
1148 | * tipc_port_recv_msg - receive message from lower layer and deliver to port user | 1126 | * tipc_port_recv_msg - receive message from lower layer and deliver to port user |
1149 | */ | 1127 | */ |
1150 | |||
1151 | int tipc_port_recv_msg(struct sk_buff *buf) | 1128 | int tipc_port_recv_msg(struct sk_buff *buf) |
1152 | { | 1129 | { |
1153 | struct tipc_port *p_ptr; | 1130 | struct tipc_port *p_ptr; |
@@ -1180,7 +1157,6 @@ int tipc_port_recv_msg(struct sk_buff *buf) | |||
1180 | * tipc_port_recv_sections(): Concatenate and deliver sectioned | 1157 | * tipc_port_recv_sections(): Concatenate and deliver sectioned |
1181 | * message for this node. | 1158 | * message for this node. |
1182 | */ | 1159 | */ |
1183 | |||
1184 | static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_sect, | 1160 | static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_sect, |
1185 | struct iovec const *msg_sect, | 1161 | struct iovec const *msg_sect, |
1186 | unsigned int total_len) | 1162 | unsigned int total_len) |
@@ -1198,7 +1174,6 @@ static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_se | |||
1198 | /** | 1174 | /** |
1199 | * tipc_send - send message sections on connection | 1175 | * tipc_send - send message sections on connection |
1200 | */ | 1176 | */ |
1201 | |||
1202 | int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect, | 1177 | int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect, |
1203 | unsigned int total_len) | 1178 | unsigned int total_len) |
1204 | { | 1179 | { |
@@ -1237,7 +1212,6 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect, | |||
1237 | /** | 1212 | /** |
1238 | * tipc_send2name - send message sections to port name | 1213 | * tipc_send2name - send message sections to port name |
1239 | */ | 1214 | */ |
1240 | |||
1241 | int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain, | 1215 | int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain, |
1242 | unsigned int num_sect, struct iovec const *msg_sect, | 1216 | unsigned int num_sect, struct iovec const *msg_sect, |
1243 | unsigned int total_len) | 1217 | unsigned int total_len) |
@@ -1291,7 +1265,6 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain, | |||
1291 | /** | 1265 | /** |
1292 | * tipc_send2port - send message sections to port identity | 1266 | * tipc_send2port - send message sections to port identity |
1293 | */ | 1267 | */ |
1294 | |||
1295 | int tipc_send2port(u32 ref, struct tipc_portid const *dest, | 1268 | int tipc_send2port(u32 ref, struct tipc_portid const *dest, |
1296 | unsigned int num_sect, struct iovec const *msg_sect, | 1269 | unsigned int num_sect, struct iovec const *msg_sect, |
1297 | unsigned int total_len) | 1270 | unsigned int total_len) |
@@ -1334,7 +1307,6 @@ int tipc_send2port(u32 ref, struct tipc_portid const *dest, | |||
1334 | /** | 1307 | /** |
1335 | * tipc_send_buf2port - send message buffer to port identity | 1308 | * tipc_send_buf2port - send message buffer to port identity |
1336 | */ | 1309 | */ |
1337 | |||
1338 | int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest, | 1310 | int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest, |
1339 | struct sk_buff *buf, unsigned int dsz) | 1311 | struct sk_buff *buf, unsigned int dsz) |
1340 | { | 1312 | { |
@@ -1371,4 +1343,3 @@ int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest, | |||
1371 | return dsz; | 1343 | return dsz; |
1372 | return -ELINKCONG; | 1344 | return -ELINKCONG; |
1373 | } | 1345 | } |
1374 | |||