Introduction to multi-queue network cards and Linux to send packets through the network card source interpretation __linux

Source: Internet
Author: User

First, let's take a look at the diagram of a major multi-queue network card (E1000) with multi-core CPUs:


Non-multiple queues:

The Linux network card is represented by the structure body Net_device, one of which corresponds to a dispatch packet sending queue.

The entity of the packet is Sk_buff (SKB) in the kernel, in the form of:

Multiple queues:

A network adapter can have multiple queues

Next, look at how the TX engine Works (note: There are two nouns for sending and receiving packets, respectively, for TX,RX)


Explain:

function-dev_queue_xmit (): A buffer is queued for transmission to a network drive device.

With the function of the source code to explain the above diagram of the transmission process:

Step one: You can see that if the device supports queues, the data is wrapped into the device queue. Before and after the join operation, there is the process of locking and releasing the queue lock.

Step two: Qdisc the device (this object is the queuing rule for queues)

Qdisc (queuing rule) is a shorthand for queueingdiscipline, which is the basis for understanding flow control (traffic). Whenever the kernel needs to send packets through a network interface, it needs to join the packet in the queue according to the Qdisc (queuing rules) configured for the interface. The kernel then takes as many packets from the Qdisc as possible and hands them to the network adapter driver module. The simplest qdisc is PFIFO it does not do any processing to the incoming packets, and the packet takes the first in first out way through the queue. However, it saves packets that the network interface cannot handle for a while.

Step three: Reset the SKB queue mapping to 0


Step Four: TX lock->hard_start_xmit

Here, we don't seem to see the tx_lock, Hard_start_xmit functions, instead we see these in the queue-free device branch:

Definition of Dev_hard_start_xmit:

It is clear that we should look through the clouds to see some of the nature, again back to the branch of the device support queue (This is what we care about): Anyway, you should always have to send the function call it, is the following circled this:


Sure enough, this is a wrapper function:

Reference:

Http://www.landley.net/kdocs/ols/2007/ols2007v2-pages-305-310.pdf

Http://vger.kernel.org/~davem/davem_nyc09.pdf

Http://www.chineselinuxuniversity.net/kerneldocs/networking/API-dev-queue-xmit.html

http://apps.hi.baidu.com/share/detail/36206005

http://cache.baidu.com/c?m= 9d78d513d98017f419bc837f7d01d0120e55f0237b8bc7150ec3e54c84145d563164f4cd25351174c4b5777075d95e2cebe74703234460e99492ce0c9 Fac935b3295776a2d499141658243f4971532c157c304b2ff4ab7e9e732e4ff8f8cc2040d97061832daabc8015c41ca65ed4771a5fdc816424240b8fa 3013a4537d2c992742b750f997682858df&p=ce7ddc1187904eac59b5c4710e14d625&user=baidu&fm=sc&query= Qdisc%5frun+%d6%b4%d0%d0%b9%fd%b3%cc&qid=f6ae9cf00151dde4&p1=1

http://lwn.net/Articles/289137/

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.