diff --git a/homa_plumbing.c b/homa_plumbing.c index 65109a05..7667ce18 100644 --- a/homa_plumbing.c +++ b/homa_plumbing.c @@ -1677,11 +1677,15 @@ int homa_softirq(struct sk_buff *skb) * skb_shinfo(skb)->frag_list by the Homa GRO mechanism. Make a * pass through the list to process all of the short packets, * leaving the longer packets in the list. Also, perform various - * prep/cleanup/error checking functions. + * prep/cleanup/error checking functions. IP reassembly can also + * leave a frag_list, but in that case the frag_list is part of + * this packet (its length is included in skb->len), so leave it. */ tt_record("homa_softirq starting"); - skb->next = skb_shinfo(skb)->frag_list; - skb_shinfo(skb)->frag_list = NULL; + if (skb->len == skb_pagelen(skb)) { + skb->next = skb_shinfo(skb)->frag_list; + skb_shinfo(skb)->frag_list = NULL; + } packets = skb; prev_link = &packets; for (skb = packets; skb; skb = next) { diff --git a/test/unit_homa_plumbing.c b/test/unit_homa_plumbing.c index f99bd551..099a3577 100644 --- a/test/unit_homa_plumbing.c +++ b/test/unit_homa_plumbing.c @@ -1767,6 +1767,32 @@ TEST_F(homa_plumbing, homa_softirq__per_rpc_batching) "sk->sk_data_ready invoked", unit_log_get()); } +TEST_F(homa_plumbing, homa_softirq__frag_list_from_ip_reassembly) +{ + struct sk_buff *skb, *skb2; + struct homa_rpc *srpc; + + /* skb2 has a Homa header, but it is just payload in the + * reassembled packet, so it must not be processed separately. + */ + self->data.common.sender_id = cpu_to_be64(5000); + skb2 = mock_skb_alloc(self->client_ip, self->server_ip, + &self->data.common, 400, 0); + skb2->dev = NULL; + self->data.common.sender_id = cpu_to_be64(self->client_id); + skb = mock_skb_alloc(self->client_ip, self->server_ip, + &self->data.common, 1000, 0); + skb_shinfo(skb)->frag_list = skb2; + skb->len += skb2->len; + skb->data_len += skb2->len; + homa_softirq(skb); + unit_log_clear(); + unit_log_active_ids(&self->hsk); + EXPECT_STREQ("1235", unit_log_get()); + srpc = list_first_entry(&self->hsk.active_rpcs, struct homa_rpc, + active_links); + EXPECT_EQ(10000 - 1000 - skb2->len, srpc->msgin.bytes_remaining); +} TEST_F(homa_plumbing, homa_err_handler_v4__port_unreachable) {