From: Toshiaki Makita <toshiaki.makita1@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Cc: "David S . Miller" <davem@davemloft.net>,
Patrick McHardy <kaber@trash.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next] vlan: Add GRO support for non hardware accelerated vlan
Date: Fri, 29 May 2015 23:48:08 +0900 [thread overview]
Message-ID: <55687C28.506@gmail.com> (raw)
In-Reply-To: <1432814539.16878.10.camel@edumazet-glaptop2.roam.corp.google.com>
On 15/05/28 (木) 21:02, Eric Dumazet wrote:
> On Thu, 2015-05-28 at 20:17 +0900, Toshiaki Makita wrote:
>> Currently packets with non-hardware-accelerated vlan cannot be handled
>> by GRO. This causes low performance for 802.1ad and stacked vlan, as their
>> vlan tags are currently not stripped by hardware.
>>
>> This patch adds GRO support for non-hardware-accelerated vlan and
>> improves receive performance of them.
>
> Very nice patch !
>
>>
>> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
>> ---
>> net/8021q/vlan.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 94 insertions(+)
>>
>> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
>> index 59555f0..0a9e8e1 100644
>> --- a/net/8021q/vlan.c
>> +++ b/net/8021q/vlan.c
>> @@ -618,6 +618,90 @@ out:
>> return err;
>> }
>>
>> + vhdr2 = (struct vlan_hdr *)(p->data + off_vlan);
>> + if (memcmp(vhdr, vhdr2, VLAN_HLEN))
>> + NAPI_GRO_CB(p)->same_flow = 0;
>> + }
>
>
> This memcmp() is quite expensive, you better use a helper like :
>
> /* vlan header only guaranteed to be 16bit aligned */
> static bool vlan_hdr_compare(const struct vlan_hdr *h1, const struct vlan_hdr *h2)
> {
> #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
> return *(u32 *)h1 != *(u32 *)h2;
> #else
> return (((__force u32)h1->h_vlan_TCI ^ (__force u32)h2->h_vlan_TCI) |
> ((__force u32)h1->h_vlan_encapsulated_proto ^
> (__force u32)h2->h_vlan_encapsulated_proto)) != 0;
> #endif
> }
Hi Eric,
Thank you for your reviewing.
Indeed, memcmp() is not good for performance.
I'll include your feedback in v2.
Thanks,
Toshiaki Makita
prev parent reply other threads:[~2015-05-29 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 11:17 [PATCH net-next] vlan: Add GRO support for non hardware accelerated vlan Toshiaki Makita
2015-05-28 12:02 ` Eric Dumazet
2015-05-29 14:48 ` Toshiaki Makita [this message]
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=55687C28.506@gmail.com \
--to=toshiaki.makita1@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kaber@trash.net \
--cc=makita.toshiaki@lab.ntt.co.jp \
--cc=netdev@vger.kernel.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 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).