Page MenuHomeFreeBSD

bhyve: e82545: drop frames that are too long for the guest
Needs ReviewPublic

Authored by wanpengqian_gmail.com on Fri, Oct 2, 5:57 AM.
Tags
None
Referenced Files
F175525281: D60225.id188366.diff
Sun, Oct 11, 11:22 AM
Unknown Object (File)
Sat, Oct 10, 7:37 AM
Unknown Object (File)
Fri, Oct 9, 9:17 AM
Unknown Object (File)
Fri, Oct 9, 5:59 AM
Unknown Object (File)
Fri, Oct 9, 5:02 AM
Unknown Object (File)
Fri, Oct 9, 1:25 AM
Unknown Object (File)
Thu, Oct 8, 5:06 PM
Unknown Object (File)
Wed, Oct 7, 7:21 AM
Subscribers

Details

Reviewers
None
Group Reviewers
bhyve
Summary

Unless the guest sets RCTL.LPE, the 8254x discards frames longer than
1522 bytes. The device model used that limit only to work out how many
descriptors a frame can take: a longer frame that fitted the buffers,
up to 2048 bytes with the usual buffer size, was handed to the guest.

A bridge with LRO enabled on a member delivered 1634-byte frames to
the tap interface. Linux's e1000 driver panicked in skb_put() and
Windows' driver stopped receiving.

Drop such frames as the hardware does.

Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Sponsored by: keelos.dev

Test Plan

main (f958aa7e7), FreeBSD 16.0-CURRENT guest with -s 3,e1000,tap0, em0 with the default MTU of 1500 (RCTL.LPE clear). On the host the MTU of tap0 was raised to 9000 and frames of several sizes were sent with ping -D -s SIZE (3 pings each):

framebeforeafter
1514 bytes (-s 1472)3 replies3 replies
1518 bytes (-s 1476)3 replies3 replies
1518 bytes with a VLAN tag (-s 1472 on a vlan(4))3 replies
1519 bytes (-s 1477)3 repliesnone
1642 bytes (-s 1600)3 repliesnone
2042 bytes (-s 2000)3 repliesnone
1514 bytes again3 replies3 replies

1518 bytes without the CRC is the 1522-byte limit of the hardware.

How it was found (FreeBSD 14.5): guests on a bridge whose physical member is a vlan(4) on an igb(4) port with LRO left on. The bridge handed 1634-byte frames to the tap interfaces. A Linux guest's e1000 driver panicked in skb_put(), a Windows 10 guest's stopped receiving. With this change the Linux guest no longer panics (the transfer stalls until LRO is turned off, as it would with a real 8254x).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77601
Build 74484: arc lint + arc unit