diff options
author | David S. Miller <davem@davemloft.net> | 2008-04-08 19:50:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-08 19:50:44 -0400 |
commit | 21f644f3eabde637f255f75ad05d0821a7a36b7f (patch) | |
tree | 2dc70aade59bf77c2d156b8e2544906128368f87 /net/ieee80211/ieee80211_rx.c | |
parent | 6adb4f733e9996b4fd68a6db50dd51bd2463ccac (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 'net/ieee80211/ieee80211_rx.c')
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 1e3f87c8c012..200ee1e63728 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -271,7 +271,6 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
271 | { | 271 | { |
272 | struct ieee80211_hdr_3addr *hdr; | 272 | struct ieee80211_hdr_3addr *hdr; |
273 | int res, hdrlen; | 273 | int res, hdrlen; |
274 | DECLARE_MAC_BUF(mac); | ||
275 | 274 | ||
276 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) | 275 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) |
277 | return 0; | 276 | return 0; |
@@ -283,8 +282,12 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
283 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); | 282 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); |
284 | atomic_dec(&crypt->refcnt); | 283 | atomic_dec(&crypt->refcnt); |
285 | if (res < 0) { | 284 | if (res < 0) { |
286 | IEEE80211_DEBUG_DROP("decryption failed (SA=%s" | 285 | IEEE80211_DEBUG_DROP("decryption failed (SA=" MAC_FMT |
287 | ") res=%d\n", print_mac(mac, hdr->addr2), res); | 286 | ") res=%d\n", |
287 | hdr->addr2[0], hdr->addr2[1], | ||
288 | hdr->addr2[2], hdr->addr2[3], | ||
289 | hdr->addr2[4], hdr->addr2[5], | ||
290 | res); | ||
288 | if (res == -2) | 291 | if (res == -2) |
289 | IEEE80211_DEBUG_DROP("Decryption failed ICV " | 292 | IEEE80211_DEBUG_DROP("Decryption failed ICV " |
290 | "mismatch (key %d)\n", | 293 | "mismatch (key %d)\n", |
@@ -304,7 +307,6 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, | |||
304 | { | 307 | { |
305 | struct ieee80211_hdr_3addr *hdr; | 308 | struct ieee80211_hdr_3addr *hdr; |
306 | int res, hdrlen; | 309 | int res, hdrlen; |
307 | DECLARE_MAC_BUF(mac); | ||
308 | 310 | ||
309 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) | 311 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) |
310 | return 0; | 312 | return 0; |
@@ -317,8 +319,12 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, | |||
317 | atomic_dec(&crypt->refcnt); | 319 | atomic_dec(&crypt->refcnt); |
318 | if (res < 0) { | 320 | if (res < 0) { |
319 | printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" | 321 | printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" |
320 | " (SA=%s keyidx=%d)\n", | 322 | " (SA=" MAC_FMT " keyidx=%d)\n", |
321 | ieee->dev->name, print_mac(mac, hdr->addr2), keyidx); | 323 | ieee->dev->name, |
324 | hdr->addr2[0], hdr->addr2[1], | ||
325 | hdr->addr2[2], hdr->addr2[3], | ||
326 | hdr->addr2[4], hdr->addr2[5], | ||
327 | keyidx); | ||
322 | return -1; | 328 | return -1; |
323 | } | 329 | } |
324 | 330 | ||
@@ -462,8 +468,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
462 | * frames silently instead of filling system log with | 468 | * frames silently instead of filling system log with |
463 | * these reports. */ | 469 | * these reports. */ |
464 | IEEE80211_DEBUG_DROP("Decryption failed (not set)" | 470 | IEEE80211_DEBUG_DROP("Decryption failed (not set)" |
465 | " (SA=%s)\n", | 471 | " (SA=" MAC_FMT ")\n", |
466 | print_mac(mac, hdr->addr2)); | 472 | hdr->addr2[0], hdr->addr2[1], |
473 | hdr->addr2[2], hdr->addr2[3], | ||
474 | hdr->addr2[4], hdr->addr2[5]); | ||
467 | ieee->ieee_stats.rx_discards_undecryptable++; | 475 | ieee->ieee_stats.rx_discards_undecryptable++; |
468 | goto rx_dropped; | 476 | goto rx_dropped; |
469 | } | 477 | } |
@@ -474,8 +482,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
474 | fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && | 482 | fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && |
475 | (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { | 483 | (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { |
476 | printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " | 484 | printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " |
477 | "from %s\n", dev->name, | 485 | "from " MAC_FMT "\n", dev->name, |
478 | print_mac(mac, hdr->addr2)); | 486 | hdr->addr2[0], hdr->addr2[1], |
487 | hdr->addr2[2], hdr->addr2[3], | ||
488 | hdr->addr2[4], hdr->addr2[5]); | ||
479 | /* TODO: could inform hostapd about this so that it | 489 | /* TODO: could inform hostapd about this so that it |
480 | * could send auth failure report */ | 490 | * could send auth failure report */ |
481 | goto rx_dropped; | 491 | goto rx_dropped; |
@@ -653,8 +663,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
653 | * configured */ | 663 | * configured */ |
654 | } else { | 664 | } else { |
655 | IEEE80211_DEBUG_DROP("encryption configured, but RX " | 665 | IEEE80211_DEBUG_DROP("encryption configured, but RX " |
656 | "frame not encrypted (SA=%s" | 666 | "frame not encrypted (SA=" |
657 | ")\n", print_mac(mac, hdr->addr2)); | 667 | MAC_FMT ")\n", |
668 | hdr->addr2[0], hdr->addr2[1], | ||
669 | hdr->addr2[2], hdr->addr2[3], | ||
670 | hdr->addr2[4], hdr->addr2[5]); | ||
658 | goto rx_dropped; | 671 | goto rx_dropped; |
659 | } | 672 | } |
660 | } | 673 | } |
@@ -662,9 +675,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
662 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && | 675 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && |
663 | !ieee80211_is_eapol_frame(ieee, skb)) { | 676 | !ieee80211_is_eapol_frame(ieee, skb)) { |
664 | IEEE80211_DEBUG_DROP("dropped unencrypted RX data " | 677 | IEEE80211_DEBUG_DROP("dropped unencrypted RX data " |
665 | "frame from %s" | 678 | "frame from " MAC_FMT |
666 | " (drop_unencrypted=1)\n", | 679 | " (drop_unencrypted=1)\n", |
667 | print_mac(mac, hdr->addr2)); | 680 | hdr->addr2[0], hdr->addr2[1], |
681 | hdr->addr2[2], hdr->addr2[3], | ||
682 | hdr->addr2[4], hdr->addr2[5]); | ||
668 | goto rx_dropped; | 683 | goto rx_dropped; |
669 | } | 684 | } |
670 | 685 | ||