I'm looking at various network card drivers and have the following question.
I know that after the PCI card completes the frame reception via DMA, it
signals that condition with an interrupt. The interrupt service routine,
notices that and pushes the frame into the upper layers by calling
My question is: what happens that after DMA operation to given physical
page, performed by a network card, CPU does not have to invalidate its cache
for this particular page, and (as I se in various device drivers) sees the
right data (data actually written by network card). Since DMA is performed
by a different processor (card adapter), there must be some way of
invalidating (synchronizing) the cache for that page in the main CPU.
Otherwise, the main CPU could possibly use the stale contents of its cache
for that page, not affected by the DMA transfer.
I see three possibilities, but I don't know which is true:
a. network buffers (alloc_skb()) are in non-cached memory,
b. CPU invalidates the cache before accessing the frame,
c. CPU cache is automatically updated by hardware (so that its view is
Can someone explain it to me?