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 ...
随机推荐
- Kali-linux使用Easy-Creds工具攻击无线网络
Easy-Creds是一个菜单式的破解工具.该工具允许用户打开一个无线网卡,并能实现一个无线接入点攻击平台.Easy-Creds可以创建一个欺骗访问点,并作为一个中间人攻击类型运行,进而分析用户的数据 ...
- Kali-linux绘制网络结构图
CaseFile工具用来绘制网络结构图.使用该工具能快速添加和连接,并能以图形界面形式灵活的构建网络结构图.本节将介绍Maltego CaseFile的使用. 在使用CaseFile工具之前,需要修改 ...
- vector详讲(一)
<vector>头文件里带有两个类型参数的类模板,第一个参数是需要指定的数据类型,第二个是分配器(allocator)类型 template<class T, class Alloc ...
- Linux中PATH环境变量的作用和使用方法
关于PATH的作用:PATH说简单点就是一个字符串变量,当输入命令的时候LINUX会去查找PATH里面记录的路径.比如在根目录/下可以输入命令ls,在/usr目录下也可以输入ls,但其实ls这个命令根 ...
- PAT——1031. 查验身份证
一个合法的身份证号码由17位地区.日期编号和顺序编号加1位校验码组成.校验码的计算规则如下: 首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8, ...
- 阅读Deep Packet Inspection based Application-Aware Traffic Control for Software Defined Networks
Deep Packet Inspection based Application-Aware Traffic Control for Software Defined Networks Globlec ...
- JAVA语言编程思维入门
Java语言是一门强数据类型语言,也就是所有的数据有自己的数据类型,不能搞混淆.比如整数int 字符串String 不能用int a="字符串123";这样写是错的,因为数据类型不 ...
- Web框架——XWAF的代码结构和运行机制(4)
XWAF是一套基于Servlet和java反射技术的Web应用程序框架,它利用Servlet运行机制在服务器上加载和运行,接管客户端请求,依靠ServletRequest对象获取用户请求信息,使用Se ...
- alter修改表
alter修改表的基础语句,语法如下: ALTER TABLE table_name ADD column_name|MODIFY column_name| DROP COLUMN column_na ...
- 修改系统UITableViewCell的ImageView大小
代码如下: CGSize itemSize = CGSizeMake(, ); UIGraphicsBeginImageContext(itemSize); CGRect imageRect = CG ...