문제

I'm trying to understand the purpose of the csum_start and csum_offset fields in struct sk_buff.

Googling for them, I came across the following definition:

csum_start is the offset from the address of skb->head to the address of the checksum field. csum_offset is the offset from the beginning of the address of checksum to the end.

  1. When are these fields actually used?
  2. If the checksum is offloaded to a device driver via NETIF_F_HW_CSUM, how are the aforementioned values to be used/interpreted in this context?

Any insight on the above is highly appreciated!

도움이 되었습니까?

해결책

If a device's feature is set to NETIF_F_HW_CSUM, then the network stack does not compute the transport checksum on the transmit path. Instead, it tells the device to compute the checksum by setting ip_summed to CHECKSUM_PARTIAL.

The device shall use csum_start (or skb_checksum_start_offset(skb) occasionally) as the starting position and compute the checksum till the end of the packet (len field in socket buffer). The computed checksum is stored at csum_offset from csum_start.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top