All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ding Tianhong <dingtianhong@huawei.com>
To: Joe Perches <joe@perches.com>
Cc: Patrick McHardy <kaber@trash.net>,
	"David S. Miller" <davem@davemloft.net>,
	Julia Lawall <julia.lawall@lip6.fr>,
	Netdev <netdev@vger.kernel.org>, Jiri Pirko <jpirko@redhat.com>
Subject: Re: [PATCH net-next] vlan: use ether_addr_equal_64bits to instead of ether_addr_equal
Date: Mon, 3 Mar 2014 14:05:15 +0800	[thread overview]
Message-ID: <53141B9B.40404@huawei.com> (raw)
In-Reply-To: <1393821407.13719.65.camel@joe-AO722>

On 2014/3/3 12:36, Joe Perches wrote:
> (adding Jiri Pirko to cc's)
> 
> On Mon, 2014-03-03 at 10:49 +0800, Ding Tianhong wrote:
>> On 2014/3/3 9:49, Joe Perches wrote:
>>> On Mon, 2014-03-03 at 09:14 +0800, Ding Tianhong wrote:
>>>> Ether_addr_equal_64bits is more efficient than ether_addr_equal, and
>>>> can be used when each argument is an array within a structure that
>>>> contains at least two bytes of data beyond the array, so it is safe
>>>> to use it for vlan.
>>> []
>>>> diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
>>> []
>>>> @@ -26,7 +26,7 @@ bool vlan_do_receive(struct sk_buff **skbp)
>>>>  		/* Our lower layer thinks this is not local, let's make sure.
>>>>  		 * This allows the VLAN to have a different MAC than the
>>>>  		 * underlying device, and still route correctly. */
>>>> -		if (ether_addr_equal(eth_hdr(skb)->h_dest, vlan_dev->dev_addr))
>>>> +		if (ether_addr_equal_64bits(eth_hdr(skb)->h_dest, vlan_dev->dev_addr))
>>>>  			skb->pkt_type = PACKET_HOST;
>>>>  	}
>>>
>>> Hi again Ding
>>>
>>> If you do have performance numbers:
>>>
>>> The lines above this ether_addr_equal_64 are:
>>>
>>> 	if (skb->pkt_type == PACKET_OTHERHOST) {
>>> 		/* Our lower layer thinks this is not local, let's make sure.
>>> 		 * This allows the VLAN to have a different MAC than the
>>> 		 * underlying device, and still route correctly. */
>>> 		if (ether_addr_equal(eth_hdr(skb)->h_dest, vlan_dev->dev_addr))
>>> 			skb->pkt_type = PACKET_HOST;
>>> 	}
>>>
>>> Maybe it'd be faster overall to add an unlikely
>>> to the == test
>>>
>>> 	if (unlikely(skb->pkt_type == PACKET_OTHERHOST)) {
>>
>> Sorry, I can't understand it clearly, do you mean that if the skb deliver to the vlan dev,
>> it is impossible that the pkt_type is PACKET_OTHERHOST at most time?
> 
> No, just that it's maybe better to add an unlikely
> to the test.
> 
> Jiri Pirko's commit 0b5c9db1b modified the code
> from a switch/case to a specific test.
> 
> I don't know how likely it is in normal uses for
> a packet to be delivered as PACKET_OTHERHOST.
> 
> I just hoped that if you in fact had performance
> numbers for your suggested ether_addr_equal_64bits
> test, you might be able to run those same tests
> with if (unlikely(skb->pkt_type == PACKET_OTHERHOST))
> and see if that was better or worse for performance.
> 
> cheers, Joe
> 

OK, I got it and I will review the commit 0b5c9db1b, try to
see the performance.

Regards
Ding

> 
> --
> 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
> 
> 

      reply	other threads:[~2014-03-03  6:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03  1:14 [PATCH net-next] vlan: use ether_addr_equal_64bits to instead of ether_addr_equal Ding Tianhong
2014-03-03  1:37 ` Joe Perches
2014-03-03  1:49 ` Joe Perches
2014-03-03  2:49   ` Ding Tianhong
2014-03-03  4:36     ` Joe Perches
2014-03-03  6:05       ` Ding Tianhong [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=53141B9B.40404@huawei.com \
    --to=dingtianhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=jpirko@redhat.com \
    --cc=julia.lawall@lip6.fr \
    --cc=kaber@trash.net \
    --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 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.