links: https://email@example.com https://firstname.lastname@example.org https://email@example.com
pci_register_driver(&e100_driver) alloc_etherdev() // alloc dev memory register_netdev()
- netif_rx_schedule -> napi_schedule -> netif_recive_skb
- dev_queue_xmit -> qdisc_run -> hard_start_xmit
Diff NAPI/Net Poll
- NAPI: stop interrupt and start poll mode, increase performance for device which will receive huge of packages per seconds.
- Netpoll: let kernel send package with unintact network, e.g. netconsole
- spin lock: used for multi processors, and can only be hold by one kernel task, incase multi processor visit critical Section. should only be uses with little time. Not allowed sleep, can be used in interrupt context
- mutex: sleep lock, can only be used in Process Context, could not be used in interrupt context.
- RCU(Read-Copy Update): read much and write little, like route query
- First 1M physical memory store BIOS info, linux start from 1M
- Page: 4K/per page
- X86_64: 0-3G user space, 3-4G kernel space
- kernel space: 0-896M, lower memory, > 896M, High memory
- the last 128K for page mapping
- malloc: for user space
- kmalloc: for kernel, but with consecutive memory, fast
- vmalloc: for kernel, but may not onsecutive, slow
block, char device
- char device only be called like stream.
- block device can be read from anyware.
show driver print info, module info, and interrupt info
- dmesg, lsmod, cat /proc/interrupt
- check whether user space pointer is valid
- incase of do_page_fault
register char device
- mknod to create a device under /dev
- DMA: no need cpu, copy date from kernel to device directly
- interrupt: need cpu, when have IRQ, cpu stop current job and deal with IRQ
Author Hangbin Liu
LastMod 2018-12-13 (1672b97)