This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
networking:kernel_flow [2020/09/13 16:14] foxhlchen replace outdated linux.no with more beautiful bootlin.com |
networking:kernel_flow [2022/10/15 00:37] q2ven [Layer 2: Link layer (e.g. Ethernet)] |
||
---|---|---|---|
Line 42: | Line 42: | ||
* sendmsg (a composite message to a socket) | * sendmsg (a composite message to a socket) | ||
- | All of these eventually end up in sock_sendmsg(), which does security_sock_sendmsg() to check permissions and then forwards the message to the next layer using the socket's sendmsg virtual method. | + | All of these eventually end up in %%__%%sock_sendmsg(), which does security_sock_sendmsg() to check permissions and then forwards the message to the next layer using the socket's sendmsg virtual method. |
===== Layer 4: Transport layer (TCP)===== | ===== Layer 4: Transport layer (TCP)===== | ||
Line 94: | Line 94: | ||
The network device pre-allocates a number of sk_buffs for reception. How many, is configured per device. Usually, the addresses to the data space in these sk_buffs are configured directly as DMA area for the device. The device interrupt handler takes the sk_buff and performs reception handling on it. Before NAPI, this was done using netif_rx(). In NAPI, it is done in two phases. | The network device pre-allocates a number of sk_buffs for reception. How many, is configured per device. Usually, the addresses to the data space in these sk_buffs are configured directly as DMA area for the device. The device interrupt handler takes the sk_buff and performs reception handling on it. Before NAPI, this was done using netif_rx(). In NAPI, it is done in two phases. | ||
- | - From the interrupt handler, the device driver just calls [[https://elixir.bootlin.com/linux/v2.6.20/source/include/linux/netdevice.h#L858|netif_rx_schedule()]] and returns from interrupt. netif_rx_schedule() adds the device to sofnet_data's poll_list and raises the NET_RX_SOFTIRQ software interrupt. | + | - From the interrupt handler, the device driver just calls [[https://elixir.bootlin.com/linux/v2.6.20/source/include/linux/netdevice.h#L858|netif_rx_schedule()]] and returns from interrupt. netif_rx_schedule() adds the device to softnet_data's poll_list and raises the NET_RX_SOFTIRQ software interrupt. |
- ksoftirqd runs [[https://elixir.bootlin.com/linux/v2.6.20/source/net/core/dev.c#L1904|net_rx_action()]], which calls the device's poll virtual method. The poll method does device-specific buffer management, calls netif_receive_skb() for each sk_buff, allocates new sk_buffs as required, and terminates with netif_rx_complete(). | - ksoftirqd runs [[https://elixir.bootlin.com/linux/v2.6.20/source/net/core/dev.c#L1904|net_rx_action()]], which calls the device's poll virtual method. The poll method does device-specific buffer management, calls netif_receive_skb() for each sk_buff, allocates new sk_buffs as required, and terminates with netif_rx_complete(). | ||