Monday, April 12, 2021

Reading the Fine Manual

Not directly related to finance but, an interesting dive into the history of the NE2000 network card and why Linux kernel devs hated it so much, complaining that people who used proprietary drivers had an easy time of it. The long and short of it seems to be, they were blaming the hardware but hadn't correctly read the documentation on how to program the hardware. For example:
For whatever reason, the Linux driver does not do things by the book, and there is a book. The Linux driver acknowledges receive interrupts as the last thing it does, which is simply backwards. It is important to keep in mind that the driver code which reads received packets from the DP8390’s ring buffer inevitably races the chip which may be receiving new packets at the same time. For that reason, it is necessary to acknowledge (clear) interrupts first, and then remove all received packets. The hardware works in the opposite order and first updates all of its state and writes to memory, and then raises an interrupt. That way, there could be a spurious interrupt for an already-processed packet but nothing will be missed.
The lesson is, if someone makes something and tells you how to use it, feel free to disregard that advice, but at least read and understand what they tell you first. Otherwise you risk breaking something you don't understand. Not that this would ever happen in finance . . . right . . .