VirtioNet L3 protocol patch advice request.
flat view
From: Andrew Melnichenko <hidden>
Date: 2021-10-29 10:51:43
Hi all, Recently I've discovered a patch that added an additional check for the protocol in VirtioNet. (https://www.spinics.net/lists/kernel/msg3866319.html) Currently, that patch breaks UFOv6 support and possible USOv6 support in upcoming patches. The issue is the code next to the patch expects failure of skb_flow_dissect_flow_keys_basic() for IPv6 packets to retry it with protocol IPv6. I'm not sure about the goals of the patch and propose the next solution: static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
const struct virtio_net_hdr *hdr)
{
__be16 protocol;
protocol = dev_parse_header_protocol(skb);
switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
case VIRTIO_NET_HDR_GSO_TCPV4:
skb->protocol = cpu_to_be16(ETH_P_IP);
break;
case VIRTIO_NET_HDR_GSO_TCPV6:
skb->protocol = cpu_to_be16(ETH_P_IPV6);
break;
case VIRTIO_NET_HDR_GSO_UDP:
case VIRTIO_NET_HDR_GSO_UDP_L4:
skb->protocol = protocol;
default:
return -EINVAL;
}
return protocol && protocol == skb->protocol ? 0 : -EINVAL;
}
And in virtio_net_hdr_to_skb():
if (!skb->protocol) { if(virtio_net_hdr_set_proto(skb, hdr))
return -EINVAL;
}
if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
NULL, 0, 0, 0,
0)) {
return -EINVAL;
}Would such changes suit the goals of the initial patch?