diff options
author | Tom Herbert <tom@herbertland.com> | 2016-03-07 23:11:03 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-09 22:36:13 +0100 |
commit | f092276d85b82504e8a07498f4e9e0c51f06745c (patch) | |
tree | c1d130980b720167581a0f74a9a8bd2746e8cee2 /net/socket.c | |
parent | net: Allow MSG_EOR in each msghdr of sendmmsg (diff) | |
download | linux-f092276d85b82504e8a07498f4e9e0c51f06745c.tar.xz linux-f092276d85b82504e8a07498f4e9e0c51f06745c.zip |
net: Add MSG_BATCH flag
Add a new msg flag called MSG_BATCH. This flag is used in sendmsg to
indicate that more messages will follow (i.e. a batch of messages is
being sent). This is similar to MSG_MORE except that the following
messages are not merged into one packet, they are sent individually.
sendmmsg is updated so that each contained message except for the
last one is marked as MSG_BATCH.
MSG_BATCH is a performance optimization in cases where a socket
implementation can benefit by transmitting packets in a batch.
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c index 0dd4dd818f41..886649c88d8f 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2008,6 +2008,7 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, struct compat_mmsghdr __user *compat_entry; struct msghdr msg_sys; struct used_address used_address; + unsigned int oflags = flags; if (vlen > UIO_MAXIOV) vlen = UIO_MAXIOV; @@ -2022,8 +2023,12 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, entry = mmsg; compat_entry = (struct compat_mmsghdr __user *)mmsg; err = 0; + flags |= MSG_BATCH; while (datagrams < vlen) { + if (datagrams == vlen - 1) + flags = oflags; + if (MSG_CMSG_COMPAT & flags) { err = ___sys_sendmsg(sock, (struct user_msghdr __user *)compat_entry, &msg_sys, flags, &used_address, MSG_EOR); |