History

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")

Sowmini Varadhan committed 8 years ago

Commit 67490e31 parent c1de13b1 file · +0 −67Browse files

Unified · Split

tools/testing/selftests/net/msg_zerocopy.c+0−67
@@ -344,26 +344,6 @@ static int do_setup_tx(int domain, int type, int protocol) · 343 unmodified lines
344344 return fd;
345345 }
346346
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−
367347 static bool do_recv_completion(int fd)
368348 {
369349 struct sock_extended_err *serr;
@@ -372,17 +352,10 @@ static bool do_recv_completion(int fd) · 2 unmodified lines
372352 uint32_t hi, lo, range;
373353 int ret, zerocopy;
374354 char control[100];
375− uint32_t ckbuf[SO_EE_ORIGIN_MAX_ZCOOKIES];
376− struct iovec iov;
377355
378356 msg.msg_control = control;
379357 msg.msg_controllen = sizeof(control);
380358
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−
386359 ret = recvmsg(fd, &msg, MSG_ERRQUEUE);
387360 if (ret == -1 && errno == EAGAIN)
388361 return false;
@@ -402,10 +375,6 @@ static bool do_recv_completion(int fd) · 13 unmodified lines
402375
403376 serr = (void *) CMSG_DATA(cm);
404377
405− if (serr->ee_origin == SO_EE_ORIGIN_ZCOOKIE) {
406− completions += do_process_zerocopy_cookies(serr, ckbuf, ret);
407− return true;
408− }
409378 if (serr->ee_origin != SO_EE_ORIGIN_ZEROCOPY)
410379 error(1, 0, "serr: wrong origin: %u", serr->ee_origin);
411380 if (serr->ee_errno != 0)
@@ -631,40 +600,6 @@ static void do_flush_datagram(int fd, int type) · 219 unmodified lines
631600 bytes += cfg_payload_len;
632601 }
633602
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−
668603 static void do_rx(int domain, int type, int protocol)
669604 {
670605 uint64_t tstop;
@@ -676,8 +611,6 @@ static void do_rx(int domain, int type, int protocol) · 5 unmodified lines
676611 do {
677612 if (type == SOCK_STREAM)
678613 do_flush_tcp(fd);
679− else if (domain == PF_RDS)
680− do_recvmsg(fd);
681614 else
682615 do_flush_datagram(fd, type);
683616