summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@googlemail.com>2010-10-09 19:37:11 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2010-10-11 19:04:22 (GMT)
commitc8a16c68ef4eb7817e41759c7105678ebc155377 (patch)
tree5038cde6647864c7039f4a3aea09ff889f6a8ed5 /drivers
parent12eec2cc0d5eacd8287646585dc88ab558d4866d (diff)
downloadlinux-fsl-qoriq-c8a16c68ef4eb7817e41759c7105678ebc155377.tar.xz
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')
-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 671dbc4..31287e0 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)
if (!IS_STARTED(ar))
return;
- if (unlikely(len < sizeof(*mac))) {
- ar->rx_dropped++;
- return;
- }
+ if (unlikely(len < sizeof(*mac)))
+ goto drop;
mpdu_len = len - sizeof(*mac);
mac = (void *)(buf + mpdu_len);
- if (unlikely(mac->error & AR9170_RX_ERROR_FATAL)) {
- ar->rx_dropped++;
- return;
- }
+ if (unlikely(mac->error & AR9170_RX_ERROR_FATAL))
+ goto drop;
switch (mac->status & AR9170_RX_STATUS_MPDU) {
case AR9170_RX_STATUS_MPDU_FIRST:
@@ -638,8 +634,7 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
"is clipped.\n");
}
- ar->rx_dropped++;
- return;
+ goto drop;
}
break;
@@ -659,8 +654,7 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
"is clipped.\n");
}
- ar->rx_dropped++;
- return;
+ goto drop;
}
case AR9170_RX_STATUS_MPDU_MIDDLE:
@@ -672,8 +666,7 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
wiphy_err(ar->hw->wiphy, "rx stream does not start "
"with a first_mpdu frame tag.\n");
- ar->rx_dropped++;
- return;
+ goto drop;
}
head = &ar->rx_plcp;
@@ -696,16 +689,12 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
}
/* FC + DU + RA + FCS */
- if (unlikely(mpdu_len < (2 + 2 + 6 + FCS_LEN))) {
- ar->rx_dropped++;
- return;
- }
+ if (unlikely(mpdu_len < (2 + 2 + ETH_ALEN + FCS_LEN)))
+ goto drop;
memset(&status, 0, sizeof(status));
- if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status))) {
- ar->rx_dropped++;
- return;
- }
+ if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status)))
+ goto drop;
if (phy)
carl9170_rx_phy_status(ar, phy, &status);
@@ -713,12 +702,15 @@ static void carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len)
carl9170_ps_beacon(ar, buf, mpdu_len);
skb = carl9170_rx_copy_data(buf, mpdu_len);
- if (likely(skb)) {
- memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
- ieee80211_rx(ar->hw, skb);
- } else {
- ar->rx_dropped++;
- }
+ if (!skb)
+ goto drop;
+
+ memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
+ ieee80211_rx(ar->hw, skb);
+ return;
+
+drop:
+ ar->rx_dropped++;
}
static void carl9170_rx_untie_cmds(struct ar9170 *ar, const u8 *respbuf,