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.

时间: 2024-10-24 14:35:46

Linux checksum flag in kernel的相关文章

Linux系统启动流程之kernel

Linux系统启动流程之kernel   1.内核参数修改方法: 2.内核内核模块管理: 3.内核编译 用户空间访问.监控内核的方式:/proc, /sys 伪文件系统 /proc/sys: 此目录中的文件很多是可读写的 /sys/: 某些文件可写   1.内核参数修改方法: echo VALUE > /proc/sys/TO/SOMEFILE sysctl -w kernel.hostname= [[email protected] vm]# free -m  total   used   f

基于FL2440的3.6.6内核移植出现Uncompressing Linux... done, booting the kernel.

具体问题 参考解决方案 解决思路 深入解决 1.具体问题: 在移植3.6.6的内核后,下载启动卡死,具体是串口打印信息停留在"Uncompressing Linux- done, booting the kernel." 2. 参考解决方案: 依据网上的说法要确保如下情况: 2.1 内核的时钟频率正确 2.2 boot和kerel 配置一致的MACH_TYPE,即板子MACHINE ID 2.3 串口驱动配置正常 在内核配置device drivers->character de

Linux Systemcall、Llinux Kernel Debug Based On Sourcecode

目录 1. 系统调用简介 2. 系统调用跟踪调试 3. 系统调用内核源码分析 1. 系统调用简介 关于系统调用的基本原理,请参阅另一篇文章,本文的主要目标是从内核源代码的角度来学习一下系统调用在底层的内核中是如何实现的 Relevant Link: http://www.cnblogs.com/LittleHann/p/3850653.html http://www.kerneltravel.net/journal/iv/syscall.htm http://zjuedward.blog.51c

ARM Linux从Bootloader、kernel到filesystem启动流程

转自:http://www.veryarm.com/1491.html ARM Linux启动流程大致为:bootloader ---->kernel---->root filesystem.bootloader 是一上电就拿到cpu 的控制权的,而bootloader实现了硬件的初始化.bootloader俨然就成了Power on 之后”第一个吃螃蟹”的代码. 谈到这就得想到硬件机制是如何满足这个功能的了.CPU内部一般都集成小容量的SRAM (又叫stapping stone,垫脚石),

在Linux运行期间升级Linux系统(Uboot+kernel+Rootfs)

版本:v1.2 摘要 本文主要介绍了如何在嵌入式Linux系统运行的时候,进行升级整个Linux系统,包括uboot,kernel和rootfs.以及简介Linux中的已有的通用的Nor Flash驱动m25p80,和简介mtd util以及相关工具mtdinfo,flash_erase,flash_eraseall,nanddump,nandwrite等的基本用法. 本文提供多种格式供: 在线阅读 HTML HTMLs PDF CHM TXT RTF WEBHELP 下载(7zip压缩包) H

ORACLE Linux以及 Unbreakable Enterprise Kernel

Oracle Linux,全称为Oracle Enterprise Linux,简称OEL,Linux发行版本之一.Oracle公司在2006年初发布第一个版本,以对Oracle软件和硬件支持较好见长.OEL,一般人通常叫法为Oracle企业版Linux,由于Oracle提供的企业级支持计划UBL(Unbreakable Linux),所以很多人都称OEL为坚不可摧Linux.2010年9月,Oracle Enterprise Linux发布新版内核--Unbreakable Enterpris

Optimizing Linux network TCP/IP kernel parameters

You can verify the Linux networking kernel parms from the root user with these commands::Many Oracle professionals do not note the required setting for optimizing Oracle*Net on Oracle 10g release 2.  Here is a review of the suggested TCP/IP buffer pa

Linux开学flag

从年初到现在,通过对Linux的学习,从一个完全没听过这个操作系统的纯小白,逐渐的了解到了关于服务器的相关知识,发现这是一个功能强大而复杂的操作系统.曾经互联网中有个流传甚广的笑话--从删库到跑路.以前听当程序员的朋友说起,却不知其义.直到如今了解到linux后终于知道了这句话的含义,并且意识到了运维工程师在企业中所处于中的关键作用. 这段时间通过老师的讲解,和自己在网络上看到的linux的相关知识,算是做到了入门.并且知道了一些基础命令的用法,以及Linux系统后期的学习内容.也意识到想要学的

[daily] 查看linux程序或操作的kernel内核调用栈

一 [classic_tong @ https://www.cnblogs.com/hugetong/p/12198122.html] 查看一个命令或程序,都调用了什么系统API的方法, 可以是用strace [[email protected] OUTPUT_nginx]# strace echo execve("/usr/bin/echo", ["echo"], [/* 22 vars */]) = 0 brk(NULL) = 0x1311000 mmap(NU