函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\checksum.c Create Date:2022-07-27 08:15:27
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:do_csum

函数原型:static unsigned int do_csum(const unsigned char *buff, int len)

返回类型:unsigned int

参数:

类型参数名称
const unsigned char *buff
intlen
49  result等于0
51  如果len小于等于0则转到:out
53  odd等于1按位与buff
54  如果odd
56  result加等于buff左移8位
60  len自减
61  buff自加
63  如果len大于等于2则
64  如果2按位与buff
65  result加等于buff
66  len减等于2
67  buff加等于2
69  如果len大于等于4则
70  end等于bufflen按位与3的反的值
71  carry等于0
72  循环
73  w等于buff
74  buff加等于4
75  result加等于carry
76  result加等于w
77  carry等于w大于result
78 buff小于end循环
79  result加等于carry
80  result等于result按位与0xffff的值加result右移16位的值
82  如果len按位与2则
83  result加等于buff
84  buff加等于2
87  如果len按位与1则result加等于buff
93  result等于from32to16(result)
94  如果oddresult等于result右移8位按位与0xff按位或result按位与0xff的值左移8位
96  out :
97  返回:result
调用者
名称描述
ip_fast_csumThis is a version of ip_compute_csum() optimized for IP headers,* which always checksum on 4 octet boundaries.
csum_partialmputes the checksum of a memory block at buff, length len,* and adds in "sum" (32-bit)* returns a 32-bit number suitable for feeding into itself* or csum_tcpudp_magic* this function must be called with even lengths, except* for the last fragment, which
ip_compute_csumIP校验