diff options
| author | Anton Blanchard <anton@samba.org> | 2011-05-02 16:21:35 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2011-05-05 14:10:14 -0400 |
| commit | 228e548e602061b08ee8e8966f567c12aa079682 (patch) | |
| tree | 4c79ecf071d6174d42da1557812a4646d0aaa5af /include/linux | |
| parent | 1c5cae815d19ffe02bdfda1260949ef2b1806171 (diff) | |
net: Add sendmmsg socket system call
This patch adds a multiple message send syscall and is the send
version of the existing recvmmsg syscall. This is heavily
based on the patch by Arnaldo that added recvmmsg.
I wrote a microbenchmark to test the performance gains of using
this new syscall:
http://ozlabs.org/~anton/junkcode/sendmmsg_test.c
The test was run on a ppc64 box with a 10 Gbit network card. The
benchmark can send both UDP and RAW ethernet packets.
64B UDP
batch pkts/sec
1 804570
2 872800 (+ 8 %)
4 916556 (+14 %)
8 939712 (+17 %)
16 952688 (+18 %)
32 956448 (+19 %)
64 964800 (+20 %)
64B raw socket
batch pkts/sec
1 1201449
2 1350028 (+12 %)
4 1461416 (+22 %)
8 1513080 (+26 %)
16 1541216 (+28 %)
32 1553440 (+29 %)
64 1557888 (+30 %)
We see a 20% improvement in throughput on UDP send and 30%
on raw socket send.
[ Add sparc syscall entries. -DaveM ]
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/net.h | 1 | ||||
| -rw-r--r-- | include/linux/socket.h | 2 | ||||
| -rw-r--r-- | include/linux/syscalls.h | 2 |
3 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/net.h b/include/linux/net.h index 94de83c0f87..1da55e9b6f0 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ | 42 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ |
| 43 | #define SYS_ACCEPT4 18 /* sys_accept4(2) */ | 43 | #define SYS_ACCEPT4 18 /* sys_accept4(2) */ |
| 44 | #define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */ | 44 | #define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */ |
| 45 | #define SYS_SENDMMSG 20 /* sys_sendmmsg(2) */ | ||
| 45 | 46 | ||
| 46 | typedef enum { | 47 | typedef enum { |
| 47 | SS_FREE = 0, /* not allocated */ | 48 | SS_FREE = 0, /* not allocated */ |
diff --git a/include/linux/socket.h b/include/linux/socket.h index d2b5e982f07..4ef98e422fd 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -333,5 +333,7 @@ struct timespec; | |||
| 333 | 333 | ||
| 334 | extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, | 334 | extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, |
| 335 | unsigned int flags, struct timespec *timeout); | 335 | unsigned int flags, struct timespec *timeout); |
| 336 | extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, | ||
| 337 | unsigned int vlen, unsigned int flags); | ||
| 336 | #endif /* not kernel and not glibc */ | 338 | #endif /* not kernel and not glibc */ |
| 337 | #endif /* _LINUX_SOCKET_H */ | 339 | #endif /* _LINUX_SOCKET_H */ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 83ecc1749ef..ab71447d0c5 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -610,6 +610,8 @@ asmlinkage long sys_send(int, void __user *, size_t, unsigned); | |||
| 610 | asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, | 610 | asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, |
| 611 | struct sockaddr __user *, int); | 611 | struct sockaddr __user *, int); |
| 612 | asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); | 612 | asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); |
| 613 | asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg, | ||
| 614 | unsigned int vlen, unsigned flags); | ||
| 613 | asmlinkage long sys_recv(int, void __user *, size_t, unsigned); | 615 | asmlinkage long sys_recv(int, void __user *, size_t, unsigned); |
| 614 | asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, | 616 | asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, |
| 615 | struct sockaddr __user *, int __user *); | 617 | struct sockaddr __user *, int __user *); |
