media: dvb_core: slight optimization of addr compare
authordingtianhong <dingtianhong@huawei.com>
Thu, 26 Dec 2013 11:41:10 +0000 (19:41 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Dec 2013 18:31:34 +0000 (13:31 -0500)
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>
drivers/media/dvb-core/dvb_net.c

index f91c80c0e9ec0899816ea177dc616e4aa2b2755d..8a86b3025637d69c33a91ed7c697f5ad261fedb1 100644 (file)
@@ -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,13 @@ 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 +690,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 */
                                        }