aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_80211_rx.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-08 19:50:44 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-08 19:50:44 -0400
commit21f644f3eabde637f255f75ad05d0821a7a36b7f (patch)
tree2dc70aade59bf77c2d156b8e2544906128368f87 /drivers/net/wireless/hostap/hostap_80211_rx.c
parent6adb4f733e9996b4fd68a6db50dd51bd2463ccac (diff)
[NET]: Undo code bloat in hot paths due to print_mac().
If print_mac() is used inside of a pr_debug() the compiler can't see that the call is redundant so still performs it even of pr_debug() ends up being a nop. So don't use print_mac() in such cases in hot code paths, use MAC_FMT et al. instead. As noted by Joe Perches, pr_debug() could be modified to handle this better, but that is a change to an interface used by the entire kernel and thus needs to be validated carefully. This here is thus the less risky fix for 2.6.25 Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_80211_rx.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 49978bdb4324..4fd73809602e 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -635,7 +635,6 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
635{ 635{
636 struct ieee80211_hdr_4addr *hdr; 636 struct ieee80211_hdr_4addr *hdr;
637 int res, hdrlen; 637 int res, hdrlen;
638 DECLARE_MAC_BUF(mac);
639 638
640 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 639 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
641 return 0; 640 return 0;
@@ -647,8 +646,10 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
647 strcmp(crypt->ops->name, "TKIP") == 0) { 646 strcmp(crypt->ops->name, "TKIP") == 0) {
648 if (net_ratelimit()) { 647 if (net_ratelimit()) {
649 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 648 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
650 "received packet from %s\n", 649 "received packet from " MAC_FMT "\n",
651 local->dev->name, print_mac(mac, hdr->addr2)); 650 local->dev->name,
651 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
652 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
652 } 653 }
653 return -1; 654 return -1;
654 } 655 }
@@ -657,9 +658,12 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
657 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); 658 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
658 atomic_dec(&crypt->refcnt); 659 atomic_dec(&crypt->refcnt);
659 if (res < 0) { 660 if (res < 0) {
660 printk(KERN_DEBUG "%s: decryption failed (SA=%s" 661 printk(KERN_DEBUG "%s: decryption failed (SA=" MAC_FMT
661 ") res=%d\n", 662 ") res=%d\n",
662 local->dev->name, print_mac(mac, hdr->addr2), res); 663 local->dev->name,
664 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
665 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
666 res);
663 local->comm_tallies.rx_discards_wep_undecryptable++; 667 local->comm_tallies.rx_discards_wep_undecryptable++;
664 return -1; 668 return -1;
665 } 669 }
@@ -721,7 +725,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
721 struct ieee80211_crypt_data *crypt = NULL; 725 struct ieee80211_crypt_data *crypt = NULL;
722 void *sta = NULL; 726 void *sta = NULL;
723 int keyidx = 0; 727 int keyidx = 0;
724 DECLARE_MAC_BUF(mac);
725 728
726 iface = netdev_priv(dev); 729 iface = netdev_priv(dev);
727 local = iface->local; 730 local = iface->local;
@@ -798,8 +801,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
798 * frames silently instead of filling system log with 801 * frames silently instead of filling system log with
799 * these reports. */ 802 * these reports. */
800 printk(KERN_DEBUG "%s: WEP decryption failed (not set)" 803 printk(KERN_DEBUG "%s: WEP decryption failed (not set)"
801 " (SA=%s)\n", 804 " (SA=" MAC_FMT ")\n",
802 local->dev->name, print_mac(mac, hdr->addr2)); 805 local->dev->name,
806 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
807 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
803#endif 808#endif
804 local->comm_tallies.rx_discards_wep_undecryptable++; 809 local->comm_tallies.rx_discards_wep_undecryptable++;
805 goto rx_dropped; 810 goto rx_dropped;
@@ -813,8 +818,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
813 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) 818 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
814 { 819 {
815 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 820 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
816 "from %s\n", dev->name, 821 "from " MAC_FMT "\n", dev->name,
817 print_mac(mac, hdr->addr2)); 822 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
823 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
818 /* TODO: could inform hostapd about this so that it 824 /* TODO: could inform hostapd about this so that it
819 * could send auth failure report */ 825 * could send auth failure report */
820 goto rx_dropped; 826 goto rx_dropped;
@@ -982,8 +988,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
982 "unencrypted EAPOL frame\n", local->dev->name); 988 "unencrypted EAPOL frame\n", local->dev->name);
983 } else { 989 } else {
984 printk(KERN_DEBUG "%s: encryption configured, but RX " 990 printk(KERN_DEBUG "%s: encryption configured, but RX "
985 "frame not encrypted (SA=%s)\n", 991 "frame not encrypted (SA=" MAC_FMT ")\n",
986 local->dev->name, print_mac(mac, hdr->addr2)); 992 local->dev->name,
993 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
994 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
987 goto rx_dropped; 995 goto rx_dropped;
988 } 996 }
989 } 997 }
@@ -992,9 +1000,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
992 !hostap_is_eapol_frame(local, skb)) { 1000 !hostap_is_eapol_frame(local, skb)) {
993 if (net_ratelimit()) { 1001 if (net_ratelimit()) {
994 printk(KERN_DEBUG "%s: dropped unencrypted RX data " 1002 printk(KERN_DEBUG "%s: dropped unencrypted RX data "
995 "frame from %s" 1003 "frame from " MAC_FMT " (drop_unencrypted=1)\n",
996 " (drop_unencrypted=1)\n", 1004 dev->name,
997 dev->name, print_mac(mac, hdr->addr2)); 1005 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1006 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
998 } 1007 }
999 goto rx_dropped; 1008 goto rx_dropped;
1000 } 1009 }