mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 15:58:47 +00:00
virtio: Net header needs hdr_len
It's far easier to deal with packets if we don't have to parse the packet to figure out the header length to know how much to pull into the skb data. Add the field to the virtio_net_hdr struct (and fix the spaces that somehow crept in there). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
24a5ae5d03
commit
50c8ea8080
@ -242,6 +242,7 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skb_is_gso(skb)) {
|
if (skb_is_gso(skb)) {
|
||||||
|
hdr->hdr_len = skb_transport_header(skb) - skb->data;
|
||||||
hdr->gso_size = skb_shinfo(skb)->gso_size;
|
hdr->gso_size = skb_shinfo(skb)->gso_size;
|
||||||
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN)
|
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN)
|
||||||
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4_ECN;
|
hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4_ECN;
|
||||||
@ -255,7 +256,7 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
BUG();
|
BUG();
|
||||||
} else {
|
} else {
|
||||||
hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE;
|
hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE;
|
||||||
hdr->gso_size = 0;
|
hdr->gso_size = hdr->hdr_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vnet_hdr_to_sg(sg, skb);
|
vnet_hdr_to_sg(sg, skb);
|
||||||
|
@ -32,8 +32,9 @@ struct virtio_net_hdr
|
|||||||
#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
|
#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO)
|
||||||
#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
|
#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
|
||||||
__u8 gso_type;
|
__u8 gso_type;
|
||||||
__u16 gso_size;
|
__u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
|
||||||
__u16 csum_start;
|
__u16 gso_size; /* Bytes to append to gso_hdr_len per frame */
|
||||||
__u16 csum_offset;
|
__u16 csum_start; /* Position to start checksumming from */
|
||||||
|
__u16 csum_offset; /* Offset after that to place checksum */
|
||||||
};
|
};
|
||||||
#endif /* _LINUX_VIRTIO_NET_H */
|
#endif /* _LINUX_VIRTIO_NET_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user