aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2011-04-21 11:42:07 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-05-10 16:03:57 -0400
commit2689690469c9fd76f9db0afcdf2523f48cce4006 (patch)
tree73d23b37b9e4ad965f893857aa618b0ed110bdf7 /net/tipc
parentc29c3f70c9eb6f18090da5af9dbe9dcb4adece8c (diff)
tipc: Avoid recomputation of outgoing message length
Rework TIPC's message sending routines to take advantage of the total amount of data value passed to it by the kernel socket infrastructure. This change eliminates the need for TIPC to compute the size of outgoing messages itself, as well as the check for an oversize message in tipc_msg_build(). In addition, this change warrants an explanation: - res = send_packet(NULL, sock, &my_msg, 0); + res = send_packet(NULL, sock, &my_msg, bytes_to_send); Previously, the final argument to send_packet() was ignored (since the amount of data being sent was recalculated by a lower-level routine) and we could just pass in a dummy value (0). Now that the recalculation is being eliminated, the argument value being passed to send_packet() is significant and we have to supply the actual amount of data we want to send. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/link.c18
-rw-r--r--net/tipc/link.h1
-rw-r--r--net/tipc/msg.c25
-rw-r--r--net/tipc/msg.h5
-rw-r--r--net/tipc/port.c49
-rw-r--r--net/tipc/port.h14
-rw-r--r--net/tipc/socket.c14
-rw-r--r--net/tipc/subscr.c4
8 files changed, 64 insertions, 66 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 2a9f44a203eb..4bab139d5e74 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -92,7 +92,8 @@ static int link_recv_changeover_msg(struct link **l_ptr, struct sk_buff **buf);
92static void link_set_supervision_props(struct link *l_ptr, u32 tolerance); 92static void link_set_supervision_props(struct link *l_ptr, u32 tolerance);
93static int link_send_sections_long(struct tipc_port *sender, 93static 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, unsigned int total_len,
96 u32 destnode);
96static void link_check_defragm_bufs(struct link *l_ptr); 97static void link_check_defragm_bufs(struct link *l_ptr);
97static void link_state_event(struct link *l_ptr, u32 event); 98static void link_state_event(struct link *l_ptr, u32 event);
98static void link_reset_statistics(struct link *l_ptr); 99static void link_reset_statistics(struct link *l_ptr);
@@ -1043,6 +1044,7 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
1043int tipc_link_send_sections_fast(struct tipc_port *sender, 1044int tipc_link_send_sections_fast(struct tipc_port *sender,
1044 struct iovec const *msg_sect, 1045 struct iovec const *msg_sect,
1045 const u32 num_sect, 1046 const u32 num_sect,
1047 unsigned int total_len,
1046 u32 destaddr) 1048 u32 destaddr)
1047{ 1049{
1048 struct tipc_msg *hdr = &sender->phdr; 1050 struct tipc_msg *hdr = &sender->phdr;
@@ -1058,8 +1060,8 @@ again:
1058 * (Must not hold any locks while building message.) 1060 * (Must not hold any locks while building message.)
1059 */ 1061 */
1060 1062
1061 res = tipc_msg_build(hdr, msg_sect, num_sect, sender->max_pkt, 1063 res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
1062 !sender->user_port, &buf); 1064 sender->max_pkt, !sender->user_port, &buf);
1063 1065
1064 read_lock_bh(&tipc_net_lock); 1066 read_lock_bh(&tipc_net_lock);
1065 node = tipc_node_find(destaddr); 1067 node = tipc_node_find(destaddr);
@@ -1104,7 +1106,8 @@ exit:
1104 goto again; 1106 goto again;
1105 1107
1106 return link_send_sections_long(sender, msg_sect, 1108 return link_send_sections_long(sender, msg_sect,
1107 num_sect, destaddr); 1109 num_sect, total_len,
1110 destaddr);
1108 } 1111 }
1109 tipc_node_unlock(node); 1112 tipc_node_unlock(node);
1110 } 1113 }
@@ -1116,7 +1119,7 @@ exit:
1116 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); 1119 return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
1117 if (res >= 0) 1120 if (res >= 0)
1118 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect, 1121 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
1119 TIPC_ERR_NO_NODE); 1122 total_len, TIPC_ERR_NO_NODE);
1120 return res; 1123 return res;
1121} 1124}
1122 1125
@@ -1137,12 +1140,13 @@ exit:
1137static int link_send_sections_long(struct tipc_port *sender, 1140static int link_send_sections_long(struct tipc_port *sender,
1138 struct iovec const *msg_sect, 1141 struct iovec const *msg_sect,
1139 u32 num_sect, 1142 u32 num_sect,
1143 unsigned int total_len,
1140 u32 destaddr) 1144 u32 destaddr)
1141{ 1145{
1142 struct link *l_ptr; 1146 struct link *l_ptr;
1143 struct tipc_node *node; 1147 struct tipc_node *node;
1144 struct tipc_msg *hdr = &sender->phdr; 1148 struct tipc_msg *hdr = &sender->phdr;
1145 u32 dsz = msg_data_sz(hdr); 1149 u32 dsz = total_len;
1146 u32 max_pkt, fragm_sz, rest; 1150 u32 max_pkt, fragm_sz, rest;
1147 struct tipc_msg fragm_hdr; 1151 struct tipc_msg fragm_hdr;
1148 struct sk_buff *buf, *buf_chain, *prev; 1152 struct sk_buff *buf, *buf_chain, *prev;
@@ -1269,7 +1273,7 @@ reject:
1269 buf_discard(buf_chain); 1273 buf_discard(buf_chain);
1270 } 1274 }
1271 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect, 1275 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
1272 TIPC_ERR_NO_NODE); 1276 total_len, TIPC_ERR_NO_NODE);
1273 } 1277 }
1274 1278
1275 /* Append whole chain to send queue: */ 1279 /* Append whole chain to send queue: */
diff --git a/net/tipc/link.h b/net/tipc/link.h
index e6a30dbe1aaa..74fbecab1ea0 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -228,6 +228,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector);
228int tipc_link_send_sections_fast(struct tipc_port *sender, 228int tipc_link_send_sections_fast(struct tipc_port *sender,
229 struct iovec const *msg_sect, 229 struct iovec const *msg_sect,
230 const u32 num_sect, 230 const u32 num_sect,
231 unsigned int total_len,
231 u32 destnode); 232 u32 destnode);
232void tipc_link_recv_bundle(struct sk_buff *buf); 233void tipc_link_recv_bundle(struct sk_buff *buf);
233int tipc_link_recv_fragment(struct sk_buff **pending, 234int tipc_link_recv_fragment(struct sk_buff **pending,
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 6d92d17e7fb5..03e57bf92c73 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -68,20 +68,6 @@ void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
68} 68}
69 69
70/** 70/**
71 * tipc_msg_calc_data_size - determine total data size for message
72 */
73
74int tipc_msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect)
75{
76 int dsz = 0;
77 int i;
78
79 for (i = 0; i < num_sect; i++)
80 dsz += msg_sect[i].iov_len;
81 return dsz;
82}
83
84/**
85 * tipc_msg_build - create message using specified header and data 71 * tipc_msg_build - create message using specified header and data
86 * 72 *
87 * Note: Caller must not hold any locks in case copy_from_user() is interrupted! 73 * Note: Caller must not hold any locks in case copy_from_user() is interrupted!
@@ -89,18 +75,13 @@ int tipc_msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect)
89 * Returns message data size or errno 75 * Returns message data size or errno
90 */ 76 */
91 77
92int tipc_msg_build(struct tipc_msg *hdr, 78int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
93 struct iovec const *msg_sect, u32 num_sect, 79 u32 num_sect, unsigned int total_len,
94 int max_size, int usrmem, struct sk_buff **buf) 80 int max_size, int usrmem, struct sk_buff **buf)
95{ 81{
96 int dsz, sz, hsz, pos, res, cnt; 82 int dsz, sz, hsz, pos, res, cnt;
97 83
98 dsz = tipc_msg_calc_data_size(msg_sect, num_sect); 84 dsz = total_len;
99 if (unlikely(dsz > TIPC_MAX_USER_MSG_SIZE)) {
100 *buf = NULL;
101 return -EINVAL;
102 }
103
104 pos = hsz = msg_hdr_sz(hdr); 85 pos = hsz = msg_hdr_sz(hdr);
105 sz = hsz + dsz; 86 sz = hsz + dsz;
106 msg_set_size(hdr, sz); 87 msg_set_size(hdr, sz);
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 005b318fd328..8452454731fa 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -750,9 +750,8 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n)
750u32 tipc_msg_tot_importance(struct tipc_msg *m); 750u32 tipc_msg_tot_importance(struct tipc_msg *m);
751void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, 751void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
752 u32 hsize, u32 destnode); 752 u32 hsize, u32 destnode);
753int tipc_msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect); 753int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
754int tipc_msg_build(struct tipc_msg *hdr, 754 u32 num_sect, unsigned int total_len,
755 struct iovec const *msg_sect, u32 num_sect,
756 int max_size, int usrmem, struct sk_buff **buf); 755 int max_size, int usrmem, struct sk_buff **buf);
757 756
758static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) 757static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 9f2ff12cf436..c68dc956a423 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -74,7 +74,8 @@ static u32 port_peerport(struct tipc_port *p_ptr)
74 */ 74 */
75 75
76int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, 76int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
77 u32 num_sect, struct iovec const *msg_sect) 77 u32 num_sect, struct iovec const *msg_sect,
78 unsigned int total_len)
78{ 79{
79 struct tipc_msg *hdr; 80 struct tipc_msg *hdr;
80 struct sk_buff *buf; 81 struct sk_buff *buf;
@@ -98,7 +99,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
98 msg_set_namelower(hdr, seq->lower); 99 msg_set_namelower(hdr, seq->lower);
99 msg_set_nameupper(hdr, seq->upper); 100 msg_set_nameupper(hdr, seq->upper);
100 msg_set_hdr_sz(hdr, MCAST_H_SIZE); 101 msg_set_hdr_sz(hdr, MCAST_H_SIZE);
101 res = tipc_msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, 102 res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
102 !oport->user_port, &buf); 103 !oport->user_port, &buf);
103 if (unlikely(!buf)) 104 if (unlikely(!buf))
104 return res; 105 return res;
@@ -418,12 +419,12 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
418 419
419int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr, 420int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
420 struct iovec const *msg_sect, u32 num_sect, 421 struct iovec const *msg_sect, u32 num_sect,
421 int err) 422 unsigned int total_len, int err)
422{ 423{
423 struct sk_buff *buf; 424 struct sk_buff *buf;
424 int res; 425 int res;
425 426
426 res = tipc_msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, 427 res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
427 !p_ptr->user_port, &buf); 428 !p_ptr->user_port, &buf);
428 if (!buf) 429 if (!buf)
429 return res; 430 return res;
@@ -1163,12 +1164,13 @@ int tipc_shutdown(u32 ref)
1163 */ 1164 */
1164 1165
1165static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_sect, 1166static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_sect,
1166 struct iovec const *msg_sect) 1167 struct iovec const *msg_sect,
1168 unsigned int total_len)
1167{ 1169{
1168 struct sk_buff *buf; 1170 struct sk_buff *buf;
1169 int res; 1171 int res;
1170 1172
1171 res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, 1173 res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, total_len,
1172 MAX_MSG_SIZE, !sender->user_port, &buf); 1174 MAX_MSG_SIZE, !sender->user_port, &buf);
1173 if (likely(buf)) 1175 if (likely(buf))
1174 tipc_port_recv_msg(buf); 1176 tipc_port_recv_msg(buf);
@@ -1179,7 +1181,8 @@ static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_se
1179 * tipc_send - send message sections on connection 1181 * tipc_send - send message sections on connection
1180 */ 1182 */
1181 1183
1182int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect) 1184int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect,
1185 unsigned int total_len)
1183{ 1186{
1184 struct tipc_port *p_ptr; 1187 struct tipc_port *p_ptr;
1185 u32 destnode; 1188 u32 destnode;
@@ -1194,9 +1197,10 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
1194 destnode = port_peernode(p_ptr); 1197 destnode = port_peernode(p_ptr);
1195 if (likely(destnode != tipc_own_addr)) 1198 if (likely(destnode != tipc_own_addr))
1196 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, 1199 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
1197 destnode); 1200 total_len, destnode);
1198 else 1201 else
1199 res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect); 1202 res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect,
1203 total_len);
1200 1204
1201 if (likely(res != -ELINKCONG)) { 1205 if (likely(res != -ELINKCONG)) {
1202 p_ptr->congested = 0; 1206 p_ptr->congested = 0;
@@ -1207,8 +1211,7 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
1207 } 1211 }
1208 if (port_unreliable(p_ptr)) { 1212 if (port_unreliable(p_ptr)) {
1209 p_ptr->congested = 0; 1213 p_ptr->congested = 0;
1210 /* Just calculate msg length and return */ 1214 return total_len;
1211 return tipc_msg_calc_data_size(msg_sect, num_sect);
1212 } 1215 }
1213 return -ELINKCONG; 1216 return -ELINKCONG;
1214} 1217}
@@ -1218,7 +1221,8 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
1218 */ 1221 */
1219 1222
1220int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain, 1223int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
1221 unsigned int num_sect, struct iovec const *msg_sect) 1224 unsigned int num_sect, struct iovec const *msg_sect,
1225 unsigned int total_len)
1222{ 1226{
1223 struct tipc_port *p_ptr; 1227 struct tipc_port *p_ptr;
1224 struct tipc_msg *msg; 1228 struct tipc_msg *msg;
@@ -1245,23 +1249,23 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
1245 if (likely(destport)) { 1249 if (likely(destport)) {
1246 if (likely(destnode == tipc_own_addr)) 1250 if (likely(destnode == tipc_own_addr))
1247 res = tipc_port_recv_sections(p_ptr, num_sect, 1251 res = tipc_port_recv_sections(p_ptr, num_sect,
1248 msg_sect); 1252 msg_sect, total_len);
1249 else 1253 else
1250 res = tipc_link_send_sections_fast(p_ptr, msg_sect, 1254 res = tipc_link_send_sections_fast(p_ptr, msg_sect,
1251 num_sect, destnode); 1255 num_sect, total_len,
1256 destnode);
1252 if (likely(res != -ELINKCONG)) { 1257 if (likely(res != -ELINKCONG)) {
1253 if (res > 0) 1258 if (res > 0)
1254 p_ptr->sent++; 1259 p_ptr->sent++;
1255 return res; 1260 return res;
1256 } 1261 }
1257 if (port_unreliable(p_ptr)) { 1262 if (port_unreliable(p_ptr)) {
1258 /* Just calculate msg length and return */ 1263 return total_len;
1259 return tipc_msg_calc_data_size(msg_sect, num_sect);
1260 } 1264 }
1261 return -ELINKCONG; 1265 return -ELINKCONG;
1262 } 1266 }
1263 return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect, 1267 return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect,
1264 TIPC_ERR_NO_NAME); 1268 total_len, TIPC_ERR_NO_NAME);
1265} 1269}
1266 1270
1267/** 1271/**
@@ -1269,7 +1273,8 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
1269 */ 1273 */
1270 1274
1271int tipc_send2port(u32 ref, struct tipc_portid const *dest, 1275int tipc_send2port(u32 ref, struct tipc_portid const *dest,
1272 unsigned int num_sect, struct iovec const *msg_sect) 1276 unsigned int num_sect, struct iovec const *msg_sect,
1277 unsigned int total_len)
1273{ 1278{
1274 struct tipc_port *p_ptr; 1279 struct tipc_port *p_ptr;
1275 struct tipc_msg *msg; 1280 struct tipc_msg *msg;
@@ -1289,18 +1294,18 @@ int tipc_send2port(u32 ref, struct tipc_portid const *dest,
1289 msg_set_hdr_sz(msg, DIR_MSG_H_SIZE); 1294 msg_set_hdr_sz(msg, DIR_MSG_H_SIZE);
1290 1295
1291 if (dest->node == tipc_own_addr) 1296 if (dest->node == tipc_own_addr)
1292 res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect); 1297 res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect,
1298 total_len);
1293 else 1299 else
1294 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, 1300 res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
1295 dest->node); 1301 total_len, dest->node);
1296 if (likely(res != -ELINKCONG)) { 1302 if (likely(res != -ELINKCONG)) {
1297 if (res > 0) 1303 if (res > 0)
1298 p_ptr->sent++; 1304 p_ptr->sent++;
1299 return res; 1305 return res;
1300 } 1306 }
1301 if (port_unreliable(p_ptr)) { 1307 if (port_unreliable(p_ptr)) {
1302 /* Just calculate msg length and return */ 1308 return total_len;
1303 return tipc_msg_calc_data_size(msg_sect, num_sect);
1304 } 1309 }
1305 return -ELINKCONG; 1310 return -ELINKCONG;
1306} 1311}
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 87b9424ae0ec..b9aa34195aec 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -205,23 +205,27 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr);
205/* 205/*
206 * TIPC messaging routines 206 * TIPC messaging routines
207 */ 207 */
208int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect); 208int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect,
209 unsigned int total_len);
209 210
210int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain, 211int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain,
211 unsigned int num_sect, struct iovec const *msg_sect); 212 unsigned int num_sect, struct iovec const *msg_sect,
213 unsigned int total_len);
212 214
213int tipc_send2port(u32 portref, struct tipc_portid const *dest, 215int tipc_send2port(u32 portref, struct tipc_portid const *dest,
214 unsigned int num_sect, struct iovec const *msg_sect); 216 unsigned int num_sect, struct iovec const *msg_sect,
217 unsigned int total_len);
215 218
216int tipc_send_buf2port(u32 portref, struct tipc_portid const *dest, 219int tipc_send_buf2port(u32 portref, struct tipc_portid const *dest,
217 struct sk_buff *buf, unsigned int dsz); 220 struct sk_buff *buf, unsigned int dsz);
218 221
219int tipc_multicast(u32 portref, struct tipc_name_seq const *seq, 222int tipc_multicast(u32 portref, struct tipc_name_seq const *seq,
220 unsigned int section_count, struct iovec const *msg); 223 unsigned int section_count, struct iovec const *msg,
224 unsigned int total_len);
221 225
222int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr, 226int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
223 struct iovec const *msg_sect, u32 num_sect, 227 struct iovec const *msg_sect, u32 num_sect,
224 int err); 228 unsigned int total_len, int err);
225struct sk_buff *tipc_port_get_ports(void); 229struct sk_buff *tipc_port_get_ports(void);
226void tipc_port_recv_proto_msg(struct sk_buff *buf); 230void tipc_port_recv_proto_msg(struct sk_buff *buf);
227void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp); 231void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp);
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index e1c791798ba1..338837396642 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -576,12 +576,14 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
576 &dest->addr.name.name, 576 &dest->addr.name.name,
577 dest->addr.name.domain, 577 dest->addr.name.domain,
578 m->msg_iovlen, 578 m->msg_iovlen,
579 m->msg_iov); 579 m->msg_iov,
580 total_len);
580 } else if (dest->addrtype == TIPC_ADDR_ID) { 581 } else if (dest->addrtype == TIPC_ADDR_ID) {
581 res = tipc_send2port(tport->ref, 582 res = tipc_send2port(tport->ref,
582 &dest->addr.id, 583 &dest->addr.id,
583 m->msg_iovlen, 584 m->msg_iovlen,
584 m->msg_iov); 585 m->msg_iov,
586 total_len);
585 } else if (dest->addrtype == TIPC_ADDR_MCAST) { 587 } else if (dest->addrtype == TIPC_ADDR_MCAST) {
586 if (needs_conn) { 588 if (needs_conn) {
587 res = -EOPNOTSUPP; 589 res = -EOPNOTSUPP;
@@ -593,7 +595,8 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
593 res = tipc_multicast(tport->ref, 595 res = tipc_multicast(tport->ref,
594 &dest->addr.nameseq, 596 &dest->addr.nameseq,
595 m->msg_iovlen, 597 m->msg_iovlen,
596 m->msg_iov); 598 m->msg_iov,
599 total_len);
597 } 600 }
598 if (likely(res != -ELINKCONG)) { 601 if (likely(res != -ELINKCONG)) {
599 if (needs_conn && (res >= 0)) 602 if (needs_conn && (res >= 0))
@@ -659,7 +662,8 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
659 break; 662 break;
660 } 663 }
661 664
662 res = tipc_send(tport->ref, m->msg_iovlen, m->msg_iov); 665 res = tipc_send(tport->ref, m->msg_iovlen, m->msg_iov,
666 total_len);
663 if (likely(res != -ELINKCONG)) 667 if (likely(res != -ELINKCONG))
664 break; 668 break;
665 if (m->msg_flags & MSG_DONTWAIT) { 669 if (m->msg_flags & MSG_DONTWAIT) {
@@ -766,7 +770,7 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
766 bytes_to_send = curr_left; 770 bytes_to_send = curr_left;
767 my_iov.iov_base = curr_start; 771 my_iov.iov_base = curr_start;
768 my_iov.iov_len = bytes_to_send; 772 my_iov.iov_len = bytes_to_send;
769 res = send_packet(NULL, sock, &my_msg, 0); 773 res = send_packet(NULL, sock, &my_msg, bytes_to_send);
770 if (res < 0) { 774 if (res < 0) {
771 if (bytes_sent) 775 if (bytes_sent)
772 res = bytes_sent; 776 res = bytes_sent;
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index aae9eae13404..6cf726863485 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -109,7 +109,7 @@ static void subscr_send_event(struct subscription *sub,
109 sub->evt.found_upper = htohl(found_upper, sub->swap); 109 sub->evt.found_upper = htohl(found_upper, sub->swap);
110 sub->evt.port.ref = htohl(port_ref, sub->swap); 110 sub->evt.port.ref = htohl(port_ref, sub->swap);
111 sub->evt.port.node = htohl(node, sub->swap); 111 sub->evt.port.node = htohl(node, sub->swap);
112 tipc_send(sub->server_ref, 1, &msg_sect); 112 tipc_send(sub->server_ref, 1, &msg_sect, msg_sect.iov_len);
113} 113}
114 114
115/** 115/**
@@ -521,7 +521,7 @@ static void subscr_named_msg_event(void *usr_handle,
521 521
522 /* Send an ACK- to complete connection handshaking */ 522 /* Send an ACK- to complete connection handshaking */
523 523
524 tipc_send(server_port_ref, 0, NULL); 524 tipc_send(server_port_ref, 0, NULL, 0);
525 525
526 /* Handle optional subscription request */ 526 /* Handle optional subscription request */
527 527