Lines Matching full:p1

451 	int n, err, map, verdict, c1 = -1, p1 = -1;  in test_sockmap_skb_verdict_shutdown()  local
469 err = create_pair(AF_INET, SOCK_STREAM, &c1, &p1); in test_sockmap_skb_verdict_shutdown()
477 shutdown(p1, SHUT_WR); in test_sockmap_skb_verdict_shutdown()
496 close(p1); in test_sockmap_skb_verdict_shutdown()
504 int err, map, verdict, c0 = -1, c1 = -1, p0 = -1, p1 = -1; in do_test_sockmap_skb_verdict_fionread() local
536 err = create_socket_pairs(AF_INET, sotype, &c0, &c1, &p0, &p1); in do_test_sockmap_skb_verdict_fionread()
544 sent = xsend(p1, &buf, split_len, 0); in do_test_sockmap_skb_verdict_fionread()
545 sent += xsend(p1, &buf, sizeof(buf) - split_len, 0); in do_test_sockmap_skb_verdict_fionread()
546 ASSERT_EQ(sent, sizeof(buf), "xsend(p1)"); in do_test_sockmap_skb_verdict_fionread()
560 close(p1); in do_test_sockmap_skb_verdict_fionread()
578 int c1, p1, sent, recvd; in test_sockmap_skb_verdict_change_tail() local
591 err = create_pair(AF_INET, SOCK_STREAM, &c1, &p1); in test_sockmap_skb_verdict_change_tail()
597 sent = xsend(p1, "Tr", 2, 0); in test_sockmap_skb_verdict_change_tail()
598 ASSERT_EQ(sent, 2, "xsend(p1)"); in test_sockmap_skb_verdict_change_tail()
603 sent = xsend(p1, "G", 1, 0); in test_sockmap_skb_verdict_change_tail()
604 ASSERT_EQ(sent, 1, "xsend(p1)"); in test_sockmap_skb_verdict_change_tail()
609 sent = xsend(p1, "E", 1, 0); in test_sockmap_skb_verdict_change_tail()
610 ASSERT_EQ(sent, 1, "xsend(p1)"); in test_sockmap_skb_verdict_change_tail()
617 close(p1); in test_sockmap_skb_verdict_change_tail()
626 int c1 = -1, p1 = -1, sent; in test_sockmap_msg_verdict_pop_data() local
642 err = create_pair(AF_INET, SOCK_STREAM, &c1, &p1); in test_sockmap_msg_verdict_pop_data()
662 close(p1); in test_sockmap_msg_verdict_pop_data()
669 int err, c1, p1, zero = 0, sent, recvd, avail; in test_sockmap_skb_verdict_peek_helper() local
673 err = create_pair(AF_INET, SOCK_STREAM, &c1, &p1); in test_sockmap_skb_verdict_peek_helper()
681 sent = xsend(p1, snd, sizeof(snd), 0); in test_sockmap_skb_verdict_peek_helper()
682 ASSERT_EQ(sent, sizeof(snd), "xsend(p1)"); in test_sockmap_skb_verdict_peek_helper()
696 close(p1); in test_sockmap_skb_verdict_peek_helper()
1070 int c0 = -1, p0 = -1, c1 = -1, p1 = -1; in test_sockmap_zc() local
1079 if (create_socket_pairs(AF_INET, SOCK_STREAM, &c0, &c1, &p0, &p1)) in test_sockmap_zc()
1093 err = bpf_map_update_elem(map, &one, &p1, BPF_ANY); in test_sockmap_zc()
1101 /* trigger tcp_bpf_recvmsg_parser and inc copied_seq of p1 */ in test_sockmap_zc()
1102 recvd = recv_timeout(p1, rcv, sizeof(rcv), MSG_DONTWAIT, 1); in test_sockmap_zc()
1103 if (!ASSERT_EQ(recvd, sent, "recv_timeout(p1)")) in test_sockmap_zc()
1106 /* uninstall sockmap of p1 */ in test_sockmap_zc()
1109 /* trigger tcp stack and the rcv_nxt of p1 is less than copied_seq */ in test_sockmap_zc()
1114 err = setsockopt(p1, SOL_SOCKET, SO_ZEROCOPY, &on, sizeof(on)); in test_sockmap_zc()
1122 err = getsockopt(p1, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, &zc, &zc_len); in test_sockmap_zc()
1133 if (p1 >= 0) in test_sockmap_zc()
1134 close(p1); in test_sockmap_zc()
1143 int c0 = -1, p0 = -1, c1 = -1, p1 = -1; in test_sockmap_copied_seq() local
1151 if (create_socket_pairs(AF_INET, SOCK_STREAM, &c0, &c1, &p0, &p1)) in test_sockmap_copied_seq()
1172 err = bpf_map_update_elem(map, &one, &p1, BPF_ANY); in test_sockmap_copied_seq()
1173 if (!ASSERT_OK(err, "bpf_map_update_elem(p1)")) in test_sockmap_copied_seq()
1176 /* just trigger sockamp: data sent by c0 will be received by p1 */ in test_sockmap_copied_seq()
1182 recvd = recv_timeout(p1, rcv, 1, MSG_DONTWAIT, 1); in test_sockmap_copied_seq()
1183 recvd += recv_timeout(p1, rcv + 1, sizeof(rcv) - 1, MSG_DONTWAIT, 1); in test_sockmap_copied_seq()
1184 if (!ASSERT_EQ(recvd, sent, "recv_timeout(p1), bpf") || in test_sockmap_copied_seq()
1188 /* uninstall sockmap of p1 and p0 */ in test_sockmap_copied_seq()
1199 /* test copied_seq of p1 by running tcp native stack */ in test_sockmap_copied_seq()
1204 recvd = recv(p1, rcv, sizeof(rcv), MSG_DONTWAIT); in test_sockmap_copied_seq()
1205 if (!ASSERT_EQ(recvd, sent, "recv_timeout(p1), native")) in test_sockmap_copied_seq()
1208 /* p0 previously redirected skb to p1, we also check copied_seq of p0 */ in test_sockmap_copied_seq()
1225 if (p1 >= 0) in test_sockmap_copied_seq()
1226 close(p1); in test_sockmap_copied_seq()
1252 int c0 = -1, p0 = -1, c1 = -1, p1 = -1; in test_sockmap_multi_channels() local
1260 err = create_socket_pairs(AF_INET, sotype, &c0, &c1, &p0, &p1); in test_sockmap_multi_channels()
1275 err = bpf_map_update_elem(map, &one, &p1, BPF_ANY); in test_sockmap_multi_channels()
1279 /* send data to p1 via native stack */ in test_sockmap_multi_channels()
1284 avail = wait_for_fionread(p1, 2, IO_TIMEOUT_SEC); in test_sockmap_multi_channels()
1287 /* send data to p1 via bpf redirecting */ in test_sockmap_multi_channels()
1296 avail = wait_for_fionread(p1, expected, IO_TIMEOUT_SEC); in test_sockmap_multi_channels()
1299 recvd = recv_timeout(p1, rcv, expected, MSG_DONTWAIT, 1); in test_sockmap_multi_channels()
1300 if (!ASSERT_EQ(recvd, expected, "recv_timeout(p1)") || in test_sockmap_multi_channels()
1307 avail = wait_for_fionread(p1, expected, IO_TIMEOUT_SEC); in test_sockmap_multi_channels()
1310 recvd = recv_timeout(p1, rcv, expected, MSG_DONTWAIT, 1); in test_sockmap_multi_channels()
1311 if (!ASSERT_EQ(recvd, expected, "second recv_timeout(p1)") || in test_sockmap_multi_channels()
1323 if (p1 >= 0) in test_sockmap_multi_channels()
1324 close(p1); in test_sockmap_multi_channels()
1334 int c0 = -1, c1 = -1, p0 = -1, p1 = -1; in test_sockmap_no_verdict_fionread() local
1343 err = create_socket_pairs(AF_INET, SOCK_STREAM, &c0, &c1, &p0, &p1); in test_sockmap_no_verdict_fionread()
1351 sent = xsend(p1, &buf, sizeof(buf), 0); in test_sockmap_no_verdict_fionread()
1352 ASSERT_EQ(sent, sizeof(buf), "xsend(p1)"); in test_sockmap_no_verdict_fionread()
1360 close(p1); in test_sockmap_no_verdict_fionread()