In preparation for optimized reception of zerocopy completion,
revert the Rx side changes introduced by Commit dfb8434b0a94
("selftests/net: add zerocopy support for PF_RDS test case")

Signed-off-by: Sowmini Varadhan <sowmini.varad...@oracle.com>
Acked-by: Willem de Bruijn <will...@google.com>
Acked-by: Santosh Shilimkar <santosh.shilim...@oracle.com>
---
v2: prepare to remove sk_error_queue based path; remove recvmsg() as well,
    PF_RDS can also use recv() for the usage pattern in msg_zerocopy

 tools/testing/selftests/net/msg_zerocopy.c |   67 ----------------------------
 1 files changed, 0 insertions(+), 67 deletions(-)

diff --git a/tools/testing/selftests/net/msg_zerocopy.c 
b/tools/testing/selftests/net/msg_zerocopy.c
index 5cc2a53..eff9cf2 100644
--- a/tools/testing/selftests/net/msg_zerocopy.c
+++ b/tools/testing/selftests/net/msg_zerocopy.c
@@ -344,26 +344,6 @@ static int do_setup_tx(int domain, int type, int protocol)
        return fd;
 }
 
-static int do_process_zerocopy_cookies(struct sock_extended_err *serr,
-                                      uint32_t *ckbuf, size_t nbytes)
-{
-       int ncookies, i;
-
-       if (serr->ee_errno != 0)
-               error(1, 0, "serr: wrong error code: %u", serr->ee_errno);
-       ncookies = serr->ee_data;
-       if (ncookies > SO_EE_ORIGIN_MAX_ZCOOKIES)
-               error(1, 0, "Returned %d cookies, max expected %d\n",
-                     ncookies, SO_EE_ORIGIN_MAX_ZCOOKIES);
-       if (nbytes != ncookies * sizeof(uint32_t))
-               error(1, 0, "Expected %d cookies, got %ld\n",
-                     ncookies, nbytes/sizeof(uint32_t));
-       for (i = 0; i < ncookies; i++)
-               if (cfg_verbose >= 2)
-                       fprintf(stderr, "%d\n", ckbuf[i]);
-       return ncookies;
-}
-
 static bool do_recv_completion(int fd)
 {
        struct sock_extended_err *serr;
@@ -372,17 +352,10 @@ static bool do_recv_completion(int fd)
        uint32_t hi, lo, range;
        int ret, zerocopy;
        char control[100];
-       uint32_t ckbuf[SO_EE_ORIGIN_MAX_ZCOOKIES];
-       struct iovec iov;
 
        msg.msg_control = control;
        msg.msg_controllen = sizeof(control);
 
-       iov.iov_base = ckbuf;
-       iov.iov_len = (SO_EE_ORIGIN_MAX_ZCOOKIES * sizeof(ckbuf[0]));
-       msg.msg_iov = &iov;
-       msg.msg_iovlen = 1;
-
        ret = recvmsg(fd, &msg, MSG_ERRQUEUE);
        if (ret == -1 && errno == EAGAIN)
                return false;
@@ -402,10 +375,6 @@ static bool do_recv_completion(int fd)
 
        serr = (void *) CMSG_DATA(cm);
 
-       if (serr->ee_origin == SO_EE_ORIGIN_ZCOOKIE) {
-               completions += do_process_zerocopy_cookies(serr, ckbuf, ret);
-               return true;
-       }
        if (serr->ee_origin != SO_EE_ORIGIN_ZEROCOPY)
                error(1, 0, "serr: wrong origin: %u", serr->ee_origin);
        if (serr->ee_errno != 0)
@@ -631,40 +600,6 @@ static void do_flush_datagram(int fd, int type)
        bytes += cfg_payload_len;
 }
 
-
-static void do_recvmsg(int fd)
-{
-       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);
-       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;
-}
-
 static void do_rx(int domain, int type, int protocol)
 {
        uint64_t tstop;
@@ -676,8 +611,6 @@ static void do_rx(int domain, int type, int protocol)
        do {
                if (type == SOCK_STREAM)
                        do_flush_tcp(fd);
-               else if (domain == PF_RDS)
-                       do_recvmsg(fd);
                else
                        do_flush_datagram(fd, type);
 
-- 
1.7.1

Reply via email to