mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-29 18:43:59 +00:00
linux/virtio_net.h: Support USO offload in vnet header.
Now, it's possible to convert USO vnet packets from/to skb. Added support for GSO_UDP_L4 offload. Signed-off-by: Andrew Melnychenko <andrew@daynix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
34061b348a
commit
860b7f27b8
1 changed files with 9 additions and 0 deletions
|
@ -15,6 +15,7 @@ static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type)
|
||||||
case VIRTIO_NET_HDR_GSO_TCPV6:
|
case VIRTIO_NET_HDR_GSO_TCPV6:
|
||||||
return protocol == cpu_to_be16(ETH_P_IPV6);
|
return protocol == cpu_to_be16(ETH_P_IPV6);
|
||||||
case VIRTIO_NET_HDR_GSO_UDP:
|
case VIRTIO_NET_HDR_GSO_UDP:
|
||||||
|
case VIRTIO_NET_HDR_GSO_UDP_L4:
|
||||||
return protocol == cpu_to_be16(ETH_P_IP) ||
|
return protocol == cpu_to_be16(ETH_P_IP) ||
|
||||||
protocol == cpu_to_be16(ETH_P_IPV6);
|
protocol == cpu_to_be16(ETH_P_IPV6);
|
||||||
default:
|
default:
|
||||||
|
@ -31,6 +32,7 @@ static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
|
||||||
switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
|
switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
|
||||||
case VIRTIO_NET_HDR_GSO_TCPV4:
|
case VIRTIO_NET_HDR_GSO_TCPV4:
|
||||||
case VIRTIO_NET_HDR_GSO_UDP:
|
case VIRTIO_NET_HDR_GSO_UDP:
|
||||||
|
case VIRTIO_NET_HDR_GSO_UDP_L4:
|
||||||
skb->protocol = cpu_to_be16(ETH_P_IP);
|
skb->protocol = cpu_to_be16(ETH_P_IP);
|
||||||
break;
|
break;
|
||||||
case VIRTIO_NET_HDR_GSO_TCPV6:
|
case VIRTIO_NET_HDR_GSO_TCPV6:
|
||||||
|
@ -69,6 +71,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
|
||||||
ip_proto = IPPROTO_UDP;
|
ip_proto = IPPROTO_UDP;
|
||||||
thlen = sizeof(struct udphdr);
|
thlen = sizeof(struct udphdr);
|
||||||
break;
|
break;
|
||||||
|
case VIRTIO_NET_HDR_GSO_UDP_L4:
|
||||||
|
gso_type = SKB_GSO_UDP_L4;
|
||||||
|
ip_proto = IPPROTO_UDP;
|
||||||
|
thlen = sizeof(struct udphdr);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -182,6 +189,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
|
||||||
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
|
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
|
||||||
else if (sinfo->gso_type & SKB_GSO_TCPV6)
|
else if (sinfo->gso_type & SKB_GSO_TCPV6)
|
||||||
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
|
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
|
||||||
|
else if (sinfo->gso_type & SKB_GSO_UDP_L4)
|
||||||
|
hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP_L4;
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (sinfo->gso_type & SKB_GSO_TCP_ECN)
|
if (sinfo->gso_type & SKB_GSO_TCP_ECN)
|
||||||
|
|
Loading…
Add table
Reference in a new issue