|
@@ -56,7 +56,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,
|
|
static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
|
|
struct virtio_net_hdr *hdr,
|
|
struct virtio_net_hdr *hdr,
|
|
- bool little_endian)
|
|
|
|
|
|
+ bool little_endian,
|
|
|
|
+ bool has_data_valid)
|
|
{
|
|
{
|
|
memset(hdr, 0, sizeof(*hdr)); /* no info leak */
|
|
memset(hdr, 0, sizeof(*hdr)); /* no info leak */
|
|
|
|
|
|
@@ -91,6 +92,9 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
|
|
skb_checksum_start_offset(skb));
|
|
skb_checksum_start_offset(skb));
|
|
hdr->csum_offset = __cpu_to_virtio16(little_endian,
|
|
hdr->csum_offset = __cpu_to_virtio16(little_endian,
|
|
skb->csum_offset);
|
|
skb->csum_offset);
|
|
|
|
+ } else if (has_data_valid &&
|
|
|
|
+ skb->ip_summed == CHECKSUM_UNNECESSARY) {
|
|
|
|
+ hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
|
|
} /* else everything is zero */
|
|
} /* else everything is zero */
|
|
|
|
|
|
return 0;
|
|
return 0;
|