]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
virtio: Net header needs hdr_len
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 5 Feb 2008 04:50:01 +0000 (23:50 -0500)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 4 Feb 2008 12:50:02 +0000 (23:50 +1100)
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>
drivers/net/virtio_net.c
include/linux/virtio_net.h

index 7b0059f0f5d4f64d310964886a5ea0f9aabd04c5..3492ae0951decca6d714951c3a2e2cdaf911aecd 100644 (file)
@@ -242,6 +242,7 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        if (skb_is_gso(skb)) {
+               hdr->hdr_len = skb_transport_header(skb) - skb->data;
                hdr->gso_size = skb_shinfo(skb)->gso_size;
                if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_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();
        } else {
                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);
index 6e8fdfea8cd0df14c56776ed4bb1d237630291ad..1456f7b936d0eb699d00c75223bf1636bf8de6d3 100644 (file)
@@ -24,16 +24,17 @@ struct virtio_net_config
 struct virtio_net_hdr
 {
 #define VIRTIO_NET_HDR_F_NEEDS_CSUM    1       // Use csum_start, csum_offset
-      __u8 flags;
+       __u8 flags;
 #define VIRTIO_NET_HDR_GSO_NONE                0       // Not a GSO frame
 #define VIRTIO_NET_HDR_GSO_TCPV4       1       // GSO frame, IPv4 TCP (TSO)
 /* FIXME: Do we need this?  If they said they can handle ECN, do they care? */
 #define VIRTIO_NET_HDR_GSO_TCPV4_ECN   2       // GSO frame, IPv4 TCP w/ ECN
 #define VIRTIO_NET_HDR_GSO_UDP         3       // GSO frame, IPv4 UDP (UFO)
 #define VIRTIO_NET_HDR_GSO_TCPV6       4       // GSO frame, IPv6 TCP
-      __u8 gso_type;
-      __u16 gso_size;
-      __u16 csum_start;
-      __u16 csum_offset;
+       __u8 gso_type;
+       __u16 hdr_len;          /* Ethernet + IP + tcp/udp hdrs */
+       __u16 gso_size;         /* Bytes to append to gso_hdr_len per frame */
+       __u16 csum_start;       /* Position to start checksumming from */
+       __u16 csum_offset;      /* Offset after that to place checksum */
 };
 #endif /* _LINUX_VIRTIO_NET_H */