diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2018-10-11 23:07:30 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-10-11 23:07:30 +0200 |
commit | 90fb814b6c025da45f71db1703cffe3fe87f575c (patch) | |
tree | 5fd739d407654df6f9d6e82900a45e027dd8b9f0 /include/linux/virtio_net.h | |
parent | b30f2f65568f840e5ca522d98ba2ad73b8f59cde (diff) | |
parent | 0238df646e6224016a45505d2c111a24669ebe21 (diff) |
Merge tag 'v4.19-rc7' into i2c/for-4.20
This is the 4.19-rc7 release
Diffstat (limited to 'include/linux/virtio_net.h')
-rw-r--r-- | include/linux/virtio_net.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 9397628a1967..cb462f9ab7dd 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -5,6 +5,24 @@ #include <linux/if_vlan.h> #include <uapi/linux/virtio_net.h> +static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, + const struct virtio_net_hdr *hdr) +{ + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + case VIRTIO_NET_HDR_GSO_TCPV4: + case VIRTIO_NET_HDR_GSO_UDP: + skb->protocol = cpu_to_be16(ETH_P_IP); + break; + case VIRTIO_NET_HDR_GSO_TCPV6: + skb->protocol = cpu_to_be16(ETH_P_IPV6); + break; + default: + return -EINVAL; + } + + return 0; +} + static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, const struct virtio_net_hdr *hdr, bool little_endian) |