cw1200: slight optimization of addr compare
authordingtianhong <dingtianhong@huawei.com>
Thu, 26 Dec 2013 11:41:20 +0000 (19:41 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Dec 2013 18:31:35 +0000 (13:31 -0500)
Use possibly more efficient ether_addr_equal
instead of memcmp.

Cc: Solomon Peachy <pizza@shaftnet.org>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Weilong Chen <chenweilong@huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/cw1200/sta.c
drivers/net/wireless/cw1200/txrx.c

index 010b252be584237c7f6b4e71f5d375332176f586..103f7bce893208c30eb692cca9aa9adf51b8d8b9 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/sched.h>
 #include <linux/firmware.h>
 #include <linux/module.h>
+#include <linux/etherdevice.h>
 
 #include "cw1200.h"
 #include "sta.h"
@@ -555,8 +556,8 @@ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
                pr_debug("[STA] multicast: %pM\n", ha->addr);
                memcpy(&priv->multicast_filter.macaddrs[count],
                       ha->addr, ETH_ALEN);
-               if (memcmp(ha->addr, broadcast_ipv4, ETH_ALEN) &&
-                   memcmp(ha->addr, broadcast_ipv6, ETH_ALEN))
+               if (!ether_addr_equal(ha->addr, broadcast_ipv4) &&
+                   !ether_addr_equal(ha->addr, broadcast_ipv6))
                        priv->has_multicast_subscription = true;
                count++;
        }
index e824d4d4a18d7e1d385d9d95f8fea195766a3ae8..0bd541175ecda7d9277e4abd33b6b6b4148bdd8c 100644 (file)
@@ -1166,8 +1166,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,
                        return;
        } else if (ieee80211_is_beacon(frame->frame_control) &&
                   !arg->status && priv->vif &&
-                  !memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid,
-                          ETH_ALEN)) {
+                  ether_addr_equal(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid)) {
                const u8 *tim_ie;
                u8 *ies = ((struct ieee80211_mgmt *)
                          (skb->data))->u.beacon.variable;