LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   wrap copy in 8139too.c (https://www.linuxquestions.org/questions/programming-9/wrap-copy-in-8139too-c-844134/)

tkmsr 11-13-2010 10:14 PM

wrap copy in 8139too.c
 
I came across a function wrap_copy on http://lxr.free-electrons.com/source.../net/8139too.c
Can some one help to understand what it is doing.
What I interpret it is that some how the person is tying to copy
payload from DMA to sk buffer.Is this interpretation correct?
What exactly are we trying to achieve via wrap_copy function call?

neonsignal 11-14-2010 05:00 AM

The function is copying from a ring (circular) buffer into the skb buffer. Since the memcpy may go off the end of the ring buffer, the function sometimes has to break up the copy into two parts (wrapping back around to the beginning of the ring buffer for the rest of the data).

tkmsr 11-14-2010 07:01 AM

Hi, thanks for your reply

orgcandman 11-16-2010 09:58 AM

Also note - I don't see how that code will ever be called. The only valid _user_ configurable values are 0 and 2. RX_BUF_IDX of 3 is not defined anywhere.

neonsignal 11-16-2010 05:53 PM

Quote:

Originally Posted by orgcandman (Post 4160778)
Also note - I don't see how that code will ever be called.

True. It looks like this used to be handled by a configurable define called CONFIG_8139_RXBUF_IDX, which could take the values 0 to 3. I'm guessing that buffer sizes of 16k and 64k are no longer supported, and the comment in the file says that "Warning: 64K ring has hardware issues and may lock up."

It makes some sense to leave the code there in case the 64k buffer option is ever reinstated.


All times are GMT -5. The time now is 10:57 AM.