diff options
author | dingtianhong <dingtianhong@huawei.com> | 2013-12-26 06:41:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-26 13:31:34 -0500 |
commit | 5e231c2c5aeda0763c0b6e1337ca7bb61a887af8 (patch) | |
tree | f528c86eaf297fc11f65c6fa8b565e8f669e5e24 /drivers | |
parent | 48f045b9115bb26e08f065840d7732d920525e30 (diff) |
media: dvb_core: slight optimization of addr compare
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb-core/dvb_net.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index f91c80c0e9ec..8a86b3025637 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, | |||
179 | eth = eth_hdr(skb); | 179 | eth = eth_hdr(skb); |
180 | 180 | ||
181 | if (*eth->h_dest & 1) { | 181 | if (*eth->h_dest & 1) { |
182 | if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0) | 182 | if(ether_addr_equal(eth->h_dest,dev->broadcast)) |
183 | skb->pkt_type=PACKET_BROADCAST; | 183 | skb->pkt_type=PACKET_BROADCAST; |
184 | else | 184 | else |
185 | skb->pkt_type=PACKET_MULTICAST; | 185 | skb->pkt_type=PACKET_MULTICAST; |
@@ -674,11 +674,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | |||
674 | if (priv->rx_mode != RX_MODE_PROMISC) { | 674 | if (priv->rx_mode != RX_MODE_PROMISC) { |
675 | if (priv->ule_skb->data[0] & 0x01) { | 675 | if (priv->ule_skb->data[0] & 0x01) { |
676 | /* multicast or broadcast */ | 676 | /* multicast or broadcast */ |
677 | if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) { | 677 | if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) { |
678 | /* multicast */ | 678 | /* multicast */ |
679 | if (priv->rx_mode == RX_MODE_MULTI) { | 679 | if (priv->rx_mode == RX_MODE_MULTI) { |
680 | int i; | 680 | int i; |
681 | for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++) | 681 | for(i = 0; i < priv->multi_num && |
682 | !ether_addr_equal(priv->ule_skb->data, | ||
683 | priv->multi_macs[i]); i++) | ||
682 | ; | 684 | ; |
683 | if (i == priv->multi_num) | 685 | if (i == priv->multi_num) |
684 | drop = 1; | 686 | drop = 1; |
@@ -688,7 +690,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | |||
688 | } | 690 | } |
689 | /* else: broadcast */ | 691 | /* else: broadcast */ |
690 | } | 692 | } |
691 | else if (memcmp(priv->ule_skb->data, dev->dev_addr, ETH_ALEN)) | 693 | else if (!ether_addr_equal(priv->ule_skb->data, dev->dev_addr)) |
692 | drop = 1; | 694 | drop = 1; |
693 | /* else: destination address matches the MAC address of our receiver device */ | 695 | /* else: destination address matches the MAC address of our receiver device */ |
694 | } | 696 | } |