[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-L0qfqWMN6sH6F_LS-9XayGYpsoSFAHGHXZmNYmHgobvA@mail.gmail.com>
Date: Sun, 28 Jan 2018 14:58:56 +0100
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Sowmini Varadhan <sowmini.varadhan@...cle.com>
Cc: Network Development <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>, rds-devel@....oracle.com,
santosh.shilimkar@...cle.com
Subject: Re: [PATCH net-next 6/7] selftests/net: add support for PF_RDS sockets
On Wed, Jan 24, 2018 at 12:46 PM, Sowmini Varadhan
<sowmini.varadhan@...cle.com> wrote:
> Add support for basic PF_RDS client-server testing in msg_zerocopy
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@...cle.com>
> ---
> 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
> @@ -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;
> +}
> +
Powered by blists - more mailing lists