Lines Matching refs:ring

75             setsockopt() ---> allocation of the circular buffer (ring)
103 allocated RX and TX buffer ring with a single mmap() call.
104 See "Mapping and use of the circular buffer (ring)".
116 setsockopt() ---> allocation of the circular buffer (ring)
124 the ring
215 circular buffer (ring) of unswappable memory.
252 buffer (ring)".
406 + Mapping and use of the circular buffer (ring)
423 RX and TX buffer ring has to be done with one call to mmap:
432 RX must be the first as the kernel maps the TX ring memory right
488 packets are in the ring:
562 3. Set protocol version to 2, set up ring as usual
740 AF_PACKET's TPACKET_V3 ring buffer can be configured to use non-static frame
742 works on a per block basis instead of per ring as in TPACKET_V2 and predecessor.
793 struct ring {
807 static int setup_socket(struct ring *ring, char *netdev)
826 memset(&ring->req, 0, sizeof(ring->req));
827 ring->req.tp_block_size = blocksiz;
828 ring->req.tp_frame_size = framesiz;
829 ring->req.tp_block_nr = blocknum;
830 ring->req.tp_frame_nr = (blocksiz * blocknum) / framesiz;
831 ring->req.tp_retire_blk_tov = 60;
832 ring->req.tp_feature_req_word = TP_FT_REQ_FILL_RXHASH;
834 err = setsockopt(fd, SOL_PACKET, PACKET_RX_RING, &ring->req,
835 sizeof(ring->req));
841 ring->map = mmap(NULL, ring->req.tp_block_size * ring->req.tp_block_nr,
843 if (ring->map == MAP_FAILED) {
848 ring->rd = malloc(ring->req.tp_block_nr * sizeof(*ring->rd));
849 assert(ring->rd);
850 for (i = 0; i < ring->req.tp_block_nr; ++i) {
851 ring->rd[i].iov_base = ring->map + (i * ring->req.tp_block_size);
852 ring->rd[i].iov_len = ring->req.tp_block_size;
924 static void teardown_socket(struct ring *ring, int fd)
926 munmap(ring->map, ring->req.tp_block_size * ring->req.tp_block_nr);
927 free(ring->rd);
935 struct ring ring;
948 memset(&ring, 0, sizeof(ring));
949 fd = setup_socket(&ring, argp[argc - 1]);
958 pbd = (struct block_desc *) ring.rd[block_num].iov_base;
982 teardown_socket(&ring, fd);
1023 For the mmap(2)ed ring buffers, such timestamps are stored in the
1036 Getting timestamps for the TX_RING works as follows: i) fill the ring frames,