From 2e5d81996e9ec4aa75942b64134f0a30edd75863 Mon Sep 17 00:00:00 2001 From: mentor Date: Thu, 22 May 2008 15:13:19 +0000 Subject: [PATCH] Slightly tidier way of managing SKBs git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3672 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index b6a4a35..73b3192 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -6504,7 +6504,7 @@ ath_rx_tasklet(TQUEUE_ARG data) struct ath_desc *ds; struct ath_rx_status *rs; struct ieee80211_node *ni; - struct sk_buff* skb; + struct sk_buff* skb = NULL; unsigned int len, phyerr, mic_fail = 0; int type = -1; /* undefined */ int init_ret = 0; @@ -6629,17 +6629,15 @@ rx_accept: /* Finished monitor mode handling, now reject error frames * before passing to other VAPs. Ignore MIC failures here, as * we need to recheck them. */ - if (rs->rs_status & ~(HAL_RXERR_MIC | HAL_RXERR_DECRYPT)) { - ieee80211_dev_kfree_skb(&skb); + if (rs->rs_status & ~(HAL_RXERR_MIC | HAL_RXERR_DECRYPT)) goto rx_next; - } /* Remove the CRC. */ skb_trim(skb, skb->len - IEEE80211_CRC_LEN); if (mic_fail) { - struct ieee80211_frame *frm = (struct ieee80211_frame *) - skb->data; + struct ieee80211_frame *frm = + (struct ieee80211_frame *)skb->data; /* Ignore control frames which are reported with MIC * error. */ if ((frm->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != @@ -6654,8 +6652,6 @@ rx_accept: } mic_fail = 0; - - ieee80211_dev_kfree_skb(&skb); goto rx_next; } @@ -6666,7 +6662,6 @@ rx_accept: len); sc->sc_stats.ast_rx_tooshort++; errors++; - ieee80211_dev_kfree_skb(&skb); goto rx_next; } @@ -6736,7 +6731,7 @@ rx_accept: type = ieee80211_input_all(ic, skb, rs->rs_rssi, bf->bf_tsf); } - skb = NULL; + skb = NULL; /* SKB is no longer ours. */ if (sc->sc_diversity) { /* When using hardware fast diversity, change the default RX @@ -6761,6 +6756,9 @@ rx_accept: ath_led_event(sc, ATH_LED_POLL); } rx_next: + /* SKBs that have not in a buf, and are not passed on. */ + ieee80211_dev_kfree_skb(&skb); + KASSERT(bf != NULL, ("null bf")); if ((init_ret = ath_rxbuf_init(sc, bf)) != 0) {