Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if_infiniband: Support BPF write for broadcast frames #1591

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ndance-vdura
Copy link

This change is predominantly focused at being able to support DHCP for IPoIB network interfaces utilizing the if_infiniband.c driver.

To do this, DHCP clients and servers require the ability to transmit link-layer broadcasts on the IB interfaces using BPF. In the current driver implementation, this isn't possible as frames transmitted via BPF become mangled (whether using IB or Ethernet headers).

This change updates the if_infiniband driver to be capable of accepting link-layer broadcast requests via BPF using Ethernet formatted frames as this honors the DLT_EN10MB type the driver uses to bind to BPF. Only Broadcast frames can reliably be interpreted using the Ethernet header format so unicast and multicast frames are rejected if passed in using the Ethernet header format. This is, however, sufficient to support the primary DHCP use case this commit aims to address. The ability to support unicast, broadcast or multicast frames should not be impacted if native infiniband header support is added to BPF at a later date.

To support DHCP for IPoIB links, DHCP clients and servers require the
ability to transmit link-layer broadcasts on the IB interfaces. BPF
provides the mechanism for doing this.

This change updates the if_infiniband driver to be capable of accepting
link-layer broadcast requests via BPF using Ethernet formatted frames
(the driver currently registers with BPF as DLT_EN10MB). Only Broadcast
frames can reliably be interpreted using the Ethernet header format so
detect unicast and multicast frames are rejected if passed in using the
Ethernet format. This doesn't impact the ability to support native
unicast, broadcast or multicast frames if native infiniband header
support is added to BPF at a later date.

Further the above, this commit also addresses an issue in the existing
code that can result in separation of part of the packet header from the
rest of the payload if a BPF write was attempted. This was caused by
mbuf preallocation of the infiniband header length regardless of length
of the prepend data.
@ndance-vdura ndance-vdura changed the title if_infininband: Support BPF write for broadcast frames if_infiniband: Support BPF write for broadcast frames Feb 5, 2025
@rpokala-freebsd
Copy link
Contributor

@glebius and @chmeeedalf: When I looked around the IB / IP-over-IB code, it looks like you two have made the only non-trivial changes since we lost Hans Petter.

This change looks okay to us within VDura (formerly known as Panasas), but I was hoping to get some expert eyes on it, rather than just committing it on my own. Can either of you take a look?

@glebius
Copy link
Member

glebius commented Feb 6, 2025

I'm not expert. All my changes to infiniband are related to large network stack sweeping cleanups. I never touched infiniband hardware. If you use it in VDura, you probably should consider becoming maintainers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants