Lines Matching refs:to
1 This file documents how to use memory mapped I/O with netlink.
8 Memory mapped netlink I/O can be used to increase throughput and decrease
17 The RX ring is used by the kernel to directly construct netlink messages into
20 syscalls have to be issued by user-space to get more message.
22 The TX ring is used to process messages directly from user-space memory, the
29 In order to use memory mapped netlink I/O, user-space needs three main changes:
32 - conversion of the RX path to get messages from the ring instead of recvmsg()
33 - conversion of the TX path to construct messages into the ring
35 Ring setup is done using setsockopt() to provide the ring parameters to the
36 kernel, then a call to mmap() to map the ring into the processes address space:
43 mapping still needs to be writable in order to update the frame status after
51 On kernel side, in order to make use of memory mapped I/O on receive, the
52 originating netlink subsystem needs to support memory mapped I/O, otherwise
54 copied to the ring on transmission, nullifying most of the performance gains.
57 Conversion of the transmit path involves changing message construction to
60 be used to wait for free frames in the TX ring.
82 The blocks are only visible to the kernel, from the point of view of user-space
105 The getpagesize() function can be used to get the page size.
107 - nm_frame_size must be equal or larger to NL_MMAP_HDRLEN, IOW a frame must be
108 able to hold at least the frame header
110 - nm_frame_size must be smaller or equal to nm_block_size
117 it will fall back to use physically discontinuous memory. This might affect
118 performance negatively, in order to avoid this the nm_frame_size parameter
119 should be chosen to be as small as possible for the required frame size and
143 space and specifies ownership of the frame as well as the operation to perform
150 process. These values correspond to the data available using SOCK_PASSCRED in
156 RX ring: frame belongs to the kernel and contains no message
157 for user-space. Approriate action is to invoke poll()
158 to wait for new messages.
160 TX ring: frame belongs to user-space and can be used for
166 Appropriate action is to invoke poll() to wait for
171 to process the message and release the frame back to
172 the kernel by setting the status to
174 status to NL_MMAP_STATUS_SKIP.
176 TX ring: the frame contains a valid message from user-space to
178 the kernel will release the frame back to user-space by
179 setting the status to NL_MMAP_STATUS_UNUSED.
182 RX ring only: a message is ready to be processed but could not be
186 to invoke recvmsg() to receive the message and release
187 the frame back to the kernel by setting the status to
196 The data area of a frame begins at a offset of NL_MMAP_HDRLEN relative to the
202 As of Jan 2015 the message is always copied from the ring frame to an
203 allocated buffer due to unresolved security concerns.
281 /* Frame queued to socket receive queue */
287 /* No more messages to process, continue polling */
292 /* Release frame back to the kernel */
295 /* Advance frame offset to next frame */
303 A single message is constructed and transmitted, to send multiple messages
305 to sendto().
316 /* No frame available. Use poll() to avoid. */
324 /* Fill frame header: length and status need to be set */
331 /* Advance frame offset to next frame */