Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions homa_hijack.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ struct sk_buff *homa_hijack_gro_receive(struct list_head *held_list,
// tt_record4("homa_hijack_gro_receive got type 0x%x, flags 0x%x, "
// "urgent 0x%x, id %d", h->type, h->flags,
// ntohs(h->urgent), homa_local_id(h->sender_id));
if (!homa_skb_hijacked(skb))
return tcp_net_offload->callbacks.gro_receive(held_list, skb);
if (!homa_skb_hijacked(skb)) {
const struct net_offload *tcp_offload = skb_is_ipv6(skb) ?
tcp6_net_offload : tcp_net_offload;

return tcp_offload->callbacks.gro_receive(held_list, skb);
}

/* Change the packet's IP protocol to Homa so that it will get
* dispatched directly to Homa in the future.
Expand Down
19 changes: 18 additions & 1 deletion test/unit_homa_hijack.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ TEST_F(homa_hijack, homa_hijack_init)
inet6_offloads[IPPROTO_TCP]->callbacks.gro_receive);
}

TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp)
TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp_ipv4)
{
struct homa_common_hdr *h;
struct sk_buff *skb;

mock_ipv6 = false;
homa_hijack_init();
self->header.seg.offset = htonl(6000);
skb = mock_skb_alloc(&self->src_ip, &self->dst_ip,
Expand All @@ -122,6 +123,22 @@ TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp)
kfree_skb(skb);
homa_hijack_end();
}
TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_tcp_ipv6)
{
struct homa_common_hdr *h;
struct sk_buff *skb;

mock_ipv6 = true;
homa_hijack_init();
skb = mock_skb_alloc(&self->src_ip, &self->dst_ip,
&self->header.common, 1400, 0);
h = (struct homa_common_hdr *)skb_transport_header(skb);
h->flags = 0;
EXPECT_EQ(NULL, homa_hijack_gro_receive(&self->empty_list, skb));
EXPECT_STREQ("unit_tcp6_gro_receive", unit_log_get());
kfree_skb(skb);
homa_hijack_end();
}
TEST_F(homa_hijack, homa_hijack_gro_receive__pass_to_homa_ipv6)
{
struct homa_common_hdr *h;
Expand Down