Linux 4.0+ kernel support for hardware switching modules (HW switch Offload)

Source: Internet
Author: User

The Linux kernel has recently leapt into the 4.x era, but it's not a big move at first, but the most exciting thing for me is its support for hard-switching modules. This is also the first step in preparing for full Sdn.

Routing and switching on Linux

Linux is born in the network, the network has a comprehensive and powerful support, even if the complex protocol, and then closed technology, almost all can find the corresponding Linux implementation. However, this is not to say that the Linux network is invincible, it has a lot of unreasonable places.
Linux has strong support for routing, in the data plane, you can easily implement a route lookup algorithm, in the control plane, you can also implement any existing or your own design of the routing protocol, however, all this is soft, that is, the CPU to complete.
When we know the difference between routing and switching, we will find that Linux has never really switched, at least not a reasonable solution at the general interface level. The bridge module of Linux? Forget it, it just implements a soft bridge, and the real switch is not.

Linux support for hardware switching

Remember last year, I once got a swap board, can be plugged directly on the motherboard pci-e, at that time must use the manufacturer-specific drivers and with VLAN technology to use them. In fact, many switches may use Linux as a management plane and control plane, and then configure their own custom hardware and custom drivers.
I have thought of a way to use netfilter technology to support the hardware switching module, but the CPU is still interrupted, the entire process is the CPU pull the packet to bridge or the IP layer, and then back to the hardware ... The correct way is not to interrupt the CPU at all, completely through the hardware to forward the packet, only the data and the local protocol stack related to the time of the CPU interrupt. And this idea means that you have to rewrite the drive.
In short, there is no unified interface, which means that if you want to design a switch board, there is no better standard to follow, even if you have to write or copy and paste a large number of driver code, which will seriously affect research and development efficiency.

Linux 4.0 Switchdev

All bad news ends up in the Linux 4.0 kernel.
Linux 4.0 introduces a Switchdev framework that represents the abstraction of a class of multi-port devices with "switching" capability chips. Each of these network ports is a port that is registered as a net_device in the Switchdev framework. In addition, the kernel comes with a rocker driver, demonstrating an actual device-driven implementation. The entire switchdev is as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/F6/wKiom1VYMJCS7LVWAAJX8N0ThsQ134.jpg "title=" Swtdev.jpg "alt=" Wkiom1vymjcs7lvwaajx8n0thsq134.jpg "/>
Note that in an idealized implementation, the OpenFlow controller can inject the flow table directly into the device, thus directing the device to exchange packets directly. The content of the flow table is super complex, not the goal of this article, but I believe the relevant document will appear in the later kernel version.
The Linux box with the hardware switch module is very different from the original, it is more like a high-end professional network equipment, similar to Cisco. It looks like the following:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6C/F6/wKiom1VYMIHjLFdjAAJbQPZpvpo359.jpg "title=" Swtoff.jpg "alt=" Wkiom1vymihjlfdjaajbqpzpvpo359.jpg "/>


Linux 4.0+ kernel support for hardware switching modules (HW switch Offload)

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.