Xinying Wang, Cong Xu CS 423 Project



Similar documents
Operating Systems Design 16. Networking: Sockets

Network packet capture in Linux kernelspace

Programming PCI-Devices under Linux

Linux Driver Devices. Why, When, Which, How?

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-12: Real Time Linux

Network Drivers CHAPTER 17. Chapter 17

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

The new frontier of the DATA acquisition using 1 and 10 Gb/s Ethernet links. Filippo Costa on behalf of the ALICE DAQ group

Networking Driver Performance and Measurement - e1000 A Case Study

Enabling Linux* Network Support of Hardware Multiqueue Devices

Gigabit Ethernet Packet Capture. User s Guide

Ethernet. Ethernet. Network Devices

Collecting Packet Traces at High Speed

D1.2 Network Load Balancing

Analysis of Open Source Drivers for IEEE WLANs

Performance of Software Switching

Wire-speed Packet Capture and Transmission

Sockets vs. RDMA Interface over 10-Gigabit Networks: An In-depth Analysis of the Memory Traffic Bottleneck

KeyStone Training. Multicore Navigator Overview. Overview Agenda

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference.

VXLAN Performance Evaluation on VMware vsphere 5.1

ENGG*44200 Real Time System Design Lab3 Implement VoIP on ARM Outline

Virtualization: TCP/IP Performance Management in a Virtualized Environment Orlando Share Session 9308

Operating Systems. 12. Devices. Paul Krzyzanowski. Rutgers University. Spring /9/ Paul Krzyzanowski

High-performance vswitch of the user, by the user, for the user

KeyStone Architecture Gigabit Ethernet (GbE) Switch Subsystem. User Guide

Data Center Bridging Attributes. John Fastabend LAN Access Division, Intel Corp.

Have both hardware and software. Want to hide the details from the programmer (user).

The Performance Analysis of Linux Networking Packet Receiving

Performance Evaluation of VMXNET3 Virtual Network Device VMware vsphere 4 build

Understanding OpenFlow

OpenFlow with Intel Voravit Tanyingyong, Markus Hidell, Peter Sjödin

TCP Offload Engines. As network interconnect speeds advance to Gigabit. Introduction to

Intel DPDK Boosts Server Appliance Performance White Paper

Optimizing Network Virtualization in Xen

Fibre Channel over Ethernet in the Data Center: An Introduction

Internet Architecture and Philosophy

Using Industrial Ethernet Networks for PROFInet

An Implementation Of Multiprocessor Linux

HANIC 100G: Hardware accelerator for 100 Gbps network traffic monitoring

Monitoring high-speed networks using ntop. Luca Deri

CS 416: Opera-ng Systems Design

SEP Packet Capturing Using the Linux Netfilter Framework Ivan Pronchev

Device Management Functions

Network Programming TDC 561

VLAN for DekTec Network Adapters

Internet Working 5 th lecture. Chair of Communication Systems Department of Applied Sciences University of Freiburg 2004

Linux Kernel Architecture

MEASURING WIRELESS NETWORK CONNECTION QUALITY

1. Computer System Structure and Components

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

CS161: Operating Systems

Computer-System Architecture

A way towards Lower Latency and Jitter

Performance Analysis of Network Subsystem on Virtual Desktop Infrastructure System utilizing SR-IOV NIC

A Transport Protocol for Multimedia Wireless Sensor Networks

ncap: Wire-speed Packet Capture and Transmission

A Research Study on Packet Sniffing Tool TCPDUMP

A Design of Video Acquisition and Transmission Based on ARM. Ziqiang Hao a, Hongzuo Li b

1000-Channel IP System Architecture for DSS

ACHILLES CERTIFICATION. SIS Module SLS 1508

IEEE Congestion Management Presentation for IEEE Congestion Management Study Group

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

Improving the Database Logging Performance of the Snort Network Intrusion Detection Sensor

A Packet Forwarding Method for the ISCSI Virtualization Switch

PCI Express High Speed Networks. Complete Solution for High Speed Networking

Accelerate In-Line Packet Processing Using Fast Queue

Easy H.264 video streaming with Freescale's i.mx27 and Linux

CANnes PC CAN Interface Manual

Architectural Breakdown of End-to-End Latency in a TCP/IP Network

Unit of Learning # 2 The Physical Layer. Sergio Guíñez Molinos sguinez@utalca.cl

Data Transfer between Serial Link and TCP/IP Link Using ez80f91 MCU

Transport Layer. Chapter 3.4. Think about

MBP_MSTR: Modbus Plus Master 12

The Bus (PCI and PCI-Express)

Getting the most TCP/IP from your Embedded Processor

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Evaluation Report: Emulex OCe GbE and OCe GbE Adapter Comparison with Intel X710 10GbE and XL710 40GbE Adapters

Bridging the Gap between Software and Hardware Techniques for I/O Virtualization

Introduction To Computer Networking

Overview of Computer Networks

IP - The Internet Protocol

RF Monitor and its Uses

High-performance vnic framework for hypervisor-based NFV with userspace vswitch Yoshihiro Nakajima, Hitoshi Masutani, Hirokazu Takahashi NTT Labs.

Figure 1.Block diagram of inventory management system using Proximity sensors.

Unix System Administration

SR-IOV Networking in Xen: Architecture, Design and Implementation Yaozu Dong, Zhao Yu and Greg Rose

Quantifying the Performance Degradation of IPv6 for TCP in Windows and Linux Networking

Application Note: AN00121 Using XMOS TCP/IP Library for UDP-based Networking

Kernel Synchronization and Interrupt Handling

AN833. The Microchip TCP/IP Stack INTRODUCTION STACK ARCHITECTURE REFERENCE MODEL

Virtual Machines. COMP 3361: Operating Systems I Winter

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Linux Kernel Networking. Raoul Rivas

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

IP address format: Dotted decimal notation:

Transcription:

Understanding Linux Network Device Driver and NAPI Mechanism Xinying Wang, Cong Xu CS 423 Project Outline Ethernet Introduction Ethernet Frame MAC address Linux Network Driver Intel e1000 driver Important data structures Ethernet Driver Initialization & Registration Initialize net_device Set up device opetation Set up DMA & NAPI Summary & Future Work Interrupt Profiler To Test NAPI Profiler implementation Experiment results 1

Introduction to Ethernet A family of computer networking technologies for local area networks (LANs) Commercially introduced in 1980 and standardized in 1983 as IEEE 802.3. The most popular network with good degree of compatibility Features: o Ethernet frame o MAC Address Ethernet frame Transported by Ethernet packet (a data packet on an Ethernet) Example of Ethernet frame structure through TCP socket: Ethernet header IP header TCP header Data Frame Check Sequence (FCS) Ethernet header o Header: a set of bytes (octets*) prepended to a packet o Include destination MAC address and source MAC address FCS: to detect any in-transit corruption of data *octet: a group of eight bits 2

MAC address Media Access Control address Often stored in hardware s read-only memory First three octets: Organizationally Unique Identifier (OUI) Following octets: as long as unique Linux network driver Linux kernel handles MAC address resolution. Network drivers are still needed o Kernel cannot do anything o Different from character drivers and block drivers Intel e1000 driver for Ethernet adapter o /drivers/net/ethernet/intel/e1000 3

Data structure: struct net_device Global information o char name[ifnamsiz]: The name of the device. o unsigned long state: Device state. o struct net_device *next: Pointer to the next device in the global linked list. o int (*init)(struct net_device *dev): An initialization function. Data structure: struct net_device Hardware information: o unsigned long rmem_end, rmem_start, mem_end, mem_start: Device memory information. o unsigned long base_addr: The I/O base address of the network interface. o unsigned char irq: The assigned interrupt number. o unsigned char dma: The DMA channel allocated by the device. 4

Data structure: struct e1000_adapter struct net_device *netdev; o Pointer to net_device struct struct pci_dev *pdev; o Pointer to pci_device struct struct e1000_hw hw; o An e1000_hw struct struct e1000_hw_stats stats; o Statistics counters collected by the MAC Data structure: struct e1000_hw e1000_mac_type mac_type; o An enum for currently available devices u8 mac_addr[node_address_size]; o MAC address u16 device_id; o Device identification information u16 vendor_id; o Vendor information 5

Ethernet driver initialization and registration init_module pci_register_drive e1000_probe( ) r(&e1000_driver) Driver entrance.name = e1000_driver_name,.id_table = e1000_pci_tbl,.probe = e1000_probe,. Create and initialize struct net_device set up device operation Do hardware and software initialization Copy out MAC address from EEPROM Set up DMA and napi Set up timers Register device Initialize struct net_device Initialization is done by calling MACRO alloc_etherdev(sizeof_priv) Track down to function struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, void (*setup)(struct net_device *), unsigned int queue_count) in net/core/dev.c What does this function do? Create a net_device struct Allocate kernel memory for package_receiving transmitting queues Initiate lists: ethtool_ntuple_list napi_list unreg_list link_watch_list Return a pointer of the new struct 6

Set up device operation It is defined in struct net_device_ops What does device operation do? open Close Get System Network Statistics Configuring hardware for uni or multicast Change Ethernet address Set transmission time-out Change MTU I/O control Validate Ethernet address Hardware and software initialization Hardware initialization Initialize members of hw struct; abstract vendor ID, device ID, subsystem ID; identify mac type; set MTU size. Software initialization This is done after hardware initialization; Initialize general software structures (struct e1000_adapter) 7

Set up DMA and NAPI What is NAPI and why do we need NAPI? Allocate buffer skb e1000_rx_ring Remap DMA dma_map_single() NAPI add netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) How a package being received Received a package NAPI enable? No Normal interrupt handling package Yes E1000_intr() Interrupt handler IRQ_disable _schedule(napi) E1000 driver is NAPI-enabled 8

NAPI implementation In interrupt handler function e1000_entr() Make sure the net device is working properly netif_rx_schedule_prep() Add net device into poll list _netif_rx_schedule()->napi_schedule() _raise_softirq_irqoff(net_rx_softirq) for switching to bottom half NAPI implementation Bottom half function net_rx_action() Return yes Set budget Work > budget or process time > 1s no Calculate weight for device Call poll function E1000_clean() Move device to the list end 9

NAPI implementation Poll function e1000_clean() Clean_rx() Work_done < weight? Yes Remove device from list no Return work_done Experiment An experiment is designed to test NAPI mechanism A interrupt profiler is designed to profile the interrupt counts in a designed period Linux kernel 3.13.6 was employed to fulfill the experiment Experiment platform: CPU: Intel core i5 dual core 2.53Ghz; Memory: 4G; Network card: Intel-82577 Gb card 10

Profiler implementation Char Device Driver interface unsigned long Interrupt_counter; Monitor Process mmap() Profiler buffer Kernel Module Monitor Work Queue Network Driver Handler function Kernel build-in Network driver Results streaming YouTube video streaming YouTube video 16000 2500 14000 12000 2000 interrupt (counts) 10000 8000 6000 4000 2000 interrupts/second 1500 1000 500 0 0 50 100 150 200 250 300 350 Time (s) 0 0 50 100 150 200 250 300 350 Time(s) Accumulated interrupts Differentiated interrupts 11

Summary and future work The Linux network device driver was analyzed base on Intel E1000 driver code files. The mechanism and implementation of NAPI was detailed An experiment was designed to further understand the NAPI mechanism A thorough understanding the Linux network device driver could be done for the future by further analysis of more sub functions. Reference Branden Moore, Thomas Slabach, Lambert Schaelicke, Profiling Interrupt Handler Performance through Kernel Instrumentation, Proceedings of the 21 st international conference on computer design Lambert Schaelicke, Al Davis, and Sally A. Mckee, Profiling I/O Interrupts in Modern Architectures Linux kernel source code (version 3.13.6) 12

Q & A Thanks! 13