* [LTP] [PATCH 0/4] netstress: new option and some enhancements
@ 2019-02-11 18:07 Alexey Kodanev
2019-02-11 18:07 ` [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag Alexey Kodanev
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Alexey Kodanev @ 2019-02-11 18:07 UTC (permalink / raw)
To: ltp
Mainly, for UDP protocol.
Alexey Kodanev (4):
netstress: support SO_REUSEPORT with new 'P' flag
netstress: allow setting MSG_ZEROCOPY for other protocols
netstress: handle zero length message for datagram sockets
netstress: increase timeout errors counter
testcases/network/netstress/netstress.c | 39 ++++++++++++++++++++++--------
1 files changed, 28 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread* [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag 2019-02-11 18:07 [LTP] [PATCH 0/4] netstress: new option and some enhancements Alexey Kodanev @ 2019-02-11 18:07 ` Alexey Kodanev 2019-02-14 23:21 ` Petr Vorel 2019-02-11 18:07 ` [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols Alexey Kodanev ` (2 subsequent siblings) 3 siblings, 1 reply; 10+ messages in thread From: Alexey Kodanev @ 2019-02-11 18:07 UTC (permalink / raw) To: ltp netstress tool can be used manually by setting -P flag for a server. There is no test-case yet that specifically auto tests this functionality or uses it, but it should be easy to create one. For example, starting multiple netstress instances on the same port. Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> --- testcases/network/netstress/netstress.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c index 2c5a6bd..2cdc91a 100644 --- a/testcases/network/netstress/netstress.c +++ b/testcases/network/netstress/netstress.c @@ -147,6 +147,7 @@ struct sock_info { static char *zcopy; static int send_flags = MSG_NOSIGNAL; +static char *reuse_port; static void init_socket_opts(int sd) { @@ -308,6 +309,8 @@ static void bind_before_connect(int sd) if (bind_no_port) SAFE_SETSOCKOPT_INT(sd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, 1); + if (reuse_port) + SAFE_SETSOCKOPT_INT(sd, SOL_SOCKET, SO_REUSEPORT, 1); SAFE_BIND(sd, local_addrinfo->ai_addr, local_addrinfo->ai_addrlen); @@ -674,6 +677,8 @@ static void server_init(void) /* IPv6 socket is also able to access IPv4 protocol stack */ sfd = SAFE_SOCKET(family, sock_type, protocol); SAFE_SETSOCKOPT_INT(sfd, SOL_SOCKET, SO_REUSEADDR, 1); + if (reuse_port) + SAFE_SETSOCKOPT_INT(sfd, SOL_SOCKET, SO_REUSEPORT, 1); tst_res(TINFO, "assigning a name to the server socket..."); SAFE_BIND(sfd, local_addrinfo->ai_addr, local_addrinfo->ai_addrlen); @@ -996,6 +1001,7 @@ static struct tst_option options[] = { {"b:", &barg, "-b x x - low latency busy poll timeout"}, {"T:", &type, "-T x tcp (default), udp, udp_lite, dccp, sctp"}, {"z", &zcopy, "-z enable SO_ZEROCOPY"}, + {"P:", &reuse_port, "-P enable SO_REUSEPORT"}, {"D:", &dev, "-d x bind to device x\n"}, {"H:", &server_addr, "Client:\n-H x Server name or IP address"}, -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag 2019-02-11 18:07 ` [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag Alexey Kodanev @ 2019-02-14 23:21 ` Petr Vorel 2019-02-15 10:50 ` Alexey Kodanev 0 siblings, 1 reply; 10+ messages in thread From: Petr Vorel @ 2019-02-14 23:21 UTC (permalink / raw) To: ltp Hi Alexey, > netstress tool can be used manually by setting -P flag for > a server. There is no test-case yet that specifically > auto tests this functionality or uses it, but it should be > easy to create one. For example, starting multiple netstress > instances on the same port. > Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr ^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag 2019-02-14 23:21 ` Petr Vorel @ 2019-02-15 10:50 ` Alexey Kodanev 0 siblings, 0 replies; 10+ messages in thread From: Alexey Kodanev @ 2019-02-15 10:50 UTC (permalink / raw) To: ltp On 15.02.2019 02:21, Petr Vorel wrote: > Hi Alexey, > >> netstress tool can be used manually by setting -P flag for >> a server. There is no test-case yet that specifically >> auto tests this functionality or uses it, but it should be >> easy to create one. For example, starting multiple netstress >> instances on the same port. > >> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> > Reviewed-by: Petr Vorel <pvorel@suse.cz> Patch-set applied, thanks for review Petr! ^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols 2019-02-11 18:07 [LTP] [PATCH 0/4] netstress: new option and some enhancements Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag Alexey Kodanev @ 2019-02-11 18:07 ` Alexey Kodanev 2019-02-14 23:34 ` Petr Vorel 2019-02-11 18:07 ` [LTP] [PATCH 3/4] netstress: handle zero length message for datagram sockets Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 4/4] netstress: increase timeout errors counter Alexey Kodanev 3 siblings, 1 reply; 10+ messages in thread From: Alexey Kodanev @ 2019-02-11 18:07 UTC (permalink / raw) To: ltp Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> --- testcases/network/netstress/netstress.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c index 2cdc91a..63d02c9 100644 --- a/testcases/network/netstress/netstress.c +++ b/testcases/network/netstress/netstress.c @@ -942,13 +942,14 @@ static void setup(void) } } + if (zcopy) + send_flags |= MSG_ZEROCOPY; + switch (proto_type) { case TYPE_TCP: tst_res(TINFO, "TCP %s is using %s TCP API.", (client_mode) ? "client" : "server", (fastopen_api) ? "Fastopen" : "old"); - if (zcopy) - send_flags |= MSG_ZEROCOPY; check_tfo_value(); break; case TYPE_UDP: -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols 2019-02-11 18:07 ` [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols Alexey Kodanev @ 2019-02-14 23:34 ` Petr Vorel 2019-02-15 9:26 ` Alexey Kodanev 0 siblings, 1 reply; 10+ messages in thread From: Petr Vorel @ 2019-02-14 23:34 UTC (permalink / raw) To: ltp Hi Alexey, > Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> > --- > testcases/network/netstress/netstress.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c > index 2cdc91a..63d02c9 100644 > --- a/testcases/network/netstress/netstress.c > +++ b/testcases/network/netstress/netstress.c > @@ -942,13 +942,14 @@ static void setup(void) > } > } > + if (zcopy) > + send_flags |= MSG_ZEROCOPY; > + > switch (proto_type) { > case TYPE_TCP: > tst_res(TINFO, "TCP %s is using %s TCP API.", > (client_mode) ? "client" : "server", > (fastopen_api) ? "Fastopen" : "old"); > - if (zcopy) > - send_flags |= MSG_ZEROCOPY; > check_tfo_value(); > break; > case TYPE_UDP: BTW MSG_ZEROCOPY is enabled only for TCP and UDP, but we allow it to be set on all, which leads to BROK: ./netstress -z -T sctp tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s netstress.c:938: INFO: max requests '3' netstress.c:990: INFO: SCTP server netstress.c:693: INFO: assigning a name to the server socket... netstress.c:700: INFO: bind to port 37196 safe_net.c:186: BROK: netstress.c:717: setsockopt(3, 1, 60, 0x7fff155701a4, 4) failed: ??? Kind regards, Petr ^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols 2019-02-14 23:34 ` Petr Vorel @ 2019-02-15 9:26 ` Alexey Kodanev 2019-02-15 13:45 ` Petr Vorel 0 siblings, 1 reply; 10+ messages in thread From: Alexey Kodanev @ 2019-02-15 9:26 UTC (permalink / raw) To: ltp Hi Petr, On 15.02.2019 02:34, Petr Vorel wrote: > Hi Alexey, > >> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> > Reviewed-by: Petr Vorel <pvorel@suse.cz> Thanks for review! > >> --- >> testcases/network/netstress/netstress.c | 5 +++-- >> 1 files changed, 3 insertions(+), 2 deletions(-) > >> diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c >> index 2cdc91a..63d02c9 100644 >> --- a/testcases/network/netstress/netstress.c >> +++ b/testcases/network/netstress/netstress.c >> @@ -942,13 +942,14 @@ static void setup(void) >> } >> } > >> + if (zcopy) >> + send_flags |= MSG_ZEROCOPY; >> + >> switch (proto_type) { >> case TYPE_TCP: >> tst_res(TINFO, "TCP %s is using %s TCP API.", >> (client_mode) ? "client" : "server", >> (fastopen_api) ? "Fastopen" : "old"); >> - if (zcopy) >> - send_flags |= MSG_ZEROCOPY; >> check_tfo_value(); >> break; >> case TYPE_UDP: > > BTW MSG_ZEROCOPY is enabled only for TCP and UDP, but we allow it to be set on > all, which leads to BROK: > ./netstress -z -T sctp > tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s > netstress.c:938: INFO: max requests '3' > netstress.c:990: INFO: SCTP server > netstress.c:693: INFO: assigning a name to the server socket... > netstress.c:700: INFO: bind to port 37196 > safe_net.c:186: BROK: netstress.c:717: setsockopt(3, 1, 60, 0x7fff155701a4, 4) failed: ??? > This is expected fail, I would keep it. Hmm, there is no error description. I've checked the errno returned and the kernel sources, found that it is actually returning ENOTSUPP(524). I think it should rather be EOPNOTSUPP(95), since the error is returned to user-space [1]: diff --git a/net/core/sock.c b/net/core/sock.c index 6aa2e7e..f6c57de 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1023,9 +1023,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname, sk->sk_protocol == IPPROTO_TCP) || (sk->sk_type == SOCK_DGRAM && sk->sk_protocol == IPPROTO_UDP))) - ret = -ENOTSUPP; + ret = -EOPNOTSUPP; } else if (sk->sk_family != PF_RDS) { - ret = -ENOTSUPP; + ret = -EOPNOTSUPP; } if (!ret) { if (val < 0 || val > 1) For LTP library: may be we need to return the actual errno if strerror() returns nothing? [1] https://lists.gt.net/linux/kernel/2207071 > > Kind regards, > Petr > ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols 2019-02-15 9:26 ` Alexey Kodanev @ 2019-02-15 13:45 ` Petr Vorel 0 siblings, 0 replies; 10+ messages in thread From: Petr Vorel @ 2019-02-15 13:45 UTC (permalink / raw) To: ltp Hi Alexey, > > BTW MSG_ZEROCOPY is enabled only for TCP and UDP, but we allow it to be set on > > all, which leads to BROK: > > ./netstress -z -T sctp > > tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s > > netstress.c:938: INFO: max requests '3' > > netstress.c:990: INFO: SCTP server > > netstress.c:693: INFO: assigning a name to the server socket... > > netstress.c:700: INFO: bind to port 37196 > > safe_net.c:186: BROK: netstress.c:717: setsockopt(3, 1, 60, 0x7fff155701a4, 4) failed: ??? > This is expected fail, I would keep it. Agree, other protocols might gain the support one day. > Hmm, there is no error description. I've checked the errno returned and the > kernel sources, found that it is actually returning ENOTSUPP(524). I think it > should rather be EOPNOTSUPP(95), since the error is returned to user-space [1]: > diff --git a/net/core/sock.c b/net/core/sock.c > index 6aa2e7e..f6c57de 100644 > --- a/net/core/sock.c > +++ b/net/core/sock.c > @@ -1023,9 +1023,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname, > sk->sk_protocol == IPPROTO_TCP) || > (sk->sk_type == SOCK_DGRAM && > sk->sk_protocol == IPPROTO_UDP))) > - ret = -ENOTSUPP; > + ret = -EOPNOTSUPP; > } else if (sk->sk_family != PF_RDS) { > - ret = -ENOTSUPP; > + ret = -EOPNOTSUPP; > } > if (!ret) { > if (val < 0 || val > 1) Interesting. IMHO it'd make sense to fix it. > For LTP library: may be we need to return the actual errno if strerror() > returns nothing? yes, that'd be useful. Assume you send a patch. > [1] https://lists.gt.net/linux/kernel/2207071 Kind regards, Petr ^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH 3/4] netstress: handle zero length message for datagram sockets 2019-02-11 18:07 [LTP] [PATCH 0/4] netstress: new option and some enhancements Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols Alexey Kodanev @ 2019-02-11 18:07 ` Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 4/4] netstress: increase timeout errors counter Alexey Kodanev 3 siblings, 0 replies; 10+ messages in thread From: Alexey Kodanev @ 2019-02-11 18:07 UTC (permalink / raw) To: ltp Don't treat them as errors unless there are too many of them. Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> --- testcases/network/netstress/netstress.c | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c index 63d02c9..63fbaed 100644 --- a/testcases/network/netstress/netstress.c +++ b/testcases/network/netstress/netstress.c @@ -89,6 +89,7 @@ static char *source_addr; static char *server_bg; static int busy_poll = -1; static int max_etime_cnt = 12; /* ~30 sec max timeout if no connection */ +static int max_eshutdown_cnt = 10; static int max_pmtu_err = 10; enum { @@ -142,6 +143,7 @@ struct sock_info { socklen_t raddr_len; int etime_cnt; int pmtu_err_cnt; + int eshutdown_cnt; int timeout; }; @@ -287,14 +289,22 @@ static int client_recv(char *buf, int srv_msg_len, struct sock_info *i) return 0; } - if (errno == ETIME && sock_type != SOCK_STREAM) { - if (++(i->etime_cnt) > max_etime_cnt) - tst_brk(TFAIL, "client requests timeout %d times, last timeout %dms", - i->etime_cnt, i->timeout); - /* Increase timeout in poll up to 3.2 sec */ - if (i->timeout < 3000) - i->timeout <<= 1; - return 0; + if (sock_type != SOCK_STREAM) { + if (errno == ETIME) { + if (++(i->etime_cnt) > max_etime_cnt) + tst_brk(TFAIL, "client requests timeout %d times, last timeout %dms", + i->etime_cnt, i->timeout); + /* Increase timeout in poll up to 3.2 sec */ + if (i->timeout < 3000) + i->timeout <<= 1; + return 0; + } + if (errno == ESHUTDOWN) { + if (++(i->eshutdown_cnt) > max_eshutdown_cnt) + tst_brk(TFAIL, "too many zero-length msgs"); + tst_res(TINFO, "%d-length msg on sock %d", len, i->fd); + return 0; + } } SAFE_CLOSE(i->fd); -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH 4/4] netstress: increase timeout errors counter 2019-02-11 18:07 [LTP] [PATCH 0/4] netstress: new option and some enhancements Alexey Kodanev ` (2 preceding siblings ...) 2019-02-11 18:07 ` [LTP] [PATCH 3/4] netstress: handle zero length message for datagram sockets Alexey Kodanev @ 2019-02-11 18:07 ` Alexey Kodanev 3 siblings, 0 replies; 10+ messages in thread From: Alexey Kodanev @ 2019-02-11 18:07 UTC (permalink / raw) To: ltp Make sure we avoid false-positives with stress test scenarious. Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> --- testcases/network/netstress/netstress.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c index 63fbaed..06882b1 100644 --- a/testcases/network/netstress/netstress.c +++ b/testcases/network/netstress/netstress.c @@ -88,7 +88,7 @@ static char *server_addr = "localhost"; static char *source_addr; static char *server_bg; static int busy_poll = -1; -static int max_etime_cnt = 12; /* ~30 sec max timeout if no connection */ +static int max_etime_cnt = 21; /* ~60 sec max timeout if no connection */ static int max_eshutdown_cnt = 10; static int max_pmtu_err = 10; -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-02-15 13:45 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-02-11 18:07 [LTP] [PATCH 0/4] netstress: new option and some enhancements Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 1/4] netstress: support SO_REUSEPORT with new 'P' flag Alexey Kodanev 2019-02-14 23:21 ` Petr Vorel 2019-02-15 10:50 ` Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 2/4] netstress: allow setting MSG_ZEROCOPY for other protocols Alexey Kodanev 2019-02-14 23:34 ` Petr Vorel 2019-02-15 9:26 ` Alexey Kodanev 2019-02-15 13:45 ` Petr Vorel 2019-02-11 18:07 ` [LTP] [PATCH 3/4] netstress: handle zero length message for datagram sockets Alexey Kodanev 2019-02-11 18:07 ` [LTP] [PATCH 4/4] netstress: increase timeout errors counter Alexey Kodanev
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox