From: Rusty Russell <rusty@rustcorp.com.au>
To: Michael Dalton <mwdalton@google.com>,
"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Daniel Borkmann <dborkman@redhat.com>,
virtualization@lists.linux-foundation.org,
Michael Dalton <mwdalton@google.com>
Subject: Re: [PATCH net-next] virtio_net: migrate mergeable rx buffers to page frag allocators
Date: Tue, 29 Oct 2013 12:21:56 +1030 [thread overview]
Message-ID: <87ppqoetdv.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1383000258-1458-1-git-send-email-mwdalton@google.com>
Michael Dalton <mwdalton@google.com> writes:
> The virtio_net driver's mergeable receive buffer allocator
> uses 4KB packet buffers. For MTU-sized traffic, SKB truesize
> is > 4KB but only ~1500 bytes of the buffer is used to store
> packet data, reducing the effective TCP window size
> substantially. This patch addresses the performance concerns
> with mergeable receive buffers by allocating MTU-sized packet
> buffers using page frag allocators. If more than MAX_SKB_FRAGS
> buffers are needed, the SKB frag_list is used.
>
> Signed-off-by: Michael Dalton <mwdalton@google.com>
Hi Michael,
Nice work! Just one comment. Your patch highlights the
anachronistic name MAX_PACKET_LEN: it was from the original
implementation which only supported 1500 byte packets, and only used in
one place.
Please apply a first patch like this, then come up with a new constant
name (GOOD_PACKET_LEN?) for that value. Because it's not the maximum
packet we can receive for mergable buffers.
Thanks,
Rusty.
Subject: virtio_net: remove anachronistic MAX_PACKET_LEN constant.
From: Rusty Russell <rusty@rustcorp.com.au>
The initial implementation of virtio_net only allowed ethernet-style
MTU packets; with more recent features this isn't true. Move the
constant into the function where it's used.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 057ea13..dcbfccd 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -35,8 +35,6 @@ static bool csum = true, gso = true;
module_param(csum, bool, 0444);
module_param(gso, bool, 0444);
-/* FIXME: MTU in config. */
-#define MAX_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
#define GOOD_COPY_LEN 128
#define VIRTNET_DRIVER_VERSION "1.0.0"
@@ -434,12 +432,13 @@ static int add_recvbuf_small(struct receive_queue *rq, gfp_t gfp)
struct sk_buff *skb;
struct skb_vnet_hdr *hdr;
int err;
+ const int len = ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN;
- skb = __netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN, gfp);
+ skb = __netdev_alloc_skb_ip_align(vi->dev, len, gfp);
if (unlikely(!skb))
return -ENOMEM;
- skb_put(skb, MAX_PACKET_LEN);
+ skb_put(skb, len);
hdr = skb_vnet_hdr(skb);
sg_set_buf(rq->sg, &hdr->hdr, sizeof hdr->hdr);
next prev parent reply other threads:[~2013-10-29 1:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-28 22:44 [PATCH net-next] virtio_net: migrate mergeable rx buffers to page frag allocators Michael Dalton
2013-10-28 23:19 ` Eric Dumazet
2013-10-29 3:57 ` David Miller
2013-10-29 19:12 ` Michael S. Tsirkin
2013-10-29 7:30 ` Daniel Borkmann
2013-10-29 7:30 ` Daniel Borkmann
2013-10-29 1:51 ` Rusty Russell
2013-10-29 1:51 ` Rusty Russell [this message]
2013-10-29 6:27 ` Jason Wang
2013-10-29 18:44 ` Eric Northup
2013-10-29 19:05 ` Michael Dalton
2013-10-29 19:05 ` Michael Dalton
2013-10-29 19:17 ` Michael S. Tsirkin
2013-10-30 4:41 ` Jason Wang
2013-10-29 19:05 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2013-10-28 22:44 Michael Dalton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ppqoetdv.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=edumazet@google.com \
--cc=mst@redhat.com \
--cc=mwdalton@google.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.