~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/net/wireless/iwlwifi/iwl-rx.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
2
 *
3
 
 * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved.
 
3
 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
4
4
 *
5
5
 * Portions of this file are derived from the ipw3945 project, as well
6
6
 * as portions of the ieee80211 subsystem header files.
225
225
 *
226
226
 ******************************************************************************/
227
227
 
228
 
static void iwl_rx_reply_alive(struct iwl_priv *priv,
229
 
                               struct iwl_rx_mem_buffer *rxb)
230
 
{
231
 
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
232
 
        struct iwl_alive_resp *palive;
233
 
        struct delayed_work *pwork;
234
 
 
235
 
        palive = &pkt->u.alive_frame;
236
 
 
237
 
        IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision "
238
 
                       "0x%01X 0x%01X\n",
239
 
                       palive->is_valid, palive->ver_type,
240
 
                       palive->ver_subtype);
241
 
 
242
 
        if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
243
 
                IWL_DEBUG_INFO(priv, "Initialization Alive received.\n");
244
 
                memcpy(&priv->card_alive_init,
245
 
                       &pkt->u.alive_frame,
246
 
                       sizeof(struct iwl_init_alive_resp));
247
 
                pwork = &priv->init_alive_start;
248
 
        } else {
249
 
                IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
250
 
                memcpy(&priv->card_alive, &pkt->u.alive_frame,
251
 
                       sizeof(struct iwl_alive_resp));
252
 
                pwork = &priv->alive_start;
253
 
        }
254
 
 
255
 
        /* We delay the ALIVE response by 5ms to
256
 
         * give the HW RF Kill time to activate... */
257
 
        if (palive->is_valid == UCODE_VALID_OK)
258
 
                queue_delayed_work(priv->workqueue, pwork,
259
 
                                   msecs_to_jiffies(5));
260
 
        else {
261
 
                IWL_WARN(priv, "%s uCode did not respond OK.\n",
262
 
                        (palive->ver_subtype == INITIALIZE_SUBTYPE) ?
263
 
                        "init" : "runtime");
264
 
                /*
265
 
                 * If fail to load init uCode,
266
 
                 * let's try to load the init uCode again.
267
 
                 * We should not get into this situation, but if it
268
 
                 * does happen, we should not move on and loading "runtime"
269
 
                 * without proper calibrate the device.
270
 
                 */
271
 
                if (palive->ver_subtype == INITIALIZE_SUBTYPE)
272
 
                        priv->ucode_type = UCODE_NONE;
273
 
                queue_work(priv->workqueue, &priv->restart);
274
 
        }
275
 
}
276
 
 
277
228
static void iwl_rx_reply_error(struct iwl_priv *priv,
278
229
                               struct iwl_rx_mem_buffer *rxb)
279
230
{
299
250
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
300
251
        struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
301
252
 
302
 
        if (priv->switch_rxon.switch_in_progress) {
303
 
                if (!le32_to_cpu(csa->status) &&
304
 
                    (csa->channel == priv->switch_rxon.channel)) {
305
 
                        rxon->channel = csa->channel;
306
 
                        ctx->staging.channel = csa->channel;
307
 
                        IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
308
 
                              le16_to_cpu(csa->channel));
309
 
                        iwl_chswitch_done(priv, true);
310
 
                } else {
311
 
                        IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
312
 
                              le16_to_cpu(csa->channel));
313
 
                        iwl_chswitch_done(priv, false);
314
 
                }
 
253
        if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
 
254
                return;
 
255
 
 
256
        if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
 
257
                rxon->channel = csa->channel;
 
258
                ctx->staging.channel = csa->channel;
 
259
                IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
 
260
                              le16_to_cpu(csa->channel));
 
261
                iwl_chswitch_done(priv, true);
 
262
        } else {
 
263
                IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
 
264
                        le16_to_cpu(csa->channel));
 
265
                iwl_chswitch_done(priv, false);
315
266
        }
316
267
}
317
268
 
390
341
 * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
391
342
 * operation state.
392
343
 */
393
 
static bool iwl_good_ack_health(struct iwl_priv *priv, struct iwl_rx_packet *pkt)
 
344
static bool iwl_good_ack_health(struct iwl_priv *priv,
 
345
                                struct statistics_tx *cur)
394
346
{
395
347
        int actual_delta, expected_delta, ba_timeout_delta;
396
 
        struct statistics_tx *cur, *old;
 
348
        struct statistics_tx *old;
397
349
 
398
350
        if (priv->_agn.agg_tids_count)
399
351
                return true;
400
352
 
401
 
        if (iwl_bt_statistics(priv)) {
402
 
                cur = &pkt->u.stats_bt.tx;
403
 
                old = &priv->_agn.statistics_bt.tx;
404
 
        } else {
405
 
                cur = &pkt->u.stats.tx;
406
 
                old = &priv->_agn.statistics.tx;
407
 
        }
 
353
        old = &priv->statistics.tx;
408
354
 
409
355
        actual_delta = le32_to_cpu(cur->actual_ack_cnt) -
410
356
                       le32_to_cpu(old->actual_ack_cnt);
430
376
                 * DEBUG is not, these will just compile out.
431
377
                 */
432
378
                IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta %d\n",
433
 
                                priv->_agn.delta_statistics.tx.rx_detected_cnt);
 
379
                                priv->delta_stats.tx.rx_detected_cnt);
434
380
                IWL_DEBUG_RADIO(priv,
435
381
                                "ack_or_ba_timeout_collision delta %d\n",
436
 
                                priv->_agn.delta_statistics.tx.ack_or_ba_timeout_collision);
 
382
                                priv->delta_stats.tx.ack_or_ba_timeout_collision);
437
383
#endif
438
384
 
439
385
                if (ba_timeout_delta >= BA_TIMEOUT_MAX)
450
396
 * to improve the throughput.
451
397
 */
452
398
static bool iwl_good_plcp_health(struct iwl_priv *priv,
453
 
                                 struct iwl_rx_packet *pkt, unsigned int msecs)
 
399
                                 struct statistics_rx_phy *cur_ofdm,
 
400
                                 struct statistics_rx_ht_phy *cur_ofdm_ht,
 
401
                                 unsigned int msecs)
454
402
{
455
403
        int delta;
456
404
        int threshold = priv->cfg->base_params->plcp_delta_threshold;
460
408
                return true;
461
409
        }
462
410
 
463
 
        if (iwl_bt_statistics(priv)) {
464
 
                struct statistics_rx_bt *cur, *old;
465
 
 
466
 
                cur = &pkt->u.stats_bt.rx;
467
 
                old = &priv->_agn.statistics_bt.rx;
468
 
 
469
 
                delta = le32_to_cpu(cur->ofdm.plcp_err) -
470
 
                        le32_to_cpu(old->ofdm.plcp_err) +
471
 
                        le32_to_cpu(cur->ofdm_ht.plcp_err) -
472
 
                        le32_to_cpu(old->ofdm_ht.plcp_err);
473
 
        } else {
474
 
                struct statistics_rx *cur, *old;
475
 
 
476
 
                cur = &pkt->u.stats.rx;
477
 
                old = &priv->_agn.statistics.rx;
478
 
 
479
 
                delta = le32_to_cpu(cur->ofdm.plcp_err) -
480
 
                        le32_to_cpu(old->ofdm.plcp_err) +
481
 
                        le32_to_cpu(cur->ofdm_ht.plcp_err) -
482
 
                        le32_to_cpu(old->ofdm_ht.plcp_err);
483
 
        }
484
 
 
485
 
        /* Can be negative if firmware reseted statistics */
 
411
        delta = le32_to_cpu(cur_ofdm->plcp_err) -
 
412
                le32_to_cpu(priv->statistics.rx_ofdm.plcp_err) +
 
413
                le32_to_cpu(cur_ofdm_ht->plcp_err) -
 
414
                le32_to_cpu(priv->statistics.rx_ofdm_ht.plcp_err);
 
415
 
 
416
        /* Can be negative if firmware reset statistics */
486
417
        if (delta <= 0)
487
418
                return true;
488
419
 
497
428
}
498
429
 
499
430
static void iwl_recover_from_statistics(struct iwl_priv *priv,
500
 
                                        struct iwl_rx_packet *pkt)
 
431
                                        struct statistics_rx_phy *cur_ofdm,
 
432
                                        struct statistics_rx_ht_phy *cur_ofdm_ht,
 
433
                                        struct statistics_tx *tx,
 
434
                                        unsigned long stamp)
501
435
{
502
 
        const struct iwl_mod_params *mod_params = priv->cfg->mod_params;
503
436
        unsigned int msecs;
504
 
        unsigned long stamp;
505
437
 
506
438
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
507
439
                return;
508
440
 
509
 
        stamp = jiffies;
510
441
        msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies);
511
442
 
512
443
        /* Only gather statistics and update time stamp when not associated */
513
444
        if (!iwl_is_any_associated(priv))
514
 
                goto out;
 
445
                return;
515
446
 
516
447
        /* Do not check/recover when do not have enough statistics data */
517
448
        if (msecs < 99)
518
449
                return;
519
450
 
520
 
        if (mod_params->ack_check && !iwl_good_ack_health(priv, pkt)) {
 
451
        if (iwlagn_mod_params.ack_check && !iwl_good_ack_health(priv, tx)) {
521
452
                IWL_ERR(priv, "low ack count detected, restart firmware\n");
522
453
                if (!iwl_force_reset(priv, IWL_FW_RESET, false))
523
454
                        return;
524
455
        }
525
456
 
526
 
        if (mod_params->plcp_check && !iwl_good_plcp_health(priv, pkt, msecs))
 
457
        if (iwlagn_mod_params.plcp_check &&
 
458
            !iwl_good_plcp_health(priv, cur_ofdm, cur_ofdm_ht, msecs))
527
459
                iwl_force_reset(priv, IWL_RF_RESET, false);
528
 
 
529
 
out:
530
 
        if (iwl_bt_statistics(priv))
531
 
                memcpy(&priv->_agn.statistics_bt, &pkt->u.stats_bt,
532
 
                        sizeof(priv->_agn.statistics_bt));
533
 
        else
534
 
                memcpy(&priv->_agn.statistics, &pkt->u.stats,
535
 
                        sizeof(priv->_agn.statistics));
536
 
 
537
 
        priv->rx_statistics_jiffies = stamp;
538
460
}
539
461
 
540
462
/* Calculate noise level, based on measurements during network silence just
548
470
        int bcn_silence_a, bcn_silence_b, bcn_silence_c;
549
471
        int last_rx_noise;
550
472
 
551
 
        if (iwl_bt_statistics(priv))
552
 
                rx_info = &(priv->_agn.statistics_bt.rx.general.common);
553
 
        else
554
 
                rx_info = &(priv->_agn.statistics.rx.general);
 
473
        rx_info = &priv->statistics.rx_non_phy;
 
474
 
555
475
        bcn_silence_a =
556
476
                le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER;
557
477
        bcn_silence_b =
583
503
                        last_rx_noise);
584
504
}
585
505
 
 
506
#ifdef CONFIG_IWLWIFI_DEBUGFS
586
507
/*
587
508
 *  based on the assumption of all statistics counter are in DWORD
588
509
 *  FIXME: This function is for debugging, do not deal with
589
510
 *  the case of counters roll-over.
590
511
 */
591
 
static void iwl_accumulative_statistics(struct iwl_priv *priv,
592
 
                                        __le32 *stats)
 
512
static void accum_stats(__le32 *prev, __le32 *cur, __le32 *delta,
 
513
                        __le32 *max_delta, __le32 *accum, int size)
593
514
{
594
 
#ifdef CONFIG_IWLWIFI_DEBUGFS
595
 
        int i, size;
596
 
        __le32 *prev_stats;
597
 
        u32 *accum_stats;
598
 
        u32 *delta, *max_delta;
599
 
        struct statistics_general_common *general, *accum_general;
600
 
        struct statistics_tx *tx, *accum_tx;
 
515
        int i;
601
516
 
602
 
        if (iwl_bt_statistics(priv)) {
603
 
                prev_stats = (__le32 *)&priv->_agn.statistics_bt;
604
 
                accum_stats = (u32 *)&priv->_agn.accum_statistics_bt;
605
 
                size = sizeof(struct iwl_bt_notif_statistics);
606
 
                general = &priv->_agn.statistics_bt.general.common;
607
 
                accum_general = &priv->_agn.accum_statistics_bt.general.common;
608
 
                tx = &priv->_agn.statistics_bt.tx;
609
 
                accum_tx = &priv->_agn.accum_statistics_bt.tx;
610
 
                delta = (u32 *)&priv->_agn.delta_statistics_bt;
611
 
                max_delta = (u32 *)&priv->_agn.max_delta_bt;
612
 
        } else {
613
 
                prev_stats = (__le32 *)&priv->_agn.statistics;
614
 
                accum_stats = (u32 *)&priv->_agn.accum_statistics;
615
 
                size = sizeof(struct iwl_notif_statistics);
616
 
                general = &priv->_agn.statistics.general.common;
617
 
                accum_general = &priv->_agn.accum_statistics.general.common;
618
 
                tx = &priv->_agn.statistics.tx;
619
 
                accum_tx = &priv->_agn.accum_statistics.tx;
620
 
                delta = (u32 *)&priv->_agn.delta_statistics;
621
 
                max_delta = (u32 *)&priv->_agn.max_delta;
622
 
        }
623
 
        for (i = sizeof(__le32); i < size;
624
 
             i += sizeof(__le32), stats++, prev_stats++, delta++,
625
 
             max_delta++, accum_stats++) {
626
 
                if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
627
 
                        *delta = (le32_to_cpu(*stats) -
628
 
                                le32_to_cpu(*prev_stats));
629
 
                        *accum_stats += *delta;
630
 
                        if (*delta > *max_delta)
 
517
        for (i = 0;
 
518
             i < size / sizeof(__le32);
 
519
             i++, prev++, cur++, delta++, max_delta++, accum++) {
 
520
                if (le32_to_cpu(*cur) > le32_to_cpu(*prev)) {
 
521
                        *delta = cpu_to_le32(
 
522
                                le32_to_cpu(*cur) - le32_to_cpu(*prev));
 
523
                        le32_add_cpu(accum, le32_to_cpu(*delta));
 
524
                        if (le32_to_cpu(*delta) > le32_to_cpu(*max_delta))
631
525
                                *max_delta = *delta;
632
526
                }
633
527
        }
634
 
 
635
 
        /* reset accumulative statistics for "no-counter" type statistics */
636
 
        accum_general->temperature = general->temperature;
637
 
        accum_general->temperature_m = general->temperature_m;
638
 
        accum_general->ttl_timestamp = general->ttl_timestamp;
639
 
        accum_tx->tx_power.ant_a = tx->tx_power.ant_a;
640
 
        accum_tx->tx_power.ant_b = tx->tx_power.ant_b;
641
 
        accum_tx->tx_power.ant_c = tx->tx_power.ant_c;
 
528
}
 
529
 
 
530
static void
 
531
iwl_accumulative_statistics(struct iwl_priv *priv,
 
532
                            struct statistics_general_common *common,
 
533
                            struct statistics_rx_non_phy *rx_non_phy,
 
534
                            struct statistics_rx_phy *rx_ofdm,
 
535
                            struct statistics_rx_ht_phy *rx_ofdm_ht,
 
536
                            struct statistics_rx_phy *rx_cck,
 
537
                            struct statistics_tx *tx,
 
538
                            struct statistics_bt_activity *bt_activity)
 
539
{
 
540
#define ACCUM(_name)    \
 
541
        accum_stats((__le32 *)&priv->statistics._name,          \
 
542
                    (__le32 *)_name,                            \
 
543
                    (__le32 *)&priv->delta_stats._name,         \
 
544
                    (__le32 *)&priv->max_delta_stats._name,     \
 
545
                    (__le32 *)&priv->accum_stats._name,         \
 
546
                    sizeof(*_name));
 
547
 
 
548
        ACCUM(common);
 
549
        ACCUM(rx_non_phy);
 
550
        ACCUM(rx_ofdm);
 
551
        ACCUM(rx_ofdm_ht);
 
552
        ACCUM(rx_cck);
 
553
        ACCUM(tx);
 
554
        if (bt_activity)
 
555
                ACCUM(bt_activity);
 
556
#undef ACCUM
 
557
}
 
558
#else
 
559
static inline void
 
560
iwl_accumulative_statistics(struct iwl_priv *priv,
 
561
                            struct statistics_general_common *common,
 
562
                            struct statistics_rx_non_phy *rx_non_phy,
 
563
                            struct statistics_rx_phy *rx_ofdm,
 
564
                            struct statistics_rx_ht_phy *rx_ofdm_ht,
 
565
                            struct statistics_rx_phy *rx_cck,
 
566
                            struct statistics_tx *tx,
 
567
                            struct statistics_bt_activity *bt_activity)
 
568
{
 
569
}
642
570
#endif
643
 
}
644
571
 
645
572
static void iwl_rx_statistics(struct iwl_priv *priv,
646
573
                              struct iwl_rx_mem_buffer *rxb)
647
574
{
 
575
        unsigned long stamp = jiffies;
648
576
        const int reg_recalib_period = 60;
649
577
        int change;
650
578
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
651
 
 
652
 
        if (iwl_bt_statistics(priv)) {
653
 
                IWL_DEBUG_RX(priv,
654
 
                             "Statistics notification received (%d vs %d).\n",
655
 
                             (int)sizeof(struct iwl_bt_notif_statistics),
656
 
                             le32_to_cpu(pkt->len_n_flags) &
657
 
                             FH_RSCSR_FRAME_SIZE_MSK);
658
 
 
659
 
                change = ((priv->_agn.statistics_bt.general.common.temperature !=
660
 
                           pkt->u.stats_bt.general.common.temperature) ||
661
 
                           ((priv->_agn.statistics_bt.flag &
662
 
                           STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
663
 
                           (pkt->u.stats_bt.flag &
664
 
                           STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
665
 
 
666
 
                iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats_bt);
 
579
        u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
 
580
        __le32 *flag;
 
581
        struct statistics_general_common *common;
 
582
        struct statistics_rx_non_phy *rx_non_phy;
 
583
        struct statistics_rx_phy *rx_ofdm;
 
584
        struct statistics_rx_ht_phy *rx_ofdm_ht;
 
585
        struct statistics_rx_phy *rx_cck;
 
586
        struct statistics_tx *tx;
 
587
        struct statistics_bt_activity *bt_activity;
 
588
 
 
589
        len -= sizeof(struct iwl_cmd_header); /* skip header */
 
590
 
 
591
        IWL_DEBUG_RX(priv, "Statistics notification received (%d bytes).\n",
 
592
                     len);
 
593
 
 
594
        if (len == sizeof(struct iwl_bt_notif_statistics)) {
 
595
                struct iwl_bt_notif_statistics *stats;
 
596
                stats = &pkt->u.stats_bt;
 
597
                flag = &stats->flag;
 
598
                common = &stats->general.common;
 
599
                rx_non_phy = &stats->rx.general.common;
 
600
                rx_ofdm = &stats->rx.ofdm;
 
601
                rx_ofdm_ht = &stats->rx.ofdm_ht;
 
602
                rx_cck = &stats->rx.cck;
 
603
                tx = &stats->tx;
 
604
                bt_activity = &stats->general.activity;
 
605
 
 
606
#ifdef CONFIG_IWLWIFI_DEBUGFS
 
607
                /* handle this exception directly */
 
608
                priv->statistics.num_bt_kills = stats->rx.general.num_bt_kills;
 
609
                le32_add_cpu(&priv->statistics.accum_num_bt_kills,
 
610
                             le32_to_cpu(stats->rx.general.num_bt_kills));
 
611
#endif
 
612
        } else if (len == sizeof(struct iwl_notif_statistics)) {
 
613
                struct iwl_notif_statistics *stats;
 
614
                stats = &pkt->u.stats;
 
615
                flag = &stats->flag;
 
616
                common = &stats->general.common;
 
617
                rx_non_phy = &stats->rx.general;
 
618
                rx_ofdm = &stats->rx.ofdm;
 
619
                rx_ofdm_ht = &stats->rx.ofdm_ht;
 
620
                rx_cck = &stats->rx.cck;
 
621
                tx = &stats->tx;
 
622
                bt_activity = NULL;
667
623
        } else {
668
 
                IWL_DEBUG_RX(priv,
669
 
                             "Statistics notification received (%d vs %d).\n",
670
 
                             (int)sizeof(struct iwl_notif_statistics),
671
 
                             le32_to_cpu(pkt->len_n_flags) &
672
 
                             FH_RSCSR_FRAME_SIZE_MSK);
673
 
 
674
 
                change = ((priv->_agn.statistics.general.common.temperature !=
675
 
                           pkt->u.stats.general.common.temperature) ||
676
 
                           ((priv->_agn.statistics.flag &
677
 
                           STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
678
 
                           (pkt->u.stats.flag &
679
 
                           STATISTICS_REPLY_FLG_HT40_MODE_MSK)));
680
 
 
681
 
                iwl_accumulative_statistics(priv, (__le32 *)&pkt->u.stats);
 
624
                WARN_ONCE(1, "len %d doesn't match BT (%zu) or normal (%zu)\n",
 
625
                          len, sizeof(struct iwl_bt_notif_statistics),
 
626
                          sizeof(struct iwl_notif_statistics));
 
627
                return;
682
628
        }
683
629
 
684
 
        iwl_recover_from_statistics(priv, pkt);
 
630
        change = common->temperature != priv->statistics.common.temperature ||
 
631
                 (*flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK) !=
 
632
                 (priv->statistics.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK);
 
633
 
 
634
        iwl_accumulative_statistics(priv, common, rx_non_phy, rx_ofdm,
 
635
                                    rx_ofdm_ht, rx_cck, tx, bt_activity);
 
636
 
 
637
        iwl_recover_from_statistics(priv, rx_ofdm, rx_ofdm_ht, tx, stamp);
 
638
 
 
639
        priv->statistics.flag = *flag;
 
640
        memcpy(&priv->statistics.common, common, sizeof(*common));
 
641
        memcpy(&priv->statistics.rx_non_phy, rx_non_phy, sizeof(*rx_non_phy));
 
642
        memcpy(&priv->statistics.rx_ofdm, rx_ofdm, sizeof(*rx_ofdm));
 
643
        memcpy(&priv->statistics.rx_ofdm_ht, rx_ofdm_ht, sizeof(*rx_ofdm_ht));
 
644
        memcpy(&priv->statistics.rx_cck, rx_cck, sizeof(*rx_cck));
 
645
        memcpy(&priv->statistics.tx, tx, sizeof(*tx));
 
646
#ifdef CONFIG_IWLWIFI_DEBUGFS
 
647
        if (bt_activity)
 
648
                memcpy(&priv->statistics.bt_activity, bt_activity,
 
649
                        sizeof(*bt_activity));
 
650
#endif
 
651
 
 
652
        priv->rx_statistics_jiffies = stamp;
685
653
 
686
654
        set_bit(STATUS_STATISTICS, &priv->status);
687
655
 
708
676
 
709
677
        if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) {
710
678
#ifdef CONFIG_IWLWIFI_DEBUGFS
711
 
                memset(&priv->_agn.accum_statistics, 0,
712
 
                        sizeof(struct iwl_notif_statistics));
713
 
                memset(&priv->_agn.delta_statistics, 0,
714
 
                        sizeof(struct iwl_notif_statistics));
715
 
                memset(&priv->_agn.max_delta, 0,
716
 
                        sizeof(struct iwl_notif_statistics));
717
 
                memset(&priv->_agn.accum_statistics_bt, 0,
718
 
                        sizeof(struct iwl_bt_notif_statistics));
719
 
                memset(&priv->_agn.delta_statistics_bt, 0,
720
 
                        sizeof(struct iwl_bt_notif_statistics));
721
 
                memset(&priv->_agn.max_delta_bt, 0,
722
 
                        sizeof(struct iwl_bt_notif_statistics));
 
679
                memset(&priv->accum_stats, 0,
 
680
                        sizeof(priv->accum_stats));
 
681
                memset(&priv->delta_stats, 0,
 
682
                        sizeof(priv->delta_stats));
 
683
                memset(&priv->max_delta_stats, 0,
 
684
                        sizeof(priv->max_delta_stats));
723
685
#endif
724
686
                IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
725
687
        }
873
835
{
874
836
        struct sk_buff *skb;
875
837
        __le16 fc = hdr->frame_control;
 
838
        struct iwl_rxon_context *ctx;
876
839
 
877
840
        /* We only process data packets if the interface is open */
878
841
        if (unlikely(!priv->is_open)) {
882
845
        }
883
846
 
884
847
        /* In case of HW accelerated crypto and bad decryption, drop */
885
 
        if (!priv->cfg->mod_params->sw_crypto &&
 
848
        if (!iwlagn_mod_params.sw_crypto &&
886
849
            iwl_set_decrypted_flag(priv, hdr, ampdu_status, stats))
887
850
                return;
888
851
 
895
858
        skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len);
896
859
 
897
860
        iwl_update_stats(priv, false, fc, len);
 
861
 
 
862
        /*
 
863
        * Wake any queues that were stopped due to a passive channel tx
 
864
        * failure. This can happen because the regulatory enforcement in
 
865
        * the device waits for a beacon before allowing transmission,
 
866
        * sometimes even after already having transmitted frames for the
 
867
        * association because the new RXON may reset the information.
 
868
        */
 
869
        if (unlikely(ieee80211_is_beacon(fc))) {
 
870
                for_each_context(priv, ctx) {
 
871
                        if (!ctx->last_tx_rejected)
 
872
                                continue;
 
873
                        if (compare_ether_addr(hdr->addr3,
 
874
                                               ctx->active.bssid_addr))
 
875
                                continue;
 
876
                        ctx->last_tx_rejected = false;
 
877
                        iwl_wake_any_queue(priv, ctx);
 
878
                }
 
879
        }
 
880
 
898
881
        memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
899
882
 
900
883
        ieee80211_rx(priv->hw, skb);
901
 
        priv->alloc_rxb_page--;
902
884
        rxb->page = NULL;
903
885
}
904
886
 
1093
1075
 
1094
1076
        handlers = priv->rx_handlers;
1095
1077
 
1096
 
        handlers[REPLY_ALIVE]                   = iwl_rx_reply_alive;
1097
1078
        handlers[REPLY_ERROR]                   = iwl_rx_reply_error;
1098
1079
        handlers[CHANNEL_SWITCH_NOTIFICATION]   = iwl_rx_csa;
1099
1080
        handlers[SPECTRUM_MEASURE_NOTIFICATION] = iwl_rx_spectrum_measure_notif;