For OHCI another way to solve the done_list bus_to_virt isssue:Hi Dave,struct td {
...
struct td *dma_hash; /* grows size 64 -> 68/72 */
dma_addr_t dma_addr; /* ... 72 */
};#define TD_HASH_SIZE 53 /* prime */
struct ohci {
...
struct td *dma_hash [TD_HASH_SIZE];
};static inline td *dma_to_td (struct ohci *ohci, u32 dma)
{
struct td *td;
td = ohci->dma_hash[(dma>>SOME_SHIFT)%TD_HASH_SIZE];
while (td && td->dma_addr != dma) td = td->dma_hash;
return td;
}Hashes maintained in td_alloc and td_free. Seems familiar.
Brad, Steve -- that kind of thing? It'd be great to see a patch
along these lines. I think Roman's right: most systems won't
have many tds active at a time. Usually one td per urb.- Dave
Looks good to me. I like your use of chaining for the collision
cases, it's simplest
and no worries about re-hashing timeouts, clustering problems, etc.
Only question is
what should SOME_SHIFT be. I think a natural value would
correspond to the
TD alignment (ie. if 32-byte aligned, SOME_SHIFT=5).
-- Steve Longerbeam MontaVista Software, Inc. office:408-328-9008, fax:408-328-9204 http://www.mvista.com