Re: [PATCH 1/1] Defer skb allocation for both mergeable buffers and big packets in virtio_net

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Rusty Russell
Date: Monday, November 23, 2009 - 3:24 pm

On Tue, 24 Nov 2009 02:37:01 am Shirley Ma wrote:

Hi Shirley,

   Looks like buf is a void *, so no cast should be necessary.  But I could
be reading the patch wrong.


It's a qemu bug.  It insists the header be an element in the scatterlist by
itself.  Unfortunately we have to accommodate it.

However, there's no reason for the merged rxbuf and big packet layout to be
the same: for the big packet case you should layout as follows:

#define BIG_PACKET_PAD (NET_SKB_PAD - sizeof(struct virtio_net_hdr) + NET_IP_ALIGN)
struct big_packet_page {
	struct virtio_net_hdr hdr;
	char pad[BIG_PACKET_PAD];
	/* Actual packet data starts here */
	unsigned char data[PAGE_SIZE - BIG_PACKET_PAD - sizeof(struct virtio_net_hdr)];
};

Then use this type as the template for registering the sg list for the
big packet case.


Yes, that has to stay inside, but the memcpy can move out.  It's just a bit
neater to have more common code.

Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/1] Defer skb allocation for both mergeable bu ..., Michael S. Tsirkin, (Mon Nov 23, 2:43 am)
Re: [PATCH 1/1] Defer skb allocation for both mergeable bu ..., Rusty Russell, (Mon Nov 23, 3:24 pm)
Re: [PATCH 1/1] Defer skb allocation for both mergeable bu ..., Michael S. Tsirkin, (Tue Nov 24, 4:37 am)
Re: [PATCH 1/1] Defer skb allocation for both mergeable bu ..., Michael S. Tsirkin, (Tue Nov 24, 9:04 am)
Re: [PATCH 1/1] Defer skb allocation for both mergeable bu ..., Michael S. Tsirkin, (Tue Nov 24, 9:04 am)
Re: [PATCH 1/1] Defer skb allocation for both mergeable bu ..., Michael S. Tsirkin, (Wed Nov 25, 2:15 am)
Re: [PATCH 1/1] Defer skb allocation for both mergeable bu ..., Michael S. Tsirkin, (Wed Nov 25, 4:40 am)