Commit eea48c6
committed
virtio-net: enable IPv6 checksum and TSO offload
The virtio-net offload paths were hardcoded to ETHERTYPE_IP: the TX path only
built VIRTIO_NET_HDR_GSO_TCPV4 and the RX checksum path rejected everything but
IPv4 (with a literal "How come - no support for IPv6?!" comment). As a result
IPv6 traffic computed checksums in software and never used TCP segmentation
offload, so high-throughput IPv6 sends/receives burned more CPU than IPv4 even
though the stack (tcp_output) already emits CSUM_TCP_IPV6.
This teaches the driver about IPv6:
- negotiate VIRTIO_NET_F_HOST_TSO6 / VIRTIO_NET_F_GUEST_TSO6
- advertise IFCAP_TSO6 and CSUM_TCP_IPV6 | CSUM_UDP_IPV6 in if_hwassist/caps
- TX: add an ETHERTYPE_IPV6 case that sets csum_start past the 40-byte base
header and gso_type = VIRTIO_NET_HDR_GSO_TCPV6 (packets with extension
headers have ip6_nxt != TCP/UDP and fall back to software checksums)
- RX: accept ETHERTYPE_IPV6 in the checksum-offload path (the TCP/UDP checksum
offset logic is identical for v4 and v6)
- use large receive buffers when GUEST_TSO6 is negotiated too
Boot-tested with IPv6 SLAAC over virtio-net: loopback + concurrent dual-stack
TCP pass and a global address is configured through the modified TX/RX paths.1 parent b06d3df commit eea48c6
2 files changed
Lines changed: 39 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
286 | 290 | | |
287 | 291 | | |
288 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
289 | 297 | | |
290 | 298 | | |
291 | 299 | | |
292 | 300 | | |
293 | 301 | | |
294 | | - | |
| 302 | + | |
295 | 303 | | |
296 | 304 | | |
297 | 305 | | |
| |||
382 | 390 | | |
383 | 391 | | |
384 | 392 | | |
| 393 | + | |
| 394 | + | |
385 | 395 | | |
386 | 396 | | |
387 | 397 | | |
388 | 398 | | |
389 | 399 | | |
390 | 400 | | |
| 401 | + | |
391 | 402 | | |
392 | | - | |
| 403 | + | |
393 | 404 | | |
394 | 405 | | |
395 | 406 | | |
396 | | - | |
| 407 | + | |
397 | 408 | | |
398 | 409 | | |
399 | 410 | | |
| |||
431 | 442 | | |
432 | 443 | | |
433 | 444 | | |
434 | | - | |
435 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
436 | 448 | | |
437 | 449 | | |
438 | 450 | | |
| |||
829 | 841 | | |
830 | 842 | | |
831 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
832 | 861 | | |
833 | 862 | | |
834 | 863 | | |
| |||
914 | 943 | | |
915 | 944 | | |
916 | 945 | | |
| 946 | + | |
917 | 947 | | |
918 | 948 | | |
| 949 | + | |
919 | 950 | | |
920 | 951 | | |
921 | 952 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
276 | 278 | | |
277 | 279 | | |
278 | 280 | | |
| |||
0 commit comments