This blog post explains how computers running the Linux kernel send packets, as well as how to monitor and tune each component of the networking stack as packets flow from user programs to network hardware. 这篇
Monitoring and Tuning the Linux Networking Stack: Receiving Data。如果能看懂英文,建议阅读原文,或者和本文对照看。 这篇文章写的是 “Linux networking stack”,这里的 ”stack“ 指的不仅仅是内核协议 栈,而是包括内核协议栈在内的、从数据包到达物理网卡到最终被用户态程序收起的整个路 径。所以文章有三方面,...
DD(Device Drivers设备驱动程序):用来定义各种设备驱动,其代码量占Linux Kernel代码总量的70%以上。 IPC(Inter-Process Communication):进程间通信。IPC不管理任何硬件,主要负责Linux系统中进程之间的通信。 图3 Linux Kernel and Network Stack 2、Linux Kernel Network Stack,网络子系统 网络子系统在Linux内核中主要负...
从上面的struct smp_hotplug_thread定义中可以看出,注册了两个函数指针:ksoftirqd_should_run和run_ksoftirqd。 作为类似于事件循环的一部分,这两个函数都是从kernel/smpboot.c中调用的。 kernel/smpboot.c中的代码首先调用ksoftirqd_should_run,确定是否有未决的软中断,如果有未决的软中断,则执行run_ksoftirqd。run_...
主要的参考文献是:Linux网络栈剖析(中文版)/Anatomy of Linux networking stack (英文原版)by Tim Jones. 以及:Linux内核2.4.x的网络接口结构 另外一些参考资料可以从这个页面找到:http://www.ecsl.cs.sunysb.edu/elibrary/linux/network/ (纽约州立大学石溪分校的页面) Linux内核网络协议栈采用了如下的层次结构:...
Scaling in the Linux Networking Stack Introduction Linux网络栈的性能缩放 本文翻译自:kernel.org/doc/html/lat 在机翻基础上,按照译者的理解进行了意译。 This document describes a set of complementary techniques in the Linux networking stack to increase parallelism and improve performance for multi-processor...
ip_rcv() 函数验证 IP 分组,比如目的地址是否本机地址,校验和是否正确等。若正确,则交给 netfilter 的NF_IP_PRE_ROUTING 钩子(关于netfilter细节可以参考 Hacking the Linux Kernel Network Stack );否则,丢弃。到了 ip_rcv_finish() 函数,数据包就要根据 skb 结构的目的或路由信息各奔东西了。
被其他 CPU 唤醒来处理 backlog 数据的次数,第 11 列是触发 flow_limit 限制的次数,需要注意,本文的描述忽略了很多实现中的细节,没有讨论 NAPI 的配置项,也没有讨论 RSS / RPS 所带来的 CPU 分配等问题,较为完整的基于源码讨论 Linux ingress 可以参见https://arthurchiao.github.io/blog/tuning-stack-rx-...
参考资料: https://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ https://www.cnblogs.com/luoahong/p/10815283.html 链接:http://kerneltravel.net/blog/2020/ksoftirqd_ljr/ (版权归原作者所有,侵删)...
The components are arranged in groups that form network layers, which stack on top of each other in order to form a complete system. The Linux kernel handles networking in a similar way to the SCSI subsystem described in Chapter 3. 计算机通过使用一系列组件来回答这些问题,每个组件负责发送、接收...