Skip to content

Commit 76b29ef

Browse files
sowminivdavem330
authored andcommitted
RDS-TCP: Set up MSG_MORE and MSG_SENDPAGE_NOTLAST as appropriate in rds_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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1edd6a1 commit 76b29ef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

net/rds/tcp_send.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
8383
struct rds_tcp_connection *tc = conn->c_transport_data;
8484
int done = 0;
8585
int ret = 0;
86+
int more;
8687

8788
if (hdr_off == 0) {
8889
/*
@@ -116,12 +117,15 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
116117
goto out;
117118
}
118119

120+
more = rm->data.op_nents > 1 ? (MSG_MORE | MSG_SENDPAGE_NOTLAST) : 0;
119121
while (sg < rm->data.op_nents) {
122+
int flags = MSG_DONTWAIT | MSG_NOSIGNAL | more;
123+
120124
ret = tc->t_sock->ops->sendpage(tc->t_sock,
121125
sg_page(&rm->data.op_sg[sg]),
122126
rm->data.op_sg[sg].offset + off,
123127
rm->data.op_sg[sg].length - off,
124-
MSG_DONTWAIT|MSG_NOSIGNAL);
128+
flags);
125129
rdsdebug("tcp sendpage %p:%u:%u ret %d\n", (void *)sg_page(&rm->data.op_sg[sg]),
126130
rm->data.op_sg[sg].offset + off, rm->data.op_sg[sg].length - off,
127131
ret);
@@ -134,6 +138,8 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
134138
off = 0;
135139
sg++;
136140
}
141+
if (sg == rm->data.op_nents - 1)
142+
more = 0;
137143
}
138144

139145
out:

0 commit comments

Comments
 (0)