Presentation is loading. Please wait.

Presentation is loading. Please wait.

Examining network packets Information about the RTL8139 needed for understanding our ‘watch235.c’ pseudo driver.

Similar presentations


Presentation on theme: "Examining network packets Information about the RTL8139 needed for understanding our ‘watch235.c’ pseudo driver."— Presentation transcript:

1 Examining network packets Information about the RTL8139 needed for understanding our ‘watch235.c’ pseudo driver

2 Harney-235 The Kudlick Classroom’s workstations are equipped with network interface adapters designed by RealTek (model 8139) The Linux network device-driver for these NICs is configured on our workstations to use 32KB of memory as a receive buffer Each device interrupt identification number is calculated by adding 0x20 to the IRQ

3 RTL8139 registers The RTL8139 has a number of hardware registers which control its operations and provide information about its current state The Linux driver programs these registers Our driver will need to read three of them: –Interrupt Status register –Receive Buffer Start Address register –Current Address of Packet Read register

4 The Receive Buffer 32KB RAM RBSTART 32-bits 16-bits CAPR packet data packet-header packet-checksum 16-bits ISR 16-bits CBR

5 Rx Buffer Operation When a new packet is received, the 8139 stores it into the Receive Buffer area, at the offset specified in the CBA register (Current Buffer Address), automatically advances the CBA value to the offset of the end of the packet, and generates an interrupt (with ISR equal to 0x0001)

6 Interrupt Service Routine The CAPR register points to an offset that is 16-bytes ahead of the newly received packet’s packet-header The packet-header is always aligned on a 32-bit address-boundary The packet-header consists of two fields: –The packet status (16-bits) –The packet length (16-bits)

7 Packet Length The packet-length field contains a count of the number of bytes of packet-data, plus 4 (for the length of the packet’s checksum) The maximum length of a network packet is set by an ethernet standard: 1514 bytes (not including the 4-byte CRC checksum) The minimum length of a network packet is normally required to be 60 bytes (+CRC)

8 Packet Status MARMAR PAMPAM BARBAR ISEISE RUNTRUNT LONGLONG CRCCRC FAEFAE ROKROK Legend: ROK = Receive OK FAE = Frame Alignment Error CRC = Checksum Error LONG = Long Packet ( > 4K bytes) RUNT = Data + CRC < 64 bytes ISE = Invalid Symbol Error BAR = Broadcast Address Received PAM = Physical Addfess Matched MAR = Multicast Address Received

9 Demo: ‘trywatch.cpp’ After you download and then compile our ‘watch235.c’ driver module, you can try running this demo-program to see a dump (in hex and ascii formats) of a packet that is received in our classroom (Harney-235)

10 In-Class exercise Modify the ‘trywatch.cpp’ program so that it continuously ‘dumps’ received packets, until the user terminates the endless loop by typing -C. For a graceful termination, you should use a signal-handler to break out of your loop, so that you can close the pseudo-file and remove the ‘watch235’ driver module


Download ppt "Examining network packets Information about the RTL8139 needed for understanding our ‘watch235.c’ pseudo driver."

Similar presentations


Ads by Google