Linux wireless network technology: in-depth analysis of WLAN
Source: Internet
Author: User
Article title: Linux wireless network technology: in-depth analysis of WLAN. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Wireless technologies, such as WLAN (Wireless Local Area Network), Bluetooth, General Packet Radio Service, GSM (Global System for Mobile communications), and IrDa (Infrared Data ), provide services in different environments. Although WLAN supports higher speed and longer propagation distance than Bluetooth, it also requires more costs and consumes more power. Although GPRS is slower than Bluetooth and WLAN, it can be used in mobile technology. Despite their differences or other causes, devices with multiple wireless features can exploit them comprehensively. For example, based on the GPS module's positioning input, devices can transparently switch the GPRS network connection from the road to cheaper WLAN in Internet cafes. Mobile phones can communicate with heart rate monitors over Bluetooth, and when a patient's heart rate exceeds a certain limit, they can send alerts to doctors through GSM.
Currently, wireless technology has been widely used in the form of PCMCIA and Compact Flash (CF) cards, or used in USB devices. Most computer systems, including embedded devices, all have PCMCIA, CF, or USB interfaces, which can be used immediately even if built-in support for wireless technology is not included. This article analyzes some examples of wireless devices and studies the Linux implementation of device drivers, bus technology, and various protocols.
First, by tracking the code stream of the WLAN sample card, you will learn how the WLAN device works in Linux, then we can see how several Bluetooth devices connect to the Linux Bluetooth stack and other kernel layers. Next, you will learn how to make the GPRS and GSM devices work in Linux. At last, the article analyzes IrDa support on Linux and briefly introduces the performance of wireless network devices.
Note: the kernel data structure and file name involved in this article are used in the current Linux version. The file name is relative to the root of the Linux kernel source code tree.
Linux 802.11 WLAN The WLAN communication system is used in the same building as an alternative to a wired LAN. WLAN uses the ISM (Industrial, Scientific, and Medical) radio broadcast frequency band for communication. The WLAN 802.11a standard uses a 5 GHz band and supports a maximum speed of 54 Mbps. the 802.11b and 802.11g standard use a 2.4 GHz band, which supports a maximum speed of 11 Mbps and 54 Mbps respectively.
WLAN is similar to wired ethernet. they are all allocated MAC (Media Access Control) addresses from the same address pool, and all appear on the network device layer of the operating system as Ethernet devices. For example, the Address Resolution Protocol table is filled with wlan mac addresses and Ethernet MAC addresses.
However, WLAN differs greatly from wired Ethernet in the link layer. For example, the 802.11 standard uses conflict detection (CSMA/CA) instead of wired Ethernet (CSMA/CD ). Moreover, unlike Ethernet frames, WLAN frames are confirmed.
Due to the fuzzy border between WLAN workstations, the WLAN link layer has a protocol to clear a region before transfer. For security considerations, WLAN's Wired Equivalent Privacy (WEP) encryption mechanism provides the same security level as Wired networks. WEP combines a 40-bit or 104-bit key with a random 24-bit initial vector to encrypt and decrypt data. WLAN supports two communication modes: Ad Hoc mode is used for short-term communication between workstations in small groups without access points, while all communication in Infrastructure mode must pass through access points. An access point periodically broadcasts a Service Set Identifier (SSID). The SSID is used to distinguish a WLAN network from other networks.
Most available WLAN cards are based on the Intersil Prism or Lucent Hermes chipset. The Compaq, Nokia, Linksys, and D-Link cards use the Prism chipset, while the Lucent Orinoco card and Apple Airport use the Hermes chipset.
Linux WLAN support Linux WLAN supports wlan api implementation and WLAN device drivers. I will study them in sequence.
There are two Linux projects that define common WLAN APIs and provide tools for user space applications to configure parameters and access information from WLAN device drivers. The Wireless Extensions project provides public Linux User space interfaces for different Wireless network adapters. Tools for this project include iwconfig used to configure parameters (such as the WEP keyword and SSID in the WLAN driver ). As part of the Wireless Extensions project, the linux-wlan project also supports a series of tools used to interact with the driver of the WLAN device from the user space. Unlike tools based on Wireless Extensions, these tools use a syntax similar to SNMP (Simple Network Management Protocol) MIB (Management Information Base) that reflects IEEE 802.11 specifications.
Continue to discuss device drivers. Linux Device Drivers that support popular WLAN cards include:
Orinoco WLAN driver: it is part of the Linux kernel source code and supports Hermes-based cards and Intersil-based Prism cards. The orinoco_cs module provides the PCMCIA card service support required for the PCMCIA and CF cards.
Linux-wlan project linux-wlan-ng driver: supports a variety of Prism-based chipset cards. This driver supports the linux-wlan API and partially supports Wireless Extensions.
Host AP device driver: Supports the AP mode of the Prism chipset to enable the WLAN Host to act as an access point.
Linux Symbol Spectrum device driver: Supports the Symbol PCMCIA card. Unlike the PCMCIA card, the Symbol CF card lacks onboard firmware, which relies on the device driver to download the firmware. A separate version of the driver applies to the CF card. Intel repacks the Symbol PCMCIA card into an Intel PRO/Wireless card, while Socket communication repacks the Symbol CF card.
Atmel usb wlan driver: the Atmel chipset supports many usb wlan Devices.
Intersil Prism2 wlan cf card I will discuss Intersil Prism2 802.11b WLAN CF card to show how it works with Linux PCMCIA, network devices, and protocol layers.
Linux PCMCIA/CF layer device drivers controlled by PCMCIA host, client drivers for different cards, user pattern programs, background processes that help hot unplug and interact with and for them the kernel card service hub that provides services. The PCMCIA controller connects the card to the system bus, maps the card memory to the host I/O and memory windows, and routes the card interruption to the free processor. The CF card is small but compatible with PCMCIA and is often used in handheld devices. The PCMCIA/CF card has two storage spaces: attribute memory and common memory ). The property memory is similar to Card Information Structure (CIS) and used to save configuration registration and descriptor Information. The Linux card service core interacts with host controller device drivers, card device drivers, and user-mode cardmgr background processes. It calls the event handler routine of the card driver when some events (such as card insertion, card removal, and low power) occur. Although the card service transfers information from the card's CIS to cardmgr, cardmgr will allocate the memory window and interrupt level in the user space (/etc/pcmcia/config. opts. View drivers/pcmcia/ds. c to learn about the kernel code used to interact with cardmgr, and view/etc/pcmcia/config. opts to learn about the user space resource allocation policy.
When an Intersil wlan cf card is inserted, the card service calls the PCMCIA event handler of the orinoco_cs module. The CIS tuples (tuples) in the memory of the resolution card attribute of the card service and the information is transferred up to cardmgr, which will be in the/etc/pcmcia/config file (see listing 1) load the appropriate device driver. Because the manfid tuples in the card's CIS match entries in/etc/pcmcia/config, cardmgr binds a card with the orinoco_cs driver. The device entry in listing 1 specifies that the orinoco_cs driver consists of three kernel modules: orinoco, orinoco_cs, and hermes. In addition, because the device is wireless, cardmgr executes the script/etc/wireless when the device is started and stopped. This script uses WLAN tools and utilities to configure device driver parameters, such as the WEP keyword and SSID. It can also start network protocols on WLAN, such as DHCP (Dynamic Host Configuration Protocol, Dynamic Host Configuration communication Protocol ). The example in listing 1 uses the Wireless Extensions tool to perform device configuration.
Note: The exact location of the PCMCIA configuration file depends on the Linux distribution used.
Listing 1. PCMCIA device entry for the Intersil wlan cf card
Use the/etc/pcmcia/wireless and/etc/pcmcia/wireless. opts scripts to configure parameters such as the WEP keyword and SSID.
List 2. configure WLAN-specific parameters
Iwconfig ethX essid Key AAAA-AAAA-AA [1] key BBBB-BBBB-BB [2] key CCCC-CCCC-CC [3] key DDDD-DDDD-DD [4]: Set 64-bit WEP Keys and ESSID in the driver iwconfig ethX: Display WLAN parameters iwpriv: get nongeneric, driver-specific parameters iwlist: List Information and statistics from an interface iwspy: Read quality of link for a set of addresses/proc/net/wireless: Wireless Statistics from the device driver
When inserting a card, orinoco_cs calls register_netdev like a traditional network device driver to obtain the ethX network interface name allocated to the WLAN interface. It also registers the address of an interrupt service routine to interrupt the service when it sends and receives wireless data. The interrupt handler is part of the orinoco module and interacts with the Linux network stack. The main data structure used by the Linux network stack is the sk_buff structure (defined in include/linux/skbuff. h. This file includes control information about a memory block attached to it ). Sk_buffs provides effective buffer processing and stream control mechanisms for all network layers. The network device driver executes a dev_alloc_skb and a skb_put to fill in a sk_buff with IP data, and then sends the sk_buff to the TCP/IP stack by calling netif_rx. The orinoco interrupt service routine fills sk_buffs with the data received from the WLAN and transmits it to the IP stack through netif_rx.
For Linux TCP/IP applications, you can use the network interface provided by the kernel module for the Intersil wlan cf card.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service