aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@googlemail.com>2010-10-09 15:37:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-10-11 15:04:22 -0400
commitc8a16c68ef4eb7817e41759c7105678ebc155377 (patch)
tree5038cde6647864c7039f4a3aea09ff889f6a8ed5 /drivers/net/wireless/ath
parent12eec2cc0d5eacd8287646585dc88ab558d4866d (diff)
carl9170: common error path for bad frames
This patch replaces several identical frame drop paths with a single shared rx frame error handler. Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/carl9170/rx.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index 671dbc429547..31287e0d362f 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -598,18 +598,14 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
598 if (!IS_STARTED(ar)) 598 if (!IS_STARTED(ar))
599 return; 599 return;
600 600
601 if (unlikely(len < sizeof(*mac))) { 601 if (unlikely(len < sizeof(*mac)))
602 ar->rx_dropped++; 602 goto drop;
603 return;
604 }
605 603
606 mpdu_len = len - sizeof(*mac); 604 mpdu_len = len - sizeof(*mac);
607 605
608 mac = (void *)(buf + mpdu_len); 606 mac = (void *)(buf + mpdu_len);
609 if (unlikely(mac->error & AR9170_RX_ERROR_FATAL)) { 607 if (unlikely(mac->error & AR9170_RX_ERROR_FATAL))
610 ar->rx_dropped++; 608 goto drop;
611 return;
612 }
613 609
614 switch (mac->status & AR9170_RX_STATUS_MPDU) { 610 switch (mac->status & AR9170_RX_STATUS_MPDU) {
615 case AR9170_RX_STATUS_MPDU_FIRST: 611 case AR9170_RX_STATUS_MPDU_FIRST:
@@ -638,8 +634,7 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
638 "is clipped.\n"); 634 "is clipped.\n");
639 } 635 }
640 636
641 ar->rx_dropped++; 637 goto drop;
642 return;
643 } 638 }
644 break; 639 break;
645 640
@@ -659,8 +654,7 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
659 "is clipped.\n"); 654 "is clipped.\n");
660 } 655 }
661 656
662 ar->rx_dropped++; 657 goto drop;
663 return;
664 } 658 }
665 659
666 case AR9170_RX_STATUS_MPDU_MIDDLE: 660 case AR9170_RX_STATUS_MPDU_MIDDLE:
@@ -672,8 +666,7 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
672 wiphy_err(ar->hw->wiphy, "rx stream does not start " 666 wiphy_err(ar->hw->wiphy, "rx stream does not start "
673 "with a first_mpdu frame tag.\n"); 667 "with a first_mpdu frame tag.\n");
674 668
675 ar->rx_dropped++; 669 goto drop;
676 return;
677 } 670 }
678 671
679 head = &ar->rx_plcp; 672 head = &ar->rx_plcp;
@@ -696,16 +689,12 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
696 } 689 }
697 690
698 /* FC + DU + RA + FCS */ 691 /* FC + DU + RA + FCS */
699 if (unlikely(mpdu_len < (2 + 2 + 6 + FCS_LEN))) { 692 if (unlikely(mpdu_len < (2 + 2 + ETH_ALEN + FCS_LEN)))
700 ar->rx_dropped++; 693 goto drop;
701 return;
702 }
703 694
704 memset(&status, 0, sizeof(status)); 695 memset(&status, 0, sizeof(status));
705 if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status))) { 696 if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status)))
706 ar->rx_dropped++; 697 goto drop;
707 return;
708 }
709 698
710 if (phy) 699 if (phy)
711 carl9170_rx_phy_status(ar, phy, &status); 700 carl9170_rx_phy_status(ar, phy, &status);
@@ -713,12 +702,15 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
713 carl9170_ps_beacon(ar, buf, mpdu_len); 702 carl9170_ps_beacon(ar, buf, mpdu_len);
714 703
715 skb = carl9170_rx_copy_data(buf, mpdu_len); 704 skb = carl9170_rx_copy_data(buf, mpdu_len);
716 if (likely(skb)) { 705 if (!skb)
717 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); 706 goto drop;
718 ieee80211_rx(ar->hw, skb); 707
719 } else { 708 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
720 ar->rx_dropped++; 709 ieee80211_rx(ar->hw, skb);
721 } 710 return;
711
712drop:
713 ar->rx_dropped++;
722} 714}
723 715
724static void carl9170_rx_untie_cmds(struct ar9170 *ar, const u8 *respbuf, 716static void carl9170_rx_untie_cmds(struct ar9170 *ar, const u8 *respbuf,