> So a diff like the one below seems like a good idea. However I'm not > very experienced with the OpenBSD kernel and I'm wondering what the > idiomatic way is to express the fact that we need to make sure that > neither the compiler nor an out-of-order CPU reorder the TX descriptor > writes either. Or do we just not worry about this?
Assuming I understand you question correctly, this can not be guaranteed and in fact it is unlikely to complete in order you expect. All newish DMA engines interleave DMA transfers. A driver for a piece of hardware that got bitten by that (because they assumed in order completion of a DMA) is ami(4). For the full horror story read the interrupt path code which does nothing but ensure that individual pieces are completed before it calls it an overall completion.