diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2012-02-13 05:23:20 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-02-22 14:51:15 -0500 |
commit | 288f9954132cd64f60fbb8051e31d62d8c35875f (patch) | |
tree | 5defaae6d77d4babd0a8bf5b9e3eefe3f1d19ee6 /drivers/net/wireless/iwlegacy | |
parent | c936355172a7e4aeadbbdcaae48f10e31f604899 (diff) |
iwlegacy: get rid of tx/rx traffic log
The same data can be gathered using monitor mode.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy')
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945-mac.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/4965-mac.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/common.c | 247 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/common.h | 51 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/debug.c | 243 |
6 files changed, 145 insertions, 423 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 19a4d56dd0ab..1743accc1271 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -573,7 +573,6 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb) | |||
573 | len = (u16) skb->len; | 573 | len = (u16) skb->len; |
574 | tx_cmd->len = cpu_to_le16(len); | 574 | tx_cmd->len = cpu_to_le16(len); |
575 | 575 | ||
576 | il_dbg_log_tx_data_frame(il, len, hdr); | ||
577 | il_update_stats(il, true, fc, len); | 576 | il_update_stats(il, true, fc, len); |
578 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; | 577 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; |
579 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; | 578 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; |
@@ -3098,11 +3097,9 @@ il3945_store_debug_level(struct device *d, struct device_attribute *attr, | |||
3098 | ret = strict_strtoul(buf, 0, &val); | 3097 | ret = strict_strtoul(buf, 0, &val); |
3099 | if (ret) | 3098 | if (ret) |
3100 | IL_INFO("%s is not in hex or decimal form.\n", buf); | 3099 | IL_INFO("%s is not in hex or decimal form.\n", buf); |
3101 | else { | 3100 | else |
3102 | il->debug_level = val; | 3101 | il->debug_level = val; |
3103 | if (il_alloc_traffic_mem(il)) | 3102 | |
3104 | IL_ERR("Not enough memory to generate traffic log\n"); | ||
3105 | } | ||
3106 | return strnlen(buf, count); | 3103 | return strnlen(buf, count); |
3107 | } | 3104 | } |
3108 | 3105 | ||
@@ -3625,9 +3622,6 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3625 | il->pci_dev = pdev; | 3622 | il->pci_dev = pdev; |
3626 | il->inta_mask = CSR_INI_SET_MASK; | 3623 | il->inta_mask = CSR_INI_SET_MASK; |
3627 | 3624 | ||
3628 | if (il_alloc_traffic_mem(il)) | ||
3629 | IL_ERR("Not enough memory to generate traffic log\n"); | ||
3630 | |||
3631 | /*************************** | 3625 | /*************************** |
3632 | * 2. Initializing PCI bus | 3626 | * 2. Initializing PCI bus |
3633 | * *************************/ | 3627 | * *************************/ |
@@ -3790,7 +3784,6 @@ out_pci_disable_device: | |||
3790 | pci_set_drvdata(pdev, NULL); | 3784 | pci_set_drvdata(pdev, NULL); |
3791 | pci_disable_device(pdev); | 3785 | pci_disable_device(pdev); |
3792 | out_ieee80211_free_hw: | 3786 | out_ieee80211_free_hw: |
3793 | il_free_traffic_mem(il); | ||
3794 | ieee80211_free_hw(il->hw); | 3787 | ieee80211_free_hw(il->hw); |
3795 | out: | 3788 | out: |
3796 | return err; | 3789 | return err; |
@@ -3858,7 +3851,6 @@ il3945_pci_remove(struct pci_dev *pdev) | |||
3858 | * until now... */ | 3851 | * until now... */ |
3859 | destroy_workqueue(il->workqueue); | 3852 | destroy_workqueue(il->workqueue); |
3860 | il->workqueue = NULL; | 3853 | il->workqueue = NULL; |
3861 | il_free_traffic_mem(il); | ||
3862 | 3854 | ||
3863 | free_irq(pdev->irq, il); | 3855 | free_irq(pdev->irq, il); |
3864 | pci_disable_msi(pdev); | 3856 | pci_disable_msi(pdev); |
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c index fde6979d080a..95ebd43ae537 100644 --- a/drivers/net/wireless/iwlegacy/3945.c +++ b/drivers/net/wireless/iwlegacy/3945.c | |||
@@ -573,8 +573,6 @@ il3945_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) | |||
573 | network_packet ? '*' : ' ', le16_to_cpu(rx_hdr->channel), | 573 | network_packet ? '*' : ' ', le16_to_cpu(rx_hdr->channel), |
574 | rx_status.signal, rx_status.signal, rx_status.rate_idx); | 574 | rx_status.signal, rx_status.signal, rx_status.rate_idx); |
575 | 575 | ||
576 | il_dbg_log_rx_data_frame(il, le16_to_cpu(rx_hdr->len), header); | ||
577 | |||
578 | if (network_packet) { | 576 | if (network_packet) { |
579 | il->_3945.last_beacon_time = | 577 | il->_3945.last_beacon_time = |
580 | le32_to_cpu(rx_end->beacon_timestamp); | 578 | le32_to_cpu(rx_end->beacon_timestamp); |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 89275bfe559f..b251d34f0790 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -688,7 +688,6 @@ il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) | |||
688 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ | 688 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ |
689 | rx_status.signal = il4965_calc_rssi(il, phy_res); | 689 | rx_status.signal = il4965_calc_rssi(il, phy_res); |
690 | 690 | ||
691 | il_dbg_log_rx_data_frame(il, len, header); | ||
692 | D_STATS("Rssi %d, TSF %llu\n", rx_status.signal, | 691 | D_STATS("Rssi %d, TSF %llu\n", rx_status.signal, |
693 | (unsigned long long)rx_status.mactime); | 692 | (unsigned long long)rx_status.mactime); |
694 | 693 | ||
@@ -1781,7 +1780,6 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb) | |||
1781 | 1780 | ||
1782 | /* TODO need this for burst mode later on */ | 1781 | /* TODO need this for burst mode later on */ |
1783 | il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id); | 1782 | il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id); |
1784 | il_dbg_log_tx_data_frame(il, len, hdr); | ||
1785 | 1783 | ||
1786 | il4965_tx_cmd_build_rate(il, tx_cmd, info, fc); | 1784 | il4965_tx_cmd_build_rate(il, tx_cmd, info, fc); |
1787 | 1785 | ||
@@ -4541,11 +4539,9 @@ il4965_store_debug_level(struct device *d, struct device_attribute *attr, | |||
4541 | ret = strict_strtoul(buf, 0, &val); | 4539 | ret = strict_strtoul(buf, 0, &val); |
4542 | if (ret) | 4540 | if (ret) |
4543 | IL_ERR("%s is not in hex or decimal form.\n", buf); | 4541 | IL_ERR("%s is not in hex or decimal form.\n", buf); |
4544 | else { | 4542 | else |
4545 | il->debug_level = val; | 4543 | il->debug_level = val; |
4546 | if (il_alloc_traffic_mem(il)) | 4544 | |
4547 | IL_ERR("Not enough memory to generate traffic log\n"); | ||
4548 | } | ||
4549 | return strnlen(buf, count); | 4545 | return strnlen(buf, count); |
4550 | } | 4546 | } |
4551 | 4547 | ||
@@ -6483,9 +6479,6 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6483 | il->pci_dev = pdev; | 6479 | il->pci_dev = pdev; |
6484 | il->inta_mask = CSR_INI_SET_MASK; | 6480 | il->inta_mask = CSR_INI_SET_MASK; |
6485 | 6481 | ||
6486 | if (il_alloc_traffic_mem(il)) | ||
6487 | IL_ERR("Not enough memory to generate traffic log\n"); | ||
6488 | |||
6489 | /************************** | 6482 | /************************** |
6490 | * 2. Initializing PCI bus | 6483 | * 2. Initializing PCI bus |
6491 | **************************/ | 6484 | **************************/ |
@@ -6663,7 +6656,6 @@ out_pci_release_regions: | |||
6663 | out_pci_disable_device: | 6656 | out_pci_disable_device: |
6664 | pci_disable_device(pdev); | 6657 | pci_disable_device(pdev); |
6665 | out_ieee80211_free_hw: | 6658 | out_ieee80211_free_hw: |
6666 | il_free_traffic_mem(il); | ||
6667 | ieee80211_free_hw(il->hw); | 6659 | ieee80211_free_hw(il->hw); |
6668 | out: | 6660 | out: |
6669 | return err; | 6661 | return err; |
@@ -6734,7 +6726,6 @@ il4965_pci_remove(struct pci_dev *pdev) | |||
6734 | * until now... */ | 6726 | * until now... */ |
6735 | destroy_workqueue(il->workqueue); | 6727 | destroy_workqueue(il->workqueue); |
6736 | il->workqueue = NULL; | 6728 | il->workqueue = NULL; |
6737 | il_free_traffic_mem(il); | ||
6738 | 6729 | ||
6739 | free_irq(il->pci_dev->irq, il); | 6730 | free_irq(il->pci_dev->irq, il); |
6740 | pci_disable_msi(il->pci_dev); | 6731 | pci_disable_msi(il->pci_dev); |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 1bf861626c86..21b355a9171f 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -4574,253 +4574,6 @@ il_txq_mem(struct il_priv *il) | |||
4574 | } | 4574 | } |
4575 | EXPORT_SYMBOL(il_txq_mem); | 4575 | EXPORT_SYMBOL(il_txq_mem); |
4576 | 4576 | ||
4577 | #ifdef CONFIG_IWLEGACY_DEBUGFS | ||
4578 | |||
4579 | #define IL_TRAFFIC_DUMP_SIZE (IL_TRAFFIC_ENTRY_SIZE * IL_TRAFFIC_ENTRIES) | ||
4580 | |||
4581 | void | ||
4582 | il_reset_traffic_log(struct il_priv *il) | ||
4583 | { | ||
4584 | il->tx_traffic_idx = 0; | ||
4585 | il->rx_traffic_idx = 0; | ||
4586 | if (il->tx_traffic) | ||
4587 | memset(il->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); | ||
4588 | if (il->rx_traffic) | ||
4589 | memset(il->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); | ||
4590 | } | ||
4591 | |||
4592 | int | ||
4593 | il_alloc_traffic_mem(struct il_priv *il) | ||
4594 | { | ||
4595 | u32 traffic_size = IL_TRAFFIC_DUMP_SIZE; | ||
4596 | |||
4597 | if (il_debug_level & IL_DL_TX) { | ||
4598 | if (!il->tx_traffic) { | ||
4599 | il->tx_traffic = kzalloc(traffic_size, GFP_KERNEL); | ||
4600 | if (!il->tx_traffic) | ||
4601 | return -ENOMEM; | ||
4602 | } | ||
4603 | } | ||
4604 | if (il_debug_level & IL_DL_RX) { | ||
4605 | if (!il->rx_traffic) { | ||
4606 | il->rx_traffic = kzalloc(traffic_size, GFP_KERNEL); | ||
4607 | if (!il->rx_traffic) | ||
4608 | return -ENOMEM; | ||
4609 | } | ||
4610 | } | ||
4611 | il_reset_traffic_log(il); | ||
4612 | return 0; | ||
4613 | } | ||
4614 | EXPORT_SYMBOL(il_alloc_traffic_mem); | ||
4615 | |||
4616 | void | ||
4617 | il_free_traffic_mem(struct il_priv *il) | ||
4618 | { | ||
4619 | kfree(il->tx_traffic); | ||
4620 | il->tx_traffic = NULL; | ||
4621 | |||
4622 | kfree(il->rx_traffic); | ||
4623 | il->rx_traffic = NULL; | ||
4624 | } | ||
4625 | EXPORT_SYMBOL(il_free_traffic_mem); | ||
4626 | |||
4627 | void | ||
4628 | il_dbg_log_tx_data_frame(struct il_priv *il, u16 length, | ||
4629 | struct ieee80211_hdr *header) | ||
4630 | { | ||
4631 | __le16 fc; | ||
4632 | u16 len; | ||
4633 | |||
4634 | if (likely(!(il_debug_level & IL_DL_TX))) | ||
4635 | return; | ||
4636 | |||
4637 | if (!il->tx_traffic) | ||
4638 | return; | ||
4639 | |||
4640 | fc = header->frame_control; | ||
4641 | if (ieee80211_is_data(fc)) { | ||
4642 | len = | ||
4643 | (length > | ||
4644 | IL_TRAFFIC_ENTRY_SIZE) ? IL_TRAFFIC_ENTRY_SIZE : length; | ||
4645 | memcpy((il->tx_traffic + | ||
4646 | (il->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header, | ||
4647 | len); | ||
4648 | il->tx_traffic_idx = | ||
4649 | (il->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; | ||
4650 | } | ||
4651 | } | ||
4652 | EXPORT_SYMBOL(il_dbg_log_tx_data_frame); | ||
4653 | |||
4654 | void | ||
4655 | il_dbg_log_rx_data_frame(struct il_priv *il, u16 length, | ||
4656 | struct ieee80211_hdr *header) | ||
4657 | { | ||
4658 | __le16 fc; | ||
4659 | u16 len; | ||
4660 | |||
4661 | if (likely(!(il_debug_level & IL_DL_RX))) | ||
4662 | return; | ||
4663 | |||
4664 | if (!il->rx_traffic) | ||
4665 | return; | ||
4666 | |||
4667 | fc = header->frame_control; | ||
4668 | if (ieee80211_is_data(fc)) { | ||
4669 | len = | ||
4670 | (length > | ||
4671 | IL_TRAFFIC_ENTRY_SIZE) ? IL_TRAFFIC_ENTRY_SIZE : length; | ||
4672 | memcpy((il->rx_traffic + | ||
4673 | (il->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header, | ||
4674 | len); | ||
4675 | il->rx_traffic_idx = | ||
4676 | (il->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; | ||
4677 | } | ||
4678 | } | ||
4679 | EXPORT_SYMBOL(il_dbg_log_rx_data_frame); | ||
4680 | |||
4681 | const char * | ||
4682 | il_get_mgmt_string(int cmd) | ||
4683 | { | ||
4684 | switch (cmd) { | ||
4685 | IL_CMD(MANAGEMENT_ASSOC_REQ); | ||
4686 | IL_CMD(MANAGEMENT_ASSOC_RESP); | ||
4687 | IL_CMD(MANAGEMENT_REASSOC_REQ); | ||
4688 | IL_CMD(MANAGEMENT_REASSOC_RESP); | ||
4689 | IL_CMD(MANAGEMENT_PROBE_REQ); | ||
4690 | IL_CMD(MANAGEMENT_PROBE_RESP); | ||
4691 | IL_CMD(MANAGEMENT_BEACON); | ||
4692 | IL_CMD(MANAGEMENT_ATIM); | ||
4693 | IL_CMD(MANAGEMENT_DISASSOC); | ||
4694 | IL_CMD(MANAGEMENT_AUTH); | ||
4695 | IL_CMD(MANAGEMENT_DEAUTH); | ||
4696 | IL_CMD(MANAGEMENT_ACTION); | ||
4697 | default: | ||
4698 | return "UNKNOWN"; | ||
4699 | |||
4700 | } | ||
4701 | } | ||
4702 | |||
4703 | const char * | ||
4704 | il_get_ctrl_string(int cmd) | ||
4705 | { | ||
4706 | switch (cmd) { | ||
4707 | IL_CMD(CONTROL_BACK_REQ); | ||
4708 | IL_CMD(CONTROL_BACK); | ||
4709 | IL_CMD(CONTROL_PSPOLL); | ||
4710 | IL_CMD(CONTROL_RTS); | ||
4711 | IL_CMD(CONTROL_CTS); | ||
4712 | IL_CMD(CONTROL_ACK); | ||
4713 | IL_CMD(CONTROL_CFEND); | ||
4714 | IL_CMD(CONTROL_CFENDACK); | ||
4715 | default: | ||
4716 | return "UNKNOWN"; | ||
4717 | |||
4718 | } | ||
4719 | } | ||
4720 | |||
4721 | void | ||
4722 | il_clear_traffic_stats(struct il_priv *il) | ||
4723 | { | ||
4724 | memset(&il->tx_stats, 0, sizeof(struct traffic_stats)); | ||
4725 | memset(&il->rx_stats, 0, sizeof(struct traffic_stats)); | ||
4726 | } | ||
4727 | |||
4728 | /* | ||
4729 | * if CONFIG_IWLEGACY_DEBUGFS defined, | ||
4730 | * il_update_stats function will | ||
4731 | * record all the MGMT, CTRL and DATA pkt for both TX and Rx pass | ||
4732 | * Use debugFs to display the rx/rx_stats | ||
4733 | * if CONFIG_IWLEGACY_DEBUGFS not being defined, then no MGMT and CTRL | ||
4734 | * information will be recorded, but DATA pkt still will be recorded | ||
4735 | * for the reason of il_led.c need to control the led blinking based on | ||
4736 | * number of tx and rx data. | ||
4737 | * | ||
4738 | */ | ||
4739 | void | ||
4740 | il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) | ||
4741 | { | ||
4742 | struct traffic_stats *stats; | ||
4743 | |||
4744 | if (is_tx) | ||
4745 | stats = &il->tx_stats; | ||
4746 | else | ||
4747 | stats = &il->rx_stats; | ||
4748 | |||
4749 | if (ieee80211_is_mgmt(fc)) { | ||
4750 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { | ||
4751 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ): | ||
4752 | stats->mgmt[MANAGEMENT_ASSOC_REQ]++; | ||
4753 | break; | ||
4754 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): | ||
4755 | stats->mgmt[MANAGEMENT_ASSOC_RESP]++; | ||
4756 | break; | ||
4757 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ): | ||
4758 | stats->mgmt[MANAGEMENT_REASSOC_REQ]++; | ||
4759 | break; | ||
4760 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): | ||
4761 | stats->mgmt[MANAGEMENT_REASSOC_RESP]++; | ||
4762 | break; | ||
4763 | case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ): | ||
4764 | stats->mgmt[MANAGEMENT_PROBE_REQ]++; | ||
4765 | break; | ||
4766 | case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): | ||
4767 | stats->mgmt[MANAGEMENT_PROBE_RESP]++; | ||
4768 | break; | ||
4769 | case cpu_to_le16(IEEE80211_STYPE_BEACON): | ||
4770 | stats->mgmt[MANAGEMENT_BEACON]++; | ||
4771 | break; | ||
4772 | case cpu_to_le16(IEEE80211_STYPE_ATIM): | ||
4773 | stats->mgmt[MANAGEMENT_ATIM]++; | ||
4774 | break; | ||
4775 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): | ||
4776 | stats->mgmt[MANAGEMENT_DISASSOC]++; | ||
4777 | break; | ||
4778 | case cpu_to_le16(IEEE80211_STYPE_AUTH): | ||
4779 | stats->mgmt[MANAGEMENT_AUTH]++; | ||
4780 | break; | ||
4781 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): | ||
4782 | stats->mgmt[MANAGEMENT_DEAUTH]++; | ||
4783 | break; | ||
4784 | case cpu_to_le16(IEEE80211_STYPE_ACTION): | ||
4785 | stats->mgmt[MANAGEMENT_ACTION]++; | ||
4786 | break; | ||
4787 | } | ||
4788 | } else if (ieee80211_is_ctl(fc)) { | ||
4789 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { | ||
4790 | case cpu_to_le16(IEEE80211_STYPE_BACK_REQ): | ||
4791 | stats->ctrl[CONTROL_BACK_REQ]++; | ||
4792 | break; | ||
4793 | case cpu_to_le16(IEEE80211_STYPE_BACK): | ||
4794 | stats->ctrl[CONTROL_BACK]++; | ||
4795 | break; | ||
4796 | case cpu_to_le16(IEEE80211_STYPE_PSPOLL): | ||
4797 | stats->ctrl[CONTROL_PSPOLL]++; | ||
4798 | break; | ||
4799 | case cpu_to_le16(IEEE80211_STYPE_RTS): | ||
4800 | stats->ctrl[CONTROL_RTS]++; | ||
4801 | break; | ||
4802 | case cpu_to_le16(IEEE80211_STYPE_CTS): | ||
4803 | stats->ctrl[CONTROL_CTS]++; | ||
4804 | break; | ||
4805 | case cpu_to_le16(IEEE80211_STYPE_ACK): | ||
4806 | stats->ctrl[CONTROL_ACK]++; | ||
4807 | break; | ||
4808 | case cpu_to_le16(IEEE80211_STYPE_CFEND): | ||
4809 | stats->ctrl[CONTROL_CFEND]++; | ||
4810 | break; | ||
4811 | case cpu_to_le16(IEEE80211_STYPE_CFENDACK): | ||
4812 | stats->ctrl[CONTROL_CFENDACK]++; | ||
4813 | break; | ||
4814 | } | ||
4815 | } else { | ||
4816 | /* data */ | ||
4817 | stats->data_cnt++; | ||
4818 | stats->data_bytes += len; | ||
4819 | } | ||
4820 | } | ||
4821 | EXPORT_SYMBOL(il_update_stats); | ||
4822 | #endif | ||
4823 | |||
4824 | int | 4577 | int |
4825 | il_force_reset(struct il_priv *il, bool external) | 4578 | il_force_reset(struct il_priv *il, bool external) |
4826 | { | 4579 | { |
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index 873182ec3fbf..b2a6e52f8233 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -1766,57 +1766,21 @@ int il_alloc_txq_mem(struct il_priv *il); | |||
1766 | void il_txq_mem(struct il_priv *il); | 1766 | void il_txq_mem(struct il_priv *il); |
1767 | 1767 | ||
1768 | #ifdef CONFIG_IWLEGACY_DEBUGFS | 1768 | #ifdef CONFIG_IWLEGACY_DEBUGFS |
1769 | int il_alloc_traffic_mem(struct il_priv *il); | 1769 | extern void il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len); |
1770 | void il_free_traffic_mem(struct il_priv *il); | ||
1771 | void il_reset_traffic_log(struct il_priv *il); | ||
1772 | void il_dbg_log_tx_data_frame(struct il_priv *il, u16 length, | ||
1773 | struct ieee80211_hdr *header); | ||
1774 | void il_dbg_log_rx_data_frame(struct il_priv *il, u16 length, | ||
1775 | struct ieee80211_hdr *header); | ||
1776 | const char *il_get_mgmt_string(int cmd); | ||
1777 | const char *il_get_ctrl_string(int cmd); | ||
1778 | void il_clear_traffic_stats(struct il_priv *il); | ||
1779 | void il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len); | ||
1780 | #else | 1770 | #else |
1781 | static inline int | ||
1782 | il_alloc_traffic_mem(struct il_priv *il) | ||
1783 | { | ||
1784 | return 0; | ||
1785 | } | ||
1786 | |||
1787 | static inline void | ||
1788 | il_free_traffic_mem(struct il_priv *il) | ||
1789 | { | ||
1790 | } | ||
1791 | |||
1792 | static inline void | ||
1793 | il_reset_traffic_log(struct il_priv *il) | ||
1794 | { | ||
1795 | } | ||
1796 | |||
1797 | static inline void | ||
1798 | il_dbg_log_tx_data_frame(struct il_priv *il, u16 length, | ||
1799 | struct ieee80211_hdr *header) | ||
1800 | { | ||
1801 | } | ||
1802 | |||
1803 | static inline void | ||
1804 | il_dbg_log_rx_data_frame(struct il_priv *il, u16 length, | ||
1805 | struct ieee80211_hdr *header) | ||
1806 | { | ||
1807 | } | ||
1808 | |||
1809 | static inline void | 1771 | static inline void |
1810 | il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) | 1772 | il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) |
1811 | { | 1773 | { |
1812 | } | 1774 | } |
1813 | #endif | 1775 | #endif |
1776 | |||
1814 | /***************************************************** | 1777 | /***************************************************** |
1815 | * RX handlers. | 1778 | * Handlers |
1816 | * **************************************************/ | 1779 | ***************************************************/ |
1817 | void il_hdl_pm_sleep(struct il_priv *il, struct il_rx_buf *rxb); | 1780 | void il_hdl_pm_sleep(struct il_priv *il, struct il_rx_buf *rxb); |
1818 | void il_hdl_pm_debug_stats(struct il_priv *il, struct il_rx_buf *rxb); | 1781 | void il_hdl_pm_debug_stats(struct il_priv *il, struct il_rx_buf *rxb); |
1819 | void il_hdl_error(struct il_priv *il, struct il_rx_buf *rxb); | 1782 | void il_hdl_error(struct il_priv *il, struct il_rx_buf *rxb); |
1783 | void il_hdl_csa(struct il_priv *il, struct il_rx_buf *rxb); | ||
1820 | 1784 | ||
1821 | /***************************************************** | 1785 | /***************************************************** |
1822 | * RX | 1786 | * RX |
@@ -1827,13 +1791,10 @@ int il_rx_queue_alloc(struct il_priv *il); | |||
1827 | void il_rx_queue_update_write_ptr(struct il_priv *il, struct il_rx_queue *q); | 1791 | void il_rx_queue_update_write_ptr(struct il_priv *il, struct il_rx_queue *q); |
1828 | int il_rx_queue_space(const struct il_rx_queue *q); | 1792 | int il_rx_queue_space(const struct il_rx_queue *q); |
1829 | void il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb); | 1793 | void il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb); |
1830 | /* Handlers */ | 1794 | |
1831 | void il_hdl_spectrum_measurement(struct il_priv *il, struct il_rx_buf *rxb); | 1795 | void il_hdl_spectrum_measurement(struct il_priv *il, struct il_rx_buf *rxb); |
1832 | void il_recover_from_stats(struct il_priv *il, struct il_rx_pkt *pkt); | 1796 | void il_recover_from_stats(struct il_priv *il, struct il_rx_pkt *pkt); |
1833 | void il_chswitch_done(struct il_priv *il, bool is_success); | 1797 | void il_chswitch_done(struct il_priv *il, bool is_success); |
1834 | void il_hdl_csa(struct il_priv *il, struct il_rx_buf *rxb); | ||
1835 | |||
1836 | /* TX helpers */ | ||
1837 | 1798 | ||
1838 | /***************************************************** | 1799 | /***************************************************** |
1839 | * TX | 1800 | * TX |
diff --git a/drivers/net/wireless/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c index be6005da785d..236dc90b035b 100644 --- a/drivers/net/wireless/iwlegacy/debug.c +++ b/drivers/net/wireless/iwlegacy/debug.c | |||
@@ -31,6 +31,101 @@ | |||
31 | 31 | ||
32 | #include "common.h" | 32 | #include "common.h" |
33 | 33 | ||
34 | void | ||
35 | il_clear_traffic_stats(struct il_priv *il) | ||
36 | { | ||
37 | memset(&il->tx_stats, 0, sizeof(struct traffic_stats)); | ||
38 | memset(&il->rx_stats, 0, sizeof(struct traffic_stats)); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * il_update_stats function record all the MGMT, CTRL and DATA pkt for | ||
43 | * both TX and Rx . Use debugfs to display the rx/rx_stats | ||
44 | */ | ||
45 | void | ||
46 | il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) | ||
47 | { | ||
48 | struct traffic_stats *stats; | ||
49 | |||
50 | if (is_tx) | ||
51 | stats = &il->tx_stats; | ||
52 | else | ||
53 | stats = &il->rx_stats; | ||
54 | |||
55 | if (ieee80211_is_mgmt(fc)) { | ||
56 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { | ||
57 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ): | ||
58 | stats->mgmt[MANAGEMENT_ASSOC_REQ]++; | ||
59 | break; | ||
60 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): | ||
61 | stats->mgmt[MANAGEMENT_ASSOC_RESP]++; | ||
62 | break; | ||
63 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ): | ||
64 | stats->mgmt[MANAGEMENT_REASSOC_REQ]++; | ||
65 | break; | ||
66 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): | ||
67 | stats->mgmt[MANAGEMENT_REASSOC_RESP]++; | ||
68 | break; | ||
69 | case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ): | ||
70 | stats->mgmt[MANAGEMENT_PROBE_REQ]++; | ||
71 | break; | ||
72 | case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): | ||
73 | stats->mgmt[MANAGEMENT_PROBE_RESP]++; | ||
74 | break; | ||
75 | case cpu_to_le16(IEEE80211_STYPE_BEACON): | ||
76 | stats->mgmt[MANAGEMENT_BEACON]++; | ||
77 | break; | ||
78 | case cpu_to_le16(IEEE80211_STYPE_ATIM): | ||
79 | stats->mgmt[MANAGEMENT_ATIM]++; | ||
80 | break; | ||
81 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): | ||
82 | stats->mgmt[MANAGEMENT_DISASSOC]++; | ||
83 | break; | ||
84 | case cpu_to_le16(IEEE80211_STYPE_AUTH): | ||
85 | stats->mgmt[MANAGEMENT_AUTH]++; | ||
86 | break; | ||
87 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): | ||
88 | stats->mgmt[MANAGEMENT_DEAUTH]++; | ||
89 | break; | ||
90 | case cpu_to_le16(IEEE80211_STYPE_ACTION): | ||
91 | stats->mgmt[MANAGEMENT_ACTION]++; | ||
92 | break; | ||
93 | } | ||
94 | } else if (ieee80211_is_ctl(fc)) { | ||
95 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { | ||
96 | case cpu_to_le16(IEEE80211_STYPE_BACK_REQ): | ||
97 | stats->ctrl[CONTROL_BACK_REQ]++; | ||
98 | break; | ||
99 | case cpu_to_le16(IEEE80211_STYPE_BACK): | ||
100 | stats->ctrl[CONTROL_BACK]++; | ||
101 | break; | ||
102 | case cpu_to_le16(IEEE80211_STYPE_PSPOLL): | ||
103 | stats->ctrl[CONTROL_PSPOLL]++; | ||
104 | break; | ||
105 | case cpu_to_le16(IEEE80211_STYPE_RTS): | ||
106 | stats->ctrl[CONTROL_RTS]++; | ||
107 | break; | ||
108 | case cpu_to_le16(IEEE80211_STYPE_CTS): | ||
109 | stats->ctrl[CONTROL_CTS]++; | ||
110 | break; | ||
111 | case cpu_to_le16(IEEE80211_STYPE_ACK): | ||
112 | stats->ctrl[CONTROL_ACK]++; | ||
113 | break; | ||
114 | case cpu_to_le16(IEEE80211_STYPE_CFEND): | ||
115 | stats->ctrl[CONTROL_CFEND]++; | ||
116 | break; | ||
117 | case cpu_to_le16(IEEE80211_STYPE_CFENDACK): | ||
118 | stats->ctrl[CONTROL_CFENDACK]++; | ||
119 | break; | ||
120 | } | ||
121 | } else { | ||
122 | /* data */ | ||
123 | stats->data_cnt++; | ||
124 | stats->data_bytes += len; | ||
125 | } | ||
126 | } | ||
127 | EXPORT_SYMBOL(il_update_stats); | ||
128 | |||
34 | /* create and remove of files */ | 129 | /* create and remove of files */ |
35 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ | 130 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
36 | if (!debugfs_create_file(#name, mode, parent, il, \ | 131 | if (!debugfs_create_file(#name, mode, parent, il, \ |
@@ -98,6 +193,46 @@ static const struct file_operations il_dbgfs_##name##_ops = { \ | |||
98 | .llseek = generic_file_llseek, \ | 193 | .llseek = generic_file_llseek, \ |
99 | }; | 194 | }; |
100 | 195 | ||
196 | static const char * | ||
197 | il_get_mgmt_string(int cmd) | ||
198 | { | ||
199 | switch (cmd) { | ||
200 | IL_CMD(MANAGEMENT_ASSOC_REQ); | ||
201 | IL_CMD(MANAGEMENT_ASSOC_RESP); | ||
202 | IL_CMD(MANAGEMENT_REASSOC_REQ); | ||
203 | IL_CMD(MANAGEMENT_REASSOC_RESP); | ||
204 | IL_CMD(MANAGEMENT_PROBE_REQ); | ||
205 | IL_CMD(MANAGEMENT_PROBE_RESP); | ||
206 | IL_CMD(MANAGEMENT_BEACON); | ||
207 | IL_CMD(MANAGEMENT_ATIM); | ||
208 | IL_CMD(MANAGEMENT_DISASSOC); | ||
209 | IL_CMD(MANAGEMENT_AUTH); | ||
210 | IL_CMD(MANAGEMENT_DEAUTH); | ||
211 | IL_CMD(MANAGEMENT_ACTION); | ||
212 | default: | ||
213 | return "UNKNOWN"; | ||
214 | |||
215 | } | ||
216 | } | ||
217 | |||
218 | static const char * | ||
219 | il_get_ctrl_string(int cmd) | ||
220 | { | ||
221 | switch (cmd) { | ||
222 | IL_CMD(CONTROL_BACK_REQ); | ||
223 | IL_CMD(CONTROL_BACK); | ||
224 | IL_CMD(CONTROL_PSPOLL); | ||
225 | IL_CMD(CONTROL_RTS); | ||
226 | IL_CMD(CONTROL_CTS); | ||
227 | IL_CMD(CONTROL_ACK); | ||
228 | IL_CMD(CONTROL_CFEND); | ||
229 | IL_CMD(CONTROL_CFENDACK); | ||
230 | default: | ||
231 | return "UNKNOWN"; | ||
232 | |||
233 | } | ||
234 | } | ||
235 | |||
101 | static ssize_t | 236 | static ssize_t |
102 | il_dbgfs_tx_stats_read(struct file *file, char __user *user_buf, size_t count, | 237 | il_dbgfs_tx_stats_read(struct file *file, char __user *user_buf, size_t count, |
103 | loff_t *ppos) | 238 | loff_t *ppos) |
@@ -715,112 +850,6 @@ DEBUGFS_READ_FILE_OPS(qos); | |||
715 | DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); | 850 | DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); |
716 | 851 | ||
717 | static ssize_t | 852 | static ssize_t |
718 | il_dbgfs_traffic_log_read(struct file *file, char __user *user_buf, | ||
719 | size_t count, loff_t *ppos) | ||
720 | { | ||
721 | struct il_priv *il = file->private_data; | ||
722 | int pos = 0, ofs = 0; | ||
723 | int cnt = 0, entry; | ||
724 | struct il_tx_queue *txq; | ||
725 | struct il_queue *q; | ||
726 | struct il_rx_queue *rxq = &il->rxq; | ||
727 | char *buf; | ||
728 | int bufsz = | ||
729 | ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) + | ||
730 | (il->cfg->num_of_queues * 32 * 8) + 400; | ||
731 | const u8 *ptr; | ||
732 | ssize_t ret; | ||
733 | |||
734 | if (!il->txq) { | ||
735 | IL_ERR("txq not ready\n"); | ||
736 | return -EAGAIN; | ||
737 | } | ||
738 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
739 | if (!buf) { | ||
740 | IL_ERR("Can not allocate buffer\n"); | ||
741 | return -ENOMEM; | ||
742 | } | ||
743 | pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); | ||
744 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { | ||
745 | txq = &il->txq[cnt]; | ||
746 | q = &txq->q; | ||
747 | pos += | ||
748 | scnprintf(buf + pos, bufsz - pos, | ||
749 | "q[%d]: read_ptr: %u, write_ptr: %u\n", cnt, | ||
750 | q->read_ptr, q->write_ptr); | ||
751 | } | ||
752 | if (il->tx_traffic && (il_debug_level & IL_DL_TX)) { | ||
753 | ptr = il->tx_traffic; | ||
754 | pos += | ||
755 | scnprintf(buf + pos, bufsz - pos, "Tx Traffic idx: %u\n", | ||
756 | il->tx_traffic_idx); | ||
757 | for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { | ||
758 | for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; | ||
759 | entry++, ofs += 16) { | ||
760 | pos += | ||
761 | scnprintf(buf + pos, bufsz - pos, "0x%.4x ", | ||
762 | ofs); | ||
763 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, | ||
764 | buf + pos, bufsz - pos, 0); | ||
765 | pos += strlen(buf + pos); | ||
766 | if (bufsz - pos > 0) | ||
767 | buf[pos++] = '\n'; | ||
768 | } | ||
769 | } | ||
770 | } | ||
771 | |||
772 | pos += scnprintf(buf + pos, bufsz - pos, "Rx Queue\n"); | ||
773 | pos += | ||
774 | scnprintf(buf + pos, bufsz - pos, "read: %u, write: %u\n", | ||
775 | rxq->read, rxq->write); | ||
776 | |||
777 | if (il->rx_traffic && (il_debug_level & IL_DL_RX)) { | ||
778 | ptr = il->rx_traffic; | ||
779 | pos += | ||
780 | scnprintf(buf + pos, bufsz - pos, "Rx Traffic idx: %u\n", | ||
781 | il->rx_traffic_idx); | ||
782 | for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { | ||
783 | for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; | ||
784 | entry++, ofs += 16) { | ||
785 | pos += | ||
786 | scnprintf(buf + pos, bufsz - pos, "0x%.4x ", | ||
787 | ofs); | ||
788 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, | ||
789 | buf + pos, bufsz - pos, 0); | ||
790 | pos += strlen(buf + pos); | ||
791 | if (bufsz - pos > 0) | ||
792 | buf[pos++] = '\n'; | ||
793 | } | ||
794 | } | ||
795 | } | ||
796 | |||
797 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
798 | kfree(buf); | ||
799 | return ret; | ||
800 | } | ||
801 | |||
802 | static ssize_t | ||
803 | il_dbgfs_traffic_log_write(struct file *file, const char __user *user_buf, | ||
804 | size_t count, loff_t *ppos) | ||
805 | { | ||
806 | struct il_priv *il = file->private_data; | ||
807 | char buf[8]; | ||
808 | int buf_size; | ||
809 | int traffic_log; | ||
810 | |||
811 | memset(buf, 0, sizeof(buf)); | ||
812 | buf_size = min(count, sizeof(buf) - 1); | ||
813 | if (copy_from_user(buf, user_buf, buf_size)) | ||
814 | return -EFAULT; | ||
815 | if (sscanf(buf, "%d", &traffic_log) != 1) | ||
816 | return -EFAULT; | ||
817 | if (traffic_log == 0) | ||
818 | il_reset_traffic_log(il); | ||
819 | |||
820 | return count; | ||
821 | } | ||
822 | |||
823 | static ssize_t | ||
824 | il_dbgfs_tx_queue_read(struct file *file, char __user *user_buf, size_t count, | 853 | il_dbgfs_tx_queue_read(struct file *file, char __user *user_buf, size_t count, |
825 | loff_t *ppos) | 854 | loff_t *ppos) |
826 | { | 855 | { |
@@ -1303,7 +1332,6 @@ il_dbgfs_wd_timeout_write(struct file *file, const char __user *user_buf, | |||
1303 | 1332 | ||
1304 | DEBUGFS_READ_FILE_OPS(rx_stats); | 1333 | DEBUGFS_READ_FILE_OPS(rx_stats); |
1305 | DEBUGFS_READ_FILE_OPS(tx_stats); | 1334 | DEBUGFS_READ_FILE_OPS(tx_stats); |
1306 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | ||
1307 | DEBUGFS_READ_FILE_OPS(rx_queue); | 1335 | DEBUGFS_READ_FILE_OPS(rx_queue); |
1308 | DEBUGFS_READ_FILE_OPS(tx_queue); | 1336 | DEBUGFS_READ_FILE_OPS(tx_queue); |
1309 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); | 1337 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); |
@@ -1357,7 +1385,6 @@ il_dbgfs_register(struct il_priv *il, const char *name) | |||
1357 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); | 1385 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); |
1358 | DEBUGFS_ADD_FILE(rx_stats, dir_debug, S_IRUSR); | 1386 | DEBUGFS_ADD_FILE(rx_stats, dir_debug, S_IRUSR); |
1359 | DEBUGFS_ADD_FILE(tx_stats, dir_debug, S_IRUSR); | 1387 | DEBUGFS_ADD_FILE(tx_stats, dir_debug, S_IRUSR); |
1360 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); | ||
1361 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); | 1388 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); |
1362 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); | 1389 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); |
1363 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); | 1390 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); |