The hardware ringbuffer Understanding the RTL-8139 mechanism for packet reception.

Slides:



Advertisements
Similar presentations
21.1 Chapter 21 Network Layer: Address Mapping, Error Reporting, and Multicasting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
Advertisements

ARP: Address Resolution Protocol
Internet Control Protocols Savera Tanwir. Internet Control Protocols ICMP ARP RARP DHCP.
The ATA/IDE Interface Can we write a character-mode device driver for the hard disk?
ISO/OSI Model Layers Application: applications that use the network. This is were mail, browsers, ftp, etc reside Presentation: data formats, character.
Receiver ‘packet-splitting’
1 Fall 2005 Hardware Addressing and Frame Identification Qutaibah Malluhi CSE Department Qatar University.
The RealTek interface Introduction to the RTL-8139 network controller registers.
RTL-8139 experimentation Setting up an environment for studying the Network Controller.
Examining network packets Information about the RTL8139 needed for understanding our ‘watch235.c’ pseudo driver.
Oct 21, 2004CS573: Network Protocols and Standards1 IP: Addressing, ARP, Routing Network Protocols and Standards Autumn
A RealTek Application Using our own device-driver and a standard networking protocol to discover the ‘active’ workstations.
Our ‘nic.c’ module We create a ‘character-mode’ device-driver for the 82573L NIC to use in futrure experiments.
Adjusting out device-driver Here we complete the job of modifying our ‘nicf.c’ Linux driver to support ‘raw’ packet-transfers.
ITIS 6167/8167: Network and Information Security Weichao Wang.
ARP Request/Reply Can we modify our previous device-driver so it will allow us to send and receive ‘raw’ packets?
What’s needed to transmit? A look at the minimum steps required for programming our anchor nic’s to send packets.
Hardware-address filtering How can we send packets to just one node on our ‘anchor’ cluster?
Address Resolution Protocol (ARP). Mapping IP Address to Data-Link Address  How does a machine map an IP address to its Data- Link layer (hardware or.
Building TCP/IP packets A look at the computation-steps which need to be performed for utilizing the TCP/IP protocol.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Ethernet, ARP.
VLAN Trunking Protocol (VTP) W.lilakiatsakun. VLAN Management Challenge (1) It is not difficult to add new VLAN for a small network.
© 2006 Cisco Systems, Inc. All rights reserved. ICND v2.3—1-1 Configuring Catalyst Switch Operations Configuring a Catalyst Switch.
Mapping Internet Addresses to Physical Addresses (ARP)
TELE202 Lecture 10 Internet Protocols (2) 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »Internet Protocols (1) »Source: chapter 15 ¥This Lecture »Internet.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Network Addressing Networking for Home and Small Businesses – Chapter 5.
Sublayers Under the Network Layer: BOOTP & DHCP
© 2007 Cisco Systems, Inc. All rights reserved. 1 Network Addressing Networking for Home and Small Businesses – Chapter 5 Darren Shaver – Modified Fall.
Fall 2005Computer Networks20-1 Chapter 20. Network Layer Protocols: ARP, IPv4, ICMPv4, IPv6, and ICMPv ARP 20.2 IP 20.3 ICMP 20.4 IPv6.
Hyung-Min Lee ©Networking Lab., 2001 Chapter 8 ARP and RARP.
1 TCP/IP Networking. 2 TCP/IP TCP/IP is the networking protocol suite most commonly used with UNIX, Windows, NT and most other OS’s. TCP/IP defines a.
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.
Internet Protocols. Address Resolution IP Addresses are not recognized by hardware. If we know the IP address of a host, how do we find out the hardware.
BAI513 - PROTOCOLS DHCP BAIST – Network Management.
Sem 3 V1 Chapter 7 Novell IPX. So far we have studied the TCP/IP protocol in depth. Another common protocol that is implemented in the networking industry.
Chapter 9 Hardware Address & Frame Type Identification Hardware address of frame Addressing schemes Ethernet Frame header format.
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.
BAI513 - PROTOCOLS ARP BAIST – Network Management.
© 2006 Cisco Systems, Inc. All rights reserved.Cisco Public BSCI Module 8 Lesson 3 1 BSCI Module 8 Lesson 3 Implementing Dynamic IPv6 Addresses.
Mapping IP Addresses to Hardware Addresses Chapter 5.
DMA Driver APIs DMA State Diagram Loading Driver and Opening Channel DMA Channel Attributes Loading Data to a Channel Unloading Data from a Channel.
1 Binding Protocol Addresses (ARP ). 2 Resolving Addresses Hardware only recognizes MAC addresses IP only uses IP addresses Consequence: software needed.
UDP : User Datagram Protocol 백 일 우
BAI513 - PROTOCOLS DHCP BAIST – Network Management.
Introduction to Ethernet In 1985, the Institute of Electrical and Electronics Engineers (IEEE) published standards for LANs. These standards start with.
1 4 ARP : Address Resolution Protocol. 2 4 Introduction - Problem Successful Mapping of an IP Address to a Hardware Address Ethernet uses MAC-address.
+ 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.
Address Resolution Protocol Yasir Jan 20 th March 2008 Future Internet.
Computer Networks 0111-ICMP Gergely Windisch
Packet Switch Network Server client IP Ether IPTCPData.
Data Communication Networks Lec 18. Wired LAN:Ethernet Datalink layer – Logical link control(LLC) – MAC Physical layer.
RARP : Reverse Address Resolution Protocol
IPv4 over IP CS Soohong Daniel Park Syam Madanapalli.
© 2003, Cisco Systems, Inc. All rights reserved.
Behrouz A. Forouzan TCP/IP Protocol Suite, 3rd Ed.
Introduction to Networks v6.0
IP: Addressing, ARP, Routing
Instructor Materials Chapter 5: Ethernet
Objective: ARP.
Address Resolution Protocol
Net 323: NETWORK Protocols
ARP: Address Resolution Protocol
Protocol layering and data
ARP: Address Resolution Protocol
Ch 17 - Binding Protocol Addresses
Protocol layering and data
ITIS 6167/8167: Network and Information Security
Presentation transcript:

The hardware ringbuffer Understanding the RTL-8139 mechanism for packet reception

Implementing a ringbuffer Start addressBuffer length datum HEAD TAIL Buffer storage datum TAIL = where to insert the next datum HEAD = where to remove the next datum

Some ringbuffer details When HEAD == TAIL the buffer is empty The HEAD and TAIL pointers advance to the end of the buffer, then ‘wrap around’ Some storage always remains unused When sizes of stored data-items are not uniform, then the size of each item must be stored somewhere – probably with the item itself

RealTek’s implementation data Receive Buffer Start AddressReceive Configuration Register (includes size of the buffer) CAPR Current Address of Packet to Read (minus 16 bytes) CBR Current Buffer Register (4-byte aligned) = packet header (4-bytes) = packet data (size varies) Buffer storage

Packet-Header Format MARMAR PAMPAM BARBAR reserved ISEISE RUNTRUNT LONGLONG CRCCRC FAEFAE ROKROK Packet Status (least significant 16 bits) Packet Length (most significant 16 bits) LEGENDROK = Received OK MAR (Multicast Address Received)FAE = Frame Alignment Error PAM (Physical Address Matched) CRC = CRC Error BAR (Broadcast Address Received)LONG = Packet length exceeds 4KB RUNT = Packet size below 64 bytes ISE = Invalid Symbol Error

Receive Algorithm Reset controller (bit #4 in register CR) Allocate memory and program RBSTART Enable reception (bit #3 in register CR) Configure reception (RXCONFIG register) Adjust CAPR for size of allocated buffer Optionally unmask the receive interrupts Await received packet(s) (bit #0 in CR)

Recall ‘RXCONFIG’ layout 32-bit register (offsets 0x44-0x47) reserved Early Receive Threshold reserved Mult ER INT Rx ERR 8 Rx FIFO Threshold Rx Buf Length Max DMA Burse Size WRAPWRAP 0 LONGLONG RUNTRUNT BCASTBCAST MCASTMCAST MACMAC ALLALL

How to configure Rx Buffer length is the most crucial parameter –8KB (=00)with or without ‘wrap’ –16KB (=01)with or without ‘wrap’ –32KB (=10)with or without ‘wrap’ –64KB (=11) (‘wrap’ is automatic) Next is which packets to receive: –Broadcast, Multicast and MAC-Address Match –(You do NOT want to receive ALL packets)

What about thresholds? The Linux driver offers us guidance –Can use ‘none’ as Early Rx Threshold –Can use ‘none’ as Rx FIFO Threshold –Can use a ‘reserved’ DMA Burst size So the Linux driver used: 0x0000E70E But you can experiment with other values

In-class exercise #1 Install our ‘user8139.c’ device-driver, and take note of its buffer’s physical address Install our ‘dram.c’ device-driver, and use ‘fileview’ to look at the NIC Receive Buffer Then modify ‘nicstudy.cpp’ so that it will enable (and configure) packet-recption Use ‘fileview’ to look at received packets

In-class exercise #2 Now enhance your modified version of the ‘nicstudy’ application so that it will display a succession of received packets (using both hexadecimal and ascii formats), in a manner similar to our ‘rxtester.cpp’ demo Be sure you ‘disable’ the packet reception before you remove ‘user8139.ko’ from the kernel – or risk a system ‘crash’ (Why?)

The ‘/etc/ethers’ file This file describes the list of associations of Ethernet-addresses with IP-addresses It’s a text file, created with a text editor Each line describes one correspondence: xx:xx:xx:xx:xx:xx But comments start with a #-character A sample ‘ethers’ file is on our website

Dynamic Address Resolution A standard Internet Protocol service exists which provides a dynamic way for stations to discover the Ethernet address that goes with a given IP-address It is called ‘Address Resolution Protocol’

ARP request AB CDE request Station ‘A’ wants to know the Ethernet Address for station ‘B’ So ‘A’ broadcasts an ARP request-packet to all other stations

ARP reply AB CDE reply Station ‘B’ recognizes that the request is for its Ethernet Address. So ‘B’ replies directly to ‘A’, and other stations ignore the request.

ARP packet-format ARP packet-data0806Dest’n MACSource MAC packet-header PTYPE=0008HTYPE=0001 OPER=0001/0002PLEN=04HLEN (01) source hardware address (6 bytes) source protocol address (4 bytes) destination hardware address (6 bytes) destination protocol address (4 bytes) All zeros for an ARP request broadcast address for ARP request