* [PATCH v2 06/20] ppp: slight optimization of addr compare
@ 2013-12-24 11:28 Ding Tianhong
2013-12-24 16:24 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Ding Tianhong @ 2013-12-24 11:28 UTC (permalink / raw)
To: Michal Ostrowski, Netdev, linux-kernel
Use possibly more efficient ether_addr_equal
to instead of memcmp.
Cc: Michal Ostrowski <mostrows@earthlink.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/ppp/pppoe.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 82ee6ed..1808a10 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -131,12 +131,13 @@ static inline struct pppoe_net *pppoe_pernet(struct net *net)
static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
{
- return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
+ return a->sid == b->sid && ether_addr_equal(a->remote,
+ b->remote);
}
static inline int cmp_addr(struct pppoe_addr *a, __be16 sid, char *addr)
{
- return a->sid == sid && !memcmp(a->remote, addr, ETH_ALEN);
+ return a->sid == sid && ether_addr_equal(a->remote, addr);
}
#if 8 % PPPOE_HASH_BITS
--
1.8.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 06/20] ppp: slight optimization of addr compare
2013-12-24 11:28 [PATCH v2 06/20] ppp: slight optimization of addr compare Ding Tianhong
@ 2013-12-24 16:24 ` Sergei Shtylyov
2013-12-24 16:35 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2013-12-24 16:24 UTC (permalink / raw)
To: Ding Tianhong, Michal Ostrowski, Netdev, linux-kernel
Hello.
On 24-12-2013 15:28, Ding Tianhong wrote:
> Use possibly more efficient ether_addr_equal
> to instead of memcmp.
> Cc: Michal Ostrowski <mostrows@earthlink.net>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
> drivers/net/ppp/pppoe.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
> index 82ee6ed..1808a10 100644
> --- a/drivers/net/ppp/pppoe.c
> +++ b/drivers/net/ppp/pppoe.c
> @@ -131,12 +131,13 @@ static inline struct pppoe_net *pppoe_pernet(struct net *net)
>
> static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
> {
> - return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
> + return a->sid == b->sid && ether_addr_equal(a->remote,
> + b->remote);
If it really doesn't fit insto single line, the continuation line should
start right under 'a->remote'.
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 06/20] ppp: slight optimization of addr compare
2013-12-24 16:24 ` Sergei Shtylyov
@ 2013-12-24 16:35 ` Joe Perches
2013-12-24 16:40 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2013-12-24 16:35 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Ding Tianhong, Michal Ostrowski, Netdev, linux-kernel
On Tue, 2013-12-24 at 20:24 +0400, Sergei Shtylyov wrote:
> On 24-12-2013 15:28, Ding Tianhong wrote:
[]
> > diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
[]
> > @@ -131,12 +131,13 @@ static inline struct pppoe_net *pppoe_pernet(struct net *net)
> >
> > static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
> > {
> > - return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
> > + return a->sid == b->sid && ether_addr_equal(a->remote,
> > + b->remote);
>
> If it really doesn't fit insto single line, the continuation line should
> start right under 'a->remote'.
Better still might be
return a->sid == b->sid &&
ether_addr_equal(a->remote, b->remote);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 06/20] ppp: slight optimization of addr compare
2013-12-24 16:35 ` Joe Perches
@ 2013-12-24 16:40 ` Sergei Shtylyov
0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2013-12-24 16:40 UTC (permalink / raw)
To: Joe Perches; +Cc: Ding Tianhong, Michal Ostrowski, Netdev, linux-kernel
Hello.
On 24-12-2013 20:35, Joe Perches wrote:
> []
>>> diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
> []
>>> @@ -131,12 +131,13 @@ static inline struct pppoe_net *pppoe_pernet(struct net *net)
>>>
>>> static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
>>> {
>>> - return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
>>> + return a->sid == b->sid && ether_addr_equal(a->remote,
>>> + b->remote);
>> If it really doesn't fit insto single line, the continuation line should
>> start right under 'a->remote'.
> Better still might be
>
> return a->sid == b->sid &&
> ether_addr_equal(a->remote, b->remote);
Actually, after the second look, I don't know why the line was broken at all.
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-24 16:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-24 11:28 [PATCH v2 06/20] ppp: slight optimization of addr compare Ding Tianhong
2013-12-24 16:24 ` Sergei Shtylyov
2013-12-24 16:35 ` Joe Perches
2013-12-24 16:40 ` Sergei Shtylyov
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.