External implementers of tun.Device may support GRO, requiring checksum offload. Signed-off-by: Jordan Whited <jordan@tailscale.com>
15 lines
345 B
Go
15 lines
345 B
Go
// This file contains IP checksum algorithms that are not specific to any
|
|
// architecture and don't use hardware acceleration.
|
|
|
|
//go:build !amd64
|
|
|
|
package tun
|
|
|
|
import "strconv"
|
|
|
|
func Checksum(data []byte, initial uint16) uint16 {
|
|
if strconv.IntSize < 64 {
|
|
return checksumGeneric32(data, initial)
|
|
}
|
|
return checksumGeneric64(data, initial)
|
|
}
|