Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/ic



thorpej%shagadelic.org@localhost wrote:

> > I wonder which is more efficient way to copy received buffer,
> > allocating a new mbuf, or moving data toward 2 bytes in the
> > same mbuf, which is used in vge(4).
> 
> Maybe allocate a new mbuf, copy a "typical" amount of data (i.e.  
> Ethernet header + IPv4 header + TCP/IP header + typical TCP options)  
> into new mbuf (offset 2 bytes from beginning of mbuf), adjust the  
> received packet past the data copied into the new mbuf, prepend the  
> new mbuf onto the received packet.

Hmm.

Should some upper layer provide such function?

> Allocating mbufs is fairly cheap because of pool_cache.  A lot cheaper  
> than copying an entire packet (especially an overlapping copy like vge  
> uses!)

Well, but for now most of our drivers which pad ETHER_ALIGN on RX
manually allocate a new mbuf (with a cluster if needed) and copy
entire each packet by memcpy(9), don't they? ;-p
The vge(4)'s method looks a bit faster than that.
(though maybe I should have more precise benchmarks)
---
Izumi Tsutsui



Home | Main Index | Thread Index | Old Index