From: Jason Wang <jasowang@redhat.com>
To: "Zhangjie (HZ)" <zhangjie14@huawei.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Qinchuanyu <qinchuanyu@huawei.com>,
Liuyongan <liuyongan@huawei.com>
Subject: Re: [PATCH net-next] Virtio_net: Set dev->needed_headroom to put the header in
Date: Fri, 25 Apr 2014 16:51:25 +0800 [thread overview]
Message-ID: <535A220D.7040101@redhat.com> (raw)
In-Reply-To: <60A73B7A161A82449A7DB7B382BFD1553702849A@SZXEMA504-MBS.china.huawei.com>
On 04/25/2014 11:11 AM, Zhangjie (HZ) wrote:
>
> This patch is a small supplement for Patch “virtio-net: put virtio-net
> header inline with data”.
>
> This patch set dev->needed_headroom for virtio-net device to put
> virtio-net header in.
>
> Currently, TCP packages have enough room, but UDP packages do not.
>
> For UDP packages, sk_buff is alloced in fun __ip_append_data. The size
> equals “alloclen + hh_len + 15”, and “hh_len =
> LL_RESERVED_SPACE(rt->dst.dev);”.
>
> The Macro is defined as follows:
>
> #define LL_RESERVED_SPACE(dev) \
>
> ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1))
> + HH_DATA_MOD)
>
> By default, for UDP packages, after skb is allocated, only 16 bytes
> reserved. And 2 bytes remained after mac header is set. Not enough to
> put virtio-net header in.
>
> If we set dev->needed_headroom to 12 or 10 (according to
> mergeable_rx_bufs is on or off ), more room can be reserved.
>
> Then there is enough room for UDP packages to put the header in.
>
> Here is the patch. J
>
> ------------
>
> From a0192e935855002bb122a373a526fe884173c652 Mon Sep 17 00:00:00 2001
>
> From: ZhangJie <zhangjie14@huawei.com>
>
> Date: Fri, 25 Apr 2014 11:06:27 +0800
>
> Subject: [PATCH] set needed_headroom
>
> ---
>
> drivers/net/virtio_net.c | 7 +++++++
>
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>
> index 7b68746..c95d196 100644
>
> --- a/drivers/net/virtio_net.c
>
> +++ b/drivers/net/virtio_net.c
>
> @@ -1724,6 +1724,13 @@ static int virtnet_probe(struct virtio_device
> *vdev)
>
> if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
>
> vi->has_cvq = true;
>
> + if (vi->any_header_sg) {
>
> + if (vi->mergeable_rx_bufs)
>
> + dev->needed_headroom = sizeof(struct virtio_net_hdr_mrg_rxbuf);
>
> + else
>
> + dev->needed_headroom = sizeof(struct virtio_net_hdr);
>
> + }
>
> +
>
> /* Use single tx/rx queue pair as default */
>
> vi->curr_queue_pairs = 1;
>
> vi->max_queue_pairs = max_queue_pairs;
>
> --
>
> 1.7.10.msysgit.1
>
> --Best Wishes!
>
> //Zhang Jie
>
Hi:
Please submit a formal patch that obeys the rule of
Documentation/SubmittingPatches. Then you verify this by checking
whether or not it was captured by patchwork:
http://patchwork.ozlabs.org/project/netdev/list/.
For this patch, it's better to put your test method and result in the
commit log also.
Thanks
parent reply other threads:[~2014-04-25 8:52 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <60A73B7A161A82449A7DB7B382BFD1553702849A@SZXEMA504-MBS.china.huawei.com>]
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=535A220D.7040101@redhat.com \
--to=jasowang@redhat.com \
--cc=liuyongan@huawei.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=qinchuanyu@huawei.com \
--cc=zhangjie14@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).