Lines Matching +full:foo +full:- +full:queue

1 // SPDX-License-Identifier: GPL-2.0
109 fprintf(stderr, "Usage: mptcp_connect [-6] [-c cmsg] [-f offset] [-i file] [-I num] [-j] [-l] " in die_usage()
110 "[-m mode] [-M mark] [-o option] [-p port] [-P mode] [-r num] [-R num] " in die_usage()
111 "[-s MPTCP|TCP] [-S num] [-t num] [-T num] [-w sec] connect_address\n"); in die_usage()
112 fprintf(stderr, "\t-6 use ipv6\n"); in die_usage()
113 fprintf(stderr, "\t-c cmsg -- test cmsg type <cmsg>\n"); in die_usage()
114 fprintf(stderr, "\t-f offset -- stop the I/O after receiving and sending the specified amount " in die_usage()
115 "of bytes. If there are unread bytes in the receive queue, that will cause a MPTCP " in die_usage()
118 fprintf(stderr, "\t-i file -- read the data to send from the given file instead of stdin"); in die_usage()
119 fprintf(stderr, "\t-I num -- repeat the transfer 'num' times. In listen mode accepts num " in die_usage()
121 fprintf(stderr, "\t-j -- add additional sleep at connection start and tear down " in die_usage()
122 "-- for MPJ tests\n"); in die_usage()
123 fprintf(stderr, "\t-l -- listens mode, accepts incoming connection\n"); in die_usage()
124 fprintf(stderr, "\t-m [poll|mmap|sendfile] -- use poll(default)/mmap+write/sendfile\n"); in die_usage()
125 fprintf(stderr, "\t-M mark -- set socket packet mark\n"); in die_usage()
126 fprintf(stderr, "\t-o option -- test sockopt <option>\n"); in die_usage()
127 fprintf(stderr, "\t-p num -- use port num\n"); in die_usage()
129 "\t-P [saveWithPeek|saveAfterPeek] -- save data with/after MSG_PEEK form tcp socket\n"); in die_usage()
130 fprintf(stderr, "\t-r num -- enable slow mode, limiting each write to num bytes " in die_usage()
131 "-- for remove addr tests\n"); in die_usage()
132 fprintf(stderr, "\t-R num -- set SO_RCVBUF to num\n"); in die_usage()
133 fprintf(stderr, "\t-s [MPTCP|TCP] -- use mptcp(default) or tcp sockets\n"); in die_usage()
134 fprintf(stderr, "\t-S num -- set SO_SNDBUF to num\n"); in die_usage()
135 fprintf(stderr, "\t-t num -- set poll timeout to num\n"); in die_usage()
136 fprintf(stderr, "\t-T num -- set expected runtime to num ms\n"); in die_usage()
137 fprintf(stderr, "\t-w num -- wait num sec before closing the socket\n"); in die_usage()
234 if (-1 == setsockopt(fd, SOL_IP, IP_TRANSPARENT, &one, sizeof(one))) in set_transparent()
238 if (-1 == setsockopt(fd, IPPROTO_IPV6, IPV6_TRANSPARENT, &one, sizeof(one))) in set_transparent()
248 if (setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)) == -1) in set_mptfo()
275 if (ret != -1) in sock_test_tcpulp()
280 if (ret != -1) in sock_test_tcpulp()
291 int sock = -1; in sock_listen_mptcp()
306 for (a = addr; a; a = a->ai_next) { in sock_listen_mptcp()
307 sock = socket(a->ai_family, a->ai_socktype, cfg_sock_proto); in sock_listen_mptcp()
313 if (-1 == setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, in sock_listen_mptcp()
323 if (bind(sock, a->ai_addr, a->ai_addrlen) == 0) in sock_listen_mptcp()
328 sock = -1; in sock_listen_mptcp()
343 return -1; in sock_listen_mptcp()
362 int sock = -1; in sock_connect_mptcp()
367 for (a = addr; a; a = a->ai_next) { in sock_connect_mptcp()
368 sock = socket(a->ai_family, a->ai_socktype, proto); in sock_connect_mptcp()
380 if (!winfo->total_len) in sock_connect_mptcp()
381 winfo->total_len = winfo->len = read(infd, winfo->buf, in sock_connect_mptcp()
382 sizeof(winfo->buf)); in sock_connect_mptcp()
384 syn_copied = sendto(sock, winfo->buf, winfo->len, MSG_FASTOPEN, in sock_connect_mptcp()
385 a->ai_addr, a->ai_addrlen); in sock_connect_mptcp()
387 winfo->off = syn_copied; in sock_connect_mptcp()
388 winfo->len -= syn_copied; in sock_connect_mptcp()
393 if (connect(sock, a->ai_addr, a->ai_addrlen) == 0) { in sock_connect_mptcp()
401 sock = -1; in sock_connect_mptcp()
405 sock = -1; in sock_connect_mptcp()
410 if (sock != -1) in sock_connect_mptcp()
455 bw = write(fd, buf + offset, len - offset); in do_write()
477 if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SO_TIMESTAMPNS_NEW) { in process_cmsg()
482 if (cmsg->cmsg_level == IPPROTO_TCP && cmsg->cmsg_type == TCP_CM_INQ) { in process_cmsg()
595 if (flags == -1) in set_nonblock()
635 case -1: in copyfd_io_poll()
653 rb = cfg_truncate - total_rlen; in copyfd_io_poll()
683 if (winfo->len == 0) { in copyfd_io_poll()
684 winfo->off = 0; in copyfd_io_poll()
685 winfo->len = read(infd, winfo->buf, sizeof(winfo->buf)); in copyfd_io_poll()
688 if (winfo->len > 0) { in copyfd_io_poll()
692 if (cfg_truncate > 0 && winfo->len + total_wlen > cfg_truncate) in copyfd_io_poll()
693 winfo->len = cfg_truncate - total_wlen; in copyfd_io_poll()
695 bw = do_rnd_write(peerfd, winfo->buf + winfo->off, winfo->len); in copyfd_io_poll()
703 winfo->off += bw; in copyfd_io_poll()
704 winfo->len -= bw; in copyfd_io_poll()
706 } else if (winfo->len == 0) { in copyfd_io_poll()
764 while (winfo->len) { in spool_buf()
765 int ret = write(fd, winfo->buf + winfo->off, winfo->len); in spool_buf()
771 winfo->off += ret; in spool_buf()
772 winfo->len -= ret; in spool_buf()
781 ssize_t ret = 0, off = winfo->total_len; in do_mmap()
793 rem = size - winfo->total_len; in do_mmap()
804 rem -= ret; in do_mmap()
820 return -1; in get_infd_size()
825 return -2; in get_infd_size()
831 return -3; in get_infd_size()
845 count -= winfo->total_len; in do_sendfile()
856 count -= r; in do_sendfile()
963 delta_ms = (end.tv_sec - start.tv_sec) * 1000 + (end.tv_nsec - start.tv_nsec) / 1000000; in copyfd_io()
990 if (!sin->sin_port) in check_sockaddr()
996 if (!sin6->sin6_port) in check_sockaddr()
1008 if (ss->ss_family != pf) in check_sockaddr()
1010 (int)ss->ss_family, pf); in check_sockaddr()
1087 case -1: in main_loop_s()
1118 if (--cfg_repeat > 0) { in main_loop_s()
1129 unsigned int foo; in init_rng() local
1131 if (getrandom(&foo, sizeof(foo), 0) == -1) { in init_rng()
1136 srand(foo); in init_rng()
1154 if (cmsg->timestampns) in apply_cmsg_types()
1156 if (cmsg->tcp_inq) in apply_cmsg_types()
1169 len = next - type; in parse_cmsg_types()
1195 len = next - name; in parse_setsock_options()
1228 xerror("can't query out socket queue: %d", errno); in xdisconnect()
1284 xdisconnect(fd, peer->ai_addrlen); in main_loop()
1285 } else if (--cfg_repeat > 0) { in main_loop()
1286 xdisconnect(fd, peer->ai_addrlen); in main_loop()
1292 if (connect(fd, peer->ai_addr, peer->ai_addrlen)) in main_loop()
1330 fprintf(stderr, "\t\t\"poll\" - interleaved read/write using poll()\n"); in parse_mode()
1331 …fprintf(stderr, "\t\t\"mmap\" - send entire input file (mmap+write), then read response (-l will r… in parse_mode()
1332 …fprintf(stderr, "\t\t\"sendfile\" - send entire input file (sendfile), then read response (-l will… in parse_mode()
1350 "\t\t\"saveWithPeek\" - recv data with flags 'MSG_PEEK' and save the peek data into file\n"); in parse_peek()
1352 "\t\t\"saveAfterPeek\" - read and save data into file after recv with flags 'MSG_PEEK'\n"); in parse_peek()
1387 while ((c = getopt(argc, argv, "6c:f:hi:I:jlm:M:o:p:P:r:R:s:S:t:T:w:")) != -1) { in parse_opts()
1436 poll_timeout = -1; in parse_opts()