Đang chuẩn bị liên kết để tải về tài liệu:
Our ‘xmit1000.c’ driver: Implementing a ‘packet-transmit’ capability with the Intel 82573L network interface controller
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Our ‘xmit1000.c’ driver: Implementing a ‘packet-transmit’ capability with the Intel 82573L network interface controller includes Driver’s components, Single page-frame option, Our Tx-Descriptor ring, Direct Memory Access, Configuration registers. | Our ‘xmit1000.c’ driver Implementing a ‘packet-transmit’ capability with the Intel 82573L network interface controller Remenber ‘echo’ and ‘cat’? • Your device-driver module (named ‘uart.c’) was supposed to allow two programs that are running on a pair of adjacent PCs to communicate via a “null-modem” cable Transmitting $ echo Hello > /dev/uart $_ Receiving $ cat /dev/uart Hello _ ‘keep it simple’ • Let’s try to implement a ‘write()’ routine for our Intel Pro/1000 ethernet controllers that will provide the same basic functionality as we achieved with our serial UART driver • It should allow us to transmit a message by using the familiar UNIX ‘cat’ command to redirect output to a character device-file • Our device-file will be named ‘/dev/nic’ Driver’s components my_fops write ‘struct’ holds one function-pointer my_write() This function will program the actual data-transfer my_get_info() This function will allow us to inspect the transmit-descriptors module_init() This function will detect and configure the hardware, define page-mappings, allocate and initialize the descriptors, start the ‘transmit’ engine, create the pseudo-file and register ‘my_fops’ module_exit() This function will do needed ‘cleanup’ when it’s time to unload our driver – turn off the ‘transmit’ engine, free the memory, delete page-table entries, the pseudo-file, and the ‘my_fops’ Kzalloc() • Linux kernels since 2.6.13 offer this convenient function for allocating pre-zeroed kernel memory • It has the same syntax as the ‘kmalloc()’ function (described in our texts), but adds the after-effect of zeroing out the newly-allocated memory-area void *kmem = kmalloc( region_size, GFP_KERNEL ); memset( kmem, 0x00, region_size ); /* can be replaced with */ void *kmem = kzalloc( region_size, GFP_KERNEL ); • Thus it does two logically distinct actions (often coupled anyway) within a single .