aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-03-01 18:52:00 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-03-06 17:09:46 -0500
commit17744ff6ae7eafe33dac9772f2ef9ab5fb738db8 (patch)
treefff5b091d2d6ed8682893f66072c698aa7308218 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent8211ef78d9023a8772e5acf6b7934598156b2fc8 (diff)
iwlwifi: Fix 52 rate report in rx status
This patch fixes reporting rate in RX packets in 52 band. The rate was updated from CCK rate index instead of OFDM rate 6M Most of the patch is collateral clean up Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c182
1 files changed, 0 insertions, 182 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 0cafbd42d84c..7a72048b0f42 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -162,17 +162,6 @@ static const char *iwl3945_escape_essid(const char *essid, u8 essid_len)
162 return escaped; 162 return escaped;
163} 163}
164 164
165static void iwl3945_print_hex_dump(int level, void *p, u32 len)
166{
167#ifdef CONFIG_IWL3945_DEBUG
168 if (!(iwl3945_debug_level & level))
169 return;
170
171 print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
172 p, len, 1);
173#endif
174}
175
176/*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** 165/*************** DMA-QUEUE-GENERAL-FUNCTIONS *****
177 * DMA services 166 * DMA services
178 * 167 *
@@ -1630,151 +1619,6 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1630 return 0; 1619 return 0;
1631} 1620}
1632 1621
1633/******************************************************************************
1634 *
1635 * Misc. internal state and helper functions
1636 *
1637 ******************************************************************************/
1638#ifdef CONFIG_IWL3945_DEBUG
1639
1640/**
1641 * iwl3945_report_frame - dump frame to syslog during debug sessions
1642 *
1643 * You may hack this function to show different aspects of received frames,
1644 * including selective frame dumps.
1645 * group100 parameter selects whether to show 1 out of 100 good frames.
1646 */
1647void iwl3945_report_frame(struct iwl3945_priv *priv,
1648 struct iwl3945_rx_packet *pkt,
1649 struct ieee80211_hdr *header, int group100)
1650{
1651 u32 to_us;
1652 u32 print_summary = 0;
1653 u32 print_dump = 0; /* set to 1 to dump all frames' contents */
1654 u32 hundred = 0;
1655 u32 dataframe = 0;
1656 u16 fc;
1657 u16 seq_ctl;
1658 u16 channel;
1659 u16 phy_flags;
1660 int rate_sym;
1661 u16 length;
1662 u16 status;
1663 u16 bcn_tmr;
1664 u32 tsf_low;
1665 u64 tsf;
1666 u8 rssi;
1667 u8 agc;
1668 u16 sig_avg;
1669 u16 noise_diff;
1670 struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
1671 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
1672 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
1673 u8 *data = IWL_RX_DATA(pkt);
1674
1675 /* MAC header */
1676 fc = le16_to_cpu(header->frame_control);
1677 seq_ctl = le16_to_cpu(header->seq_ctrl);
1678
1679 /* metadata */
1680 channel = le16_to_cpu(rx_hdr->channel);
1681 phy_flags = le16_to_cpu(rx_hdr->phy_flags);
1682 rate_sym = rx_hdr->rate;
1683 length = le16_to_cpu(rx_hdr->len);
1684
1685 /* end-of-frame status and timestamp */
1686 status = le32_to_cpu(rx_end->status);
1687 bcn_tmr = le32_to_cpu(rx_end->beacon_timestamp);
1688 tsf_low = le64_to_cpu(rx_end->timestamp) & 0x0ffffffff;
1689 tsf = le64_to_cpu(rx_end->timestamp);
1690
1691 /* signal statistics */
1692 rssi = rx_stats->rssi;
1693 agc = rx_stats->agc;
1694 sig_avg = le16_to_cpu(rx_stats->sig_avg);
1695 noise_diff = le16_to_cpu(rx_stats->noise_diff);
1696
1697 to_us = !compare_ether_addr(header->addr1, priv->mac_addr);
1698
1699 /* if data frame is to us and all is good,
1700 * (optionally) print summary for only 1 out of every 100 */
1701 if (to_us && (fc & ~IEEE80211_FCTL_PROTECTED) ==
1702 (IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) {
1703 dataframe = 1;
1704 if (!group100)
1705 print_summary = 1; /* print each frame */
1706 else if (priv->framecnt_to_us < 100) {
1707 priv->framecnt_to_us++;
1708 print_summary = 0;
1709 } else {
1710 priv->framecnt_to_us = 0;
1711 print_summary = 1;
1712 hundred = 1;
1713 }
1714 } else {
1715 /* print summary for all other frames */
1716 print_summary = 1;
1717 }
1718
1719 if (print_summary) {
1720 char *title;
1721 u32 rate;
1722
1723 if (hundred)
1724 title = "100Frames";
1725 else if (fc & IEEE80211_FCTL_RETRY)
1726 title = "Retry";
1727 else if (ieee80211_is_assoc_response(fc))
1728 title = "AscRsp";
1729 else if (ieee80211_is_reassoc_response(fc))
1730 title = "RasRsp";
1731 else if (ieee80211_is_probe_response(fc)) {
1732 title = "PrbRsp";
1733 print_dump = 1; /* dump frame contents */
1734 } else if (ieee80211_is_beacon(fc)) {
1735 title = "Beacon";
1736 print_dump = 1; /* dump frame contents */
1737 } else if (ieee80211_is_atim(fc))
1738 title = "ATIM";
1739 else if (ieee80211_is_auth(fc))
1740 title = "Auth";
1741 else if (ieee80211_is_deauth(fc))
1742 title = "DeAuth";
1743 else if (ieee80211_is_disassoc(fc))
1744 title = "DisAssoc";
1745 else
1746 title = "Frame";
1747
1748 rate = iwl3945_rate_index_from_plcp(rate_sym);
1749 if (rate == -1)
1750 rate = 0;
1751 else
1752 rate = iwl3945_rates[rate].ieee / 2;
1753
1754 /* print frame summary.
1755 * MAC addresses show just the last byte (for brevity),
1756 * but you can hack it to show more, if you'd like to. */
1757 if (dataframe)
1758 IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, "
1759 "len=%u, rssi=%d, chnl=%d, rate=%u, \n",
1760 title, fc, header->addr1[5],
1761 length, rssi, channel, rate);
1762 else {
1763 /* src/dst addresses assume managed mode */
1764 IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, "
1765 "src=0x%02x, rssi=%u, tim=%lu usec, "
1766 "phy=0x%02x, chnl=%d\n",
1767 title, fc, header->addr1[5],
1768 header->addr3[5], rssi,
1769 tsf_low - priv->scan_start_tsf,
1770 phy_flags, channel);
1771 }
1772 }
1773 if (print_dump)
1774 iwl3945_print_hex_dump(IWL_DL_RX, data, length);
1775}
1776#endif
1777
1778static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv) 1622static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv)
1779{ 1623{
1780 if (priv->hw_setting.shared_virt) 1624 if (priv->hw_setting.shared_virt)
@@ -7895,31 +7739,6 @@ static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR,
7895 show_measurement, store_measurement); 7739 show_measurement, store_measurement);
7896#endif /* CONFIG_IWL3945_SPECTRUM_MEASUREMENT */ 7740#endif /* CONFIG_IWL3945_SPECTRUM_MEASUREMENT */
7897 7741
7898static ssize_t show_rate(struct device *d,
7899 struct device_attribute *attr, char *buf)
7900{
7901 struct iwl3945_priv *priv = dev_get_drvdata(d);
7902 unsigned long flags;
7903 int i;
7904
7905 spin_lock_irqsave(&priv->sta_lock, flags);
7906 if (priv->iw_mode == IEEE80211_IF_TYPE_STA)
7907 i = priv->stations[IWL_AP_ID].current_rate.s.rate;
7908 else
7909 i = priv->stations[IWL_STA_ID].current_rate.s.rate;
7910 spin_unlock_irqrestore(&priv->sta_lock, flags);
7911
7912 i = iwl3945_rate_index_from_plcp(i);
7913 if (i == -1)
7914 return sprintf(buf, "0\n");
7915
7916 return sprintf(buf, "%d%s\n",
7917 (iwl3945_rates[i].ieee >> 1),
7918 (iwl3945_rates[i].ieee & 0x1) ? ".5" : "");
7919}
7920
7921static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL);
7922
7923static ssize_t store_retry_rate(struct device *d, 7742static ssize_t store_retry_rate(struct device *d,
7924 struct device_attribute *attr, 7743 struct device_attribute *attr,
7925 const char *buf, size_t count) 7744 const char *buf, size_t count)
@@ -8210,7 +8029,6 @@ static struct attribute *iwl3945_sysfs_entries[] = {
8210 &dev_attr_measurement.attr, 8029 &dev_attr_measurement.attr,
8211#endif 8030#endif
8212 &dev_attr_power_level.attr, 8031 &dev_attr_power_level.attr,
8213 &dev_attr_rate.attr,
8214 &dev_attr_retry_rate.attr, 8032 &dev_attr_retry_rate.attr,
8215 &dev_attr_rf_kill.attr, 8033 &dev_attr_rf_kill.attr,
8216 &dev_attr_rs_window.attr, 8034 &dev_attr_rs_window.attr,