* Current code already updates last time packet was transmitted
* Driver should set watchdog\\_timeo and ndo\\_tx\\_timeout
+# Reception
+
+* Usually happens in an interrupt handler
+* Driver allocates skb: some drivers allocate it when setting up and arrange the
+ device to write into the buffers directly
+* Must set skb field protocol: easily done for ethernet drivers with
+ eth\\_type\\_trans
+* Finally, call netif\\_rx
+
+# NAPI
+
+* To allow more performance, NAPI introduces polling, avoiding too much
+ interrupts when load is high
+* Driver disables interrupts and enables polling in its interrupt handler
+ when RX happens
+* Network subsystem uses a softirq to do the polling
+* The driver poll function disables polling and reenabled interrupts when it's
+ done with its hardware queue
+
# NAPI
+* struct napi\\_struct
+* netif\\_napi\\_add(dev, napi, poll\\_func, weight)
+* napi\\_enable: called in open
+* napi\\_disable: called in stop - awaits completion
+* napi\\_schedule
+ - napi\\_schedule\\_prep
+ - \\_\\_napi\\_schedule
+* napi\\_complete: called in poll when all is done
+* Use netif\\_receive\\_skb instead of netif\\_rx
+
+# NAPI step by step
+
+* In the interrupt handler:
+ - Checks that the interrupt received is RX
+ - Call napi\\_schedule\\_prep to check that napi isn't already scheduled
+ - Disable RX
+ - Call \\_\\_napi\\_schedule
+
+# Weight and Budget
+
+* The weight is the start budget for the interface, usually 16
+* The poll function must not dequeue more frames than the budget
+* It must call napi\\_complete if and only if it has exhausted the hardware
+ queues with less than the budget
+* It must return the number of entries in the queue processed
+
# Changes in net device
* Use netdev\\_priv, no priv anymore