Linux NAPI and Solaris GLDv3

Source: Internet
Author: User
Linux NAPI and Solaris GLDv3-general Linux technology-Linux programming and kernel information. For details, refer to the following section. 1. NAPI (New API) is a kind of modification to the device driver Package Processing Framework of the Linux kernel. It improves the performance of high-speed networks through the following two aspects.

1. reduce interruptions

High-speed networks can cause thousands of interruptions per second. Each interruption tells the kernel that many packets need to be processed. NAPI allows the driver to run without interruption to reduce system load.

2. Discard the package as soon as possible

The system must discard packets that are too late to process. However, we should try to spend less time processing these items before dropping them. NAPI-compatible drivers can discard unhandled packets at the network adaptation layer, and the kernel cannot see them at all.

NAPI is first integrated into the 2.5/2.6 kernel, but has also been transplanted to the 2.4 kernel. Note that NAPI is completely optional, and the driver can work well without it, but it may be slower. Drivers written in the previous 2.4 kernel can still work in the new kernel.

NAPI Driver Design:

When a new package arrives and there is an interruption, the driver should disable any "new package arrival" interruption and allow the network subsystem to polling to obtain as many packets as possible. Use the following interface to round-robin the driver:

Void netif_rx_schedule (struct net_device * dev );

The next step is to create the poll () method. Its function is to pass the packet obtained from the NIC to the kernel. The prototype is as follows:

Int (* poll) (struct net_device * dev, int * budget );

The number of packages available for poll is limited by budget. Linux sets it to 300 in net/core/dev. c. The resulting package should not be handled by the old interface netif_rx (). The new interface should be used:

Int netif_receive_skb (struct sk_buff * skb );

When all packages are processed, the following interface is used to enable interruption and disable polling:

Void netif_rx_complete (struct net_device * dev );

2. In the Solaris 8 and Solaris 9 multi-processor systems, the speed of the processor lags behind that of the Gigabit Nic. Solaris introduced a thread model called a worker to ease the situation where a CPU is busy handling interruptions while other CPUs have nothing to do. That is, one or more worker threads distribute jobs to multiple CPUs, rather than simply the interrupted CPU to process all the packets. However, the device driver does not know how many worker threads should be created. It is more complicated to have multiple Enis active in the system. When a 10g Nic appears, when the size of the Ethernet package is still 1500 bytes, the problem is even worse. The system can get 80000 packets per second, leaving only 12 microseconds for the CPU to process them.

Therefore, Solaris 10 introduced a new framework, GLDv3 (General LAN Driver version 3 ). The idea is the same as that of NAPI, except that Solaris is better at multi-processing systems.

Iii. At present, I still do not know whether it is GLDv3 first introduced by Solaris, NAPI first introduced by Linux, or at the same time. However, it is certain that the slab Memory Allocation Algorithm of Linux and the modular idea are all based on Solaris. But Linux started with a UNIX clone. But we also see that Solaris has transplanted a large number of Linux applications, including desktop systems, gcc compilers, games, audio and video software, and so on. Although the Linux Server shares far higher than Solaris, Oracle's preferred platform is still Solaris. I also believe that the top 500 companies in the world will not hesitate to choose Linux + MySQL + php; although Solaris has transplanted a large number of Linux applications, it is not realistic to compile the latest source code directly. Therefore, I think that all things are reasonable and there is no need to be honest with each other. What is important is to make a proper choice.
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.