recv.c (40346b66799b7d382e61bbb68a6b6bbdd20f320e) recv.c (a6d2055b02dde1067075795274672720baadd3ca)
1/*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 988 unchanged lines hidden (view full) ---

997 */
998static int ath9k_rx_skb_preprocess(struct ath_common *common,
999 struct ieee80211_hw *hw,
1000 struct ieee80211_hdr *hdr,
1001 struct ath_rx_status *rx_stats,
1002 struct ieee80211_rx_status *rx_status,
1003 bool *decrypt_error)
1004{
1/*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 988 unchanged lines hidden (view full) ---

997 */
998static int ath9k_rx_skb_preprocess(struct ath_common *common,
999 struct ieee80211_hw *hw,
1000 struct ieee80211_hdr *hdr,
1001 struct ath_rx_status *rx_stats,
1002 struct ieee80211_rx_status *rx_status,
1003 bool *decrypt_error)
1004{
1005 struct ath_hw *ah = common->ah;
1006
1007 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
1008
1009 /*
1010 * everything but the rate is checked here, the rate check is done
1011 * separately to avoid doing two lookups for a rate for each frame.
1012 */
1013 if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error))
1014 return -EINVAL;
1015
1016 ath9k_process_rssi(common, hw, hdr, rx_stats);
1017
1018 if (ath9k_process_rate(common, hw, rx_stats, rx_status))
1019 return -EINVAL;
1020
1005 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
1006
1007 /*
1008 * everything but the rate is checked here, the rate check is done
1009 * separately to avoid doing two lookups for a rate for each frame.
1010 */
1011 if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error))
1012 return -EINVAL;
1013
1014 ath9k_process_rssi(common, hw, hdr, rx_stats);
1015
1016 if (ath9k_process_rate(common, hw, rx_stats, rx_status))
1017 return -EINVAL;
1018
1021 rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp);
1022 rx_status->band = hw->conf.channel->band;
1023 rx_status->freq = hw->conf.channel->center_freq;
1024 rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi;
1025 rx_status->antenna = rx_stats->rs_antenna;
1026 rx_status->flag |= RX_FLAG_TSFT;
1027
1028 return 0;
1029}

--- 65 unchanged lines hidden (view full) ---

1095 struct ieee80211_hdr *hdr;
1096 int retval;
1097 bool decrypt_error = false;
1098 struct ath_rx_status rs;
1099 enum ath9k_rx_qtype qtype;
1100 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
1101 int dma_type;
1102 u8 rx_status_len = ah->caps.rx_status_len;
1019 rx_status->band = hw->conf.channel->band;
1020 rx_status->freq = hw->conf.channel->center_freq;
1021 rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi;
1022 rx_status->antenna = rx_stats->rs_antenna;
1023 rx_status->flag |= RX_FLAG_TSFT;
1024
1025 return 0;
1026}

--- 65 unchanged lines hidden (view full) ---

1092 struct ieee80211_hdr *hdr;
1093 int retval;
1094 bool decrypt_error = false;
1095 struct ath_rx_status rs;
1096 enum ath9k_rx_qtype qtype;
1097 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
1098 int dma_type;
1099 u8 rx_status_len = ah->caps.rx_status_len;
1100 u64 tsf = 0;
1101 u32 tsf_lower = 0;
1103
1104 if (edma)
1105 dma_type = DMA_BIDIRECTIONAL;
1106 else
1107 dma_type = DMA_FROM_DEVICE;
1108
1109 qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP;
1110 spin_lock_bh(&sc->rx.rxbuflock);
1111
1102
1103 if (edma)
1104 dma_type = DMA_BIDIRECTIONAL;
1105 else
1106 dma_type = DMA_FROM_DEVICE;
1107
1108 qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP;
1109 spin_lock_bh(&sc->rx.rxbuflock);
1110
1111 tsf = ath9k_hw_gettsf64(ah);
1112 tsf_lower = tsf & 0xffffffff;
1113
1112 do {
1113 /* If handling rx interrupt and flush is in progress => exit */
1114 if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0))
1115 break;
1116
1117 memset(&rs, 0, sizeof(rs));
1118 if (edma)
1119 bf = ath_edma_get_next_rx_buf(sc, &rs, qtype);

--- 16 unchanged lines hidden (view full) ---

1136
1137 /*
1138 * If we're asked to flush receive queue, directly
1139 * chain it back at the queue without processing it.
1140 */
1141 if (flush)
1142 goto requeue;
1143
1114 do {
1115 /* If handling rx interrupt and flush is in progress => exit */
1116 if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0))
1117 break;
1118
1119 memset(&rs, 0, sizeof(rs));
1120 if (edma)
1121 bf = ath_edma_get_next_rx_buf(sc, &rs, qtype);

--- 16 unchanged lines hidden (view full) ---

1138
1139 /*
1140 * If we're asked to flush receive queue, directly
1141 * chain it back at the queue without processing it.
1142 */
1143 if (flush)
1144 goto requeue;
1145
1146 rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
1147 if (rs.rs_tstamp > tsf_lower &&
1148 unlikely(rs.rs_tstamp - tsf_lower > 0x10000000))
1149 rxs->mactime -= 0x100000000ULL;
1150
1151 if (rs.rs_tstamp < tsf_lower &&
1152 unlikely(tsf_lower - rs.rs_tstamp > 0x10000000))
1153 rxs->mactime += 0x100000000ULL;
1154
1144 retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
1145 rxs, &decrypt_error);
1146 if (retval)
1147 goto requeue;
1148
1149 /* Ensure we always have an skb to requeue once we are done
1150 * processing the current buffer's skb */
1151 requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC);

--- 69 unchanged lines hidden ---
1155 retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
1156 rxs, &decrypt_error);
1157 if (retval)
1158 goto requeue;
1159
1160 /* Ensure we always have an skb to requeue once we are done
1161 * processing the current buffer's skb */
1162 requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC);

--- 69 unchanged lines hidden ---