Presentation is loading. Please wait.

Presentation is loading. Please wait.

Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in futrure experiments.

Similar presentations


Presentation on theme: "Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in futrure experiments."— Presentation transcript:

1 Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in futrure experiments

2 Character devices The concept of a ‘character mode’ device is that it provides a ‘stream’ of data bytes which application-programs can access with these standard Linux system-calls: –‘open()’ and ‘close()’ –‘read()’ and ‘write()’ –‘lseek()’

3 Requirement The character-mode devices are known to a Linux system by their ‘names’ and by an associated pair of ID-numbers (major and minor) normally set up by a ‘superuser’ root# mknod /dev/nic c 97 0 root# chmod a+rw /dev/nic

4 Driver module module_init module_exit fops read() write() ioctl() isr() get_info() nic.c required pair of module administration functions character-mode device-driver’s required ‘file-operations’ data-structure this module’s collection of ‘payload’ functions

5 Overview hardware char driver module Linux operating system Kernel networking subsystem application program standard runtime libraries user space kernel space file subsystem

6 Transmit operation application program user data-buffer runtime library write() Linux OS kernel nic device-driver my_write() file subsystem hardware packet buffer copy_from_user() DMA user space kernel space

7 Receive operation application program user data-buffer runtime library read() Linux OS kernel nic device-driver my_read() file subsystem hardware packet buffer copy_to_user() user space kernel space DMA

8 Our packet-format Our ‘nic.c’ driver elects to have the NIC append ‘padding’ to any short packets But this prevents a receiver from knowing how many bytes represent actual data To solve this problem, we added our own ‘count’ field to each packet’s payload actual bytes of user-data 0 6 12 14 destination MAC-addresssource MAC-address Type/Len count

9 Using ‘echo’ and ‘cat’ Our device-driver module ‘nic.c’ is intended to allow two programs that are running on a pair of anchor-cluster PCs to communicate via that cluster’s Local Area Network $ echo Hello > /dev/nic $ _ $ cat /dev/nic Hello _ Receiving…Transmitting…

10 “Jumbo” packets One of the innovations provided by gigabit ethernet technology is support in the NIC for larger-than-normal size data-packets The most common upper bound for data capacity in “jumbo” frames is 9000 bytes (plus the usual ethernet frame “header”) Our 82573L network controller implements “long packet” support as an option

11 Receive Control (0x0100) R =0 00 FLXBUF SE CRC BSEX R =0 PMCF DPF R =0 CFI EN VFE BSIZE BAMBAM R =0 MODTYPRDMTS ILOSILOS SLUSLU LPEUPE 0 R =0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 SBP ENEN 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 LBMMPE EN = Receive Enable DTYP = Descriptor TypeDPF = Discard Pause Frames SBP = Store Bad Packets MO = Multicast OffsetPMCF = Pass MAC Control Frames UPE = Unicast Promiscuous Enable BAM = Broadcast Accept ModeBSEX = Buffer Size Extension MPE = Multicast Promiscuous Enable BSIZE = Receive Buffer SizeSECRC = Strip Ethernet CRC LPE = Long Packet reception Enable VFE = VLAN Filter EnableFLXBUF = Flexible Buffer size LBM = Loopback ModeCFIEN = Canonical Form Indicator Enable RDMTS = Rx-Descriptor Minimum Threshold SizeCFI = Cannonical Form Indicator bit-value 82573L Our ‘nic.c’ driver initially will program this register with the value 0x0400801C. Later, when everything is ready, it will turn on bit #1 to ‘start the receive engine’

12 Project 1 Revise our ‘nic.c’ device-driver module so it will allow application programs to ‘write’ (i.e., transmit) and to ‘read’ (i.e., receive) “jumbo” packets which contain up to 9000 data-bytes, plus ethernet header and CRC Construct a pair of application-programs that you can use (in place of ‘echo’ and ‘cat’) to test your enhanced device-driver

13 In-class demonstration We can use our (unmodified) ‘nic.c’ driver to study the way in which our 82573L NIC uses a portion of its internal i/o-memory We can view the NIC’s internal memory using our ‘82573.c’ character driver and our ‘fileview’ navigation-tool We’ve also created an additional module (named ‘nicmap.c’) to assist in this study

14 Rx-Descriptor Control (0x2828) 0000000 GRANGRAN 00 WTHRESH (Writeback Threshold) 000 FRC DPLX FRC SPD 0 HTHRESH (Host Threshold) ILOSILOS 0 ASDEASDE 0 LRSTLRST 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 00 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 PTHRESH (Prefetch Threshold) 00 Recommended for 82573: 0x01010000 (GRAN=1, WTHRESH=1) “This register controls the fetching and write back of receive descriptors. The three threshhold values are used to determine when descriptors are read from, and written to, host memory. Their values can be in units of cache lines or of descriptors (each descriptor is 16 bytes), based on the value of the GRAN bit (0=cache lines, 1=descriptors). When GRAN = 1, all descriptors are written back (even if not requested).” --Intel manual

15 Exploring RX Descriptor FIFO Timeout for an in-class demonstration

16 In-class exercise Modify the code in our ‘nicmap.c’ module so that you can use it to explore the NIC’s TX Descriptor FIFO (begins at 0x07000)


Download ppt "Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in futrure experiments."

Similar presentations


Ads by Google