April 24, 2008

Rt2x00 project for wireless nearing success

Author: Bruce Byfield

If you use wireless networking in GNU/Linux with native drivers, then chances are that you benefit from work done by the Rt2x00 project. You may use the MadWifi Atheros drivers with OpenHal, or drivers for the Realtek RTL8180 chipset, but most likely you use one of the drivers developed by the Rt2x00 for Ralink chipsets. In the nearly four years since the project began, its work has moved from having a reputation for bugginess to the point where some of its drivers are now part of the latest Linux kernels. Recently, Linux.com talked to three of the lead developers on the project about where Rt2x00 has been and where it is going.

The project exists because of Ralink's decision in 2004 to release its Linux drivers for the Rt2400 chipset rather than maintain them itself. According to Rt2x00 project leader Mark Wallis, "After ongoing hassles trying to keep up with new kernels and distributions, [Ralink] decided to instead release the source -- but they didn't attach a license." Wallis's employer, Australian Wi-Fi hardware distributor Minitar, "contacted Ralink and informed them that they needed to attach a license to the code, and suggested the GPL license as the most appropriate. After lots of back-and-forth between the Linux product lead at Ralink and myself and the managers at Ralink, we were able to get a GPL license attached to the code," Wallis recalls.

The Rt2400 driver was released in April 2004, and Wallis began a project using it as a base. As Ralink released other drivers over the next two years, the project added them to its work.

But "by that time we also had discovered that maintaining the old drivers would be a lot of work, and the driver itself would never be acceptable for the Linux kernel," says Ivo van Doorn, the main developer for the project. "Because of that, we started to rewrite the driver from scratch, using the original code as reference material only." The new version was called the Rt2x00 driver, and it quickly became the new name for the project.

Since then, Ralink has continued to release its Linux drivers -- at first, about six months after the release of the proprietary drivers for other platforms, but, more recently, at the same time. According to Luis Correia, the project administrator, "Ralink acknowledges our project, but does not participate directly. They supply us (and also BSD) the preliminary datasheet for [each chipset], but that doesn't really help, since we often find much more accurate information in their driver source code." At times, too, says van Doorn, the project sometimes asks Ralink "some minor questions regarding licensing" from time to time.

Minitar, the company that pushed for the first code release, is no longer actively involved in developing the drivers.

The project today

The Rt2x00 project now supplies free software drivers for the Ralink Rt2400, Rt2500, and Rt2570 chipsets. In addition, the project develops drivers for the Rt61, Rt73, Rt2860, and Rt2870 chipsets that are free in themselves, but dependent on non-free but distributable firmware. The license for the proprietary firmware is available on the project site.

"It is very likely that future chipsets will also contain firmware," van Doorn predicts. However, he has no intention of reverse-engineering the firmware to provide a free version of it. "One of the things I like about the Ralink hardware is that almost everything that really matters is handled in software. Only the things that are very timing-specific are handled in the hardware/firmware. I am not encouraging reverse engineering, and I see no point in doing this for the Ralink firmware, since the most interesting features for the hardware can simply be implemented in the driver software itself."

Correia shares this opinion, adding, "I have no interest to have this firmware open in any form, as long as it continues to work well."

Instead, the project has two main areas of development. The first, which occupies most of the project's energies, is the maintenance of the legacy drivers for both the 2.6 and 2.4 kernel series. Van Doorn defines the legacy work as involving "all drivers released by Ralink with many bug fixes provided by us." The legacy drivers support neither HostAP nor wpa-supplicant, nor as they likely to, since "all development is focused on bug fixes" for them, according to van Doorn.

However, even these bug fixes are only in the project's own code. "Instead of backporting our fixes," Correia says, Ralink "completely ignores them. The proof is, new drivers still come out with the same bugs, over and over again. We would gladly accept their code, but they seem to ignore us."

The second area of development is the Rt2x00 driver, the rewritten driver created by the project. This driver benefits from the work done on the legacy driver, but also contains a full feature set. "It already contains several features which are simply not possible with the legacy drivers -- for instance, virtual interfaces and master mode," says van Doorn. "Rt2x00 is closely related to Mac80211, which provides most of the capabilities to Rt2x00 to support all those exciting new features."

Despite this potential, van Doorn says, "At the moment the reality is that the legacy driver still outperforms Rt2x00 in reliability and data throughput on x86 and x86_64 platforms."

Being added to the kernel

Another recent development that the project is dealing with is the inclusion of its drivers in the Linux kernel since version 2.6.24, which was released in January. "All of these drivers depend on the kernel config option CONFIG_EXPERIMENTAL to indicate that they are not ready for production systems yet," van Doorn says. The project Web site describes them concisely as "somewhat buggy," but van Doorn says, "We are actively working on improving the drivers and hope that we can remove the remark very soon."

One of the difficulties in dealing with kernel drivers, van Doorn finds, is that, while more people are using and reporting on them, tracking problems through different distros remains difficult. "A 2.6.24 kernel in distribution X may contain a different Rt2x00 version than the one in distribution Y, because some distributions use the Rt2x00 versions which came with the kernel, while other package more updated versions."

Under these circumstances, the project's first concern is to stabilize the drivers. Once that milestone is achieved, van Doorn hopes to move on to adding new features. Currently, he says, "one of the important features under development is the hardware encryption support for the Rt61pci and Rt73usb drivers."

The project is also developing drivers for the Rt2800 chipset. "But they still requires a lot of work before they can be released," van Doorn says. He declines to speculate on when they will be released.

Nearing the end game

"The main goals for rewriting the legacy drivers into Rt2x00 was to create a better code base to work on," van Doorn says. With the versions now in the kernel, he considers this goal largely achieved.

"Rt2x00 contains a big library which translates all calls from Mac80211 into something all Ralink hardware understands. This makes maintenance of the drivers much easier, since fixing a bug in the Rt2x00 library immediately fixes the bug for all Rt2x00 drivers. It also makes development of new drivers easier since less work is required to hook the new driver into that library.

"For example, the Rt2800, which I am currently porting to Rt2x00, is relatively easy to do, since all I have to do is copy register initializations. 75% of the legacy driver code can simply be ignored because the Rt2x00 library and Mac80211 already cover that area. The speed of the Rt2800 development is more limited by the available time I can spend on it than the difficulty level."

Van Doorn describes the project's goal as enabling a device that "works out of the box. The driver should be rock-solid, have excellent data throughput, and not consume more memory than strictly needed. For advanced users, it should be possible to create multiple virtual interfaces and put them all in master mode for software access point and create an extra virtual interface for monitor mode just to show off to users of other operating systems.

"Linux support for Ralink hardware has had a bad reputation for a long time," van Doorn acknowledges, but he adds that "This has already been improving over the past year. We are on the right track, and hopefully it won't take that long before we can push Rt2x00 past the final obstacles."


  • Desktop Hardware
  • Networking
  • Programming
Click Here!