diff options
author | Sowmini Varadhan <sowmini.varadhan@oracle.com> | 2018-02-27 12:52:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-27 14:19:10 -0500 |
commit | 67490e34ba2b1c02fb554a8059cd6ce12b47ccfb (patch) | |
tree | c59a08a8f5e8e88e6b13c4428211860ef2695034 /tools/testing/selftests/net/msg_zerocopy.c | |
parent | c1de13bb9374ae6b8f4278add102fc33e94c463b (diff) |
selftests/net: revert the zerocopy Rx path for PF_RDS
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.varadhan@oracle.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/msg_zerocopy.c')
-rw-r--r-- | 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 5cc2a53bb71c..eff9cf2ff04d 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) | |||
344 | return fd; | 344 | return fd; |
345 | } | 345 | } |
346 | 346 | ||
347 | static int do_process_zerocopy_cookies(struct sock_extended_err *serr, | ||
348 | uint32_t *ckbuf, size_t nbytes) | ||
349 | { | ||
350 | int ncookies, i; | ||
351 | |||
352 | if (serr->ee_errno != 0) | ||
353 | error(1, 0, "serr: wrong error code: %u", serr->ee_errno); | ||
354 | ncookies = serr->ee_data; | ||
355 | if (ncookies > SO_EE_ORIGIN_MAX_ZCOOKIES) | ||
356 | error(1, 0, "Returned %d cookies, max expected %d\n", | ||
357 | ncookies, SO_EE_ORIGIN_MAX_ZCOOKIES); | ||
358 | if (nbytes != ncookies * sizeof(uint32_t)) | ||
359 | error(1, 0, "Expected %d cookies, got %ld\n", | ||
360 | ncookies, nbytes/sizeof(uint32_t)); | ||
361 | for (i = 0; i < ncookies; i++) | ||
362 | if (cfg_verbose >= 2) | ||
363 | fprintf(stderr, "%d\n", ckbuf[i]); | ||
364 | return ncookies; | ||
365 | } | ||
366 | |||
367 | static bool do_recv_completion(int fd) | 347 | static bool do_recv_completion(int fd) |
368 | { | 348 | { |
369 | struct sock_extended_err *serr; | 349 | struct sock_extended_err *serr; |
@@ -372,17 +352,10 @@ static bool do_recv_completion(int fd) | |||
372 | uint32_t hi, lo, range; | 352 | uint32_t hi, lo, range; |
373 | int ret, zerocopy; | 353 | int ret, zerocopy; |
374 | char control[100]; | 354 | char control[100]; |
375 | uint32_t ckbuf[SO_EE_ORIGIN_MAX_ZCOOKIES]; | ||
376 | struct iovec iov; | ||
377 | 355 | ||
378 | msg.msg_control = control; | 356 | msg.msg_control = control; |
379 | msg.msg_controllen = sizeof(control); | 357 | msg.msg_controllen = sizeof(control); |
380 | 358 | ||
381 | iov.iov_base = ckbuf; | ||
382 | iov.iov_len = (SO_EE_ORIGIN_MAX_ZCOOKIES * sizeof(ckbuf[0])); | ||
383 | msg.msg_iov = &iov; | ||
384 | msg.msg_iovlen = 1; | ||
385 | |||
386 | ret = recvmsg(fd, &msg, MSG_ERRQUEUE); | 359 | ret = recvmsg(fd, &msg, MSG_ERRQUEUE); |
387 | if (ret == -1 && errno == EAGAIN) | 360 | if (ret == -1 && errno == EAGAIN) |
388 | return false; | 361 | return false; |
@@ -402,10 +375,6 @@ static bool do_recv_completion(int fd) | |||
402 | 375 | ||
403 | serr = (void *) CMSG_DATA(cm); | 376 | serr = (void *) CMSG_DATA(cm); |
404 | 377 | ||
405 | if (serr->ee_origin == SO_EE_ORIGIN_ZCOOKIE) { | ||
406 | completions += do_process_zerocopy_cookies(serr, ckbuf, ret); | ||
407 | return true; | ||
408 | } | ||
409 | if (serr->ee_origin != SO_EE_ORIGIN_ZEROCOPY) | 378 | if (serr->ee_origin != SO_EE_ORIGIN_ZEROCOPY) |
410 | error(1, 0, "serr: wrong origin: %u", serr->ee_origin); | 379 | error(1, 0, "serr: wrong origin: %u", serr->ee_origin); |
411 | if (serr->ee_errno != 0) | 380 | if (serr->ee_errno != 0) |
@@ -631,40 +600,6 @@ static void do_flush_datagram(int fd, int type) | |||
631 | bytes += cfg_payload_len; | 600 | bytes += cfg_payload_len; |
632 | } | 601 | } |
633 | 602 | ||
634 | |||
635 | static void do_recvmsg(int fd) | ||
636 | { | ||
637 | int ret, off = 0; | ||
638 | char *buf; | ||
639 | struct iovec iov; | ||
640 | struct msghdr msg; | ||
641 | struct sockaddr_storage din; | ||
642 | |||
643 | buf = calloc(cfg_payload_len, sizeof(char)); | ||
644 | iov.iov_base = buf; | ||
645 | iov.iov_len = cfg_payload_len; | ||
646 | |||
647 | memset(&msg, 0, sizeof(msg)); | ||
648 | msg.msg_name = &din; | ||
649 | msg.msg_namelen = sizeof(din); | ||
650 | msg.msg_iov = &iov; | ||
651 | msg.msg_iovlen = 1; | ||
652 | |||
653 | ret = recvmsg(fd, &msg, MSG_TRUNC); | ||
654 | |||
655 | if (ret == -1) | ||
656 | error(1, errno, "recv"); | ||
657 | if (ret != cfg_payload_len) | ||
658 | error(1, 0, "recv: ret=%u != %u", ret, cfg_payload_len); | ||
659 | |||
660 | if (memcmp(buf + off, payload, ret)) | ||
661 | error(1, 0, "recv: data mismatch"); | ||
662 | |||
663 | free(buf); | ||
664 | packets++; | ||
665 | bytes += cfg_payload_len; | ||
666 | } | ||
667 | |||
668 | static void do_rx(int domain, int type, int protocol) | 603 | static void do_rx(int domain, int type, int protocol) |
669 | { | 604 | { |
670 | uint64_t tstop; | 605 | uint64_t tstop; |
@@ -676,8 +611,6 @@ static void do_rx(int domain, int type, int protocol) | |||
676 | do { | 611 | do { |
677 | if (type == SOCK_STREAM) | 612 | if (type == SOCK_STREAM) |
678 | do_flush_tcp(fd); | 613 | do_flush_tcp(fd); |
679 | else if (domain == PF_RDS) | ||
680 | do_recvmsg(fd); | ||
681 | else | 614 | else |
682 | do_flush_datagram(fd, type); | 615 | do_flush_datagram(fd, type); |
683 | 616 | ||