From: Stuart M. <stu...@st...> - 2008-02-01 12:21:28
|
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. Stuart |