aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/networking/packet_mmap.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/networking/packet_mmap.txt')
-rw-r--r--Documentation/networking/packet_mmap.txt24
1 files changed, 12 insertions, 12 deletions
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt
index aaf99d5f0dad..12a008a5c221 100644
--- a/Documentation/networking/packet_mmap.txt
+++ b/Documentation/networking/packet_mmap.txt
@@ -66,7 +66,7 @@ the following process:
66 66
67[setup] socket() -------> creation of the capture socket 67[setup] socket() -------> creation of the capture socket
68 setsockopt() ---> allocation of the circular buffer (ring) 68 setsockopt() ---> allocation of the circular buffer (ring)
69 mmap() ---------> maping of the allocated buffer to the 69 mmap() ---------> mapping of the allocated buffer to the
70 user process 70 user process
71 71
72[capture] poll() ---------> to wait for incoming packets 72[capture] poll() ---------> to wait for incoming packets
@@ -93,7 +93,7 @@ The destruction of the socket and all associated resources
93is done by a simple call to close(fd). 93is done by a simple call to close(fd).
94 94
95Next I will describe PACKET_MMAP settings and it's constraints, 95Next I will describe PACKET_MMAP settings and it's constraints,
96also the maping of the circular buffer in the user process and 96also the mapping of the circular buffer in the user process and
97the use of this buffer. 97the use of this buffer.
98 98
99-------------------------------------------------------------------------------- 99--------------------------------------------------------------------------------
@@ -153,8 +153,8 @@ we will get the following buffer structure:
153 153
154A frame can be of any size with the only condition it can fit in a block. A block 154A frame can be of any size with the only condition it can fit in a block. A block
155can only hold an integer number of frames, or in other words, a frame cannot 155can only hold an integer number of frames, or in other words, a frame cannot
156be spawn accross two blocks so there are some datails you have to take into 156be spawned accross two blocks, so there are some details you have to take into
157account when choosing the frame_size. See "Maping and use of the circular 157account when choosing the frame_size. See "Mapping and use of the circular
158buffer (ring)". 158buffer (ring)".
159 159
160 160
@@ -215,8 +215,8 @@ called pg_vec, its size limits the number of blocks that can be allocated.
215 block #1 215 block #1
216 216
217 217
218kmalloc allocates any number of bytes of phisically contiguous memory from 218kmalloc allocates any number of bytes of physically contiguous memory from
219a pool of pre-determined sizes. This pool of memory is mantained by the slab 219a pool of pre-determined sizes. This pool of memory is maintained by the slab
220allocator which is at the end the responsible for doing the allocation and 220allocator which is at the end the responsible for doing the allocation and
221hence which imposes the maximum memory that kmalloc can allocate. 221hence which imposes the maximum memory that kmalloc can allocate.
222 222
@@ -262,7 +262,7 @@ i386 architecture:
262 <pagesize> = 4096 bytes 262 <pagesize> = 4096 bytes
263 <max-order> = 11 263 <max-order> = 11
264 264
265and a value for <frame size> of 2048 byteas. These parameters will yield 265and a value for <frame size> of 2048 bytes. These parameters will yield
266 266
267 <block number> = 131072/4 = 32768 blocks 267 <block number> = 131072/4 = 32768 blocks
268 <block size> = 4096 << 11 = 8 MiB. 268 <block size> = 4096 << 11 = 8 MiB.
@@ -278,7 +278,7 @@ an i386 kernel's memory size is limited to 1GiB.
278All memory allocations are not freed until the socket is closed. The memory 278All memory allocations are not freed until the socket is closed. The memory
279allocations are done with GFP_KERNEL priority, this basically means that 279allocations are done with GFP_KERNEL priority, this basically means that
280the allocation can wait and swap other process' memory in order to allocate 280the allocation can wait and swap other process' memory in order to allocate
281the nececessary memory, so normally limits can be reached. 281the necessary memory, so normally limits can be reached.
282 282
283 Other constraints 283 Other constraints
284------------------- 284-------------------
@@ -296,7 +296,7 @@ the following (from include/linux/if_packet.h):
296 - struct tpacket_hdr 296 - struct tpacket_hdr
297 - pad to TPACKET_ALIGNMENT=16 297 - pad to TPACKET_ALIGNMENT=16
298 - struct sockaddr_ll 298 - struct sockaddr_ll
299 - Gap, chosen so that packet data (Start+tp_net) alignes to 299 - Gap, chosen so that packet data (Start+tp_net) aligns to
300 TPACKET_ALIGNMENT=16 300 TPACKET_ALIGNMENT=16
301 - Start+tp_mac: [ Optional MAC header ] 301 - Start+tp_mac: [ Optional MAC header ]
302 - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. 302 - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16.
@@ -311,14 +311,14 @@ the following (from include/linux/if_packet.h):
311 tp_frame_size must be a multiple of TPACKET_ALIGNMENT 311 tp_frame_size must be a multiple of TPACKET_ALIGNMENT
312 tp_frame_nr must be exactly frames_per_block*tp_block_nr 312 tp_frame_nr must be exactly frames_per_block*tp_block_nr
313 313
314Note that tp_block_size should be choosed to be a power of two or there will 314Note that tp_block_size should be chosen to be a power of two or there will
315be a waste of memory. 315be a waste of memory.
316 316
317-------------------------------------------------------------------------------- 317--------------------------------------------------------------------------------
318+ Maping and use of the circular buffer (ring) 318+ Mapping and use of the circular buffer (ring)
319-------------------------------------------------------------------------------- 319--------------------------------------------------------------------------------
320 320
321The maping of the buffer in the user process is done with the conventional 321The mapping of the buffer in the user process is done with the conventional
322mmap function. Even the circular buffer is compound of several physically 322mmap function. Even the circular buffer is compound of several physically
323discontiguous blocks of memory, they are contiguous to the user space, hence 323discontiguous blocks of memory, they are contiguous to the user space, hence
324just one call to mmap is needed: 324just one call to mmap is needed: