On Fri, 2007-11-09 at 19:55 +0800, Tang Rui wrote: > Dear Bernd, > Really thank you for your advice. > What makes me to have this thought is I want to improve the > performance of my software. Normally, I use user-space socket > interface to receive UPD/TCP packets. But for my project, in fact, > another device will process the payload of the packets, so I have to > send the data to kernel driver again. That means I have to do a lot data Of course. Serving static files over http is essentially the same and the kernel-space http-server was removed when user-space http servers were almost as fast as the kernel-space one. > transfer, such as from kernel to user-space, then from user-space to > kernel again. Learn about the splice() (and/or sendfile()) sys-call and use them in your user-space solution. That should at least avoid copying the data around. > If I can directly receive TCP/UDP packets from kernel space and > send them into my device. Does that mean I can save a lot of CPU time? If you win something, it's more the savings on system call overhead and possible context switches. > Of course, I'm not sure if such this crazy thing can help me, > maybe it is a very silly idea. It is not silly or crazy as such IMHO. It is (very) probably an interesting thing as a just-for-fun (or research) project or to get into kernel programming. However, I doubt that the gain in performance is tremendous compared to the additional implementation effort. However, if the additional implementation effort doesn't count .... As for the question "how to do it": I never did such a thing so I don't know. > In addition, I need to receive high bit rate data stream > [20Mbit/s] from ip port. So performance is really important for me. Is the user-space solution (read() from port, write() to device and/or vice versa) too slow? [ Fullquote killed ] Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ