Skip to content

Commit

Permalink
RDS-TCP: Set up MSG_MORE and MSG_SENDPAGE_NOTLAST as appropriate in r…
Browse files Browse the repository at this point in the history
…ds_tcp_xmit

For the same reasons as commit 2f53384 ("tcp: allow splice() to
build full TSO packets") and commit 35f9c09 ("tcp: tcp_sendpages()
should call tcp_push() once"), rds_tcp_xmit may have multiple pages to
send, so use the MSG_MORE and MSG_SENDPAGE_NOTLAST as hints to
tcp_sendpage()

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sowmini Varadhan authored and David S. Miller committed Oct 5, 2015
1 parent 1edd6a1 commit 76b29ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net/rds/tcp_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
struct rds_tcp_connection *tc = conn->c_transport_data;
int done = 0;
int ret = 0;
int more;

if (hdr_off == 0) {
/*
Expand Down Expand Up @@ -116,12 +117,15 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
goto out;
}

more = rm->data.op_nents > 1 ? (MSG_MORE | MSG_SENDPAGE_NOTLAST) : 0;
while (sg < rm->data.op_nents) {
int flags = MSG_DONTWAIT | MSG_NOSIGNAL | more;

ret = tc->t_sock->ops->sendpage(tc->t_sock,
sg_page(&rm->data.op_sg[sg]),
rm->data.op_sg[sg].offset + off,
rm->data.op_sg[sg].length - off,
MSG_DONTWAIT|MSG_NOSIGNAL);
flags);
rdsdebug("tcp sendpage %p:%u:%u ret %d\n", (void *)sg_page(&rm->data.op_sg[sg]),
rm->data.op_sg[sg].offset + off, rm->data.op_sg[sg].length - off,
ret);
Expand All @@ -134,6 +138,8 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
off = 0;
sg++;
}
if (sg == rm->data.op_nents - 1)
more = 0;
}

out:
Expand Down

0 comments on commit 76b29ef

Please sign in to comment.