From: chrubis@suse.cz
To: alexey.kodanev@oracle.com
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] network: tcp_fastopen: add TCP Fast Open test
Date: Thu, 7 Nov 2013 11:06:51 +0100 [thread overview]
Message-ID: <20131107100651.GA27699@rei> (raw)
In-Reply-To: <527B5E5B.9040709@oracle.com>
Hi!
> >> +
> >> +/* test options */
> >> +static char *narg, *Narg, *qarg, *barg, *Barg,
> >> + *rarg, *Rarg, *aarg, *Targ;
> >> +static int nflag, Nflag, qflag, bflag, Bflag, dflag,
> >> + rflag, Rflag, aflag, Hflag, Tflag, gflag;
> > There is no reason to use these flags. The option pointers are set to
> > NULL (global variables). So that you can use:
> >
> > if (arg) {
> > ...
> > }
> >
> > In the check_opt() functions.
> OK
> >> + {"o", &tcp_api, NULL},
> > This should be rather named as use_fastopen beacuse as it is, the name
> > is misleading (I was wondering if there were some changes in the TCP
> > userspace API for a while).
> There are changes in user-space TCP API: we don't use normal TCP system
> calls: connect(), send(), write(). Instead making use of sendmsg(),
> sendto() which are normally used in UDP. Some additional flags were
> introduced.
Still I think it would be better to use 'fastopen' string in the opt
name.
> >> +int sock_recv_poll(int *fd, char *buf, const int *buf_size, int *offset)
> >> +{
> >> + struct pollfd pfd;
> >> + pfd.fd = *fd;
> >> + pfd.events = POLLIN;
> >> + int len = -1;
> >> + while (1) {
> >> + errno = 0;
> >> + int ret = poll(&pfd, 1, wait_timeout / 1000);
> >> + if (ret == -1) {
> >> + if (errno == EINTR)
> >> + continue;
> >> + tst_resm(TFAIL | TERRNO, "poll failed at %s:%d",
> >> + __FILE__, __LINE__);
> >> + break;
> >> + }
> >> + if (ret == 0) {
> >> + tst_resm(TFAIL, "msg timeout, sock '%d'", *fd);
> >> + break;
> >> + }
> >> +
> >> + if (ret != 1 || !(pfd.revents & POLLIN))
> >> + break;
> >> +
> >> + errno = 0;
> >> + len = recv(*fd, buf + *offset,
> >> + *buf_size - *offset, MSG_DONTWAIT);
> >> +
> >> + if (len == -1 && (errno == EINTR ||
> >> + errno == EWOULDBLOCK || errno == EAGAIN))
> >> + continue;
> >> + else
> >> + break;
> >> + }
> >> +
> >> + if (len == 0)
> >> + tst_resm(TINFO, "sock was closed '%d'", *fd);
> >> +
> >> + return len;
> >> +}
> > Now this one seems wrong. Both client and server creates new thread for
> > each connection, which means that this creates bussy loop (which will
> > eventually degrade performance). Why don't you use blocking read() so
> > that each thread waits in read() syscall util data are ready?
> It's not busy loop here, poll() will block. The purpose of the while(1)
> is to go once more if the poll call was interrupted. I think I need to
> remove EWOULDBLOCK and EGAIN errors checking as poll doesn't have their.
> I didn't use read with block because I wanted some sort of block wait
> timeout, which poll has.
Ah my bad, I see it now.
> > Can we default to localhost, would that work?
> It will work, but we won't see some significant performance results.
Ok.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
prev parent reply other threads:[~2013-11-07 10:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-28 14:18 [LTP] [PATCH] network: tcp_fastopen: add TCP Fast Open test Alexey Kodanev
2013-10-29 3:16 ` Hangbin Liu
2013-11-06 15:05 ` chrubis
[not found] ` <527B5E5B.9040709@oracle.com>
2013-11-07 10:06 ` chrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131107100651.GA27699@rei \
--to=chrubis@suse.cz \
--cc=alexey.kodanev@oracle.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=vasily.isaenko@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox