Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2e27255 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller
Browse files

net: Introduce recvmmsg socket syscall



Meaning receive multiple messages, reducing the number of syscalls and
net stack entry/exit operations.

Next patches will introduce mechanisms where protocols that want to
optimize this operation will provide an unlocked_recvmsg operation.

This takes into account comments made by:

. Paul Moore: sock_recvmsg is called only for the first datagram,
  sock_recvmsg_nosec is used for the rest.

. Caitlin Bestler: recvmmsg now has a struct timespec timeout, that
  works in the same fashion as the ppoll one.

  If the underlying protocol returns a datagram with MSG_OOB set, this
  will make recvmmsg return right away with as many datagrams (+ the OOB
  one) it has received so far.

. Rémi Denis-Courmont & Steven Whitehouse: If we receive N < vlen
  datagrams and then recvmsg returns an error, recvmmsg will return
  the successfully received datagrams, store the error and return it
  in the next call.

This paves the way for a subsequent optimization, sk_prot->unlocked_recvmsg,
where we will be able to acquire the lock only at batch start and end, not at
every underlying recvmsg call.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c05e85a0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -497,6 +497,7 @@ sys_call_table:
	.quad sys_signalfd
	.quad sys_ni_syscall
	.quad sys_eventfd
	.quad sys_recvmmsg

	.size sys_call_table, . - sys_call_table
	.type sys_call_table, @object
+1 −0
Original line number Diff line number Diff line
@@ -374,6 +374,7 @@
		CALL(sys_pwritev)
		CALL(sys_rt_tgsigqueueinfo)
		CALL(sys_perf_event_open)
/* 365 */	CALL(sys_recvmmsg)
#ifndef syscalls_counted
.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
#define syscalls_counted
+1 −0
Original line number Diff line number Diff line
@@ -295,4 +295,5 @@ sys_call_table:
	.long	sys_signalfd
	.long	sys_ni_syscall		/* 280, was sys_timerfd */
	.long	sys_eventfd
	.long	sys_recvmmsg
	.long	sys_ni_syscall		/* r8 is saturated at nr_syscalls */
+1 −0
Original line number Diff line number Diff line
@@ -1621,6 +1621,7 @@ ENTRY(_sys_call_table)
	.long _sys_pwritev
	.long _sys_rt_tgsigqueueinfo
	.long _sys_perf_event_open
	.long _sys_recvmmsg		/* 370 */

	.rept NR_syscalls-(.-_sys_call_table)/4
	.long _sys_ni_syscall
+1 −0
Original line number Diff line number Diff line
@@ -1806,6 +1806,7 @@ sys_call_table:
	data8 sys_preadv
	data8 sys_pwritev			// 1320
	data8 sys_rt_tgsigqueueinfo
	data8 sys_recvmmsg

	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
Loading