1 / 10

RTL-8139 experimentation

RTL-8139 experimentation. Setting up an environment for studying the Network Controller. Operating the NIC. We saw that, with a suitable device-driver, we could memory-map the NIC’s registers into an application’s virtual address space (our ‘mmap8139.c’ module did that for us)

jholman
Télécharger la présentation

RTL-8139 experimentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RTL-8139 experimentation Setting up an environment for studying the Network Controller

  2. Operating the NIC • We saw that, with a suitable device-driver, we could memory-map the NIC’s registers into an application’s virtual address space (our ‘mmap8139.c’ module did that for us) • But operating the NIC requires two further ‘resources’ that are not directly accessible from user-space: memory and interrupts

  3. Kernel memory-buffer • We can enhance of our device-driver so it provides access to a region of physically contiguous processor memory, by using ‘kmalloc()’ during module-initialization to reserve a big enough buffer (80-KB), and by equipping our driver with functions that perform ‘read()’, ‘write()’, and ‘lseek()’ on the allocated region of kernel memory

  4. Avoid using interrupts • We can temporarily avoid using interrupts by performing ‘polling’ operations during our initial exploratory work with the NIC • Interrupts are disabled by doing a ‘reset’ • Later, after we have developed our basic understanding of the NIC’s operations, we can turn to the issue of how interrupts may be employed for improved efficiency

  5. Overview of our setup kernel-space user-space standard runtime libraries Linux Kernel ‘user8139.ko’ device-driver ‘nicstudy’ application mmap llseek write read 8139 registers memory buffer

  6. The ‘transmit’ steps • To transmit our first network packet, we ‘write’ it into our kernel buffer (at offset 0) • We ‘enable’ transmission (bit #2 of CR) • We ‘configure’ transmission, or use default • To ‘initiate’ packet-transmission, we write the packet’s length to ‘TxStatus0’ register • The NIC sets bit 13 of TxStatus when the transmission has been concluded

  7. Did it work? • Our ‘nicstudy.cpp’ application performs a packet-transmission (using ‘user8139.c’) • To verify that our packet was indeed sent over the Local Area Network, we need to setup another workstation that receives it (and displays the transmitted information) • Our ‘rxtester.cpp’ program can do this – but it requires a ‘privileged’ user to run it

  8. Multiple packets • To send another packet, we need to use the next ‘transmit descriptor’ among four that the network controller supports: • Descriptor 0: <TxStatus0, TxBuffer0> • Descriptor 1: <TxStatus0, TxBuffer1> • Descriptor 2: <TxStatus0, TxBuffer2> • Descriptor 3: <TxStatus0, TxBuffer3> • These descriptors must be used in ‘round robin’ fashion (i.e., as a ‘circular queue’)

  9. In-class exercise #1 • Modify the ‘nicstudy.cpp’ application so it transmits fifteen packets in succession • You can use your ‘rxtester’ workstation’s MAC address in the destination-field for your packet (first six bytes), to avoid your 15 packets being received by everyone’s test-station (that would be very confusing)!

  10. In-class exercise #2 • Find out the lengths for the smallest and the largest packets you can successfully transmit and receive • Find out the maximum number of 80-byte packets that you can successfully transmit and receive during a one-second interval

More Related