Thread (23 messages) flat view 23 messages, 3 authors, 2018-01-28

Re: [PATCH net-next 6/7] selftests/net: add support for PF_RDS sockets

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2018-01-28 13:59:38

On Wed, Jan 24, 2018 at 12:46 PM, Sowmini Varadhan
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
Add support for basic PF_RDS client-server testing in msg_zerocopy

Signed-off-by: Sowmini Varadhan <redacted>
---
 tools/testing/selftests/net/msg_zerocopy.c |   65 +++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 1 deletions(-)
diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c
index e11fe84..7a5b353 100644
--- a/tools/testing/selftests/net/msg_zerocopy.c
+++ b/tools/testing/selftests/net/msg_zerocopy.c
quoted hunk ↗ jump to hunk
@@ -555,6 +571,40 @@ static void do_flush_datagram(int fd, int type)
        bytes += cfg_payload_len;
 }

+
+static void do_recvmsg(int fd)
+{
Can PF_RDS/SOC_SEQPACKET use one of the existing bytestream
or datagram flush methods?
+       int ret, off = 0;
+       char *buf;
+       struct iovec iov;
+       struct msghdr msg;
+       struct sockaddr_storage din;
+
+       buf = calloc(cfg_payload_len, sizeof(char));
+       iov.iov_base = buf;
+       iov.iov_len = cfg_payload_len;
+
+       memset(&msg, 0, sizeof(msg));
+       msg.msg_name = &din;
+       msg.msg_namelen = sizeof(din);
Not read, so no need to configure. In that case a simpler
recv will do and is more concise than setting up recvmsg.
+       msg.msg_iov = &iov;
+       msg.msg_iovlen = 1;
+
+       ret = recvmsg(fd, &msg, MSG_TRUNC);
+
+       if (ret == -1)
+               error(1, errno, "recv");
+       if (ret != cfg_payload_len)
+               error(1, 0, "recv: ret=%u != %u", ret, cfg_payload_len);
+
+       if (memcmp(buf + off, payload, ret))
+               error(1, 0, "recv: data mismatch");
+
+       free(buf);
+       packets++;
+       bytes += cfg_payload_len;
+}
+
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help