|
@@ -58,7 +58,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
|
|
|
static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
|
|
|
struct virtio_net_hdr *hdr,
|
|
|
bool little_endian,
|
|
|
- bool has_data_valid)
|
|
|
+ bool has_data_valid,
|
|
|
+ int vlan_hlen)
|
|
|
{
|
|
|
memset(hdr, 0, sizeof(*hdr)); /* no info leak */
|
|
|
|
|
@@ -83,12 +84,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
|
|
|
|
|
|
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
|
|
hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
|
|
|
- if (skb_vlan_tag_present(skb))
|
|
|
- hdr->csum_start = __cpu_to_virtio16(little_endian,
|
|
|
- skb_checksum_start_offset(skb) + VLAN_HLEN);
|
|
|
- else
|
|
|
- hdr->csum_start = __cpu_to_virtio16(little_endian,
|
|
|
- skb_checksum_start_offset(skb));
|
|
|
+ hdr->csum_start = __cpu_to_virtio16(little_endian,
|
|
|
+ skb_checksum_start_offset(skb) + vlan_hlen);
|
|
|
hdr->csum_offset = __cpu_to_virtio16(little_endian,
|
|
|
skb->csum_offset);
|
|
|
} else if (has_data_valid &&
|