On Mon, Feb 20, 2023 at 09:05:12AM +0000, Krasnov Arseniy wrote:
On 16.02.2023 18:29, Stefano Garzarella wrote:
On Mon, Feb 06, 2023 at 07:06:32AM +0000, Arseniy Krasnov wrote:
To use this option pass '--zc' parameter:
--zerocopy or --zero-copy maybe better follow what we did with the other parameters :-)
./vsock_perf --zc --sender <cid> --port <port> --bytes <bytes to send>
With this option MSG_ZEROCOPY flag will be passed to the 'send()' call.
Signed-off-by: Arseniy Krasnov <AVKrasnov@xxxxxxxxxxxxxx>
---
tools/testing/vsock/vsock_perf.c | 127 +++++++++++++++++++++++++++++--
1 file changed, 120 insertions(+), 7 deletions(-)
diff --git a/tools/testing/vsock/vsock_perf.c b/tools/testing/vsock/vsock_perf.c
index a72520338f84..1d435be9b48e 100644
--- a/tools/testing/vsock/vsock_perf.c
+++ b/tools/testing/vsock/vsock_perf.c
@@ -18,6 +18,8 @@
#include <poll.h>
#include <sys/socket.h>
#include <linux/vm_sockets.h>
+#include <sys/mman.h>
+#include <linux/errqueue.h>
#define DEFAULT_BUF_SIZE_BYTES (128 * 1024)
#define DEFAULT_TO_SEND_BYTES (64 * 1024)
@@ -28,9 +30,14 @@
#define BYTES_PER_GB (1024 * 1024 * 1024ULL)
#define NSEC_PER_SEC (1000000000ULL)
+#ifndef SOL_VSOCK
+#define SOL_VSOCK 287
+#endif
I thought we use the current kernel headers when we compile the tests,
do we need to fix something in the makefile?
Not sure, of course we are using uapi. But i see, that defines like SOL_XXX is not
defined in uapi headers. For example SOL_IP is defined in include/linux/socket.h,
but userspace app uses SOL_IP from in.h (at least on my machine). E.g. SOL_XXX is
not exported to user.
Right, I see only few SOL_* in the uapi, e.g. SOL_TIPC in
uapi/linux/tipc.h
So it's fine for now, otherwise we can define it in
uapi/linux/vm_sockets.h
Thanks,
Stefano