Skip to contentSkip to conversation

IPv6 UFO for VMs

DISCUSSION Ben Hutchings 2 participants 5 messages Oct 21, 2014 – Oct 27, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

There are several ways that VMs can take advantage of UFO and get the host to do fragmentation for them:

drivers/net/macvtap.c:                  gso_type = SKB_GSO_UDP;
drivers/net/tun.c:                      skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
drivers/net/virtio_net.c:                       skb_shinfo(skb)->gso_type = SKB_GSO_UDP;

Our implementation of UFO for IPv6 does:

		fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
		fptr->nexthdr = nexthdr;
		fptr->reserved = 0;
		fptr->identification = skb_shinfo(skb)->ip6_frag_id;

which assumes ip6_frag_id has been set. That's only true if the local stack constructed the skb; otherwise it appears we get zero.

This seems to be a regression as a result of:

commit 916e4cf46d0204806c062c8c6c4d1f633852c5b6

Author: Hannes Frederic Sowa <[email protected]>
Date:   Fri Feb 21 02:55:35 2014 +0100

ipv6: reuse ip6_frag_id from ip6_ufo_append_data

However, that change seems reasonable - we *shouldn't* be choosing IDs for any other stack. Any paravirt net driver that can use IPv6 UFO needs to have some way of passing a fragmentation ID to put in skb_shared_info::ip6_frag_id.

Ben.

Signature · 2 lines
Ben Hutchings
For every action, there is an equal and opposite criticism. - Harrison

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#1 lore raw
Quoted 23 lines · Ben Hutchings

There are several ways that VMs can take advantage of UFO and get the host to do fragmentation for them:

drivers/net/macvtap.c:                  gso_type = SKB_GSO_UDP;
drivers/net/tun.c:                      skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
drivers/net/virtio_net.c:                       skb_shinfo(skb)->gso_type = SKB_GSO_UDP;

Our implementation of UFO for IPv6 does:

		fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
		fptr->nexthdr = nexthdr;
		fptr->reserved = 0;
		fptr->identification = skb_shinfo(skb)->ip6_frag_id;

which assumes ip6_frag_id has been set. That's only true if the local stack constructed the skb; otherwise it appears we get zero.

This seems to be a regression as a result of:

commit 916e4cf46d0204806c062c8c6c4d1f633852c5b6

Author: Hannes Frederic Sowa <[email protected]>
Date:   Fri Feb 21 02:55:35 2014 +0100
Quoted 6 lines

ipv6: reuse ip6_frag_id from ip6_ufo_append_data

However, that change seems reasonable - we *shouldn't* be choosing IDs for any other stack. Any paravirt net driver that can use IPv6 UFO needs to have some way of passing a fragmentation ID to put in skb_shared_info::ip6_frag_id.

Do we really gain a lot of performance by enabling UFO on those devices or would it make sense to just drop support? It only helps fragmenting large UDP packets, so I don't think it is worth it.

Otherwise I agree with Ben, we need to pass a fragmentation id from the host over to the system segmenting the gso frame. Fragmentation ids must be generated by the end system.

Hmm...

Bye,
Hannes

#2 lore raw
In reply to Ben Hutchings
Quoted 23 lines · Ben Hutchings

There are several ways that VMs can take advantage of UFO and get the host to do fragmentation for them:

drivers/net/macvtap.c:                  gso_type = SKB_GSO_UDP;
drivers/net/tun.c:                      skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
drivers/net/virtio_net.c:                       skb_shinfo(skb)->gso_type = SKB_GSO_UDP;

Our implementation of UFO for IPv6 does:

		fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
		fptr->nexthdr = nexthdr;
		fptr->reserved = 0;
		fptr->identification = skb_shinfo(skb)->ip6_frag_id;

which assumes ip6_frag_id has been set. That's only true if the local stack constructed the skb; otherwise it appears we get zero.

This seems to be a regression as a result of:

commit 916e4cf46d0204806c062c8c6c4d1f633852c5b6

Author: Hannes Frederic Sowa <[email protected]>
Date:   Fri Feb 21 02:55:35 2014 +0100
Quoted 6 lines

ipv6: reuse ip6_frag_id from ip6_ufo_append_data

However, that change seems reasonable - we *shouldn't* be choosing IDs for any other stack. Any paravirt net driver that can use IPv6 UFO needs to have some way of passing a fragmentation ID to put in skb_shared_info::ip6_frag_id.

Do we really gain a lot of performance by enabling UFO on those devices or would it make sense to just drop support? It only helps fragmenting large UDP packets, so I don't think it is worth it.

Otherwise I agree with Ben, we need to pass a fragmentation id from the host over to the system segmenting the gso frame. Fragmentation ids must be generated by the end system.

Hmm...

Bye,
Hannes

#3 lore raw
Quoted 26 lines · Hannes Frederic Sowa
Quoted 25 lines · Ben Hutchings

There are several ways that VMs can take advantage of UFO and get the host to do fragmentation for them:

drivers/net/macvtap.c:                  gso_type = SKB_GSO_UDP;
drivers/net/tun.c:                      skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
drivers/net/virtio_net.c:                       skb_shinfo(skb)->gso_type = SKB_GSO_UDP;

Our implementation of UFO for IPv6 does:

		fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
		fptr->nexthdr = nexthdr;
		fptr->reserved = 0;
		fptr->identification = skb_shinfo(skb)->ip6_frag_id;

which assumes ip6_frag_id has been set. That's only true if the local stack constructed the skb; otherwise it appears we get zero.

This seems to be a regression as a result of:

commit 916e4cf46d0204806c062c8c6c4d1f633852c5b6

Author: Hannes Frederic Sowa <[email protected]>
Date:   Fri Feb 21 02:55:35 2014 +0100

ipv6: reuse ip6_frag_id from ip6_ufo_append_data

Quoted 8 lines
Quoted 4 lines

However, that change seems reasonable - we *shouldn't* be choosing IDs for any other stack. Any paravirt net driver that can use IPv6 UFO needs to have some way of passing a fragmentation ID to put in skb_shared_info::ip6_frag_id.

Do we really gain a lot of performance by enabling UFO on those devices or would it make sense to just drop support? It only helps fragmenting large UDP packets, so I don't think it is worth it.

It's not been important enough for anyone to bother implementing it in hardware/firmware aside from Neterion.

I'll shortly post patches to disable it.

Ben.

Quoted 5 lines

Otherwise I agree with Ben, we need to pass a fragmentation id from the host over to the system segmenting the gso frame. Fragmentation ids must be generated by the end system.

Hmm...

Signature · 3 lines
Ben Hutchings
Theory and practice are closer in theory than in practice.
                                - John Levine, moderator of comp.compilers

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#4 lore raw
In reply to Hannes Frederic Sowa
Quoted 26 lines · Hannes Frederic Sowa
Quoted 25 lines · Ben Hutchings

There are several ways that VMs can take advantage of UFO and get the host to do fragmentation for them:

drivers/net/macvtap.c:                  gso_type = SKB_GSO_UDP;
drivers/net/tun.c:                      skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
drivers/net/virtio_net.c:                       skb_shinfo(skb)->gso_type = SKB_GSO_UDP;

Our implementation of UFO for IPv6 does:

		fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
		fptr->nexthdr = nexthdr;
		fptr->reserved = 0;
		fptr->identification = skb_shinfo(skb)->ip6_frag_id;

which assumes ip6_frag_id has been set. That's only true if the local stack constructed the skb; otherwise it appears we get zero.

This seems to be a regression as a result of:

commit 916e4cf46d0204806c062c8c6c4d1f633852c5b6

Author: Hannes Frederic Sowa <[email protected]>
Date:   Fri Feb 21 02:55:35 2014 +0100

ipv6: reuse ip6_frag_id from ip6_ufo_append_data

Quoted 8 lines
Quoted 4 lines

However, that change seems reasonable - we *shouldn't* be choosing IDs for any other stack. Any paravirt net driver that can use IPv6 UFO needs to have some way of passing a fragmentation ID to put in skb_shared_info::ip6_frag_id.

Do we really gain a lot of performance by enabling UFO on those devices or would it make sense to just drop support? It only helps fragmenting large UDP packets, so I don't think it is worth it.

It's not been important enough for anyone to bother implementing it in hardware/firmware aside from Neterion.

I'll shortly post patches to disable it.

Ben.

Quoted 5 lines

Otherwise I agree with Ben, we need to pass a fragmentation id from the host over to the system segmenting the gso frame. Fragmentation ids must be generated by the end system.

Hmm...

Signature · 3 lines
Ben Hutchings
Theory and practice are closer in theory than in practice.
                                - John Levine, moderator of comp.compilers