Subject: Re: hardware checksum with wm nics
To: None <tech-net@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-net
Date: 07/25/2007 23:23:01
In article <Pine.NEB.4.64.0707241452410.19188@6bone.informatik.uni-leipzig.de>,
<6bone@6bone.informatik.uni-leipzig.de> wrote:
>hello,
>
>I am using intel nics with netbsd-3-1 and netbsd-4-beta2 kernel
>versions. It seems that the hardware-assisted checksums don't work
>correctly.
>
>example (disabled hardware-assisted checksums):
>ifconfig wm0:
>
>wm0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> capabilities=87<IP4CSUM,TCP4CSUM,UDP4CSUM,TSO4>
> enabled=0
> address: 00:14:22:1d:8b:41
> media: Ethernet autoselect (1000baseT full-duplex)
> status: active
> inet 139.18.25.35 netmask 0xfffffff8 broadcast 139.18.25.39
> inet6 fe80::214:22ff:fe1d:8b41%wm0 prefixlen 64 scopeid 0x1
> inet6 2001:638:902:1:214:22ff:fe1d:8b41 prefixlen 64 detached
>
>
>bash-3.2# tcpdump -vpni wm0 port 22
>tcpdump: listening on wm0, link-type EN10MB (Ethernet), capture size 96 bytes
>14:58:28.922305 IP (tos 0x0, ttl 127, id 15365, offset 0, flags [DF],
>length: 40) 139.18.11.72.2430 > 139.18.25.35.22: . [tcp sum ok] ack
>2524156043 win 64243
>
>
>example (enabled hardware-assisted checksums):
>ifconfig wm0
>wm0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> capabilities=87<IP4CSUM,TCP4CSUM,UDP4CSUM,TSO4>
> enabled=87<IP4CSUM,TCP4CSUM,UDP4CSUM,TSO4>
> address: 00:14:22:1d:8b:41
> media: Ethernet autoselect (1000baseT full-duplex)
> status: active
> inet 139.18.25.35 netmask 0xfffffff8 broadcast 139.18.25.39
> inet6 fe80::214:22ff:fe1d:8b41%wm0 prefixlen 64 scopeid 0x1
> inet6 2001:638:902:1:214:22ff:fe1d:8b41 prefixlen 64
>
>
>bash-3.2# tcpdump -vpni wm0 port 22
>tcpdump: listening on wm0, link-type EN10MB (Ethernet), capture size 96 bytes
>15:11:16.469732 IP (tos 0x10, ttl 64, id 32065, offset 0, flags [DF],
>length: 292, bad cksum 0 (->741a)!) 139.18.25.35.22 > 139.18.25.33.65436:
>P 946513:946753(240) ack 1008 win 33580 <nop,nop,timestamp 22 22>
>
>I think the problem only occurs with outgoing packets.
>
>You can simply disable the hardware-assisted checksums, but it would be
>nice, if anyone could fix the problem.
I think that if you enable checksums tcpdump does not know that they will
be calculated by the nic for outgoing packets so you see the wrong checksum.
We could fix tcpdump to look at the interface flags and DTRT but it does
not seem worth-while.
christos