Skip to content

Homa over UDP - #113

Open
axkum10 wants to merge 6 commits into
PlatformLab:mainfrom
axkum10:main
Open

axkum10 wants to merge 6 commits into
PlatformLab:mainfrom
axkum10:main

Conversation

@axkum10

@axkum10 axkum10 commented Oct 5, 2026

Copy link
Copy Markdown

Summary

Adds optional Homa-over-UDP transport for networks that do not support Homa’s native IP protocol, while preserving the application API and native transport.

Main Flow

  • Enabling per-namespace net.homa.hijack_udp creates shared IPv4/IPv6 tunnel sockets on UDP port 54321.
  • Homa sockets select their transport at creation. Packets are encapsulated on transmit and validated/decapsulated before existing receive processing; transport mismatches are rejected.
  • Disabling UDP blocks new UDP RPC admission and drains existing RPCs before releasing resources.

Tests and Utilities

  • Introduces the entirely new test/integration/ directory with 18 files covering lifecycle, IPv4/IPv6, isolation, checksums, PMTU, retransmission, and pacing. Live scripts use temporary namespaces and retain diagnostic artifacts.
  • Extends existing unit coverage, replaces invoke with an RTT-style udp operation, and adds server startup transport labels.
  • Includes a separate, reversible utility compatibility fix using userspace struct sockaddr; kernel SOCKADDR handling remains unchanged.

Review and Validation

Please focus on namespace/socket lifetime, concurrent enable/disable, checksum/offload handling, PMTU/ICMP, pacing, and native Homa regressions.

All 27 local helper tests and the full utility build passed. Earlier Linux 6.12 module builds and unit suites passed before upstream integration. Post-merge kernel unit builds are blocked locally by __cond_acquires handling with Linux 5.14 headers;

Validation Pending:

  • live integration has not been rerun.
  • Linux 6.17 KASAN/lockdep
  • Physical-wire IPv6 offload
  • Constrained-link SRPT validation

@johnousterhout johnousterhout left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an excellent first pass. Here is an initial round of comments; there are several that I have marked "Let's discuss", which means I'd like to talk about them in person (either in our Wednesday meeting or in a separate Zoom call, if need be). No need to discuss the others unless you want to.

A couple of overall comments:

  • This PR assumes that UDP support will be in addition to "native" Homa-over-UDP and TCP hijacking. I have been assuming that UDP tunneling will be the only way that Homa packets are transmitted, so we can eliminate all of the existing native and TCP hijacking code. Is there some reason why we need all three of these? Focusing entirely on UDP tunneling should make the code much simpler. I marked a few places where I think code can be removed, but there are many more that I didn't mark. Let's discuss.

  • Assuming that UDP tunneling is going to be the only mechanism, the UDP code should not be inside #ifndef __STRIP__ blocks.

Comment thread homa_wire.h
* used for the pair of kernel tunnel sockets that implement UDP hijacking
* (see homa_hijack.c). Chosen from the dynamic/private port range.
*/
#define HOMA_UDP_HIJACK_PORT 54321

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This declaration is part of the public protocol spec, so it should go in homa.h (probably right next to the definition of IPPROTO_HOMA.

Comment thread homa_wire.h
* Homa packets to actually be transmitted as TCP packets (and thereby
* take advantage of TSO and other features).
*/
struct homa_common_hdr {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My assumption has been that this structure will change pretty significantly: all of the fields that mirror TCP should be removed, leaving only those that are necessary for Homa. I wonder if it would also make sense to include the UDP header in this struct? Let's discuss.

Comment thread homa_outgoing.c

if (mtu < min_mtu) {
rcu_read_unlock();
return -EMSGSIZE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return EHOSTUNREACH here? Let's discuss.

Comment thread homa_outgoing.c
rpc->msgout.max_seg_data = mtu - rpc->hsk->ip_header_length -
sizeof(struct udphdr) -
sizeof(struct homa_data_hdr);
rpc->msgout.max_gso_segs = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to indicate that there is no segmentation offload with UDP tunneling? Let's discuss.

Comment thread homa_outgoing.c
rcu_read_unlock();
if (mtu < hsk->ip_header_length + sizeof(struct udphdr) +
padded_length)
return -EMSGSIZE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EHOSTUNREACH?

Comment thread homa_hijack.c
tunnel_cfg.encap_type = 1;
tunnel_cfg.encap_rcv = homa_hijack_udp_encap_rcv;
tunnel_cfg.encap_err_lookup = homa_hijack_udp_encap_err_lookup;
tunnel_cfg.encap_err_rcv = homa_hijack_udp_encap_err_rcv;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't the gro_receive and gro_complete fields need to be set as well? Let's discuss.

Comment thread homa_hijack.c
* @work: The &homa_net.udp_release_work embedded in the target
* &struct homa_net.
*/
static void homa_hijack_udp_release_work_fn(struct work_struct *work)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this mechanism go away if the UDP mechanism exists for the entire lifetime of the network namespace? Let's discuss.

@@ -0,0 +1,66 @@
# UDP Tunnel Integration Tests

The integration scripts exercise a loaded Homa module in temporary network

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't examined this directory in detail, but I'm a bit nervous about it because (a) it's a big slug of code to maintain and (b) historically I have found it hard to get much value out of integration tests (hard to write, run, and maintain for the number of bugs they find).

Maybe when we talk you can demo these for me so I get a sense of how they work?

Let's discuss.

Comment thread test/unit_homa_timer.c
EXPECT_EQ(0, srpc->silent_ticks);
EXPECT_STREQ("", unit_log_get());
}
#ifndef __STRIP__ /* See strip.py */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to me that this test is in the wrong place in the file. Tests should be isomorphic to the code, so the order of tests for a particular function matches the order of the functionality being tested within that function. Let's discuss.

Comment thread test/unit_homa_offload.c
for (i = 0; i < GRO_HASH_BUCKETS; i++) {
INIT_LIST_HEAD(&self->napi.gro.hash[i].list);
self->napi.gro.hash[i].count = 0;
INIT_LIST_HEAD(&self->napi.gro_hash[i].list);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like maybe you are compiling against a Linux version older than 6.17.8? Let's discuss.

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.

2 participants