aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.c
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2008-07-30 11:20:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-22 16:29:50 -0400
commit6f0a2c4dfc96d268233a6a882f3805975f91216c (patch)
treefbc60eec2c3a2f91b06b605ebaaa659d7fd4621b /drivers/net/wireless/iwlwifi/iwl-3945.c
parent9deb1ae572364a37d054d916c5bae858f91a3f9a (diff)
iwlwifi: use generic mac80211 radiotap headers
remove drivers own implementation of radiotap in favor of the generic one provided by mac80211. also remove priv->add_radiotap because it is not used any more. Signed-off-by: Bruno Randolf <br1@einfach.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c104
1 files changed, 7 insertions, 97 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 3f51f363534..8dc26adc197 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -531,99 +531,6 @@ static int iwl3945_is_network_packet(struct iwl3945_priv *priv,
531 } 531 }
532} 532}
533 533
534static void iwl3945_add_radiotap(struct iwl3945_priv *priv,
535 struct sk_buff *skb,
536 struct iwl3945_rx_frame_hdr *rx_hdr,
537 struct ieee80211_rx_status *stats)
538{
539 /* First cache any information we need before we overwrite
540 * the information provided in the skb from the hardware */
541 s8 signal = stats->signal;
542 s8 noise = 0;
543 int rate = stats->rate_idx;
544 u64 tsf = stats->mactime;
545 __le16 phy_flags_hw = rx_hdr->phy_flags, antenna;
546
547 struct iwl3945_rt_rx_hdr {
548 struct ieee80211_radiotap_header rt_hdr;
549 __le64 rt_tsf; /* TSF */
550 u8 rt_flags; /* radiotap packet flags */
551 u8 rt_rate; /* rate in 500kb/s */
552 __le16 rt_channelMHz; /* channel in MHz */
553 __le16 rt_chbitmask; /* channel bitfield */
554 s8 rt_dbmsignal; /* signal in dBm, kluged to signed */
555 s8 rt_dbmnoise;
556 u8 rt_antenna; /* antenna number */
557 } __attribute__ ((packed)) *iwl3945_rt;
558
559 if (skb_headroom(skb) < sizeof(*iwl3945_rt)) {
560 if (net_ratelimit())
561 printk(KERN_ERR "not enough headroom [%d] for "
562 "radiotap head [%zd]\n",
563 skb_headroom(skb), sizeof(*iwl3945_rt));
564 return;
565 }
566
567 /* put radiotap header in front of 802.11 header and data */
568 iwl3945_rt = (void *)skb_push(skb, sizeof(*iwl3945_rt));
569
570 /* initialise radiotap header */
571 iwl3945_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION;
572 iwl3945_rt->rt_hdr.it_pad = 0;
573
574 /* total header + data */
575 put_unaligned_le16(sizeof(*iwl3945_rt), &iwl3945_rt->rt_hdr.it_len);
576
577 /* Indicate all the fields we add to the radiotap header */
578 put_unaligned_le32((1 << IEEE80211_RADIOTAP_TSFT) |
579 (1 << IEEE80211_RADIOTAP_FLAGS) |
580 (1 << IEEE80211_RADIOTAP_RATE) |
581 (1 << IEEE80211_RADIOTAP_CHANNEL) |
582 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
583 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
584 (1 << IEEE80211_RADIOTAP_ANTENNA),
585 &iwl3945_rt->rt_hdr.it_present);
586
587 /* Zero the flags, we'll add to them as we go */
588 iwl3945_rt->rt_flags = 0;
589
590 put_unaligned_le64(tsf, &iwl3945_rt->rt_tsf);
591
592 iwl3945_rt->rt_dbmsignal = signal;
593 iwl3945_rt->rt_dbmnoise = noise;
594
595 /* Convert the channel frequency and set the flags */
596 put_unaligned_le16(stats->freq, &iwl3945_rt->rt_channelMHz);
597 if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK))
598 put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ,
599 &iwl3945_rt->rt_chbitmask);
600 else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK)
601 put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
602 &iwl3945_rt->rt_chbitmask);
603 else /* 802.11g */
604 put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
605 &iwl3945_rt->rt_chbitmask);
606
607 if (rate == -1)
608 iwl3945_rt->rt_rate = 0;
609 else {
610 if (stats->band == IEEE80211_BAND_5GHZ)
611 rate += IWL_FIRST_OFDM_RATE;
612
613 iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee;
614 }
615
616 /* antenna number */
617 antenna = phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK;
618 iwl3945_rt->rt_antenna = le16_to_cpu(antenna) >> 4;
619
620 /* set the preamble flag if we have it */
621 if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK)
622 iwl3945_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
623
624 stats->flag |= RX_FLAG_RADIOTAP;
625}
626
627static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv, 534static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
628 struct iwl3945_rx_mem_buffer *rxb, 535 struct iwl3945_rx_mem_buffer *rxb,
629 struct ieee80211_rx_status *stats) 536 struct ieee80211_rx_status *stats)
@@ -657,9 +564,6 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
657 iwl3945_set_decrypted_flag(priv, rxb->skb, 564 iwl3945_set_decrypted_flag(priv, rxb->skb,
658 le32_to_cpu(rx_end->status), stats); 565 le32_to_cpu(rx_end->status), stats);
659 566
660 if (priv->add_radiotap)
661 iwl3945_add_radiotap(priv, rxb->skb, rx_hdr, stats);
662
663#ifdef CONFIG_IWL3945_LEDS 567#ifdef CONFIG_IWL3945_LEDS
664 if (ieee80211_is_data(hdr->frame_control)) 568 if (ieee80211_is_data(hdr->frame_control))
665 priv->rxtxpackets += len; 569 priv->rxtxpackets += len;
@@ -684,7 +588,6 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
684 u16 rx_stats_noise_diff = le16_to_cpu(rx_stats->noise_diff); 588 u16 rx_stats_noise_diff = le16_to_cpu(rx_stats->noise_diff);
685 u8 network_packet; 589 u8 network_packet;
686 590
687 rx_status.antenna = 0;
688 rx_status.flag = 0; 591 rx_status.flag = 0;
689 rx_status.mactime = le64_to_cpu(rx_end->timestamp); 592 rx_status.mactime = le64_to_cpu(rx_end->timestamp);
690 rx_status.freq = 593 rx_status.freq =
@@ -696,6 +599,13 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
696 if (rx_status.band == IEEE80211_BAND_5GHZ) 599 if (rx_status.band == IEEE80211_BAND_5GHZ)
697 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; 600 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE;
698 601
602 rx_status.antenna = le16_to_cpu(rx_hdr->phy_flags &
603 RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
604
605 /* set the preamble flag if appropriate */
606 if (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK)
607 rx_status.flag |= RX_FLAG_SHORTPRE;
608
699 if ((unlikely(rx_stats->phy_count > 20))) { 609 if ((unlikely(rx_stats->phy_count > 20))) {
700 IWL_DEBUG_DROP 610 IWL_DEBUG_DROP
701 ("dsp size out of range [0,20]: " 611 ("dsp size out of range [0,20]: "