* [PATCH v3 13/19] media: dvb_core: slight optimization of addr compare
@ 2013-12-25 3:29 Ding Tianhong
2013-12-25 10:57 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Ding Tianhong @ 2013-12-25 3:29 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media, linux-kernel@vger.kernel.org,
Netdev
Use possibly more efficient ether_addr_equal
instead of memcmp.
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/media/dvb-core/dvb_net.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
index f91c80c..3dfc33b 100644
--- a/drivers/media/dvb-core/dvb_net.c
+++ b/drivers/media/dvb-core/dvb_net.c
@@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
eth = eth_hdr(skb);
if (*eth->h_dest & 1) {
- if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
+ if(ether_addr_equal(eth->h_dest,dev->broadcast))
skb->pkt_type=PACKET_BROADCAST;
else
skb->pkt_type=PACKET_MULTICAST;
@@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->rx_mode != RX_MODE_PROMISC) {
if (priv->ule_skb->data[0] & 0x01) {
/* multicast or broadcast */
- if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) {
+ if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) {
/* multicast */
if (priv->rx_mode == RX_MODE_MULTI) {
int i;
- for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++)
+ for(i = 0; i < priv->multi_num && !ether_addr_equal(priv->ule_skb->data, priv->multi_macs[i]); i++)
;
if (i == priv->multi_num)
drop = 1;
@@ -688,7 +688,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
}
/* else: broadcast */
}
- else if (memcmp(priv->ule_skb->data, dev->dev_addr, ETH_ALEN))
+ else if (!ether_addr_equal(priv->ule_skb->data, dev->dev_addr))
drop = 1;
/* else: destination address matches the MAC address of our receiver device */
}
--
1.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 13/19] media: dvb_core: slight optimization of addr compare
2013-12-25 3:29 [PATCH v3 13/19] media: dvb_core: slight optimization of addr compare Ding Tianhong
@ 2013-12-25 10:57 ` Sergei Shtylyov
2013-12-26 11:09 ` Ding Tianhong
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2013-12-25 10:57 UTC (permalink / raw)
To: Ding Tianhong, Mauro Carvalho Chehab, linux-media,
linux-kernel@vger.kernel.org, Netdev
Hello.
On 25-12-2013 7:29, Ding Tianhong wrote:
> Use possibly more efficient ether_addr_equal
> instead of memcmp.
> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
> Cc: linux-media@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
> drivers/media/dvb-core/dvb_net.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
> index f91c80c..3dfc33b 100644
> --- a/drivers/media/dvb-core/dvb_net.c
> +++ b/drivers/media/dvb-core/dvb_net.c
> @@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
> eth = eth_hdr(skb);
>
> if (*eth->h_dest & 1) {
> - if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
> + if(ether_addr_equal(eth->h_dest,dev->broadcast))
There should be space after comma.
> @@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
> if (priv->rx_mode != RX_MODE_PROMISC) {
> if (priv->ule_skb->data[0] & 0x01) {
> /* multicast or broadcast */
> - if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) {
> + if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) {
> /* multicast */
> if (priv->rx_mode == RX_MODE_MULTI) {
> int i;
> - for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++)
> + for(i = 0; i < priv->multi_num && !ether_addr_equal(priv->ule_skb->data, priv->multi_macs[i]); i++)
Shouldn't this line be broken?
> ;
> if (i == priv->multi_num)
> drop = 1;
WBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 13/19] media: dvb_core: slight optimization of addr compare
2013-12-25 10:57 ` Sergei Shtylyov
@ 2013-12-26 11:09 ` Ding Tianhong
2014-01-07 13:54 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 5+ messages in thread
From: Ding Tianhong @ 2013-12-26 11:09 UTC (permalink / raw)
To: Sergei Shtylyov, Mauro Carvalho Chehab, linux-media,
linux-kernel@vger.kernel.org, Netdev
On 2013/12/25 18:57, Sergei Shtylyov wrote:
> Hello.
>
> On 25-12-2013 7:29, Ding Tianhong wrote:
>
>> Use possibly more efficient ether_addr_equal
>> instead of memcmp.
>
>> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
>> Cc: linux-media@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>> ---
>> drivers/media/dvb-core/dvb_net.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>> diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
>> index f91c80c..3dfc33b 100644
>> --- a/drivers/media/dvb-core/dvb_net.c
>> +++ b/drivers/media/dvb-core/dvb_net.c
>> @@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
>> eth = eth_hdr(skb);
>>
>> if (*eth->h_dest & 1) {
>> - if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
>> + if(ether_addr_equal(eth->h_dest,dev->broadcast))
>
> There should be space after comma.
>
>> @@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
>> if (priv->rx_mode != RX_MODE_PROMISC) {
>> if (priv->ule_skb->data[0] & 0x01) {
>> /* multicast or broadcast */
>> - if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) {
>> + if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) {
>> /* multicast */
>> if (priv->rx_mode == RX_MODE_MULTI) {
>> int i;
>> - for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++)
>> + for(i = 0; i < priv->multi_num && !ether_addr_equal(priv->ule_skb->data, priv->multi_macs[i]); i++)
>
> Shouldn't this line be broken?
>
ok, thanks.
Regards
>> ;
>> if (i == priv->multi_num)
>> drop = 1;
>
> WBR, Sergei
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 13/19] media: dvb_core: slight optimization of addr compare
2013-12-26 11:09 ` Ding Tianhong
@ 2014-01-07 13:54 ` Mauro Carvalho Chehab
2014-01-08 1:07 ` Ding Tianhong
0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2014-01-07 13:54 UTC (permalink / raw)
To: Ding Tianhong
Cc: Sergei Shtylyov, linux-media, linux-kernel@vger.kernel.org,
Netdev
Em Thu, 26 Dec 2013 19:09:10 +0800
Ding Tianhong <dingtianhong@huawei.com> escreveu:
> On 2013/12/25 18:57, Sergei Shtylyov wrote:
> > Hello.
> >
> > On 25-12-2013 7:29, Ding Tianhong wrote:
> >
> >> Use possibly more efficient ether_addr_equal
> >> instead of memcmp.
> >
> >> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
> >> Cc: linux-media@vger.kernel.org
> >> Cc: linux-kernel@vger.kernel.org
> >> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> >> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> >> ---
> >> drivers/media/dvb-core/dvb_net.c | 8 ++++----
> >> 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> >> diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
> >> index f91c80c..3dfc33b 100644
> >> --- a/drivers/media/dvb-core/dvb_net.c
> >> +++ b/drivers/media/dvb-core/dvb_net.c
> >> @@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
> >> eth = eth_hdr(skb);
> >>
> >> if (*eth->h_dest & 1) {
> >> - if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
> >> + if(ether_addr_equal(eth->h_dest,dev->broadcast))
> >
> > There should be space after comma.
> >
> >> @@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
> >> if (priv->rx_mode != RX_MODE_PROMISC) {
> >> if (priv->ule_skb->data[0] & 0x01) {
> >> /* multicast or broadcast */
> >> - if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) {
> >> + if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) {
> >> /* multicast */
> >> if (priv->rx_mode == RX_MODE_MULTI) {
> >> int i;
> >> - for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++)
> >> + for(i = 0; i < priv->multi_num && !ether_addr_equal(priv->ule_skb->data, priv->multi_macs[i]); i++)
> >
> > Shouldn't this line be broken?
> >
>
> ok, thanks.
Also, since you're touching on those lines, could you please add an space
after 'if' (on the first hunk) and after 'for' (on the second one)?
>
> Regards
> >> ;
> >> if (i == priv->multi_num)
> >> drop = 1;
> >
> > WBR, Sergei
> >
> >
> >
> >
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Mauro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 13/19] media: dvb_core: slight optimization of addr compare
2014-01-07 13:54 ` Mauro Carvalho Chehab
@ 2014-01-08 1:07 ` Ding Tianhong
0 siblings, 0 replies; 5+ messages in thread
From: Ding Tianhong @ 2014-01-08 1:07 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Sergei Shtylyov, linux-media, linux-kernel@vger.kernel.org,
Netdev
On 2014/1/7 21:54, Mauro Carvalho Chehab wrote:
> Em Thu, 26 Dec 2013 19:09:10 +0800
> Ding Tianhong <dingtianhong@huawei.com> escreveu:
>
>> On 2013/12/25 18:57, Sergei Shtylyov wrote:
>>> Hello.
>>>
>>> On 25-12-2013 7:29, Ding Tianhong wrote:
>>>
>>>> Use possibly more efficient ether_addr_equal
>>>> instead of memcmp.
>>>
>>>> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
>>>> Cc: linux-media@vger.kernel.org
>>>> Cc: linux-kernel@vger.kernel.org
>>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>>>> ---
>>>> drivers/media/dvb-core/dvb_net.c | 8 ++++----
>>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>>> diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
>>>> index f91c80c..3dfc33b 100644
>>>> --- a/drivers/media/dvb-core/dvb_net.c
>>>> +++ b/drivers/media/dvb-core/dvb_net.c
>>>> @@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
>>>> eth = eth_hdr(skb);
>>>>
>>>> if (*eth->h_dest & 1) {
>>>> - if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
>>>> + if(ether_addr_equal(eth->h_dest,dev->broadcast))
>>>
>>> There should be space after comma.
>>>
>>>> @@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
>>>> if (priv->rx_mode != RX_MODE_PROMISC) {
>>>> if (priv->ule_skb->data[0] & 0x01) {
>>>> /* multicast or broadcast */
>>>> - if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) {
>>>> + if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) {
>>>> /* multicast */
>>>> if (priv->rx_mode == RX_MODE_MULTI) {
>>>> int i;
>>>> - for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++)
>>>> + for(i = 0; i < priv->multi_num && !ether_addr_equal(priv->ule_skb->data, priv->multi_macs[i]); i++)
>>>
>>> Shouldn't this line be broken?
>>>
>>
>> ok, thanks.
>
> Also, since you're touching on those lines, could you please add an space
> after 'if' (on the first hunk) and after 'for' (on the second one)?
>
Ok, thanks
Regards
Ding
>>
>> Regards
>>>> ;
>>>> if (i == priv->multi_num)
>>>> drop = 1;
>>>
>>> WBR, Sergei
>>>
>>>
>>>
>>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> Thanks,
> Mauro
>
> .
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-08 1:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 3:29 [PATCH v3 13/19] media: dvb_core: slight optimization of addr compare Ding Tianhong
2013-12-25 10:57 ` Sergei Shtylyov
2013-12-26 11:09 ` Ding Tianhong
2014-01-07 13:54 ` Mauro Carvalho Chehab
2014-01-08 1:07 ` Ding Tianhong
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).