iwl-rx.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
  4. *
  5. * Portions of this file are derived from the ipw3945 project, as well
  6. * as portions of the ieee80211 subsystem header files.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of version 2 of the GNU General Public License as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  20. *
  21. * The full GNU General Public License is included in this distribution in the
  22. * file called LICENSE.
  23. *
  24. * Contact Information:
  25. * Intel Linux Wireless <ilw@linux.intel.com>
  26. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  27. *
  28. *****************************************************************************/
  29. #include <linux/etherdevice.h>
  30. #include <linux/slab.h>
  31. #include <linux/sched.h>
  32. #include <net/mac80211.h>
  33. #include <asm/unaligned.h>
  34. #include "iwl-eeprom.h"
  35. #include "iwl-dev.h"
  36. #include "iwl-core.h"
  37. #include "iwl-sta.h"
  38. #include "iwl-io.h"
  39. #include "iwl-helpers.h"
  40. #include "iwl-agn-calib.h"
  41. #include "iwl-agn.h"
  42. #include "iwl-shared.h"
  43. /******************************************************************************
  44. *
  45. * Generic RX handler implementations
  46. *
  47. ******************************************************************************/
  48. static void iwl_rx_reply_error(struct iwl_priv *priv,
  49. struct iwl_rx_mem_buffer *rxb)
  50. {
  51. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  52. IWL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) "
  53. "seq 0x%04X ser 0x%08X\n",
  54. le32_to_cpu(pkt->u.err_resp.error_type),
  55. get_cmd_string(pkt->u.err_resp.cmd_id),
  56. pkt->u.err_resp.cmd_id,
  57. le16_to_cpu(pkt->u.err_resp.bad_cmd_seq_num),
  58. le32_to_cpu(pkt->u.err_resp.error_info));
  59. }
  60. static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
  61. {
  62. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  63. struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
  64. /*
  65. * MULTI-FIXME
  66. * See iwl_mac_channel_switch.
  67. */
  68. struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
  69. struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
  70. if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
  71. return;
  72. if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
  73. rxon->channel = csa->channel;
  74. ctx->staging.channel = csa->channel;
  75. IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
  76. le16_to_cpu(csa->channel));
  77. iwl_chswitch_done(priv, true);
  78. } else {
  79. IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
  80. le16_to_cpu(csa->channel));
  81. iwl_chswitch_done(priv, false);
  82. }
  83. }
  84. static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
  85. struct iwl_rx_mem_buffer *rxb)
  86. {
  87. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  88. struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif);
  89. if (!report->state) {
  90. IWL_DEBUG_11H(priv,
  91. "Spectrum Measure Notification: Start\n");
  92. return;
  93. }
  94. memcpy(&priv->measure_report, report, sizeof(*report));
  95. priv->measurement_status |= MEASUREMENT_READY;
  96. }
  97. static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv,
  98. struct iwl_rx_mem_buffer *rxb)
  99. {
  100. #ifdef CONFIG_IWLWIFI_DEBUG
  101. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  102. struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif);
  103. IWL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n",
  104. sleep->pm_sleep_mode, sleep->pm_wakeup_src);
  105. #endif
  106. }
  107. static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
  108. struct iwl_rx_mem_buffer *rxb)
  109. {
  110. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  111. u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
  112. IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
  113. "notification for %s:\n", len,
  114. get_cmd_string(pkt->hdr.cmd));
  115. iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, len);
  116. }
  117. static void iwl_rx_beacon_notif(struct iwl_priv *priv,
  118. struct iwl_rx_mem_buffer *rxb)
  119. {
  120. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  121. struct iwlagn_beacon_notif *beacon = (void *)pkt->u.raw;
  122. #ifdef CONFIG_IWLWIFI_DEBUG
  123. u16 status = le16_to_cpu(beacon->beacon_notify_hdr.status.status);
  124. u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
  125. IWL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d "
  126. "tsf:0x%.8x%.8x rate:%d\n",
  127. status & TX_STATUS_MSK,
  128. beacon->beacon_notify_hdr.failure_frame,
  129. le32_to_cpu(beacon->ibss_mgr_status),
  130. le32_to_cpu(beacon->high_tsf),
  131. le32_to_cpu(beacon->low_tsf), rate);
  132. #endif
  133. priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status);
  134. if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
  135. queue_work(priv->shrd->workqueue, &priv->beacon_update);
  136. }
  137. /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
  138. #define ACK_CNT_RATIO (50)
  139. #define BA_TIMEOUT_CNT (5)
  140. #define BA_TIMEOUT_MAX (16)
  141. /**
  142. * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
  143. *
  144. * When the ACK count ratio is low and aggregated BA timeout retries exceeding
  145. * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
  146. * operation state.
  147. */
  148. static bool iwl_good_ack_health(struct iwl_priv *priv,
  149. struct statistics_tx *cur)
  150. {
  151. int actual_delta, expected_delta, ba_timeout_delta;
  152. struct statistics_tx *old;
  153. if (priv->agg_tids_count)
  154. return true;
  155. old = &priv->statistics.tx;
  156. actual_delta = le32_to_cpu(cur->actual_ack_cnt) -
  157. le32_to_cpu(old->actual_ack_cnt);
  158. expected_delta = le32_to_cpu(cur->expected_ack_cnt) -
  159. le32_to_cpu(old->expected_ack_cnt);
  160. /* Values should not be negative, but we do not trust the firmware */
  161. if (actual_delta <= 0 || expected_delta <= 0)
  162. return true;
  163. ba_timeout_delta = le32_to_cpu(cur->agg.ba_timeout) -
  164. le32_to_cpu(old->agg.ba_timeout);
  165. if ((actual_delta * 100 / expected_delta) < ACK_CNT_RATIO &&
  166. ba_timeout_delta > BA_TIMEOUT_CNT) {
  167. IWL_DEBUG_RADIO(priv, "deltas: actual %d expected %d ba_timeout %d\n",
  168. actual_delta, expected_delta, ba_timeout_delta);
  169. #ifdef CONFIG_IWLWIFI_DEBUGFS
  170. /*
  171. * This is ifdef'ed on DEBUGFS because otherwise the
  172. * statistics aren't available. If DEBUGFS is set but
  173. * DEBUG is not, these will just compile out.
  174. */
  175. IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta %d\n",
  176. priv->delta_stats.tx.rx_detected_cnt);
  177. IWL_DEBUG_RADIO(priv,
  178. "ack_or_ba_timeout_collision delta %d\n",
  179. priv->delta_stats.tx.ack_or_ba_timeout_collision);
  180. #endif
  181. if (ba_timeout_delta >= BA_TIMEOUT_MAX)
  182. return false;
  183. }
  184. return true;
  185. }
  186. /**
  187. * iwl_good_plcp_health - checks for plcp error.
  188. *
  189. * When the plcp error is exceeding the thresholds, reset the radio
  190. * to improve the throughput.
  191. */
  192. static bool iwl_good_plcp_health(struct iwl_priv *priv,
  193. struct statistics_rx_phy *cur_ofdm,
  194. struct statistics_rx_ht_phy *cur_ofdm_ht,
  195. unsigned int msecs)
  196. {
  197. int delta;
  198. int threshold = priv->cfg->base_params->plcp_delta_threshold;
  199. if (threshold == IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE) {
  200. IWL_DEBUG_RADIO(priv, "plcp_err check disabled\n");
  201. return true;
  202. }
  203. delta = le32_to_cpu(cur_ofdm->plcp_err) -
  204. le32_to_cpu(priv->statistics.rx_ofdm.plcp_err) +
  205. le32_to_cpu(cur_ofdm_ht->plcp_err) -
  206. le32_to_cpu(priv->statistics.rx_ofdm_ht.plcp_err);
  207. /* Can be negative if firmware reset statistics */
  208. if (delta <= 0)
  209. return true;
  210. if ((delta * 100 / msecs) > threshold) {
  211. IWL_DEBUG_RADIO(priv,
  212. "plcp health threshold %u delta %d msecs %u\n",
  213. threshold, delta, msecs);
  214. return false;
  215. }
  216. return true;
  217. }
  218. static void iwl_recover_from_statistics(struct iwl_priv *priv,
  219. struct statistics_rx_phy *cur_ofdm,
  220. struct statistics_rx_ht_phy *cur_ofdm_ht,
  221. struct statistics_tx *tx,
  222. unsigned long stamp)
  223. {
  224. unsigned int msecs;
  225. if (test_bit(STATUS_EXIT_PENDING, &priv->status))
  226. return;
  227. msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies);
  228. /* Only gather statistics and update time stamp when not associated */
  229. if (!iwl_is_any_associated(priv))
  230. return;
  231. /* Do not check/recover when do not have enough statistics data */
  232. if (msecs < 99)
  233. return;
  234. if (iwlagn_mod_params.ack_check && !iwl_good_ack_health(priv, tx)) {
  235. IWL_ERR(priv, "low ack count detected, restart firmware\n");
  236. if (!iwl_force_reset(priv, IWL_FW_RESET, false))
  237. return;
  238. }
  239. if (iwlagn_mod_params.plcp_check &&
  240. !iwl_good_plcp_health(priv, cur_ofdm, cur_ofdm_ht, msecs))
  241. iwl_force_reset(priv, IWL_RF_RESET, false);
  242. }
  243. /* Calculate noise level, based on measurements during network silence just
  244. * before arriving beacon. This measurement can be done only if we know
  245. * exactly when to expect beacons, therefore only when we're associated. */
  246. static void iwl_rx_calc_noise(struct iwl_priv *priv)
  247. {
  248. struct statistics_rx_non_phy *rx_info;
  249. int num_active_rx = 0;
  250. int total_silence = 0;
  251. int bcn_silence_a, bcn_silence_b, bcn_silence_c;
  252. int last_rx_noise;
  253. rx_info = &priv->statistics.rx_non_phy;
  254. bcn_silence_a =
  255. le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER;
  256. bcn_silence_b =
  257. le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER;
  258. bcn_silence_c =
  259. le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER;
  260. if (bcn_silence_a) {
  261. total_silence += bcn_silence_a;
  262. num_active_rx++;
  263. }
  264. if (bcn_silence_b) {
  265. total_silence += bcn_silence_b;
  266. num_active_rx++;
  267. }
  268. if (bcn_silence_c) {
  269. total_silence += bcn_silence_c;
  270. num_active_rx++;
  271. }
  272. /* Average among active antennas */
  273. if (num_active_rx)
  274. last_rx_noise = (total_silence / num_active_rx) - 107;
  275. else
  276. last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
  277. IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n",
  278. bcn_silence_a, bcn_silence_b, bcn_silence_c,
  279. last_rx_noise);
  280. }
  281. #ifdef CONFIG_IWLWIFI_DEBUGFS
  282. /*
  283. * based on the assumption of all statistics counter are in DWORD
  284. * FIXME: This function is for debugging, do not deal with
  285. * the case of counters roll-over.
  286. */
  287. static void accum_stats(__le32 *prev, __le32 *cur, __le32 *delta,
  288. __le32 *max_delta, __le32 *accum, int size)
  289. {
  290. int i;
  291. for (i = 0;
  292. i < size / sizeof(__le32);
  293. i++, prev++, cur++, delta++, max_delta++, accum++) {
  294. if (le32_to_cpu(*cur) > le32_to_cpu(*prev)) {
  295. *delta = cpu_to_le32(
  296. le32_to_cpu(*cur) - le32_to_cpu(*prev));
  297. le32_add_cpu(accum, le32_to_cpu(*delta));
  298. if (le32_to_cpu(*delta) > le32_to_cpu(*max_delta))
  299. *max_delta = *delta;
  300. }
  301. }
  302. }
  303. static void
  304. iwl_accumulative_statistics(struct iwl_priv *priv,
  305. struct statistics_general_common *common,
  306. struct statistics_rx_non_phy *rx_non_phy,
  307. struct statistics_rx_phy *rx_ofdm,
  308. struct statistics_rx_ht_phy *rx_ofdm_ht,
  309. struct statistics_rx_phy *rx_cck,
  310. struct statistics_tx *tx,
  311. struct statistics_bt_activity *bt_activity)
  312. {
  313. #define ACCUM(_name) \
  314. accum_stats((__le32 *)&priv->statistics._name, \
  315. (__le32 *)_name, \
  316. (__le32 *)&priv->delta_stats._name, \
  317. (__le32 *)&priv->max_delta_stats._name, \
  318. (__le32 *)&priv->accum_stats._name, \
  319. sizeof(*_name));
  320. ACCUM(common);
  321. ACCUM(rx_non_phy);
  322. ACCUM(rx_ofdm);
  323. ACCUM(rx_ofdm_ht);
  324. ACCUM(rx_cck);
  325. ACCUM(tx);
  326. if (bt_activity)
  327. ACCUM(bt_activity);
  328. #undef ACCUM
  329. }
  330. #else
  331. static inline void
  332. iwl_accumulative_statistics(struct iwl_priv *priv,
  333. struct statistics_general_common *common,
  334. struct statistics_rx_non_phy *rx_non_phy,
  335. struct statistics_rx_phy *rx_ofdm,
  336. struct statistics_rx_ht_phy *rx_ofdm_ht,
  337. struct statistics_rx_phy *rx_cck,
  338. struct statistics_tx *tx,
  339. struct statistics_bt_activity *bt_activity)
  340. {
  341. }
  342. #endif
  343. static void iwl_rx_statistics(struct iwl_priv *priv,
  344. struct iwl_rx_mem_buffer *rxb)
  345. {
  346. unsigned long stamp = jiffies;
  347. const int reg_recalib_period = 60;
  348. int change;
  349. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  350. u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
  351. __le32 *flag;
  352. struct statistics_general_common *common;
  353. struct statistics_rx_non_phy *rx_non_phy;
  354. struct statistics_rx_phy *rx_ofdm;
  355. struct statistics_rx_ht_phy *rx_ofdm_ht;
  356. struct statistics_rx_phy *rx_cck;
  357. struct statistics_tx *tx;
  358. struct statistics_bt_activity *bt_activity;
  359. len -= sizeof(struct iwl_cmd_header); /* skip header */
  360. IWL_DEBUG_RX(priv, "Statistics notification received (%d bytes).\n",
  361. len);
  362. if (len == sizeof(struct iwl_bt_notif_statistics)) {
  363. struct iwl_bt_notif_statistics *stats;
  364. stats = &pkt->u.stats_bt;
  365. flag = &stats->flag;
  366. common = &stats->general.common;
  367. rx_non_phy = &stats->rx.general.common;
  368. rx_ofdm = &stats->rx.ofdm;
  369. rx_ofdm_ht = &stats->rx.ofdm_ht;
  370. rx_cck = &stats->rx.cck;
  371. tx = &stats->tx;
  372. bt_activity = &stats->general.activity;
  373. #ifdef CONFIG_IWLWIFI_DEBUGFS
  374. /* handle this exception directly */
  375. priv->statistics.num_bt_kills = stats->rx.general.num_bt_kills;
  376. le32_add_cpu(&priv->statistics.accum_num_bt_kills,
  377. le32_to_cpu(stats->rx.general.num_bt_kills));
  378. #endif
  379. } else if (len == sizeof(struct iwl_notif_statistics)) {
  380. struct iwl_notif_statistics *stats;
  381. stats = &pkt->u.stats;
  382. flag = &stats->flag;
  383. common = &stats->general.common;
  384. rx_non_phy = &stats->rx.general;
  385. rx_ofdm = &stats->rx.ofdm;
  386. rx_ofdm_ht = &stats->rx.ofdm_ht;
  387. rx_cck = &stats->rx.cck;
  388. tx = &stats->tx;
  389. bt_activity = NULL;
  390. } else {
  391. WARN_ONCE(1, "len %d doesn't match BT (%zu) or normal (%zu)\n",
  392. len, sizeof(struct iwl_bt_notif_statistics),
  393. sizeof(struct iwl_notif_statistics));
  394. return;
  395. }
  396. change = common->temperature != priv->statistics.common.temperature ||
  397. (*flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
  398. (priv->statistics.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK);
  399. iwl_accumulative_statistics(priv, common, rx_non_phy, rx_ofdm,
  400. rx_ofdm_ht, rx_cck, tx, bt_activity);
  401. iwl_recover_from_statistics(priv, rx_ofdm, rx_ofdm_ht, tx, stamp);
  402. priv->statistics.flag = *flag;
  403. memcpy(&priv->statistics.common, common, sizeof(*common));
  404. memcpy(&priv->statistics.rx_non_phy, rx_non_phy, sizeof(*rx_non_phy));
  405. memcpy(&priv->statistics.rx_ofdm, rx_ofdm, sizeof(*rx_ofdm));
  406. memcpy(&priv->statistics.rx_ofdm_ht, rx_ofdm_ht, sizeof(*rx_ofdm_ht));
  407. memcpy(&priv->statistics.rx_cck, rx_cck, sizeof(*rx_cck));
  408. memcpy(&priv->statistics.tx, tx, sizeof(*tx));
  409. #ifdef CONFIG_IWLWIFI_DEBUGFS
  410. if (bt_activity)
  411. memcpy(&priv->statistics.bt_activity, bt_activity,
  412. sizeof(*bt_activity));
  413. #endif
  414. priv->rx_statistics_jiffies = stamp;
  415. set_bit(STATUS_STATISTICS, &priv->status);
  416. /* Reschedule the statistics timer to occur in
  417. * reg_recalib_period seconds to ensure we get a
  418. * thermal update even if the uCode doesn't give
  419. * us one */
  420. mod_timer(&priv->statistics_periodic, jiffies +
  421. msecs_to_jiffies(reg_recalib_period * 1000));
  422. if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
  423. (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
  424. iwl_rx_calc_noise(priv);
  425. queue_work(priv->shrd->workqueue, &priv->run_time_calib_work);
  426. }
  427. if (priv->cfg->lib->temperature && change)
  428. priv->cfg->lib->temperature(priv);
  429. }
  430. static void iwl_rx_reply_statistics(struct iwl_priv *priv,
  431. struct iwl_rx_mem_buffer *rxb)
  432. {
  433. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  434. if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) {
  435. #ifdef CONFIG_IWLWIFI_DEBUGFS
  436. memset(&priv->accum_stats, 0,
  437. sizeof(priv->accum_stats));
  438. memset(&priv->delta_stats, 0,
  439. sizeof(priv->delta_stats));
  440. memset(&priv->max_delta_stats, 0,
  441. sizeof(priv->max_delta_stats));
  442. #endif
  443. IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
  444. }
  445. iwl_rx_statistics(priv, rxb);
  446. }
  447. /* Handle notification from uCode that card's power state is changing
  448. * due to software, hardware, or critical temperature RFKILL */
  449. static void iwl_rx_card_state_notif(struct iwl_priv *priv,
  450. struct iwl_rx_mem_buffer *rxb)
  451. {
  452. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  453. u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
  454. unsigned long status = priv->status;
  455. IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n",
  456. (flags & HW_CARD_DISABLED) ? "Kill" : "On",
  457. (flags & SW_CARD_DISABLED) ? "Kill" : "On",
  458. (flags & CT_CARD_DISABLED) ?
  459. "Reached" : "Not reached");
  460. if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED |
  461. CT_CARD_DISABLED)) {
  462. iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
  463. CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
  464. iwl_write_direct32(priv, HBUS_TARG_MBX_C,
  465. HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
  466. if (!(flags & RXON_CARD_DISABLED)) {
  467. iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
  468. CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
  469. iwl_write_direct32(priv, HBUS_TARG_MBX_C,
  470. HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
  471. }
  472. if (flags & CT_CARD_DISABLED)
  473. iwl_tt_enter_ct_kill(priv);
  474. }
  475. if (!(flags & CT_CARD_DISABLED))
  476. iwl_tt_exit_ct_kill(priv);
  477. if (flags & HW_CARD_DISABLED)
  478. set_bit(STATUS_RF_KILL_HW, &priv->status);
  479. else
  480. clear_bit(STATUS_RF_KILL_HW, &priv->status);
  481. if (!(flags & RXON_CARD_DISABLED))
  482. iwl_scan_cancel(priv);
  483. if ((test_bit(STATUS_RF_KILL_HW, &status) !=
  484. test_bit(STATUS_RF_KILL_HW, &priv->status)))
  485. wiphy_rfkill_set_hw_state(priv->hw->wiphy,
  486. test_bit(STATUS_RF_KILL_HW, &priv->status));
  487. else
  488. wake_up_interruptible(&priv->wait_command_queue);
  489. }
  490. static void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
  491. struct iwl_rx_mem_buffer *rxb)
  492. {
  493. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  494. struct iwl_missed_beacon_notif *missed_beacon;
  495. missed_beacon = &pkt->u.missed_beacon;
  496. if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) >
  497. priv->missed_beacon_threshold) {
  498. IWL_DEBUG_CALIB(priv,
  499. "missed bcn cnsq %d totl %d rcd %d expctd %d\n",
  500. le32_to_cpu(missed_beacon->consecutive_missed_beacons),
  501. le32_to_cpu(missed_beacon->total_missed_becons),
  502. le32_to_cpu(missed_beacon->num_recvd_beacons),
  503. le32_to_cpu(missed_beacon->num_expected_beacons));
  504. if (!test_bit(STATUS_SCANNING, &priv->status))
  505. iwl_init_sensitivity(priv);
  506. }
  507. }
  508. /* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD).
  509. * This will be used later in iwl_rx_reply_rx() for REPLY_RX_MPDU_CMD. */
  510. static void iwl_rx_reply_rx_phy(struct iwl_priv *priv,
  511. struct iwl_rx_mem_buffer *rxb)
  512. {
  513. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  514. priv->last_phy_res_valid = true;
  515. memcpy(&priv->last_phy_res, pkt->u.raw,
  516. sizeof(struct iwl_rx_phy_res));
  517. }
  518. /*
  519. * returns non-zero if packet should be dropped
  520. */
  521. static int iwl_set_decrypted_flag(struct iwl_priv *priv,
  522. struct ieee80211_hdr *hdr,
  523. u32 decrypt_res,
  524. struct ieee80211_rx_status *stats)
  525. {
  526. u16 fc = le16_to_cpu(hdr->frame_control);
  527. /*
  528. * All contexts have the same setting here due to it being
  529. * a module parameter, so OK to check any context.
  530. */
  531. if (priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags &
  532. RXON_FILTER_DIS_DECRYPT_MSK)
  533. return 0;
  534. if (!(fc & IEEE80211_FCTL_PROTECTED))
  535. return 0;
  536. IWL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res);
  537. switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) {
  538. case RX_RES_STATUS_SEC_TYPE_TKIP:
  539. /* The uCode has got a bad phase 1 Key, pushes the packet.
  540. * Decryption will be done in SW. */
  541. if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
  542. RX_RES_STATUS_BAD_KEY_TTAK)
  543. break;
  544. case RX_RES_STATUS_SEC_TYPE_WEP:
  545. if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
  546. RX_RES_STATUS_BAD_ICV_MIC) {
  547. /* bad ICV, the packet is destroyed since the
  548. * decryption is inplace, drop it */
  549. IWL_DEBUG_RX(priv, "Packet destroyed\n");
  550. return -1;
  551. }
  552. case RX_RES_STATUS_SEC_TYPE_CCMP:
  553. if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
  554. RX_RES_STATUS_DECRYPT_OK) {
  555. IWL_DEBUG_RX(priv, "hw decrypt successfully!!!\n");
  556. stats->flag |= RX_FLAG_DECRYPTED;
  557. }
  558. break;
  559. default:
  560. break;
  561. }
  562. return 0;
  563. }
  564. static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
  565. struct ieee80211_hdr *hdr,
  566. u16 len,
  567. u32 ampdu_status,
  568. struct iwl_rx_mem_buffer *rxb,
  569. struct ieee80211_rx_status *stats)
  570. {
  571. struct sk_buff *skb;
  572. __le16 fc = hdr->frame_control;
  573. struct iwl_rxon_context *ctx;
  574. /* We only process data packets if the interface is open */
  575. if (unlikely(!priv->is_open)) {
  576. IWL_DEBUG_DROP_LIMIT(priv,
  577. "Dropping packet while interface is not open.\n");
  578. return;
  579. }
  580. /* In case of HW accelerated crypto and bad decryption, drop */
  581. if (!iwlagn_mod_params.sw_crypto &&
  582. iwl_set_decrypted_flag(priv, hdr, ampdu_status, stats))
  583. return;
  584. skb = dev_alloc_skb(128);
  585. if (!skb) {
  586. IWL_ERR(priv, "dev_alloc_skb failed\n");
  587. return;
  588. }
  589. skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len);
  590. iwl_update_stats(priv, false, fc, len);
  591. /*
  592. * Wake any queues that were stopped due to a passive channel tx
  593. * failure. This can happen because the regulatory enforcement in
  594. * the device waits for a beacon before allowing transmission,
  595. * sometimes even after already having transmitted frames for the
  596. * association because the new RXON may reset the information.
  597. */
  598. if (unlikely(ieee80211_is_beacon(fc))) {
  599. for_each_context(priv, ctx) {
  600. if (!ctx->last_tx_rejected)
  601. continue;
  602. if (compare_ether_addr(hdr->addr3,
  603. ctx->active.bssid_addr))
  604. continue;
  605. ctx->last_tx_rejected = false;
  606. iwl_wake_any_queue(priv, ctx);
  607. }
  608. }
  609. memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
  610. ieee80211_rx(priv->hw, skb);
  611. rxb->page = NULL;
  612. }
  613. static u32 iwl_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
  614. {
  615. u32 decrypt_out = 0;
  616. if ((decrypt_in & RX_RES_STATUS_STATION_FOUND) ==
  617. RX_RES_STATUS_STATION_FOUND)
  618. decrypt_out |= (RX_RES_STATUS_STATION_FOUND |
  619. RX_RES_STATUS_NO_STATION_INFO_MISMATCH);
  620. decrypt_out |= (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK);
  621. /* packet was not encrypted */
  622. if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) ==
  623. RX_RES_STATUS_SEC_TYPE_NONE)
  624. return decrypt_out;
  625. /* packet was encrypted with unknown alg */
  626. if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) ==
  627. RX_RES_STATUS_SEC_TYPE_ERR)
  628. return decrypt_out;
  629. /* decryption was not done in HW */
  630. if ((decrypt_in & RX_MPDU_RES_STATUS_DEC_DONE_MSK) !=
  631. RX_MPDU_RES_STATUS_DEC_DONE_MSK)
  632. return decrypt_out;
  633. switch (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) {
  634. case RX_RES_STATUS_SEC_TYPE_CCMP:
  635. /* alg is CCM: check MIC only */
  636. if (!(decrypt_in & RX_MPDU_RES_STATUS_MIC_OK))
  637. /* Bad MIC */
  638. decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC;
  639. else
  640. decrypt_out |= RX_RES_STATUS_DECRYPT_OK;
  641. break;
  642. case RX_RES_STATUS_SEC_TYPE_TKIP:
  643. if (!(decrypt_in & RX_MPDU_RES_STATUS_TTAK_OK)) {
  644. /* Bad TTAK */
  645. decrypt_out |= RX_RES_STATUS_BAD_KEY_TTAK;
  646. break;
  647. }
  648. /* fall through if TTAK OK */
  649. default:
  650. if (!(decrypt_in & RX_MPDU_RES_STATUS_ICV_OK))
  651. decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC;
  652. else
  653. decrypt_out |= RX_RES_STATUS_DECRYPT_OK;
  654. break;
  655. }
  656. IWL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n",
  657. decrypt_in, decrypt_out);
  658. return decrypt_out;
  659. }
  660. /* Calc max signal level (dBm) among 3 possible receivers */
  661. static int iwlagn_calc_rssi(struct iwl_priv *priv,
  662. struct iwl_rx_phy_res *rx_resp)
  663. {
  664. /* data from PHY/DSP regarding signal strength, etc.,
  665. * contents are always there, not configurable by host
  666. */
  667. struct iwlagn_non_cfg_phy *ncphy =
  668. (struct iwlagn_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
  669. u32 val, rssi_a, rssi_b, rssi_c, max_rssi;
  670. u8 agc;
  671. val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_AGC_IDX]);
  672. agc = (val & IWLAGN_OFDM_AGC_MSK) >> IWLAGN_OFDM_AGC_BIT_POS;
  673. /* Find max rssi among 3 possible receivers.
  674. * These values are measured by the digital signal processor (DSP).
  675. * They should stay fairly constant even as the signal strength varies,
  676. * if the radio's automatic gain control (AGC) is working right.
  677. * AGC value (see below) will provide the "interesting" info.
  678. */
  679. val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_AB_IDX]);
  680. rssi_a = (val & IWLAGN_OFDM_RSSI_INBAND_A_BITMSK) >>
  681. IWLAGN_OFDM_RSSI_A_BIT_POS;
  682. rssi_b = (val & IWLAGN_OFDM_RSSI_INBAND_B_BITMSK) >>
  683. IWLAGN_OFDM_RSSI_B_BIT_POS;
  684. val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_C_IDX]);
  685. rssi_c = (val & IWLAGN_OFDM_RSSI_INBAND_C_BITMSK) >>
  686. IWLAGN_OFDM_RSSI_C_BIT_POS;
  687. max_rssi = max_t(u32, rssi_a, rssi_b);
  688. max_rssi = max_t(u32, max_rssi, rssi_c);
  689. IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
  690. rssi_a, rssi_b, rssi_c, max_rssi, agc);
  691. /* dBm = max_rssi dB - agc dB - constant.
  692. * Higher AGC (higher radio gain) means lower signal. */
  693. return max_rssi - agc - IWLAGN_RSSI_OFFSET;
  694. }
  695. /* Called for REPLY_RX (legacy ABG frames), or
  696. * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
  697. static void iwl_rx_reply_rx(struct iwl_priv *priv,
  698. struct iwl_rx_mem_buffer *rxb)
  699. {
  700. struct ieee80211_hdr *header;
  701. struct ieee80211_rx_status rx_status;
  702. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  703. struct iwl_rx_phy_res *phy_res;
  704. __le32 rx_pkt_status;
  705. struct iwl_rx_mpdu_res_start *amsdu;
  706. u32 len;
  707. u32 ampdu_status;
  708. u32 rate_n_flags;
  709. /**
  710. * REPLY_RX and REPLY_RX_MPDU_CMD are handled differently.
  711. * REPLY_RX: physical layer info is in this buffer
  712. * REPLY_RX_MPDU_CMD: physical layer info was sent in separate
  713. * command and cached in priv->last_phy_res
  714. *
  715. * Here we set up local variables depending on which command is
  716. * received.
  717. */
  718. if (pkt->hdr.cmd == REPLY_RX) {
  719. phy_res = (struct iwl_rx_phy_res *)pkt->u.raw;
  720. header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*phy_res)
  721. + phy_res->cfg_phy_cnt);
  722. len = le16_to_cpu(phy_res->byte_count);
  723. rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*phy_res) +
  724. phy_res->cfg_phy_cnt + len);
  725. ampdu_status = le32_to_cpu(rx_pkt_status);
  726. } else {
  727. if (!priv->last_phy_res_valid) {
  728. IWL_ERR(priv, "MPDU frame without cached PHY data\n");
  729. return;
  730. }
  731. phy_res = &priv->last_phy_res;
  732. amsdu = (struct iwl_rx_mpdu_res_start *)pkt->u.raw;
  733. header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu));
  734. len = le16_to_cpu(amsdu->byte_count);
  735. rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len);
  736. ampdu_status = iwl_translate_rx_status(priv,
  737. le32_to_cpu(rx_pkt_status));
  738. }
  739. if ((unlikely(phy_res->cfg_phy_cnt > 20))) {
  740. IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n",
  741. phy_res->cfg_phy_cnt);
  742. return;
  743. }
  744. if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) ||
  745. !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
  746. IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n",
  747. le32_to_cpu(rx_pkt_status));
  748. return;
  749. }
  750. /* This will be used in several places later */
  751. rate_n_flags = le32_to_cpu(phy_res->rate_n_flags);
  752. /* rx_status carries information about the packet to mac80211 */
  753. rx_status.mactime = le64_to_cpu(phy_res->timestamp);
  754. rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
  755. IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
  756. rx_status.freq =
  757. ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel),
  758. rx_status.band);
  759. rx_status.rate_idx =
  760. iwlagn_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band);
  761. rx_status.flag = 0;
  762. /* TSF isn't reliable. In order to allow smooth user experience,
  763. * this W/A doesn't propagate it to the mac80211 */
  764. /*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/
  765. priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp);
  766. /* Find max signal strength (dBm) among 3 antenna/receiver chains */
  767. rx_status.signal = iwlagn_calc_rssi(priv, phy_res);
  768. iwl_dbg_log_rx_data_frame(priv, len, header);
  769. IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n",
  770. rx_status.signal, (unsigned long long)rx_status.mactime);
  771. /*
  772. * "antenna number"
  773. *
  774. * It seems that the antenna field in the phy flags value
  775. * is actually a bit field. This is undefined by radiotap,
  776. * it wants an actual antenna number but I always get "7"
  777. * for most legacy frames I receive indicating that the
  778. * same frame was received on all three RX chains.
  779. *
  780. * I think this field should be removed in favor of a
  781. * new 802.11n radiotap field "RX chains" that is defined
  782. * as a bitmask.
  783. */
  784. rx_status.antenna =
  785. (le16_to_cpu(phy_res->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK)
  786. >> RX_RES_PHY_FLAGS_ANTENNA_POS;
  787. /* set the preamble flag if appropriate */
  788. if (phy_res->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK)
  789. rx_status.flag |= RX_FLAG_SHORTPRE;
  790. /* Set up the HT phy flags */
  791. if (rate_n_flags & RATE_MCS_HT_MSK)
  792. rx_status.flag |= RX_FLAG_HT;
  793. if (rate_n_flags & RATE_MCS_HT40_MSK)
  794. rx_status.flag |= RX_FLAG_40MHZ;
  795. if (rate_n_flags & RATE_MCS_SGI_MSK)
  796. rx_status.flag |= RX_FLAG_SHORT_GI;
  797. iwl_pass_packet_to_mac80211(priv, header, len, ampdu_status,
  798. rxb, &rx_status);
  799. }
  800. /**
  801. * iwl_setup_rx_handlers - Initialize Rx handler callbacks
  802. *
  803. * Setup the RX handlers for each of the reply types sent from the uCode
  804. * to the host.
  805. */
  806. void iwl_setup_rx_handlers(struct iwl_priv *priv)
  807. {
  808. void (**handlers)(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
  809. handlers = priv->rx_handlers;
  810. handlers[REPLY_ERROR] = iwl_rx_reply_error;
  811. handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa;
  812. handlers[SPECTRUM_MEASURE_NOTIFICATION] = iwl_rx_spectrum_measure_notif;
  813. handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif;
  814. handlers[PM_DEBUG_STATISTIC_NOTIFIC] = iwl_rx_pm_debug_statistics_notif;
  815. handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif;
  816. /*
  817. * The same handler is used for both the REPLY to a discrete
  818. * statistics request from the host as well as for the periodic
  819. * statistics notifications (after received beacons) from the uCode.
  820. */
  821. handlers[REPLY_STATISTICS_CMD] = iwl_rx_reply_statistics;
  822. handlers[STATISTICS_NOTIFICATION] = iwl_rx_statistics;
  823. iwl_setup_rx_scan_handlers(priv);
  824. handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif;
  825. handlers[MISSED_BEACONS_NOTIFICATION] = iwl_rx_missed_beacon_notif;
  826. /* Rx handlers */
  827. handlers[REPLY_RX_PHY_CMD] = iwl_rx_reply_rx_phy;
  828. handlers[REPLY_RX_MPDU_CMD] = iwl_rx_reply_rx;
  829. /* block ack */
  830. handlers[REPLY_COMPRESSED_BA] = iwlagn_rx_reply_compressed_ba;
  831. /* init calibration handlers */
  832. priv->rx_handlers[CALIBRATION_RES_NOTIFICATION] =
  833. iwlagn_rx_calib_result;
  834. priv->rx_handlers[REPLY_TX] = iwlagn_rx_reply_tx;
  835. /* set up notification wait support */
  836. spin_lock_init(&priv->notif_wait_lock);
  837. INIT_LIST_HEAD(&priv->notif_waits);
  838. init_waitqueue_head(&priv->notif_waitq);
  839. /* Set up BT Rx handlers */
  840. if (priv->cfg->lib->bt_rx_handler_setup)
  841. priv->cfg->lib->bt_rx_handler_setup(priv);
  842. }
  843. void iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
  844. {
  845. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  846. /*
  847. * Do the notification wait before RX handlers so
  848. * even if the RX handler consumes the RXB we have
  849. * access to it in the notification wait entry.
  850. */
  851. if (!list_empty(&priv->notif_waits)) {
  852. struct iwl_notification_wait *w;
  853. spin_lock(&priv->notif_wait_lock);
  854. list_for_each_entry(w, &priv->notif_waits, list) {
  855. if (w->cmd != pkt->hdr.cmd)
  856. continue;
  857. IWL_DEBUG_RX(priv,
  858. "Notif: %s, 0x%02x - wake the callers up\n",
  859. get_cmd_string(pkt->hdr.cmd),
  860. pkt->hdr.cmd);
  861. w->triggered = true;
  862. if (w->fn)
  863. w->fn(priv, pkt, w->fn_data);
  864. }
  865. spin_unlock(&priv->notif_wait_lock);
  866. wake_up_all(&priv->notif_waitq);
  867. }
  868. if (priv->pre_rx_handler)
  869. priv->pre_rx_handler(priv, rxb);
  870. /* Based on type of command response or notification,
  871. * handle those that need handling via function in
  872. * rx_handlers table. See iwl_setup_rx_handlers() */
  873. if (priv->rx_handlers[pkt->hdr.cmd]) {
  874. priv->isr_stats.rx_handlers[pkt->hdr.cmd]++;
  875. priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
  876. } else {
  877. /* No handling needed */
  878. IWL_DEBUG_RX(priv,
  879. "No handler needed for %s, 0x%02x\n",
  880. get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
  881. }
  882. }