Re: Kernel hooks just to get rid of copy_[to/from]_user() and syscall overhead?

From: Gianni Tedesco (gianni@ecsc.co.uk)
Date: Fri Jan 10 2003 - 10:31:06 EST


On Fri, 2003-01-10 at 14:45, Mihnea Balta wrote:
> Hi,
>
> I have to implement a system which grabs udp packets off a gigabit connection,
> take some basic action based on what they contain, repack their data with a
> custom protocol header and send them through a gigabit ethernet interface on
> broadcast.
>
> I know how to do this in userspace, but I need to know if doing everyting in
> the kernel would show a considerable speed improvement due to removing
> syscall and memory copy overhead. The system will be quite stressed, having
> to deal with around 15-20000 packets/second.

mmap() packet socket interface eliminates the need for system calls when
traffic is coming in at a high rate. The kernel -> user copy is also
eliminated, but its just replaced with a kernel -> kernel copy :P

You could perhaps also use linux socket filters to minimize the number
of packets you need to evaluate...

Check out this sample code: http://www.scaramanga.co.uk/code-fu/lincap.c

HTH

-- 
// Gianni Tedesco (gianni at scaramanga dot co dot uk)
lynx --source www.scaramanga.co.uk/gianni-at-ecsc.asc | gpg --import
8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jan 15 2003 - 22:00:33 EST