diff options
| author | Ingo Molnar <mingo@kernel.org> | 2018-10-09 08:50:10 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2018-10-09 08:50:10 +0200 |
| commit | fc8eaa85681fa72dc6a4e46f01c92e4fba83d0ab (patch) | |
| tree | b044fab426f2167ceeb37ed6fe58f7f11b10cebd /include/linux/virtio_net.h | |
| parent | 2cc81c6992248ea37d0241bc325977bab310bc3b (diff) | |
| parent | 49e00eee00612b1357596fed8a88b621a7648c14 (diff) | |
Merge branch 'x86/urgent' into x86/cache, to pick up dependent fix
Signed-off-by: Ingo Molnar <mingo@kernel.org>
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) |
