aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
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/socket.c
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/socket.c')
-rw-r--r--net/tipc/socket.c14
1 files changed, 9 insertions, 5 deletions
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;