|
@@ -5,6 +5,24 @@
|
|
#include <linux/if_vlan.h>
|
|
#include <linux/if_vlan.h>
|
|
#include <uapi/linux/virtio_net.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,
|
|
static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
|
|
const struct virtio_net_hdr *hdr,
|
|
const struct virtio_net_hdr *hdr,
|
|
bool little_endian)
|
|
bool little_endian)
|