tech-net archive

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

Re: NetBSD 5.1 TCP performance issue (lots of ACK)

On Fri, Oct 28, 2011 at 04:10:36PM +0200, Manuel Bouyer wrote:
> Here is an updated patch. The key point to avoid the receive errors is
> to do another BUS_DMASYNC after reading wrx_status, before reading the
> other values to avoid reading e.g. len before status gets updated.
> The errors were because of 0-len receive descriptors.

I'm not entirely clear where the mis-ordering happens. I presume the
fields a volatile so gcc won't re-order them. Which seems to imply
that the only problem can be the adapter writing the fields in the
wrong order (unless the data is cached and spans cache lines).
In that case the BUS_DMASYNC is also acting as a delay.

I'm also not entirely certain it is a good idea to use le16toh()
on a volatile data item!
>               len = le16toh(sc->sc_rxdescs[i].wrx_len);

Much better would be:
>               len = sc->sc_rxdescs[i].wrx_len;
>               len = le16toh(len);


David Laight:

Home | Main Index | Thread Index | Old Index