Skip to content

Commit

Permalink
Priorities weren't handled correctly for IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
johnousterhout committed Nov 3, 2022
1 parent a205041 commit e2e52d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion homa_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct sk_buff *homa_gro_receive(struct list_head *held_list,
int priority;
__u32 saddr;
if (skb_is_ipv6(skb)) {
priority = ((struct ipv6hdr *) skb_network_header(skb))->priority;
priority = ipv6_hdr(skb)->priority;
saddr = ntohl(ipv6_hdr(skb)->saddr.in6_u.u6_addr32[3]);
} else {
priority = ((struct iphdr *) skb_network_header(skb))->tos >> 5;
Expand Down
12 changes: 6 additions & 6 deletions homa_outgoing.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,14 @@ int __homa_xmit_control(void *contents, size_t length, struct homa_peer *peer,
extra_bytes);
}
priority = hsk->homa->num_priorities-1;
set_priority(skb, hsk, priority);
skb->ooo_okay = 1;
skb_get(skb);
if (hsk->inet.sk.sk_family == AF_INET6) {
result = ip6_xmit(&hsk->inet.sk, skb, &peer->flow.u.ip6, 0,
NULL, 0, priority);
NULL, hsk->homa->priority_map[priority] << 4, 0);
} else {
/* This will find its way to the DSCP field in the IPv4 hdr. */
hsk->inet.tos = hsk->homa->priority_map[priority]<<5;
result = ip_queue_xmit(&hsk->inet.sk, skb, &peer->flow);
}
if (unlikely(result != 0)) {
Expand Down Expand Up @@ -446,8 +447,6 @@ void __homa_xmit_data(struct sk_buff *skb, struct homa_rpc *rpc, int priority)
skb_transport_header(skb);
struct dst_entry *dst;

set_priority(skb, rpc->hsk, priority);

/* Update info that may have changed since the message was initially
* created.
*/
Expand All @@ -466,15 +465,16 @@ void __homa_xmit_data(struct sk_buff *skb, struct homa_rpc *rpc, int priority)
"offset %d",
skb->len, tt_addr(rpc->peer->addr), rpc->id,
ntohl(h->seg.offset));

err = ip6_xmit(&rpc->hsk->inet.sk, skb, &rpc->peer->flow.u.ip6,
0, NULL, 0, priority);
0, NULL,
rpc->hsk->homa->priority_map[priority] << 4, 0);
} else {
tt_record4("calling ip_queue_xmit: skb->len %d, peer 0x%x, "
"id %d, offset %d",
skb->len, tt_addr(rpc->peer->addr), rpc->id,
htonl(h->seg.offset));

rpc->hsk->inet.tos = rpc->hsk->homa->priority_map[priority]<<5;
err = ip_queue_xmit(&rpc->hsk->inet.sk, skb, &rpc->peer->flow);
}
tt_record4("Finished queueing packet: rpc id %llu, offset %d, len %d, "
Expand Down
2 changes: 1 addition & 1 deletion test/mock.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
mock_xmit_prios_offset += snprintf(
mock_xmit_prios + mock_xmit_prios_offset,
sizeof(mock_xmit_prios) - mock_xmit_prios_offset,
"%s%d", prefix, ((struct inet_sock *) sk)->tos>>5);
"%s%d", prefix, tclass >> 4);
if (mock_xmit_log_verbose)
homa_print_packet(skb, buffer, sizeof(buffer));
else
Expand Down

0 comments on commit e2e52d9

Please sign in to comment.