mywiki:linux:checksum
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| mywiki:linux:checksum [2016/04/05 16:51] – created shaoguoh | mywiki:linux:checksum [2019/09/15 18:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| Linux Checksum Calculation Logic | Linux Checksum Calculation Logic | ||
| - | API: skb_checksum_help | + | ^API | Comments | |
| + | | skb_checksum_help | ||
| + | | ip_fast_csum | | | ||
| + | | csum_fold | | | ||
| + | | skb_checksum | | | ||
| + | | csum_tcpudp_magic | | | ||
| + | | nf_ip_checksum | | ||
| + | | csum_tcpudp_nofold | | ||
| + | | csum_replace4 | | ||
| + | | csum_replace2 | | ||
| + | | nf_nat_ipv4_csum_recalc | | ||
| + | | csum_tcpudp_magic | | ||
| + | |||
| + | |||
| + | skb-> | ||
| + | |||
| + | skb-> | ||
| + | |||
| + | **TSO** is a hardware feature whereas **GSO** is a software feature. | ||
| + | |||
| + | In the sense, TSO needs "the device" | ||
| + | BUT, GSO is a strategy followed by kernel to avoid processing smaller packets throughout the stack to improve the porformance | ||
| + | |||
| + | ====== Linux Checksum offloading ====== | ||
| + | |||
| + | - For bridging and non-udp/tcp packet, no so called offloading support in tx path | ||
| + | - For Fragmented packets, no checksum offloading support in tx path | ||
| + | - For UDP/TCP routing packet (incremental), | ||
| + | - Only Linux local output UDP/TCP’s checksum can be offloaded in tx path | ||
| + | - For L2TP related tunnels, only inner UDP/TCP can be offloaded, outer UDP/TCP is done by linux itself in tx path. | ||
| + | |||
| + | Below variables in skb is very important for checksum offloading: | ||
| + | - ip_summed (CHECKSUM_PARTIAL) | ||
| + | - encapsulation | ||
| + | - inner_network_header/ | ||
| + | - inner_transport_header/ | ||
| + | |||
| + | |||
| + | ====== Linux Checksum ====== | ||
| + | < | ||
| + | union { | ||
| + | |||
| + | __wsum | ||
| + | struct { | ||
| + | __u16 csum_start; | ||
| + | __u16 csum_offset; | ||
| + | }; | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | |||
| + | | Variables/ | ||
| + | ^ Input | CHECKSUM_NONE 0 | not valid | SW need do L4 payload + pseudo header verification | ||
| + | | | CHECKSUM_UNNECESSARY 1 | not valid | HW already do L4 payload + pseudo header verification | ||
| + | | | CHECKSUM_COMPLETE 2 | csum valid (stored with L4 payload checksum) | SW need to do skb-> | ||
| + | ^ Output | CHECKSUM_NONE 0 | not valid | SW already do necessary L4 checksum calculation | ||
| + | | | CHECKSUM_PARTIAL 3 | csum_start/ | ||
mywiki/linux/checksum.1459846306.txt.gz · Last modified: (external edit)
