1 / 22

Network Devices

Network Devices. Reading: Chapter 5. Network devices. Interface between network adapters and software protocols Asynchronous input/output point of protocol stack. (Network) Hardware Properties. I/O ports (base address) Address of the hardware (in I/O address space) Interrupt ReQuest (IRQ)

mikko
Download Presentation

Network Devices

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Network Devices Reading: Chapter 5 FSU CIS 5930 Internet Protocols

  2. Network devices • Interface between network adapters and software protocols • Asynchronous input/output point of protocol stack FSU CIS 5930 Internet Protocols

  3. (Network) Hardware Properties • I/O ports (base address) • Address of the hardware (in I/O address space) • Interrupt ReQuest (IRQ) • Informing kernel something happens at hardware • DMA channel • Direct Memory Access FSU CIS 5930 Internet Protocols

  4. Network device interface • Abstract from technical details of network adapters • Uniform interface for access by protocol instances • dev.c (net/core/dev.c) • Providing interface/functions for upper layer • net_device structure (include/linux/netdevice.h) • Hiding specific details in network drivers • xxx_driver.c (drivers/net/xxx_driver.c) • Implementation of specific network drivers FSU CIS 5930 Internet Protocols

  5. Higher protocol instances dev.c Network devices (Adapter-independent) dev_open dev_close netif_rx dev_queue_xmit Network-devices interface net_device Abstraction from Adapter specfics dev->hard_start_xmit dev->open dev->stop driver.c net_start_xmit net_rx net_tx Network driver(Adapter-specifics) net_open net_stop skb skb net_interrupt skb Network device interface (Cont’d) FSU CIS 5930 Internet Protocols

  6. net_device structure • Defined in include/linux/netdevice.h • Abtract from network adapter specifics • Containing network adapter information • Configuration data of the adapter • General fields of a network device • Hardware-specific fields • Data on physical layer • Data on network layer • Device-driver methods/functions FSU CIS 5930 Internet Protocols

  7. General fields of a network device • Name • For example, eth0, lo • ifindex • State • For example, if the adapter is up • qdisc • Queue discipline • How packets are served • And other fields FSU CIS 5930 Internet Protocols

  8. Hardware-specific fields • rmem_start, rmem_end, mem_start, mem_end • Memory for sending/receiving packets • base_addr • I/O base address • irq • Interrupt ReQuest • DMA channel • And other fields FSU CIS 5930 Internet Protocols

  9. Data on physical layer • hard_header_length • Layer-2 packet header length • mtu • Maximum transfer unit • addr_len, dev_addr[MAX_ADDR_LEN] • Layer-2 address length and address • And other fields FSU CIS 5930 Internet Protocols

  10. Data on network layer • ip_ptr, ip6_ptr, etc • Corresponding layer-3 pointers • family • Address family, e.g., AF_INET for IP • pa_alen • Address length for the family, e.g, 4 for IP • pa_addr, pa_mask • Address and mask • And other fields FSU CIS 5930 Internet Protocols

  11. Device-driver methods • They are function pointers. Adapter drivers need to implement and map to them • Initialization/activation/de-activation • init(), destructor(), open(), close() • Transmission of data • hard_start_xmit() • Control functions • do_ioctl(), set_config() • Helpful functions • dard_header(), hard_header_parse(), etc • Other functions FSU CIS 5930 Internet Protocols

  12. net_device name: eth1 dev_base state net_device next priv net_device ... name: eth0 Hardware state local2private driver structure next MAC Layer priv ... Network layer Hardware open MAC Layer adapter2_open() stop adapter2_stop() hard_start_xmit Network layer adapter2_start_xmit() ... open adapter_open() stop adapter_stop() hard_start_xmit adapter_start_xmit() ... local1private driver structure Managing Network Devices FSU CIS 5930 Internet Protocols

  13. Functions to manage devices • Registering/unregistering devices • Opening/closing devices • Creating/finding devices • Transmitting over devices • Provided in the following two files • net/core/dev.c • drivers/net/net_init.c FSU CIS 5930 Internet Protocols

  14. Registering/unregistering devices • init_netdev(dev, sizeof_priv, mask, setup) • init_etherdev(dev, priv_size) • ether_setup(dev) • register_netdevice(dev) • unregister_netdevice(dev) FSU CIS 5930 Internet Protocols

  15. Opening/closing devices • dev_open(dev) • dev_close(dev) FSU CIS 5930 Internet Protocols

  16. Creating/finding devices • dev_alloc_name(dev, name) • dev_alloc(name, err) • dev_get_by_name(name) • dev_get(name) • dev_getbyhwaddr(type, ha) • dev_load(name) FSU CIS 5930 Internet Protocols

  17. Transmitting over network devices • dev_queue_xmit(skb) FSU CIS 5930 Internet Protocols

  18. Network drivers • They implement adapter specific functions • Initializing adapters • Opening and closing network adapters • Transmitting/receiving data • We use sample driver isa_skeleton.c to discuss functions (drivers/net/isa_skeleton.c) FSU CIS 5930 Internet Protocols

  19. Initializing adapters • net_init()/net_probe() • netcard_probe(dev) • netcard_probe1(dev, ioaddr) • Helper functions to allocate system resources • Request_region(), release_region(), check_region() • Request_irq(), free_irq() • Request_dma(), free_dma() FSU CIS 5930 Internet Protocols

  20. Opening/closing adapters • net_open(dev) • net_stop(dev) FSU CIS 5930 Internet Protocols

  21. dev.c netif_rx driver.c net_error net_tx net_rx Completing A transmission process Receiving a packet Errow situation net_interrupt Transmitting data • net_send_packet(skb, dev) • net_interrupt(irq, dev_id, regs) • net_tx(dev) • net_rx(dev) FSU CIS 5930 Internet Protocols

  22. About the project • Progress, problems encountered FSU CIS 5930 Internet Protocols

More Related