Skip to content

Commit 860b7f2

Browse files
AndrewAtDaynixdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 34061b3 commit 860b7f2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/linux/virtio_net.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type)
1515
case VIRTIO_NET_HDR_GSO_TCPV6:
1616
return protocol == cpu_to_be16(ETH_P_IPV6);
1717
case VIRTIO_NET_HDR_GSO_UDP:
18+
case VIRTIO_NET_HDR_GSO_UDP_L4:
1819
return protocol == cpu_to_be16(ETH_P_IP) ||
1920
protocol == cpu_to_be16(ETH_P_IPV6);
2021
default:
@@ -31,6 +32,7 @@ static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
3132
switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
3233
case VIRTIO_NET_HDR_GSO_TCPV4:
3334
case VIRTIO_NET_HDR_GSO_UDP:
35+
case VIRTIO_NET_HDR_GSO_UDP_L4:
3436
skb->protocol = cpu_to_be16(ETH_P_IP);
3537
break;
3638
case VIRTIO_NET_HDR_GSO_TCPV6:
@@ -69,6 +71,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
6971
ip_proto = IPPROTO_UDP;
7072
thlen = sizeof(struct udphdr);
7173
break;
74+
case VIRTIO_NET_HDR_GSO_UDP_L4:
75+
gso_type = SKB_GSO_UDP_L4;
76+
ip_proto = IPPROTO_UDP;
77+
thlen = sizeof(struct udphdr);
78+
break;
7279
default:
7380
return -EINVAL;
7481
}
@@ -182,6 +189,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
182189
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
183190
else if (sinfo->gso_type & SKB_GSO_TCPV6)
184191
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
192+
else if (sinfo->gso_type & SKB_GSO_UDP_L4)
193+
hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP_L4;
185194
else
186195
return -EINVAL;
187196
if (sinfo->gso_type & SKB_GSO_TCP_ECN)

0 commit comments

Comments
 (0)