h2load: Send more packets without GSO per event loop

This commit is contained in:
Tatsuhiro Tsujikawa 2022-06-22 19:46:33 +09:00
parent 7077096162
commit 71f8971dde
1 changed files with 31 additions and 8 deletions

View File

@ -593,17 +593,13 @@ int Client::write_quic() {
std::array<nghttp3_vec, 16> vec; std::array<nghttp3_vec, 16> vec;
size_t pktcnt = 0; size_t pktcnt = 0;
auto max_udp_payload_size = ngtcp2_conn_get_max_udp_payload_size(quic.conn); auto max_udp_payload_size = ngtcp2_conn_get_max_udp_payload_size(quic.conn);
#ifdef UDP_SEGMENT
auto path_max_udp_payload_size = auto path_max_udp_payload_size =
ngtcp2_conn_get_path_max_udp_payload_size(quic.conn); ngtcp2_conn_get_path_max_udp_payload_size(quic.conn);
#endif // UDP_SEGMENT
size_t max_pktcnt = size_t max_pktcnt =
#ifdef UDP_SEGMENT std::min(static_cast<size_t>(10),
worker->config->no_udp_gso
? 1
: std::min(static_cast<size_t>(10),
static_cast<size_t>(64_k / max_udp_payload_size)); static_cast<size_t>(64_k / max_udp_payload_size));
#else // !UDP_SEGMENT
1;
#endif // !UDP_SEGMENT
uint8_t *bufpos = quic.tx.data.get(); uint8_t *bufpos = quic.tx.data.get();
ngtcp2_path_storage ps; ngtcp2_path_storage ps;
size_t gso_size = 0; size_t gso_size = 0;
@ -685,6 +681,32 @@ int Client::write_quic() {
bufpos += nwrite; bufpos += nwrite;
#ifdef UDP_SEGMENT
if (worker->config->no_udp_gso) {
#endif // UDP_SEGMENT
auto data = quic.tx.data.get();
auto datalen = bufpos - quic.tx.data.get();
rv = write_udp(ps.path.remote.addr, ps.path.remote.addrlen, data, datalen,
0);
if (rv == 1) {
on_send_blocked(ps.path.remote, data, datalen, 0);
signal_write();
return 0;
}
if (++pktcnt == max_pktcnt) {
signal_write();
return 0;
}
bufpos = quic.tx.data.get();
#ifdef UDP_SEGMENT
continue;
}
#endif // UDP_SEGMENT
#ifdef UDP_SEGMENT
if (pktcnt == 0) { if (pktcnt == 0) {
gso_size = nwrite; gso_size = nwrite;
} else if (static_cast<size_t>(nwrite) > gso_size || } else if (static_cast<size_t>(nwrite) > gso_size ||
@ -722,6 +744,7 @@ int Client::write_quic() {
signal_write(); signal_write();
return 0; return 0;
} }
#endif // UDP_SEGMENT
} }
} }