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.
Linux Routing and switching Linux is born in the network, born to 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 I remember last year when I had a swap board that I could plug directly into the pci-e of the motherboard, when I had to use the vendor-specific driver and the VLAN technology to get it together. 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 messages end 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:
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:
Linux 4.0+ kernel support for hardware switching modules (HW switch Offload)