Everything you wanted to know about testing Wi-Fi adapters, but were afraid to ask

    image

    The other day our company turns 20 years old. The last 15 years of these 20 we have been making programs for analyzing Wi-Fi networks. Part of this work is the development of drivers for Wi-Fi adapters, and in this article I will describe how the development team tests the products of their work, and how the testing process has evolved over these 15 years with the evolution of standards and adapters. There will be a lot of pictures (what is called “geek porn”) and technical details.

    Why write special drivers at all?

    When you make software for analyzing Wi-Fi networks (and we are making a program for inspecting and modeling networks and a Wi-Fi packet analyzer), you need to somehow receive (read, capture, sniff, catch ... - all these are synonyms) packages Wi-Fi shared between nearby access points and customers. You can do this under Windows only by creating a set of your own drivers for certain chipsets.

    What is wrong with the usual standard drivers that the adapter manufacturer does? From the point of view of the average user, everything is fine with them. There is only a small problem - you cannot use it to read Wi-Fi packets in the passive observer mode. And without this you can not create software for network analysis. In general, this is a big topic for a separate article (and I will write it this year). If you are interested right now, then I will tell you briefly in the next paragraph, and if the topic of programming is not close to you, just skip it.

    Ten years ago, a new API for passive reading of Wi-Fi packets, the so-called monitor mode, appeared under Windows. It was always possible to "sniff" packets on Windows, and nobody prevents you from running Wireshark and seeing the packets going through your wireless adapter, but the problem is that you will only see your packets and only the data packets. All other information (foreign packets, Beacon-type packets, information on the signal level in the packet and its data rate, etc.) is not available. The new API was designed to resolve this issue once and for all. But I did not decide: almost no chipset of the main vendors supports it normally, and the API itself is outdated at the time of birth and Microsoft does not develop. In short, with him a complete disaster. And if you stumble upon a software for analyzing Wi-Fi networks under Windows, whose vendors claim

    Writing special drivers for monitoring Wi-Fi is difficult, time consuming and expensive. The number of companies that do this can be calculated using the fingers of one hand.

    Why Test Adapter Driver

    Bundle A driver is a hardware-specific program for interacting with hardware. During the driver development process, the programmer must make sure that the driver correctly catches the packets, switches the frequency channels and ranges, reacts correctly to the hibernate system, correctly calculates the signal levels, and does a lot of things without which it is impossible to analyze the Wi-Fi network.

    It would seem that this is a fairly clear and simple task: you plug the adapter into the computer, and then develop and test your driver as much as you want. In reality, there are a lot of nuances, which we will tell about.

    What should be a platform for testing?

    To technologically test drivers, you need a certain test bed, that is, a platform for working with a variety of hardware, which must meet several requirements:

    • Simply disconnect one and connect another adapter.
    • Ability to connect to modern computer interfaces.
    • Low noise from electronic components.
    • Mobility. During testing, you need to be able to move the Wi-Fi adapter, changing the orientation of its antennas in space and changing the distance to the access point (otherwise you will not be able to calibrate the signal level normally).
    • Ability to connect multiple adapters simultaneously (for USB).

    In addition, it is extremely useful to see how the standard driver works, i.e. see the communication of the adapter driver with the computer at the bus level, but we will leave this topic aside for now.

    Archeology and modernity

    Now it's time to talk directly about iron. Recall the past, sometimes very ancient, and discuss the new.

    2003

    We started doing software for Wi-Fi in 2003 (before that, we only made software for wired networks). The beginning of the zero was the time when Wi-Fi was just beginning its journey. The first of the family of standards, 802.11, was adopted in 1997. It was followed by 802.11b and 802.11a in 1999, but the technology went much later. Most laptops were sold without built-in Wi-Fi, but you could buy adapters for them: external, connected to the CardBus (PCMCIA) port for laptops, or internal PCI ones. A small proportion of high-end notebooks were also sold with built-in miniPCI adapters.

    Our first step was to support 802.11b CardBus adapters. Those were blessed times: almost all of these adapters were on the Intersil Prism chipset, the driver’s source code was available free of charge for everyone after signing the NDA, and the maximum data transfer rate at the physical level was 11 Mbps, i.e. it was really possible to transfer data at a speed of no more than 1 megabyte per second under ideal conditions.


    CardBus Wi-Fi adapter with external antennas

    CardBus Wi-Fi adapter with external antennas

    It must be said that the adapters worked well, had good sensitivity, especially if it was possible to connect external antennas. With the platform for testing, everything was also very simple and uncontested: almost all laptops had one or two CardBus ports.

    Vintage laptop with PCMCIA ports
    Do you still remember these mammoths of 3-4 kilograms?

    All we had to do was insert the adapter into such an external port.

    CardBus adapter and the corresponding slot of the ancient machine
    The CardBus adapter and the corresponding slot of the ancient machine of

    2007.

    A much more elegant ExpressCard standard on the PCI Express bus comes to replace the far from miniature CardBus adapters. There are 34mm Wi-Fi ExpressCard adapters on the market, with 802.11g and 802.11a already. Speeds grow, new modulation schemes are applied.

    ExpressCard Wi-Fi Adapters
    Wi-Fi adapters ExpressCard

    ExpressCard, like CardBus, is quite convenient for testing. Cards are easy to change, laptops are mobile, there is no shortage of models with ExpressCard ports on the market.

    Desktops do not stand still either, in 2007 the standard PCI Express 2.0 was adopted, so PCIe adapters with external antennas often appear inside desktops. It’s not so convenient to test them (remove the case cover, replace the PCIe adapter, put everything back in place).

    2010

    We are starting to support Wi-Fi USB 2.0 adapters. This is a very convenient form factor for testing and for use by end users. All you need is a USB port, or several ports if you use multiple adapters.

    The legendary Proxim ORiNOCO 8494 adapter of the 802.11n standard, based on the Atheros Communications chipset, not yet absorbed by Qualcomm, is entering the arena. This adapter was used by all professional programs for the Wi-Fi site surveys. He has excellent sensitivity.

    Legendary USB-adapter Proxim ORiNOCO 8494
    The legendary USB-adapter Proxim ORiNOCO 8494 The

    ability to connect several adapters at once is a big plus, it speeds up channel scanning time when it comes to site survey programs, and allows, for example, analyzing customer behavior when roaming when it comes to packet analyzers.

    However, you should not forget that a typical Wi-Fi USB adapter consumes 200 to 300 mA, and if you use a passive USB hub by plugging three adapters into it, you can easily go beyond the limit for USB 2.0 500 mA .

    PortaPow meter to determine the current consumed by the adapter
    PortaPow meter to determine the current consumed by the adapter

    There is practically no radio frequency interference from USB 2.0 hubs, and besides the issue of current consumption, the only thing you need to take care of is the location of the ports on the hub. Ports should be located so that adapters can be inserted into neighboring ports at the same time (if the ports are too close, you just won't be able to insert adapters).

    The next problem in 2010 was the emergence of MiniPCIe adapters, which replaced the MiniPCI in laptops. We started by disassembling laptops to test the new adapter. What kind of pain it was - you probably don’t need to tell. Replacing the adapter in a laptop is a slow and tedious process, and you can stumble upon a lot of pitfalls. First, if there was an adapter with two antennas in the “native” laptop adapter, and we wanted to test a model with three antennas, there was no normal solution. Secondly, some manufacturers of laptops are engaged in outright sabotage, hard flashing in the BIOS those models of adapters that the laptop supports. And if the new adapter does not fit into such a white list, then it is simply not recognized. Thirdly, you may just be unlucky, and you will break something inside.

    At some point, we had to use desktops with a PCIe <-> MiniPCIe adapter card. But the decision was not perfect: the mobility of the device is still important. The ideal solution was found by Taiwanese guys from Bplus Technology , who, among a large assortment of very interesting debugging solutions, offered just such an excellent board:

    Test Board with MiniPCIe Connector
    A test board with a MiniPCIe connector, connected via an ExpressCard adapter

    This board was just a salvation for many years. Test bed turned out great: adapters can be changed in two accounts, mobility is preserved, there is no interference, and the board itself is quite inexpensive. All you need is a laptop with an ExpressCard slot, but in those years it was not a problem.

    Fee in the connected state
    The board is connected, the ExpressCard adapter is inserted into the laptop.

    2013

    By 2013, Wi-Fi has completely conquered the world. All laptops are equipped with integrated integrated Wi-Fi modules, and these modules, in the wake of universal miniaturization, are beginning to be released in a new form factor, M.2 (aka NGFF). M.2 cards are smaller than usual MiniPCIe and have a different connector.

    Board with MiniPCIe connector, MiniPCIe module, M.2 module
    MiniPCIe connector board, MiniPCIe module, M.2 module

    I really want to continue using our beautiful test suite, and Bplus Technologies comes to the rescue again. They release the MiniPCIe <-> M.2 adapter, and we easily make such a thick sandwich:

    “Sandwich” from MiniPCIe board, MiniPCIe <-> M.2 adapter, M.2 Wi-Fi adapter and omni-antennas connected to it
    “Sandwich” from the MiniPCIe board, MiniPCIe <-> M.2 adapter, M.2 Wi-Fi adapter and omni- connected to it antennas

    There are almost no laptops with ExpressCards on the market, but we have a stock of such old machines, although it is already clear that we will soon have to find a new solution. But more about that below.

    2014

    In December 2013, the 802.11ac standard was ratified, and in 2014, many 802.11ac adapters appeared on the market, with USB 3.0 already. Why USB 3.0 adapters? Because the speed of the bus 2.0 is not enough. Three-stream (3 spatial streams) 802.11n adapters could provide a maximum speed of 450 Mbps at the physical level, but 802.11ac adapters can already produce 867 Mbps (two streams, 80 MHz channel width) or 1300 Mbps (three streams, 80 MHz channel width) and even in theory, 2340 Mbps (three streams, channel width 160 MHz, only there are none in nature).

    The only problem with USB 3.0 is that USB 3.0 devices (cables, connectors, circuitry) are capable of generating fairly powerful broadband radio frequency noise, which makes adapters much less sensitive as the signal-to-noise ratio decreases. In the absence of good shielding, this effect can be easily observed. The screenshot below was made using TamoGraph Site Survey and Wi-Spy spectrum analyzer. The screenshot shows a typical picture of the work of several networks in the 2.4 GHz band (amplitudes at the top and the so-called waterfall view below). It can be seen that the noise threshold is about –95 dBm.

    No interference from USB hub
    There is no interference from the USB hub.

    Now let's try to bring Wi-Spy closer to the hub or external USB 3.0 drive. The picture changes radically:

    Powerful interference from a USB hub
    Powerful interference from a USB hub

    Near the hub there is a very decent noise, approximately at the level of -77 dBm. If we consider that the minimum signal-to-noise ratio, at which Wi-Fi can still work somehow, is about 4 dB, then with such a picture, the adapter will not be able to connect to the network if the signal from the access point is below -73 dBm. To get around this problem, you should try different hubs or use additional USB cables that remove the adapter from RF noise sources.

    You ask, how do USB 3.0 adapters live under such interference? They live a very interesting life. Take, for example, adapters on the Realtek chipset: when the adapter is not associated, it works in USB 2.0 mode, scanning channels and finding nearby networks. When the adapter is connected to the network, a special Windows system service reinitializes the device, switching it to USB 3.0 mode. In this mode, the adapter remains until it dissociates, after which it returns to USB 2.0 mode again. These are the crazy dances.

    2018

    Time goes on, and if there are no new problems with testing USB adapters (USB Type-C connectors do not count, a kopek adapter solves the problem), then a crisis is brewing for MiniPCIe and M.2. It is becoming unbearable to continue living with an old bundle of “laptop with ExpressCard slot + MiniPCIe card with ExpressCard interface”. First, old laptops no longer pull Windows 10. Secondly, they can die at any time, leaving us at the bottom of the trough, since we don’t want to look for replacement laptops at the flea market at all.

    We must find a new solution. Mobile, it is desirable both under Windows and under macOS, with the modern interface for connection. Naturally, with the possibility of Direct Memory Access (DMA). The simplest thing is to insert a PCIe <-> MiniPCIe adapter card into the desktop, but then you need to put a cross on mobility. Carrying a desktop office is very good for health, but not very productive. In addition, we generally now move away from desktops in the direction of laptops and Intel NUC; desktops have largely lost their meaning in recent years.

    So what remains for us? Of course, not USB, because, alas, you cannot make a PCIe bridge <-> USB. Then Thunderbolt: it is in the new laptops and NUCs, and it should make the bridge PCIe <-> Thunderbolt possible. Good,

    We are looking for, looking for and finding the handsome: Startech Thunderbolt 3 PCIe Expansion Chassis . Naturally, its developers, even in the most violent fantasies, could not come up with the idea that someone would want to insert a Wi-Fi card into this chassis. The site, in fact, describes all those fantasies that have been visited by the developers: “At Thunderbolt 3 PCIe chassis”. You can add many types of PCI Express cards, such as a PCIe USB 3.1 / 3.0 / 2.0 and USB-C, SSD, network, eSATA, FireWire or video capture cards. ” Theoretically, Wi-Fi should take off. Almost ... well, you know how it is practically. If a component has even the slightest chance of not making money for any reason (driver, firmware, microcircuit), then it will not work.

    We wrote in support. The support, explicable, was completely unprepared for the Wi-Fi issue. They said they tried Ethernet adapters, but never Wi-Fi. Well, we will try for them. The package arrives quickly, and we just have to remove the external case and insert the PCIe-board with an adapter on M.2.

    image
    Startech TB31PCIEX16 internals

    Insert the Wi-Fi adapter into the adapter and screw it. Next, we connect the antenna to the board (through microscopic connectors, we cannot handle it without a magnifying glass), fasten the antennas to the PCIe-bracket to bring them out, and connect the entire unit to the power supply and the Thunderbolt port of the laptop.

    image
    Startech TB31PCIEX16 assembled

    And it earned. Not immediately, of course, such pieces of iron usually do not give up immediately. I had to first update the firmware of the Thunderbolt controller in the computer. But then everything went like clockwork.

    Future

    We are closely following the development of the industry. The next interface is on the way - M.2 CNVio, which is used, for example, in the most recent Intel 9560 adapters. The next Wi-Fi standard is 802.11ax. We will solve problems as they become available.

    Also popular now: