Lines Matching defs:sock

71 	void (*walk)(int sock, struct ring *ring);
101 int ret, sock = socket(PF_PACKET, SOCK_RAW, 0);
102 if (sock == -1) {
107 ret = setsockopt(sock, SOL_PACKET, PACKET_VERSION, &ver, sizeof(ver));
113 return sock;
220 static void walk_v1_v2_rx(int sock, struct ring *ring)
232 pfd.fd = sock;
342 static void __v1_v2_set_packet_loss_discard(int sock)
346 ret = setsockopt(sock, SOL_PACKET, PACKET_LOSS, (void *) &discard,
369 static void walk_tx(int sock, struct ring *ring)
411 pfd.fd = sock;
473 ret = sendto(sock, NULL, 0, 0, NULL, 0);
500 static void walk_v1_v2(int sock, struct ring *ring)
503 walk_v1_v2_rx(sock, ring);
505 walk_tx(sock, ring);
581 static void walk_v3_rx(int sock, struct ring *ring)
593 pfd.fd = sock;
622 static void walk_v3(int sock, struct ring *ring)
625 walk_v3_rx(sock, ring);
627 walk_tx(sock, ring);
667 static void setup_ring(int sock, struct ring *ring, int version, int type)
679 __v1_v2_set_packet_loss_discard(sock);
681 ret = setsockopt(sock, SOL_PACKET, type, &ring->req,
687 ret = setsockopt(sock, SOL_PACKET, type, &ring->req3,
708 static void mmap_ring(int sock, struct ring *ring)
713 MAP_SHARED | MAP_LOCKED | MAP_POPULATE, sock, 0);
726 static void bind_ring(int sock, struct ring *ring)
730 pair_udp_setfilter(sock);
739 ret = bind(sock, (struct sockaddr *) &ring->ll, sizeof(ring->ll));
746 static void walk_ring(int sock, struct ring *ring)
748 ring->walk(sock, ring);
751 static void unmap_ring(int sock, struct ring *ring)
804 int sock;
819 sock = pfsocket(version);
821 setup_ring(sock, &ring, version, type);
822 mmap_ring(sock, &ring);
823 bind_ring(sock, &ring);
824 walk_ring(sock, &ring);
825 unmap_ring(sock, &ring);
826 close(sock);