From: Ha N. <han...@gm...> - 2008-02-01 15:40:07
|
On Feb 1, 2008 1:21 PM, Stuart MENEFY <stu...@st...> wrote: > Folks > > Giuseppe Cavallaro wrote: > >> I have to read UDP packets from sk_buff to my module in kernel space and > >> the udp stack uses copy_to_user() to do my task. I'm wondering if using > >> dma for mem-to-mem copy can improve data transfer performance instead of > >> using copy_to_user()??? > > > > Often to take the best performance by using a DMA engine, e.g. in a network > > driver, > > the zero-copy mechanism is used because It essentially avoids memcpy. > > Abut how to implement the zero-copy mechanism you ought to start looking at > > the network device > > drivers within the kernel source tree. > > Note that there are generally two 'copies' involved in receiving data. > The first is where the data is written into the network stack's packet > buffer, the second is where the data is copied into the user's buffer. > (This is ignoring the checksum step, which ideally is merged with one of > the other copies). > > Giuseppe is referring to removing the first, which involves the DMA engine > in the NIC writing the data directly into the sk_buff. Ha Nguyen was asking > about the second, which is very hard to remove while still retaining the > standard socket API. Exactly, I already configured the MAC for zero-copy. Based on Stuart's input, dmaengine should do my work when it is available. I'm curious to see if how it improves network performance... Thanks guys for your feedbacks! /ha |