More detail (sorry, submitted this in the absolute dead of night, was tired),
Anyways, a single read with BPF could return several packets packed back-to-back, each preceded by a struct bpf_hdr. The rump kernel pads each record to BPF_ALIGNMENT, which NetBSD's <net/bpf.h> defines as sizeof (long). rumpnet/net-rump.c advances with its own BPF_WORDALIGN, uses Mach's <device/bpf.h>, where that is sizeof (int). On i386, this bug wouldn't exist since both int and long are four bytes. But on amd64, long is 8 bytes, causing a semi-consistent 4 byte mismatch. The first record in each read is always parsed correctly, because it starts at offset 0 and bh_hdrlen comes from the kernel. However, a full-size frame is (26 + 1514) 1540 bytes, and the kernel pads that to 1544, but rumpnet advances only 1540, so it reads the next header 4 bytes early. This shifts everything over, putting rumpnet's field bh_caplen in the upper end of a 64 bit timestamp field tv_usec, which are always zero, and shifts another field bh_datalen onto that bh_caplen. This causes datalen - caplen to be nonzero, which the code interprets as a fragment, and immediately drops everything following the rest of the read, causing networking to appear to work, but being abysmally slow. This adds a RUMP_BPF_WORDALIGN, which uses sizeof (long) correctly. On my Latitude E6420 (Intlel 82579LM, hurd-amd64), I saw performance gains from as low as 12kB/s on HTTPS file downloads, up to 1.2MB/s. From a faster server, I saw it hit 9MB/s, and 30MB/s parallel x4, while the CPU was left somewhat idle. I'm sure there is more performance to be eeked out of rumpnet as a whole, but this should fix the most glaring of performance issues people have experienced on 64 bit. Get Outlook for Android<https://aka.ms/AAb9ysg> ________________________________ From: Michael Beecher Sent: Thursday, 08 October 2026 01:12:40 To: [email protected] <[email protected]> Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]> Subject: rumpnet: Fix BPF record alignment on amd64 Hurd systems Hi all, Patch attached. I found this while getting networking usable on hurd-amd64 on my Dell E6420 (82579LM). I noticed TCP was very slow and saw that bursts of packets got dropped consistently. Thanks, Michael.
