Skip to content

Commit 3933d20

Browse files
Pass IPv6 TCP packets to tcp6 gro_receive in homa_hijack_gro_receive
* homa_hijack_gro_receive is installed for both inet_offloads and inet6_offloads, but always passed non-Homa packets to the IPv4 TCP gro_receive, so IPv6 TCP packets went through tcp4_gro_receive (which treats the IPv6 header as an iphdr). homa_hijack_init runs at module load, so this affects all IPv6 TCP traffic. * Use the saved tcp6_net_offload for IPv6 packets. * Pin the existing pass-through test to IPv4 (it relied on the default) and add an IPv6 one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 4bd0275 commit 3933d20

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

‎homa_hijack.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ struct sk_buff *homa_hijack_gro_receive(struct list_head *held_list,
7676
// tt_record4("homa_hijack_gro_receive got type 0x%x, flags 0x%x, "
7777
// "urgent 0x%x, id %d", h->type, h->flags,
7878
// ntohs(h->urgent), homa_local_id(h->sender_id));
79-
if (!homa_skb_hijacked(skb))
80-
return tcp_net_offload->callbacks.gro_receive(held_list, skb);
79+
if (!homa_skb_hijacked(skb)) {
80+
const struct net_offload *tcp_offload = skb_is_ipv6(skb) ?
81+
tcp6_net_offload : tcp_net_offload;
82+
83+
return tcp_offload->callbacks.gro_receive(held_list, skb);
84+
}
8185

8286
/* Change the packet's IP protocol to Homa so that it will get
8387
* dispatched directly to Homa in the future.

‎test/unit_homa_hijack.c‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ TEST_F(homa_hijack, homa_hijack_init)
9797
inet6_offloads[IPPROTO_TCP]->callbacks.gro_receive);
9898
}
9999

100-
TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp)
100+
TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp_ipv4)
101101
{
102102
struct homa_common_hdr *h;
103103
struct sk_buff *skb;
104104

105+
mock_ipv6 = false;
105106
homa_hijack_init();
106107
self->header.seg.offset = htonl(6000);
107108
skb = mock_skb_alloc(&self->src_ip, &self->dst_ip,
@@ -122,6 +123,22 @@ TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp)
122123
kfree_skb(skb);
123124
homa_hijack_end();
124125
}
126+
TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp_ipv6)
127+
{
128+
struct homa_common_hdr *h;
129+
struct sk_buff *skb;
130+
131+
mock_ipv6 = true;
132+
homa_hijack_init();
133+
skb = mock_skb_alloc(&self->src_ip, &self->dst_ip,
134+
&self->header.common, 1400, 0);
135+
h = (struct homa_common_hdr *)skb_transport_header(skb);
136+
h->flags = 0;
137+
EXPECT_EQ(NULL, homa_hijack_gro_receive(&self->empty_list, skb));
138+
EXPECT_STREQ("unit_tcp6_gro_receive", unit_log_get());
139+
kfree_skb(skb);
140+
homa_hijack_end();
141+
}
125142
TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_homa_ipv6)
126143
{
127144
struct homa_common_hdr *h;

0 commit comments

Comments
 (0)