Page MenuHomeFreeBSD

Add Support for Geneve (RFC8926)
ClosedPublic

Authored by pouria on Dec 10 2025, 11:24 PM.
Tags
None
Referenced Files
F152942105: D54172.id175291.diff
Sat, Apr 18, 5:37 AM
F152909722: D54172.id175427.diff
Fri, Apr 17, 11:31 PM
F152904262: D54172.id175289.diff
Fri, Apr 17, 10:31 PM
F152844586: D54172.id175142.diff
Fri, Apr 17, 11:29 AM
Unknown Object (File)
Wed, Apr 15, 11:23 AM
Unknown Object (File)
Mon, Apr 13, 6:41 PM
Unknown Object (File)
Sun, Apr 12, 5:32 PM
Unknown Object (File)
Sun, Apr 12, 12:30 AM

Details

Summary

if_geneve: Add geneve support (RFC8926)
geneve creates a generic network virtualization tunnel
interface for Tentant Systems over an L3 (IP/UDP) underlay network that
provides a Layer 2 (ethernet) or Layer 3 service using the geneve protocol.
This implementation is based on RFC8926.

  • IPv4 and IPv6 is fully supported for both unicast and multicast underlay.
  • Per-VNET geneve tunnel is implemented.
  • RXCSUM/TXCSUM/TSO offloading capabilities are implemented.
Test Plan

see D55183

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69563
Build 66446: arc lint + arc unit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
zlei added inline comments.
sys/net/if_geneve.c
1676

I'm recently fighting with ifp->if_drv_flags & IFF_DRV_RUNNING. I think the flag should ( if ever wanted ) be write only by the driver and protected by driver locks, but not by the net stack. For sync issue, the net stack should use atomic_load but not merely a test by ifp->if_drv_flags & IFF_DRV_RUNNING.

sys/net/if_geneve.c
1676

IMHO, the idea of the flag was not correct in the first place. A new properly written driver shall not rely on it as a measure to prevent the stack from talking to the driver.

Rebase and update according to 0bd0c3295ac09f759f2816b73cbd2d950e3bef7e .

  • There is no ether_reassign, therefore, geneve_reassign removed for good.

All geneve tests are passed and reassignment is also tested.

Fix ability to modifying generic and link-specific attributes at the same time in geneve_clone_modify_nl

sbin/ifconfig/ifgeneve.c
233

D54443: @zlei
This is an example of netlink implementation of ifconfig for geneve.
For the same reason, we need the nl_parsed_geneve here.
That's why I want the nl_parsed_gre to be public KPI.

I'm going to breakdown this revision to be easier to review.
So, sorry for noise in advance.

Rebase geneve to main and limit this revision kernel only.
ifconfig netlink helper: D55174
ifconfig geneve implementation (netlink): D55184
ifconfig geneve implementation (without netlink): D55185
ifconfig(8) manual for geneve: D55181
geneve(4) manual: D55182
geneve tests: D55183
update geneve to follow RFC 6040: D55186

If you want to test all of the Geneve patches together,
you can find them with all patches applied on my github:
https://github.com/spmzt/freebsd-src/tree/geneve_total

pouria edited the test plan for this revision. (Show Details)
pouria removed a reviewer: manpages.
pouria removed a parent revision: D53516: Update ip_ecn to RFC 6040.
pouria removed a subscriber: ziaee.
pouria marked 12 inline comments as done.Feb 8 2026, 4:50 PM

@glebius Do you think removing nvlist/non-netlink support will help this revision get reviewed faster?
since it will reduce the code size.

Sorry if I wasn't clear - I have no objections against pushing this in. I'm not able to do a protocol level review, but wrt the interaction with the rest of the network stack all looks good to me.

P.S. My only comment was about use of IFF_DRV_RUNNING, which IMHO is not a real protection from stack calling into the driver. You can improve that later, though.

This revision is now accepted and ready to land.Mar 16 2026, 6:47 PM

Rebase to main, apply and close D55186.

This revision now requires review to proceed.Mar 19 2026, 10:37 AM

Do you think removing nvlist/non-netlink support will help this revision get reviewed faster?
since it will reduce the code size.

FYI, deleting nvlist/non-netlink support, removes ~550 LOC.

I have not looked through the related RFC. So this quick review is not completed.

sys/net/if.h
259–261

I'd like to test this HW offload feature for GENEVE, but I think the ethernet drivers in-tree are not ready for that yet. @pouria Do you have any WIP updates for any drivers ?

sys/net/if_geneve.c
98

The sx lock geneve_sx is only used in this file. Make it static to limit the scope.

613

I guess a memcmp() is sufficient ?

2103

The in-tree drivers are approaching to netlink based config. Shall we still support nvlist ?
@kp How do you think about this ?

3080

No need for parentheses in case labels.

3094

Ditto.

3107

I believe the default branch is unreachable.

3201

Shall the drivers be updated to support the inner csum offload ?

3237

Unreachable code.

The ip_output() shall handle the mbuf, and free it if error occurs. So this is not required.

3385

Ditto.

4534

Shall this move to VNET_SYSUNINIT ?

pouria marked 5 inline comments as done.

Address @zlei comments

Thank you for your review.

sys/net/if.h
259–261

You're right. There are drivers that should support GENEVE hw offload, but not implemented yet.
I want to work on it after geneve lands.
I'm currently busy with v6 and routing stack.

sys/net/if_geneve.c
613

It'll be used in line 785 to order entries on the ftable.
It's basically the same mechanism used in if_vxlan.

2103

np from me. I've a branch prepared without nvlist.
I also like to remove the nvlist support too.

3107

In that case, IMHO, we shouldn't panic.

3201

Of course, but I don't want to update them on this revision.
I prepared the CSUM requirements for geneve here and I'll update other drivers in another revision.

4534

It should, but please see the D54175.

kind ping @zlei

sys/net/if_geneve.c
2103

kind ping @kp

sys/net/if_geneve.c
2103

I'm entirely on board with the "Netlink only" approach. I don't think it's a good idea to have multiple different sets of configuration code. Just do netlink, it's the best available option right now.

sys/net/if_geneve.c
4534

IMO the cloner is not to be blamed.

( The socket ) Leaking of refcount of prison should be handled properly on prison remove event. I have an idea to fix it, then destroy cloner via VNET_SYSUNINIT should work as intended.

Remove nvlist/ioctl support.

@kp @zlei Done.
Could you please review this again?
I just removed the support without netlink completely and successfully ran my tests.
There should be no nvlist interface/header left.
I also abandoned the support for ifconfig WITHOUT_NETLINK.

pouria edited the summary of this revision. (Show Details)

Final style check before landing.

Add spdx tag to geneve header and replace its email with my freebsd email.

adrian added inline comments.
sys/net/if_geneve.c
2869

why are there semicolons here? :p

pouria added inline comments.
sys/net/if_geneve.c
2869

bad habit of declaring first and copying from it.
Nice catch!
How did you find that? :)))

adrian added inline comments.
sys/net/if_geneve.c
2869

eyeballs :p

This revision is now accepted and ready to land.Sun, Apr 12, 11:00 PM
This revision was automatically updated to reflect the committed changes.
pouria marked an inline comment as done.