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

Slides:



Advertisements
Similar presentations
Lecture 101 Lecture 10: Kernel Modules and Device Drivers ECE 412: Microcomputer Laboratory.
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
Hardware ‘flow control’ How we can activate our NIC’s ability to avoid overwhelming the capacities of its ‘link partner’
More 82573L details Getting ready to write and test a character-mode device-driver for our anchor-LAN’s ethernet controllers.
Fixing some driver problems Most software is discovered to have some ‘design-flaws’ after it has been put into use for awhile.
Receiver ‘packet-splitting’
I/o multiplexing On adding a ‘poll()’ method to our character-mode device-driver for an 82573L network controller.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Virtual Local Area Networks A look at how the Intel 82573L nic supports IEEE standard 802.1q for ethernet VLANs.
What’s needed to receive? A look at the minimum steps required for programming our 82573L nic to receive packets.
1 Fall 2005 Hardware Addressing and Frame Identification Qutaibah Malluhi CSE Department Qatar University.
Hardware-address filtering How can we send packets to just one node on our ‘anchor’ cluster?
The RealTek interface Introduction to the RTL-8139 network controller registers.
Standard C Libraries Application Programmming Interface to System-Calls.
RTL-8139 experimentation Setting up an environment for studying the Network Controller.
Computer Network 實踐資管 Wang-Jiunn Cheng 2004 PART IV-2 Local Area Networks (LANs) Frame.
Examining network packets Information about the RTL8139 needed for understanding our ‘watch235.c’ pseudo driver.
Our ‘recv1000.c’ driver Implementing a ‘packet-receive’ capability with the Intel 82573L network interface controller.
Introduction to Kernel
The hardware ringbuffer Understanding the RTL-8139 mechanism for packet reception.
A “real” network driver? We want to construct a Linux network device-driver that is able to send and receive packets.
I/O Systems CS 3100 I/O Hardware1. I/O Hardware Incredible variety of I/O devices Common concepts ◦Port ◦Bus (daisy chain or shared direct access) ◦Controller.
Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in future experiments.
What’s needed to transmit? A look at the minimum steps required for programming our 82573L nic to send packets.
The ‘ioctl’ driver-function On implementing a way to query and modify our UART’s baudrate via the ‘device-file’ abstraction.
Adjusting out device-driver Here we complete the job of modifying our ‘nicf.c’ Linux driver to support ‘raw’ packet-transfers.
Looking at kernel objects How a character-mode Linux device driver can be useful in viewing a ‘net_device’ structure.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
What’s needed to transmit? A look at the minimum steps required for programming our anchor nic’s to send packets.
IP Routing: an Introduction. Quiz
CS335 Networking & Network Administration Tuesday, April 13, 2010.
Hardware-address filtering How can we send packets to just one node on our ‘anchor’ cluster?
What’s needed to receive? A look at the minimum steps required for programming our anchor nic’s to receive packets.
Building TCP/IP packets A look at the computation-steps which need to be performed for utilizing the TCP/IP protocol.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
COMP 3438 – Part I - Lecture 4 Introduction to Device Drivers Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
I/O Systems I/O Hardware Application I/O Interface
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Transmission Control Protocol
Ethernet Driver Changes for NET+OS V5.1. Design Changes Resides in bsp\devices\ethernet directory. Source code broken into more C files. Native driver.
NS Training Hardware.
An initial study on Multi Path Routing Over Multiple Devices in Linux 2.4.x kernel Towards CS522 term project By Syama Sundar Kosuri.
Chapter 9 Hardware Addressing and Frame Type Identification 1.Delivering and sending packets 2.Hardware addressing: specifying a destination 3. Broadcasting.
1 Ch 9 Hardware Addressing and Frame Type Identification.
Internet Protocols (chapter 18) CSE 3213 Fall 2011.
Intel Research & Development ETA: Experience with an IA processor as a Packet Processing Engine HP Labs Computer Systems Colloquium August 2003 Greg Regnier.
LAN Switching Concepts. Overview Ethernet networks used to be built using repeaters. When the performance of these networks began to suffer because too.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
Chapter 7 OSI Data Link Layer.
1 Hardware Addressing and Frame Type Identification.
CCNA3 Module 4 Brierley Module 4. CCNA3 Module 4 Brierley Topics LAN congestion and its effect on network performance Advantages of LAN segmentation in.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
+ Lecture#2: Ethernet Asma ALOsaimi. + Objectives In this chapter, you will learn to: Describe the operation of the Ethernet sublayers. Identify the major.
ADDRESS MAPPING ADDRESS MAPPING The delivery of a packet to a host or a router requires two levels of addressing: logical and physical. We need to be able.
WINLAB Open Cognitive Radio Platform Architecture v1.0 WINLAB – Rutgers University Date : July 27th 2009 Authors : Prasanthi Maddala,
Data Communication Networks Lec 18. Wired LAN:Ethernet Datalink layer – Logical link control(LLC) – MAC Physical layer.
Introduction to Networks v6.0
Zero-copy Receive Path in Virtio
Instructor Materials Chapter 5: Ethernet
Network Administration CNET-443
Net 323: NETWORK Protocols
Data Link Issues Relates to Lab 2.
COMPUTER NETWORKS CS610 Lecture-10 Hammad Khalid Khan.
Operating System Concepts
CS703 - Advanced Operating Systems
Implementing an OpenFlow Switch on the NetFPGA platform
Fixes and Enhancements
VIRTIO 1.1 FOR HARDWARE Rev2.0
Presentation transcript:

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

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()’

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

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

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

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

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

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 destination MAC-addresssource MAC-address Type/Len count

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…

“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

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 = SBP ENEN 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 0x C. Later, when everything is ready, it will turn on bit #1 to ‘start the receive engine’

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

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

Rx-Descriptor Control (0x2828) GRANGRAN 00 WTHRESH (Writeback Threshold) 000 FRC DPLX FRC SPD 0 HTHRESH (Host Threshold) ILOSILOS 0 ASDEASDE 0 LRSTLRST PTHRESH (Prefetch Threshold) 00 Recommended for 82573: 0x (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

Exploring RX Descriptor FIFO Timeout for an in-class demonstration

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)