简体   繁体   中英

From the kernel to the user space (DMA)

Lately, I have been reading a lot of websites,and books about 10gb/s NICs, their DMA and the way data are handled by the linux kernel (10/100 mb/s NICs) and a few questions came to my mind.

What would be the easiest way to send a 10GB/s flow of data from the NIC to the user-land (I assume being able to process the data in the user-land at the same rate).

And

Do you think it would be a good idea to implement the DMA buffer inside the user-space to read the raw data directly from there (and process them obviously at the same rate)

or is their any better solutions I didn't think of :/

Thank you.

The easiest thing it to use Linux's normal sockets. It might not be the most efficient, but it's easiest.

There are frameworks, which allow very efficiently to receive and transmit data in user space. They map the same buffers to the NIC (DMA) and the process, so data doesn't need to be copied.
These frameworks bypass the kernel completely - you have to interact with the NICs directly. Such frameworks are, for example, PF-RING and Netmap

我还建议看看PFQ框架( https://github.com/pfq/PFQhttp://netgroup.iet.unipi.it/software/pfq/ ),它构建于netmap之上, pf_ring概念并隐藏它们以允许在用户空间中进行简单的多核数据包处理。

I remember hearing a talk by some folks from Intel in Ottawa Linux Symposium that implemented exactly what you proposed. When they measured the results vs. the normal socket interface they were surprised to discover that for many work loads this approach did not perform any better and sometime worse(!) then the socket interface.

I searched but could not locate the exact paper online right now, but maybe this gives you a hint...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM