Linux checksum flag in kernel
net_device->feature
| NETIF_F_NO_CSUM: No need to use L4 checksum, it used for loopback device.
| NETIF_F_IP_CSUM: the device can compute L4 checksum in hardware, but only for TCP and UDP over IPv4.
| NETIF_F_HW_CSUM: the device can compute the L4 checksum in hardware for any protocol.
For receive path:
skb->csum may hold the L4 checksum(when skb->ip_summed == CHECKSUM_COMPLETE, this filed hold the checksum provided by hardware).
skb->ip_summed: indicate the checksum status.
CHECKSUM_NONE: the checksum in csum is not valid, this can be due to:
1. device doesn't provide hardware checksumming.
2. hardware found the packet is corrupted, in normal case, it should drop this packet and not discard this packet, but the driver may want the kernel to re-check it again,so it set this flag.
IMPORTANT: if the packet is going to be forwarded, the router should not discard it dure to wrong L4 checksum (a route is not supposed to check L4 checksum). but the receiver need to check it.
3. the checksum need be recomputed nd reverified.
CHECKSUM_HW: the NIC hs computed the checksum on the L4 header and payload. and has copied it into the skb->csum field. The software needs to add checksum on the pseduo-heder to generate the result checksum.
CHECHSUM_UNNECESSARY: the NIC has computed and verified the checksum. software doesn't need to verify the checksum again.
For TX path: skb->csum: tell hardware to put the checksum at this offset of the packet.
skb->ip_summed, CHECKSUM_NONE: the software has processed the checksum, hardware doesn't need to do anything.
CHECKSUM_HW: software computed the checksum of the pseudo-header. hardware need to adding this checksum to L4 header and payload.
refer:tcp_v4_checksum_init for rx, tcp_v4_send_check for tx in kernel code.
Linux checksum flag in kernel的更多相关文章
- Android开发:Android虚拟机启动错误Can't find 'Linux version ' string in kernel image file
Android启动出错,虚拟机报错信息如下: Starting emulator for AVD 'test' emulator: ERROR: Can't find 'Linux version ' ...
- linux下lk和kernel层通信方式[2]
U-Boot与Linux内核的交互 说明:本文所使用的U-Boot的版本是1.1.6,平台是S3C2440. 目录 一.简介 1.1标记列表二.设置标记存放的地址 2.1相关的结构体定义 2.2标记存 ...
- ORACLE Linux以及 Unbreakable Enterprise Kernel
Oracle Linux,全称为Oracle Enterprise Linux,简称OEL,Linux发行版本之一.Oracle公司在2006年初发布第一个版本,以对Oracle软件和硬件支持较好见长 ...
- ARM Linux从Bootloader、kernel到filesystem启动流程
转自:http://www.veryarm.com/1491.html ARM Linux启动流程大致为:bootloader ---->kernel---->root filesyste ...
- 在Linux运行期间升级Linux系统(Uboot+kernel+Rootfs)
版本:v1.2 Crifan Li 摘要 本文主要介绍了如何在嵌入式Linux系统运行的时候,进行升级整个Linux系统,包括uboot,kernel和rootfs.以及简介Linux中的已有的通 ...
- Optimizing Linux network TCP/IP kernel parameters
You can verify the Linux networking kernel parms from the root user with these commands::Many Oracle ...
- vbox下安装 linux 64 bit出现“kernel requires an x86_64 cpu
今天在vbox下安装linux 64bit出现"kernel requires an x86_64 cpu, but only detected "的错误,网上有很多文章介 ...
- 开发人员需要熟知的常用Linux命令Version、Kernel查看
当我们需要在Linux系统中安装一些软件而去下载安装文件时,一般都需要确认到底下载哪个版本的安装包,这就需要我们知道自己的Linux系统到底是什么版本.什么内核,常见的版本.内核查看命令或者文件有如下 ...
- linux overcommit flag
linux中有一个overcomit的配置,这个配置关系到进程在过多申请memory资源的时候,系统的表现(启发式允许,不检查,or 阻止) /proc/sys/vm/overcommit_memor ...
随机推荐
- 监听器中spring注入相关的问题
问题描述: 需求是要求在项目启动自动触发一个service中的线程的操作,使用监听器来实现,但是自定义监听器中spring注解service失败,通过WebApplicationContextUtil ...
- javascript中获取dom元素高度和宽度
javascript中获取dom元素高度和宽度的方法如下: 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网 ...
- 卢卡斯定理Lucas
卢卡斯定理Lucas 在数论中,\(Lucas\)定理用于快速计算\(C^m_n ~ \% ~p\),即证明\(C^m_n = \prod_{i = 0} ^kC^{m_i}_{n_i}\)其中\(m ...
- JNI由浅入深_9_JNI 异常处理
1 .本地代码中如何缓存和抛出异常 下面的代码中演示了如何声明一个会抛出异常的本地方法.CatchThrow这个类声明了一个会抛出IllegalArgumentException异常的名叫doit的本 ...
- zabbix 表结构详情(基本)
zabbix表结构 1.acknowledges 记录告警的确认信息 2.actions 记录了当触发器触发时,需要采用的动作. mysql> desc actions; +---------- ...
- mysql常见字符串处理函数
- LeetCode29.两数相除 JavaScript
给定两个整数,被除数 dividend 和除数 divisor.将两数相除,要求不使用乘法.除法和 mod 运算符. 返回被除数 dividend 除以除数 divisor 得到的商. 示例 1: 输 ...
- 手把手教你创建私有podspec
本文来自 网易云社区 . CocoaPods是iOS非常好用的类库管理工具,可以非常方便的管理和更新项目中使用到的第三方库,以及将自己项目中的公共组件交由它管理. 工作中比较常用到的是通过CocoaP ...
- fail2ban 防暴力破解总结
公司服务器安全问题一直是个令人头疼的问题,许多运维的小伙伴一直在用脚本来监控服务器登录状态,然而脚本编写比较麻烦,今天就给大家推荐一款小而精致的防暴力破解工具 fail2ban ,他可以监控系统日志, ...
- 关于osi的7层与tcp的4层网络协议的理解
osi 七层模型 应用层 提供接口 表示层 机器语言的二进制转换 对话层 决定是否传输 传输层 确定可不可靠 排差错 控流 网络层 提供逻辑地址 选路 数据链路层 mac 错误检测 物理层 设备间的比 ...