Packet reception
When a packet arrives at the network interface card, the driver must build a new socket buffer around it and copy the packet into the sk_buff->data field. The kind of copy does not really matter, and DMA can be used too. The driver is generally aware of new data arriving by means of interrupts. When the NIC receives a packet, it raises an interrupt, which will be handled by the driver, which has to check the interrupt status register of the device and check the real reason why the interrupt was raised (it could be RX ok, RX error, and so on). Bit(s) that correspond to the event that raised the interrupt will be set in the status register.
The tricky part will be allocating and building the socket buffer. But, fortunately, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access